X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=runtime%2Forg.argeo.slc.core%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fcore%2Fexecution%2Fgenerator%2FExecutionFlowGenerator.java;h=0269e72994b4cad5202c9997546fd221664a7cc7;hb=f41c54f9803f2617287cec0515e140f22687fac9;hp=5451402ff6255d13bdfee837a22c79cf73082a90;hpb=78c26de935d15dafb2a6bfd81be4d3bb3ae61b23;p=gpl%2Fargeo-slc.git diff --git a/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/generator/ExecutionFlowGenerator.java b/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/generator/ExecutionFlowGenerator.java index 5451402ff..0269e7299 100644 --- a/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/generator/ExecutionFlowGenerator.java +++ b/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/generator/ExecutionFlowGenerator.java @@ -15,7 +15,6 @@ import org.springframework.beans.factory.config.RuntimeBeanReference; import org.springframework.beans.factory.support.BeanDefinitionRegistry; import org.springframework.beans.factory.support.GenericBeanDefinition; import org.springframework.core.Ordered; -import org.springframework.core.PriorityOrdered; /** * Generates ExecutionFlows and Runnables as @@ -26,12 +25,8 @@ import org.springframework.core.PriorityOrdered; * Application Context after configuring the ExecutionContext, * and outputs of a RunnableFactory. */ -/** - * @author Olivier Capillon - * - */ public class ExecutionFlowGenerator implements BeanFactoryPostProcessor, - PriorityOrdered { + Ordered { private final Log log = LogFactory.getLog(getClass()); @@ -63,6 +58,14 @@ public class ExecutionFlowGenerator implements BeanFactoryPostProcessor, * RunnableCallFlow beans. */ private String contextValuesBeanName = "executionFlowGenerator.contextValues"; + + /** + * Prefix added to the bean names defined in each + * RunnableCallFlowDescriptor + */ + private String flowBeanNamesPrefix = ""; + + private int order = Ordered.HIGHEST_PRECEDENCE; public void postProcessBeanFactory( ConfigurableListableBeanFactory beanFactory) throws BeansException { @@ -100,11 +103,13 @@ public class ExecutionFlowGenerator implements BeanFactoryPostProcessor, GenericBeanDefinition flowBean = new GenericBeanDefinition(); flowBean.setBeanClass(RunnableCallFlow.class); + String beanName = flowBeanNamesPrefix + flowDescriptor.getBeanName(); + MutablePropertyValues mpv = new MutablePropertyValues(); mpv.addPropertyValue("runnableCalls", flowDescriptor.getRunnableCalls()); mpv.addPropertyValue("sharedContextValuesMap", new RuntimeBeanReference(contextValuesBeanName)); - mpv.addPropertyValue("name", flowDescriptor.getBeanName()); + mpv.addPropertyValue("name", beanName); mpv.addPropertyValue("path", flowDescriptor.getPath()); mpv.addPropertyValue("executionContext", new RuntimeBeanReference(executionContextBeanName)); @@ -113,9 +118,9 @@ public class ExecutionFlowGenerator implements BeanFactoryPostProcessor, // register it if(log.isDebugEnabled()) { - log.debug("Registering bean definition for RunnableCallFlow " + flowDescriptor.getBeanName()); + log.debug("Registering bean definition for RunnableCallFlow " + beanName); } - registry.registerBeanDefinition(flowDescriptor.getBeanName(), flowBean); + registry.registerBeanDefinition(beanName, flowBean); } /** @@ -132,7 +137,11 @@ public class ExecutionFlowGenerator implements BeanFactoryPostProcessor, } public int getOrder() { - return Ordered.HIGHEST_PRECEDENCE; + return order; + } + + public void setOrder(int order) { + this.order = order; } public void setSource(ExecutionFlowGeneratorSource source) { @@ -151,5 +160,7 @@ public class ExecutionFlowGenerator implements BeanFactoryPostProcessor, this.contextValuesBeanName = contextValuesBeanName; } - + public void setFlowBeanNamesPrefix(String flowBeanNamesPrefix) { + this.flowBeanNamesPrefix = flowBeanNamesPrefix; + } }