From 6a633dee838417ed68cf91fbd2e9b3b9fa07bd8f Mon Sep 17 00:00:00 2001 From: jsdelfino Date: Fri, 19 Sep 2008 05:31:14 +0000 Subject: Simplified ServiceDiscoverer. Started to use it to create factories to resolve ClassNotFoundExceptions. Renamed calculator-osgi to calculator-equinox and a few fixes to get it working in Eclipse. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@696924 13f79535-47bb-0310-9956-ffa450edef68 --- .../main/java/org/apache/tuscany/sca/node/SCANodeFactory.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'branches/sca-equinox/modules/node-api/src/main') diff --git a/branches/sca-equinox/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANodeFactory.java b/branches/sca-equinox/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANodeFactory.java index e41afd29c4..2c91032653 100644 --- a/branches/sca-equinox/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANodeFactory.java +++ b/branches/sca-equinox/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANodeFactory.java @@ -123,13 +123,11 @@ public abstract class SCANodeFactory { // final ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); // Use reflection APIs to call ServiceDiscovery to avoid hard dependency to tuscany-extensibility try { - Class discoveryClass = - Class.forName("org.apache.tuscany.sca.extensibility.ServiceDiscovery"); + Class discoveryClass = Class.forName("org.apache.tuscany.sca.extensibility.ServiceDiscovery"); Object instance = discoveryClass.getMethod("getInstance").invoke(null); - Class factoryImplClass = - (Class)discoveryClass.getMethod("loadFirstServiceClass", Class.class) - .invoke(instance, SCANodeFactory.class); - if (factoryImplClass != null) { + Object factoryDeclaration = discoveryClass.getMethod("getFirstServiceDeclaration", String.class).invoke(instance, SCANodeFactory.class.getName()); + if (factoryDeclaration != null) { + Class factoryImplClass = (Class)factoryDeclaration.getClass().getMethod("loadClass").invoke(factoryDeclaration); scaNodeFactory = (SCANodeFactory)factoryImplClass.newInstance(); return scaNodeFactory; } -- cgit v1.2.3