X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=runtime%2Forg.argeo.slc.support.simple%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fcore%2Fexecution%2FInstantiationManager.java;h=c3d844c46c54c01bd267792e6ec1af8d23057d64;hb=5ae9dc81ad1c3ddfa99a8456b0c5263dd483642d;hp=143a8f90e823b0eacdb06b851be50da4984176e8;hpb=7fdc9af3e710f0b5e63974aeb4e71e6631fcd1ff;p=gpl%2Fargeo-slc.git diff --git a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/InstantiationManager.java b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/InstantiationManager.java index 143a8f90e..c3d844c46 100644 --- a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/InstantiationManager.java +++ b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/InstantiationManager.java @@ -9,34 +9,30 @@ import org.argeo.slc.execution.ExecutionFlow; public class InstantiationManager { - private final static Log log = LogFactory.getLog(DefaultExecutionSpec.class); + private final static Log log = LogFactory.getLog(InstantiationManager.class); private ThreadLocal > flowStack = new ThreadLocal >(); public Object createRef(String name) { + if((flowStack.get() == null) || flowStack.get().empty()) { throw new SlcException("No flow is currently initializing." - + " Declare flow refs as inner beans or prototypes."); + + " Declare ParameterRef as inner beans or prototypes."); } - - /* - * RefSpecAttribute refSpecAttribute = (RefSpecAttribute) attributes - * .get(name); Class targetClass = refSpecAttribute.getTargetClass(); - * ExecutionTargetSource targetSource = new ExecutionTargetSource(flow, - * targetClass, name); ProxyFactory proxyFactory = new ProxyFactory(); - * proxyFactory.setTargetClass(targetClass); - * proxyFactory.setProxyTargetClass(true); - * proxyFactory.setTargetSource(targetSource); - * - * return proxyFactory.getProxy(); - */ - return flowStack.get().peek().getParameter(name); + + return getInitializingFlowParameter(name); } public void flowInitializationStarted(ExecutionFlow flow, String flowName) { if (log.isTraceEnabled()) log.trace("Start initialization of " + flow.hashCode() + " (" + flow + " - " + flow.getClass() + ")"); + + // set the flow name if it is DefaultExecutionFlow + if(flow instanceof DefaultExecutionFlow) { + ((DefaultExecutionFlow) flow).setBeanName(flowName); + } + // log.info("# flowInitializationStarted " + flowName); // create a stack for this thread if there is none if(flowStack.get() == null) { @@ -69,9 +65,7 @@ public class InstantiationManager { } } throw new SlcException("Key " + key + " is not set as parameter in " - + flowStack.get().firstElement().toString()); - -// return flowStack.get().peek().getParameter(key); + + flowStack.get().firstElement().toString() + " (stack size="+flowStack.get().size()+")"); } public Boolean isInFlowInitialization() {