X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;ds=inline;f=runtime%2Forg.argeo.slc.support.osgi%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fosgi%2FOsgiExecutionModulesManager.java;h=c5d23589ef03ee09c5a53429359a7e36a412567d;hb=aee87eeef820af87f18c2cf2e9b86b612393f7db;hp=6625ebd3b53fbacbc79c31360328111f1bc1fff8;hpb=c3483ee56ab0083c5be7636c500963dffdc058a3;p=gpl%2Fargeo-slc.git diff --git a/runtime/org.argeo.slc.support.osgi/src/main/java/org/argeo/slc/osgi/OsgiExecutionModulesManager.java b/runtime/org.argeo.slc.support.osgi/src/main/java/org/argeo/slc/osgi/OsgiExecutionModulesManager.java index 6625ebd3b..c5d23589e 100644 --- a/runtime/org.argeo.slc.support.osgi/src/main/java/org/argeo/slc/osgi/OsgiExecutionModulesManager.java +++ b/runtime/org.argeo.slc.support.osgi/src/main/java/org/argeo/slc/osgi/OsgiExecutionModulesManager.java @@ -67,6 +67,47 @@ public class OsgiExecutionModulesManager extends private Boolean registerFlowsToJmx = true; + public void init() throws Exception { + final String module = System.getProperty(UNIQUE_LAUNCH_MODULE_PROPERTY); + final String flow = System.getProperty(UNIQUE_LAUNCH_FLOW_PROPERTY); + if (module != null) { + // launch a flow and stops + new Thread("Unique Flow") { + @Override + public void run() { + try { + bundlesManager.startSynchronous(bundlesManager + .findRelatedBundle(bundlesManager + .findFromPattern(module))); + RealizedFlow lastLaunch = findRealizedFlow(module, flow); + if (lastLaunch == null) + throw new SlcException("Cannot find launch for " + + module + " " + flow); + execute(lastLaunch); + } catch (Exception e) { + throw new SlcException( + "Error when executing unique flow " + flow + + " on " + module, e); + } finally { + try { + bundlesManager.getBundleContext().getBundle(0) + .stop(); + System.exit(0); + } catch (Exception e) { + log.error("Cannot shutdown equinox.", e); + System.exit(1); + } + } + } + }.start(); + } + + } + + public void destroy() { + + } + public synchronized ExecutionModuleDescriptor getExecutionModuleDescriptor( String moduleName, String version) { ExecutionModuleDescriptor md = new ExecutionModuleDescriptor(); @@ -142,11 +183,10 @@ public class OsgiExecutionModulesManager extends protected ExecutionFlowDescriptorConverter findExecutionFlowDescriptorConverter( String moduleName, String moduleVersion) { - String filter = "(&(Bundle-SymbolicName=" + moduleName + ")(Bundle-Version=" + moduleVersion + "))"; return bundlesManager.getSingleService( - ExecutionFlowDescriptorConverter.class, filter); + ExecutionFlowDescriptorConverter.class, filter, false); } /**