X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;ds=sidebyside;f=runtime%2Forg.argeo.slc.support.simple%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fcore%2Fexecution%2FInstantiationManager.java;h=c3d844c46c54c01bd267792e6ec1af8d23057d64;hb=63b5eb0bd0b282844093950ba05d77b1fcd0f664;hp=39c2edf7af525ea43d319ac11ca262532afdc4fe;hpb=669315aa5d9016a1e5954e8ef172ba3f29d33087;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 39c2edf7a..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 @@ -14,29 +14,25 @@ public class InstantiationManager { 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() {