Package org.milyn.cdr

Examples of org.milyn.cdr.SmooksConfigurationException


                }
                fieldNames += field.getName();
            }
        }

        throw new SmooksConfigurationException("Invalid field name '" + fieldName + "'.  Valid names: [" + fieldNames + "].");
    }
View Full Code Here


        if (setterMethod == null && property == null ) {
            if(isBeanWiring && (beanRuntimeInfo.getClassification() == Classification.NON_COLLECTION || beanRuntimeInfo.getClassification() == Classification.MAP_COLLECTION)) {
                // Default the property name if it's a wiring...
                property = wireBeanIdName;
          } else if(beanRuntimeInfo.getClassification() == Classification.NON_COLLECTION){
            throw new SmooksConfigurationException("Binding configuration for beanIdName='" + beanIdName + "' must contain " +
                    "either a 'property' or 'setterMethod' attribute definition, unless the target bean is a Collection/Array." +
                    "  Bean is type '" + beanRuntimeInfo.getPopulateType().getName() + "'.");
          }
        }
View Full Code Here

                ((Map)bean).put(mapPropertyName, dataObject);
            } else if(beanType == Classification.ARRAY_COLLECTION || beanType == Classification.COLLECTION_COLLECTION) {
                ((Collection)bean).add(dataObject);
            } else if(propertySetterMethod == null) {
              if(setterMethod != null) {
                    throw new SmooksConfigurationException("Bean [" + beanIdName + "] configuration invalid.  Bean setter method [" + setterMethod + "(" + dataObject.getClass().getName() + ")] not found on type [" + beanRuntimeInfo.getPopulateType().getName() + "].  You may need to set a 'decoder' on the binding config.");
                } else if(property != null) {
                    boolean throwException = true;

                    if (beanRuntimeInfo.isJAXBType() && getWiredBeanRuntimeInfo().getClassification() != BeanRuntimeInfo.Classification.NON_COLLECTION) {
                        // It's a JAXB collection type.  If the wired in bean is created by a factory then it's most
                        // probable that there's no need to set the collection because the JAXB type is creating it lazily
                        // in the getter method.  So... we're going to ignore this.
                        if (wireBeanId.getCreateResourceConfiguration().getParameter("beanFactory") != null) {
                            throwException = false;
                        }
                    }

                    if (throwException) {
                        throw new SmooksConfigurationException("Bean [" + beanIdName + "] configuration invalid.  Bean setter method [" + ClassUtil.toSetterName(property) + "(" + dataObject.getClass().getName() + ")] not found on type [" + beanRuntimeInfo.getPopulateType().getName() + "].  You may need to set a 'decoder' on the binding config.");
                    }
                }
            }

            if(notifyPopulate) {
                BeanContextLifecycleEvent event = new BeanContextLifecycleEvent(executionContext, source, BeanLifecycle.POPULATE, beanId, bean);
                executionContext.getBeanContext().notifyObservers(event);
            }
        } catch (IllegalAccessException e) {
            throw new SmooksConfigurationException("Error invoking bean setter method [" + ClassUtil.toSetterName(property) + "] on bean instance class type [" + bean.getClass() + "].", e);
        } catch (InvocationTargetException e) {
            throw new SmooksConfigurationException("Error invoking bean setter method [" + ClassUtil.toSetterName(property) + "] on bean instance class type [" + bean.getClass() + "].", e);
        }
    }
View Full Code Here

        // Get the bean instance from the request.  If there is non, it's a bad config!!
        bean =  execContext.getBeanContext().getBean(beanId);

        if (bean == null) {
            throw new SmooksConfigurationException("Bean instance [" + beanId + "] not available and bean runtime class not set on configuration.");
        }

        return bean;
    }
View Full Code Here

                addFieldBindings(bean);

                listBean.addVisitors(visitorMap);
            } else if(bindingType == CSVBindingType.MAP) {
                if(bindMapKeyField == null) {
                    throw new SmooksConfigurationException("CSV 'MAP' Binding must specify a 'keyField' property on the binding configuration.");
                }

                assertValidFieldName(bindMapKeyField);

                Bean mapBean = new Bean(LinkedHashMap.class, bindBeanId, "$document");
View Full Code Here

                }
                fieldNames += field.getName();
            }
        }

        throw new SmooksConfigurationException("Invalid field name '" + fieldName + "'.  Valid names: [" + fieldNames + "].");
    }
View Full Code Here

    @Initialize
    public void intitialize() throws SmooksConfigurationException {
        statementExec = new StatementExec(statement);
        if(statementExec.getStatementType() == StatementType.QUERY && resultSetName == null) {
            throw new SmooksConfigurationException("Sorry, query statements must be accompanied by a 'resultSetName' property, under whose value the query results are bound.");
        }

        if(resultSetName != null) {
          resultSetBeanId = appContext.getBeanIdStore().register(resultSetName);
        }
View Full Code Here

      return jmsSession.createTextMessage( text );
    }
    catch (JMSException e)
    {
      final String errorMsg = "JMSException while trying to create TextMessae";
      throw new SmooksConfigurationException( errorMsg, e );
    }
  }
View Full Code Here

      return session.createObjectMessage( object );
    }
    catch (JMSException e)
    {
      final String errorMsg = "JMSException while trying to set JMS Header Fields";
      throw new SmooksConfigurationException( errorMsg, e );
    }
  }
View Full Code Here

    private BeanId beanId;
    @Initialize
    public void initialize() throws SmooksConfigurationException {

      if(StringUtils.isEmpty(lookupName) && StringUtils.isEmpty(query)) {
        throw new SmooksConfigurationException("A lookup name or  a query  needs to be set to be able to lookup anything");
      }

      if(StringUtils.isNotEmpty(lookupName) && StringUtils.isNotEmpty(query)) {
        throw new SmooksConfigurationException("Both the lookup name and the query can't be set at the same time");
      }

      beanId = appContext.getBeanIdStore().register(beanIdName);

      parameterIndex = ParameterManager.initializeParameterIndex(id, parameterListType, appContext);
View Full Code Here

TOP

Related Classes of org.milyn.cdr.SmooksConfigurationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.