diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2008-09-19 05:31:14 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2008-09-19 05:31:14 +0000 |
commit | 6a633dee838417ed68cf91fbd2e9b3b9fa07bd8f (patch) | |
tree | 658d78b2087d2f851518be4d27ed9d913ac47ebb /branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany | |
parent | bd126f649a92dd53cd3b3ccef5029ab273436291 (diff) |
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
Diffstat (limited to 'branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany')
4 files changed, 7 insertions, 5 deletions
diff --git a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/DefaultContextFactoryExtensionPoint.java b/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/DefaultContextFactoryExtensionPoint.java index 5a0aefe55d..7a35036f03 100644 --- a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/DefaultContextFactoryExtensionPoint.java +++ b/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/DefaultContextFactoryExtensionPoint.java @@ -23,6 +23,7 @@ import java.lang.reflect.Constructor; import java.util.HashMap; import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.extensibility.ServiceDeclaration; import org.apache.tuscany.sca.extensibility.ServiceDiscovery; /** @@ -93,8 +94,9 @@ public class DefaultContextFactoryExtensionPoint implements ContextFactoryExtens // Dynamically load a factory class declared under META-INF/services try { - Class<?> factoryClass = ServiceDiscovery.getInstance().loadFirstServiceClass(factoryInterface); - if (factoryClass != null) { + ServiceDeclaration factoryDeclaration = ServiceDiscovery.getInstance().getFirstServiceDeclaration(factoryInterface.getName()); + if (factoryDeclaration != null) { + Class<?> factoryClass = factoryDeclaration.loadClass(); // Default empty constructor Constructor<?> constructor = factoryClass.getConstructor(ExtensionPointRegistry.class); diff --git a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/DefaultEndpointResolverFactoryExtensionPoint.java b/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/DefaultEndpointResolverFactoryExtensionPoint.java index 2849c27c1a..81f619cef3 100644 --- a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/DefaultEndpointResolverFactoryExtensionPoint.java +++ b/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/DefaultEndpointResolverFactoryExtensionPoint.java @@ -100,7 +100,7 @@ public class DefaultEndpointResolverFactoryExtensionPoint implements EndpointRes Set<ServiceDeclaration> factoryDeclarations; ServiceDiscovery serviceDiscovery = ServiceDiscovery.getInstance(); try { - factoryDeclarations = serviceDiscovery.getServiceDeclarations(EndpointResolverFactory.class); + factoryDeclarations = serviceDiscovery.getServiceDeclarations(EndpointResolverFactory.class.getName()); } catch (Exception e) { throw new IllegalStateException(e); } diff --git a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultProviderFactoryExtensionPoint.java b/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultProviderFactoryExtensionPoint.java index dfc3ddb468..0b7b779b46 100644 --- a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultProviderFactoryExtensionPoint.java +++ b/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultProviderFactoryExtensionPoint.java @@ -129,7 +129,7 @@ public class DefaultProviderFactoryExtensionPoint implements ProviderFactoryExte Set<ServiceDeclaration> factoryDeclarations; ServiceDiscovery serviceDiscovery = ServiceDiscovery.getInstance(); try { - factoryDeclarations = serviceDiscovery.getServiceDeclarations(factoryClass); + factoryDeclarations = serviceDiscovery.getServiceDeclarations(factoryClass.getName()); } catch (Exception e) { throw new IllegalStateException(e); } diff --git a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultSCADefinitionsProviderExtensionPoint.java b/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultSCADefinitionsProviderExtensionPoint.java index 068d0d12d7..3e1f1a10c5 100644 --- a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultSCADefinitionsProviderExtensionPoint.java +++ b/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultSCADefinitionsProviderExtensionPoint.java @@ -68,7 +68,7 @@ public class DefaultSCADefinitionsProviderExtensionPoint implements try { defnProviderDecls = - ServiceDiscovery.getInstance().getServiceDeclarations(SCADefinitionsProvider.class); + ServiceDiscovery.getInstance().getServiceDeclarations(SCADefinitionsProvider.class.getName()); for (ServiceDeclaration aDefnProviderDecl : defnProviderDecls) { providerClass = aDefnProviderDecl.loadClass(); |