summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/node-api/src
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-10-28 19:29:50 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-10-28 19:29:50 +0000
commit3ab338ad0b521192e72a4e1da2e6fae0f45b38ae (patch)
tree14b6aab8959c1e79b4578a1617966c96cf329a45 /java/sca/modules/node-api/src
parentc13b16cafe0cd2999754186270f6b8e03baefe6d (diff)
Pass ServiceRegistry via extensionPointRegistry to remove static references
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@830738 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/node-api/src')
-rw-r--r--java/sca/modules/node-api/src/main/java/org/apache/tuscany/sca/node/NodeFactory.java14
1 files changed, 8 insertions, 6 deletions
diff --git a/java/sca/modules/node-api/src/main/java/org/apache/tuscany/sca/node/NodeFactory.java b/java/sca/modules/node-api/src/main/java/org/apache/tuscany/sca/node/NodeFactory.java
index 24dac505ef..a4daa2177d 100644
--- a/java/sca/modules/node-api/src/main/java/org/apache/tuscany/sca/node/NodeFactory.java
+++ b/java/sca/modules/node-api/src/main/java/org/apache/tuscany/sca/node/NodeFactory.java
@@ -166,8 +166,8 @@ public abstract class NodeFactory extends DefaultNodeConfigurationFactory {
Class<?> discoveryClass = Class.forName("org.apache.tuscany.sca.extensibility.ServiceDiscovery");
Object instance = discoveryClass.getMethod("getInstance").invoke(null);
Object factoryDeclaration =
- discoveryClass.getMethod("getServiceDeclaration", String.class).invoke(instance,
- NodeFactory.class.getName());
+ discoveryClass.getMethod("getServiceDeclaration", Class.class).invoke(instance,
+ NodeFactory.class);
if (factoryDeclaration != null) {
Class<?> factoryImplClass =
(Class<?>)factoryDeclaration.getClass().getMethod("loadClass").invoke(factoryDeclaration);
@@ -177,11 +177,13 @@ public abstract class NodeFactory extends DefaultNodeConfigurationFactory {
// Ignore
}
- // Fail back to default impl
- String className = "org.apache.tuscany.sca.node.impl.NodeFactoryImpl";
+ if (nodeFactory == null) {
+ // Fail back to default impl
+ String className = "org.apache.tuscany.sca.node.impl.NodeFactoryImpl";
- Class<?> cls = Class.forName(className);
- nodeFactory = (NodeFactory)cls.newInstance();
+ Class<?> cls = Class.forName(className);
+ nodeFactory = (NodeFactory)cls.newInstance();
+ }
} catch (Exception e) {
throw new ServiceRuntimeException(e);