diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2010-01-20 11:03:33 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2010-01-20 11:03:33 +0000 |
commit | 979778896e1561988b376961e936e37c019022fc (patch) | |
tree | 6eee294ef039af3afd025cc59046a58dd0abddb8 /sca-java-2.x/trunk/modules/sca-client-impl/src | |
parent | d93f0ae0212dc48000fbe6145b07e497d7062a6c (diff) |
Update the tuscany sca client impl to match the latest oasis code
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@901127 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/sca-client-impl/src')
3 files changed, 56 insertions, 25 deletions
diff --git a/sca-java-2.x/trunk/modules/sca-client-impl/src/main/java/org/apache/tuscany/sca/client/impl/SCAClientFactoryFinderImpl.java b/sca-java-2.x/trunk/modules/sca-client-impl/src/main/java/org/apache/tuscany/sca/client/impl/SCAClientFactoryFinderImpl.java new file mode 100644 index 0000000000..6bbc2b48e9 --- /dev/null +++ b/sca-java-2.x/trunk/modules/sca-client-impl/src/main/java/org/apache/tuscany/sca/client/impl/SCAClientFactoryFinderImpl.java @@ -0,0 +1,49 @@ +/*
+ * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved.
+ * OASIS trademark, IPR and other policies apply.
+ */
+package org.apache.tuscany.sca.client.impl;
+
+import java.net.URI;
+import java.util.Properties;
+
+import org.oasisopen.sca.NoSuchDomainException;
+import org.oasisopen.sca.ServiceRuntimeException;
+import org.oasisopen.sca.client.SCAClientFactory;
+import org.oasisopen.sca.client.SCAClientFactoryFinder;
+
+/**
+ * A Tuscany specific implementation of an SCAClientFactoryFinder which finds
+ * hard codes the use of the Tuscany SCAClientFactory instead of doscovering it.
+ *
+ * @see SCAClientFactoryFinder
+ * @see SCAClientFactory
+ */
+public class SCAClientFactoryFinderImpl implements SCAClientFactoryFinder {
+
+ /**
+ * Public Constructor
+ */
+ public SCAClientFactoryFinderImpl() {
+ }
+
+ /**
+ * Creates an instance of the SCAClientFactorySPI implementation.
+ * This discovers the SCAClientFactorySPI Implementation and instantiates
+ * the provider's implementation.
+ *
+ * @param properties Properties that may be used when creating a new
+ * instance of the SCAClient
+ * @param classLoader ClassLoader that may be used when creating a new
+ * instance of the SCAClient
+ * @return new instance of the SCAClientFactory
+ * @throws ServiceRuntimeException Failed to create SCAClientFactory
+ * Implementation.
+ */
+ public SCAClientFactory find(Properties properties,
+ ClassLoader classLoader,
+ URI domainURI ) throws NoSuchDomainException, ServiceRuntimeException {
+ return new SCAClientFactoryImpl(domainURI);
+ }
+
+}
diff --git a/sca-java-2.x/trunk/modules/sca-client-impl/src/main/java/org/apache/tuscany/sca/client/impl/SCAClientFactoryImpl.java b/sca-java-2.x/trunk/modules/sca-client-impl/src/main/java/org/apache/tuscany/sca/client/impl/SCAClientFactoryImpl.java index ec9d073ca9..7afc6bbe07 100644 --- a/sca-java-2.x/trunk/modules/sca-client-impl/src/main/java/org/apache/tuscany/sca/client/impl/SCAClientFactoryImpl.java +++ b/sca-java-2.x/trunk/modules/sca-client-impl/src/main/java/org/apache/tuscany/sca/client/impl/SCAClientFactoryImpl.java @@ -20,7 +20,6 @@ package org.apache.tuscany.sca.client.impl; import java.net.URI; -import java.net.URISyntaxException; import java.util.List; import org.apache.tuscany.sca.node.Node; @@ -29,23 +28,18 @@ import org.oasisopen.sca.NoSuchDomainException; import org.oasisopen.sca.NoSuchServiceException; import org.oasisopen.sca.ServiceUnavailableException; import org.oasisopen.sca.client.SCAClientFactory; +import org.oasisopen.sca.client.SCAClientFactoryFinder; public class SCAClientFactoryImpl extends SCAClientFactory { - - // required when a registry is used to create the factory - // need to extend to have domain uri configuration - public SCAClientFactoryImpl() throws URISyntaxException { - super(new URI(Node.DEFAULT_DOMAIN_URI)); - } - public SCAClientFactoryImpl(URI domainURI) { + public static void setSCAClientFactoryFinder(SCAClientFactoryFinder factoryFinder) { + SCAClientFactory.factoryFinder = factoryFinder; + } + + public SCAClientFactoryImpl(URI domainURI) throws NoSuchDomainException { super(domainURI); } - public static void setDefaultClientFactory(SCAClientFactory clientFactory){ - defaultFactory = clientFactory; - } - @Override public <T> T getService(Class<T> serviceInterface, String serviceName) throws NoSuchServiceException, NoSuchDomainException { URI domainURI = getDomainURI(); diff --git a/sca-java-2.x/trunk/modules/sca-client-impl/src/main/java/org/apache/tuscany/sca/client/impl/SCAClientModuleActivator.java b/sca-java-2.x/trunk/modules/sca-client-impl/src/main/java/org/apache/tuscany/sca/client/impl/SCAClientModuleActivator.java index 8501b37b24..64f982796c 100644 --- a/sca-java-2.x/trunk/modules/sca-client-impl/src/main/java/org/apache/tuscany/sca/client/impl/SCAClientModuleActivator.java +++ b/sca-java-2.x/trunk/modules/sca-client-impl/src/main/java/org/apache/tuscany/sca/client/impl/SCAClientModuleActivator.java @@ -21,26 +21,14 @@ package org.apache.tuscany.sca.client.impl; import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.core.ModuleActivator; -import org.oasisopen.sca.client.SCAClientFactory; public class SCAClientModuleActivator implements ModuleActivator { - private ExtensionPointRegistry registry; - public SCAClientModuleActivator(ExtensionPointRegistry registry) { - this.registry = registry; } public void start() { - // look up the SCAClientFactory. We could instantiate one directly here but - // looking it up brings the META-INF/services mechanism into play - SCAClientFactory clientFactory = registry.getExtensionPoint(SCAClientFactory.class); - - // inject this client factory as the default client factory - // so that the SCAClientFactory interface doesn't have to use the - // finder to look for it. - // TODO - handle multiple domains - SCAClientFactoryImpl.setDefaultClientFactory(clientFactory); + SCAClientFactoryImpl.setSCAClientFactoryFinder(new SCAClientFactoryFinderImpl()); } public void stop() { |