Package org.milyn.cdr

Examples of org.milyn.cdr.SmooksConfigurationException


   */
  public void visitBefore(Element element, ExecutionContext executionContext)
      throws SmooksException {

    if(!isCreateOnElementSet(element) && !isWireOnElementSet(element)) {
      throw new SmooksConfigurationException("The bindings attribute 'createOnElement' and wiring attribute 'wireOnElement' " +
          "are both not set. One of them must at least be set. If the result of this binding should be a new populated Object " +
          "then you need to set the 'createOnElement' bindings attribute. If you want to update an existing object in the bean " +
          "context then you must set the 'wireOnElement' attribute.");
    }

View Full Code Here


    public void initialize() throws SmooksConfigurationException, JMSException {
        Context context = null;
        boolean initialized = false;

        if(beanId == null) {
            throw new SmooksConfigurationException("Mandatory 'beanId' property not defined.");
        }
        if(jmsProperties.getDestinationName() == null) {
            throw new SmooksConfigurationException("Mandatory 'destinationName' property not defined.");
        }

        try
        {
            if(correlationIdPattern != null) {
                correlationIdTemplate = new FreeMarkerTemplate(correlationIdPattern);
            }

            Properties jndiContextProperties = jndiProperties.toProperties();

            if(jndiContextProperties.isEmpty()) {
                context = new InitialContext();
            } else {
                context = new InitialContext(jndiContextProperties);
            }
            destination = (Destination) context.lookup( jmsProperties.getDestinationName() );
            msgProducer = createMessageProducer( destination, context );
            setMessageProducerProperties( );

            initialized = true;
        }
        catch (NamingException e)
        {
            final String errorMsg = "NamingException while trying to lookup [" + jmsProperties.getDestinationName() + "]";
            logger.error( errorMsg, e );
            throw new SmooksConfigurationException( errorMsg, e );
        } finally {
            if ( context != null )
            {
                try { context.close(); } catch (NamingException e) { logger.debug( "NamingException while trying to close initial Context"); }
            }
View Full Code Here

    }
    catch( JMSException e)
    {
      final String errorMsg = "JMSException while trying to create MessageProducer for Queue [" + jmsProperties.getDestinationName() + "]";
            releaseJMSResources();
            throw new SmooksConfigurationException( errorMsg, e );
    }
    catch (NamingException e)
    {
      final String errorMsg = "NamingException while trying to lookup ConnectionFactory [" + jmsProperties.getConnectionFactoryName() + "]";
            releaseJMSResources();
      throw new SmooksConfigurationException( errorMsg, e );
    }

    return msgProducer;
  }
View Full Code Here

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

    public static SmooksResourceConfiguration findBeanCreatorConfig(String beanId, ExecutionContext executionContext) {
        ExtensionContext extensionContext = ExtensionContext.getExtensionContext(executionContext);
        List<SmooksResourceConfiguration> creatorConfigs = extensionContext.lookupResource(new ConfigSearch().resource(BeanInstanceCreator.class.getName()).param("beanId", beanId));

        if(creatorConfigs.size() > 1) {
            throw new SmooksConfigurationException("Multiple <jb:bean> configurations exist for beanId '" + beanId + "'.  'beanId' values must be unique.");
        }

        return creatorConfigs.get(0);
    }
View Full Code Here

        SmooksResourceConfiguration dmbWriterConfig = extensionContext.getResourceStack().peek();
        if(dmbWriterConfig.getStringParameter("beanClass") == null) {
            String beanId = dmbWriterConfig.getStringParameter("beanId");

            if(beanId == null) {
                throw new SmooksConfigurationException("One of the 'beanClass' or 'beanId' attributes must be configured on the <dmb:writer> configuration.");               
            }

            SmooksResourceConfiguration beanCreatorConfig = BeanConfigUtil.findBeanCreatorConfig(beanId, executionContext);
            if(beanCreatorConfig == null) {
                throw new SmooksConfigurationException("Cannot find <jb:bean> configuration for beanId '" + beanId + "' for <dmb:writer>.  Reordered <dmb:writer> after <jb:bean> config.");
            }

            String beanClass = beanCreatorConfig.getStringParameter(BeanConfigUtil.BEAN_CLASS_CONFIG);
            if(beanClass == null) {
                throw new SmooksConfigurationException("Cannot create find BeanWriter for beanId '" + beanId + "'.  The associated <jb:bean> configuration does not define a bean Class name.");
            }

            dmbWriterConfig.setParameter(BeanConfigUtil.BEAN_CLASS_CONFIG, beanClass);
        }
    }
View Full Code Here

        boolean isBeanIdRefSpecified = element.hasAttribute("beanIdRef");
        boolean isBeanTypeSpecified = element.hasAttribute("beanType");
        boolean isBeanAnnotationSpecified = element.hasAttribute("beanAnnotation");

        if(!isBeanIdRefSpecified && !isBeanTypeSpecified && !isBeanAnnotationSpecified) {
          throw new SmooksConfigurationException("One or more of attributes 'beanIdRef', 'beanType' and 'beanAnnotation' must be specified on a bean wiring configuration.");
        }
    }
View Full Code Here

            } else if(javaResource instanceof BeanInstancePopulator) {
                BeanInstancePopulator beanPopulator = (BeanInstancePopulator) javaResource;
                Bean bean = baseBeans.get(beanPopulator.getBeanId());

                if(bean == null) {
                    throw new SmooksConfigurationException("Unexpected binding configuration exception.  Unknown parent beanId '' for binding configuration.");
                }

                if(beanPopulator.isBeanWiring()) {
                    bean.getBindings().add(new WiredBinding(beanPopulator));
                } else {
View Full Code Here

            Bean bean = baseBeans.get(beanId);

            if(bean != null) {
                resourceConfiguration.setSelectorSteps(concat(bean.getConfig().getSelectorSteps(), selectorSteps));
            } else if(failOnMissingBean) {
                throw new SmooksConfigurationException("Invalid selector '" + SelectorStepBuilder.toString(selectorSteps) + "'.  Unknown beanId '" + beanId + "'.");
            }

        }
    }
View Full Code Here

        if(propertiesFile != null) {
            try {
                URIResourceLocator locator = new URIResourceLocator();
                properties.load(locator.getResource(propertiesFile));
            } catch (IOException e) {
                throw new SmooksConfigurationException("Failed to read JMS JNDI properties file '" + propertiesFile + "'.", e);
            }
        }

        if(contextFactory != null) {
            properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, contextFactory);
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.