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=d9400e42edf8b89651b7e4d27e5c3202fa7c7436;hb=a75c0516aca20f9a8c8fdd32feee402257ff2b61;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..d9400e42e 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 @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.argeo.slc.core.execution.generator; import java.util.HashMap; @@ -15,7 +30,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 +40,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 +73,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 +118,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 +133,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 +152,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 +175,7 @@ public class ExecutionFlowGenerator implements BeanFactoryPostProcessor, this.contextValuesBeanName = contextValuesBeanName; } - + public void setFlowBeanNamesPrefix(String flowBeanNamesPrefix) { + this.flowBeanNamesPrefix = flowBeanNamesPrefix; + } }