package org.argeo.slc.core.execution;
-import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
import org.argeo.slc.execution.ExecutionContext;
import org.argeo.slc.execution.ExecutionFlow;
import org.argeo.slc.execution.ExecutionFlowDescriptor;
+import org.argeo.slc.execution.ExecutionFlowDescriptorConverter;
import org.argeo.slc.execution.ExecutionModule;
import org.argeo.slc.execution.ExecutionModuleDescriptor;
import org.argeo.slc.execution.ExecutionSpec;
import org.argeo.slc.execution.ExecutionSpecAttribute;
-import org.argeo.slc.process.SlcExecution;
import org.springframework.aop.scope.ScopedObject;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.generic.GenericBeanFactoryAccessor;
private ExecutionContext executionContext;
- public ExecutionContext getExecutionContext() {
- return executionContext;
- }
-
- public void setExecutionContext(ExecutionContext executionContext) {
- this.executionContext = executionContext;
- }
+ private ExecutionFlowDescriptorConverter descriptorConverter = new DefaultDescriptorConverter();
public ExecutionModuleDescriptor getDescriptor() {
ExecutionModuleDescriptor md = new ExecutionModuleDescriptor();
+ value.getClass().getName());
}
values.put(key, refValue);
+ } else if (attribute instanceof ResourceSpecAttribute) {
+ PrimitiveValue primitiveValue = new PrimitiveValue();
+ primitiveValue
+ .setType(((ResourceSpecAttribute) attribute)
+ .getType());
+ primitiveValue.setValue(value);
+ values.put(key, primitiveValue);
} else {
throw new SlcException("Unkown spec attribute type "
+ attribute.getClass());
ExecutionFlowDescriptor efd = new ExecutionFlowDescriptor(name,
values, executionSpec);
+ if (executionFlow.getPath() != null)
+ efd.setPath(executionFlow.getPath());
// Add execution spec if necessary
if (!md.getExecutionSpecs().contains(executionSpec))
return md;
}
- public void execute(ExecutionFlowDescriptor descriptor) {
+ public void execute(ExecutionFlowDescriptor executionFlowDescriptor) {
+ if (descriptorConverter != null)
+ executionContext.addVariables(descriptorConverter
+ .convertValues(executionFlowDescriptor));
ExecutionFlow flow = (ExecutionFlow) applicationContext.getBean(
- descriptor.getName(), ExecutionFlow.class);
- flow.execute();
+ executionFlowDescriptor.getName(), ExecutionFlow.class);
+ flow.run();
}
public void setApplicationContext(ApplicationContext applicationContext)
this.applicationContext = applicationContext;
}
+ public void setExecutionContext(ExecutionContext executionContext) {
+ this.executionContext = executionContext;
+ }
+
+ public void setDescriptorConverter(
+ ExecutionFlowDescriptorConverter descriptorConverter) {
+ this.descriptorConverter = descriptorConverter;
+ }
+
}