diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2010-01-20 11:02:48 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2010-01-20 11:02:48 +0000 |
commit | d93f0ae0212dc48000fbe6145b07e497d7062a6c (patch) | |
tree | 5a11619af0dafa88ac533383df4b607290d2da4c /sca-java-2.x/trunk/modules/sca-api/src/main/java/org/oasisopen/sca/client/SCAClientFactory.java | |
parent | c4ba5b60d5b730e44405dc7e9b795d8b789cd825 (diff) |
Update the client api classes to be the very latest from the oasis svn
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@901126 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/sca-api/src/main/java/org/oasisopen/sca/client/SCAClientFactory.java')
-rw-r--r-- | sca-java-2.x/trunk/modules/sca-api/src/main/java/org/oasisopen/sca/client/SCAClientFactory.java | 144 |
1 files changed, 85 insertions, 59 deletions
diff --git a/sca-java-2.x/trunk/modules/sca-api/src/main/java/org/oasisopen/sca/client/SCAClientFactory.java b/sca-java-2.x/trunk/modules/sca-api/src/main/java/org/oasisopen/sca/client/SCAClientFactory.java index e96969c99d..cb9fb1b34b 100644 --- a/sca-java-2.x/trunk/modules/sca-api/src/main/java/org/oasisopen/sca/client/SCAClientFactory.java +++ b/sca-java-2.x/trunk/modules/sca-api/src/main/java/org/oasisopen/sca/client/SCAClientFactory.java @@ -1,6 +1,6 @@ -/* - * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved. - * OASIS trademark, IPR and other policies apply. +/* + * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved. + * OASIS trademark, IPR and other policies apply. */ package org.oasisopen.sca.client; @@ -9,28 +9,49 @@ import java.util.Properties; import org.oasisopen.sca.NoSuchDomainException; import org.oasisopen.sca.NoSuchServiceException; -import org.oasisopen.sca.client.impl.SCAClientFactoryFinder; +import org.oasisopen.sca.client.SCAClientFactoryFinder; +import org.oasisopen.sca.client.impl.SCAClientFactoryFinderImpl; /** - * The SCAClientFactory can be used by non-SCA managed code to lookup services - * that exist in a SCADomain. + * The SCAClientFactory can be used by non-SCA managed code to + * lookup services that exist in a SCADomain. + * + * @see SCAClientFactoryFinderImpl * - * @see SCAClientFactoryFinder - * @see SCAClient * @author OASIS Open */ + public abstract class SCAClientFactory { - + + /** + * The SCAClientFactoryFinder. + * Provides a means by which a provider of an SCAClientFactory + * implementation can inject a factory finder implementation into + * the abstract SCAClientFactory class - once this is done, future + * invocations of the SCAClientFactory use the injected factory + * finder to locate and return an instance of a subclass of + * SCAClientFactory. + */ + protected static SCAClientFactoryFinder factoryFinder; + /** + * The Domain URI of the SCA Domain which is accessed by this + * SCAClientFactory + */ private URI domainURI; + /** + * Prevent concrete subclasses from using the no-arg constructor + */ private SCAClientFactory() { } /** * Constructor used by concrete subclasses - * @param domainURI - The Domain URI of the Domain accessed via this SCAClientFactory + * @param domainURI - The Domain URI of the Domain accessed via this + * SCAClientFactory */ - protected SCAClientFactory(URI domainURI) { + protected SCAClientFactory(URI domainURI) + throws NoSuchDomainException { this.domainURI = domainURI; } @@ -41,69 +62,73 @@ public abstract class SCAClientFactory { protected URI getDomainURI() { return domainURI; } - + + /** - * The default implementation of the SCAClientFactory. A Vendor may use - * reflection to inject a default SCAClientFactory instance that will be - * used in the newInstance() methods rather than using the - * SCAClientFactoryFinder. - */ - protected static SCAClientFactory defaultFactory; - - /** - * Creates a new instance of the SCAClient that can be used to lookup SCA - * Services. + * Creates a new instance of the SCAClientFactory that can be + * used to lookup SCA Services. * - * @return A new SCAClient + * @param domainURI URI of the target domain for the SCAClientFactory + * @return A new SCAClientFactory */ - public static SCAClientFactory newInstance(URI domainURI) throws NoSuchDomainException { + public static SCAClientFactory newInstance( URI domainURI ) + throws NoSuchDomainException { return newInstance(null, null, domainURI); } - + /** - * Creates a new instance of the SCAClient that can be used to lookup SCA - * Services. - * - * @param properties Properties that may be used when creating a new - * instance of the SCAClient - * @return A new SCAClient instance + * Creates a new instance of the SCAClientFactory that can be + * used to lookup SCA Services. + * + * @param properties Properties that may be used when + * creating a new instance of the SCAClientFactory + * @param domainURI URI of the target domain for the SCAClientFactory + * @return A new SCAClientFactory instance */ - public static SCAClientFactory newInstance(Properties properties, URI domainURI) { + public static SCAClientFactory newInstance(Properties properties, + URI domainURI) + throws NoSuchDomainException { return newInstance(properties, null, domainURI); } /** - * Creates a new instance of the SCAClient that can be used to lookup SCA - * Services. - * - * @param classLoader ClassLoader that may be used when creating a new - * instance of the SCAClient - * @return A new SCAClient instance + * Creates a new instance of the SCAClientFactory that can be + * used to lookup SCA Services. + * + * @param classLoader ClassLoader that may be used when + * creating a new instance of the SCAClientFactory + * @param domainURI URI of the target domain for the SCAClientFactory + * @return A new SCAClientFactory instance */ - public static SCAClientFactory newInstance(ClassLoader classLoader, URI domainURI) { + public static SCAClientFactory newInstance(ClassLoader classLoader, + URI domainURI) + throws NoSuchDomainException { return newInstance(null, classLoader, domainURI); } /** - * Creates a new instance of the SCAClient that can be used to lookup SCA - * Services. - * - * @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 A new SCAClient instance + * Creates a new instance of the SCAClientFactory that can be + * used to lookup SCA Services. + * + * @param properties Properties that may be used when + * creating a new instance of the SCAClientFactory + * @param classLoader ClassLoader that may be used when + * creating a new instance of the SCAClientFactory + * @param domainURI URI of the target domain for the SCAClientFactory + * @return A new SCAClientFactory instance */ - public static SCAClientFactory newInstance(Properties properties, ClassLoader classLoader, URI domainURI) { - final SCAClientFactory factory; - if (defaultFactory == null) { - factory = SCAClientFactoryFinder.find(properties, classLoader, domainURI); - } else { - factory = defaultFactory; - } + public static SCAClientFactory newInstance(Properties properties, + ClassLoader classLoader, + URI domainURI) + throws NoSuchDomainException { + final SCAClientFactoryFinder finder = + factoryFinder != null ? factoryFinder : + new SCAClientFactoryFinderImpl(); + final SCAClientFactory factory + = finder.find(properties, classLoader, domainURI); return factory; } - + /** * Returns a reference proxy that implements the business interface <T> * of a service in the SCA Domain handled by this SCAClientFactory @@ -112,15 +137,16 @@ public abstract class SCAClientFactory { * form componentName/serviceName. * Can also take the extended form componentName/serviceName/bindingName * to use a specific binding of the target service - * - * @param interfaze The business interface class of the service in the + * + * @param interfaze The business interface class of the service in the * domain * @param <T> The business interface class of the service in the domain * - * @return a proxy to the target service, in the specified SCA Domain + * @return a proxy to the target service, in the specified SCA Domain * that implements the business interface <B>. * @throws NoSuchServiceException Service requested was not found * @throws NoSuchDomainException Domain requested was not found */ - public abstract <T> T getService(Class<T> interfaze, String serviceURI) throws NoSuchServiceException, NoSuchDomainException; + public abstract <T> T getService(Class<T> interfaze, String serviceURI) + throws NoSuchServiceException, NoSuchDomainException; } |