public SmooksResourceConfiguration findBeanCreatorConfig(String beanId, ExtensionContext extensionContext) { List<SmooksResourceConfiguration> creatorConfigs = extensionContext.lookupResource(new ConfigSearch().resource(BeanInstancePopulator.class.getName()).param("wireBeanId", beanId)); if(creatorConfigs.size() > 1) { throw new SmooksConfigurationException("Multiple <jb:wiring> configurations exist for beanId '" + beanId + "'. " + "In this case you must set the selector in the '" + selectorAttrName + "' attribute because Smooks can't select a sensible default."); } if(creatorConfigs.size() == 1) { return creatorConfigs.get(0); } return null; }
public SmooksResourceConfiguration findBeanCreatorConfig(String beanId, ExtensionContext extensionContext) { 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 + "'. " + "In this case you must set the selector in the '" + selectorAttrName + "' attribute because Smooks can't select a sensible default."); } if(creatorConfigs.size() == 1) { return creatorConfigs.get(0); } return null; }
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); } }
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); } }
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); } }
public void visitBefore(Element element, ExecutionContext executionContext) throws SmooksException { ExtensionContext extensionContext = ExtensionContext.getExtensionContext(executionContext); // The current config on the stack must be a <jb:bean>... SmooksResourceConfiguration beanConfig = (SmooksResourceConfiguration) extensionContext.getResourceStack().peek(); String retain = beanConfig.getStringParameter("retain"); // If the "retain" attribute is not configured we configure it. If // this is the first bean config, we set it to "true" (i.e. retain it), // otherwise set it to "false" (i.e. do not retain it)... if(retain == null) { List<SmooksResourceConfiguration> creatorConfigs = extensionContext.lookupResource(new ConfigSearch().resource(BeanInstanceCreator.class.getName())); if(!creatorConfigs.isEmpty()) { // This is not the first bean config... set retain to "false" beanConfig.setParameter("retain", "false"); } } } }
public void visitBefore(Element element, ExecutionContext executionContext) throws SmooksException { ExtensionContext extensionContext = ExtensionContext.getExtensionContext(executionContext); // The current config on the stack must be a <jb:bean>... SmooksResourceConfiguration beanConfig = (SmooksResourceConfiguration) extensionContext.getResourceStack().peek(); String retain = beanConfig.getStringParameter("retain"); // If the "retain" attribute is not configured we configure it. If // this is the first bean config, we set it to "true" (i.e. retain it), // otherwise set it to "false" (i.e. do not retain it)... if(retain == null) { List<SmooksResourceConfiguration> creatorConfigs = extensionContext.lookupResource(new ConfigSearch().resource(BeanInstanceCreator.class.getName())); if(!creatorConfigs.isEmpty()) { // This is not the first bean config... set retain to "false" beanConfig.setParameter("retain", "false"); } } } }
public void visitBefore(Element element, ExecutionContext executionContext) throws SmooksException { ExtensionContext extensionContext = ExtensionContext.getExtensionContext(executionContext); // The current config on the stack must be a <jb:bean>... SmooksResourceConfiguration beanConfig = (SmooksResourceConfiguration) extensionContext.getResourceStack().peek(); String retain = beanConfig.getStringParameter("retain"); // If the "retain" attribute is not configured we configure it. If // this is the first bean config, we set it to "true" (i.e. retain it), // otherwise set it to "false" (i.e. do not retain it)... if(retain == null) { List<SmooksResourceConfiguration> creatorConfigs = extensionContext.lookupResource(new ConfigSearch().resource(BeanInstanceCreator.class.getName())); if(!creatorConfigs.isEmpty()) { // This is not the first bean config... set retain to "false" beanConfig.setParameter("retain", "false"); } } } }