import org.springframework.util.ObjectUtils;\r
import org.springframework.util.StringUtils;\r
\r
+/**\r
+ * Spring post processor which ensures that execution parameters are properly\r
+ * set. It is used at two levels: first during instantiation for instantiation\r
+ * parameters which allow to implement templates, then at runtime in order to\r
+ * interpret @{} placeholders when object of scope execution are instantiated.\r
+ */\r
public class ExecutionParameterPostProcessor extends\r
InstantiationAwareBeanPostProcessorAdapter {\r
\r
placeholder).toString();\r
\r
else {// execution\r
- // next call fail if no execution context available\r
+ // next call fail if no execution context available\r
Object obj = executionContext.getVariable(placeholder);\r
if (obj != null) {\r
return obj.toString();\r
return convertedValue.equals(originalValue) ? value\r
: convertedValue;\r
} else if (value instanceof ManagedMap) {\r
- Map mapVal = (Map) value;\r
+ Map<?, ?> mapVal = (Map<?, ?>) value;\r
\r
- Map newContent = new ManagedMap();\r
+ Map<Object, Object> newContent = new ManagedMap();\r
boolean entriesModified = false;\r
- for (Iterator it = mapVal.entrySet().iterator(); it.hasNext();) {\r
- Map.Entry entry = (Map.Entry) it.next();\r
+ for (Iterator<?> it = mapVal.entrySet().iterator(); it.hasNext();) {\r
+ Map.Entry<?, ?> entry = (Map.Entry<?, ?>) it.next();\r
Object key = entry.getKey();\r
int keyHash = (key != null ? key.hashCode() : 0);\r
Object newKey = resolveValue(beanName, bean, key);\r
\r
return entriesModified ? newContent : value;\r
} else if (value instanceof ManagedList) {\r
- List listVal = (List) value;\r
- List newContent = new ManagedList();\r
+ List<?> listVal = (List<?>) value;\r
+ List<Object> newContent = new ManagedList();\r
boolean valueModified = false;\r
\r
for (int i = 0; i < listVal.size(); i++) {\r
}\r
return valueModified ? newContent : value;\r
} else if (value instanceof ManagedSet) {\r
- Set setVal = (Set) value;\r
- Set newContent = new ManagedSet();\r
+ Set<?> setVal = (Set<?>) value;\r
+ Set<Object> newContent = new ManagedSet();\r
boolean entriesModified = false;\r
- for (Iterator it = setVal.iterator(); it.hasNext();) {\r
+ for (Iterator<?> it = setVal.iterator(); it.hasNext();) {\r
Object elem = it.next();\r
int elemHash = (elem != null ? elem.hashCode() : 0);\r
Object newVal = resolveValue(beanName, bean, elem);\r
// previously resolved placeholder value.\r
propVal = parseStringValue(bean, propVal,\r
visitedPlaceholders);\r
- buf.replace(startIndex, endIndex\r
- + placeholderSuffix.length(), propVal);\r
+ buf.replace(startIndex,\r
+ endIndex + placeholderSuffix.length(), propVal);\r
if (log.isTraceEnabled()) {\r
log.trace("Resolved placeholder '" + placeholder + "'");\r
}\r
import org.argeo.slc.execution.ExecutionFlow;\r
import org.argeo.slc.execution.ExecutionSpecAttribute;\r
\r
+/** Manage parameters that need to be set during the instantiation of a flow */\r
public class InstantiationManager {\r
\r
private final static Log log = LogFactory\r
if (flow instanceof DefaultExecutionFlow) {\r
((DefaultExecutionFlow) flow).setBeanName(flowName);\r
}\r
- \r
+\r
if (log.isTraceEnabled())\r
log.trace("Start initialization of " + flow.hashCode() + " ("\r
+ flow + " - " + flow.getClass() + ")");\r
if (log.isTraceEnabled())\r
log.trace("Finish initialization of " + flow.hashCode() + " ("\r
+ flow + " - " + flow.getClass() + ")");\r
- \r
- if(flowStack.get() != null) {\r
+\r
+ if (flowStack.get() != null) {\r
ExecutionFlow registeredFlow = flowStack.get().pop();\r
if (registeredFlow != null) {\r
if (!flow.getName().equals(registeredFlow.getName()))\r
// log.info("# flowInitializationFinished " + flowName);\r
// initializingFlow.set(null);\r
}\r
- }\r
- else {\r
+ } else {\r
// happens for flows imported as services\r
log.warn("flowInitializationFinished - Flow Stack is null");\r
}\r
import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import java.util.concurrent.ArrayBlockingQueue;
-import java.util.concurrent.BlockingQueue;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.argeo.slc.process.SlcExecution;
/** Thread of the SLC Process, starting the sub executions. */
+@SuppressWarnings("deprecation")
public class ProcessThread extends Thread {
private final static Log log = LogFactory.getLog(ProcessThread.class);
private Boolean hadAnError = false;
private Boolean killed = false;
- private final static Integer STEPS_BUFFER_CAPACITY = 10000;
- private BlockingQueue<ExecutionStep> steps = new ArrayBlockingQueue<ExecutionStep>(
- STEPS_BUFFER_CAPACITY);
-
public ProcessThread(ThreadGroup processesThreadGroup,
ExecutionModulesManager executionModulesManager,
ExecutionProcess process) {
* Implementation specific execution. To be overridden in order to deal with
* custom process types. Default expects an {@link SlcExecution}.
*/
- @SuppressWarnings("deprecation")
protected void process() throws InterruptedException {
if (!(process instanceof SlcExecution))
throw new SlcException("Unsupported process type "
import org.argeo.slc.process.SlcExecutionStep;
/** The thread group attached to a given {@link SlcExecution}. */
+@SuppressWarnings("deprecation")
public class ProcessThreadGroup extends ThreadGroup {
private final ExecutionModulesManager executionModulesManager;
private final ProcessThread processThread;
this.processThread = processThread;
}
- // public SlcExecution getSlcProcess() {
- // return processThread.getSlcProcess();
- // }
-
public void dispatchAddStep(ExecutionStep step) {
// legacy
ExecutionProcess slcProcess = processThread.getProcess();
*/
protected String getExecDirToUse() {
try {
- File dir = null;
if (execDir != null) {
return execDir;
- // Replace '/' by local file separator, for portability
- // execDir.replace('/', File.separatorChar);
- // dir = new File(execDir).getCanonicalFile();
- // dir = execDir.;
}
-
- if (dir == null)
- return System.getProperty("user.dir");
- else
- return dir.getPath();
+ return System.getProperty("user.dir");
} catch (Exception e) {
throw new SlcException("Cannot find exec dir", e);
}
import org.apache.commons.logging.LogFactory;
import org.argeo.slc.SlcException;
import org.argeo.slc.core.execution.DefaultExecutionFlow;
+import org.argeo.slc.execution.ExecutionFlow;
import org.springframework.beans.factory.config.BeanDefinitionHolder;
import org.springframework.beans.factory.config.RuntimeBeanReference;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.w3c.dom.Attr;
import org.w3c.dom.Node;
+/** Publishes a {@link Runnable} as an {@link ExecutionFlow} */
public class AsFlowDecorator implements BeanDefinitionDecorator {
private Log log = LogFactory.getLog(AsFlowDecorator.class);
String attrValue = ((Attr) node).getValue();
if (attrValue.charAt(attrValue.length() - 1) == '/')
throw new SlcException(attrValue + " cannot end with a path");
- // int lastSlash = attrValue.lastIndexOf('/');
- // String path;
- // String flowBeanName;
- // if (lastSlash > 0) {
- // flowBeanName = attrValue.substring(lastSlash + 1);
- // path = attrValue.substring(0, lastSlash);
- // } else if (lastSlash == 0) {
- // flowBeanName = attrValue.substring(lastSlash + 1);
- // path = null;
- // } else {
- // flowBeanName = attrValue;
- // path = null;
- // }
- //
final String flowBeanName = attrValue;
- final String path = null;
if (log.isTraceEnabled())
- log.debug("path=" + path + ", flowBeanName=" + flowBeanName);
+ log.trace("flowBeanName=" + flowBeanName);
if (ctx.getRegistry().containsBeanDefinition(flowBeanName))
throw new SlcException("A bean named " + flowBeanName
else
executables.add(new RuntimeBeanReference(beanName));
- if (path != null)
- flow.addPropertyValue("path", path);
+ // if (path != null)
+ // flow.addPropertyValue("path", path);
flow.addPropertyValue("executables", executables);
if (beanName != null)
* A basic bean implementation of a <code>WritableTestRun</code>, holding\r
* references to the various parts of a test run.\r
*/\r
+@SuppressWarnings("deprecation")\r
public class SimpleTestRun implements WritableTestRun, ExecutableTestRun,\r
SlcExecutionRelated, StructureAware<TreeSPath> {\r
private String uuid;\r
this.slcExecutionStepUuid = slcExecutionStepUuid;\r
}\r
\r
+ @Deprecated\r
public void notifySlcExecution(SlcExecution slcExecution) {\r
if (slcExecution != null) {\r
slcExecutionUuid = slcExecution.getUuid();\r
private TreeSPath path;\r
private StructureRegistry<TreeSPath> registry;\r
\r
- @SuppressWarnings("unchecked")\r
+ @SuppressWarnings({ "unchecked", "rawtypes" })\r
public void execute(TestRun testRun) {\r
if (log.isTraceEnabled())\r
log.trace("Execute sequence of test definitions...");\r
for (TestDefinition task : tasks) {\r
TestResult result = testRun.getTestResult();\r
if (result instanceof StructureAware) {\r
- ((StructureAware) result).notifyCurrentPath(registry, taskPaths\r
- .get(i));\r
+ ((StructureAware) result).notifyCurrentPath(registry,\r
+ taskPaths.get(i));\r
}\r
\r
task.execute(testRun);\r
* \r
* @see TreeTestResult\r
*/\r
+@Deprecated\r
public interface TreeTestResultDao extends TestResultDao<TreeTestResult> {\r
/** Lists results containing this path */\r
public List<TreeTestResult> listResults(TreeSPath path);\r
* \r
* @see TreeTestResult\r
*/\r
+@Deprecated\r
public class TreeTestResultPersister implements\r
TestResultListener<TreeTestResult> {\r
private static Log log = LogFactory.getLog(TreeTestResultPersister.class);\r
import org.argeo.slc.process.SlcExecution;
+@Deprecated
public class SlcExecutionRequest implements Serializable {
private static final long serialVersionUID = 4448081961875614441L;
private SlcExecution slcExecution;
\r
import java.io.Serializable;\r
\r
+@Deprecated\r
public class SlcExecutionStatusRequest implements Serializable {\r
private static final long serialVersionUID = -6495004680978575999L;\r
private String slcExecutionUuid;\r
import org.argeo.slc.execution.ExecutionStep;\r
import org.argeo.slc.process.SlcExecutionStep;\r
\r
+@Deprecated\r
public class SlcExecutionStepsRequest implements Serializable {\r
private static final long serialVersionUID = 6243880315234605390L;\r
private String slcExecutionUuid;\r
\r
package org.argeo.slc.process;\r
\r
+@Deprecated\r
public interface SlcExecutionAware {\r
public void notifySlcExecution(SlcExecution slcExecution);\r
}\r
final SlcExecution slcExecution = (SlcExecution) convertFrom(message);
new Thread() {
public void run() {
- runSlcExecution(slcExecution);
+ process(slcExecution);
}
}.start();
return ExecutionAnswer.ok("Execution started on agent "
package org.argeo.slc.osgi;
-/** A structured set of OSGi bundles. */
+/** <b>Experimental</b> A structured set of OSGi bundles. */
public interface BundleRegister {
/**
* @param pkg
import java.util.HashSet;
import java.util.Properties;
import java.util.Set;
-import java.util.StringTokenizer;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
import org.apache.commons.logging.LogFactory;
import org.osgi.framework.Constants;
+/** <b>Experimental</b> */
public class FileSystemBundleRegister implements BundleRegister {
private final static Log log = LogFactory
.getLog(FileSystemBundleRegister.class);
-
- private File baseDirectory;
-
private Properties packagesBundles = null;
public String bundleProvidingPackage(String pkg, String version) {