summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/node-impl-osgi/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'java/sca/modules/node-impl-osgi/src/main')
-rw-r--r--java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/impl/NodeActivator.java1
-rw-r--r--java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/impl/NodeImpl.java5
-rw-r--r--java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/impl/NodeManager.java13
3 files changed, 15 insertions, 4 deletions
diff --git a/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/impl/NodeActivator.java b/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/impl/NodeActivator.java
index 42ae9d89f3..a67a7c0a45 100644
--- a/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/impl/NodeActivator.java
+++ b/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/impl/NodeActivator.java
@@ -75,6 +75,7 @@ public class NodeActivator implements BundleActivator, SynchronousBundleListener
public void bundleChanged(BundleEvent event) {
if (event.getType() == BundleEvent.STARTING) {
if (isSCABundle(event.getBundle())) {
+ bundleContext.removeBundleListener(this);
init();
}
}
diff --git a/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/impl/NodeImpl.java b/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/impl/NodeImpl.java
index 8ecb8b968d..2b74720a53 100644
--- a/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/impl/NodeImpl.java
+++ b/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/impl/NodeImpl.java
@@ -147,7 +147,10 @@ public class NodeImpl implements Node, Client {
modelFactories.getFactory(NodeImplementationFactory.class);
ConfiguredNodeImplementation configuration = nodeImplementationFactory.createConfiguredNodeImplementation();
- String compositeURI = "OSGI-INF/sca/bundle.composite";
+ String compositeURI = (String)bundle.getHeaders().get("SCA-Composite");
+ if (compositeURI == null) {
+ compositeURI = "OSGI-INF/sca/bundle.composite";
+ }
if (compositeURI != null) {
Composite composite = assemblyFactory.createComposite();
composite.setURI(compositeURI);
diff --git a/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/impl/NodeManager.java b/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/impl/NodeManager.java
index 68575b6c74..0dccdd95e9 100644
--- a/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/impl/NodeManager.java
+++ b/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/impl/NodeManager.java
@@ -23,6 +23,8 @@ import java.util.Dictionary;
import java.util.Enumeration;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -35,6 +37,7 @@ import org.osgi.framework.SynchronousBundleListener;
* Managing the mapping between OSGi bundles and SCA implementation.osgi
*/
public class NodeManager implements SynchronousBundleListener, ServiceListener {
+ private static final Logger logger = Logger.getLogger(NodeManager.class.getName());
private BundleContext bundleContext;
private Map<Bundle, NodeImpl> nodes = new ConcurrentHashMap<Bundle, NodeImpl>();
@@ -84,9 +87,13 @@ public class NodeManager implements SynchronousBundleListener, ServiceListener {
if (!isSCABundle(bundle)) {
return;
}
- NodeImpl node = new NodeImpl(bundle);
- nodes.put(bundle, node);
- node.start();
+ try {
+ NodeImpl node = new NodeImpl(bundle);
+ nodes.put(bundle, node);
+ node.start();
+ } catch (Throwable e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ }
}
private void bundleStopping(Bundle bundle) {