diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-03-16 23:17:35 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-03-16 23:17:35 +0000 |
commit | 15cb80cb8e53910e05f6d6f6d8ed4536eb335eba (patch) | |
tree | 7dba4a4eb1c55fa254b1875544b1b52d365d796b /java/sca/modules | |
parent | 9084bd19216f4865f63d7d68f3d4c3ac6f9d37f4 (diff) |
Add missing composites and use SCA-Composite header
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@755037 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules')
8 files changed, 26 insertions, 13 deletions
diff --git a/java/sca/modules/implementation-osgi-runtime/pom.xml b/java/sca/modules/implementation-osgi-runtime/pom.xml index b7ac27f7e0..91ee8e3e24 100644 --- a/java/sca/modules/implementation-osgi-runtime/pom.xml +++ b/java/sca/modules/implementation-osgi-runtime/pom.xml @@ -155,6 +155,13 @@ </dependency> <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-extensibility-equinox</artifactId> + <version>2.0-SNAPSHOT</version> + <scope>test</scope> + </dependency> + + <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.5</version> diff --git a/java/sca/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/test/CalculatorOSGiNodeTestCase.java b/java/sca/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/test/CalculatorOSGiNodeTestCase.java index 1dee0b1ae7..04341bcd3f 100644 --- a/java/sca/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/test/CalculatorOSGiNodeTestCase.java +++ b/java/sca/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/test/CalculatorOSGiNodeTestCase.java @@ -102,7 +102,8 @@ public class CalculatorOSGiNodeTestCase { new String[] {"OSGI-INF/add-component.xml", "OSGI-INF/subtract-component.xml", "OSGI-INF/multiply-component.xml", - "OSGI-INF/divide-component.xml"}, + "OSGI-INF/divide-component.xml", + "calculator/dosgi/operations/operations.composite"}, OperationsActivator.class, AddService.class, AddServiceImpl.class, diff --git a/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/META-INF/MANIFEST.MF b/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/META-INF/MANIFEST.MF index f0f640541f..5973372d7c 100644 --- a/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/META-INF/MANIFEST.MF +++ b/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/META-INF/MANIFEST.MF @@ -16,3 +16,4 @@ Eclipse-LazyStart: true Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
Bundle-DocURL: http://www.apache.org/
Service-Component: OSGI-INF/calculator-component.xml
+SCA-Composite: calculator/dosgi/calculator.composite
diff --git a/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/operations/META-INF/MANIFEST.MF b/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/operations/META-INF/MANIFEST.MF index 2dbead0b88..d353e7edb6 100644 --- a/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/operations/META-INF/MANIFEST.MF +++ b/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/operations/META-INF/MANIFEST.MF @@ -17,3 +17,4 @@ Service-Component: OSGI-INF/add-component.xml, OSGI-INF/subtract-component.xml,
OSGI-INF/multiply-component.xml,
OSGI-INF/divide-component.xml
+SCA-Composite: calculator/dosgi/operations/operations.composite
diff --git a/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/operations/operations.composite b/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/operations/operations.composite index 14c2b6a4e4..964be5643e 100644 --- a/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/operations/operations.composite +++ b/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/operations/operations.composite @@ -25,14 +25,6 @@ <component name="OperationsComponent">
<tuscany:implementation.osgi bundleSymbolicName="calculator.dosgi.operations" bundleVersion="1.0.0" />
- <service name="AddService">
- </service>
- <service name="SubtractService">
- </service>
- <service name="MultiplyService">
- </service>
- <service name="DivideService">
- </service>
</component>
</composite>
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) { |