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%2FDefaultExecutionSpec.java;h=203a12430478d7c225429eccd2b3f4370cdacf72;hb=53146ebdda3a7c0c217c44d395d270a7e9d045be;hp=6711f658da53f5ad75332de5ff7ca50bc124742e;hpb=743ecb28b3c0236bc91a5d0993f70477236d96fd;p=gpl%2Fargeo-slc.git diff --git a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/DefaultExecutionSpec.java b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/DefaultExecutionSpec.java index 6711f658d..203a12430 100644 --- a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/DefaultExecutionSpec.java +++ b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/DefaultExecutionSpec.java @@ -2,6 +2,8 @@ package org.argeo.slc.core.execution; import java.util.HashMap; import java.util.Map; +import java.util.Stack; +import java.util.UUID; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -12,13 +14,14 @@ import org.argeo.slc.execution.ExecutionSpecAttribute; import org.springframework.beans.factory.BeanNameAware; public class DefaultExecutionSpec implements ExecutionSpec, BeanNameAware { - private final static Log log = LogFactory.getLog(DefaultExecutionSpec.class); - - private final static ThreadLocal initializingFlow = new ThreadLocal(); + private final static Log log = LogFactory + .getLog(DefaultExecutionSpec.class); + +// private final static ThreadLocal > flowStack = new ThreadLocal >(); private Map attributes = new HashMap(); - private String name = null; + private String name = getClass().getName() + "#" + UUID.randomUUID(); public Map getAttributes() { return attributes; @@ -28,25 +31,6 @@ public class DefaultExecutionSpec implements ExecutionSpec, BeanNameAware { this.attributes = attributes; } - public Object createRef(String name) { - ExecutionFlow flow = initializingFlow.get(); - if (flow == null) - throw new SlcException("No flow is currently initializing." - + " Declare flow refs 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 flow.getParameter(name); - } - public void setBeanName(String name) { this.name = name; } @@ -55,37 +39,6 @@ public class DefaultExecutionSpec implements ExecutionSpec, BeanNameAware { return name; } - // FLOWS INITIALIZATION SUPPORT - - public static void flowInitializationStarted(ExecutionFlow flow) { - if (log.isTraceEnabled()) - log.trace("Start initialization of " + flow.hashCode() + " (" - + flow + " - " + flow.getClass() + ")"); - initializingFlow.set(flow); - } - - public static void flowInitializationFinished(ExecutionFlow flow) { - if (log.isTraceEnabled()) - log.trace("Finish initialization of " + flow.hashCode() + " (" - + flow + " - " + flow.getClass() + ")"); - ExecutionFlow registeredFlow = initializingFlow.get(); - if (registeredFlow != null) { - if (!flow.getName().equals(registeredFlow.getName())) - throw new SlcException("Current flow is " + flow); - initializingFlow.set(null); - } - } - - public static Object getInitializingFlowParameter(String key) { - if (initializingFlow.get() == null) - throw new SlcException("No initializing flow available."); - return initializingFlow.get().getParameter(key); - } - - public static Boolean isInFlowInitialization() { - return initializingFlow.get() != null; - } - public boolean equals(Object obj) { return ((ExecutionSpec) obj).getName().equals(name); }