svn commit: r1084774 - /commons/proper/digester/trunk/pom.xml

2011-03-23 Thread simonetripodi
Author: simonetripodi
Date: Wed Mar 23 22:01:27 2011
New Revision: 1084774

URL: http://svn.apache.org/viewvc?rev=1084774&view=rev
Log:
upgrated commons-parent pom to v20

Modified:
commons/proper/digester/trunk/pom.xml

Modified: commons/proper/digester/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/digester/trunk/pom.xml?rev=1084774&r1=1084773&r2=1084774&view=diff
==
--- commons/proper/digester/trunk/pom.xml (original)
+++ commons/proper/digester/trunk/pom.xml Wed Mar 23 22:01:27 2011
@@ -20,7 +20,7 @@
   
 org.apache.commons
 commons-parent
-17
+20
   
 
   4.0.0




svn commit: r1084775 - /commons/proper/pool/trunk/pom.xml

2011-03-23 Thread simonetripodi
Author: simonetripodi
Date: Wed Mar 23 22:07:43 2011
New Revision: 1084775

URL: http://svn.apache.org/viewvc?rev=1084775&view=rev
Log:
upgrated commons-parent pom to v20

Modified:
commons/proper/pool/trunk/pom.xml

Modified: commons/proper/pool/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/pool/trunk/pom.xml?rev=1084775&r1=1084774&r2=1084775&view=diff
==
--- commons/proper/pool/trunk/pom.xml (original)
+++ commons/proper/pool/trunk/pom.xml Wed Mar 23 22:07:43 2011
@@ -22,7 +22,7 @@
   
 org.apache.commons
 commons-parent
-17
+20
   
   4.0.0
   org.apache.commons




svn commit: r1084776 - /commons/proper/pool/trunk/pom.xml

2011-03-23 Thread simonetripodi
Author: simonetripodi
Date: Wed Mar 23 22:09:07 2011
New Revision: 1084776

URL: http://svn.apache.org/viewvc?rev=1084776&view=rev
Log:
groupId inherited from parent pom

Modified:
commons/proper/pool/trunk/pom.xml

Modified: commons/proper/pool/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/pool/trunk/pom.xml?rev=1084776&r1=1084775&r2=1084776&view=diff
==
--- commons/proper/pool/trunk/pom.xml (original)
+++ commons/proper/pool/trunk/pom.xml Wed Mar 23 22:09:07 2011
@@ -25,7 +25,6 @@
 20
   
   4.0.0
-  org.apache.commons
   commons-pool2
   2.0-SNAPSHOT
   Commons Pool




svn commit: r1084917 - /commons/proper/pool/trunk/pom.xml

2011-03-24 Thread simonetripodi
Author: simonetripodi
Date: Thu Mar 24 11:53:26 2011
New Revision: 1084917

URL: http://svn.apache.org/viewvc?rev=1084917&view=rev
Log:
re-introduced the groupId - even if inherited from the parent - to avoid people 
deploy components with wrong metadata

Modified:
commons/proper/pool/trunk/pom.xml

Modified: commons/proper/pool/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/pool/trunk/pom.xml?rev=1084917&r1=1084916&r2=1084917&view=diff
==
--- commons/proper/pool/trunk/pom.xml (original)
+++ commons/proper/pool/trunk/pom.xml Thu Mar 24 11:53:26 2011
@@ -25,6 +25,7 @@
 20
   
   4.0.0
+  org.apache.commons
   commons-pool2
   2.0-SNAPSHOT
   Commons Pool




svn commit: r1088003 - /commons/proper/discovery/trunk/pom.xml

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 11:40:15 2011
New Revision: 1088003

URL: http://svn.apache.org/viewvc?rev=1088003&view=rev
Log:
upgraded parent pom

Modified:
commons/proper/discovery/trunk/pom.xml

Modified: commons/proper/discovery/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/pom.xml?rev=1088003&r1=1088002&r2=1088003&view=diff
==
--- commons/proper/discovery/trunk/pom.xml (original)
+++ commons/proper/discovery/trunk/pom.xml Sat Apr  2 11:40:15 2011
@@ -22,7 +22,7 @@
   
 org.apache.commons
 commons-parent
-15
+20
   
   4.0.0
   commons-discovery




svn commit: r1088004 - /commons/proper/discovery/trunk/pom.xml

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 11:42:16 2011
New Revision: 1088004

URL: http://svn.apache.org/viewvc?rev=1088004&view=rev
Log:
upgrated cmpliance level to java5

Modified:
commons/proper/discovery/trunk/pom.xml

Modified: commons/proper/discovery/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/pom.xml?rev=1088004&r1=1088003&r2=1088004&view=diff
==
--- commons/proper/discovery/trunk/pom.xml (original)
+++ commons/proper/discovery/trunk/pom.xml Sat Apr  2 11:42:16 2011
@@ -113,6 +113,8 @@
 
 DISCOVERY
 12310472
+1.5
+1.5

 
   




svn commit: r1088005 - /commons/proper/discovery/trunk/pom.xml

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 11:45:39 2011
New Revision: 1088005

URL: http://svn.apache.org/viewvc?rev=1088005&view=rev
Log:
upgrated commons-logging dependency to latest version

Modified:
commons/proper/discovery/trunk/pom.xml

Modified: commons/proper/discovery/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/pom.xml?rev=1088005&r1=1088004&r2=1088005&view=diff
==
--- commons/proper/discovery/trunk/pom.xml (original)
+++ commons/proper/discovery/trunk/pom.xml Sat Apr  2 11:45:39 2011
@@ -97,7 +97,7 @@
 
   commons-logging
   commons-logging
-  1.0.4
+  1.1.1
 
 
   junit




svn commit: r1088008 - in /commons/proper/discovery/trunk: pom.xml src/test/org/apache/commons/discovery/test/TestAll.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 11:54:26 2011
New Revision: 1088008

URL: http://svn.apache.org/viewvc?rev=1088008&view=rev
Log:
tests migrated to junit4

Modified:
commons/proper/discovery/trunk/pom.xml

commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java

Modified: commons/proper/discovery/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/pom.xml?rev=1088008&r1=1088007&r2=1088008&view=diff
==
--- commons/proper/discovery/trunk/pom.xml (original)
+++ commons/proper/discovery/trunk/pom.xml Sat Apr  2 11:54:26 2011
@@ -102,7 +102,7 @@
 
   junit
   junit
-  3.8.1
+  4.8.2
   test
 
   

Modified: 
commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java?rev=1088008&r1=1088007&r2=1088008&view=diff
==
--- 
commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java
 (original)
+++ 
commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java
 Sat Apr  2 11:54:26 2011
@@ -16,14 +16,13 @@
  */
 package org.apache.commons.discovery.test;
 
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertTrue;
+import static junit.framework.Assert.fail;
 
 import java.net.URL;
 import java.util.Properties;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
 import org.apache.commons.discovery.Resource;
 import org.apache.commons.discovery.ResourceClass;
 import org.apache.commons.discovery.ResourceClassIterator;
@@ -38,26 +37,19 @@ import org.apache.commons.discovery.tool
 import org.apache.commons.discovery.tools.ManagedProperties;
 import org.apache.commons.discovery.tools.PropertiesHolder;
 import org.apache.commons.discovery.tools.SPInterface;
+import org.junit.Test;
 
 
 /**
   * @author Richard A. Sitze
   * @version $Revision$
  */
