tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rf...@apache.org
Subject svn commit: r579308 - /incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/util/ServiceConfigurationUtil.java
Date Tue, 25 Sep 2007 16:33:22 GMT
Author: rfeng
Date: Tue Sep 25 09:33:21 2007
New Revision: 579308

URL: http://svn.apache.org/viewvc?rev=579308&view=rev
Log:
Add logging which will help trouble-shooting

Modified:
    incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/util/ServiceConfigurationUtil.java

Modified: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/util/ServiceConfigurationUtil.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/util/ServiceConfigurationUtil.java?rev=579308&r1=579307&r2=579308&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/util/ServiceConfigurationUtil.java
(original)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/util/ServiceConfigurationUtil.java
Tue Sep 25 09:33:21 2007
@@ -30,8 +30,11 @@
 import java.util.List;
 import java.util.Map;
 import java.util.StringTokenizer;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 public class ServiceConfigurationUtil {
+    private final static Logger logger = Logger.getLogger(ServiceConfigurationUtil.class.getName());
 
     /**
      * Read the service name from a configuration file
@@ -42,8 +45,15 @@
      * @throws IOException
      */
     public static List<String> getServiceClassNames(ClassLoader classLoader, String
name) throws IOException {
+        boolean debug = logger.isLoggable(Level.FINE);
+        if (debug) {
+            logger.fine("Discovering service providers using class loader " + classLoader);
+        }
         List<String> classNames = new ArrayList<String>();
-        for (URL url: Collections.list(classLoader.getResources("META-INF/services/" + name)))
{
+        for (URL url : Collections.list(classLoader.getResources("META-INF/services/" + name)))
{
+            if (debug) {
+                logger.fine("Reading service provider file: " + url.toExternalForm());
+            }
             InputStream is = url.openStream();
             BufferedReader reader = null;
             try {
@@ -54,7 +64,11 @@
                         break;
                     line = line.trim();
                     if (!line.startsWith("#") && !"".equals(line)) {
-                        classNames.add(line.trim());
+                        String reg = line.trim();
+                        if (debug) {
+                            logger.fine("Registering service provider: " + reg);
+                        }
+                        classNames.add(reg);
                     }
                 }
             } finally {
@@ -63,7 +77,8 @@
                 if (is != null) {
                     try {
                         is.close();
-                    } catch (IOException ioe) {}
+                    } catch (IOException ioe) {
+                    }
                 }
             }
         }
@@ -83,7 +98,7 @@
         String className = tokens.nextToken(";");
         if (className != null)
             attributes.put("class", className);
-        for (; tokens.hasMoreTokens(); ) {
+        for (; tokens.hasMoreTokens();) {
             String key = tokens.nextToken("=").substring(1);
             if (key == null)
                 break;



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message