servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r1133884 - in /servicemix/smx4/specs/trunk: java-persistence-api-1.1.1/src/main/java/javax/persistence/ java-persistence-api-2.0/src/main/java/javax/persistence/ javamail-api-1.4/src/main/java/javax/mail/ jaxb-api-2.0/src/main/java/javax/xm...
Date Thu, 09 Jun 2011 14:21:10 GMT
Author: gnodet
Date: Thu Jun  9 14:21:09 2011
New Revision: 1133884

URL: http://svn.apache.org/viewvc?rev=1133884&view=rev
Log:
[SMX4-859] ServiceMix Specs should check class space consistency before using an implementation

Modified:
    servicemix/smx4/specs/trunk/java-persistence-api-1.1.1/src/main/java/javax/persistence/Persistence.java
    servicemix/smx4/specs/trunk/java-persistence-api-2.0/src/main/java/javax/persistence/Persistence.java
    servicemix/smx4/specs/trunk/javamail-api-1.4/src/main/java/javax/mail/Session.java
    servicemix/smx4/specs/trunk/jaxb-api-2.0/src/main/java/javax/xml/bind/ContextFinder.java
    servicemix/smx4/specs/trunk/jaxb-api-2.1/src/main/java/javax/xml/bind/ContextFinder.java
    servicemix/smx4/specs/trunk/jaxb-api-2.2/src/main/java/javax/xml/bind/ContextFinder.java
    servicemix/smx4/specs/trunk/jaxp-api-1.3/src/main/java/javax/xml/datatype/FactoryFinder.java
    servicemix/smx4/specs/trunk/jaxp-api-1.3/src/main/java/javax/xml/parsers/FactoryFinder.java
    servicemix/smx4/specs/trunk/jaxp-api-1.3/src/main/java/javax/xml/transform/FactoryFinder.java
    servicemix/smx4/specs/trunk/jaxp-api-1.3/src/main/java/javax/xml/validation/SchemaFactoryFinder.java
    servicemix/smx4/specs/trunk/jaxp-api-1.3/src/main/java/javax/xml/xpath/XPathFactoryFinder.java
    servicemix/smx4/specs/trunk/jaxp-api-1.3/src/main/java/org/xml/sax/helpers/XMLReaderFactory.java
    servicemix/smx4/specs/trunk/jaxp-api-1.4/src/main/java/javax/xml/datatype/FactoryFinder.java
    servicemix/smx4/specs/trunk/jaxp-api-1.4/src/main/java/javax/xml/parsers/FactoryFinder.java
    servicemix/smx4/specs/trunk/jaxp-api-1.4/src/main/java/javax/xml/stream/FactoryFinder.java
    servicemix/smx4/specs/trunk/jaxp-api-1.4/src/main/java/javax/xml/transform/FactoryFinder.java
    servicemix/smx4/specs/trunk/jaxp-api-1.4/src/main/java/javax/xml/validation/SchemaFactoryFinder.java
    servicemix/smx4/specs/trunk/jaxp-api-1.4/src/main/java/javax/xml/xpath/XPathFactoryFinder.java
    servicemix/smx4/specs/trunk/jaxp-api-1.4/src/main/java/org/xml/sax/helpers/XMLReaderFactory.java
    servicemix/smx4/specs/trunk/jaxws-api-2.0/src/main/java/javax/xml/ws/spi/FactoryFinder.java
    servicemix/smx4/specs/trunk/jaxws-api-2.1/src/main/java/javax/xml/ws/spi/FactoryFinder.java
    servicemix/smx4/specs/trunk/jsr303-api-1.0.0/src/main/java/javax/validation/Validation.java
    servicemix/smx4/specs/trunk/jsr311-api-0.8/src/main/java/javax/rs/ext/FactoryFinder.java
    servicemix/smx4/specs/trunk/jsr311-api-1.0/src/main/java/javax/rs/ext/FactoryFinder.java
    servicemix/smx4/specs/trunk/jsr311-api-1.1.1/src/main/java/javax/rs/ext/FactoryFinder.java
    servicemix/smx4/specs/trunk/jsr311-api-1.1/src/main/java/javax/rs/ext/FactoryFinder.java
    servicemix/smx4/specs/trunk/locator/src/main/java/org/apache/servicemix/specs/locator/OsgiLocator.java
    servicemix/smx4/specs/trunk/locator/src/test/java/org/apache/servicemix/specs/locator/OsgiLocatorTest.java
    servicemix/smx4/specs/trunk/saaj-api-1.3/src/main/java/javax/xml/soap/FactoryFinder.java
    servicemix/smx4/specs/trunk/scripting-api-1.0/src/main/java/javax/script/ScriptEngineManager.java
    servicemix/smx4/specs/trunk/stax-api-1.0/src/main/java/javax/xml/stream/FactoryLocator.java

Modified: servicemix/smx4/specs/trunk/java-persistence-api-1.1.1/src/main/java/javax/persistence/Persistence.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/specs/trunk/java-persistence-api-1.1.1/src/main/java/javax/persistence/Persistence.java?rev=1133884&r1=1133883&r2=1133884&view=diff
==============================================================================
--- servicemix/smx4/specs/trunk/java-persistence-api-1.1.1/src/main/java/javax/persistence/Persistence.java
(original)
+++ servicemix/smx4/specs/trunk/java-persistence-api-1.1.1/src/main/java/javax/persistence/Persistence.java
Thu Jun  9 14:21:09 2011
@@ -97,11 +97,10 @@ public class Persistence {
         }
          
         //If we are deployed into an OSGi environment, leverage it
