import org.argeo.jcr.JcrUtils;
import org.argeo.jcr.UserJcrUtils;
+import org.argeo.slc.BasicNameVersion;
+import org.argeo.slc.NameVersion;
import org.argeo.slc.SlcException;
import org.argeo.slc.core.execution.PrimitiveAccessor;
import org.argeo.slc.core.execution.PrimitiveUtils;
return moduleName;
}
+ /** Extracts the module name and version from a flow path */
+ public static NameVersion moduleNameVersion(String fullFlowPath) {
+ String[] tokens = fullFlowPath.split("/");
+ String module = tokens[AGENT_FACTORY_DEPTH + 2];
+ String moduleName = module.substring(0, module.indexOf('_'));
+ String moduleVersion = module.substring(module.indexOf('_') + 1);
+ return new BasicNameVersion(moduleName, moduleVersion);
+ }
+
/** Module node name based on module name and version */
public static String getModuleNodeName(ModuleDescriptor moduleDescriptor) {
return moduleDescriptor.getName() + "_" + moduleDescriptor.getVersion();
import javax.jcr.Node;
import javax.jcr.NodeIterator;
+import javax.jcr.Property;
import javax.jcr.Repository;
import javax.jcr.RepositoryException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.argeo.jcr.JcrUtils;
+import org.argeo.slc.NameVersion;
import org.argeo.slc.SlcException;
+import org.argeo.slc.core.execution.ProcessThread;
import org.argeo.slc.execution.ExecutionProcess;
import org.argeo.slc.execution.ExecutionStep;
import org.argeo.slc.execution.RealizedFlow;
+import org.argeo.slc.jcr.SlcJcrUtils;
import org.argeo.slc.jcr.SlcNames;
import org.argeo.slc.jcr.SlcTypes;
NodeIterator nit = rootRealizedFlowNode.getNodes(SLC_FLOW);
while (nit.hasNext()) {
Node realizedFlowNode = nit.nextNode();
+
+ if (realizedFlowNode.hasNode(SLC_ADDRESS)) {
+ String flowPath = realizedFlowNode.getNode(SLC_ADDRESS)
+ .getProperty(Property.JCR_PATH).getString();
+ NameVersion moduleNameVersion = SlcJcrUtils
+ .moduleNameVersion(flowPath);
+ ((ProcessThread) Thread.currentThread())
+ .getExecutionModulesManager().start(
+ moduleNameVersion);
+ }
+
RealizedFlow realizedFlow = new JcrRealizedFlow(
realizedFlowNode);
if (realizedFlow != null)
OsgiBundle osgiBundle = bundlesManager.findFromPattern(module);
if (osgiBundle == null)
throw new SlcException("No OSGi bundle found for " + module);
- Bundle moduleBundle = bundlesManager.findRelatedBundle(osgiBundle);
- bundlesManager.startSynchronous(moduleBundle);
+ // Bundle moduleBundle =
+ // bundlesManager.findRelatedBundle(osgiBundle);
+ start(osgiBundle);
+
RealizedFlow lastLaunch = findRealizedFlow(module, flow);
if (lastLaunch == null)
throw new SlcException("Cannot find launch for " + module + " "
}
}
+ // public void startExectionModule(String moduleName, String moduleVersion)
+ // {
+ // try {
+ // ServiceReference[] sr = bundlesManager.getServiceRefSynchronous(
+ // ApplicationContext.class.getName(),
+ // "org.springframework.context.service.name=" + moduleName);
+ // // bundlesManager.startSynchronous(moduleBundle);
+ // if (sr == null || sr.length == 0)
+ // throw new SlcException(
+ // "Cannot find execution module application context "
+ // + moduleName);
+ // } catch (InvalidSyntaxException e) {
+ // throw new SlcException("Cannot start exeuction module "
+ // + moduleName, e);
+ // }
+ // }
+
public synchronized ExecutionModuleDescriptor getExecutionModuleDescriptor(
String moduleName, String version) {
ExecutionModuleDescriptor md = new ExecutionModuleDescriptor();