]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/MapExecutionContext.java
Improve SSH support
[gpl/argeo-slc.git] / runtime / org.argeo.slc.support.simple / src / main / java / org / argeo / slc / core / execution / MapExecutionContext.java
index 5d26c52b42fd3d0bbda91618805173d8e9bff9ef..2dc9b867c01595d5aa90b69dce60f3a48b3bead2 100644 (file)
@@ -12,10 +12,9 @@ import org.argeo.slc.SlcException;
 import org.argeo.slc.execution.ExecutionContext;
 import org.argeo.slc.execution.ExecutionFlow;
 import org.argeo.slc.execution.ExecutionSpecAttribute;
-import org.argeo.slc.process.SlcExecution;
-import org.springframework.beans.factory.ObjectFactory;
 
 public class MapExecutionContext implements ExecutionContext {
+
        private final static Log log = LogFactory.getLog(MapExecutionContext.class);
 
        private final Stack<ExecutionFlowRuntime> stack = new Stack<ExecutionFlowRuntime>();
@@ -23,10 +22,15 @@ public class MapExecutionContext implements ExecutionContext {
        // TODO: make it thread safe?
        private final Map<String, Object> variables = new HashMap<String, Object>();
 
-       private final String uuid = UUID.randomUUID().toString();
+       private final String uuid;
 
        private final Date creationDate = new Date();
 
+       public MapExecutionContext() {
+               uuid = UUID.randomUUID().toString();
+               variables.put(VAR_EXECUTION_CONTEXT_ID, uuid);
+       }
+
        public void addVariables(
                        Map<? extends String, ? extends Object> variablesToAdd) {
                variables.putAll(variablesToAdd);
@@ -35,6 +39,8 @@ public class MapExecutionContext implements ExecutionContext {
        public void enterFlow(ExecutionFlow executionFlow) {
                ExecutionFlowRuntime runtime = new ExecutionFlowRuntime(executionFlow);
                stack.push(runtime);
+               variables.put(VAR_FLOW_ID, runtime.getUuid());
+               variables.put(VAR_FLOW_NAME, runtime.getExecutionFlow().getName());
 
                if (log.isDebugEnabled())
                        log.debug(depthSpaces(stack.size()) + "=> " + executionFlow + " #"