-        Class providerClass = org.apache.servicemix.specs.locator.OsgiLocator.locate("javax.persistence.spi.PersistenceProvider");
+        Class<? extends PersistenceProvider> providerClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(PersistenceProvider.class);
         if (providerClass != null) {
             try {
-                PersistenceProvider provider = (PersistenceProvider) providerClass
-                    .newInstance();
+                PersistenceProvider provider = providerClass.newInstance();
                 return provider.createEntityManagerFactory(persistenceUnitName,
                     properties);
             }

Modified: servicemix/smx4/specs/trunk/java-persistence-api-2.0/src/main/java/javax/persistence/Persistence.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/specs/trunk/java-persistence-api-2.0/src/main/java/javax/persistence/Persistence.java?rev=1133884&r1=1133883&r2=1133884&view=diff
==============================================================================
--- servicemix/smx4/specs/trunk/java-persistence-api-2.0/src/main/java/javax/persistence/Persistence.java
(original)
+++ servicemix/smx4/specs/trunk/java-persistence-api-2.0/src/main/java/javax/persistence/Persistence.java
Thu Jun  9 14:21:09 2011
@@ -81,10 +81,10 @@ public class Persistence {
         }
         
         // If we are deployed into an OSGi environment, leverage it
-        Class providerClass = org.apache.servicemix.specs.locator.OsgiLocator.locate("javax.persistence.spi.PersistenceProvider");
+        Class<? extends PersistenceProvider> providerClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(PersistenceProvider.class);
         if (providerClass != null) {
             try {
-                PersistenceProvider provider = (PersistenceProvider) providerClass.newInstance();
+                PersistenceProvider provider = providerClass.newInstance();
                 return provider.createEntityManagerFactory(persistenceUnitName, properties);
             }
             catch (Exception e) {

Modified: servicemix/smx4/specs/trunk/javamail-api-1.4/src/main/java/javax/mail/Session.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/specs/trunk/javamail-api-1.4/src/main/java/javax/mail/Session.java?rev=1133884&r1=1133883&r2=1133884&view=diff
==============================================================================
--- servicemix/smx4/specs/trunk/javamail-api-1.4/src/main/java/javax/mail/Session.java (original)
+++ servicemix/smx4/specs/trunk/javamail-api-1.4/src/main/java/javax/mail/Session.java Thu
Jun  9 14:21:09 2011
@@ -211,7 +211,7 @@ public final class Session {
      */
     public Provider getProvider(String protocol) throws NoSuchProviderException {
     	//If we are deployed into an OSGi environment, leverage it
-        Class providerClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(protocol);
+        Class<? extends Provider> providerClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(Provider.class,
protocol);
         if (providerClass != null) {
             try {
 				return (Provider) providerClass.newInstance();
@@ -492,11 +492,11 @@ public final class Session {
             }
             
             //If we are deployed into an OSGi environment, leverage it
-            Class providerClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(provider.getClassName());
+            Class<? extends Service> providerClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(Service.class,
provider.getClassName());
             if (providerClass != null) {
                 try {
                 	Constructor ctr = providerClass.getConstructor(PARAM_TYPES);
-                    return (Service) ctr.newInstance(new Object[]{this, name});
+                    return (Service) ctr.newInstance(this, name);
     			} catch (InstantiationException e) {
     				throw new NoSuchProviderException(e.getMessage());
     			} catch (IllegalAccessException e) {
@@ -507,7 +507,7 @@ public final class Session {
             ClassLoader cl = getClassLoader();
             Class clazz = cl.loadClass(provider.getClassName());
             Constructor ctr = clazz.getConstructor(PARAM_TYPES);
-            return (Service) ctr.newInstance(new Object[]{this, name});
+            return (Service) ctr.newInstance(this, name);
         } catch (ClassNotFoundException e) {
             throw (NoSuchProviderException) new NoSuchProviderException("Unable to load class
for provider: " + provider).initCause(e);
         } catch (NoSuchMethodException e) {

Modified: servicemix/smx4/specs/trunk/jaxb-api-2.0/src/main/java/javax/xml/bind/ContextFinder.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/specs/trunk/jaxb-api-2.0/src/main/java/javax/xml/bind/ContextFinder.java?rev=1133884&r1=1133883&r2=1133884&view=diff
==============================================================================
--- servicemix/smx4/specs/trunk/jaxb-api-2.0/src/main/java/javax/xml/bind/ContextFinder.java
(original)
+++ servicemix/smx4/specs/trunk/jaxb-api-2.0/src/main/java/javax/xml/bind/ContextFinder.java
Thu Jun  9 14:21:09 2011
@@ -150,7 +150,7 @@ class ContextFinder {
     private static Class loadSpi(String className, ClassLoader classLoader) throws JAXBException
{
         Class spiClass;
         try {
-            spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(JAXBContext.class.getName());
+            spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(JAXBContext.class);
             if (spiClass != null) {
                 return spiClass;
             }

Modified: servicemix/smx4/specs/trunk/jaxb-api-2.1/src/main/java/javax/xml/bind/ContextFinder.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/specs/trunk/jaxb-api-2.1/src/main/java/javax/xml/bind/ContextFinder.java?rev=1133884&r1=1133883&r2=1133884&view=diff
==============================================================================
--- servicemix/smx4/specs/trunk/jaxb-api-2.1/src/main/java/javax/xml/bind/ContextFinder.java
(original)
+++ servicemix/smx4/specs/trunk/jaxb-api-2.1/src/main/java/javax/xml/bind/ContextFinder.java
Thu Jun  9 14:21:09 2011
@@ -160,7 +160,7 @@ class ContextFinder {
     private static Class loadSpi(String className, ClassLoader classLoader) throws JAXBException
{
         Class spiClass;
         try {
-            spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(JAXBContext.class.getName());
+            spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(JAXBContext.class);
             if (spiClass != null) {
                 return spiClass;
             }

Modified: servicemix/smx4/specs/trunk/jaxb-api-2.2/src/main/java/javax/xml/bind/ContextFinder.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/specs/trunk/jaxb-api-2.2/src/main/java/javax/xml/bind/ContextFinder.java?rev=1133884&r1=1133883&r2=1133884&view=diff
==============================================================================
--- servicemix/smx4/specs/trunk/jaxb-api-2.2/src/main/java/javax/xml/bind/ContextFinder.java
(original)
+++ servicemix/smx4/specs/trunk/jaxb-api-2.2/src/main/java/javax/xml/bind/ContextFinder.java
Thu Jun  9 14:21:09 2011
@@ -477,7 +477,7 @@ class ContextFinder {
     private static Class safeLoadClass(String className, ClassLoader classLoader) throws
ClassNotFoundException {
        // using Osig locator to load the spi class 
        try {
-           Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(JAXBContext.class.getName());
+           Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(JAXBContext.class);
            if (spiClass != null) {
                return spiClass;
            }

Modified: servicemix/smx4/specs/trunk/jaxp-api-1.3/src/main/java/javax/xml/datatype/FactoryFinder.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/specs/trunk/jaxp-api-1.3/src/main/java/javax/xml/datatype/FactoryFinder.java?rev=1133884&r1=1133883&r2=1133884&view=diff
==============================================================================
--- servicemix/smx4/specs/trunk/jaxp-api-1.3/src/main/java/javax/xml/datatype/FactoryFinder.java
(original)
+++ servicemix/smx4/specs/trunk/jaxp-api-1.3/src/main/java/javax/xml/datatype/FactoryFinder.java
Thu Jun  9 14:21:09 2011
@@ -188,7 +188,8 @@ final class FactoryFinder {
 
         try {
             // If we are deployed into an OSGi environment, leverage it
-            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(factoryId);
+            Class factoryClass = FactoryFinder.class.getClassLoader().loadClass(factoryId);
+            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(factoryClass,
factoryId);
             if (spiClass != null) {
                 return spiClass.newInstance();
             }

Modified: servicemix/smx4/specs/trunk/jaxp-api-1.3/src/main/java/javax/xml/parsers/FactoryFinder.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/specs/trunk/jaxp-api-1.3/src/main/java/javax/xml/parsers/FactoryFinder.java?rev=1133884&r1=1133883&r2=1133884&view=diff
==============================================================================
--- servicemix/smx4/specs/trunk/jaxp-api-1.3/src/main/java/javax/xml/parsers/FactoryFinder.java
(original)
+++ servicemix/smx4/specs/trunk/jaxp-api-1.3/src/main/java/javax/xml/parsers/FactoryFinder.java
Thu Jun  9 14:21:09 2011
@@ -161,7 +161,8 @@ final class FactoryFinder {
         
         try {
             // If we are deployed into an OSGi environment, leverage it
-            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(factoryId);
+            Class factoryClass = FactoryFinder.class.getClassLoader().loadClass(factoryId);
+            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(factoryClass,
factoryId);
             if (spiClass != null) {
                 return spiClass.newInstance();
             }

Modified: servicemix/smx4/specs/trunk/jaxp-api-1.3/src/main/java/javax/xml/transform/FactoryFinder.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/specs/trunk/jaxp-api-1.3/src/main/java/javax/xml/transform/FactoryFinder.java?rev=1133884&r1=1133883&r2=1133884&view=diff
==============================================================================
--- servicemix/smx4/specs/trunk/jaxp-api-1.3/src/main/java/javax/xml/transform/FactoryFinder.java
(original)
+++ servicemix/smx4/specs/trunk/jaxp-api-1.3/src/main/java/javax/xml/transform/FactoryFinder.java
Thu Jun  9 14:21:09 2011
@@ -161,7 +161,8 @@ final class FactoryFinder {
         
         try {
             // If we are deployed into an OSGi environment, leverage it
-            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(factoryId);
+            Class factoryClass = FactoryFinder.class.getClassLoader().loadClass(factoryId);
+            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(factoryClass,
factoryId);
             if (spiClass != null) {
                 return spiClass.newInstance();
             }

Modified: servicemix/smx4/specs/trunk/jaxp-api-1.3/src/main/java/javax/xml/validation/SchemaFactoryFinder.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/specs/trunk/jaxp-api-1.3/src/main/java/javax/xml/validation/SchemaFactoryFinder.java?rev=1133884&r1=1133883&r2=1133884&view=diff
==============================================================================
--- servicemix/smx4/specs/trunk/jaxp-api-1.3/src/main/java/javax/xml/validation/SchemaFactoryFinder.java
(original)
+++ servicemix/smx4/specs/trunk/jaxp-api-1.3/src/main/java/javax/xml/validation/SchemaFactoryFinder.java
Thu Jun  9 14:21:09 2011
@@ -159,7 +159,7 @@ final class SchemaFactoryFinder  {
         
         try {
             // If we are deployed into an OSGi environment, leverage it
-            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(SERVICE_CLASS.getName());
+            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(SERVICE_CLASS);
             if (spiClass != null) {
                 return (SchemaFactory) spiClass.newInstance();
             }

Modified: servicemix/smx4/specs/trunk/jaxp-api-1.3/src/main/java/javax/xml/xpath/XPathFactoryFinder.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/specs/trunk/jaxp-api-1.3/src/main/java/javax/xml/xpath/XPathFactoryFinder.java?rev=1133884&r1=1133883&r2=1133884&view=diff
==============================================================================
--- servicemix/smx4/specs/trunk/jaxp-api-1.3/src/main/java/javax/xml/xpath/XPathFactoryFinder.java
(original)
+++ servicemix/smx4/specs/trunk/jaxp-api-1.3/src/main/java/javax/xml/xpath/XPathFactoryFinder.java
Thu Jun  9 14:21:09 2011
@@ -161,7 +161,7 @@ final class XPathFactoryFinder {
         
         try {
             // If we are deployed into an OSGi environment, leverage it
-            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(SERVICE_CLASS.getName());
+            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(SERVICE_CLASS);
             if (spiClass != null) {
                 return (XPathFactory) spiClass.newInstance();
             }

Modified: servicemix/smx4/specs/trunk/jaxp-api-1.3/src/main/java/org/xml/sax/helpers/XMLReaderFactory.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/specs/trunk/jaxp-api-1.3/src/main/java/org/xml/sax/helpers/XMLReaderFactory.java?rev=1133884&r1=1133883&r2=1133884&view=diff
==============================================================================
--- servicemix/smx4/specs/trunk/jaxp-api-1.3/src/main/java/org/xml/sax/helpers/XMLReaderFactory.java
(original)
+++ servicemix/smx4/specs/trunk/jaxp-api-1.3/src/main/java/org/xml/sax/helpers/XMLReaderFactory.java
Thu Jun  9 14:21:09 2011
@@ -123,9 +123,9 @@ final public class XMLReaderFactory
             
 	        try {
 	            // If we are deployed into an OSGi environment, leverage it
-	            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(property);
+	            Class<? extends XMLReader> spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(XMLReader.class,
property);
 	            if (spiClass != null) {
-	                return (XMLReader) spiClass.newInstance();
+	                return spiClass.newInstance();
 	            }
 	        } catch (Throwable e) {
 	        }

Modified: servicemix/smx4/specs/trunk/jaxp-api-1.4/src/main/java/javax/xml/datatype/FactoryFinder.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/specs/trunk/jaxp-api-1.4/src/main/java/javax/xml/datatype/FactoryFinder.java?rev=1133884&r1=1133883&r2=1133884&view=diff
==============================================================================
--- servicemix/smx4/specs/trunk/jaxp-api-1.4/src/main/java/javax/xml/datatype/FactoryFinder.java
(original)
+++ servicemix/smx4/specs/trunk/jaxp-api-1.4/src/main/java/javax/xml/datatype/FactoryFinder.java
Thu Jun  9 14:21:09 2011
@@ -188,7 +188,8 @@ final class FactoryFinder {
 
         try {
             // If we are deployed into an OSGi environment, leverage it
-            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(factoryId);
+            Class factoryClass = FactoryFinder.class.getClassLoader().loadClass(factoryId);
+            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(factoryClass,
factoryId);
             if (spiClass != null) {
                 return spiClass.newInstance();
             }

Modified: servicemix/smx4/specs/trunk/jaxp-api-1.4/src/main/java/javax/xml/parsers/FactoryFinder.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/specs/trunk/jaxp-api-1.4/src/main/java/javax/xml/parsers/FactoryFinder.java?rev=1133884&r1=1133883&r2=1133884&view=diff
==============================================================================
--- servicemix/smx4/specs/trunk/jaxp-api-1.4/src/main/java/javax/xml/parsers/FactoryFinder.java
(original)
+++ servicemix/smx4/specs/trunk/jaxp-api-1.4/src/main/java/javax/xml/parsers/FactoryFinder.java
Thu Jun  9 14:21:09 2011
@@ -161,7 +161,8 @@ final class FactoryFinder {
         
         try {
             // If we are deployed into an OSGi environment, leverage it
-            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(factoryId);
+            Class factoryClass = FactoryFinder.class.getClassLoader().loadClass(factoryId);
+            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(factoryClass,
factoryId);
             if (spiClass != null) {
                 return spiClass.newInstance();
             }

Modified: servicemix/smx4/specs/trunk/jaxp-api-1.4/src/main/java/javax/xml/stream/FactoryFinder.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/specs/trunk/jaxp-api-1.4/src/main/java/javax/xml/stream/FactoryFinder.java?rev=1133884&r1=1133883&r2=1133884&view=diff
==============================================================================
--- servicemix/smx4/specs/trunk/jaxp-api-1.4/src/main/java/javax/xml/stream/FactoryFinder.java
(original)
+++ servicemix/smx4/specs/trunk/jaxp-api-1.4/src/main/java/javax/xml/stream/FactoryFinder.java
Thu Jun  9 14:21:09 2011
@@ -184,7 +184,8 @@ final class FactoryFinder {
         
         try {
             // If we are deployed into an OSGi environment, leverage it
-            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(factoryId);
+            Class factoryClass = FactoryFinder.class.getClassLoader().loadClass(factoryId);
+            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(factoryClass,
factoryId);
             if (spiClass != null) {
                 return spiClass.newInstance();	
             }

Modified: servicemix/smx4/specs/trunk/jaxp-api-1.4/src/main/java/javax/xml/transform/FactoryFinder.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/specs/trunk/jaxp-api-1.4/src/main/java/javax/xml/transform/FactoryFinder.java?rev=1133884&r1=1133883&r2=1133884&view=diff
==============================================================================
--- servicemix/smx4/specs/trunk/jaxp-api-1.4/src/main/java/javax/xml/transform/FactoryFinder.java
(original)
+++ servicemix/smx4/specs/trunk/jaxp-api-1.4/src/main/java/javax/xml/transform/FactoryFinder.java
Thu Jun  9 14:21:09 2011
@@ -161,7 +161,8 @@ final class FactoryFinder {
         
         try {
             // If we are deployed into an OSGi environment, leverage it
-            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(factoryId);
+            Class factoryClass = FactoryFinder.class.getClassLoader().loadClass(factoryId);
+            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(factoryClass,
factoryId);
             if (spiClass != null) {
                 return spiClass.newInstance();
             }

Modified: servicemix/smx4/specs/trunk/jaxp-api-1.4/src/main/java/javax/xml/validation/SchemaFactoryFinder.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/specs/trunk/jaxp-api-1.4/src/main/java/javax/xml/validation/SchemaFactoryFinder.java?rev=1133884&r1=1133883&r2=1133884&view=diff
==============================================================================
--- servicemix/smx4/specs/trunk/jaxp-api-1.4/src/main/java/javax/xml/validation/SchemaFactoryFinder.java
(original)
+++ servicemix/smx4/specs/trunk/jaxp-api-1.4/src/main/java/javax/xml/validation/SchemaFactoryFinder.java
Thu Jun  9 14:21:09 2011
@@ -159,7 +159,7 @@ final class SchemaFactoryFinder  {
         
         try {
             // If we are deployed into an OSGi environment, leverage it
-            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(SERVICE_CLASS.getName());
+            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(SERVICE_CLASS);
             if (spiClass != null) {
                 return (SchemaFactory) spiClass.newInstance();
             }

Modified: servicemix/smx4/specs/trunk/jaxp-api-1.4/src/main/java/javax/xml/xpath/XPathFactoryFinder.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/specs/trunk/jaxp-api-1.4/src/main/java/javax/xml/xpath/XPathFactoryFinder.java?rev=1133884&r1=1133883&r2=1133884&view=diff
==============================================================================
--- servicemix/smx4/specs/trunk/jaxp-api-1.4/src/main/java/javax/xml/xpath/XPathFactoryFinder.java
(original)
+++ servicemix/smx4/specs/trunk/jaxp-api-1.4/src/main/java/javax/xml/xpath/XPathFactoryFinder.java
Thu Jun  9 14:21:09 2011
@@ -161,7 +161,7 @@ final class XPathFactoryFinder {
         
         try {
             // If we are deployed into an OSGi environment, leverage it
-            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(SERVICE_CLASS.getName());
+            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(SERVICE_CLASS);
             if (spiClass != null) {
                 return (XPathFactory) spiClass.newInstance();
             }

Modified: servicemix/smx4/specs/trunk/jaxp-api-1.4/src/main/java/org/xml/sax/helpers/XMLReaderFactory.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/specs/trunk/jaxp-api-1.4/src/main/java/org/xml/sax/helpers/XMLReaderFactory.java?rev=1133884&r1=1133883&r2=1133884&view=diff
==============================================================================
--- servicemix/smx4/specs/trunk/jaxp-api-1.4/src/main/java/org/xml/sax/helpers/XMLReaderFactory.java
(original)
+++ servicemix/smx4/specs/trunk/jaxp-api-1.4/src/main/java/org/xml/sax/helpers/XMLReaderFactory.java
Thu Jun  9 14:21:09 2011
@@ -123,9 +123,9 @@ final public class XMLReaderFactory
             
 	        try {
 	            // If we are deployed into an OSGi environment, leverage it
-	            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(property);
+	            Class<? extends XMLReader> spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(XMLReader.class,
property);
 	            if (spiClass != null) {
-	                return (XMLReader) spiClass.newInstance();
+	                return spiClass.newInstance();
 	            }
 	        } catch (Throwable e) {
 	        }

Modified: servicemix/smx4/specs/trunk/jaxws-api-2.0/src/main/java/javax/xml/ws/spi/FactoryFinder.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/specs/trunk/jaxws-api-2.0/src/main/java/javax/xml/ws/spi/FactoryFinder.java?rev=1133884&r1=1133883&r2=1133884&view=diff
==============================================================================
--- servicemix/smx4/specs/trunk/jaxws-api-2.0/src/main/java/javax/xml/ws/spi/FactoryFinder.java
(original)
+++ servicemix/smx4/specs/trunk/jaxws-api-2.0/src/main/java/javax/xml/ws/spi/FactoryFinder.java
Thu Jun  9 14:21:09 2011
@@ -171,7 +171,8 @@ class FactoryFinder {
                     
 			        try {
 			            // If we are deployed into an OSGi environment, leverage it
-			            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(iFactoryId);
+                        Class factoryClass = FactoryFinder.class.getClassLoader().loadClass(iFactoryId);
+                        Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(factoryClass,
iFactoryId);
 			            if (spiClass != null) {
 			                return spiClass.newInstance();
 			            }

Modified: servicemix/smx4/specs/trunk/jaxws-api-2.1/src/main/java/javax/xml/ws/spi/FactoryFinder.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/specs/trunk/jaxws-api-2.1/src/main/java/javax/xml/ws/spi/FactoryFinder.java?rev=1133884&r1=1133883&r2=1133884&view=diff
==============================================================================
--- servicemix/smx4/specs/trunk/jaxws-api-2.1/src/main/java/javax/xml/ws/spi/FactoryFinder.java
(original)
+++ servicemix/smx4/specs/trunk/jaxws-api-2.1/src/main/java/javax/xml/ws/spi/FactoryFinder.java
Thu Jun  9 14:21:09 2011
@@ -171,7 +171,8 @@ class FactoryFinder {
                     
 			        try {
 			            // If we are deployed into an OSGi environment, leverage it
-			            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(iFactoryId);
+                        Class factoryClass = FactoryFinder.class.getClassLoader().loadClass(iFactoryId);
+                        Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(factoryClass,
iFactoryId);
 			            if (spiClass != null) {
 			                return spiClass.newInstance();
 			            }

Modified: servicemix/smx4/specs/trunk/jsr303-api-1.0.0/src/main/java/javax/validation/Validation.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/specs/trunk/jsr303-api-1.0.0/src/main/java/javax/validation/Validation.java?rev=1133884&r1=1133883&r2=1133884&view=diff
==============================================================================
--- servicemix/smx4/specs/trunk/jsr303-api-1.0.0/src/main/java/javax/validation/Validation.java
(original)
+++ servicemix/smx4/specs/trunk/jsr303-api-1.0.0/src/main/java/javax/validation/Validation.java
Thu Jun  9 14:21:09 2011
@@ -314,9 +314,9 @@ public class Validation {
 				providers = new ArrayList<ValidationProvider<?>>();
 				try {
 					// If we are deployed into an OSGi environment, leverage it
-					Class providerClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(ValidationProvider.class.getName());
+					Class<? extends ValidationProvider> providerClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(ValidationProvider.class);
 					if (providerClass != null) {
-						providers.add(( ValidationProvider ) providerClass.newInstance());
+						providers.add(providerClass.newInstance());
 					}
 				} catch (Throwable e) {
 					// Do nothing here

Modified: servicemix/smx4/specs/trunk/jsr311-api-0.8/src/main/java/javax/rs/ext/FactoryFinder.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/specs/trunk/jsr311-api-0.8/src/main/java/javax/rs/ext/FactoryFinder.java?rev=1133884&r1=1133883&r2=1133884&view=diff
==============================================================================
--- servicemix/smx4/specs/trunk/jsr311-api-0.8/src/main/java/javax/rs/ext/FactoryFinder.java
(original)
+++ servicemix/smx4/specs/trunk/jsr311-api-0.8/src/main/java/javax/rs/ext/FactoryFinder.java
Thu Jun  9 14:21:09 2011
@@ -75,7 +75,8 @@ class FactoryFinder {
     static Object find(String factoryId, String fallbackClassName) throws ClassNotFoundException
{
         try {
             // If we are deployed into an OSGi environment, leverage it
-            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(factoryId);
+            Class factoryClass = FactoryFinder.class.getClassLoader().loadClass(factoryId);
+            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(factoryClass,
factoryId);
             if (spiClass != null) {
                 return spiClass.newInstance();
             }

Modified: servicemix/smx4/specs/trunk/jsr311-api-1.0/src/main/java/javax/rs/ext/FactoryFinder.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/specs/trunk/jsr311-api-1.0/src/main/java/javax/rs/ext/FactoryFinder.java?rev=1133884&r1=1133883&r2=1133884&view=diff
==============================================================================
--- servicemix/smx4/specs/trunk/jsr311-api-1.0/src/main/java/javax/rs/ext/FactoryFinder.java
(original)
+++ servicemix/smx4/specs/trunk/jsr311-api-1.0/src/main/java/javax/rs/ext/FactoryFinder.java
Thu Jun  9 14:21:09 2011
@@ -76,7 +76,8 @@ class FactoryFinder {
     static Object find(String factoryId, String fallbackClassName) throws ClassNotFoundException
{
         try {
             // If we are deployed into an OSGi environment, leverage it
-            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(factoryId);
+            Class factoryClass = FactoryFinder.class.getClassLoader().loadClass(factoryId);
+            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(factoryClass,
factoryId);
             if (spiClass != null) {
                 return spiClass.newInstance();
             }

Modified: servicemix/smx4/specs/trunk/jsr311-api-1.1.1/src/main/java/javax/rs/ext/FactoryFinder.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/specs/trunk/jsr311-api-1.1.1/src/main/java/javax/rs/ext/FactoryFinder.java?rev=1133884&r1=1133883&r2=1133884&view=diff
==============================================================================
--- servicemix/smx4/specs/trunk/jsr311-api-1.1.1/src/main/java/javax/rs/ext/FactoryFinder.java
(original)
+++ servicemix/smx4/specs/trunk/jsr311-api-1.1.1/src/main/java/javax/rs/ext/FactoryFinder.java
Thu Jun  9 14:21:09 2011
@@ -68,7 +68,8 @@ public class FactoryFinder {
     static Object find(String factoryId, String fallbackClassName) throws ClassNotFoundException
{
         try {
             // If we are deployed into an OSGi environment, leverage it
-            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(factoryId);
+            Class factoryClass = FactoryFinder.class.getClassLoader().loadClass(factoryId);
+            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(factoryClass,
factoryId);
             if (spiClass != null) {
                 return spiClass.newInstance();
             }

Modified: servicemix/smx4/specs/trunk/jsr311-api-1.1/src/main/java/javax/rs/ext/FactoryFinder.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/specs/trunk/jsr311-api-1.1/src/main/java/javax/rs/ext/FactoryFinder.java?rev=1133884&r1=1133883&r2=1133884&view=diff
==============================================================================
--- servicemix/smx4/specs/trunk/jsr311-api-1.1/src/main/java/javax/rs/ext/FactoryFinder.java
(original)
+++ servicemix/smx4/specs/trunk/jsr311-api-1.1/src/main/java/javax/rs/ext/FactoryFinder.java
Thu Jun  9 14:21:09 2011
@@ -76,7 +76,8 @@ class FactoryFinder {
     static Object find(String factoryId, String fallbackClassName) throws ClassNotFoundException
{
         try {
             // If we are deployed into an OSGi environment, leverage it
-            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(factoryId);
+            Class factoryClass = FactoryFinder.class.getClassLoader().loadClass(factoryId);
+            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(factoryClass,
factoryId);
             if (spiClass != null) {
                 return spiClass.newInstance();
             }

Modified: servicemix/smx4/specs/trunk/locator/src/main/java/org/apache/servicemix/specs/locator/OsgiLocator.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/specs/trunk/locator/src/main/java/org/apache/servicemix/specs/locator/OsgiLocator.java?rev=1133884&r1=1133883&r2=1133884&view=diff
==============================================================================
--- servicemix/smx4/specs/trunk/locator/src/main/java/org/apache/servicemix/specs/locator/OsgiLocator.java
(original)
+++ servicemix/smx4/specs/trunk/locator/src/main/java/org/apache/servicemix/specs/locator/OsgiLocator.java
Thu Jun  9 14:21:09 2011
@@ -16,13 +16,13 @@
  */
 package org.apache.servicemix.specs.locator;
 
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 import java.util.concurrent.Callable;
 import java.util.concurrent.locks.ReadWriteLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
-import java.util.List;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.ArrayList;
 
 public class OsgiLocator {
 
@@ -58,13 +58,18 @@ public class OsgiLocator {
                 l = new ArrayList<Callable<Class>>();
                 factories.put(id, l);
             }
-            l.add(factory);
+            l.add(0, factory);
         } finally {
             lock.writeLock().unlock();
         }
     }
 
-    public static Class locate(String factoryId) {
+
+    public static <T> Class<? extends T> locate(Class<T> factoryId) {
+        return locate(factoryId, factoryId.getName());
+    }
+
+    public static <T> Class<? extends T> locate(Class<T> factoryClass,
String factoryId) {
         lock.readLock().lock();
         try {
             if (factories != null) {
@@ -73,21 +78,18 @@ public class OsgiLocator {
                     // look up the System property first
                     String factoryClassName = System.getProperty(factoryId);
                     try {
-                        if (factoryClassName != null) {
-                            for (Callable<Class> i : l) {
-                                Class c = null;
-                                try {
-                                    c = i.call();
-                                } catch (Exception ex) {
-                                    // do nothing here
-                                }
-                                if (c != null && c.getName().equals(factoryClassName))
{
-                                    return c;
-                                }
+                        for (Callable<Class> i : l) {
+                            Class c = null;
+                            try {
+                                c = i.call();
+                            } catch (Exception ex) {
+                                // do nothing here
+                            }
+                            if (c != null && factoryClass == c.getClassLoader().loadClass(factoryClass.getName())
+                                     && (factoryClassName == null || c.getName().equals(factoryClassName)))
+                            {
+                                return c;
                             }
-                        } else {
-                            Callable<Class> callable = l.get(l.size() - 1);
-                            return callable.call();
                         }
                     } catch (Exception ex) {
                         // do nothing here
@@ -100,16 +102,23 @@ public class OsgiLocator {
         }
     }
 
-    public static List<Class> locateAll(String factoryId) {
+    public static <T> List<Class<? extends T>> locateAll(Class<T>
factoryId) {
+        return locateAll(factoryId, factoryId.getName());
+    }
+
+    public static <T> List<Class<? extends T>> locateAll(Class<T>
factoryClass, String factoryId) {
         lock.readLock().lock();
         try {
-            List<Class> classes = new ArrayList<Class>();
+            List<Class<? extends T>> classes = new ArrayList<Class<? extends
T>>();
             if (factories != null) {
                 List<Callable<Class>> l = factories.get(factoryId);
                 if (l != null) {
-                    for (Callable<Class> c : l) {
+                    for (Callable<Class> i : l) {
                     	try {
-                        	classes.add(c.call());
+                            Class c = i.call();
+                            if (c != null && factoryClass.isAssignableFrom(c)) {
+                        	    classes.add(c);
+                            }
                     	} catch (Exception e) {
                     	}
     				}

Modified: servicemix/smx4/specs/trunk/locator/src/test/java/org/apache/servicemix/specs/locator/OsgiLocatorTest.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/specs/trunk/locator/src/test/java/org/apache/servicemix/specs/locator/OsgiLocatorTest.java?rev=1133884&r1=1133883&r2=1133884&view=diff
==============================================================================
--- servicemix/smx4/specs/trunk/locator/src/test/java/org/apache/servicemix/specs/locator/OsgiLocatorTest.java
(original)
+++ servicemix/smx4/specs/trunk/locator/src/test/java/org/apache/servicemix/specs/locator/OsgiLocatorTest.java
Thu Jun  9 14:21:09 2011
@@ -31,19 +31,19 @@ public class OsgiLocatorTest extends Ass
     @Test
     public void testLocatorWithSystemProperty() {
         System.setProperty("Factory", "org.apache.servicemix.specs.locator.MockCallable");
-        Class clazz = OsgiLocator.locate("Factory");
+        Class clazz = OsgiLocator.locate(Object.class, "Factory");
         assertNotNull("Except to find the class", clazz);
         assertEquals("Get a wrong class.", MockCallable.class.getName(), clazz.getName());
         
         System.setProperty("Factory", "org.apache.servicemix.specs.locator");
-        clazz = OsgiLocator.locate("Factory");
+        clazz = OsgiLocator.locate(Object.class, "Factory");
         assertNull("Except to find the class", clazz);
         System.clearProperty("Factory");
     }
     
     @Test
     public void testLocatorWithoutSystemProperty() {
-        Class clazz = OsgiLocator.locate("Factory");
+        Class clazz = OsgiLocator.locate(Object.class, "Factory");
         assertNotNull("Except to find the class", clazz);
         assertEquals("Get a wrong class.", MockCallable2.class.getName(), clazz.getName());
     }

Modified: servicemix/smx4/specs/trunk/saaj-api-1.3/src/main/java/javax/xml/soap/FactoryFinder.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/specs/trunk/saaj-api-1.3/src/main/java/javax/xml/soap/FactoryFinder.java?rev=1133884&r1=1133883&r2=1133884&view=diff
==============================================================================
--- servicemix/smx4/specs/trunk/saaj-api-1.3/src/main/java/javax/xml/soap/FactoryFinder.java
(original)
+++ servicemix/smx4/specs/trunk/saaj-api-1.3/src/main/java/javax/xml/soap/FactoryFinder.java
Thu Jun  9 14:21:09 2011
@@ -83,7 +83,8 @@ class FactoryFinder {
                        String defaultFactoryClassName) throws SOAPException {
         try {
             // If we are deployed into an OSGi environment, leverage it
-            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(factoryPropertyName);
+            Class factoryClass = FactoryFinder.class.getClassLoader().loadClass(factoryPropertyName);
+            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(factoryClass,
factoryPropertyName);
             if (spiClass != null) {
                 return spiClass.newInstance();
             }

Modified: servicemix/smx4/specs/trunk/scripting-api-1.0/src/main/java/javax/script/ScriptEngineManager.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/specs/trunk/scripting-api-1.0/src/main/java/javax/script/ScriptEngineManager.java?rev=1133884&r1=1133883&r2=1133884&view=diff
==============================================================================
--- servicemix/smx4/specs/trunk/scripting-api-1.0/src/main/java/javax/script/ScriptEngineManager.java
(original)
+++ servicemix/smx4/specs/trunk/scripting-api-1.0/src/main/java/javax/script/ScriptEngineManager.java
Thu Jun  9 14:21:09 2011
@@ -95,10 +95,10 @@ public class ScriptEngineManager {
 
     public ScriptEngine getEngineByName(String shortName) {
 		ScriptEngineFactory factory = null;
-        List<Class> factoryClasses = org.apache.servicemix.specs.locator.OsgiLocator.locateAll("javax.script.ScriptEngineFactory");
-        for (Class factoryClass : factoryClasses) {
+        List<Class<? extends ScriptEngineFactory>> factoryClasses = org.apache.servicemix.specs.locator.OsgiLocator.locateAll(javax.script.ScriptEngineFactory.class);
+        for (Class<? extends ScriptEngineFactory> factoryClass : factoryClasses) {
 			try {
-				ScriptEngineFactory f = (ScriptEngineFactory) factoryClass.newInstance();
+				ScriptEngineFactory f = factoryClass.newInstance();
 				if (f.getNames().contains(shortName)) {
 					factory = f;
 					break;
@@ -123,10 +123,10 @@ public class ScriptEngineManager {
 
     public ScriptEngine getEngineByExtension(String extension) {
 		ScriptEngineFactory factory = null;
-        List<Class> factoryClasses = org.apache.servicemix.specs.locator.OsgiLocator.locateAll("javax.script.ScriptEngineFactory");
-        for (Class factoryClass : factoryClasses) {
+        List<Class<? extends ScriptEngineFactory>> factoryClasses = org.apache.servicemix.specs.locator.OsgiLocator.locateAll(javax.script.ScriptEngineFactory.class);
+        for (Class<? extends ScriptEngineFactory> factoryClass : factoryClasses) {
 			try {
-				ScriptEngineFactory f = (ScriptEngineFactory) factoryClass.newInstance();
+				ScriptEngineFactory f = factoryClass.newInstance();
 				if (f.getExtensions().contains(extension)) {
 					factory = f;
 					break;
@@ -151,10 +151,10 @@ public class ScriptEngineManager {
 
     public ScriptEngine getEngineByMimeType(String mimeType) {
 		ScriptEngineFactory factory = null;
-        List<Class> factoryClasses = org.apache.servicemix.specs.locator.OsgiLocator.locateAll("javax.script.ScriptEngineFactory");
-        for (Class factoryClass : factoryClasses) {
+        List<Class<? extends ScriptEngineFactory>> factoryClasses = org.apache.servicemix.specs.locator.OsgiLocator.locateAll(javax.script.ScriptEngineFactory.class);
+        for (Class<? extends ScriptEngineFactory> factoryClass : factoryClasses) {
 			try {
-				ScriptEngineFactory f = (ScriptEngineFactory) factoryClass.newInstance();
+				ScriptEngineFactory f = factoryClass.newInstance();
 				if (f.getMimeTypes().contains(mimeType)) {
 					factory = f;
 					break;
@@ -179,8 +179,8 @@ public class ScriptEngineManager {
 
     public List<ScriptEngineFactory> getEngineFactories() {
         List<ScriptEngineFactory> factories = new ArrayList();
-        List<Class> factoryClasses = org.apache.servicemix.specs.locator.OsgiLocator.locateAll("javax.script.ScriptEngineFactory");
-        for (Class factoryClass : factoryClasses) {
+        List<Class<? extends ScriptEngineFactory>> factoryClasses = org.apache.servicemix.specs.locator.OsgiLocator.locateAll(javax.script.ScriptEngineFactory.class);
+        for (Class<? extends ScriptEngineFactory> factoryClass : factoryClasses) {
 			try {
 				factories.add((ScriptEngineFactory) factoryClass.newInstance());
 			} catch (Throwable doNothing) {

Modified: servicemix/smx4/specs/trunk/stax-api-1.0/src/main/java/javax/xml/stream/FactoryLocator.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/specs/trunk/stax-api-1.0/src/main/java/javax/xml/stream/FactoryLocator.java?rev=1133884&r1=1133883&r2=1133884&view=diff
==============================================================================
--- servicemix/smx4/specs/trunk/stax-api-1.0/src/main/java/javax/xml/stream/FactoryLocator.java
(original)
+++ servicemix/smx4/specs/trunk/stax-api-1.0/src/main/java/javax/xml/stream/FactoryLocator.java
Thu Jun  9 14:21:09 2011
@@ -56,7 +56,8 @@ class FactoryLocator {
                          ClassLoader classLoader) throws FactoryConfigurationError {
         try {
             // If we are deployed into an OSGi environment, leverage it
-            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(factoryId);
+            Class factoryClass = FactoryLocator.class.getClassLoader().loadClass(factoryId);
+            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(factoryClass,
factoryId);
             if (spiClass != null) {
                 return spiClass.newInstance();
             }



Mime
View raw message