diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-07-15 04:01:28 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-07-15 04:01:28 +0000 |
commit | e3676a116b86bc61f7cb218f6f5bb4ca21f20d8e (patch) | |
tree | aad402e310ef24207554ff28c04b22f373e038fc /tags/java/sca/2.0-M3-RC4/modules/sca-api/src/main/java/org/oasisopen/sca/client/SCAClientFactory.java | |
parent | 7cbc3e0383d1e4a97e89a01f34ee412a142ebc9a (diff) |
Java SCA 2.0-M3 RC4 tag
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@794135 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'tags/java/sca/2.0-M3-RC4/modules/sca-api/src/main/java/org/oasisopen/sca/client/SCAClientFactory.java')
-rw-r--r-- | tags/java/sca/2.0-M3-RC4/modules/sca-api/src/main/java/org/oasisopen/sca/client/SCAClientFactory.java | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/tags/java/sca/2.0-M3-RC4/modules/sca-api/src/main/java/org/oasisopen/sca/client/SCAClientFactory.java b/tags/java/sca/2.0-M3-RC4/modules/sca-api/src/main/java/org/oasisopen/sca/client/SCAClientFactory.java new file mode 100644 index 0000000000..e2abcf08e4 --- /dev/null +++ b/tags/java/sca/2.0-M3-RC4/modules/sca-api/src/main/java/org/oasisopen/sca/client/SCAClientFactory.java @@ -0,0 +1,89 @@ +/* + * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved. + * OASIS trademark, IPR and other policies apply. + */ +package org.oasisopen.sca.client; + +import java.util.Properties; + +import org.oasisopen.sca.client.impl.SCAClientFactoryFinder; + +/** + * The SCAClientFactory can be used by non-SCA managed code to lookup services + * that exist in a SCADomain. + * + * @see SCAClientFactoryFinder + * @see SCAClient + * @author OASIS Open + */ +public abstract class SCAClientFactory { + + /** + * 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. + * + * @return A new SCAClient + */ + public static SCAClient newInstance() { + return newInstance(null, null); + } + + /** + * 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 + */ + public static SCAClient newInstance(Properties properties) { + return newInstance(properties, null); + } + + /** + * 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 + */ + public static SCAClient newInstance(ClassLoader classLoader) { + return newInstance(null, classLoader); + } + + /** + * 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 + */ + public static SCAClient newInstance(Properties properties, ClassLoader classLoader) { + final SCAClientFactory factory; + if (defaultFactory == null) { + factory = SCAClientFactoryFinder.find(properties, classLoader); + } else { + factory = defaultFactory; + } + return factory.createSCAClient(); + } + + /** + * This method is invoked to create a new SCAClient instance. + * + * @return A new SCAClient instance + */ + protected abstract SCAClient createSCAClient(); +} |