summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/node-impl/src
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-05-20 16:46:55 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-05-20 16:46:55 +0000
commitb099739d69690535623b126b37f47bfdfecf040f (patch)
tree252ab5e26d6e6f2c804c43744ff22d68ce3b353f /java/sca/modules/node-impl/src
parentf1863df3c7da7a4632ef3ca70d430d62ed387bad (diff)
Refactoring a few methods on the ServiceDiscover
Adding an OSGi service registry based ExtensionPointRegistry implementation git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@776759 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/node-impl/src')
-rw-r--r--java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java b/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java
index 51a1a6579c..6bca9fc9e7 100644
--- a/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java
+++ b/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java
@@ -149,7 +149,7 @@ public class NodeFactoryImpl extends NodeFactory {
* @throws Exception
*/
private <T> T getFactory(Class<T> factory) throws Exception {
- ServiceDeclaration sd = ServiceDiscovery.getInstance().getFirstServiceDeclaration(factory.getName());
+ ServiceDeclaration sd = ServiceDiscovery.getInstance().getServiceDeclaration(factory.getName());
if (sd != null) {
return factory.cast(sd.loadClass().newInstance());
} else {
@@ -188,9 +188,9 @@ public class NodeFactoryImpl extends NodeFactory {
node.destroy();
}
nodes.clear();
- // Stop the runtime modules
- for (ModuleActivator moduleActivator : moduleActivators) {
- moduleActivator.stop(extensionPoints);
+ // Stop the runtime modules in the reverse order
+ for (int i = moduleActivators.size() - 1; i >= 0; i--) {
+ moduleActivators.get(i).stop(extensionPoints);
}
// Stop and destroy the work manager
@@ -356,7 +356,7 @@ public class NodeFactoryImpl extends NodeFactory {
long start = currentTimeMillis();
// Create extension point registry
- extensionPoints = new DefaultExtensionPointRegistry();
+ extensionPoints = createExtensionPointRegistry();
// Enable schema validation only of the logger level is FINE or higher
ValidationSchemaExtensionPoint schemas =
@@ -471,6 +471,10 @@ public class NodeFactoryImpl extends NodeFactory {
}
}
+ protected ExtensionPointRegistry createExtensionPointRegistry() {
+ return new DefaultExtensionPointRegistry();
+ }
+
Composite configureNode(NodeConfiguration configuration) throws Exception {
List<Contribution> contributions = new ArrayList<Contribution>();