You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by an...@apache.org on 2010/04/08 12:42:00 UTC

svn commit: r931861 - in /tuscany/sca-java-2.x/trunk/modules/sca-api/src/main/java/org/oasisopen/sca/client: SCAClientFactory.java SCAClientFactoryFinder.java impl/SCAClientFactoryFinderImpl.java

Author: antelder
Date: Thu Apr  8 10:41:59 2010
New Revision: 931861

URL: http://svn.apache.org/viewvc?rev=931861&view=rev
Log:
Update sca-api with latest OASIS code, these ones have only formatiing and javadoc changes

Modified:
    tuscany/sca-java-2.x/trunk/modules/sca-api/src/main/java/org/oasisopen/sca/client/SCAClientFactory.java
    tuscany/sca-java-2.x/trunk/modules/sca-api/src/main/java/org/oasisopen/sca/client/SCAClientFactoryFinder.java
    tuscany/sca-java-2.x/trunk/modules/sca-api/src/main/java/org/oasisopen/sca/client/impl/SCAClientFactoryFinderImpl.java

Modified: tuscany/sca-java-2.x/trunk/modules/sca-api/src/main/java/org/oasisopen/sca/client/SCAClientFactory.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/sca-api/src/main/java/org/oasisopen/sca/client/SCAClientFactory.java?rev=931861&r1=931860&r2=931861&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/sca-api/src/main/java/org/oasisopen/sca/client/SCAClientFactory.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/sca-api/src/main/java/org/oasisopen/sca/client/SCAClientFactory.java Thu Apr  8 10:41:59 2010
@@ -1,5 +1,5 @@
 /*
- * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved.
+ * Copyright(C) OASIS(R) 2005,2010. All Rights Reserved.
  * OASIS trademark, IPR and other policies apply.
  */
 package org.oasisopen.sca.client;
@@ -14,7 +14,7 @@ import org.oasisopen.sca.client.impl.SCA
 
 /**
  * The SCAClientFactory can be used by non-SCA managed code to 
- * lookup services that exist in a SCADomain.
+ * lookup services that exist in a SCA Domain.
  * 
  * @see SCAClientFactoryFinderImpl
  * 
@@ -51,7 +51,7 @@ public abstract class SCAClientFactory {
      * SCAClientFactory
      */
     protected SCAClientFactory(URI domainURI)
