Package org.milyn.cdr

Examples of org.milyn.cdr.SmooksConfigurationException


     *
     * @param fieldName The field name to test.
     */
    public void assertValidFieldName(String fieldName) {
        if (!fieldNames.contains(fieldName)) {
            throw new SmooksConfigurationException("Invalid field name '" + fieldName + "'.  Valid names: "
                    + fieldNames + ".");
        }
    }
View Full Code Here


            ContentHandler groovyResource = (ContentHandler) groovyObject;
            Configurator.configure(groovyResource, configuration);

            return groovyResource;
        } catch (Exception e) {
      throw new SmooksConfigurationException("Error constructing class from Groovy script " + configuration.getResource(), e);
        }
    }
View Full Code Here

        try {
            Class groovyClass = groovyClassLoader.parseClass(templatedClass);
            return groovyClass.newInstance();
        } catch(CompilationFailedException e) {
            throw new SmooksConfigurationException("Failed to compile Groovy scripted Visitor class:\n==========================\n" + templatedClass + "\n==========================\n", e);
        }
    }
View Full Code Here

      beanRuntimeInfo = BeanRuntimeInfo.getBeanRuntimeInfo(beanIdName, beanClassName, appContext);

      if(factory == null) {
        checkForDefaultConstructor();
      } else if (beanRuntimeInfo.getClassification() == Classification.ARRAY_COLLECTION) {
        throw new SmooksConfigurationException("Using a factory with an array is not supported");
      }

        if(logger.isDebugEnabled()) {
          logger.debug("BeanInstanceCreator created for [" + beanIdName + "]. BeanRuntimeInfo: " + beanRuntimeInfo);
        }
View Full Code Here

        if(factory == null) {
          try {
              bean = beanRuntimeInfo.getPopulateType().newInstance();
          } catch (InstantiationException e) {
              throw new SmooksConfigurationException("Unable to create bean instance [" + beanIdName + ":" + beanRuntimeInfo.getPopulateType().getName() + "].", e);
          } catch (IllegalAccessException e) {
              throw new SmooksConfigurationException("Unable to create bean instance [" + beanIdName + ":" + beanRuntimeInfo.getPopulateType().getName() + "].", e);
          }
        } else {
          try {
        bean = factory.create(executionContext);
      } catch (RuntimeException e) {
        throw new SmooksConfigurationException("The factory was unable to create the bean instance [" + beanIdName + "] using the factory '" + factory + "'.", e);
      }
        }

        return bean;
    }
View Full Code Here

   */
  private void checkForDefaultConstructor() {
    try {
      beanRuntimeInfo.getPopulateType().getConstructor();
    } catch (NoSuchMethodException e) {
        throw new SmooksConfigurationException("Invalid Smooks bean configuration.  Bean class " + beanRuntimeInfo.getPopulateType().getName() + " doesn't have a public default constructor.");
    }
  }
View Full Code Here

    private void assertSelectorOK(SmooksResourceConfiguration config) {
        String selector = config.getSelector();

        if(selector != null) {
            if(selector.contains(SmooksResourceConfiguration.DOCUMENT_FRAGMENT_SELECTOR) || selector.contains(SmooksResourceConfiguration.LEGACY_DOCUMENT_FRAGMENT_SELECTOR)) {
                throw new SmooksConfigurationException("Cannot use the document selector with the XMLBinding class.  Must use an absolute path.  Selector value '" + selector + "'.");
            }
            if(!selector.startsWith("/") && !selector.startsWith("${") && !selector.startsWith("#")) {
                throw new SmooksConfigurationException("Invalid selector value '" + selector + "'.  Selector paths must be absolute.");
            }
            rootElementNames.add(config.getSelectorSteps()[0].getTargetElement());
        }
    }
View Full Code Here

            camelRouterObserable = new BeanRouterObserver(this, beanId);
            camelRouterObserable.setConditionEvaluator((ExecutionContextExpressionEvaluator) routingConfig.getConditionEvaluator());
        }

        if(correlationIdName != null && correlationIdPattern == null) {
            throw new SmooksConfigurationException("Camel router component configured with a 'correlationIdName', but 'correlationIdPattern' is not configured.");
        }
        if(correlationIdName == null && correlationIdPattern != null) {
            throw new SmooksConfigurationException("Camel router component configured with a 'correlationIdPattern', but 'correlationIdName' is not configured.");
        }
    }
View Full Code Here

        boolean isPropertSpecified = (DomUtils.getAttributeValue(element, "property") != null);
        boolean isSetterMethodSpecified = (DomUtils.getAttributeValue(element, "setterMethod") != null);
        String bindingType = DomUtils.getName(element);

        if(isPropertSpecified && isSetterMethodSpecified) {
          throw new SmooksConfigurationException("'" + bindingType + "' binding specifies a 'property' and a 'setterMethod' attribute.  Only one of both may be set.");
        }
        if(isPropertSpecified && beanType == BeanType.COLLECTION) {
            throw new SmooksConfigurationException("'" + bindingType + "' binding specifies a 'property' attribute.  This is not valid for a Collection target.");
        }
        if(isPropertSpecified && beanType == BeanType.ARRAY) {
            throw new SmooksConfigurationException("'" + bindingType + "' binding specifies a 'property' attribute.  This is not valid for an Array target.");
        }
        if(isSetterMethodSpecified && beanType == BeanType.COLLECTION) {
            throw new SmooksConfigurationException("'" + bindingType + "' binding specifies a 'setterMethod' attribute.  This is not valid for a Collection target.");
        }
        if(isSetterMethodSpecified && beanType == BeanType.ARRAY) {
            throw new SmooksConfigurationException("'" + bindingType + "' binding specifies a 'setterMethod' attribute.  This is not valid for an Array target.");
        }
        if(!isPropertSpecified && !isSetterMethodSpecified && beanType == BeanType.OTHER) {
            throw new SmooksConfigurationException("'" + bindingType + "' binding for bean class '" + getBeanTypeName(element) + "' must specify a 'property' or 'setterMethod' attribute.");
        }
    }
View Full Code Here

        Class<?> beanClass;
        try {
            beanClass = ClassUtil.forName(beanClassName, getClass());
        } catch (ClassNotFoundException e) {
            throw new SmooksConfigurationException("Bean class '" + beanClassName + "' not avilable on classpath.");
        }
        return beanClass;
    }
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.