Package org.milyn.cdr

Examples of org.milyn.cdr.SmooksResourceConfiguration$ContextIndex


        }
        configurator.getParameters().setProperty("nullValueReplacement", nullValueReplacement);
        configurator.getParameters().setProperty("encoding", encoding.name());

        List<SmooksResourceConfiguration> configList = configurator.toConfig();
        SmooksResourceConfiguration config = configList.get(0);

        if(keyMap != null) {
            Parameter keyMapParam = new Parameter(JSONReader.CONFIG_PARAM_KEY_MAP, keyMap);
            config.setParameter(keyMapParam);
        }

        config.setTargetProfile(targetProfile);

        return configList;
    }
View Full Code Here


  private boolean isXMLTargetedConfiguration(ExecutionContext executionContext) {
    if(isXMLTargetedConfiguration == null) {
      synchronized (this) {       
        if(isXMLTargetedConfiguration == null) {
          SmooksResourceConfiguration readerConfiguration = AbstractParser.getSAXParserConfiguration(executionContext.getDeliveryConfig());
          if(readerConfiguration != null) {
            // We have an reader config, if the class is not configured, we assume
            // the expected Source to be XML...
            isXMLTargetedConfiguration = (readerConfiguration.getResource() == null);
          } else {
            // If no reader config is present at all, we assume the expected Source is XML...
            isXMLTargetedConfiguration = true;
          }
        }
View Full Code Here

 
  private SmooksResourceConfiguration createConfig(
      final String resourceName,
      final String beanId)
  {
      SmooksResourceConfiguration config = new SmooksResourceConfiguration( "x", OutputStreamRouter.class.getName() );
    config.setParameter( "resourceName", resourceName );
    config.setParameter( "beanId", beanId );
    return config;
  }
View Full Code Here

    private BeanId bindBeanId;

    @Initialize
    public void initialize() {
        if(templatingConfiguration != null) {
            SmooksResourceConfiguration config = new SmooksResourceConfiguration();

            config.setResource(templatingConfiguration.getTemplate());

            Usage resultUsage = templatingConfiguration.getUsage();
            if(resultUsage == Inline.ADDTO) {
                action = Action.ADDTO;
            } else if(resultUsage == Inline.REPLACE) {
View Full Code Here

  private static MockQueueConnectionFactory connectionFactory;

  @Test( groups = "integration", expectedExceptions = SmooksConfigurationException.class)
  public void configureWithMissingDestinationType()
  {
      SmooksResourceConfiguration config = new SmooksResourceConfiguration(selector, JMSRouter.class.getName());
        Configurator.configure( new JMSRouter(), config, new MockApplicationContext() );
  }
View Full Code Here

    final String beanId = "beanId";
    final TestBean bean = RouterTestHelper.createBean();

        final MockExecutionContext executionContext = RouterTestHelper.createExecutionContext( beanId, bean );

      SmooksResourceConfiguration config = new SmooksResourceConfiguration(selector, JMSRouter.class.getName());
        config.setParameter( "destinationName", queueName );
        config.setParameter( "beanId", beanId );
        final JMSRouter router = new JMSRouter();
        Configurator.configure( router, config, new MockApplicationContext() );

        router.visitAfter( (SAXElement)null, executionContext );
View Full Code Here

        final String beanId = "beanId";
        final TestBean bean = RouterTestHelper.createBean();

        final MockExecutionContext executionContext = RouterTestHelper.createExecutionContext( beanId, bean );

      SmooksResourceConfiguration config = new SmooksResourceConfiguration(selector, JMSRouter.class.getName());
        config.setParameter( "destinationName", queueName );
        config.setParameter( "beanId", beanId );
        config.setParameter( "highWaterMark", "3" );
        config.setParameter( "highWaterMarkPollFrequency", "200" );
        final JMSRouter router = new JMSRouter();
        Configurator.configure( router, config, new MockApplicationContext() );

        int numMessages = 10;
        ConsumeThread consumeThread = new ConsumeThread(queue, numMessages);
View Full Code Here

* @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a>
*/
public class SetElementDataConfigDigester implements DOMVisitAfter {

    public void visitAfter(Element element, ExecutionContext executionContext) throws SmooksException {
        SmooksResourceConfiguration config = ExtensionContext.getExtensionContext(executionContext).getCurrentConfig();

        config.setParameter(new Parameter(SetElementData.ATTRIBUTE_DATA, "##value_as_xml_element").setXML(element));
    }
View Full Code Here

        executionContext.setAttribute(DOCTYPE_KEY, new DocumentTypeData(name, publicId, systemId, xmlns));
    }

    public static DocumentTypeData getDocType(ExecutionContext executionContext) {
        List<SmooksResourceConfiguration> docTypeUDs = executionContext.getDeliveryConfig().getSmooksResourceConfigurations("doctype");
        SmooksResourceConfiguration docTypeSmooksResourceConfiguration = null;

        if(docTypeUDs != null && docTypeUDs.size() > 0) {
            docTypeSmooksResourceConfiguration = docTypeUDs.get(0);
        }

        // Only use the cdrdef if the override flag is set.  The override flag will
        // cause this DOCTYPE to override any DOCYTPE decl from the source doc.
        if(docTypeSmooksResourceConfiguration != null && docTypeSmooksResourceConfiguration.getBoolParameter("override", true)) {
            String name = docTypeSmooksResourceConfiguration.getStringParameter("name", "!!DOCTYPE name undefined - fix smooks-resource!!");
            String publicId = docTypeSmooksResourceConfiguration.getStringParameter("publicId", "!!DOCTYPE publicId undefined - fix smooks-resource!!");
            String systemId = docTypeSmooksResourceConfiguration.getStringParameter("systemId", "!!DOCTYPE systemId undefined - fix smooks-resource!!");
            String xmlns = docTypeSmooksResourceConfiguration.getStringParameter("xmlns");
            boolean omit = docTypeSmooksResourceConfiguration.getBoolParameter("omit", false);

            return new DocumentTypeData(name, publicId, systemId, xmlns, omit);
        }

        return (DocumentTypeData) executionContext.getAttribute(DOCTYPE_KEY);
View Full Code Here

    @ConfigParam(defaultVal = AnnotationConstants.NULL_STRING)
    private String[] unset;

    public void visitBefore(Element element, ExecutionContext executionContext) throws SmooksException {
        ExtensionContext extensionContext = ExtensionContext.getExtensionContext(executionContext);
        SmooksResourceConfiguration config = (SmooksResourceConfiguration) extensionContext.getResourceStack().peek().clone();

        if(unset != null) {
          for(String property : unset) {
              ResourceConfigUtil.unsetProperty(config, property);
          }
        }

        if(resource != null) {
          config.setResource(resource);
        }

        extensionContext.addResource(config);
    }
View Full Code Here

TOP

Related Classes of org.milyn.cdr.SmooksResourceConfiguration$ContextIndex

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.