-        throws NoSuchDomainException {
+    	throws NoSuchDomainException {
         this.domainURI = domainURI;
     }
 
@@ -68,11 +68,11 @@ public abstract class SCAClientFactory {
      * Creates a new instance of the SCAClientFactory that can be 
      * used to lookup SCA Services.
      * 
-     * @param domainURI         URI of the target domain for the SCAClientFactory
+     * @param domainURI 	URI of the target domain for the SCAClientFactory
      * @return A new SCAClientFactory 
      */
     public static SCAClientFactory newInstance( URI domainURI ) 
-        throws NoSuchDomainException {
+    	throws NoSuchDomainException {
         return newInstance(null, null, domainURI);
     }
     
@@ -82,12 +82,12 @@ public abstract class SCAClientFactory {
      *
      * @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
+     * @param domainURI 	URI of the target domain for the SCAClientFactory
      * @return A new SCAClientFactory instance
      */
     public static SCAClientFactory newInstance(Properties properties,
-                                                                        URI domainURI) 
-        throws NoSuchDomainException {
+    									URI domainURI) 
+    	throws NoSuchDomainException {
         return newInstance(properties, null, domainURI);
     }
 
@@ -97,12 +97,12 @@ public abstract class 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
+     * @param domainURI 	URI of the target domain for the SCAClientFactory
      * @return A new SCAClientFactory instance
      */
     public static SCAClientFactory newInstance(ClassLoader classLoader, 
-                                                                        URI domainURI) 
-        throws NoSuchDomainException {
+    									URI domainURI) 
+    	throws NoSuchDomainException {
         return newInstance(null, classLoader, domainURI);
     }
 
@@ -114,16 +114,16 @@ public abstract class SCAClientFactory {
      * 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
+     * @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) 
-        throws NoSuchDomainException {
+    		                            ClassLoader classLoader,
+    		                            URI domainURI) 
+    	throws NoSuchDomainException {
         final SCAClientFactoryFinder finder =
             factoryFinder != null ? factoryFinder :
-                new SCAClientFactoryFinderImpl();
+            	new SCAClientFactoryFinderImpl();
         final SCAClientFactory factory
             = finder.find(properties, classLoader, domainURI);
         return factory;

Modified: tuscany/sca-java-2.x/trunk/modules/sca-api/src/main/java/org/oasisopen/sca/client/SCAClientFactoryFinder.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/sca-api/src/main/java/org/oasisopen/sca/client/SCAClientFactoryFinder.java?rev=931861&r1=931860&r2=931861&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/sca-api/src/main/java/org/oasisopen/sca/client/SCAClientFactoryFinder.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/sca-api/src/main/java/org/oasisopen/sca/client/SCAClientFactoryFinder.java Thu Apr  8 10:41:59 2010
@@ -1,5 +1,5 @@
 /*
- * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved.
+ * Copyright(C) OASIS(R) 2005,2010. All Rights Reserved.
  * OASIS trademark, IPR and other policies apply.
  */
 
@@ -17,19 +17,19 @@ import org.oasisopen.sca.NoSuchDomainExc
  */
 public interface SCAClientFactoryFinder {
 
-        /**
-         * Method for finding the SCAClientFactory for a given Domain URI using
-         * a specified set of properties and a a specified ClassLoader
-         * @param properties - properties to use - may be null
-         * @param classLoader - ClassLoader to use - may be null
-         * @param domainURI - the Domain URI - must be a valid SCA Domain URI
-         * @return - the SCAClientFactory or null if the factory could not be
-         * @throws - NoSuchDomainException if the domainURI does not reference 
-         * a valid SCA Domain 
-         * found
-         */
+	/**
+	 * Method for finding the SCAClientFactory for a given Domain URI using
+	 * a specified set of properties and a a specified ClassLoader
+	 * @param properties - properties to use - may be null
+	 * @param classLoader - ClassLoader to use - may be null
+	 * @param domainURI - the Domain URI - must be a valid SCA Domain URI
+	 * @return - the SCAClientFactory or null if the factory could not be
+	 * @throws - NoSuchDomainException if the domainURI does not reference 
+	 * a valid SCA Domain 
+	 * found
+	 */
     SCAClientFactory find(Properties properties,
                           ClassLoader classLoader,
                           URI domainURI ) 
-        throws NoSuchDomainException ;
+    	throws NoSuchDomainException ;
 }

Modified: tuscany/sca-java-2.x/trunk/modules/sca-api/src/main/java/org/oasisopen/sca/client/impl/SCAClientFactoryFinderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/sca-api/src/main/java/org/oasisopen/sca/client/impl/SCAClientFactoryFinderImpl.java?rev=931861&r1=931860&r2=931861&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/sca-api/src/main/java/org/oasisopen/sca/client/impl/SCAClientFactoryFinderImpl.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/sca-api/src/main/java/org/oasisopen/sca/client/impl/SCAClientFactoryFinderImpl.java Thu Apr  8 10:41:59 2010
@@ -1,5 +1,5 @@
 /*
- * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved.
+ * Copyright(C) OASIS(R) 2005,2010. All Rights Reserved.
  * OASIS trademark, IPR and other policies apply.
  */
 package org.oasisopen.sca.client.impl;
@@ -36,7 +36,7 @@ public class SCAClientFactoryFinderImpl 
      * implementation to use for the SCAClientFactory.
      */
     private static final String SCA_CLIENT_FACTORY_PROVIDER_KEY = 
-        SCAClientFactory.class.getName();
+    	SCAClientFactory.class.getName();
 
     /**
      * The name of the file loaded from the ClassPath to determine 
@@ -67,20 +67,20 @@ public class SCAClientFactoryFinderImpl 
     public SCAClientFactory find(Properties properties,
                                  ClassLoader classLoader,
                                  URI domainURI ) 
-        throws NoSuchDomainException, ServiceRuntimeException {
-                if (classLoader == null) {
-                        classLoader = getThreadContextClassLoader ();
-                }
-                final String factoryImplClassName =
-                        discoverProviderFactoryImplClass(properties, classLoader);
-                final Class<? extends SCAClientFactory> factoryImplClass
-                        = loadProviderFactoryClass(factoryImplClassName, 
-                                                           classLoader);
-                final SCAClientFactory factory =
-                        instantiateSCAClientFactoryClass(factoryImplClass,
-                                                                   domainURI );
-                return factory;
-        }
+    	throws NoSuchDomainException, ServiceRuntimeException {
+		if (classLoader == null) {
+			classLoader = getThreadContextClassLoader ();
+		}
+		final String factoryImplClassName =
+			discoverProviderFactoryImplClass(properties, classLoader);
+		final Class<? extends SCAClientFactory> factoryImplClass
+			= loadProviderFactoryClass(factoryImplClassName, 
+					                   classLoader);
+		final SCAClientFactory factory =
+			instantiateSCAClientFactoryClass(factoryImplClass,
+								   domainURI );
+		return factory;
+	}
     
     /**
      * Gets the Context ClassLoader for the current Thread.
@@ -89,7 +89,7 @@ public class SCAClientFactoryFinderImpl 
      */
     private static ClassLoader getThreadContextClassLoader () {
         final ClassLoader threadClassLoader = 
-                Thread.currentThread().getContextClassLoader();
+        	Thread.currentThread().getContextClassLoader();
         return threadClassLoader;
     }
 
@@ -104,24 +104,24 @@ public class SCAClientFactoryFinderImpl 
      */
     private static String 
         discoverProviderFactoryImplClass(Properties properties, 
-                                             ClassLoader classLoader) 
+    		                             ClassLoader classLoader) 
         throws ServiceRuntimeException {
         String providerClassName = 
-                checkPropertiesForSPIClassName(properties);
+        	checkPropertiesForSPIClassName(properties);
         if (providerClassName != null) {
             return providerClassName;
         }
 
         providerClassName = 
-                checkPropertiesForSPIClassName(System.getProperties());
+        	checkPropertiesForSPIClassName(System.getProperties());
         if (providerClassName != null) {
             return providerClassName;
         }
         
-        providerClassName = checkMETAINFServicesForSIPClassName(classLoader);
+        providerClassName = checkMETAINFServicesForSPIClassName(classLoader);
         if (providerClassName == null) {
             throw new ServiceRuntimeException(
-                "Failed to find implementation for SCAClientFactory");
+            	"Failed to find implementation for SCAClientFactory");
         }
         
         return providerClassName;
@@ -141,7 +141,7 @@ public class SCAClientFactoryFinderImpl 
         }
         
         final String providerClassName = 
-                properties.getProperty(SCA_CLIENT_FACTORY_PROVIDER_KEY);
+        	properties.getProperty(SCA_CLIENT_FACTORY_PROVIDER_KEY);
         if (providerClassName != null && providerClassName.length() > 0) {
             return providerClassName;
         }
@@ -156,10 +156,10 @@ public class SCAClientFactoryFinderImpl 
      * @return The class name for the SCAClientFactorySPI implementation or
      * <code>null</code> if not found.
      */
-    private static String checkMETAINFServicesForSIPClassName(ClassLoader cl) 
+    private static String checkMETAINFServicesForSPIClassName(ClassLoader cl) 
     {
         final URL url = 
-                cl.getResource(SCA_CLIENT_FACTORY_PROVIDER_META_INF_SERVICE);
+        	cl.getResource(SCA_CLIENT_FACTORY_PROVIDER_META_INF_SERVICE);
         if (url == null) {
             return null;
         }
@@ -170,7 +170,7 @@ public class SCAClientFactoryFinderImpl 
             BufferedReader reader = null;
             try {
                 reader = 
-                        new BufferedReader(new InputStreamReader(in, "UTF-8"));
+                	new BufferedReader(new InputStreamReader(in, "UTF-8"));
 
                 String line;
                 while ((line = readNextLine(reader)) != null) {
@@ -185,7 +185,7 @@ public class SCAClientFactoryFinderImpl 
             }
         } catch (IOException ex) {
             throw new ServiceRuntimeException(
-                        "Failed to discover SCAClientFactory provider", ex);
+            		"Failed to discover SCAClientFactory provider", ex);
         } finally {
             closeStream(in);
         }
@@ -202,7 +202,7 @@ public class SCAClientFactoryFinderImpl 
      */
     private static String readNextLine(BufferedReader reader) 
         throws IOException {
-        
+    	
         String line = reader.readLine();
         if (line != null) {
             line = line.trim();
@@ -221,23 +221,23 @@ public class SCAClientFactoryFinderImpl 
      */
     private static Class<? extends SCAClientFactory> 
         loadProviderFactoryClass(String factoryImplClassName, 
-                                         ClassLoader classLoader) 
+        		                 ClassLoader classLoader) 
         throws ServiceRuntimeException {
 
         try {
             final Class<?> providerClass = 
-                classLoader.loadClass(factoryImplClassName);
+            	classLoader.loadClass(factoryImplClassName);
             final Class<? extends SCAClientFactory> providerFactoryClass =
                 providerClass.asSubclass(SCAClientFactory.class);
             return providerFactoryClass;
         } catch (ClassNotFoundException ex) {
             throw new ServiceRuntimeException(
-                "Failed to load SCAClientFactory implementation class "
-                + factoryImplClassName, ex);
+            	"Failed to load SCAClientFactory implementation class "
+            	+ factoryImplClassName, ex);
         } catch (ClassCastException ex) {
             throw new ServiceRuntimeException(
-                        "Loaded SCAClientFactory implementation class "
-                        + factoryImplClassName
+            		"Loaded SCAClientFactory implementation class "
+            		+ factoryImplClassName
                     + " is not a subclass of " 
                     + SCAClientFactory.class.getName() , ex);
         }
@@ -254,13 +254,13 @@ public class SCAClientFactoryFinderImpl 
      * specified SCAClientFactorySPI Implementation class  
      */
     private static SCAClientFactory instantiateSCAClientFactoryClass(
-                        Class<? extends SCAClientFactory> factoryImplClass,
-                        URI domainURI)
+    			Class<? extends SCAClientFactory> factoryImplClass,
+        		URI domainURI)
         throws NoSuchDomainException, ServiceRuntimeException {
         
         try {
             Constructor<? extends SCAClientFactory> URIConstructor = 
-                factoryImplClass.getConstructor(domainURI.getClass());
+            	factoryImplClass.getConstructor(domainURI.getClass());
             SCAClientFactory provider = 
                URIConstructor.newInstance( domainURI );
             return provider;
@@ -282,7 +282,7 @@ public class SCAClientFactoryFinderImpl 
                 closeable.close();
             } catch (IOException ex) {
                 throw new ServiceRuntimeException("Failed to close stream", 
-                                                          ex);
+                		                          ex);
             }
         }
     }