-public class TestAll extends TestCase {
+public class TestAll {
 private static final int logLevel =
 org.apache.commons.discovery.log.SimpleLog.LOG_LEVEL_INFO;
 //org.apache.commons.discovery.log.SimpleLog.LOG_LEVEL_DEBUG;
 
-
-public TestAll(String testName) {
-super(testName);
-}
-
-public static Test suite() {
-return new TestSuite(TestAll.class);
-}
-
+@Test
 public void testFindDefaultImpl_1() {
 org.apache.commons.discovery.log.SimpleLog.setLevel(logLevel);
 
@@ -74,6 +66,7 @@ public class TestAll extends TestCase {
 }
 }
 
+@Test
 public void testFindDefaultImpl_2() {
 org.apache.commons.discovery.log.SimpleLog.setLevel(logLevel);
 
@@ -90,6 +83,7 @@ public class TestAll extends TestCase {
 }
 }
 
+@Test
 public void testCache() {
 org.apache.commons.discovery.log.SimpleLog.setLevel(logLevel);
 
@@ -115,6 +109,7 @@ public class TestAll extends TestCase {
 }
 }
 
+@Test
 public void testRelease() {
 org.apache.commons.discovery.log.SimpleLog.setLevel(logLevel);
 
@@ -140,6 +135,7 @@ public class TestAll extends TestCase {
 }
 }
 
+@Test
 public void testFindPropertyImpl_1() {
 org.apache.commons.discovery.log.SimpleLog.setLevel(logLevel);
 
@@ -160,6 +156,7 @@ public class TestAll extends TestCase {
 }
 }
 
+@Test
 public void testMyFactoryManagedProperty() {
 org.apache.commons.discovery.log.SimpleLog.setLevel(logLevel);
 
@@ -184,6 +181,7 @@ public class TestAll extends TestCase {
 }
 
 
+@Test
 public void testFindPropFileDefault() {
 org.apache.commons.discovery.log.SimpleLog.setLevel(logLevel);
 
@@ -202,6 +200,7 @@ public class TestAll extends TestCase {
 }
 }
 
+@Test
 public void testFindServiceFileDefault() {
 org.apache.commons.discovery.log.SimpleLog.setLevel(logLevel);
 
@@ -220,6 +219,7 @@ public class TestAll extends TestCase {
 }
 }
 
+@Test
 public void testLowLevelFind() {
 org.apache.commons.discovery.log.SimpleLog.setLevel(logLevel);
 
@@ -244,6 +244,7 @@ public class TestAll extends TestCase {
 fail("failed to load class resource: " + name);
 }
 
+@Test
 public void testFindResources() {
 org.apache.commons.discovery.log.SimpleLog.setLevel(logLevel);
 
@@ -287,6 +288,7 @@ public class TestAll extends TestCase {
 }
 }
 
+@Test
 public void testViaDiscoverClass() {
 org.apache.commons.discovery.log.SimpleLog.setLevel(logLevel);
 




svn commit: r1088015 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ClassUtils.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 12:17:46 2011
New Revision: 1088015

URL: http://svn.apache.org/viewvc?rev=1088015&view=rev
Log:
fixed Generics warnings

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ClassUtils.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ClassUtils.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ClassUtils.java?rev=1088015&r1=1088014&r2=1088015&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ClassUtils.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ClassUtils.java
 Sat Apr  2 12:17:46 2011
@@ -43,7 +43,7 @@ public class ClassUtils {
  * This means that calling Class.getPackage().getName()
  * is unreliable at best.
  */
-public static String getPackageName(Class clazz) {
+public static String getPackageName(Class clazz) {
 Package clazzPackage = clazz.getPackage();
 String packageName;
 if (clazzPackage != null) {
@@ -59,10 +59,10 @@ public class ClassUtils {
  * @return Method 'public static returnType methodName(paramTypes)',
  * if found to be directly implemented by clazz.
  */
-public static Method findPublicStaticMethod(Class clazz,
-Class returnType,
+public static Method findPublicStaticMethod(Class clazz,
+Class returnType,
 String methodName,
-Class[] paramTypes) {
+Class[] paramTypes) {
 boolean problem = false;
 Method method = null;
 
@@ -101,7 +101,7 @@ public class ClassUtils {
 /**
  * Instantiate a new 
  */
-public static Object newInstance(Class impl, Class paramClasses[], Object 
params[])
+public static  T newInstance(Class impl, Class paramClasses[], 
Object params[])
 throws DiscoveryException,
InstantiationException,
IllegalAccessException,
@@ -111,7 +111,7 @@ public class ClassUtils {
 if (paramClasses == null || params == null) {
 return impl.newInstance();
 } else {
-Constructor constructor = impl.getConstructor(paramClasses);
+Constructor constructor = impl.getConstructor(paramClasses);
 return constructor.newInstance(params);
 }
 }
@@ -120,7 +120,7 @@ public class ClassUtils {
  * Throws exception if impl does not
  * implement or extend the SPI.
  */
-public static void verifyAncestory(Class spi, Class impl)
+public static void verifyAncestory(Class spi, Class impl)
 throws DiscoveryException
 {
 if (spi == null) {




svn commit: r1088018 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/Resource.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 13:13:28 2011
New Revision: 1088018

URL: http://svn.apache.org/viewvc?rev=1088018&view=rev
Log:
type-agnostic Vector replaced by typed LIst

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/Resource.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/Resource.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/Resource.java?rev=1088018&r1=1088017&r2=1088018&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/Resource.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/Resource.java
 Sat Apr  2 13:13:28 2011
@@ -19,7 +19,8 @@ package org.apache.commons.discovery;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
-import java.util.Vector;
+import java.util.LinkedList;
+import java.util.List;
 
 
 /**
@@ -102,12 +103,12 @@ public class Resource
 }
 
 public static Resource[] toArray(ResourceIterator iterator) {
-Vector vector = new Vector();
+List resourceList = new LinkedList();
 while (iterator.hasNext()) {
-vector.add(iterator.nextResource());
+resourceList.add(iterator.nextResource());
 }
-Resource[] resources = new Resource[vector.size()];
-vector.copyInto(resources);
+Resource[] resources = new Resource[resourceList.size()];
+resourceList.toArray(resources);
 
 return resources;
 }




svn commit: r1088019 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/DiscoveryException.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 13:16:46 2011
New Revision: 1088019

URL: http://svn.apache.org/viewvc?rev=1088019&view=rev
Log:
added generated serialVersionUID

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/DiscoveryException.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/DiscoveryException.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/DiscoveryException.java?rev=1088019&r1=1088018&r2=1088019&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/DiscoveryException.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/DiscoveryException.java
 Sat Apr  2 13:16:46 2011
@@ -30,6 +30,11 @@ public class DiscoveryException extends 
 
 
 /**
+ * 
+ */
+private static final long serialVersionUID = -2518293836976054070L;
+
+/**
  * Construct a new exception with null as its detail message.
  */
 public DiscoveryException() {




svn commit: r1088024 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceDiscover.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 13:52:25 2011
New Revision: 1088024

URL: http://svn.apache.org/viewvc?rev=1088024&view=rev
Log:
no needs to specify methods visibility

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceDiscover.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceDiscover.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceDiscover.java?rev=1088024&r1=1088023&r2=1088024&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceDiscover.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceDiscover.java
 Sat Apr  2 13:52:25 2011
@@ -27,12 +27,12 @@ public interface ResourceDiscover extend
  * 
  * @return ResourceIterator
  */
-public ResourceIterator findResources(String resourceName);
+ResourceIterator findResources(String resourceName);
 
 /**
  * Locate resources that are bound to resourceNames.
  * 
  * @return ResourceIterator
  */
-public ResourceIterator findResources(ResourceNameIterator resourceNames);
+ResourceIterator findResources(ResourceNameIterator resourceNames);
 }




svn commit: r1088025 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceClassDiscover.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 13:53:16 2011
New Revision: 1088025

URL: http://svn.apache.org/viewvc?rev=1088025&view=rev
Log:
no needs to specify methods visibility

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceClassDiscover.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceClassDiscover.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceClassDiscover.java?rev=1088025&r1=1088024&r2=1088025&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceClassDiscover.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceClassDiscover.java
 Sat Apr  2 13:53:16 2011
@@ -27,12 +27,12 @@ public interface ResourceClassDiscover e
  * 
  * @return ResourceClassIterator
  */
-public ResourceClassIterator findResourceClasses(String className);
+ResourceClassIterator findResourceClasses(String className);
 
 /**
  * Locate class resources that are bound to resourceNames.
  * 
  * @return ResourceIterator
  */
-public ResourceClassIterator findResourceClasses(ResourceNameIterator 
className);
+ResourceClassIterator findResourceClasses(ResourceNameIterator className);
 }




svn commit: r1088064 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/EnvironmentCache.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 16:58:45 2011
New Revision: 1088064

URL: http://svn.apache.org/viewvc?rev=1088064&view=rev
Log:
environment cache is a map of classloader,map

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/EnvironmentCache.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/EnvironmentCache.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/EnvironmentCache.java?rev=1088064&r1=1088063&r2=1088064&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/EnvironmentCache.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/EnvironmentCache.java
 Sat Apr  2 16:58:45 2011
@@ -17,6 +17,7 @@
 package org.apache.commons.discovery.tools;
 
 import java.util.HashMap;
+import java.util.Map;
 
 import org.apache.commons.discovery.jdk.JDKHooks;
 
@@ -48,7 +49,7 @@ public class EnvironmentCache {
  * as HashMap (unsynchronized).
  * 
  */
-private static final HashMap root_cache = new HashMap();
+private static final Map> root_cache = 
new HashMap>();
 
 /**
  * Initial hash size for SPI's, default just seem TO big today..
@@ -58,7 +59,7 @@ public class EnvironmentCache {
 /**
  * Get object keyed by classLoader.
  */
-public static synchronized Object get(ClassLoader classLoader)
+public static synchronized Map get(ClassLoader classLoader)
 {
 /**
  * 'null' (bootstrap/system class loader) thread context class loader
@@ -70,14 +71,14 @@ public class EnvironmentCache {
 /**
  * Put service keyed by spi & classLoader.
  */
-public static synchronized void put(ClassLoader classLoader, Object object)
+public static synchronized void put(ClassLoader classLoader, Map spis)
 {
 /**
  * 'null' (bootstrap/system class loader) thread context class loader
  * is ok...  Until we learn otherwise.
  */
-if (object != null) {
-root_cache.put(classLoader, object);
+if (spis != null) {
+root_cache.put(classLoader, spis);
 }
 }
 




svn commit: r1088071 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ResourceUtils.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 18:26:56 2011
New Revision: 1088071

URL: http://svn.apache.org/viewvc?rev=1088071&view=rev
Log:
fixed compiler warnings on generics

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ResourceUtils.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ResourceUtils.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ResourceUtils.java?rev=1088071&r1=1088070&r2=1088071&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ResourceUtils.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ResourceUtils.java
 Sat Apr  2 18:26:56 2011
@@ -45,7 +45,7 @@ public class ResourceUtils {
  * This means that calling Class.getPackage().getName()
  * is unreliable at best.
  */
-public static String getPackageName(Class clazz) {
+public static String getPackageName(Class clazz) {
 Package clazzPackage = clazz.getPackage();
 String packageName;
 if (clazzPackage != null) {
@@ -69,7 +69,7 @@ public class ResourceUtils {
  * 
  * @param resourceName The name of the resource to load.
  */
-public static Resource getResource(Class spi,
+public static Resource getResource(Class spi,
String resourceName,
ClassLoaders loaders)
 throws DiscoveryException
@@ -117,7 +117,7 @@ public class ResourceUtils {
  *instantiated, or if the resulting class does not implement
  *(or extend) the SPI.
  */
-public static Properties loadProperties(Class spi,
+public static Properties loadProperties(Class spi,
 String propertiesFileName,
 ClassLoaders classLoaders)
 throws DiscoveryException




svn commit: r1088075 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceClassIterator.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 18:39:36 2011
New Revision: 1088075

URL: http://svn.apache.org/viewvc?rev=1088075&view=rev
Log:
added generics: a ResourceClassIterator of a specified type T, iterates over 
the given T extensions

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceClassIterator.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceClassIterator.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceClassIterator.java?rev=1088075&r1=1088074&r2=1088075&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceClassIterator.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceClassIterator.java
 Sat Apr  2 18:39:36 2011
@@ -20,11 +20,11 @@ package org.apache.commons.discovery;
 /**
  * @author Richard A. Sitze
  */
-public abstract class ResourceClassIterator extends ResourceIterator
+public abstract class ResourceClassIterator extends ResourceIterator
 {
 /**
  */
-public abstract ResourceClass nextResourceClass();
+public abstract  ResourceClass nextResourceClass();
 
 public Resource nextResource() {
 return nextResourceClass();




svn commit: r1088077 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceClassDiscover.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 18:41:26 2011
New Revision: 1088077

URL: http://svn.apache.org/viewvc?rev=1088077&view=rev
Log:
added generics: a ResourceClassDiscover finds Iterators of a specified type T

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceClassDiscover.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceClassDiscover.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceClassDiscover.java?rev=1088077&r1=1088076&r2=1088077&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceClassDiscover.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceClassDiscover.java
 Sat Apr  2 18:41:26 2011
@@ -20,19 +20,19 @@ package org.apache.commons.discovery;
 /**
  * @author Richard A. Sitze
  */
-public interface ResourceClassDiscover extends ResourceDiscover
+public interface ResourceClassDiscover extends ResourceDiscover
 {
 /**
  * Locate class resources that are bound to className.
  * 
  * @return ResourceClassIterator
  */
-ResourceClassIterator findResourceClasses(String className);
+ResourceClassIterator findResourceClasses(String className);
 
 /**
  * Locate class resources that are bound to resourceNames.
  * 
  * @return ResourceIterator
  */
-ResourceClassIterator findResourceClasses(ResourceNameIterator className);
+ResourceClassIterator findResourceClasses(ResourceNameIterator 
className);
 }




svn commit: r1088078 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceClass.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 18:42:19 2011
New Revision: 1088078

URL: http://svn.apache.org/viewvc?rev=1088078&view=rev
Log:
added generics

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceClass.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceClass.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceClass.java?rev=1088078&r1=1088077&r2=1088078&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceClass.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceClass.java
 Sat Apr  2 18:42:19 2011
@@ -33,15 +33,15 @@ import org.apache.commons.logging.Log;
  * 
  * @author Richard A. Sitze
  */
-public class ResourceClass extends Resource
+public class ResourceClass extends Resource
 {
 private static Log log = DiscoveryLogFactory.newLog(ResourceClass.class);
 public static void setLog(Log _log) {
 log = _log;
 }
-protected Class   resourceClass;
+protected Class   resourceClass;
 
-public ResourceClass(Class resourceClass, URL resource) {
+public  ResourceClass(Class resourceClass, URL resource) {
 super(resourceClass.getName(), resource, 
resourceClass.getClassLoader());
 this.resourceClass = resourceClass;
 }
@@ -66,23 +66,28 @@ public class ResourceClass extends Resou
  *
  * @return value of resourceClass.
  */
-public Class loadClass() {
+public  Class loadClass() {
 if (resourceClass == null  &&  getClassLoader() != null) {
 if (log.isDebugEnabled())
 log.debug("loadClass: Loading class '" + getName() + "' with " 
+ getClassLoader());
 
-resourceClass = (Class)AccessController.doPrivileged(
-new PrivilegedAction() {
-public Object run() {
+resourceClass = AccessController.doPrivileged(
+new PrivilegedAction>() {
+public Class run() {
 try {
-return getClassLoader().loadClass(getName());
+@SuppressWarnings("unchecked") // this can raise a 
ClassCastException at runtime
+Class returned = (Class)  (Class) 
getClassLoader().loadClass(getName());
+return returned;
 } catch (ClassNotFoundException e) {
 return null;
 }
 }
 });
 }
-return resourceClass;
+
+@SuppressWarnings("unchecked") // this is assumed by default, see the 
ctor
+Class returned = (Class) resourceClass;
+return returned;
 }
 
 public String toString() {




svn commit: r1088080 - in /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/classes: DiscoverClasses.java ResourceClassDiscoverImpl.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 18:44:26 2011
New Revision: 1088080

URL: http://svn.apache.org/viewvc?rev=1088080&view=rev
Log:
switched to generics

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/classes/DiscoverClasses.java

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/classes/ResourceClassDiscoverImpl.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/classes/DiscoverClasses.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/classes/DiscoverClasses.java?rev=1088080&r1=1088079&r2=1088080&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/classes/DiscoverClasses.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/classes/DiscoverClasses.java
 Sat Apr  2 18:44:26 2011
@@ -17,7 +17,8 @@
 package org.apache.commons.discovery.resource.classes;
 
 import java.net.URL;
-import java.util.Vector;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.apache.commons.discovery.ResourceClass;
 import org.apache.commons.discovery.ResourceClassDiscover;
@@ -35,9 +36,9 @@ import org.apache.commons.logging.Log;
  * @author Costin Manolache
  * @author James Strachan
  */
-public class DiscoverClasses
-extends ResourceClassDiscoverImpl
-implements ResourceClassDiscover
+public class DiscoverClasses
+extends ResourceClassDiscoverImpl
+implements ResourceClassDiscover
 {
 private static Log log = DiscoveryLogFactory.newLog(DiscoverClasses.class);
 public static void setLog(Log _log) {
@@ -56,16 +57,16 @@ public class DiscoverClasses
 super(classLoaders);
 }
 
-public ResourceClassIterator findResourceClasses(final String className) {
+public ResourceClassIterator findResourceClasses(final String 
className) {
 final String resourceName = className.replace('.','/') + ".class";
 
 if (log.isDebugEnabled())
 log.debug("find: className='" + className + "'");
 
-return new ResourceClassIterator() {
-private Vector history = new Vector();
+return new ResourceClassIterator() {
+private List history = new ArrayList();
 private int idx = 0;
-private ResourceClass resource = null;
+private ResourceClass resource = null;
 
 public boolean hasNext() {
 if (resource == null) {
@@ -74,24 +75,24 @@ public class DiscoverClasses
 return resource != null;
 }
 
-public ResourceClass nextResourceClass() {
-ResourceClass element = resource;
+public ResourceClass nextResourceClass() {
+ResourceClass element = resource;
 resource = null;
 return element;
 }
 
-private ResourceClass getNextClass() {
+private ResourceClass getNextClass() {
 while (idx < getClassLoaders().size()) {
 ClassLoader loader = getClassLoaders().get(idx++);
 URL url = loader.getResource(resourceName);
 if (url != null) {
 if (!history.contains(url)) {
-history.addElement(url);
+history.add(url);
 
 if (log.isDebugEnabled())
 log.debug("getNextClass: next URL='" + url + 
"'");
 
-return new ResourceClass(className, url, loader);
+return new ResourceClass(className, url, 
loader);
 }
 if (log.isDebugEnabled())
 log.debug("getNextClass: duplicate URL='" + url + 
"'");

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/classes/ResourceClassDiscoverImpl.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/classes/ResourceClassDiscoverImpl.java?rev=1088080&r1=1088079&r2=1088080&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/classes/ResourceClassDiscoverImpl.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/classes/ResourceClassDiscoverImpl.java
 Sat Apr  2 18:44:26 2011
@@ -28,9 +28,9 @@ import org.apache.commons.discovery.reso
 /**
  * @author Richard A. Sitze
 

svn commit: r1088081 - in /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools: DefaultClassHolder.java DiscoverClass.java DiscoverSingleton.java SPInterface.java Service.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 18:46:43 2011
New Revision: 1088081

URL: http://svn.apache.org/viewvc?rev=1088081&view=rev
Log:
DiscoverClass and DiscoverSingleton (and related dependencies) now use 
generics, no more casts needed by clients

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DefaultClassHolder.java

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverClass.java

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverSingleton.java

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/SPInterface.java

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/Service.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DefaultClassHolder.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DefaultClassHolder.java?rev=1088081&r1=1088080&r2=1088081&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DefaultClassHolder.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DefaultClassHolder.java
 Sat Apr  2 18:46:43 2011
@@ -30,11 +30,11 @@ import org.apache.commons.discovery.reso
  * 
  * @author Richard A. Sitze
  */
-public class DefaultClassHolder {
-private ClassdefaultClass;
+public class DefaultClassHolder {
+private ClassdefaultClass;
 private final String defaultName;
 
-public DefaultClassHolder(Class defaultClass) {
+public  DefaultClassHolder(Class defaultClass) {
 this.defaultClass = defaultClass;
 this.defaultName = defaultClass.getName();
 }
@@ -52,12 +52,12 @@ public class DefaultClassHolder {
  * and verify that it implements the SPI.
  * (this forces the check, no way out..).
  */
-public Class getDefaultClass(SPInterface spi, ClassLoaders loaders) {
+public  Class getDefaultClass(SPInterface spi, 
ClassLoaders loaders) {
 if (defaultClass == null) {
-DiscoverClasses classDiscovery = new DiscoverClasses(loaders);
-ResourceClassIterator classes = 
classDiscovery.findResourceClasses(getDefaultName());
+DiscoverClasses classDiscovery = new 
DiscoverClasses(loaders);
+ResourceClassIterator classes = 
classDiscovery.findResourceClasses(getDefaultName());
 if (classes.hasNext()) {
-ResourceClass info = classes.nextResourceClass();
+ResourceClass info = classes.nextResourceClass();
 try {
 defaultClass = info.loadClass();
 } catch (Exception e) {
@@ -70,7 +70,9 @@ public class DefaultClassHolder {
 spi.verifyAncestory(defaultClass);
 }
 
-return defaultClass;
+@SuppressWarnings("unchecked") // the SPInterface.verifyAncestory 
already asserted
+Class returned = (Class) defaultClass;
+return returned;
 }
 
 public String getDefaultName() {

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverClass.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverClass.java?rev=1088081&r1=1088080&r2=1088081&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverClass.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverClass.java
 Sat Apr  2 18:46:43 2011
@@ -17,8 +17,9 @@
 package org.apache.commons.discovery.tools;
 
 import java.lang.reflect.InvocationTargetException;
+import java.util.LinkedList;
+import java.util.List;
 import java.util.Properties;
-import java.util.Vector;
 
 import org.apache.commons.discovery.DiscoveryException;
 import org.apache.commons.discovery.ResourceClass;
@@ -136,11 +137,6 @@ public class DiscoverClass {
 /**
  * Readable placeholder for a null value.
  */
-public static final DefaultClassHolder nullDefaultImpl = null;
-
-/**
- * Readable placeholder for a null value.
- */
 public static final PropertiesHolder nullProperties = null;
 
 
@@ -168,7 +164,7 @@ public class DiscoverClass {
 }
 
 
-public ClassLoaders getClassLoaders(Class spiClass) {
+public ClassLoaders getClassLoaders(Class spiClass) {
 return classLoaders;
 }
 
@@ -184,13 +180,13 @@ public class DiscoverClass {
  *the SPI cannot be found, if the class cannot be loaded, or if
  *the resulting class does not implement (or extend) the SPI.
  */
-public 

svn commit: r1088082 - /commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 18:49:41 2011
New Revision: 1088082

URL: http://svn.apache.org/viewvc?rev=1088082&view=rev
Log:
tests switched to generics

Modified:

commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java

Modified: 
commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java?rev=1088082&r1=1088081&r2=1088082&view=diff
==
--- 
commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java
 (original)
+++ 
commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java
 Sat Apr  2 18:49:41 2011
@@ -188,10 +188,10 @@ public class TestAll {
 TestInterface1 ti = null;
 
 try {
-ti = (TestInterface1)DiscoverSingleton.find(null,
-   new SPInterface(TestInterface1.class),
+ti = DiscoverSingleton.find(null,
+   new 
SPInterface(TestInterface1.class),
new 
PropertiesHolder("TestInterface.properties"),
-   new 
DefaultClassHolder(TestImpl1_2.class.getName()));
+   new 
DefaultClassHolder(TestImpl1_2.class.getName()));
 
 assertTrue(ti.getClass().getName() + "!=" + 
TestImpl1_1.class.getName(),

ti.getClass().getName().equals(TestImpl1_1.class.getName()));
@@ -207,10 +207,10 @@ public class TestAll {
 TestInterface2 ti = null;
 
 try {
-ti = (TestInterface2)DiscoverSingleton.find(null,
-   new SPInterface(TestInterface2.class),
+ti = DiscoverSingleton.find(null,
+   new 
SPInterface(TestInterface2.class),
null,
-   new 
DefaultClassHolder(TestImpl2_2.class.getName()));
+   new 
DefaultClassHolder(TestImpl2_2.class.getName()));
 
 assertTrue(ti.getClass().getName() + "!=" + 
TestImpl2_1.class.getName(),

ti.getClass().getName().equals(TestImpl2_1.class.getName()));
@@ -226,12 +226,12 @@ public class TestAll {
 ClassLoaders loaders = 
ClassLoaders.getAppLoaders(TestInterface2.class, getClass(), false);
 String name = "org.apache.commons.discovery.test.TestImpl2_1";
 
-DiscoverClasses discovery = new DiscoverClasses(loaders);
-ResourceClassIterator iter = discovery.findResourceClasses(name);
+DiscoverClasses discovery = new 
DiscoverClasses(loaders);
+ResourceClassIterator iter = 
discovery.findResourceClasses(name);
 while (iter.hasNext()) {
-ResourceClass resource = iter.nextResourceClass();
+ResourceClass resource = iter.nextResourceClass();
 try {
-Class implClass = resource.loadClass();
+Class implClass = resource.loadClass();
 if ( implClass != null ) {
 
assertEquals("org.apache.commons.discovery.test.TestImpl2_1", 
implClass.getName());
 return;
@@ -295,7 +295,7 @@ public class TestAll {
 ClassLoaders loaders = 
ClassLoaders.getAppLoaders(TestInterface2.class, getClass(), false);
 
 DiscoverClass discover = new DiscoverClass(loaders);
-Class implClass = discover.find(TestInterface2.class);
+Class implClass = discover.find(TestInterface2.class);
 
 assertTrue("Failed to find an implementation class", implClass != 
null);
 assertEquals("org.apache.commons.discovery.test.TestImpl2_1", 
implClass.getName());




svn commit: r1088085 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverSingleton.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 18:58:04 2011
New Revision: 1088085

URL: http://svn.apache.org/viewvc?rev=1088085&view=rev
Log:
fixed "type parameters of T cannot be determined" compiler issue

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverSingleton.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverSingleton.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverSingleton.java?rev=1088085&r1=1088084&r2=1088085&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverSingleton.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverSingleton.java
 Sat Apr  2 18:58:04 2011
@@ -367,7 +367,8 @@ public class DiscoverSingleton {
 {
 ClassLoader contextLoader = 
JDKHooks.getJDKHooks().getThreadContextClassLoader();
 
-T obj = get(contextLoader, spi.getSPName());
+@SuppressWarnings("unchecked") // spiName is assignable from stored 
object class
+T obj = (T) get(contextLoader, spi.getSPName());
 
 if (obj == null) {
 try {
@@ -455,15 +456,13 @@ public class DiscoverSingleton {
 /**
  * Get service keyed by spi & classLoader.
  */
-private static synchronized  T get(ClassLoader classLoader,
+private static synchronized Object get(ClassLoader classLoader,
String spiName)
 {
 Map spis = EnvironmentCache.get(classLoader);
 
 if (spis != null) {
-@SuppressWarnings("unchecked") // spiName is assignable from 
stored object class
-T t = (T) spis.get(spiName);
-return t;
+return spis.get(spiName);
 }
 return null;
 }




svn commit: r1088087 - /commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 19:01:30 2011
New Revision: 1088087

URL: http://svn.apache.org/viewvc?rev=1088087&view=rev
Log:
fixed type inference in testViaDiscoverClass method

Modified:

commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java

Modified: 
commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java?rev=1088087&r1=1088086&r2=1088087&view=diff
==
--- 
commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java
 (original)
+++ 
commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java
 Sat Apr  2 19:01:30 2011
@@ -295,7 +295,7 @@ public class TestAll {
 ClassLoaders loaders = 
ClassLoaders.getAppLoaders(TestInterface2.class, getClass(), false);
 
 DiscoverClass discover = new DiscoverClass(loaders);
-Class implClass = discover.find(TestInterface2.class);
+Class implClass = 
discover.find(TestInterface2.class);
 
 assertTrue("Failed to find an implementation class", implClass != 
null);
 assertEquals("org.apache.commons.discovery.test.TestImpl2_1", 
implClass.getName());




svn commit: r1088088 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/PropertiesHolder.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 19:03:09 2011
New Revision: 1088088

URL: http://svn.apache.org/viewvc?rev=1088088&view=rev
Log:
fixed compiler warning on generic

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/PropertiesHolder.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/PropertiesHolder.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/PropertiesHolder.java?rev=1088088&r1=1088087&r2=1088088&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/PropertiesHolder.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/PropertiesHolder.java
 Sat Apr  2 19:03:09 2011
@@ -52,7 +52,7 @@ public class PropertiesHolder {
  * 
  * @return Properties.  Load the properties if necessary.
  */
-public Properties getProperties(SPInterface spi, ClassLoaders loaders) {
+public Properties getProperties(SPInterface spi, ClassLoaders loaders) {
 if (properties == null) {
 properties = ResourceUtils.loadProperties(spi.getSPClass(), 
getPropertiesFileName(), loaders);
 }




svn commit: r1088094 - in /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk: JDK11Hooks.java JDK12Hooks.java JDKHooks.java PsuedoSystemClassLoader.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 19:39:46 2011
New Revision: 1088094

URL: http://svn.apache.org/viewvc?rev=1088094&view=rev
Log:
added generics to JDKHooks and relative implementations

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDK11Hooks.java

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDK12Hooks.java

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDKHooks.java

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/PsuedoSystemClassLoader.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDK11Hooks.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDK11Hooks.java?rev=1088094&r1=1088093&r2=1088094&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDK11Hooks.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDK11Hooks.java
 Sat Apr  2 19:39:46 2011
@@ -67,7 +67,7 @@ public class JDK11Hooks extends JDKHooks
  * using introspection and doing the lookup ourself, using the list
  * of URLs, via getURLs().
  */
-public Enumeration getResources(ClassLoader loader,
+public Enumeration getResources(ClassLoader loader,
 String resourceName)
 throws IOException
 {
@@ -96,13 +96,13 @@ public class JDK11Hooks extends JDKHooks
  */
 
 final URL first = (URL)loader.getResource(resourceName);
-final Enumeration rest = loader.getResources(resourceName);
+final Enumeration rest = loader.getResources(resourceName);
 
-return new Enumeration() {
+return new Enumeration() {
 private boolean firstDone = (first == null);
 private URL next = getNext();
 
-public Object nextElement() {
+public URL nextElement() {
 URL o = next;
 next = getNext();
 return o;

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDK12Hooks.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDK12Hooks.java?rev=1088094&r1=1088093&r2=1088094&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDK12Hooks.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDK12Hooks.java
 Sat Apr  2 19:39:46 2011
@@ -20,6 +20,7 @@ import java.io.IOException;
 import java.net.URL;
 import java.util.Collections;
 import java.util.Enumeration;
+import java.util.List;
 
 import org.apache.commons.discovery.log.DiscoveryLogFactory;
 import org.apache.commons.logging.Log;
@@ -53,9 +54,9 @@ public class JDK12Hooks extends JDKHooks
  * @return value of the property
  */
 public String getSystemProperty(final String propName) {
-return (String)
-java.security.AccessController.doPrivileged(new 
java.security.PrivilegedAction() {
-public Object run() {
+return
+java.security.AccessController.doPrivileged(new 
java.security.PrivilegedAction() {
+public String run() {
 try {
 return System.getProperty(propName);
 } catch (SecurityException se){
@@ -110,7 +111,7 @@ public class JDK12Hooks extends JDKHooks
 /**
  * Implement ClassLoader.getResources for JDK 1.2
  */
-public Enumeration getResources(ClassLoader loader,
+public Enumeration getResources(ClassLoader loader,
 String resourceName)
 throws IOException
 {
@@ -142,11 +143,12 @@ public class JDK12Hooks extends JDKHooks
 
 // XXX: Trying to avoid JBoss UnifiedClassLoader problem
 
-Enumeration resources;
+Enumeration resources;
 
 if(first == null) {
 log.debug("Could not find resource: " + resourceName);
-resources = Collections.enumeration(Collections.EMPTY_LIST);
+List emptyURL = Collections.emptyList();
+resources = Collections.enumeration(emptyURL);
 
 } else {
 
@@ -157,7 +159,8 @@ public class JDK12Hooks extends JDKHooks
 } catch (RuntimeException ex) {
 log.error("Exception occured during attept to get " + 
resourceName 
 + " from " + first, ex);
-resources = Collections.enumeration(Collections.EMPTY_LIST);
+List emptyURL = Collections.emptyList();
+  

svn commit: r1088095 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/DiscoverResources.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 19:41:07 2011
New Revision: 1088095

URL: http://svn.apache.org/viewvc?rev=1088095&view=rev
Log:
DiscoverResources users generified JDKHooks

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/DiscoverResources.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/DiscoverResources.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/DiscoverResources.java?rev=1088095&r1=1088094&r2=1088095&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/DiscoverResources.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/DiscoverResources.java
 Sat Apr  2 19:41:07 2011
@@ -67,7 +67,7 @@ public class DiscoverResources
 return new ResourceIterator() {
 private int idx = 0;
 private ClassLoader loader = null;
-private Enumeration resources = null;
+private Enumeration resources = null;
 private Resource resource = null;
 
 public boolean hasNext() {
@@ -90,7 +90,7 @@ public class DiscoverResources
 
 Resource resourceInfo;
 if (resources != null) {
-URL url = (URL)resources.nextElement();
+URL url = resources.nextElement();
 
 if (log.isDebugEnabled())
 log.debug("getNextResource: next URL='" + url + "'");
@@ -103,13 +103,13 @@ public class DiscoverResources
 return resourceInfo;
 }
 
-private Enumeration getNextResources() {
+private Enumeration getNextResources() {
 while (idx < getClassLoaders().size()) {
 loader = getClassLoaders().get(idx++);
 if (log.isDebugEnabled())
 log.debug("getNextResources: search using ClassLoader 
'" + loader + "'");
 try {
-Enumeration e = 
JDKHooks.getJDKHooks().getResources(loader, resourceName);
+Enumeration e = 
JDKHooks.getJDKHooks().getResources(loader, resourceName);
 if (e != null && e.hasMoreElements()) {
 return e;
 }




svn commit: r1088096 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/ClassLoaders.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 19:44:58 2011
New Revision: 1088096

URL: http://svn.apache.org/viewvc?rev=1088096&view=rev
Log:
added generics to ClassLoader
type agnostic Vector replaced by LinkedList

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/ClassLoaders.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/ClassLoaders.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/ClassLoaders.java?rev=1088096&r1=1088095&r2=1088096&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/ClassLoaders.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/ClassLoaders.java
 Sat Apr  2 19:44:58 2011
@@ -16,7 +16,8 @@
  */
 package org.apache.commons.discovery.resource;
 
-import java.util.Vector;
+import java.util.LinkedList;
+import java.util.List;
 
 import org.apache.commons.discovery.jdk.JDKHooks;
 
@@ -33,7 +34,7 @@ import org.apache.commons.discovery.jdk.
  */
 public class ClassLoaders
 {
-protected Vector classLoaders = new Vector();
+protected List classLoaders = new LinkedList();
 
 /** Construct a new class loader set
  */
@@ -45,7 +46,7 @@ public class ClassLoaders
 }
 
 public ClassLoader get(int idx) {
-return (ClassLoader)classLoaders.elementAt(idx);
+return classLoaders.get(idx);
 }
 
 /**
@@ -55,7 +56,7 @@ public class ClassLoaders
  */
 public void put(ClassLoader classLoader) {
 if (classLoader != null) {
-classLoaders.addElement(classLoader);
+classLoaders.add(classLoader);
 }
 }
 
@@ -71,7 +72,7 @@ public class ClassLoaders
  */
 public void put(ClassLoader classLoader, boolean prune) {
 if (classLoader != null  &&  !(prune && isAncestor(classLoader))) {
-classLoaders.addElement(classLoader);
+classLoaders.add(classLoader);
 }
 }
 
@@ -127,7 +128,7 @@ public class ClassLoaders
  * @param factory WHO is performing the lookup.
  * @param prune Determines if ancestors are allowed to be loaded or not.
  */
-public static ClassLoaders getLibLoaders(Class spi, Class factory, boolean 
prune) {
+public static ClassLoaders getLibLoaders(Class spi, Class factory, 
boolean prune) {
 ClassLoaders loaders = new ClassLoaders();
 
 if (spi != null) loaders.put(spi.getClassLoader());
@@ -157,7 +158,7 @@ public class ClassLoaders
  * @param factory WHO is performing the lookup (factory).
  * @param prune Determines if ancestors are allowed to be loaded or not.
  */
-public static ClassLoaders getAppLoaders(Class spi, Class factory, boolean 
prune) {
+public static ClassLoaders getAppLoaders(Class spi, Class factory, 
boolean prune) {
 ClassLoaders loaders = new ClassLoaders();
 
 loaders.put(JDKHooks.getJDKHooks().getThreadContextClassLoader());




svn commit: r1088097 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/NameDiscoverers.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 19:48:20 2011
New Revision: 1088097

URL: http://svn.apache.org/viewvc?rev=1088097&view=rev
Log:
type agnostic Vector replaced by LinkedList

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/NameDiscoverers.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/NameDiscoverers.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/NameDiscoverers.java?rev=1088097&r1=1088096&r2=1088097&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/NameDiscoverers.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/NameDiscoverers.java
 Sat Apr  2 19:48:20 2011
@@ -16,7 +16,8 @@
  */
 package org.apache.commons.discovery.resource.names;
 
-import java.util.Vector;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.apache.commons.discovery.ResourceNameDiscover;
 import org.apache.commons.discovery.ResourceNameIterator;
@@ -40,7 +41,7 @@ public class NameDiscoverers
 log = _log;
 }
 
-private Vector discoverers = new Vector();
+private List discoverers = new 
ArrayList();
 
 /**
  *  Construct a new resource name discoverer
@@ -55,12 +56,12 @@ public class NameDiscoverers
  */
 public void addResourceNameDiscover(ResourceNameDiscover discover) {
 if (discover != null) {
-discoverers.addElement(discover);
+discoverers.add(discover);
 }
 }
 
 protected ResourceNameDiscover getResourceNameDiscover(int idx) {
-return (ResourceNameDiscover)discoverers.get(idx);
+return discoverers.get(idx);
 }
 
 protected int size() {




svn commit: r1088099 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInFile.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 19:52:26 2011
New Revision: 1088099

URL: http://svn.apache.org/viewvc?rev=1088099&view=rev
Log:
type agnostic Vector replaced by List

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInFile.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInFile.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInFile.java?rev=1088099&r1=1088098&r2=1088099&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInFile.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInFile.java
 Sat Apr  2 19:52:26 2011
@@ -20,7 +20,8 @@ import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
-import java.util.Vector;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.apache.commons.discovery.Resource;
 import org.apache.commons.discovery.ResourceDiscover;
@@ -161,7 +162,7 @@ public class DiscoverNamesInFile
 
 return new ResourceNameIterator() {
 private int idx = 0;
-private Vector classNames = null;
+private List classNames = null;
 private String resource = null;
 
 public boolean hasNext() {
@@ -194,9 +195,9 @@ public class DiscoverNamesInFile
 return className;
 }
 
-private Vector getNextClassNames() {
+private List getNextClassNames() {
 while (files.hasNext()) {
-Vector results = readServices(files.nextResource());
+List results = readServices(files.nextResource());
 if (results != null  &&  results.size() > 0) {
 return results;
 }
@@ -210,8 +211,8 @@ public class DiscoverNamesInFile
  * Read everything, no defering here..
  * Ensure that files are closed before we leave.
  */
-private Vector readServices(final Resource info) {
-Vector results = new Vector();
+private List readServices(final Resource info) {
+List results = new ArrayList();
 
 InputStream is = info.getResourceAsStream();
 




svn commit: r1088101 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInDictionary.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 20:05:40 2011
New Revision: 1088101

URL: http://svn.apache.org/viewvc?rev=1088101&view=rev
Log:
added generics to internal Dictionary

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInDictionary.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInDictionary.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInDictionary.java?rev=1088101&r1=1088100&r2=1088101&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInDictionary.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInDictionary.java
 Sat Apr  2 20:05:40 2011
@@ -43,28 +43,28 @@ public class DiscoverNamesInDictionary
 log = _log;
 }
 
-private Dictionary dictionary;
+private Dictionary dictionary;
 
 /** Construct a new resource discoverer
  */
 public DiscoverNamesInDictionary() {
-setDictionary(new Hashtable());
+setDictionary(new Hashtable());
 }
 
 /** Construct a new resource discoverer
  */
-public DiscoverNamesInDictionary(Dictionary dictionary) {
+public DiscoverNamesInDictionary(Dictionary dictionary) {
 setDictionary(dictionary);
 }
 
-protected Dictionary getDictionary() {
+protected Dictionary getDictionary() {
 return dictionary;
 }
 
 /**
  * Specify set of class loaders to be used in searching.
  */
-public void setDictionary(Dictionary table) {
+public void setDictionary(Dictionary table) {
 this.dictionary = table;
 }
 




svn commit: r1088102 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInAlternateManagedProperties.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 20:07:17 2011
New Revision: 1088102

URL: http://svn.apache.org/viewvc?rev=1088102&view=rev
Log:
added generics to internal Map
internal Map made private final

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInAlternateManagedProperties.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInAlternateManagedProperties.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInAlternateManagedProperties.java?rev=1088102&r1=1088101&r2=1088102&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInAlternateManagedProperties.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInAlternateManagedProperties.java
 Sat Apr  2 20:07:17 2011
@@ -17,6 +17,7 @@
 package org.apache.commons.discovery.resource.names;
 
 import java.util.HashMap;
+import java.util.Map;
 
 import org.apache.commons.discovery.ResourceNameDiscover;
 import org.apache.commons.discovery.ResourceNameIterator;
@@ -46,7 +47,7 @@ public class DiscoverNamesInAlternateMan
 log = _log;
 }
 
-HashMap mapping = new HashMap();
+private final Map mapping = new HashMap();
 
 /** Construct a new resource discoverer
  */
@@ -63,7 +64,7 @@ public class DiscoverNamesInAlternateMan
  * @return Enumeration of ResourceInfo
  */
 public ResourceNameIterator findResourceNames(final String resourceName) {
-final String mappedName = (String)mapping.get(resourceName);
+final String mappedName = mapping.get(resourceName);
 
 if (log.isDebugEnabled()) {
 if (mappedName == null) {




svn commit: r1088105 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInDictionary.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 20:18:49 2011
New Revision: 1088105

URL: http://svn.apache.org/viewvc?rev=1088105&view=rev
Log:
Dictionary type can be statically types, no need to check value type at runtime

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInDictionary.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInDictionary.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInDictionary.java?rev=1088105&r1=1088104&r2=1088105&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInDictionary.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInDictionary.java
 Sat Apr  2 20:18:49 2011
@@ -43,33 +43,33 @@ public class DiscoverNamesInDictionary
 log = _log;
 }
 
-private Dictionary dictionary;
+private Dictionary dictionary;
 
 /** Construct a new resource discoverer
  */
 public DiscoverNamesInDictionary() {
-setDictionary(new Hashtable());
+setDictionary(new Hashtable());
 }
 
 /** Construct a new resource discoverer
  */
-public DiscoverNamesInDictionary(Dictionary dictionary) {
+public DiscoverNamesInDictionary(Dictionary dictionary) {
 setDictionary(dictionary);
 }
 
-protected Dictionary getDictionary() {
+protected Dictionary getDictionary() {
 return dictionary;
 }
 
 /**
  * Specify set of class loaders to be used in searching.
  */
-public void setDictionary(Dictionary table) {
+public void setDictionary(Dictionary table) {
 this.dictionary = table;
 }
 
 public void addResource(String resourceName, String resource) {
-dictionary.put(resourceName, resource);
+addResource(resourceName, new String[]{ resource });
 }
 
 public void addResource(String resourceName, String[] resources) {
@@ -83,16 +83,7 @@ public class DiscoverNamesInDictionary
 if (log.isDebugEnabled())
 log.debug("find: resourceName='" + resourceName + "'");
 
-Object baseResource = dictionary.get(resourceName);
-
-final String[] resources;
-if (baseResource instanceof String) {
-resources = new String[] { (String)baseResource };
-} else if (baseResource instanceof String[]) {
-resources = (String[])baseResource;
-} else {
-resources = null;
-}
+final String[] resources = dictionary.get(resourceName);
 
 return new ResourceNameIterator() {
 private int idx = 0;




svn commit: r1088107 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverMappedNames.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 20:21:05 2011
New Revision: 1088107

URL: http://svn.apache.org/viewvc?rev=1088107&view=rev
Log:
added generics to internal Map
internal Map made private final
no more need to check value type at runtime

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverMappedNames.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverMappedNames.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverMappedNames.java?rev=1088107&r1=1088106&r2=1088107&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverMappedNames.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverMappedNames.java
 Sat Apr  2 20:21:05 2011
@@ -17,6 +17,7 @@
 package org.apache.commons.discovery.resource.names;
 
 import java.util.Hashtable;
+import java.util.Map;
 
 import org.apache.commons.discovery.ResourceNameDiscover;
 import org.apache.commons.discovery.ResourceNameIterator;
@@ -45,7 +46,7 @@ public class DiscoverMappedNames
 log = _log;
 }
 
-private Hashtable mapping = new Hashtable();  // String name ==> String[] 
newNames
+private final Map mapping = new Hashtable();  // String name ==> String[] newNames
 
 /** Construct a new resource discoverer
  */
@@ -53,7 +54,7 @@ public class DiscoverMappedNames
 }
 
 public void map(String fromName, String toName) {
-mapping.put(fromName, toName);
+map(fromName, new String[]{ toName });
 }
 
 public void map(String fromName, String [] toNames) {
@@ -68,17 +69,8 @@ public class DiscoverMappedNames
 log.debug("find: resourceName='" + resourceName + "', mapping to 
constants");
 }
 
-final Object obj = mapping.get(resourceName);
+final String[] names = mapping.get(resourceName);
 
-final String[] names;
-if (obj instanceof String) {
-names = new String[] { (String)obj };
-} else if (obj instanceof String[]) {
-names = (String[])obj;
-} else {
-names = null;
-}
-
 return new ResourceNameIterator() {
 
 private int idx = 0;




svn commit: r1088109 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/log/DiscoveryLogFactory.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 20:28:35 2011
New Revision: 1088109

URL: http://svn.apache.org/viewvc?rev=1088109&view=rev
Log:
added generics to internal map
optimized iterator over map values

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/log/DiscoveryLogFactory.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/log/DiscoveryLogFactory.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/log/DiscoveryLogFactory.java?rev=1088109&r1=1088108&r2=1088109&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/log/DiscoveryLogFactory.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/log/DiscoveryLogFactory.java
 Sat Apr  2 20:28:35 2011
@@ -17,8 +17,8 @@
 package org.apache.commons.discovery.log;
 
 import java.lang.reflect.Method;
-import java.util.Enumeration;
 import java.util.Hashtable;
+import java.util.Map;
 
 import org.apache.commons.discovery.DiscoveryException;
 import org.apache.commons.discovery.tools.ClassUtils;
@@ -49,8 +49,8 @@ import org.apache.commons.logging.LogFac
  */
 public class DiscoveryLogFactory {
 private static LogFactory logFactory = null;
-private static final Hashtable  classRegistry = new Hashtable();
-private static final Class[] setLogParamClasses = new Class[] { Log.class 
};
+private static final Map, Class>  classRegistry = new 
Hashtable, Class>();
+private static final Class[] setLogParamClasses = new Class[] { 
Log.class };
 
 /**
  * Above fields must be initialied before this one..
@@ -59,7 +59,7 @@ public class DiscoveryLogFactory {
 
 /**
  */
-public static Log newLog(Class clazz) {
+public static Log newLog(Class clazz) {
 /**
  * Required to implement 'public static void setLog(Log)'
  */
@@ -89,7 +89,7 @@ public class DiscoveryLogFactory {
 /**
  * This method MUST not invoke any logging..
  */
-public static Log _newLog(Class clazz) {
+public static Log _newLog(Class clazz) {
 classRegistry.put(clazz, clazz);
 
 return (logFactory == null)
@@ -110,9 +110,7 @@ public class DiscoveryLogFactory {
 logFactory = factory;
 
 // now, go back and reset loggers for all current classes..
-Enumeration elements = classRegistry.elements();
-while (elements.hasMoreElements()) {
-Class clazz = (Class)elements.nextElement();
+for (Class clazz : classRegistry.values()) {
 
 if (log.isDebugEnabled())
 log.debug("Reset Log for: " + clazz.getName());




svn commit: r1088112 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ant/ServiceDiscoveryTask.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 20:33:54 2011
New Revision: 1088112

URL: http://svn.apache.org/viewvc?rev=1088112&view=rev
Log:
agnostic Vector replaced by a typed List

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ant/ServiceDiscoveryTask.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ant/ServiceDiscoveryTask.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ant/ServiceDiscoveryTask.java?rev=1088112&r1=1088111&r2=1088112&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ant/ServiceDiscoveryTask.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ant/ServiceDiscoveryTask.java
 Sat Apr  2 20:33:54 2011
@@ -16,7 +16,8 @@
  */
 package org.apache.commons.discovery.ant;
 
-import java.util.Vector;
+import java.util.LinkedList;
+import java.util.List;
 
 import org.apache.commons.discovery.ResourceNameIterator;
 import org.apache.commons.discovery.jdk.JDKHooks;
@@ -58,17 +59,17 @@ public class ServiceDiscoveryTask
 
 ResourceNameIterator iterator = disc.findResources(name);
 
-Vector vector = new Vector();
+List resources = new LinkedList();
 while (iterator.hasNext()) {
 String resourceInfo = iterator.nextResourceName();
-vector.add(resourceInfo);
+resources.add(resourceInfo);
 if( debug > 0 ) {
 System.out.println("Found " + resourceInfo);
 }
 }
 
-drivers = new String[vector.size()];
-vector.copyInto(drivers);
+drivers = new String[resources.size()];
+resources.toArray(drivers);
 }
 
 }




svn commit: r1088118 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ant/ServiceDiscoveryTask.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 20:48:38 2011
New Revision: 1088118

URL: http://svn.apache.org/viewvc?rev=1088118&view=rev
Log:
replaced agnostic message with a meaningful one

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ant/ServiceDiscoveryTask.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ant/ServiceDiscoveryTask.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ant/ServiceDiscoveryTask.java?rev=1088118&r1=1088117&r2=1088118&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ant/ServiceDiscoveryTask.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ant/ServiceDiscoveryTask.java
 Sat Apr  2 20:48:38 2011
@@ -51,7 +51,7 @@ public class ServiceDiscoveryTask
 }
 
 public void execute() throws Exception {
-System.out.println("XXX ");
+System.out.printf("Discovering service '%s'...%n", name);
 
 DiscoverResources disc = new DiscoverResources();
 disc.addClassLoader( 
JDKHooks.getJDKHooks().getThreadContextClassLoader() );
@@ -64,7 +64,7 @@ public class ServiceDiscoveryTask
 String resourceInfo = iterator.nextResourceName();
 resources.add(resourceInfo);
 if( debug > 0 ) {
-System.out.println("Found " + resourceInfo);
+System.out.printf("Found '%s'%n", resourceInfo);
 }
 }
 




svn commit: r1088119 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ManagedProperties.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 21:10:23 2011
New Revision: 1088119

URL: http://svn.apache.org/viewvc?rev=1088119&view=rev
Log:
added generics to internal agnostic data structures

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ManagedProperties.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ManagedProperties.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ManagedProperties.java?rev=1088119&r1=1088118&r2=1088119&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ManagedProperties.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ManagedProperties.java
 Sat Apr  2 21:10:23 2011
@@ -18,6 +18,7 @@ package org.apache.commons.discovery.too
 
 import java.security.AccessController;
 import java.security.PrivilegedAction;
+import java.util.Collections;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Hashtable;
@@ -89,7 +90,8 @@ public class ManagedProperties {
  * Use HashMap because it allows 'null' keys, which
  * allows us to account for the (null) bootstrap classloader.
  */
-private static final HashMap propertiesCache = new HashMap();
+private static final Map> propertiesCache =
+new HashMap>();
 
 
 /**
@@ -172,7 +174,7 @@ public class ManagedProperties {
 if (propertyName != null) {
 synchronized (propertiesCache) {
 ClassLoader classLoader = getThreadContextClassLoader();
-HashMap properties = (HashMap)propertiesCache.get(classLoader);
+Map properties = 
propertiesCache.get(classLoader);
 
 if (value == null) {
 if (properties != null) {
@@ -180,7 +182,7 @@ public class ManagedProperties {
 }
 } else {
 if (properties == null) {
-properties = new HashMap();
+properties = new HashMap();
 propertiesCache.put(classLoader, properties);
 }
 
@@ -196,7 +198,7 @@ public class ManagedProperties {
  * 
  * @param newProperties name/value pairs to be bound
  */
-public static void setProperties(Map newProperties) {
+public static void setProperties(Map newProperties) {
 setProperties(newProperties, false);
 }
 
@@ -212,15 +214,12 @@ public class ManagedProperties {
  *(default or non-default) of the same name bound to
  *a decendent class loader.
  */
-public static void setProperties(Map newProperties, boolean isDefault) {
-java.util.Iterator it = newProperties.entrySet().iterator();
-
+public static void setProperties(Map newProperties, boolean 
isDefault) {
 /**
  * Each entry must be mapped to a Property.
  * 'setProperty' does this for us.
  */
-while (it.hasNext()) {
-Map.Entry entry = (Map.Entry)it.next();
+for (Map.Entry entry : newProperties.entrySet()) {
 setProperty( String.valueOf(entry.getKey()),
  String.valueOf(entry.getValue()),
  isDefault);
@@ -234,8 +233,8 @@ public class ManagedProperties {
  * associated with the current context class loader upto
  * and including the bootstrap class loader.
  */
-public static Enumeration propertyNames() {
-Hashtable allProps = new Hashtable();
+public static Enumeration propertyNames() {
+Map allProps = new Hashtable();
 
 ClassLoader classLoader = getThreadContextClassLoader();
 
@@ -244,10 +243,10 @@ public class ManagedProperties {
  * the set of all keys...
  */
 while (true) {
-HashMap properties = null;
+Map properties = null;
 
 synchronized (propertiesCache) {
-properties = (HashMap)propertiesCache.get(classLoader);
+properties = propertiesCache.get(classLoader);
 }
 
 if (properties != null) {
@@ -259,7 +258,7 @@ public class ManagedProperties {
 classLoader = getParent(classLoader);
 }
 
-return allProps.keys();
+return Collections.enumeration(allProps.keySet());
 }
 
 /**
@@ -277,9 +276,9 @@ public class ManagedProperties {
 public static Properties getProperties() {
 Properties p = new Properties();
 
-Enumeration names = propertyNames();
+Enumeration names = propertyNames();
 while (names.hasMoreElements()) {
-String name = (String)nam

svn commit: r1088120 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ant/ServiceDiscoveryTask.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 21:13:39 2011
New Revision: 1088120

URL: http://svn.apache.org/viewvc?rev=1088120&view=rev
Log:
removed trailing spaces

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ant/ServiceDiscoveryTask.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ant/ServiceDiscoveryTask.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ant/ServiceDiscoveryTask.java?rev=1088120&r1=1088119&r2=1088120&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ant/ServiceDiscoveryTask.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ant/ServiceDiscoveryTask.java
 Sat Apr  2 21:13:39 2011
@@ -37,7 +37,7 @@ public class ServiceDiscoveryTask
 String name;
 int debug=0;
 String[] drivers = null;
-
+
 public void setServiceName(String name ) {
 this.name=name;
 }
@@ -52,11 +52,11 @@ public class ServiceDiscoveryTask
 
 public void execute() throws Exception {
 System.out.printf("Discovering service '%s'...%n", name);
-
+
 DiscoverResources disc = new DiscoverResources();
 disc.addClassLoader( 
JDKHooks.getJDKHooks().getThreadContextClassLoader() );
 disc.addClassLoader( this.getClass().getClassLoader() );
-
+
 ResourceNameIterator iterator = disc.findResources(name);
 
 List resources = new LinkedList();
@@ -67,9 +67,9 @@ public class ServiceDiscoveryTask
 System.out.printf("Found '%s'%n", resourceInfo);
 }
 }
-
+
 drivers = new String[resources.size()];
 resources.toArray(drivers);
 }
-
+
 }




svn commit: r1088121 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDK11Hooks.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 21:14:17 2011
New Revision: 1088121

URL: http://svn.apache.org/viewvc?rev=1088121&view=rev
Log:
removed trailing spaces

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDK11Hooks.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDK11Hooks.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDK11Hooks.java?rev=1088121&r1=1088120&r2=1088121&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDK11Hooks.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDK11Hooks.java
 Sat Apr  2 21:14:17 2011
@@ -48,7 +48,7 @@ public class JDK11Hooks extends JDKHooks
 public ClassLoader getThreadContextClassLoader() {
 return null;
 }
-
+
 /**
  * The system class loader is available for JDK 1.2
  * or later, if certain security conditions are met.
@@ -94,14 +94,14 @@ public class JDK11Hooks extends JDKHooks
  * if the resource (from getResources) matches the first resource,
  * and eliminate the redundent element.
  */
-
+
 final URL first = (URL)loader.getResource(resourceName);
 final Enumeration rest = loader.getResources(resourceName);
-
+
 return new Enumeration() {
 private boolean firstDone = (first == null);
 private URL next = getNext();
-
+
 public URL nextElement() {
 URL o = next;
 next = getNext();
@@ -111,10 +111,10 @@ public class JDK11Hooks extends JDKHooks
 public boolean hasMoreElements() {
 return next != null;
 }
-
+
 private URL getNext() {
 URL n;
-
+
 if (!firstDone) {
 /**
  * First time through, use results of getReference()
@@ -142,7 +142,7 @@ public class JDK11Hooks extends JDKHooks
 }
 }
 }
-
+
 return n;
 }
 };




svn commit: r1088122 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDK11Hooks.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 21:14:44 2011
New Revision: 1088122

URL: http://svn.apache.org/viewvc?rev=1088122&view=rev
Log:
removed useless cast

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDK11Hooks.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDK11Hooks.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDK11Hooks.java?rev=1088122&r1=1088121&r2=1088122&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDK11Hooks.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDK11Hooks.java
 Sat Apr  2 21:14:44 2011
@@ -133,7 +133,7 @@ public class JDK11Hooks extends JDKHooks
  */
 n = null;
 while (rest.hasMoreElements()  &&  n == null) {
-n = (URL)rest.nextElement();
+n = rest.nextElement();
 if (first != null &&
 n != null &&
 n.equals(first))




svn commit: r1088123 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDK12Hooks.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 21:19:06 2011
New Revision: 1088123

URL: http://svn.apache.org/viewvc?rev=1088123&view=rev
Log:
removed trailing spaces

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDK12Hooks.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDK12Hooks.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDK12Hooks.java?rev=1088123&r1=1088122&r2=1088123&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDK12Hooks.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDK12Hooks.java
 Sat Apr  2 21:19:06 2011
@@ -30,13 +30,13 @@ import org.apache.commons.logging.Log;
  * @author Richard A. Sitze
  */
 public class JDK12Hooks extends JDKHooks {
-
+
 /**
  * Logger
  */
 private static Log log = DiscoveryLogFactory.newLog(JDK12Hooks.class);
-
-
+
+
 private static final ClassLoader systemClassLoader
 = findSystemClassLoader();
 
@@ -46,7 +46,7 @@ public class JDK12Hooks extends JDKHooks
 public static void setLog(Log _log) {
 log = _log;
 }
-
+
 /**
  * Get the system property
  *
@@ -69,13 +69,13 @@ public class JDK12Hooks extends JDKHooks
 /**
  * The thread context class loader is available for JDK 1.2
  * or later, if certain security conditions are met.
- * 
+ *
  * @return The thread context class loader, if available.
  * Otherwise return null.
  */
 public ClassLoader getThreadContextClassLoader() {
 ClassLoader classLoader;
-
+
 try {
 classLoader = Thread.currentThread().getContextClassLoader();
 } catch (SecurityException e) {
@@ -84,7 +84,7 @@ public class JDK12Hooks extends JDKHooks
  * a) the context class loader isn't an ancestor of the
  *calling class's class loader, or
  * b) if security permissions are restricted.
- * 
+ *
  * For (a), ignore and keep going.  We cannot help but also
  * ignore (b) with the logic below, but other calls elsewhere
  * (to obtain a class loader) will re-trigger this exception
@@ -92,15 +92,15 @@ public class JDK12Hooks extends JDKHooks
  */
 classLoader = null;  // ignore
 }
-
+
 // Return the selected class loader
 return classLoader;
 }
-
+
 /**
  * The system class loader is available for JDK 1.2
  * or later, if certain security conditions are met.
- * 
+ *
  * @return The system class loader, if available.
  * Otherwise return null.
  */
@@ -118,19 +118,19 @@ public class JDK12Hooks extends JDKHooks
 /**
  * The simple answer is/was:
  *return loader.getResources(resourceName);
- * 
+ *
  * However, some classloaders overload the behavior of getResource
  * (loadClass, etc) such that the order of returned results changes
  * from normally expected behavior.
- * 
+ *
  * Example: locate classes/resources from child ClassLoaders first,
  *  parents last (in some J2EE environs).
- * 
+ *
  * The resource returned by getResource() should be the same as the
  * first resource returned by getResources().  Unfortunately, this
  * is not, and cannot be: getResources() is 'final' in the current
  * JDK's (1.2, 1.3, 1.4).
- * 
+ *
  * To address this, the implementation of this method will
  * return an Enumeration such that the first element is the
  * results of getResource, and all trailing elements are
@@ -138,42 +138,42 @@ public class JDK12Hooks extends JDKHooks
  * if the resource (from getResources) matches the first resource,
  * and eliminate the redundent element.
  */
-
+
 final URL first = loader.getResource(resourceName);
-
+
 // XXX: Trying to avoid JBoss UnifiedClassLoader problem
-
+
 Enumeration resources;
-
+
 if(first == null) {
 log.debug("Could not find resource: " + resourceName);
 List emptyURL = Collections.emptyList();
 resources = Collections.enumeration(emptyURL);
-
+
 } else {
-
+
 try {
-
+
 resources = loader.getResources(resourceName);
-
+
 } catch (RuntimeException ex) {
-log.error("Exception occured during attept to get " + 
resourceName 
+log.er

svn commit: r1088124 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDKHooks.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 21:20:13 2011
New Revision: 1088124

URL: http://svn.apache.org/viewvc?rev=1088124&view=rev
Log:
removed trailing spaces

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDKHooks.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDKHooks.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDKHooks.java?rev=1088124&r1=1088123&r2=1088124&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDKHooks.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDKHooks.java
 Sat Apr  2 21:20:13 2011
@@ -26,16 +26,16 @@ import java.util.Enumeration;
  */
 public abstract class JDKHooks {
 private static final JDKHooks jdkHooks;
-
+
 static {
 jdkHooks = new JDK12Hooks();
 }
-
+
 protected JDKHooks() { }
-
+
 /**
  * Return singleton object representing JVM hooks/tools.
- * 
+ *
  * TODO: add logic to detect JDK level.
  */
 public static final JDKHooks getJDKHooks() {
@@ -53,7 +53,7 @@ public abstract class JDKHooks {
 /**
  * The thread context class loader is available for JDK 1.2
  * or later, if certain security conditions are met.
- * 
+ *
  * @return The thread context class loader, if available.
  * Otherwise return null.
  */
@@ -62,12 +62,12 @@ public abstract class JDKHooks {
 /**
  * The system class loader is available for JDK 1.2
  * or later, if certain security conditions are met.
- * 
+ *
  * @return The system class loader, if available.
  * Otherwise return null.
  */
 public abstract ClassLoader getSystemClassLoader();
-
+
 public abstract Enumeration getResources(ClassLoader loader,
  String resourceName)
 throws IOException;




svn commit: r1088125 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/PsuedoSystemClassLoader.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 21:21:03 2011
New Revision: 1088125

URL: http://svn.apache.org/viewvc?rev=1088125&view=rev
Log:
removed trailing spaces

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/PsuedoSystemClassLoader.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/PsuedoSystemClassLoader.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/PsuedoSystemClassLoader.java?rev=1088125&r1=1088124&r2=1088125&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/PsuedoSystemClassLoader.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/PsuedoSystemClassLoader.java
 Sat Apr  2 21:21:03 2011
@@ -31,11 +31,11 @@ class PsuedoSystemClassLoader extends Cl
 {
 return findSystemClass(className);
 }
-
+
 public URL getResource(String resName) {
 return getSystemResource(resName);
 }
-
+
 public InputStream getResourceAsStream(String resName) {
 return getSystemResourceAsStream(resName);
 }




svn commit: r1088127 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/log/SimpleLog.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 21:25:24 2011
New Revision: 1088127

URL: http://svn.apache.org/viewvc?rev=1088127&view=rev
Log:
removed trailing spaces

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/log/SimpleLog.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/log/SimpleLog.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/log/SimpleLog.java?rev=1088127&r1=1088126&r2=1088127&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/log/SimpleLog.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/log/SimpleLog.java
 Sat Apr  2 21:25:24 2011
@@ -89,8 +89,8 @@ public class SimpleLog implements Log {
 
 /** The current log level */
 static protected int logLevel = LOG_LEVEL_INFO;
-
-
+
+
 /**
  * Use 'out' instead of 'err' for logging
  * to keep in-sync with test messages.
@@ -173,9 +173,9 @@ public class SimpleLog implements Log {
 
 private String prefix=null;
 
-
+
 //  Constructor
-
+
 /**
  * Construct a simple log with given name.
  *
@@ -215,7 +215,7 @@ public class SimpleLog implements Log {
 }
 
 // append the name of the log instance if so configured
-   if( showShortName) {
+if( showShortName) {
 if( prefix==null ) {
 // cut all but the last component of the name for both styles
 prefix = logName.substring( logName.lastIndexOf(".") +1) + " - 
";
@@ -238,7 +238,7 @@ public class SimpleLog implements Log {
 
 // print to System.err
 out.println(buf.toString());
-
+
 if (t != null)
 t.printStackTrace(System.err);
 }




svn commit: r1088128 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/classes/DiscoverClasses.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 21:26:32 2011
New Revision: 1088128

URL: http://svn.apache.org/viewvc?rev=1088128&view=rev
Log:
removed trailing spaces

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/classes/DiscoverClasses.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/classes/DiscoverClasses.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/classes/DiscoverClasses.java?rev=1088128&r1=1088127&r2=1088128&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/classes/DiscoverClasses.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/classes/DiscoverClasses.java
 Sat Apr  2 21:26:32 2011
@@ -50,16 +50,16 @@ public class DiscoverClasses
 public DiscoverClasses() {
 super();
 }
-
+
 /** Construct a new resource discoverer
  */
 public DiscoverClasses(ClassLoaders classLoaders) {
 super(classLoaders);
 }
-
+
 public ResourceClassIterator findResourceClasses(final String 
className) {
 final String resourceName = className.replace('.','/') + ".class";
-
+
 if (log.isDebugEnabled())
 log.debug("find: className='" + className + "'");
 
@@ -67,20 +67,20 @@ public class DiscoverClasses
 private List history = new ArrayList();
 private int idx = 0;
 private ResourceClass resource = null;
-
+
 public boolean hasNext() {
 if (resource == null) {
 resource = getNextClass();
 }
 return resource != null;
 }
-
+
 public ResourceClass nextResourceClass() {
 ResourceClass element = resource;
 resource = null;
 return element;
 }
-
+
 private ResourceClass getNextClass() {
 while (idx < getClassLoaders().size()) {
 ClassLoader loader = getClassLoaders().get(idx++);
@@ -88,10 +88,10 @@ public class DiscoverClasses
 if (url != null) {
 if (!history.contains(url)) {
 history.add(url);
-
+
 if (log.isDebugEnabled())
 log.debug("getNextClass: next URL='" + url + 
"'");
-
+
 return new ResourceClass(className, url, 
loader);
 }
 if (log.isDebugEnabled())




svn commit: r1088129 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/classes/ResourceClassDiscoverImpl.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 21:27:52 2011
New Revision: 1088129

URL: http://svn.apache.org/viewvc?rev=1088129&view=rev
Log:
removed trailing spaces

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/classes/ResourceClassDiscoverImpl.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/classes/ResourceClassDiscoverImpl.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/classes/ResourceClassDiscoverImpl.java?rev=1088129&r1=1088128&r2=1088129&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/classes/ResourceClassDiscoverImpl.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/classes/ResourceClassDiscoverImpl.java
 Sat Apr  2 21:27:52 2011
@@ -38,7 +38,7 @@ public abstract class ResourceClassDisco
 public ResourceClassDiscoverImpl() {
 super();
 }
-
+
 /**
  *  Construct a new resource discoverer
  */
@@ -49,7 +49,7 @@ public abstract class ResourceClassDisco
 
 /**
  * Locate names of resources that are bound to resourceName.
- * 
+ *
  * @return ResourceNameIterator
  */
 public ResourceNameIterator findResourceNames(String resourceName) {
@@ -58,7 +58,7 @@ public abstract class ResourceClassDisco
 
 /**
  * Locate names of resources that are bound to resourceNames.
- * 
+ *
  * @return ResourceNameIterator
  */
 public ResourceNameIterator findResourceNames(ResourceNameIterator 
resourceNames) {
@@ -67,7 +67,7 @@ public abstract class ResourceClassDisco
 
 /**
  * Locate resources that are bound to resourceName.
- * 
+ *
  * @return ResourceIterator
  */
 public ResourceIterator findResources(String resourceName) {
@@ -76,7 +76,7 @@ public abstract class ResourceClassDisco
 
 /**
  * Locate resources that are bound to resourceNames.
- * 
+ *
  * @return ResourceIterator
  */
 public ResourceIterator findResources(ResourceNameIterator resourceNames) {
@@ -86,7 +86,7 @@ public abstract class ResourceClassDisco
 
 /**
  * Locate class resources that are bound to className.
- * 
+ *
  * @return ResourceClassIterator
  */
 public abstract ResourceClassIterator findResourceClasses(String 
className);
@@ -100,27 +100,27 @@ public abstract class ResourceClassDisco
 return new ResourceClassIterator() {
 private ResourceClassIterator classes = null;
 private ResourceClass resource = null;
-
+
 public boolean hasNext() {
 if (resource == null) {
 resource = getNextResource();
 }
 return resource != null;
 }
-
+
 public ResourceClass nextResourceClass() {
 ResourceClass rsrc = resource;
 resource = null;
 return rsrc;
 }
-
+
 private ResourceClass getNextResource() {
 while (inputNames.hasNext() &&
(classes == null  ||  !classes.hasNext())) {
 classes =
 findResourceClasses(inputNames.nextResourceName());
 }
-
+
 return (classes != null  &&  classes.hasNext())
? classes.nextResourceClass()
: null;




svn commit: r1088130 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverMappedNames.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 21:28:56 2011
New Revision: 1088130

URL: http://svn.apache.org/viewvc?rev=1088130&view=rev
Log:
removed trailing spaces

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverMappedNames.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverMappedNames.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverMappedNames.java?rev=1088130&r1=1088129&r2=1088130&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverMappedNames.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverMappedNames.java
 Sat Apr  2 21:28:56 2011
@@ -45,18 +45,18 @@ public class DiscoverMappedNames
 public static void setLog(Log _log) {
 log = _log;
 }
-
+
 private final Map mapping = new Hashtable();  // String name ==> String[] newNames
-
+
 /** Construct a new resource discoverer
  */
 public DiscoverMappedNames() {
 }
-
+
 public void map(String fromName, String toName) {
 map(fromName, new String[]{ toName });
 }
-
+
 public void map(String fromName, String [] toNames) {
 mapping.put(fromName, toNames);
 }
@@ -68,13 +68,13 @@ public class DiscoverMappedNames
 if (log.isDebugEnabled()) {
 log.debug("find: resourceName='" + resourceName + "', mapping to 
constants");
 }
-
+
 final String[] names = mapping.get(resourceName);
 
 return new ResourceNameIterator() {
 
 private int idx = 0;
-
+
 public boolean hasNext() {
 if (names != null) {
 while (idx < names.length  &&  names[idx] == null) {
@@ -84,7 +84,7 @@ public class DiscoverMappedNames
 }
 return false;
 }
-
+
 public String nextResourceName() {
 return hasNext() ? names[idx++] : null;
 }




svn commit: r1088131 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInAlternateManagedProperties.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 21:29:40 2011
New Revision: 1088131

URL: http://svn.apache.org/viewvc?rev=1088131&view=rev
Log:
removed trailing spaces

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInAlternateManagedProperties.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInAlternateManagedProperties.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInAlternateManagedProperties.java?rev=1088131&r1=1088130&r2=1088131&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInAlternateManagedProperties.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInAlternateManagedProperties.java
 Sat Apr  2 21:29:40 2011
@@ -29,13 +29,13 @@ import org.apache.commons.logging.Log;
 /**
  * Recover resource name from Managed Properties,
  * using OLD property names.
- * 
+ *
  * This class maintains a mapping between old names and
  * (new) the class names they represent.  The discovery
  * mechanism uses the class names as property names.
- * 
+ *
  * @see org.apache.commons.discovery.tools.ManagedProperties
- * 
+ *
  * @author Richard A. Sitze
  */
 public class DiscoverNamesInAlternateManagedProperties
@@ -48,12 +48,12 @@ public class DiscoverNamesInAlternateMan
 }
 
 private final Map mapping = new HashMap();
-
+
 /** Construct a new resource discoverer
  */
 public DiscoverNamesInAlternateManagedProperties() {
 }
-
+
 /**
  */
 public void addClassToPropertyNameMapping(String className, String 
propertyName) {
@@ -77,11 +77,11 @@ public class DiscoverNamesInAlternateMan
 return new ResourceNameIterator() {
 private String resource =
 (mappedName == null) ? null : 
ManagedProperties.getProperty(mappedName);
-
+
 public boolean hasNext() {
 return resource != null;
 }
-
+
 public String nextResourceName() {
 String element = resource;
 resource = null;




svn commit: r1088132 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInDictionary.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 21:30:32 2011
New Revision: 1088132

URL: http://svn.apache.org/viewvc?rev=1088132&view=rev
Log:
removed trailing spaces

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInDictionary.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInDictionary.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInDictionary.java?rev=1088132&r1=1088131&r2=1088132&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInDictionary.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInDictionary.java
 Sat Apr  2 21:30:32 2011
@@ -28,10 +28,10 @@ import org.apache.commons.logging.Log;
 /**
  * Recover resources from a Dictionary.  This covers Properties as well,
  * since Properties extends Hashtable extends Dictionary.
- * 
+ *
  * The recovered value is expected to be either a String
  * or a String[].
- * 
+ *
  * @author Richard A. Sitze
  */
 public class DiscoverNamesInDictionary
@@ -44,13 +44,13 @@ public class DiscoverNamesInDictionary
 }
 
 private Dictionary dictionary;
-
+
 /** Construct a new resource discoverer
  */
 public DiscoverNamesInDictionary() {
 setDictionary(new Hashtable());
 }
-
+
 /** Construct a new resource discoverer
  */
 public DiscoverNamesInDictionary(Dictionary dictionary) {
@@ -67,11 +67,11 @@ public class DiscoverNamesInDictionary
 public void setDictionary(Dictionary table) {
 this.dictionary = table;
 }
-
+
 public void addResource(String resourceName, String resource) {
 addResource(resourceName, new String[]{ resource });
 }
-
+
 public void addResource(String resourceName, String[] resources) {
 dictionary.put(resourceName, resources);
 }
@@ -87,7 +87,7 @@ public class DiscoverNamesInDictionary
 
 return new ResourceNameIterator() {
 private int idx = 0;
-
+
 public boolean hasNext() {
 if (resources != null) {
 while (idx < resources.length  &&  resources[idx] == null) 
{
@@ -97,7 +97,7 @@ public class DiscoverNamesInDictionary
 }
 return false;
 }
-
+
 public String nextResourceName() {
 return hasNext() ? resources[idx++] : null;
 }




svn commit: r1088133 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInFile.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 21:32:23 2011
New Revision: 1088133

URL: http://svn.apache.org/viewvc?rev=1088133&view=rev
Log:
removed trailing spaces

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInFile.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInFile.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInFile.java?rev=1088133&r1=1088132&r2=1088133&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInFile.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInFile.java
 Sat Apr  2 21:32:23 2011
@@ -43,7 +43,7 @@ import org.apache.commons.logging.Log;
  *   whitespace ignored,
  *   comments begin with '#'
  * 
- * 
+ *
  * Default discoverer is DiscoverClassLoaderResources,
  * but it can be set to any other.
  *
@@ -59,12 +59,12 @@ public class DiscoverNamesInFile
 public static void setLog(Log _log) {
 log = _log;
 }
-
+
 private ResourceDiscover _discoverResources;
-
+
 private final String _prefix;
 private final String _suffix;
-
+
 /**
  *  Construct a new resource discoverer
  */
@@ -73,7 +73,7 @@ public class DiscoverNamesInFile
 _prefix = null;
 _suffix = null;
 }
-
+
 /**
  *  Construct a new resource discoverer
  */
@@ -82,7 +82,7 @@ public class DiscoverNamesInFile
 _prefix = prefix;
 _suffix = suffix;
 }
-
+
 /**
  *  Construct a new resource discoverer
  */
@@ -91,7 +91,7 @@ public class DiscoverNamesInFile
 _prefix = null;
 _suffix = null;
 }
-
+
 /**
  *  Construct a new resource discoverer
  */
@@ -100,7 +100,7 @@ public class DiscoverNamesInFile
 _prefix = prefix;
 _suffix = suffix;
 }
-
+
 /**
  *  Construct a new resource discoverer
  */
@@ -109,7 +109,7 @@ public class DiscoverNamesInFile
 _prefix = null;
 _suffix = null;
 }
-
+
 /**
  *  Construct a new resource discoverer
  */
@@ -164,20 +164,20 @@ public class DiscoverNamesInFile
 private int idx = 0;
 private List classNames = null;
 private String resource = null;
-
+
 public boolean hasNext() {
 if (resource == null) {
 resource = getNextClassName();
 }
 return resource != null;
 }
-
+
 public String nextResourceName() {
 String element = resource;
 resource = null;
 return element;
 }
-
+
 private String getNextClassName() {
 if (classNames == null || idx >= classNames.size()) {
 classNames = getNextClassNames();
@@ -213,9 +213,9 @@ public class DiscoverNamesInFile
  */
 private List readServices(final Resource info) {
 List results = new ArrayList();
-
+
 InputStream is = info.getResourceAsStream();
-
+
 if( is != null ) {
 try {
 try {
@@ -228,7 +228,7 @@ public class DiscoverNamesInFile
 } catch (java.io.UnsupportedEncodingException e) {
 rd = new BufferedReader(new InputStreamReader(is));
 }
-
+
 try {
 String serviceImplName;
 while( (serviceImplName = rd.readLine()) != null) {
@@ -237,7 +237,7 @@ public class DiscoverNamesInFile
 serviceImplName = serviceImplName.substring(0, 
idx);
 }
 serviceImplName = serviceImplName.trim();
-
+
 if (serviceImplName.length() != 0) {
 results.add(serviceImplName);
 }
@@ -252,7 +252,7 @@ public class DiscoverNamesInFile
 // ignore
 }
 }
-
+
 return results;
 }
 }




svn commit: r1088134 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInManagedProperties.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 21:33:55 2011
New Revision: 1088134

URL: http://svn.apache.org/viewvc?rev=1088134&view=rev
Log:
removed trailing spaces

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInManagedProperties.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInManagedProperties.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInManagedProperties.java?rev=1088134&r1=1088133&r2=1088134&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInManagedProperties.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInManagedProperties.java
 Sat Apr  2 21:33:55 2011
@@ -38,17 +38,17 @@ public class DiscoverNamesInManagedPrope
 log = _log;
 }
 
-
+
 private final String _prefix;
 private final String _suffix;
-
+
 /** Construct a new resource discoverer
  */
 public DiscoverNamesInManagedProperties() {
 _prefix = null;
 _suffix = null;
 }
-
+
 /** Construct a new resource discoverer
  */
 public DiscoverNamesInManagedProperties(String prefix, String suffix) {
@@ -85,7 +85,7 @@ public class DiscoverNamesInManagedPrope
 public boolean hasNext() {
 return resource != null;
 }
-
+
 public String nextResourceName() {
 String element = resource;
 resource = null;




svn commit: r1088135 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInSystemProperties.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 21:34:41 2011
New Revision: 1088135

URL: http://svn.apache.org/viewvc?rev=1088135&view=rev
Log:
removed trailing spaces

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInSystemProperties.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInSystemProperties.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInSystemProperties.java?rev=1088135&r1=1088134&r2=1088135&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInSystemProperties.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInSystemProperties.java
 Sat Apr  2 21:34:41 2011
@@ -35,7 +35,7 @@ public class DiscoverNamesInSystemProper
 public static void setLog(Log _log) {
 log = _log;
 }
-
+
 /** Construct a new resource discoverer
  */
 public DiscoverNamesInSystemProperties() {
@@ -50,11 +50,11 @@ public class DiscoverNamesInSystemProper
 
 return new ResourceNameIterator() {
 private String resource = System.getProperty(resourceName);
-
+
 public boolean hasNext() {
 return resource != null;
 }
-
+
 public String nextResourceName() {
 String element = resource;
 resource = null;




svn commit: r1088136 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverServiceNames.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 21:35:44 2011
New Revision: 1088136

URL: http://svn.apache.org/viewvc?rev=1088136&view=rev
Log:
removed trailing spaces

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverServiceNames.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverServiceNames.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverServiceNames.java?rev=1088136&r1=1088135&r2=1088136&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverServiceNames.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/DiscoverServiceNames.java
 Sat Apr  2 21:35:44 2011
@@ -23,7 +23,7 @@ import org.apache.commons.discovery.reso
 
 /**
  * Provide JDK 1.3 style service discovery...
- * 
+ *
  * The caller will first configure the discoverer by creating a
  * root Discoverer for the files.
  *
@@ -37,40 +37,40 @@ public class DiscoverServiceNames
 implements ResourceNameDiscover
 {
 protected static final String SERVICE_HOME = "META-INF/services/";
-
+
 /** Construct a new service discoverer
  */
 public DiscoverServiceNames() {
 super(SERVICE_HOME, null);
 }
-
+
 /**
  *  Construct a new resource discoverer
  */
 public DiscoverServiceNames(String prefix, String suffix) {
 super((prefix == null) ? SERVICE_HOME : SERVICE_HOME + prefix, suffix);
 }
-
+
 /**
  *  Construct a new resource discoverer
  */
 public DiscoverServiceNames(ClassLoaders loaders) {
 super(loaders, SERVICE_HOME, null);
 }
-
+
 /**
  *  Construct a new resource discoverer
  */
 public DiscoverServiceNames(ClassLoaders loaders, String prefix, String 
suffix) {
 super(loaders, (prefix == null) ? SERVICE_HOME : SERVICE_HOME + 
prefix, suffix);
 }
-
+
 /** Construct a new service discoverer
  */
 public DiscoverServiceNames(ResourceDiscover discoverer) {
 super(discoverer, SERVICE_HOME, null);
 }
-
+
 /** Construct a new service discoverer
  */
 public DiscoverServiceNames(ResourceDiscover discoverer, String prefix, 
String suffix) {




svn commit: r1088137 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/NameDiscoverers.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 21:37:08 2011
New Revision: 1088137

URL: http://svn.apache.org/viewvc?rev=1088137&view=rev
Log:
removed trailing spaces

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/NameDiscoverers.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/NameDiscoverers.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/NameDiscoverers.java?rev=1088137&r1=1088136&r2=1088137&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/NameDiscoverers.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/NameDiscoverers.java
 Sat Apr  2 21:37:08 2011
@@ -42,13 +42,13 @@ public class NameDiscoverers
 }
 
 private List discoverers = new 
ArrayList();
-
+
 /**
  *  Construct a new resource name discoverer
  */
 public NameDiscoverers() {
 }
-
+
 /**
  * Specify an additional class loader to be used in searching.
  * The order of loaders determines the order of the result.
@@ -70,7 +70,7 @@ public class NameDiscoverers
 
 /**
  * Set of results of all discoverers.
- * 
+ *
  * @return ResourceIterator
  */
 public ResourceNameIterator findResourceNames(final String resourceName) {
@@ -80,7 +80,7 @@ public class NameDiscoverers
 return new ResourceNameIterator() {
 private int idx = 0;
 private ResourceNameIterator iterator = null;
-
+
 public boolean hasNext() {
 if (iterator == null  ||  !iterator.hasNext()) {
 iterator = getNextIterator();
@@ -90,11 +90,11 @@ public class NameDiscoverers
 }
 return iterator.hasNext();
 }
-
+
 public String nextResourceName() {
 return iterator.nextResourceName();
 }
-
+
 private ResourceNameIterator getNextIterator() {
 while (idx < size()) {
 ResourceNameIterator iter =




svn commit: r1088138 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/ResourceNameDiscoverImpl.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 21:38:09 2011
New Revision: 1088138

URL: http://svn.apache.org/viewvc?rev=1088138&view=rev
Log:
removed trailing spaces

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/ResourceNameDiscoverImpl.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/ResourceNameDiscoverImpl.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/ResourceNameDiscoverImpl.java?rev=1088138&r1=1088137&r2=1088138&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/ResourceNameDiscoverImpl.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/names/ResourceNameDiscoverImpl.java
 Sat Apr  2 21:38:09 2011
@@ -22,47 +22,47 @@ import org.apache.commons.discovery.Reso
 
 /**
  * Helper class for methods implementing the ResourceNameDiscover interface.
- * 
+ *
  * @author Richard A. Sitze
  */
 public abstract class ResourceNameDiscoverImpl implements ResourceNameDiscover
 {
 /**
  * Locate names of resources that are bound to resourceName.
- * 
+ *
  * @return ResourceNameIterator
  */
 public abstract ResourceNameIterator findResourceNames(String 
resourceName);
 
 /**
  * Locate names of resources that are bound to resourceName.
- * 
+ *
  * @return ResourceNameIterator
  */
 public ResourceNameIterator findResourceNames(final ResourceNameIterator 
inputNames) {
 return new ResourceNameIterator() {
 private ResourceNameIterator resourceNames = null;
 private String resourceName = null;
-
+
 public boolean hasNext() {
 if (resourceName == null) {
 resourceName = getNextResourceName();
 }
 return resourceName != null;
 }
-
+
 public String nextResourceName() {
 String name = resourceName;
 resourceName = null;
 return name;
 }
-
+
 private String getNextResourceName() {
 while (inputNames.hasNext() && (resourceNames == null  ||  
!resourceNames.hasNext())) {
 resourceNames =
 findResourceNames(inputNames.nextResourceName());
 }
-
+
 return (resourceNames != null  &&  resourceNames.hasNext())
? resourceNames.nextResourceName()
: null;




svn commit: r1088139 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/ClassLoaders.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 21:40:08 2011
New Revision: 1088139

URL: http://svn.apache.org/viewvc?rev=1088139&view=rev
Log:
removed trailing spaces

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/ClassLoaders.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/ClassLoaders.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/ClassLoaders.java?rev=1088139&r1=1088138&r2=1088139&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/ClassLoaders.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/ClassLoaders.java
 Sat Apr  2 21:40:08 2011
@@ -35,16 +35,16 @@ import org.apache.commons.discovery.jdk.
 public class ClassLoaders
 {
 protected List classLoaders = new LinkedList();
-
+
 /** Construct a new class loader set
  */
 public ClassLoaders() {
 }
-
+
 public int size() {
 return classLoaders.size();
 }
-
+
 public ClassLoader get(int idx) {
 return classLoaders.get(idx);
 }
@@ -59,13 +59,13 @@ public class ClassLoaders
 classLoaders.add(classLoader);
 }
 }
-
+
 
 /**
  * Specify a new class loader to be used in searching.
  * The order of loaders determines the order of the result.
  * It is recommended to add the most specific loaders first.
- * 
+ *
  * @param prune if true, verify that the class loader is
  *  not an Ancestor (@see isAncestor) before
  *  adding it to our list.
@@ -75,16 +75,16 @@ public class ClassLoaders
 classLoaders.add(classLoader);
 }
 }
-
-
+
+
 /**
  * Check to see if classLoader is an
  * ancestor of any contained class loader.
- * 
+ *
  * This can be used to eliminate redundant class loaders
  * IF all class loaders defer to parent class loaders
  * before resolving a class.
- * 
+ *
  * It may be that this is not always true.  Therefore,
  * this check is not done internally to eliminate
  * redundant class loaders, but left to the discretion
@@ -112,17 +112,17 @@ public class ClassLoaders
 /**
  * Utility method.  Returns a preloaded ClassLoaders instance
  * containing the following class loaders, in order:
- * 
+ *
  * 
  *   spi.getClassLoader
  *   seeker.getClassLoader
  *   System Class Loader
  * 
- * 
+ *
  * Note that the thread context class loader is NOT present.
  * This is a reasonable set of loaders to try if the resource to be found
  * should be restricted to a libraries containing the SPI and Factory.
- * 
+ *
  * @param spi WHAT is being looked for (an implementation of this class,
  *a default property file related to this class).
  * @param factory WHO is performing the lookup.
@@ -130,34 +130,34 @@ public class ClassLoaders
  */
 public static ClassLoaders getLibLoaders(Class spi, Class factory, 
boolean prune) {
 ClassLoaders loaders = new ClassLoaders();
-
+
 if (spi != null) loaders.put(spi.getClassLoader());
 if (factory != null) loaders.put(factory.getClassLoader(), prune);
 loaders.put(JDKHooks.getJDKHooks().getSystemClassLoader(), prune);
-
+
 return loaders;
 }
-
+
 /**
  * Utility method.  Returns a preloaded ClassLoaders instance
  * containing the following class loaders, in order:
- * 
+ *
  * 
  *   Thread Context Class Loader
  *   spi.getClassLoader
  *   seeker.getClassLoader
  *   System Class Loader
  * 
- * 
+ *
  * Note that the thread context class loader IS  present.
  * This is a reasonable set of loaders to try if the resource to be found
  * may be provided by an application.
- * 
+ *
  * @param spi WHAT is being looked for (an implementation of this class,
  *a default property file related to this class).
  * @param factory WHO is performing the lookup (factory).
  * @param prune Determines if ancestors are allowed to be loaded or not.
- */
+ */
 public static ClassLoaders getAppLoaders(Class spi, Class factory, 
boolean prune) {
 ClassLoaders loaders = new ClassLoaders();
 
@@ -165,7 +165,7 @@ public class ClassLoaders
 if (spi != null) loaders.put(spi.getClassLoader(), prune);
 if (factory != null) loaders.put(factory.getClassLoader(), prune);
 loaders.put(JDKHooks.getJDKHooks().getSystemClassLoader(), prune);
-
+
 return loaders;
 }
 }




svn commit: r1088140 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/DiscoverResources.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 21:41:16 2011
New Revision: 1088140

URL: http://svn.apache.org/viewvc?rev=1088140&view=rev
Log:
removed trailing spaces

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/DiscoverResources.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/DiscoverResources.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/DiscoverResources.java?rev=1088140&r1=1088139&r2=1088140&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/DiscoverResources.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/DiscoverResources.java
 Sat Apr  2 21:41:16 2011
@@ -42,14 +42,14 @@ public class DiscoverResources
 public static void setLog(Log _log) {
 log = _log;
 }
-
+
 /**
  * Construct a new resource discoverer
  */
 public DiscoverResources() {
 super();
 }
-
+
 /**
  *  Construct a new resource discoverer
  */
@@ -69,20 +69,20 @@ public class DiscoverResources
 private ClassLoader loader = null;
 private Enumeration resources = null;
 private Resource resource = null;
-
+
 public boolean hasNext() {
 if (resource == null) {
 resource = getNextResource();
 }
 return resource != null;
 }
-
+
 public Resource nextResource() {
 Resource element = resource;
 resource = null;
 return element;
 }
-
+
 private Resource getNextResource() {
 if (resources == null || !resources.hasMoreElements()) {
 resources = getNextResources();
@@ -99,10 +99,10 @@ public class DiscoverResources
 } else {
 resourceInfo = null;
 }
-
+
 return resourceInfo;
 }
-
+
 private Enumeration getNextResources() {
 while (idx < getClassLoaders().size()) {
 loader = getClassLoaders().get(idx++);




svn commit: r1088141 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/ResourceDiscoverImpl.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 21:42:26 2011
New Revision: 1088141

URL: http://svn.apache.org/viewvc?rev=1088141&view=rev
Log:
removed trailing spaces

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/ResourceDiscoverImpl.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/ResourceDiscoverImpl.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/ResourceDiscoverImpl.java?rev=1088141&r1=1088140&r2=1088141&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/ResourceDiscoverImpl.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/ResourceDiscoverImpl.java
 Sat Apr  2 21:42:26 2011
@@ -34,13 +34,13 @@ public abstract class ResourceDiscoverIm
 {
 private ClassLoaders classLoaders;
 
-
+
 /**
  * Construct a new resource discoverer
  */
 public ResourceDiscoverImpl() {
 }
-
+
 /**
  *  Construct a new resource discoverer
  */
@@ -73,7 +73,7 @@ public abstract class ResourceDiscoverIm
 
 /**
  * Locate names of resources that are bound to resourceName.
- * 
+ *
  * @return ResourceNameIterator
  */
 public ResourceNameIterator findResourceNames(String resourceName) {
@@ -82,7 +82,7 @@ public abstract class ResourceDiscoverIm
 
 /**
  * Locate names of resources that are bound to resourceNames.
- * 
+ *
  * @return ResourceNameIterator
  */
 public ResourceNameIterator findResourceNames(ResourceNameIterator 
resourceNames) {
@@ -91,40 +91,40 @@ public abstract class ResourceDiscoverIm
 
 /**
  * Locate resources that are bound to resourceName.
- * 
+ *
  * @return ResourceIterator
  */
 public abstract ResourceIterator findResources(String resourceName);
 
 /**
  * Locate resources that are bound to resourceNames.
- * 
+ *
  * @return ResourceIterator
  */
 public ResourceIterator findResources(final ResourceNameIterator 
inputNames) {
 return new ResourceIterator() {
 private ResourceIterator resources = null;
 private Resource resource = null;
-
+
 public boolean hasNext() {
 if (resource == null) {
 resource = getNextResource();
 }
 return resource != null;
 }
-
+
 public Resource nextResource() {
 Resource rsrc = resource;
 resource = null;
 return rsrc;
 }
-
+
 private Resource getNextResource() {
 while (inputNames.hasNext() &&
(resources == null  ||  !resources.hasNext())) {
 resources = findResources(inputNames.nextResourceName());
 }
-
+
 return (resources != null  &&  resources.hasNext())
? resources.nextResource()
: null;




svn commit: r1088142 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ClassUtils.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 21:43:45 2011
New Revision: 1088142

URL: http://svn.apache.org/viewvc?rev=1088142&view=rev
Log:
removed trailing spaces

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ClassUtils.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ClassUtils.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ClassUtils.java?rev=1088142&r1=1088141&r2=1088142&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ClassUtils.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ClassUtils.java
 Sat Apr  2 21:43:45 2011
@@ -54,7 +54,7 @@ public class ClassUtils {
 }
 return packageName;
 }
-
+
 /**
  * @return Method 'public static returnType methodName(paramTypes)',
  * if found to be directly implemented by clazz.
@@ -73,7 +73,7 @@ public class ClassUtils {
 problem = true;
 log.debug("Class " + clazz.getName() + ": missing method '" + 
methodName + "(...)", e);
 }
-
+
 // verify 'public static '
 if (!problem  &&
 !(Modifier.isPublic(method.getModifiers()) &&
@@ -94,13 +94,13 @@ public class ClassUtils {
 problem = true;
 method = null;
 }
-
+
 return method;
 }
 
 /**
  * Instantiate a new 
- */
+ */
 public static  T newInstance(Class impl, Class paramClasses[], 
Object params[])
 throws DiscoveryException,
InstantiationException,
@@ -115,7 +115,7 @@ public class ClassUtils {
 return constructor.newInstance(params);
 }
 }
-
+
 /**
  * Throws exception if impl does not
  * implement or extend the SPI.




svn commit: r1088143 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DefaultClassHolder.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 21:44:37 2011
New Revision: 1088143

URL: http://svn.apache.org/viewvc?rev=1088143&view=rev
Log:
removed trailing spaces

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DefaultClassHolder.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DefaultClassHolder.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DefaultClassHolder.java?rev=1088143&r1=1088142&r2=1088143&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DefaultClassHolder.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DefaultClassHolder.java
 Sat Apr  2 21:44:37 2011
@@ -33,12 +33,12 @@ import org.apache.commons.discovery.reso
 public class DefaultClassHolder {
 private ClassdefaultClass;
 private final String defaultName;
-
+
 public  DefaultClassHolder(Class defaultClass) {
 this.defaultClass = defaultClass;
 this.defaultName = defaultClass.getName();
 }
-
+
 public DefaultClassHolder(String defaultName) {
 this.defaultClass = null;
 this.defaultName = defaultName;
@@ -47,7 +47,7 @@ public class DefaultClassHolder {
 /**
  * @param spi non-null SPI
  * @param loaders Used only if class needs to be loaded.
- * 
+ *
  * @return Default Class.  Load the class if necessary,
  * and verify that it implements the SPI.
  * (this forces the check, no way out..).
@@ -65,7 +65,7 @@ public class DefaultClassHolder {
 }
 }
 }
-
+
 if (defaultClass != null) {
 spi.verifyAncestory(defaultClass);
 }




svn commit: r1088145 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverClass.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 21:49:02 2011
New Revision: 1088145

URL: http://svn.apache.org/viewvc?rev=1088145&view=rev
Log:
removed trailing spaces

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverClass.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverClass.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverClass.java?rev=1088145&r1=1088144&r2=1088145&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverClass.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverClass.java
 Sat Apr  2 21:49:02 2011
@@ -35,18 +35,18 @@ import org.apache.commons.discovery.reso
  * with discovery and configuration features similar to that employed
  * by standard Java APIs such as JAXP.
  * 
- * 
+ *
  * In the context of this package, a service interface is defined by a
  * Service Provider Interface (SPI).  The SPI is expressed as a Java interface,
  * abstract class, or (base) class that defines an expected programming
  * interface.
  * 
- * 
+ *
  * DiscoverClass provides the find methods for locating a
  * class that implements a service interface (SPI).  Each form of
  * find varies slightly, but they all perform the same basic
  * function.
- * 
+ *
  * The DiscoverClass.find methods proceed as follows:
  * 
  * 
@@ -138,17 +138,17 @@ public class DiscoverClass {
  * Readable placeholder for a null value.
  */
 public static final PropertiesHolder nullProperties = null;
-
-
+
+
 private ClassLoaders classLoaders = null;
 
 
 /**
  * Create a class instance with dynamic environment
  * (thread context class loader is determined on each call).
- * 
+ *
  * Dynamically construct class loaders on each call.
- */
+ */
 public DiscoverClass() {
 this(null);
 }
@@ -156,14 +156,14 @@ public class DiscoverClass {
 /**
  * Create a class instance with dynamic environment
  * (thread context class loader is determined on each call).
- * 
+ *
  * Cache static list of class loaders for each call.
- */
+ */
 public DiscoverClass(ClassLoaders classLoaders) {
 this.classLoaders = classLoaders;
 }
-
-
+
+
 public ClassLoaders getClassLoaders(Class spiClass) {
 return classLoaders;
 }
@@ -171,11 +171,11 @@ public class DiscoverClass {
 
 /**
  * Find class implementing SPI.
- * 
+ *
  * @param spiClass Service Provider Interface Class.
- * 
+ *
  * @return Class implementing the SPI.
- * 
+ *
  * @exception DiscoveryException Thrown if the name of a class implementing
  *the SPI cannot be found, if the class cannot be loaded, or if
  *the resulting class does not implement (or extend) the SPI.
@@ -191,13 +191,13 @@ public class DiscoverClass {
 
 /**
  * Find class implementing SPI.
- * 
+ *
  * @param spiClass Service Provider Interface Class.
- * 
+ *
  * @param properties Used to determine name of SPI implementation.
- * 
+ *
  * @return Class implementing the SPI.
- * 
+ *
  * @exception DiscoveryException Thrown if the name of a class implementing
  *the SPI cannot be found, if the class cannot be loaded, or if
  *the resulting class does not implement (or extend) the SPI.
@@ -213,13 +213,13 @@ public class DiscoverClass {
 
 /**
  * Find class implementing SPI.
- * 
+ *
  * @param spiClass Service Provider Interface Class.
- * 
+ *
  * @param defaultImpl Default implementation name.
- * 
+ *
  * @return Class implementing the SPI.
- * 
+ *
  * @exception DiscoveryException Thrown if the name of a class implementing
  *the SPI cannot be found, if the class cannot be loaded, or if
  *the resulting class does not implement (or extend) the SPI.
@@ -235,15 +235,15 @@ public class DiscoverClass {
 
 /**
  * Find class implementing SPI.
- * 
+ *
  * @param spiClass Service Provider Interface Class.
- * 
+ *
  * @param properties Used to determine name of SPI implementation,.
- * 
+ *
  * @param defaultImpl Default implementation class.
- * 
+ *
  * @return Class implementing the SPI.
- * 
+ *
  * @exception DiscoveryException Thrown if the name of a class implementing
  *the SPI cannot be found, if the class cannot be loaded, or if
  *the resulting class does not implement (or extend) the SPI.
@@ -259,15 +259,15 @@ public class DiscoverClass {
 
 /**
  * Find cl

svn commit: r1088147 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverSingleton.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 21:53:28 2011
New Revision: 1088147

URL: http://svn.apache.org/viewvc?rev=1088147&view=rev
Log:
removed trailing spaces

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverSingleton.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverSingleton.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverSingleton.java?rev=1088147&r1=1088146&r2=1088147&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverSingleton.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverSingleton.java
 Sat Apr  2 21:53:28 2011
@@ -29,7 +29,7 @@ import org.apache.commons.discovery.reso
  * Discover singleton service providers.
  * This 
  * 
- * 
+ *
  * DiscoverSingleton instances are cached by the Discovery service,
  * keyed by a combination of
  * 
@@ -40,18 +40,18 @@ import org.apache.commons.discovery.reso
  * This DOES allow multiple instances of a given singleton class
  * to exist for different class loaders and different group contexts.
  * 
- * 
+ *
  * In the context of this package, a service interface is defined by a
  * Service Provider Interface (SPI).  The SPI is expressed as a Java interface,
  * abstract class, or (base) class that defines an expected programming
  * interface.
  * 
- * 
+ *
  * DiscoverSingleton provides the find methods for locating and
  * instantiating a singleton instance of an implementation of a service (SPI).
  * Each form of find varies slightly, but they all perform the
  * same basic function.
- * 
+ *
  * The simplest find methods are intended for direct use by
  * components looking for a service.  If you are not sure which finder(s)
  * to use, you can narrow your search to one of these:
@@ -68,7 +68,7 @@ import org.apache.commons.discovery.reso
  * static Object find(String groupContext, Class spi,
  *String propertiesFileName, String defaultImpl);
  * 
- * 
+ *
  * The DiscoverSingleton.find methods proceed as follows:
  * 
  * 
@@ -150,7 +150,7 @@ import org.apache.commons.discovery.reso
  *   Create an instance of the class.
  *   
  * 
- * 
+ *
  * 
  * Variances for various forms of the find
  * methods are discussed with each such method.
@@ -191,12 +191,12 @@ import org.apache.commons.discovery.reso
  *   
  * 
  * 
- * 
+ *
  * IMPLEMENTATION NOTE - This implementation is modelled
  * after the SAXParserFactory and DocumentBuilderFactory implementations
  * (corresponding to the JAXP pluggability APIs) found in Apache Xerces.
  * 
- * 
+ *
  * @author Richard A. Sitze
  * @author Craig R. McClanahan
  * @author Costin Manolache
@@ -204,19 +204,19 @@ import org.apache.commons.discovery.reso
  */
 public class DiscoverSingleton {
 /** (RELATIVELY) SIMPLE FINDERS **
- * 
+ *
  * These finders are suitable for direct use in components looking for a
  * service.  If you are not sure which finder(s) to use, you can narrow
  * your search to one of these.
  */
-
+
 /**
  * Find implementation of SPI.
- * 
+ *
  * @param spiClass Service Provider Interface Class.
- * 
+ *
  * @return Instance of a class implementing the SPI.
- * 
+ *
  * @exception DiscoveryException Thrown if the name of a class implementing
  *the SPI cannot be found, if the class cannot be loaded and
  *instantiated, or if the resulting class does not implement
@@ -233,15 +233,15 @@ public class DiscoverSingleton {
 
 /**
  * Find implementation of SPI.
- * 
+ *
  * @param spiClass Service Provider Interface Class.
- * 
+ *
  * @param properties Used to determine name of SPI implementation,
  *   and passed to implementation.init() method if
  *   implementation implements Service interface.
- * 
+ *
  * @return Instance of a class implementing the SPI.
- * 
+ *
  * @exception DiscoveryException Thrown if the name of a class implementing
  *the SPI cannot be found, if the class cannot be loaded and
  *instantiated, or if the resulting class does not implement
@@ -258,13 +258,13 @@ public class DiscoverSingleton {
 
 /**
  * Find implementation of SPI.
- * 
+ *
  * @param spiClass Service Provider Interface Class.
- * 
+ *
  * @param defaultImpl Default implementation.
- * 
+ *
  * @return Instance of a class implementing the SPI.
- * 
+ *
  * @exception DiscoveryException Thrown if the name of a class implementing
  *the SPI cannot be found, if the class cann

svn commit: r1088148 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/EnvironmentCache.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 21:54:37 2011
New Revision: 1088148

URL: http://svn.apache.org/viewvc?rev=1088148&view=rev
Log:
removed trailing spaces

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/EnvironmentCache.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/EnvironmentCache.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/EnvironmentCache.java?rev=1088148&r1=1088147&r2=1088148&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/EnvironmentCache.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/EnvironmentCache.java
 Sat Apr  2 21:54:37 2011
@@ -24,21 +24,21 @@ import org.apache.commons.discovery.jdk.
 
 /**
  * Cache by a 'key' unique to the environment:
- * 
+ *
  * - ClassLoader::groupContext::Object Cache
  * Cache : HashMap
  * Key   : Thread Context Class Loader (ClassLoader)
  * Value : groupContext::SPI Cache (HashMap)
- * 
+ *
  * //- groupContext::Object Cache
  * // Cache : HashMap
  * // Key   : groupContext (String)
  * //Value : Object
- * 
+ *
  * When we 'release', it is expected that the caller of the 'release'
  * have the same thread context class loader... as that will be used
  * to identify cached entries to be released.
- * 
+ *
  * @author Richard A. Sitze
  */
 public class EnvironmentCache {
@@ -55,7 +55,7 @@ public class EnvironmentCache {
  * Initial hash size for SPI's, default just seem TO big today..
  */
 public static final int smallHashSize = 13;
-
+
 /**
  * Get object keyed by classLoader.
  */
@@ -67,7 +67,7 @@ public class EnvironmentCache {
  */
 return root_cache.get(classLoader);
 }
-
+
 /**
  * Put service keyed by spi & classLoader.
  */
@@ -84,7 +84,7 @@ public class EnvironmentCache {
 
 
 /** CACHE-MANAGEMENT SUPPORT **/
-
+
 /**
  * Release all internal references to previously created service
  * instances associated with the current thread context class loader.
@@ -103,8 +103,8 @@ public class EnvironmentCache {
  */
 
root_cache.remove(JDKHooks.getJDKHooks().getThreadContextClassLoader());
 }
-
-
+
+
 /**
  * Release any internal references to a previously created service
  * instance associated with the current thread context class loader.




svn commit: r1088149 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ManagedProperties.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 21:57:05 2011
New Revision: 1088149

URL: http://svn.apache.org/viewvc?rev=1088149&view=rev
Log:
removed trailing spaces

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ManagedProperties.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ManagedProperties.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ManagedProperties.java?rev=1088149&r1=1088148&r2=1088149&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ManagedProperties.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ManagedProperties.java
 Sat Apr  2 21:57:05 2011
@@ -34,7 +34,7 @@ import org.apache.commons.logging.Log;
 /**
  * This class may disappear in the future, or be moved to another project..
  * 
- * 
+ *
  * Extend the concept of System properties to a hierarchical scheme
  * based around class loaders.  System properties are global in nature,
  * so using them easily violates sound architectural and design principles
@@ -42,10 +42,10 @@ import org.apache.commons.logging.Log;
  * Nevertheless, there is a need for properties broader in scope than
  * class or class instance scope.
  * 
- * 
+ *
  * This class is one solution.
  * 
- * 
+ *
  * Manage properties according to a secure
  * scheme similar to that used by classloaders:
  * 
@@ -69,14 +69,14 @@ import org.apache.commons.logging.Log;
  *   System properties take precedence over all other properties
  * 
  * 
- * 
+ *
  * This is not a perfect solution, as it is possible that
  * different ClassLoaders load different instances of
  * ScopedProperties.  The 'higher' this class is loaded
  * within the ClassLoader hierarchy, the more usefull
  * it will be.
  * 
- * 
+ *
  * @author Richard A. Sitze
  */
 public class ManagedProperties {
@@ -92,22 +92,22 @@ public class ManagedProperties {
  */
 private static final Map> propertiesCache =
 new HashMap>();
-
-
+
+
 /**
  * Get value for property bound to the current thread context class loader.
- * 
+ *
  * @param propertyName property name.
  * @return property value if found, otherwise default.
  */
 public static String getProperty(String propertyName) {
 return getProperty(getThreadContextClassLoader(), propertyName);
 }
-
+
 /**
  * Get value for property bound to the current thread context class loader.
  * If not found, then return default.
- * 
+ *
  * @param propertyName property name.
  * @param dephault default value.
  * @return property value if found, otherwise default.
@@ -115,10 +115,10 @@ public class ManagedProperties {
 public static String getProperty(String propertyName, String dephault) {
 return getProperty(getThreadContextClassLoader(), propertyName, 
dephault);
 }
-
+
 /**
  * Get value for property bound to the class loader.
- * 
+ *
  * @param classLoader
  * @param propertyName property name.
  * @return property value if found, otherwise default.
@@ -136,11 +136,11 @@ public class ManagedProperties {
 }
 return value;
 }
-
+
 /**
  * Get value for property bound to the class loader.
  * If not found, then return default.
- * 
+ *
  * @param classLoader
  * @param propertyName property name.
  * @param dephault default value.
@@ -159,7 +159,7 @@ public class ManagedProperties {
 public static void setProperty(String propertyName, String value) {
 setProperty(propertyName, value, false);
 }
-
+
 /**
  * Set value for property bound to the current thread context class loader.
  * @param propertyName property name
@@ -175,7 +175,7 @@ public class ManagedProperties {
 synchronized (propertiesCache) {
 ClassLoader classLoader = getThreadContextClassLoader();
 Map properties = 
propertiesCache.get(classLoader);
-
+
 if (value == null) {
 if (properties != null) {
 properties.remove(propertyName);
@@ -191,22 +191,22 @@ public class ManagedProperties {
 }
 }
 }
-
+
 /**
  * Set property values for Properties bound to the
  * current thread context class loader.
- * 
+ *
  * @param newProperties name/value pairs to be bound
  */
 public static void setProperties(Map newProperties) {
 setProperties(newProperties, false);
 }
-
-
+
+
 /**
  * Set property values for Properties bound to the
  * current thread context class loader.

svn commit: r1088150 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/PropertiesHolder.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 21:57:43 2011
New Revision: 1088150

URL: http://svn.apache.org/viewvc?rev=1088150&view=rev
Log:
removed trailing spaces

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/PropertiesHolder.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/PropertiesHolder.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/PropertiesHolder.java?rev=1088150&r1=1088149&r2=1088150&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/PropertiesHolder.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/PropertiesHolder.java
 Sat Apr  2 21:57:43 2011
@@ -23,21 +23,21 @@ import org.apache.commons.discovery.reso
 
 /**
  * Holder for a default class.
- * 
+ *
  * Class may be specified by name (String) or class (Class).
  * Using the holder complicates the users job, but minimized # of API's.
- * 
+ *
  * @author Richard A. Sitze
  */
 public class PropertiesHolder {
 private Properties   properties;
 private final String propertiesFileName;
-
+
 public PropertiesHolder(Properties properties) {
 this.properties = properties;
 this.propertiesFileName = null;
 }
-
+
 public PropertiesHolder(String propertiesFileName) {
 this.properties = null;
 this.propertiesFileName = propertiesFileName;
@@ -47,7 +47,7 @@ public class PropertiesHolder {
  * @param spi Optional SPI (may be null).
  *If provided, an attempt is made to load the
  *property file as-per Class.getResource().
- * 
+ *
  * @param loaders Used only if properties need to be loaded.
  * 
  * @return Properties.  Load the properties if necessary.




svn commit: r1088151 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ResourceUtils.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 21:59:03 2011
New Revision: 1088151

URL: http://svn.apache.org/viewvc?rev=1088151&view=rev
Log:
removed trailing spaces

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ResourceUtils.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ResourceUtils.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ResourceUtils.java?rev=1088151&r1=1088150&r2=1088151&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ResourceUtils.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ResourceUtils.java
 Sat Apr  2 21:59:03 2011
@@ -32,7 +32,7 @@ import org.apache.commons.discovery.reso
  * The load methods locate a class only.
  * The find methods locate a class and verify that the
  * class implements an given interface or extends a given class.
- * 
+ *
  * @author Richard A. Sitze
  * @author Craig R. McClanahan
  * @author Costin Manolache
@@ -56,8 +56,8 @@ public class ResourceUtils {
 }
 return packageName;
 }
-
-
+
+
 /**
  * Load the resource resourceName.
  * Try each classloader in succession,
@@ -66,7 +66,7 @@ public class ResourceUtils {
  * (doesn't start with '/' character), then retry with
  * packageName/resourceName after changing all
  * '.' to '/'.
- * 
+ *
  * @param resourceName The name of the resource to load.
  */
 public static Resource getResource(Class spi,
@@ -76,7 +76,7 @@ public class ResourceUtils {
 {
 DiscoverResources explorer = new DiscoverResources(loaders);
 ResourceIterator resources = explorer.findResources(resourceName);
-
+
 if (spi != null  &&
 !resources.hasNext()  &&
 resourceName.charAt(0) != '/')
@@ -89,16 +89,16 @@ public class ResourceUtils {
 resourceName = getPackageName(spi).replace('.','/') + "/" + 
resourceName;
 resources = explorer.findResources(resourceName);
 }
-
+
 return resources.hasNext()
? resources.nextResource()
: null;
 }
-
+
 /**
  * Load named property file, optionally qualifed by spi's package name
  * as per Class.getResource.
- * 
+ *
  * A property file is loaded using the following sequence of class loaders:
  *   
  * Thread Context Class Loader
@@ -107,29 +107,29 @@ public class ResourceUtils {
  * DiscoverSingleton's (this class) Class Loader
  * System Class Loader
  *   
- * 
+ *
  * @param propertiesFileName The property file name.
- * 
+ *
  * @return Instance of a class implementing the SPI.
- * 
+ *
  * @exception DiscoveryException Thrown if the name of a class implementing
  *the SPI cannot be found, if the class cannot be loaded and
  *instantiated, or if the resulting class does not implement
  *(or extend) the SPI.
- */
+ */
 public static Properties loadProperties(Class spi,
 String propertiesFileName,
 ClassLoaders classLoaders)
 throws DiscoveryException
 {
 Properties properties = null;
-
+
 if (propertiesFileName != null) {
 try {
 Resource resource = getResource(spi, propertiesFileName, 
classLoaders);
 if (resource != null) {
 InputStream stream = resource.getResourceAsStream();
-
+
 if (stream != null) {
 properties = new Properties();
 try {
@@ -145,7 +145,7 @@ public class ResourceUtils {
 // ignore
 }
 }
-
+
 return properties;
 }
 }




svn commit: r1088152 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/Service.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 22:00:11 2011
New Revision: 1088152

URL: http://svn.apache.org/viewvc?rev=1088152&view=rev
Log:
removed trailing spaces

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/Service.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/Service.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/Service.java?rev=1088152&r1=1088151&r2=1088152&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/Service.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/Service.java
 Sat Apr  2 22:00:11 2011
@@ -29,7 +29,7 @@ import org.apache.commons.discovery.reso
 /**
  * [this was ServiceDiscovery12... the 1.1 versus 1.2 issue
  * has been abstracted to org.apache.commons.discover.jdk.JDKHooks]
- * 
+ *
  * Implement the JDK1.3 'Service Provider' specification.
  * ( http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html )
  * 
@@ -54,7 +54,7 @@ public class Service
  */
 protected Service() {
 }
-
+
 /**
  * as described in
  * sun/jdk1.3.1/docs/guide/jar/jar.html#Service Provider,
@@ -66,7 +66,7 @@ public class Service
 public static  Enumeration providers(Class spiClass) 
{
 return providers(new SPInterface(spiClass), null);
 }
-
+
 /**
  * This version lets you specify constructor arguments..
  * 
@@ -82,23 +82,23 @@ public class Service
  Service.class,
  true);
 }
-
+
 ResourceNameIterator servicesIter =
 (new 
DiscoverServiceNames(loaders)).findResourceNames(spi.getSPName());
 
 final ResourceClassIterator services =
 (new 
DiscoverClasses(loaders)).findResourceClasses(servicesIter);
-
+
 return new Enumeration() {
 private S object = null;
-
+
 public boolean hasMoreElements() {
 if (object == null) {
 object = getNextClassInstance();
 }
 return object != null;
 }
-
+
 public S nextElement() {
 S obj = object;
 object = null;




svn commit: r1088153 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/SPInterface.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 22:02:15 2011
New Revision: 1088153

URL: http://svn.apache.org/viewvc?rev=1088153&view=rev
Log:
removed trailing spaces

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/SPInterface.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/SPInterface.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/SPInterface.java?rev=1088153&r1=1088152&r2=1088153&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/SPInterface.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/SPInterface.java
 Sat Apr  2 22:02:15 2011
@@ -26,12 +26,12 @@ import org.apache.commons.discovery.Disc
  * - SPI's name
  * - SPI's (provider) class
  * - SPI's (alternate) override property name
- * 
+ *
  * In addition, while there are many cases where this is NOT
  * usefull, for those in which it is:
- * 
+ *
  * - expected constructor argument types and parameters values.
- * 
+ *
  * @author Richard A. Sitze
  */
 public class SPInterface {
@@ -39,34 +39,34 @@ public class SPInterface {
  * The service programming interface: intended to be
  * an interface or abstract class, but not limited
  * to those two.
- */
+ */
 private final Class spi;
-
+
 /**
  * The property name to be used for finding the name of
  * the SPI implementation class.
  */
 private final String propertyName;
-
-
+
+
 private Class  paramClasses[] = null;
 private Object params[] = null;
 
 
 /**
  * Construct object representing Class provider.
- * 
+ *
  * @param provider The SPI class
  */
 public SPInterface(Class provider) {
 this(provider, provider.getName());
 }
-
+
 /**
  * Construct object representing Class provider.
- * 
+ *
  * @param spi The SPI class
- * 
+ *
  * @param propertyName when looking for the name of a class implementing
  *the provider class, a discovery strategy may involve looking for
  *(system or other) properties having either the name of the class
@@ -79,12 +79,12 @@ public class SPInterface {
 
 /**
  * Construct object representing Class provider.
- * 
+ *
  * @param provider The SPI class
- * 
+ *
  * @param constructorParamClasses classes representing the
  *constructor argument types.
- * 
+ *
  * @param constructorParams objects representing the
  *constructor arguments.
  */
@@ -97,20 +97,20 @@ public class SPInterface {
  constructorParamClasses,
  constructorParams);
 }
-
+
 /**
  * Construct object representing Class provider.
- * 
+ *
  * @param spi The SPI class
- * 
+ *
  * @param propertyName when looking for the name of a class implementing
  *the provider class, a discovery strategy may involve looking for
  *(system or other) properties having either the name of the class
  *(provider) or the propertyName.
- * 
+ *
  * @param constructorParamClasses classes representing the
  *constructor argument types.
- * 
+ *
  * @param constructorParams objects representing the
  *constructor arguments.
  */
@@ -132,14 +132,14 @@ public class SPInterface {
 public Class getSPClass() {
 return spi;
 }
-
+
 public String getPropertyName() {
 return propertyName;
 }
 
 /**
  * Instantiate a new 
- */
+ */
 public  S newInstance(Class impl)
 throws DiscoveryException,
InstantiationException,
@@ -148,10 +148,10 @@ public class SPInterface {
InvocationTargetException
 {
 verifyAncestory(impl);
-
+
 return ClassUtils.newInstance(impl, paramClasses, params);
 }
-
+
 public  void verifyAncestory(Class impl) {
 ClassUtils.verifyAncestory(spi, impl);
 }




svn commit: r1088154 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/DiscoveryException.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 22:02:55 2011
New Revision: 1088154

URL: http://svn.apache.org/viewvc?rev=1088154&view=rev
Log:
removed trailing spaces

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/DiscoveryException.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/DiscoveryException.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/DiscoveryException.java?rev=1088154&r1=1088153&r2=1088154&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/DiscoveryException.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/DiscoveryException.java
 Sat Apr  2 22:02:55 2011
@@ -82,7 +82,7 @@ public class DiscoveryException extends 
 public Throwable getCause() {
 return this.cause;
 }
-
+
 public String toString() {
 String ls = System.getProperty("line.separator");
 String str = super.toString();




svn commit: r1088155 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/Resource.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 22:06:58 2011
New Revision: 1088155

URL: http://svn.apache.org/viewvc?rev=1088155&view=rev
Log:
removed trailing spaces

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/Resource.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/Resource.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/Resource.java?rev=1088155&r1=1088154&r2=1088155&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/Resource.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/Resource.java
 Sat Apr  2 22:06:58 2011
@@ -27,9 +27,9 @@ import java.util.List;
  * 'Resource' located by discovery.
  * Naming of methods becomes a real pain ('getClass()')
  * so I've patterned this after ClassLoader...
- * 
+ *
  * I think it works well as it will give users a point-of-reference.
- * 
+ *
  * @author Craig R. McClanahan
  * @author Costin Manolache
  * @author Richard A. Sitze
@@ -61,7 +61,7 @@ public class Resource
 //public void setResource(URL  resource) {
 //this.resource = resource;
 //}
-
+
 /**
  * Get the value of URL.
  * @return value of URL.
@@ -69,7 +69,7 @@ public class Resource
 public URL getResource() {
 return resource;
 }
-
+
 /**
  * Get the value of URL.
  * @return value of URL.
@@ -81,7 +81,7 @@ public class Resource
 return null;  // ignore
 }
 }
-
+
 /**
  * Get the value of loader.
  * @return value of loader.
@@ -89,7 +89,7 @@ public class Resource
 public ClassLoader getClassLoader() {
 return loader ;
 }
-
+
 ///**
 // * Set the value of loader.
 // * @param v  Value to assign to loader.
@@ -97,11 +97,12 @@ public class Resource
 //public void setClassLoader(ClassLoader  loader) {
 //this.loader = loader;
 //}
-
+
 public String toString() {
 return "Resource[" + getName() +  ", " + getResource() + ", " + 
getClassLoader() + "]";
 }
-
+
+
 public static Resource[] toArray(ResourceIterator iterator) {
 List resourceList = new LinkedList();
 while (iterator.hasNext()) {
@@ -109,7 +110,7 @@ public class Resource
 }
 Resource[] resources = new Resource[resourceList.size()];
 resourceList.toArray(resources);
-
+
 return resources;
 }
 }




svn commit: r1088156 - in /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery: ResourceClass.java ResourceIterator.java ResourceNameIterator.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 22:08:49 2011
New Revision: 1088156

URL: http://svn.apache.org/viewvc?rev=1088156&view=rev
Log:
removed trailing spaces

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceClass.java

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceIterator.java

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceNameIterator.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceClass.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceClass.java?rev=1088156&r1=1088155&r2=1088156&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceClass.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceClass.java
 Sat Apr  2 22:08:49 2011
@@ -28,9 +28,9 @@ import org.apache.commons.logging.Log;
  * 'Resource' located by discovery.
  * Naming of methods becomes a real pain ('getClass()')
  * so I've patterned this after ClassLoader...
- * 
+ *
  * I think it works well as it will give users a point-of-reference.
- * 
+ *
  * @author Richard A. Sitze
  */
 public class ResourceClass extends Resource
@@ -49,7 +49,7 @@ public class ResourceClass extends Re
 public ResourceClass(String resourceName, URL resource, ClassLoader 
loader) {
 super(resourceName, resource, loader);
 }
-
+
 /**
  * Get the value of resourceClass.
  * Loading the class does NOT guarentee that the class can be
@@ -89,7 +89,7 @@ public class ResourceClass extends Re
 Class returned = (Class) resourceClass;
 return returned;
 }
-
+
 public String toString() {
 return "ResourceClass[" + getName() +  ", " + getResource() + ", " + 
getClassLoader() + "]";
 }

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceIterator.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceIterator.java?rev=1088156&r1=1088155&r2=1088156&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceIterator.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceIterator.java
 Sat Apr  2 22:08:49 2011
@@ -25,7 +25,7 @@ public abstract class ResourceIterator i
 /**
  */
 public abstract Resource nextResource();
-
+
 public String nextResourceName() {
 return nextResource().getName();
 }

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceNameIterator.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceNameIterator.java?rev=1088156&r1=1088155&r2=1088156&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceNameIterator.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceNameIterator.java
 Sat Apr  2 22:08:49 2011
@@ -24,9 +24,9 @@ package org.apache.commons.discovery;
  * each call will 'move' the cursor.
  * nextResourceName() MUST BE non-destructive,
  * it does not change the state.
- * 
+ *
  * TODO: FIX iterator logic/semantics, possibly add 'currentResourceName()'.
- * 
+ *
  * @author Richard A. Sitze
  */
 public interface ResourceNameIterator




svn commit: r1088158 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceClassIterator.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 22:09:19 2011
New Revision: 1088158

URL: http://svn.apache.org/viewvc?rev=1088158&view=rev
Log:
removed trailing spaces

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceClassIterator.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceClassIterator.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceClassIterator.java?rev=1088158&r1=1088157&r2=1088158&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceClassIterator.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceClassIterator.java
 Sat Apr  2 22:09:19 2011
@@ -29,7 +29,7 @@ public abstract class ResourceClassItera
 public Resource nextResource() {
 return nextResourceClass();
 }
-
+
 public String nextResourceName() {
 return nextResourceClass().getName();
 }




svn commit: r1088159 - in /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery: ResourceNameDiscover.java ResourceNameIterator.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 22:10:43 2011
New Revision: 1088159

URL: http://svn.apache.org/viewvc?rev=1088159&view=rev
Log:
no needs to specify public method visibility in interfaces

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceNameDiscover.java

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceNameIterator.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceNameDiscover.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceNameDiscover.java?rev=1088159&r1=1088158&r2=1088159&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceNameDiscover.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceNameDiscover.java
 Sat Apr  2 22:10:43 2011
@@ -32,12 +32,12 @@ public interface ResourceNameDiscover
  * 
  * @return ResourceNameIterator
  */
-public ResourceNameIterator findResourceNames(String resourceName);
+ResourceNameIterator findResourceNames(String resourceName);
 
 /**
  * Locate names of resources that are bound to resourceNames.
  * 
  * @return ResourceNameIterator
  */
-public ResourceNameIterator findResourceNames(ResourceNameIterator 
resourceNames);
+ResourceNameIterator findResourceNames(ResourceNameIterator resourceNames);
 }

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceNameIterator.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceNameIterator.java?rev=1088159&r1=1088158&r2=1088159&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceNameIterator.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/ResourceNameIterator.java
 Sat Apr  2 22:10:43 2011
@@ -34,11 +34,11 @@ public interface ResourceNameIterator
 /**
  * hasNext()
  */
-public boolean hasNext();
+boolean hasNext();
 
 /**
  * nextResourceName() returns the name of the next resource,
- * and MUST be non-destructive.  Repeated calls 
+ * and MUST be non-destructive.  Repeated calls
  */
-public String nextResourceName();
+String nextResourceName();
 }




svn commit: r1088160 - in /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery: package-info.java package.html

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 22:13:19 2011
New Revision: 1088160

URL: http://svn.apache.org/viewvc?rev=1088160&view=rev
Log:
html package descriptor replaced by the java5 package-info descriptor

Added:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/package-info.java
   (with props)
Removed:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/package.html

Added: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/package-info.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/package-info.java?rev=1088160&view=auto
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/package-info.java
 (added)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/package-info.java
 Sat Apr  2 22:13:19 2011
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Highlights:
+ * 
+ * JDK 1.3 Service discovery
+ * Discovery supports JDK 1.1.8 and up (see 
org.apache.commons.discover.jdk.JDKHooks).
+ * 
+ * 
+ */
+package org.apache.commons.discovery;

Propchange: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/package-info.java
--
svn:eol-style = native

Propchange: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/package-info.java
--
svn:keywords = Date Author Id Revision HeadURL

Propchange: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/package-info.java
--
svn:mime-type = text/plain




svn commit: r1088161 - /commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 22:17:09 2011
New Revision: 1088161

URL: http://svn.apache.org/viewvc?rev=1088161&view=rev
Log:
removed useless casts

Modified:

commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java

Modified: 
commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java?rev=1088161&r1=1088160&r2=1088161&view=diff
==
--- 
commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java
 (original)
+++ 
commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java
 Sat Apr  2 22:17:09 2011
@@ -56,7 +56,7 @@ public class TestAll {
 TestInterface1 ti = null;
 
 try {
-ti = (TestInterface1)DiscoverSingleton.find(TestInterface1.class,
+ti = DiscoverSingleton.find(TestInterface1.class,
 
TestImpl1_1.class.getName());
 
 assertTrue(ti.getClass().getName() + "!=" + 
TestImpl1_1.class.getName(),
@@ -73,7 +73,7 @@ public class TestAll {
 TestInterface1 ti = null;
 
 try {
-ti = (TestInterface1)DiscoverSingleton.find(TestInterface1.class,
+ti = DiscoverSingleton.find(TestInterface1.class,
 
TestImpl1_2.class.getName());
 
 assertTrue(ti.getClass().getName() + "!=" + 
TestImpl1_2.class.getName(),
@@ -90,7 +90,7 @@ public class TestAll {
 TestInterface1 ti = null;
 
 try {
-ti = (TestInterface1)DiscoverSingleton.find(TestInterface1.class,
+ti = DiscoverSingleton.find(TestInterface1.class,
 
TestImpl1_1.class.getName());
 
 assertTrue("1. " + ti.getClass().getName() + "!=" + 
TestImpl1_1.class.getName(),
@@ -98,7 +98,7 @@ public class TestAll {
 
 // no release, should get cached value..
 
-ti = (TestInterface1)DiscoverSingleton.find(TestInterface1.class,
+ti = DiscoverSingleton.find(TestInterface1.class,
 
TestImpl1_2.class.getName());
 
 // factory should be cached
@@ -116,7 +116,7 @@ public class TestAll {
 TestInterface1 ti = null;
 
 try {
-ti = (TestInterface1)DiscoverSingleton.find(TestInterface1.class,
+ti = DiscoverSingleton.find(TestInterface1.class,
 
TestImpl1_1.class.getName());
 
 assertTrue("1. " + ti.getClass().getName() + "!=" + 
TestImpl1_1.class.getName(),
@@ -124,7 +124,7 @@ public class TestAll {
 
 DiscoverSingleton.release();
 
-ti = (TestInterface1)DiscoverSingleton.find(TestInterface1.class,
+ti = DiscoverSingleton.find(TestInterface1.class,
 
TestImpl1_2.class.getName());
 
 // factory should be cached
@@ -147,7 +147,7 @@ public class TestAll {
 props.setProperty(TestInterface1.class.getName(),
   TestImpl1_2.class.getName());
 
-ti = (TestInterface1)DiscoverSingleton.find(TestInterface1.class, 
props);
+ti = DiscoverSingleton.find(TestInterface1.class, props);
 
 assertTrue(ti.getClass().getName() + "!=" + 
TestImpl1_2.class.getName(),

ti.getClass().getName().equals(TestImpl1_2.class.getName()));
@@ -166,7 +166,7 @@ public class TestAll {
 ManagedProperties.setProperty(TestInterface1.class.getName(),
   TestImpl1_2.class.getName());
   
-ti = (TestInterface1)DiscoverSingleton.find(TestInterface1.class);
+ti = DiscoverSingleton.find(TestInterface1.class);
 
 assertTrue(ti.getClass().getName() + "!=" + 
TestImpl1_2.class.getName(),

ti.getClass().getName().equals(TestImpl1_2.class.getName()));




svn commit: r1088162 - /commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 22:20:19 2011
New Revision: 1088162

URL: http://svn.apache.org/viewvc?rev=1088162&view=rev
Log:
removed trailing spaces

Modified:

commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java

Modified: 
commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java?rev=1088162&r1=1088161&r2=1088162&view=diff
==
--- 
commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java
 (original)
+++ 
commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java
 Sat Apr  2 22:20:19 2011
@@ -54,7 +54,7 @@ public class TestAll {
 org.apache.commons.discovery.log.SimpleLog.setLevel(logLevel);
 
 TestInterface1 ti = null;
-
+
 try {
 ti = DiscoverSingleton.find(TestInterface1.class,
 
TestImpl1_1.class.getName());
@@ -65,7 +65,7 @@ public class TestAll {
 DiscoverSingleton.release();
 }
 }
-
+
 @Test
 public void testFindDefaultImpl_2() {
 org.apache.commons.discovery.log.SimpleLog.setLevel(logLevel);
@@ -82,22 +82,22 @@ public class TestAll {
 DiscoverSingleton.release();
 }
 }
-
+
 @Test
 public void testCache() {
 org.apache.commons.discovery.log.SimpleLog.setLevel(logLevel);
 
 TestInterface1 ti = null;
-
+
 try {
 ti = DiscoverSingleton.find(TestInterface1.class,
 
TestImpl1_1.class.getName());
 
 assertTrue("1. " + ti.getClass().getName() + "!=" + 
TestImpl1_1.class.getName(),

ti.getClass().getName().equals(TestImpl1_1.class.getName()));
-
+
 // no release, should get cached value..
-
+
 ti = DiscoverSingleton.find(TestInterface1.class,
 
TestImpl1_2.class.getName());
 
@@ -108,22 +108,22 @@ public class TestAll {
 DiscoverSingleton.release();
 }
 }
-
+
 @Test
 public void testRelease() {
 org.apache.commons.discovery.log.SimpleLog.setLevel(logLevel);
 
 TestInterface1 ti = null;
-
+
 try {
 ti = DiscoverSingleton.find(TestInterface1.class,
 
TestImpl1_1.class.getName());
 
 assertTrue("1. " + ti.getClass().getName() + "!=" + 
TestImpl1_1.class.getName(),

ti.getClass().getName().equals(TestImpl1_1.class.getName()));
-
+
 DiscoverSingleton.release();
-
+
 ti = DiscoverSingleton.find(TestInterface1.class,
 
TestImpl1_2.class.getName());
 
@@ -134,7 +134,7 @@ public class TestAll {
 DiscoverSingleton.release();
 }
 }
-
+
 @Test
 public void testFindPropertyImpl_1() {
 org.apache.commons.discovery.log.SimpleLog.setLevel(logLevel);
@@ -143,10 +143,10 @@ public class TestAll {
 
 try {
 Properties props = new Properties();
-
+
 props.setProperty(TestInterface1.class.getName(),
   TestImpl1_2.class.getName());
-
+
 ti = DiscoverSingleton.find(TestInterface1.class, props);
 
 assertTrue(ti.getClass().getName() + "!=" + 
TestImpl1_2.class.getName(),
@@ -155,7 +155,7 @@ public class TestAll {
 DiscoverSingleton.release();
 }
 }
-
+
 @Test
 public void testMyFactoryManagedProperty() {
 org.apache.commons.discovery.log.SimpleLog.setLevel(logLevel);
@@ -165,28 +165,28 @@ public class TestAll {
 try {
 ManagedProperties.setProperty(TestInterface1.class.getName(),
   TestImpl1_2.class.getName());
-  
+
 ti = DiscoverSingleton.find(TestInterface1.class);
 
 assertTrue(ti.getClass().getName() + "!=" + 
TestImpl1_2.class.getName(),

ti.getClass().getName().equals(TestImpl1_2.class.getName()));
 } finally {
 DiscoverSingleton.release();
-
+
 /**
  * Cleanup, don't want to affect next test..
  */
 ManagedProperties.setProperty(TestInterface1.class.getName(), 
null);
 }
 }
-
+
 
 @Test
 public void testFindPropFileDefault() {
 org.apache.commons.discovery.log.SimpleLog.setLevel(logLevel)

svn commit: r1088163 - /commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestInterface.properties

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 22:22:16 2011
New Revision: 1088163

URL: http://svn.apache.org/viewvc?rev=1088163&view=rev
Log:
added missing ASF license

Modified:

commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestInterface.properties

Modified: 
commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestInterface.properties
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestInterface.properties?rev=1088163&r1=1088162&r2=1088163&view=diff
==
--- 
commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestInterface.properties
 (original)
+++ 
commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestInterface.properties
 Sat Apr  2 22:22:16 2011
@@ -1 +1,18 @@
-org.apache.commons.discovery.test.TestInterface1=org.apache.commons.discovery.test.TestImpl1_1
\ No newline at end of file
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+
+# #  http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# $Id$
+
+org.apache.commons.discovery.test.TestInterface1=org.apache.commons.discovery.test.TestImpl1_1




svn commit: r1088164 - /commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestInterface.properties

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 22:23:43 2011
New Revision: 1088164

URL: http://svn.apache.org/viewvc?rev=1088164&view=rev
Log:
removed double sharp in comment

Modified:

commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestInterface.properties

Modified: 
commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestInterface.properties
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestInterface.properties?rev=1088164&r1=1088163&r2=1088164&view=diff
==
--- 
commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestInterface.properties
 (original)
+++ 
commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestInterface.properties
 Sat Apr  2 22:23:43 2011
@@ -5,7 +5,7 @@
 # (the "License"); you may not use this file except in compliance with
 # the License.  You may obtain a copy of the License at
 
-# #  http://www.apache.org/licenses/LICENSE-2.0
+#http://www.apache.org/licenses/LICENSE-2.0
 
 # Unless required by applicable law or agreed to in writing, software
 # distributed under the License is distributed on an "AS IS" BASIS,




svn commit: r1088165 - /commons/proper/discovery/trunk/src/test/META-INF/services/org.apache.commons.discovery.test.TestInterface2

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 22:25:03 2011
New Revision: 1088165

URL: http://svn.apache.org/viewvc?rev=1088165&view=rev
Log:
added missing ASF license header

Modified:

commons/proper/discovery/trunk/src/test/META-INF/services/org.apache.commons.discovery.test.TestInterface2

Modified: 
commons/proper/discovery/trunk/src/test/META-INF/services/org.apache.commons.discovery.test.TestInterface2
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/test/META-INF/services/org.apache.commons.discovery.test.TestInterface2?rev=1088165&r1=1088164&r2=1088165&view=diff
==
Binary files - no diff available.




svn commit: r1088168 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverSingleton.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 22:36:54 2011
New Revision: 1088168

URL: http://svn.apache.org/viewvc?rev=1088168&view=rev
Log:
updated javadoc according to new APIs signature

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverSingleton.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverSingleton.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverSingleton.java?rev=1088168&r1=1088167&r2=1088168&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverSingleton.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverSingleton.java
 Sat Apr  2 22:36:54 2011
@@ -56,17 +56,15 @@ import org.apache.commons.discovery.reso
  * components looking for a service.  If you are not sure which finder(s)
  * to use, you can narrow your search to one of these:
  * 
- * static Object find(Class spi);
- * static Object find(Class spi, Properties properties);
- * static Object find(Class spi, String defaultImpl);
- * static Object find(Class spi,
+ * static <T> T find(Class<T> spi);
+ * static <T> T find(Class<T> spi, Properties properties);
+ * static <T> T find(Class<T> spi, String defaultImpl);
+ * static <T> T find(Class<T> spi,
  *Properties properties, String defaultImpl);
- * static Object find(Class spi,
- *String propertiesFileName, String defaultImpl);
- * static Object find(String groupContext, Class spi,
- *Properties properties, String defaultImpl);
- * static Object find(String groupContext, Class spi,
+ * static <T> T find(Class<T> spi,
  *String propertiesFileName, String defaultImpl);
+ * static <T> T find(ClassLoaders loaders, SPInterface<T> spi,
+ *PropertiesHolder holder, DefaultClassHolder<T> 
holder);
  * 
  *
  * The DiscoverSingleton.find methods proceed as follows:




svn commit: r1088169 - /commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 22:58:51 2011
New Revision: 1088169

URL: http://svn.apache.org/viewvc?rev=1088169&view=rev
Log:
added two test cases that use the DiscoverClass to find SPI class/instance

Modified:

commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java

Modified: 
commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java?rev=1088169&r1=1088168&r2=1088169&view=diff
==
--- 
commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java
 (original)
+++ 
commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java
 Sat Apr  2 22:58:51 2011
@@ -17,6 +17,7 @@
 package org.apache.commons.discovery.test;
 
 import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
 import static junit.framework.Assert.assertTrue;
 import static junit.framework.Assert.fail;
 
@@ -220,6 +221,22 @@ public class TestAll {
 }
 
 @Test
+public void findServiceClass() {
+DiscoverClass discoverClass = new DiscoverClass();
+Class serviceClass = 
discoverClass.find(TestInterface2.class);
+
+assertNotNull(serviceClass);
+}
+
+@Test
+public void findServiceClassAndInstantiate() throws Exception {
+DiscoverClass discoverClass = new DiscoverClass();
+TestInterface2 serviceImpl = 
discoverClass.newInstance(TestInterface2.class);
+
+assertNotNull(serviceImpl);
+}
+
+@Test
 public void testLowLevelFind() {
 org.apache.commons.discovery.log.SimpleLog.setLevel(logLevel);
 




svn commit: r1088170 - /commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 23:02:10 2011
New Revision: 1088170

URL: http://svn.apache.org/viewvc?rev=1088170&view=rev
Log:
stripped 'test' prefix from test methods

Modified:

commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java

Modified: 
commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java?rev=1088170&r1=1088169&r2=1088170&view=diff
==
--- 
commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java
 (original)
+++ 
commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java
 Sat Apr  2 23:02:10 2011
@@ -51,7 +51,7 @@ public class TestAll {
 //org.apache.commons.discovery.log.SimpleLog.LOG_LEVEL_DEBUG;
 
 @Test
-public void testFindDefaultImpl_1() {
+public void findDefaultImpl_1() {
 org.apache.commons.discovery.log.SimpleLog.setLevel(logLevel);
 
 TestInterface1 ti = null;
@@ -68,7 +68,7 @@ public class TestAll {
 }
 
 @Test
-public void testFindDefaultImpl_2() {
+public void findDefaultImpl_2() {
 org.apache.commons.discovery.log.SimpleLog.setLevel(logLevel);
 
 TestInterface1 ti = null;
@@ -85,7 +85,7 @@ public class TestAll {
 }
 
 @Test
-public void testCache() {
+public void cacheAssertions() {
 org.apache.commons.discovery.log.SimpleLog.setLevel(logLevel);
 
 TestInterface1 ti = null;
@@ -111,7 +111,7 @@ public class TestAll {
 }
 
 @Test
-public void testRelease() {
+public void releaseAssertions() {
 org.apache.commons.discovery.log.SimpleLog.setLevel(logLevel);
 
 TestInterface1 ti = null;
@@ -137,7 +137,7 @@ public class TestAll {
 }
 
 @Test
-public void testFindPropertyImpl_1() {
+public void findPropertyImpl_1() {
 org.apache.commons.discovery.log.SimpleLog.setLevel(logLevel);
 
 TestInterface1 ti = null;
@@ -158,7 +158,7 @@ public class TestAll {
 }
 
 @Test
-public void testMyFactoryManagedProperty() {
+public void myFactoryManagedProperty() {
 org.apache.commons.discovery.log.SimpleLog.setLevel(logLevel);
 
 TestInterface1 ti = null;
@@ -183,7 +183,7 @@ public class TestAll {
 
 
 @Test
-public void testFindPropFileDefault() {
+public void findPropFileDefault() {
 org.apache.commons.discovery.log.SimpleLog.setLevel(logLevel);
 
 TestInterface1 ti = null;
@@ -202,7 +202,7 @@ public class TestAll {
 }
 
 @Test
-public void testFindServiceFileDefault() {
+public void findServiceFileDefault() {
 org.apache.commons.discovery.log.SimpleLog.setLevel(logLevel);
 
 TestInterface2 ti = null;
@@ -221,14 +221,6 @@ public class TestAll {
 }
 
 @Test
-public void findServiceClass() {
-DiscoverClass discoverClass = new DiscoverClass();
-Class serviceClass = 
discoverClass.find(TestInterface2.class);
-
-assertNotNull(serviceClass);
-}
-
-@Test
 public void findServiceClassAndInstantiate() throws Exception {
 DiscoverClass discoverClass = new DiscoverClass();
 TestInterface2 serviceImpl = 
discoverClass.newInstance(TestInterface2.class);
@@ -237,7 +229,7 @@ public class TestAll {
 }
 
 @Test
-public void testLowLevelFind() {
+public void lowLevelFind() {
 org.apache.commons.discovery.log.SimpleLog.setLevel(logLevel);
 
 ClassLoaders loaders = 
ClassLoaders.getAppLoaders(TestInterface2.class, getClass(), false);
@@ -262,7 +254,7 @@ public class TestAll {
 }
 
 @Test
-public void testFindResources() {
+public void findResources() {
 org.apache.commons.discovery.log.SimpleLog.setLevel(logLevel);
 
 ClassLoaders loaders = new ClassLoaders();
@@ -306,7 +298,7 @@ public class TestAll {
 }
 
 @Test
-public void testViaDiscoverClass() {
+public void findViaDiscoverClass() {
 org.apache.commons.discovery.log.SimpleLog.setLevel(logLevel);
 
 ClassLoaders loaders = 
ClassLoaders.getAppLoaders(TestInterface2.class, getClass(), false);




svn commit: r1088171 - /commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 23:05:14 2011
New Revision: 1088171

URL: http://svn.apache.org/viewvc?rev=1088171&view=rev
Log:
reorganized test methods

Modified:

commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java

Modified: 
commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java?rev=1088171&r1=1088170&r2=1088171&view=diff
==
--- 
commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java
 (original)
+++ 
commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java
 Sat Apr  2 23:05:14 2011
@@ -221,14 +221,6 @@ public class TestAll {
 }
 
 @Test
-public void findServiceClassAndInstantiate() throws Exception {
-DiscoverClass discoverClass = new DiscoverClass();
-TestInterface2 serviceImpl = 
discoverClass.newInstance(TestInterface2.class);
-
-assertNotNull(serviceImpl);
-}
-
-@Test
 public void lowLevelFind() {
 org.apache.commons.discovery.log.SimpleLog.setLevel(logLevel);
 
@@ -311,6 +303,17 @@ public class TestAll {
 
 }
 
+@Test
+public void instantiateViaDiscoverClass() throws Exception {
+ClassLoaders loaders = 
ClassLoaders.getAppLoaders(TestInterface2.class, getClass(), false);
+
+DiscoverClass discoverClass = new DiscoverClass(loaders);
+TestInterface2 serviceImpl = 
discoverClass.newInstance(TestInterface2.class);
+
+assertNotNull(serviceImpl);
+assertEquals(TestImpl2_1.class, serviceImpl.getClass());
+}
+
 /**
  * This allows the tests to run as a standalone application.
  */




svn commit: r1088173 - /commons/proper/discovery/trunk/src/site/xdoc/best-practices.xml

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 23:06:37 2011
New Revision: 1088173

URL: http://svn.apache.org/viewvc?rev=1088173&view=rev
Log:
updated documentation according to latest APIs changes

Modified:
commons/proper/discovery/trunk/src/site/xdoc/best-practices.xml

Modified: commons/proper/discovery/trunk/src/site/xdoc/best-practices.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/site/xdoc/best-practices.xml?rev=1088173&r1=1088172&r2=1088173&view=diff
==
--- commons/proper/discovery/trunk/src/site/xdoc/best-practices.xml (original)
+++ commons/proper/discovery/trunk/src/site/xdoc/best-practices.xml Sat Apr  2 
23:06:37 2011
@@ -78,12 +78,12 @@ different:
 
 To call discovery directly from user-code:
 
-
+
 import org.apache.commons.discovery.DiscoverSingleton;
 import org.apache.commons.logging.LogFactory;
 ...
-LogFactory logFactory = 
(LogFactory)DiscoverSingleton.find(LogFactory.class);
-
+LogFactory logFactory = DiscoverSingleton.find(LogFactory.class);
+
 
 DiscoverSingleton looks for the value of the system property
 org.apache.commons.logging.LogFactory
@@ -95,23 +95,23 @@ DiscoverSingleton also allows a ja
 parameter to be used for query for service implementation class name,
 as well as a default implementation class name:
 
-
+
 LogFactory factory =
-(LogFactory)DiscoverSingleton.find(LogFactory.class,
+DiscoverSingleton.find(LogFactory.class,
properties,
LogFactory.FACTORY_DEFAULT);
-
+
 
 
 
 The properties can also be specified as a resource name:
 
-
+
 LogFactory factory =
-(LogFactory)DiscoverSingleton.find(LogFactory.class,
+DiscoverSingleton.find(LogFactory.class,
LogFactory.FACTORY_PROPERTIES,
LogFactory.FACTORY_DEFAULT);
-
+
 
 This last form is equivalent in function
 to the original LogFactory.getFactory()
@@ -149,13 +149,13 @@ used and maintains internal state.
 To find a class directly from user-code:
 [NEED BETTER EXAMPLE]
 
-
+
 import org.apache.commons.discovery.DiscoverClass;
 import org.apache.commons.logging.LogFactory;
 ...
 DiscoverClass discoverClass = new DiscoverClass();
-Class logFactoryClass = (LogFactory)discoverClass.find(LogFactory.class);
-
+Class<? extends LogFactory> logFactoryClass = 
discoverClass.find(LogFactory.class);
+
 
 In this case, DiscoverClass looks for the value of the system property
 org.apache.commons.logging.LogFactory
@@ -166,13 +166,13 @@ Failing that, it uses JDK1.3-style servi
 To instantiate a class directly from user-code:
 [NEED BETTER EXAMPLE]
 
-
+
 import org.apache.commons.discovery.DiscoverClass;
 import org.apache.commons.logging.LogFactory;
 ...
 DiscoverClass discoverClass = new DiscoverClass();
-LogFactory logFactoryClass = 
(LogFactory)discoverClass.newInstance(LogFactory.class);
-
+LogFactory logFactoryClass = discoverClass.newInstance(LogFactory.class);
+
 
 
 
@@ -192,7 +192,7 @@ In this case, the factory plays double d
 to be discovered (abstract class), and the discovery mechanism.
 
 
-
+
 import java.util.Properties;
 import org.apache.commons.discovery.DiscoverSingleton;
 import org.apache.commons.discovery.DiscoveryException;
@@ -212,7 +212,7 @@ public abstract class LogFactory
 
 public static LogFactory getFactory() throws ServiceException
 {
-return (LogFactory)DiscoverSingleton.find(LogFactory.class,
+return DiscoverSingleton.find(LogFactory.class,
   LogFactory.class,
   FACTORY_PROPERTIES,
   FACTORY_DEFAULT);
@@ -221,14 +221,14 @@ public abstract class LogFactory
 public static LogFactory getFactory(Properties properties)
 throws ServiceException
 {
-return (LogFactory)DiscoverSingleton.find(LogFactory.class,
+return DiscoverSingleton.find(LogFactory.class,
   LogFactory.class,
   properties,
   FACTORY_DEFAULT);
 }
 ...
 }
-
+
 
 Note the addition of one extra parameter to the find
 method call.
@@ -242,7 +242,7 @@ for which Discovery will be
 In this example, they are the same class, as the LogFactory
 is providing helper methods that 'wrap' Discovery.
 
- 
+
 
 
 




svn commit: r1088177 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverClass.java

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 23:20:11 2011
New Revision: 1088177

URL: http://svn.apache.org/viewvc?rev=1088177&view=rev
Log:
DISCOVERY-12: DiscoverClass improvements
patch submitted by Neeme Praks

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverClass.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverClass.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverClass.java?rev=1088177&r1=1088176&r2=1088177&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverClass.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverClass.java
 Sat Apr  2 23:20:11 2011
@@ -313,20 +313,23 @@ public class DiscoverClass {
: properties.getProperties(spi, loaders);
 
 String[] classNames = discoverClassNames(spi, props);
+Exception error = null;
 
 if (classNames.length > 0) {
 DiscoverClasses classDiscovery = new 
DiscoverClasses(loaders);
 
-ResourceClassIterator classes =
-classDiscovery.findResourceClasses(classNames[0]);
-
-// If it's set as a property.. it had better be there!
-if (classes.hasNext()) {
-ResourceClass info = classes.nextResourceClass();
-try {
-return info.loadClass();
-} catch (Exception e) {
-// ignore
+for (int i = 0; i < classNames.length; i++) {
+ ResourceClassIterator classes =
+ classDiscovery.findResourceClasses(classNames[i]);
+
+ // If it's set as a property.. it had better be there!
+ if (classes.hasNext()) {
+ ResourceClass info = classes.nextResourceClass();
+ try {
+ return info.loadClass();
+ } catch (Exception e) {
+ error = e;
+ }
 }
 }
 } else {
@@ -347,12 +350,12 @@ public class DiscoverClass {
 try {
 return info.loadClass();
 } catch (Exception e) {
-// ignore
+error = e;
 }
 }
 }
 
-throw new DiscoveryException("No implementation defined for " + 
spi.getSPName());
+throw new DiscoveryException("No implementation defined for " + 
spi.getSPName(), error);
 // return null;
 }
 




svn commit: r1088184 - /commons/proper/discovery/trunk/RELEASE-NOTES.txt

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 23:45:39 2011
New Revision: 1088184

URL: http://svn.apache.org/viewvc?rev=1088184&view=rev
Log:
added latest changes for 0.5 release

Modified:
commons/proper/discovery/trunk/RELEASE-NOTES.txt

Modified: commons/proper/discovery/trunk/RELEASE-NOTES.txt
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/RELEASE-NOTES.txt?rev=1088184&r1=1088183&r2=1088184&view=diff
==
--- commons/proper/discovery/trunk/RELEASE-NOTES.txt (original)
+++ commons/proper/discovery/trunk/RELEASE-NOTES.txt Sat Apr  2 23:45:39 2011
@@ -2,102 +2,39 @@ $Id$
 
 
   Commons Discovery Package
-Version 0.4
+Version 0.5
Release Notes
 
 
 INTRODUCTION
 
 
-This is a minor bugfix and maintenance release. A few small features have been 
added.
+This is an APIs update and maintenance release.
 New projects are encouraged to use this release of discovery.
 
-The previous release of Commons Discovery was 0.2. The 0.3 release failed to 
happen, 
-though an SVN tag was created. Thus a version number of 0.4 is being used for 
this 
-release.
-
 IMPORTANT NOTES
 ===
-* The commons project has migrated to the Subversion version control system
-  (previously, CVS was used). Please see the commons
-  website for details (http://commons.apache.org).
-
-* This release is done under the Apache Public License version 2.0; the
-  previous release was under the APL 1.1. All files have been updated with
-  the new license terms (including many files formerly missing license text).
+
+BREAKING CHANGES:
+
+ * The minimum JDK requirement is now JDK 1.5. The provided binaries will not
+   work on lower JDKs. The source has been updated to leverage Generics and
+   other JDK 1.5 features where possible, and requires JDK 1.5 to compile.
 
 Dependencies
 =
-Commons Discovery depends on Commons Logging. It is built against version 
1.0.4.
+Commons Discovery depends on Commons Logging. It is built against version 
1.1.1.
 
 NEW FEATURES
 =
-* maven build process improved
-* documentation moved from raw html format to xdoc format
-  (best-practices.html, adc-guidelines.html)
-
-FILES CHANGED
-=
-* tools/ManagedProperties.java
-   --> fix NullPointerException in setProperty method.
-   --> added logging facilities to the class; debug output can now be
-   enabled if desired.
-   --> Hide SecurityException in getParent(ClassLoader)
-   --> Uses new JDKTools.getSystemProperty(String)
-
-* log/SimpleLog.java
-   --> if exception occurs on System.getProperty, use a default instead
- of throwing an exception.
-
-* ResourceNameIterator.java
-   --> javadoc improvements only
-
-* resource/names/DiscoverNamesInManagedProperties.java
-  resource/names/DiscoverNamesInFile.java
-   -->Generalize qualification of resource/file-names by prefix/suffix;
-  add new constructors that take prefix and suffix strings
-  for the resource to be located.
-
-* resource/names/DiscoverServiceNames.java
-   -->Generalize qualification of resource/file-names by prefix/suffix.
-
-* resource/ResourceDiscoverImpl.java
-   -->Defer creation of ClassLoaders until we need them, and create a
-  useful default [non-null].
-
-* resource/DiscoverResources:
-   --> fix to compile under JDK1.5 (don't use reserved word "enum")
-
-* jdk/JDKHooks:
-   --> New getSystemProperty method added.
-
-* jdk/JDK12Hooks
-   --> AXIS-1227:
-   Added a try/catch for RuntimeExceptions in JDK12Hooks to avoid 
-   NullPointerExceptions from JBoss' UnifiedClassLoader.  Reloading
-   the Axis webapp after a redepoy of service classes then allows
-   things to work normally.
-   --> made class public (formerly, was package-scope only)
-   In newer JVM/compilers, runtime complains when we try to invoke 
-   setLog on a non-public class.
-   --> AXIS-2145:
-   Checks that it has the security permission to create a new 
-   classloader.
-   --> New getSystemProperty method added.
-
-* jdk/JDK11Hooks 
-   --> made class public (formerly, was package-scope only)
-   In newer JVM/compilers, runtime complains when we try to invoke 
-   setLog on a non-public class.
-   --> New getSystemProperty method added.
+* Discovery APIs use Java5 Generics.
 
 BUGS FROM PREVIOUS RELEASE
 =
 
 JIRA Issues Addressed
 -
-* AXIS-1227 (https://issues.apache.org/jira/browse/AXIS-1227)
-* AXIS-2145 (https://issues.apache.org/jira/browse/AXIS-2145)
+* DISCOVERY-12 (https://issues.apache.org/jira/browse/DISCOVERY-12)
 
 
 DEPRECATIONS




svn commit: r1088186 - /commons/proper/discovery/trunk/src/site/site.xml

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sat Apr  2 23:57:40 2011
New Revision: 1088186

URL: http://svn.apache.org/viewvc?rev=1088186&view=rev
Log:
updated latest release version

Modified:
commons/proper/discovery/trunk/src/site/site.xml

Modified: commons/proper/discovery/trunk/src/site/site.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/site/site.xml?rev=1088186&r1=1088185&r2=1088186&view=diff
==
--- commons/proper/discovery/trunk/src/site/site.xml (original)
+++ commons/proper/discovery/trunk/src/site/site.xml Sat Apr  2 23:57:40 2011
@@ -26,7 +26,7 @@
 
 
 http://commons.apache.org/discovery/download_discovery.cgi"/>
-http://www.apache.org/dist/commons/discovery/RELEASE-NOTES.txt"/>
+http://www.apache.org/dist/commons/discovery/RELEASE-NOTES.txt"/>
 
 
 




svn commit: r1088187 - /commons/proper/discovery/trunk/pom.xml

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sun Apr  3 00:01:09 2011
New Revision: 1088187

URL: http://svn.apache.org/viewvc?rev=1088187&view=rev
Log:
added myself in the developers list

Modified:
commons/proper/discovery/trunk/pom.xml

Modified: commons/proper/discovery/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/pom.xml?rev=1088187&r1=1088186&r2=1088187&view=diff
==
--- commons/proper/discovery/trunk/pom.xml (original)
+++ commons/proper/discovery/trunk/pom.xml Sun Apr  3 00:01:09 2011
@@ -91,6 +91,11 @@
   rdonkin
   rdon...@apache.org
 
+
+  Simone Tripodi
+      simonetripodi
+  simonetrip...@apache.org
+
   
 
   




svn commit: r1088188 - /commons/proper/discovery/trunk/pom.xml

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sun Apr  3 00:01:43 2011
New Revision: 1088188

URL: http://svn.apache.org/viewvc?rev=1088188&view=rev
Log:
upgraded release version

Modified:
commons/proper/discovery/trunk/pom.xml

Modified: commons/proper/discovery/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/pom.xml?rev=1088188&r1=1088187&r2=1088188&view=diff
==
--- commons/proper/discovery/trunk/pom.xml (original)
+++ commons/proper/discovery/trunk/pom.xml Sun Apr  3 00:01:43 2011
@@ -114,7 +114,7 @@
 
   
 discovery
-0.4
+0.5
 
 DISCOVERY
 12310472




svn commit: r1088189 - /commons/proper/discovery/trunk/pom.xml

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sun Apr  3 00:02:19 2011
New Revision: 1088189

URL: http://svn.apache.org/viewvc?rev=1088189&view=rev
Log:
added the RC version

Modified:
commons/proper/discovery/trunk/pom.xml

Modified: commons/proper/discovery/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/pom.xml?rev=1088189&r1=1088188&r2=1088189&view=diff
==
--- commons/proper/discovery/trunk/pom.xml (original)
+++ commons/proper/discovery/trunk/pom.xml Sun Apr  3 00:02:19 2011
@@ -115,6 +115,7 @@
   
 discovery
 0.5
+RC1
 
 DISCOVERY
 12310472




svn commit: r1088190 - /commons/proper/discovery/trunk/pom.xml

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sun Apr  3 00:04:15 2011
New Revision: 1088190

URL: http://svn.apache.org/viewvc?rev=1088190&view=rev
Log:
improved project description

Modified:
commons/proper/discovery/trunk/pom.xml

Modified: commons/proper/discovery/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/pom.xml?rev=1088190&r1=1088189&r2=1088190&view=diff
==
--- commons/proper/discovery/trunk/pom.xml (original)
+++ commons/proper/discovery/trunk/pom.xml Sun Apr  3 00:04:15 2011
@@ -31,7 +31,8 @@
   Commons Discovery
 
   2002
-  Commons Discovery
+  The Discovery component is about discovering, or finding,
+  implementations for pluggable interfaces.
 
   http://commons.apache.org/discovery/
 




svn commit: r1088191 - /commons/proper/discovery/trunk/src/site/xdoc/download_discovery.xml

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sun Apr  3 00:15:36 2011
New Revision: 1088191

URL: http://svn.apache.org/viewvc?rev=1088191&view=rev
Log:
updated the download page via commons:download-page plugin

Modified:
commons/proper/discovery/trunk/src/site/xdoc/download_discovery.xml

Modified: commons/proper/discovery/trunk/src/site/xdoc/download_discovery.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/site/xdoc/download_discovery.xml?rev=1088191&r1=1088190&r2=1088191&view=diff
==
--- commons/proper/discovery/trunk/src/site/xdoc/download_discovery.xml 
(original)
+++ commons/proper/discovery/trunk/src/site/xdoc/download_discovery.xml Sun Apr 
 3 00:15:36 2011
@@ -95,32 +95,32 @@ limitations under the License.
   
 
 
-
+
   
 
   
-  commons-discovery-0.4.tar.gz
-  http://www.apache.org/dist/commons/discovery/binaries/commons-discovery-0.4.tar.gz.md5";>md5
-  http://www.apache.org/dist/commons/discovery/binaries/commons-discovery-0.4.tar.gz.asc";>pgp
+  commons-discovery-0.5.tar.gz
+  http://www.apache.org/dist/commons/discovery/binaries/commons-discovery-0.5.tar.gz.md5";>md5
+  http://www.apache.org/dist/commons/discovery/binaries/commons-discovery-0.5.tar.gz.asc";>pgp
   
   
-  commons-discovery-0.4.zip
-  http://www.apache.org/dist/commons/discovery/binaries/commons-discovery-0.4.zip.md5";>md5
-  http://www.apache.org/dist/commons/discovery/binaries/commons-discovery-0.4.zip.asc";>pgp
+  commons-discovery-0.5.zip
+  http://www.apache.org/dist/commons/discovery/binaries/commons-discovery-0.5.zip.md5";>md5
+  http://www.apache.org/dist/commons/discovery/binaries/commons-discovery-0.5.zip.asc";>pgp
   
 
   
   
 
   
-  commons-discovery-0.4-src.tar.gz
-  http://www.apache.org/dist/commons/discovery/source/commons-discovery-0.4-src.tar.gz.md5";>md5
-  http://www.apache.org/dist/commons/discovery/source/commons-discovery-0.4-src.tar.gz.asc";>pgp
+  commons-discovery-0.5-src.tar.gz
+  http://www.apache.org/dist/commons/discovery/source/commons-discovery-0.5-src.tar.gz.md5";>md5
+  http://www.apache.org/dist/commons/discovery/source/commons-discovery-0.5-src.tar.gz.asc";>pgp
   
   
-  commons-discovery-0.4-src.zip
-  http://www.apache.org/dist/commons/discovery/source/commons-discovery-0.4-src.zip.md5";>md5
-  http://www.apache.org/dist/commons/discovery/source/commons-discovery-0.4-src.zip.asc";>pgp
+  commons-discovery-0.5-src.zip
+  http://www.apache.org/dist/commons/discovery/source/commons-discovery-0.5-src.zip.md5";>md5
+  http://www.apache.org/dist/commons/discovery/source/commons-discovery-0.5-src.zip.asc";>pgp
   
 
   




svn commit: r1088192 - /commons/proper/discovery/trunk/pom.xml

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sun Apr  3 00:19:53 2011
New Revision: 1088192

URL: http://svn.apache.org/viewvc?rev=1088192&view=rev
Log:
added missing commons site distribution management (cannot be defined in parent)

Modified:
commons/proper/discovery/trunk/pom.xml

Modified: commons/proper/discovery/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/pom.xml?rev=1088192&r1=1088191&r2=1088192&view=diff
==
--- commons/proper/discovery/trunk/pom.xml (original)
+++ commons/proper/discovery/trunk/pom.xml Sun Apr  3 00:19:53 2011
@@ -122,7 +122,16 @@
 12310472
 1.5
 1.5
-   
+  
+
+  
+
+
+  apache.website
+  Apache Commons Site
+  
${commons.deployment.protocol}://people.apache.org/www/commons.apache.org/discovery
+
+  
 
   
 src/java




svn commit: r1088193 - /commons/proper/discovery/trunk/pom.xml

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sun Apr  3 00:23:32 2011
New Revision: 1088193

URL: http://svn.apache.org/viewvc?rev=1088193&view=rev
Log:
added missing RC profile (cannot be defined in parent)

Modified:
commons/proper/discovery/trunk/pom.xml

Modified: commons/proper/discovery/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/pom.xml?rev=1088193&r1=1088192&r2=1088193&view=diff
==
--- commons/proper/discovery/trunk/pom.xml (original)
+++ commons/proper/discovery/trunk/pom.xml Sun Apr  3 00:23:32 2011
@@ -188,4 +188,18 @@
   
 
 
+  
+
+  rc
+  
+
+
+  apache.website
+  Apache Commons Release Candidate Staging Site
+  
${commons.deployment.protocol}://people.apache.org/www/people.apache.org/builds/commons/${commons.componentid}/${commons.release.version}/${commons.rc.version}/site
+
+  
+
+  
+
 




svn commit: r1088194 - /commons/proper/discovery/trunk/src/assembly/src.xml

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sun Apr  3 00:26:24 2011
New Revision: 1088194

URL: http://svn.apache.org/viewvc?rev=1088194&view=rev
Log:
project.version replaced with commons.release.version, according to commons wiki

Modified:
commons/proper/discovery/trunk/src/assembly/src.xml

Modified: commons/proper/discovery/trunk/src/assembly/src.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/assembly/src.xml?rev=1088194&r1=1088193&r2=1088194&view=diff
==
--- commons/proper/discovery/trunk/src/assembly/src.xml (original)
+++ commons/proper/discovery/trunk/src/assembly/src.xml Sun Apr  3 00:26:24 2011
@@ -20,7 +20,7 @@
 tar.gz
 zip
 
-${project.artifactId}-${project.version}-src
+
${project.artifactId}-${commons.release.version}-src
 
 
 




svn commit: r1088197 - /commons/proper/discovery/trunk/doap_discovery.rdf

2011-04-02 Thread simonetripodi
Author: simonetripodi
Date: Sun Apr  3 00:29:56 2011
New Revision: 1088197

URL: http://svn.apache.org/viewvc?rev=1088197&view=rev
Log:
added estimated next release

Modified:
commons/proper/discovery/trunk/doap_discovery.rdf

Modified: commons/proper/discovery/trunk/doap_discovery.rdf
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/doap_discovery.rdf?rev=1088197&r1=1088196&r2=1088197&view=diff
==
--- commons/proper/discovery/trunk/doap_discovery.rdf (original)
+++ commons/proper/discovery/trunk/doap_discovery.rdf Sun Apr  3 00:29:56 2011
@@ -36,6 +36,11 @@
 
   
 commons-discovery
+2011-04-06
+0.5
+  
+  
+commons-discovery
 2003-04-15
 0.2
   




svn commit: r1088241 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverClass.java

2011-04-03 Thread simonetripodi
Author: simonetripodi
Date: Sun Apr  3 10:09:24 2011
New Revision: 1088241

URL: http://svn.apache.org/viewvc?rev=1088241&view=rev
Log:
uses Java5 iterator

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverClass.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverClass.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverClass.java?rev=1088241&r1=1088240&r2=1088241&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverClass.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverClass.java
 Sun Apr  3 10:09:24 2011
@@ -318,9 +318,9 @@ public class DiscoverClass {
 if (classNames.length > 0) {
 DiscoverClasses classDiscovery = new 
DiscoverClasses(loaders);
 
-for (int i = 0; i < classNames.length; i++) {
+for (String className : classNames) {
  ResourceClassIterator classes =
- classDiscovery.findResourceClasses(classNames[i]);
+ classDiscovery.findResourceClasses(className);
 
  // If it's set as a property.. it had better be there!
  if (classes.hasNext()) {




svn commit: r1088253 - /commons/proper/discovery/trunk/src/site/xdoc/best-practices.xml

2011-04-03 Thread simonetripodi
Author: simonetripodi
Date: Sun Apr  3 11:10:42 2011
New Revision: 1088253

URL: http://svn.apache.org/viewvc?rev=1088253&view=rev
Log:
added DI framework integration sample, using Guice 

Modified:
commons/proper/discovery/trunk/src/site/xdoc/best-practices.xml

Modified: commons/proper/discovery/trunk/src/site/xdoc/best-practices.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/site/xdoc/best-practices.xml?rev=1088253&r1=1088252&r2=1088253&view=diff
==
--- commons/proper/discovery/trunk/src/site/xdoc/best-practices.xml (original)
+++ commons/proper/discovery/trunk/src/site/xdoc/best-practices.xml Sun Apr  3 
11:10:42 2011
@@ -29,6 +29,7 @@ $Id$
 [Additional Tools]
   [Calling Directly]
   [Integrating into Factories 
: Wrapping]
+  [Integrating into DI 
framework: Google Guice]
 
 
 
@@ -243,6 +244,32 @@ In this example, they are the same class
 is providing helper methods that 'wrap' Discovery.
 
 
+
+3.2  INTEGRATING INTO DI FRAMEWORKS : GOOGLE GUICE
+
+Sometimes, a DiscoverSingleton/Factory approach 
like the one exposed above,
+is not enough, because you may require injecting dependencies in your 
discovered SPI.
+
+In this example is shown how DiscoverClass can be useful 
inside DI framework such
+Google Guice:
+
+
+Injector injector = Guice.createInjector(new AbstractModule() {
+
+@Override
+protected void configure() {
+...
+DiscoverClass discoverClass = new DiscoverClass();
+
bind(ServiceInterface.class).to(discoverClass.find(ServiceInterface.class));
+...
+}
+
+});
+
+
+In this way, ServiceInterface discovery is delegated to 
Commons Discovery,
+but concrete class implementation creation and dependencies injection, to 
Google Guice.
+
 
 
 




svn commit: r1088257 - in /commons/proper/discovery/trunk/src/changes: ./ changes.xml

2011-04-03 Thread simonetripodi
Author: simonetripodi
Date: Sun Apr  3 11:51:22 2011
New Revision: 1088257

URL: http://svn.apache.org/viewvc?rev=1088257&view=rev
Log:
first checkin of changes descriptor, since it has never been committed before, 
it contains details only on latest release

Added:
commons/proper/discovery/trunk/src/changes/
commons/proper/discovery/trunk/src/changes/changes.xml   (with props)

Added: commons/proper/discovery/trunk/src/changes/changes.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/changes/changes.xml?rev=1088257&view=auto
==
--- commons/proper/discovery/trunk/src/changes/changes.xml (added)
+++ commons/proper/discovery/trunk/src/changes/changes.xml Sun Apr  3 11:51:22 
2011
@@ -0,0 +1,33 @@
+
+
+
+  
+Commons Discovery Changes
+  
+  
+  
+
+  SPI implementation class searching logic has some issues: it discards 
all errors;
+  it only considers first className in supplied classNames array.
+
+
+  Moved to Java5 APIs, used Generics.
+
+  
+  
+

Propchange: commons/proper/discovery/trunk/src/changes/changes.xml
--
svn:eol-style = native

Propchange: commons/proper/discovery/trunk/src/changes/changes.xml
--
svn:keywords = Date Revision Author HeadURL Id

Propchange: commons/proper/discovery/trunk/src/changes/changes.xml
--
svn:mime-type = text/xml




svn commit: r1088271 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverClass.java

2011-04-03 Thread simonetripodi
Author: simonetripodi
Date: Sun Apr  3 12:50:37 2011
New Revision: 1088271

URL: http://svn.apache.org/viewvc?rev=1088271&view=rev
Log:
fixed javadoc property name

Modified:

commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverClass.java

Modified: 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverClass.java
URL: 
http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverClass.java?rev=1088271&r1=1088270&r2=1088271&view=diff
==
--- 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverClass.java
 (original)
+++ 
commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverClass.java
 Sun Apr  3 12:50:37 2011
@@ -595,7 +595,7 @@ public class DiscoverClass {
  *
  * @see ManagedProperties
  *
- * @param propertName the name of the system property whose value is
+ * @param propertyName the name of the system property whose value is
  *the name of the class to load.
  */
 public static String getManagedProperty(String propertyName) {




  1   2   3   4   5   6   7   8   9   10   >