X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;ds=sidebyside;f=org.argeo.slc.core%2Fsrc%2Forg%2Fargeo%2Fslc%2Fosgi%2FOsgiExecutionModulesManager.java;h=046cfb6464301e2245c00669efe90535c48a5146;hb=9e581505a7009f32cdc1eceb39dc89e77ce2a22f;hp=68fcead713e53873713a7c87f2466e0dbeabf523;hpb=805e3301575e708491482a2a00dd37bc2b41b851;p=gpl%2Fargeo-slc.git diff --git a/org.argeo.slc.core/src/org/argeo/slc/osgi/OsgiExecutionModulesManager.java b/org.argeo.slc.core/src/org/argeo/slc/osgi/OsgiExecutionModulesManager.java index 68fcead71..046cfb646 100644 --- a/org.argeo.slc.core/src/org/argeo/slc/osgi/OsgiExecutionModulesManager.java +++ b/org.argeo.slc.core/src/org/argeo/slc/osgi/OsgiExecutionModulesManager.java @@ -46,6 +46,7 @@ import org.argeo.slc.execution.ExecutionFlowDescriptorConverter; import org.argeo.slc.execution.ExecutionModuleDescriptor; import org.argeo.slc.execution.ExecutionModulesListener; import org.argeo.slc.execution.RealizedFlow; +import org.eclipse.gemini.blueprint.service.importer.OsgiServiceLifecycleListener; import org.osgi.framework.Bundle; import org.osgi.framework.BundleEvent; import org.osgi.framework.BundleException; @@ -53,7 +54,6 @@ import org.osgi.framework.BundleListener; import org.osgi.framework.Constants; import org.osgi.framework.launch.Framework; import org.springframework.context.ApplicationContext; -import org.eclipse.gemini.blueprint.service.importer.OsgiServiceLifecycleListener; /** Execution modules manager implementation based on an OSGi runtime. */ public class OsgiExecutionModulesManager extends @@ -225,8 +225,8 @@ public class OsgiExecutionModulesManager extends + flowName + "))" : "(&(Bundle-SymbolicName=" + moduleName + ")(Bundle-Version=" + moduleVersion - + ")(org.eclipse.gemini.blueprint.bean.name=" + flowName - + "))"; + + ")(org.eclipse.gemini.blueprint.bean.name=" + + flowName + "))"; return bundlesManager.getSingleServiceStrict(ExecutionFlow.class, filter, true); } @@ -346,7 +346,7 @@ public class OsgiExecutionModulesManager extends + bundle.getSymbolicName() + ")"; try { bundlesManager.getServiceRefSynchronous( - ApplicationContext.class.getName(), filter); + ApplicationContext.class, filter); } catch (Exception e) { // stop if application context not found bundle.stop(); @@ -457,6 +457,9 @@ public class OsgiExecutionModulesManager extends /** Unregisters an execution context. */ public synchronized void unregister(ExecutionContext executionContext, Map properties) { + // FIXME why are properties null? + if (properties == null) + return; OsgiBundle osgiBundle = asOsgiBundle(properties); if (executionContexts.containsKey(osgiBundle)) { executionContexts.remove(osgiBundle); @@ -493,6 +496,9 @@ public class OsgiExecutionModulesManager extends /** Unregisters an execution flow. */ public synchronized void unregister(ExecutionFlow executionFlow, Map properties) { + // FIXME why are properties null? + if (properties == null) + return; OsgiBundle osgiBundle = asOsgiBundle(properties); if (executionFlows.containsKey(osgiBundle)) { Set flows = executionFlows.get(osgiBundle); @@ -625,33 +631,32 @@ public class OsgiExecutionModulesManager extends } } - @SuppressWarnings("deprecation") protected ObjectName flowMBeanName(Module module, ExecutionFlow executionFlow) { String executionModulesPrefix = "SLCExecutionModules"; - String path = executionFlow.getPath(); + // String path = executionFlow.getPath(); String name = executionFlow.getName(); - if (path == null && name.indexOf('/') >= 0) { - path = name.substring(0, name.lastIndexOf('/')); - name = name.substring(name.lastIndexOf('/')); - } + // if (path == null && name.indexOf('/') >= 0) { + // path = name.substring(0, name.lastIndexOf('/')); + // name = name.substring(name.lastIndexOf('/')); + // } StringBuffer buf = new StringBuffer(executionModulesPrefix + ":" + "module=" + module.getName() + " [" + module.getVersion() + "],"); - if (path != null && !path.equals("")) { - int depth = 0; - for (String token : path.split("/")) { - if (!token.equals("")) { - buf.append("path").append(depth).append('='); - // in order to have directories first - buf.append('/'); - buf.append(token).append(','); - depth++; - } - } - } + // if (path != null && !path.equals("")) { + // int depth = 0; + // for (String token : path.split("/")) { + // if (!token.equals("")) { + // buf.append("path").append(depth).append('='); + // // in order to have directories first + // buf.append('/'); + // buf.append(token).append(','); + // depth++; + // } + // } + // } buf.append("name=").append(name); try { return new ObjectName(buf.toString());