geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickmcgu...@apache.org
Subject svn commit: r920855 - in /geronimo/specs/trunk: geronimo-el_2.2_spec/ geronimo-el_2.2_spec/src/main/java/javax/el/ geronimo-jaxr_1.0_spec/ geronimo-jaxr_1.0_spec/src/main/java/javax/xml/registry/ geronimo-jaxrpc_1.1_spec/ geronimo-jaxrpc_1.1_spec/src/m...
Date Tue, 09 Mar 2010 13:09:52 GMT
Author: rickmcguire
Date: Tue Mar  9 13:09:52 2010
New Revision: 920855

URL: http://svn.apache.org/viewvc?rev=920855&view=rev
Log:
GERONIMO-5133 Geroinimo versions of the specs should pick up the additions made to the service
mix versions of the bundles. 

updates to jaxws 2.2, jaxr 1.0, stax-api 1.0, jaxrpc 1.1, validation 1.0, and el 2.2. 


Modified:
    geronimo/specs/trunk/geronimo-el_2.2_spec/pom.xml
    geronimo/specs/trunk/geronimo-el_2.2_spec/src/main/java/javax/el/ExpressionFactory.java
    geronimo/specs/trunk/geronimo-jaxr_1.0_spec/pom.xml
    geronimo/specs/trunk/geronimo-jaxr_1.0_spec/src/main/java/javax/xml/registry/ConnectionFactory.java
    geronimo/specs/trunk/geronimo-jaxrpc_1.1_spec/pom.xml
    geronimo/specs/trunk/geronimo-jaxrpc_1.1_spec/src/main/java/javax/xml/rpc/FactoryFinder.java
    geronimo/specs/trunk/geronimo-jaxws_2.2_spec/pom.xml
    geronimo/specs/trunk/geronimo-jaxws_2.2_spec/src/main/java/javax/xml/ws/spi/FactoryFinder.java
    geronimo/specs/trunk/geronimo-stax-api_1.0_spec/pom.xml
    geronimo/specs/trunk/geronimo-validation_1.0_spec/pom.xml
    geronimo/specs/trunk/geronimo-validation_1.0_spec/src/main/java/javax/validation/Validation.java

Modified: geronimo/specs/trunk/geronimo-el_2.2_spec/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-el_2.2_spec/pom.xml?rev=920855&r1=920854&r2=920855&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-el_2.2_spec/pom.xml (original)
+++ geronimo/specs/trunk/geronimo-el_2.2_spec/pom.xml Tue Mar  9 13:09:52 2010
@@ -7,9 +7,9 @@
     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
@@ -55,6 +55,15 @@
         <url>http://svn.apache.org/viewcvs.cgi/geronimo/specs/trunk/geronimo-el_2.2_spec/</url>
     </scm>
 
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-osgi-locator</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+
     <build>
         <plugins>
             <plugin>
@@ -62,7 +71,14 @@
                 <artifactId>maven-bundle-plugin</artifactId>
                 <configuration>
                     <instructions>
+                        <Bundle-SymbolicName>${groupId}.${artifactId};singleton=true</Bundle-SymbolicName>
+                        <Specification-Title>JSR-245 Java Expression Language API 2.2</Specification-Title>
+                        <Specification-Vendor>Sun Microsystems, Inc.</Specification-Vendor>
+                        <Specification-Version>2.2</Specification-Version>
                         <Export-Package>javax.el*;version=2.2</Export-Package>
+                        <Import-Package>org.apache.geronimo.osgi.registry.api;resolution:=optional,*</Import-Package>
+                        <Private-Package>org.apache.geronimo.osgi.locator</Private-Package>
+                        <Bundle-Activator>org.apache.geronimo.locator.Activator</Bundle-Activator>
                     </instructions>
                 </configuration>
             </plugin>

Modified: geronimo/specs/trunk/geronimo-el_2.2_spec/src/main/java/javax/el/ExpressionFactory.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-el_2.2_spec/src/main/java/javax/el/ExpressionFactory.java?rev=920855&r1=920854&r2=920855&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-el_2.2_spec/src/main/java/javax/el/ExpressionFactory.java
(original)
+++ geronimo/specs/trunk/geronimo-el_2.2_spec/src/main/java/javax/el/ExpressionFactory.java
Tue Mar  9 13:09:52 2010
@@ -28,6 +28,8 @@ import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 import java.util.Properties;
 
+import org.apache.geronimo.osgi.locator.ProviderLocator;
+
 /**
  *
  * @since 2.1
@@ -175,7 +177,12 @@ public abstract class ExpressionFactory 
                 return Class.forName(implClassName);
             }
         } catch (ClassNotFoundException e) {
-            throw new ELException("Fail to load implementation class " + implClassName, e);
+            // last gasp, use the OSGi locator to try to find this
+            Class cls = ProviderLocator.locate(implClassName);
+            if (cls == null) {
+                throw new ELException("Fail to load implementation class " + implClassName,
e);
+            }
+            return cls;
         }
     }
 }

Modified: geronimo/specs/trunk/geronimo-jaxr_1.0_spec/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jaxr_1.0_spec/pom.xml?rev=920855&r1=920854&r2=920855&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jaxr_1.0_spec/pom.xml (original)
+++ geronimo/specs/trunk/geronimo-jaxr_1.0_spec/pom.xml Tue Mar  9 13:09:52 2010
@@ -7,9 +7,9 @@
     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
@@ -58,6 +58,13 @@
         </dependency>
 
         <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-osgi-locator</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
             <version>3.8.2</version>
@@ -85,8 +92,14 @@
                 <artifactId>maven-bundle-plugin</artifactId>
                 <configuration>
                     <instructions>
+                        <Bundle-SymbolicName>${groupId}.${artifactId};singleton=true</Bundle-SymbolicName>
+                        <Specification-Title>JSR-93 Java API for XML Registries</Specification-Title>
+                        <Specification-Vendor>Sun Microsystems, Inc.</Specification-Vendor>
+                        <Specification-Version>1.0</Specification-Version>
                         <Export-Package>javax.xml.registry*;version=1.0</Export-Package>
-                        <Import-Package>javax.activation;version=1.1,*</Import-Package>
+                        <Import-Package>javax.activation;version=1.1,org.apache.geronimo.osgi.registry.api;resolution:=optional,*</Import-Package>
+                        <Private-Package>org.apache.geronimo.osgi.locator</Private-Package>
+                        <Bundle-Activator>org.apache.geronimo.locator.Activator</Bundle-Activator>
                     </instructions>
                 </configuration>
             </plugin>

Modified: geronimo/specs/trunk/geronimo-jaxr_1.0_spec/src/main/java/javax/xml/registry/ConnectionFactory.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jaxr_1.0_spec/src/main/java/javax/xml/registry/ConnectionFactory.java?rev=920855&r1=920854&r2=920855&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jaxr_1.0_spec/src/main/java/javax/xml/registry/ConnectionFactory.java
(original)
+++ geronimo/specs/trunk/geronimo-jaxr_1.0_spec/src/main/java/javax/xml/registry/ConnectionFactory.java
Tue Mar  9 13:09:52 2010
@@ -27,6 +27,8 @@ package javax.xml.registry;
 import java.util.Properties;
 import java.util.Collection;
 
+import org.apache.geronimo.osgi.locator.ProviderLocator;
+
 /**
  * @version $Revision$ $Date$
  */
@@ -49,10 +51,17 @@ public abstract class ConnectionFactory 
             cl = ConnectionFactory.class.getClassLoader();
         }
         try {
-            Class factoryClass = cl.loadClass(className);
+            Class factoryClass = null;
+            try {
+                factoryClass = cl.loadClass(className);
+            } catch (ClassNotFoundException e) {
+                // last gasp, use the OSGi locator to try to find this
+                factoryClass = ProviderLocator.locate(className);
+                if (factoryClass == null) {
+                    throw new JAXRException("Unable to load JAXR ConnectionFactoryClass:
" + className, e);
+                }
+            }
             return (ConnectionFactory) factoryClass.newInstance();
-        } catch (ClassNotFoundException e) {
-            throw new JAXRException("Unable to load JAXR ConnectionFactoryClass: " + className,
e);
         } catch (InstantiationException e) {
             throw new JAXRException("Unable to instantiate JAXR ConnectionFactoryClass: "
+ className, e);
         } catch (IllegalAccessException e) {

Modified: geronimo/specs/trunk/geronimo-jaxrpc_1.1_spec/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jaxrpc_1.1_spec/pom.xml?rev=920855&r1=920854&r2=920855&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jaxrpc_1.1_spec/pom.xml (original)
+++ geronimo/specs/trunk/geronimo-jaxrpc_1.1_spec/pom.xml Tue Mar  9 13:09:52 2010
@@ -7,9 +7,9 @@
     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
@@ -26,7 +26,7 @@
 
     <parent>
         <groupId>org.apache.geronimo.genesis</groupId>
-        <artifactId>genesis-java1.4-flava</artifactId>
+        <artifactId>genesis-java5-flava</artifactId>
         <version>2.0</version>
     </parent>
 
@@ -63,6 +63,13 @@
             <version>1.2</version>
             <scope>provided</scope>
         </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-osgi-locator</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
     </dependencies>
 
     <scm>
@@ -78,7 +85,14 @@
                 <artifactId>maven-bundle-plugin</artifactId>
                 <configuration>
                     <instructions>
+                        <Bundle-SymbolicName>${groupId}.${artifactId};singleton=true</Bundle-SymbolicName>
+                        <Specification-Title>JSR-101 Java API for XML-Based RPC</Specification-Title>
+                        <Specification-Vendor>Sun Microsystems, Inc.</Specification-Vendor>
+                        <Specification-Version>1.1</Specification-Version>
                         <Export-Package>javax.xml.rpc*;version=1.1</Export-Package>
+                        <Import-Package>org.apache.geronimo.osgi.registry.api;resolution:=optional,*</Import-Package>
+                        <Private-Package>org.apache.geronimo.osgi.locator</Private-Package>
+                        <Bundle-Activator>org.apache.geronimo.locator.Activator</Bundle-Activator>
                     </instructions>
                 </configuration>
             </plugin>

Modified: geronimo/specs/trunk/geronimo-jaxrpc_1.1_spec/src/main/java/javax/xml/rpc/FactoryFinder.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jaxrpc_1.1_spec/src/main/java/javax/xml/rpc/FactoryFinder.java?rev=920855&r1=920854&r2=920855&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jaxrpc_1.1_spec/src/main/java/javax/xml/rpc/FactoryFinder.java
(original)
+++ geronimo/specs/trunk/geronimo-jaxrpc_1.1_spec/src/main/java/javax/xml/rpc/FactoryFinder.java
Tue Mar  9 13:09:52 2010
@@ -28,6 +28,8 @@ import java.lang.reflect.InvocationTarge
 import java.lang.reflect.Method;
 import java.util.Properties;
 
+import org.apache.geronimo.osgi.locator.ProviderLocator;
+
 /**
  * This code is designed to implement the pluggability
  * feature and is designed to both compile and run on JDK version 1.1 and
@@ -109,10 +111,18 @@ class FactoryFinder {
                       // try again
                 }
             }
-            return Class.forName(className).newInstance();
-        } catch (ClassNotFoundException x) {
-            throw new ConfigurationError(
-                "Provider " + className + " not found", x);
+            try {
+                // try again with just Class.forName()
+                return Class.forName(className).newInstance();
+            } catch (ClassNotFoundException x) {
+                // last gasp, use the OSGi locator to try to find this
+                Class<?> cls = ProviderLocator.locate(className);
+                if (cls == null) {
+                    throw new ConfigurationError(
+                        "Provider " + className + " not found", x);
+                }
+                return cls.newInstance();
+            }
         } catch (Exception x) {
             throw new ConfigurationError(
                 "Provider " + className + " could not be instantiated: " + x,

Modified: geronimo/specs/trunk/geronimo-jaxws_2.2_spec/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jaxws_2.2_spec/pom.xml?rev=920855&r1=920854&r2=920855&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jaxws_2.2_spec/pom.xml (original)
+++ geronimo/specs/trunk/geronimo-jaxws_2.2_spec/pom.xml Tue Mar  9 13:09:52 2010
@@ -76,20 +76,17 @@
         </dependency>
 
         <dependency>
-            <groupId>javax.xml.bind</groupId>
-            <artifactId>jaxb-api</artifactId>
-            <version>2.2</version>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-jaxb_2.2_spec</artifactId>
+            <version>1.0-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-osgi-locator</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
             <scope>provided</scope>
-            <exclusions>
-                <exclusion>
-                    <groupId>javax.xml.stream</groupId>
-                    <artifactId>stax-api</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>javax.activation</groupId>
-                    <artifactId>activation</artifactId>
-                </exclusion>
-            </exclusions>
         </dependency>
     </dependencies>
 
@@ -100,7 +97,14 @@
                 <artifactId>maven-bundle-plugin</artifactId>
                 <configuration>
                     <instructions>
+                        <Bundle-SymbolicName>${groupId}.${artifactId};singleton=true</Bundle-SymbolicName>
+                        <Specification-Title>JSR-224 Java API for XML based Web Services
2.2</Specification-Title>
+                        <Specification-Vendor>Sun Microsystems, Inc.</Specification-Vendor>
+                        <Specification-Version>2.2</Specification-Version>
                         <Export-Package>javax.xml.ws*;version=2.2</Export-Package>
+                        <Import-Package>org.apache.geronimo.osgi.registry.api;resolution:=optional,*</Import-Package>
+                        <Private-Package>org.apache.geronimo.osgi.locator</Private-Package>
+                        <Bundle-Activator>org.apache.geronimo.osgi.locator.Activator</Bundle-Activator>
                     </instructions>
                 </configuration>
             </plugin>

Modified: geronimo/specs/trunk/geronimo-jaxws_2.2_spec/src/main/java/javax/xml/ws/spi/FactoryFinder.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jaxws_2.2_spec/src/main/java/javax/xml/ws/spi/FactoryFinder.java?rev=920855&r1=920854&r2=920855&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jaxws_2.2_spec/src/main/java/javax/xml/ws/spi/FactoryFinder.java
(original)
+++ geronimo/specs/trunk/geronimo-jaxws_2.2_spec/src/main/java/javax/xml/ws/spi/FactoryFinder.java
Tue Mar  9 13:09:52 2010
@@ -29,6 +29,8 @@ import java.lang.reflect.Method;
 import java.security.PrivilegedAction;
 import java.util.Properties;
 
+import org.apache.geronimo.osgi.locator.ProviderLocator;
+
 /**
  * This code is designed to implement the pluggability
  * feature and is designed to both compile and run on JDK version 1.1 and
@@ -61,13 +63,13 @@ class FactoryFinder {
      */
     private static ClassLoader findClassLoader()
             throws ConfigurationError {
-        // REVIEW This doPriv block may be unnecessary because this method is private and

-        // the caller already has a doPriv.  I added the doPriv in case someone changes the

+        // REVIEW This doPriv block may be unnecessary because this method is private and
+        // the caller already has a doPriv.  I added the doPriv in case someone changes the
         // visibility of this method to non-private.
         ClassLoader cl = (ClassLoader)
             doPrivileged( new PrivilegedAction<Object>() {
                 public Object run() {
-                
+
                     Method m = null;
 
                     try {
@@ -94,7 +96,7 @@ class FactoryFinder {
             }
         );
         return cl;
-        
+
     }
 
     /**
@@ -112,14 +114,14 @@ class FactoryFinder {
     private static Object newInstance(String className,
                                       ClassLoader classLoader)
             throws ConfigurationError {
-        
+
         final ClassLoader iClassLoader = classLoader;
         final String iClassName = className;
-        
-        // REVIEW This doPriv block may be unnecessary because this method is private and

-        // the caller already has a doPriv.  I added the doPriv in case someone changes the

+
+        // REVIEW This doPriv block may be unnecessary because this method is private and
+        // the caller already has a doPriv.  I added the doPriv in case someone changes the
         // visibility of this method to non-private.
-        Object obj = 
+        Object obj =
             doPrivileged( new PrivilegedAction<Object>() {
                 public Object run() {
                     try {
@@ -130,7 +132,16 @@ class FactoryFinder {
                                 // try again
                             }
                         }
-                        return Class.forName(iClassName).newInstance();
+                        try {
+                            return Class.forName(iClassName).newInstance();
+                        } catch (ClassNotFoundException x) {
+                            // last gasp, use the OSGi locator to try to find this
+                            Class cls = ProviderLocator.locate(iClassName);
+                            if (cls == null) {
+                                throw x;
+                            }
+                            return cls.newInstance();
+                        }
                     } catch (ClassNotFoundException x) {
                         throw new ConfigurationError(
                                 "Provider " + iClassName + " not found", x);
@@ -158,17 +169,17 @@ class FactoryFinder {
      */
     static Object find(String factoryId, String fallbackClassName)
             throws ConfigurationError {
-        
+
         final String iFactoryId = factoryId;
         final String iFallbackClassName = fallbackClassName;
-        
-        Object obj = 
+
+        Object obj =
             doPrivileged( new PrivilegedAction<Object>() {
                 public Object run() {
                     debugPrintln("debug is on");
-                    
+
                     ClassLoader classLoader = findClassLoader();
-			
+
                     // Use the system property first
                     try {
                         String systemProp =
@@ -179,7 +190,7 @@ class FactoryFinder {
                         }
                     } catch (SecurityException se) {
                     }
-                    
+
                     // try to read from $java.home/lib/xml.properties
                     try {
                         String javah = System.getProperty("java.home");
@@ -196,7 +207,7 @@ class FactoryFinder {
                     } catch (Exception ex) {
                         if (debug) ex.printStackTrace();
                     }
-                    
+
                     String serviceId = "META-INF/services/" + iFactoryId;
                     // try to find services in CLASSPATH
                     try {
@@ -206,10 +217,10 @@ class FactoryFinder {
                         } else {
                             is = classLoader.getResourceAsStream(serviceId);
                         }
-                        
+
                         if (is != null) {
                             debugPrintln("found " + serviceId);
-                            
+
                             // Read the service provider name in UTF-8 as specified in
                             // the jar spec.  Unfortunately this fails in Microsoft
                             // VJ++, which does not implement the UTF-8
@@ -232,10 +243,10 @@ class FactoryFinder {
                             } catch (java.io.UnsupportedEncodingException e) {
                                 rd = new BufferedReader(new InputStreamReader(is));
                             }
-                            
+
                             String factoryClassName = rd.readLine();
                             rd.close();
-                            
+
                             if (factoryClassName != null &&
                                     ! "".equals(factoryClassName)) {
                                 debugPrintln("loaded from services: " + factoryClassName);
@@ -245,12 +256,12 @@ class FactoryFinder {
                     } catch (Exception ex) {
                         if (debug) ex.printStackTrace();
                     }
-                    
+
                     if (iFallbackClassName == null) {
                         throw new ConfigurationError(
                                 "Provider for " + iFactoryId + " cannot be found", null);
                     }
-                    
+
                     debugPrintln("loaded from fallback value: " + iFallbackClassName);
                     return newInstance(iFallbackClassName, classLoader);
                 }

Modified: geronimo/specs/trunk/geronimo-stax-api_1.0_spec/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-stax-api_1.0_spec/pom.xml?rev=920855&r1=920854&r2=920855&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-stax-api_1.0_spec/pom.xml (original)
+++ geronimo/specs/trunk/geronimo-stax-api_1.0_spec/pom.xml Tue Mar  9 13:09:52 2010
@@ -51,7 +51,6 @@
             <version>1.0.0-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
-
     </dependencies>
 
     <build>

Modified: geronimo/specs/trunk/geronimo-validation_1.0_spec/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-validation_1.0_spec/pom.xml?rev=920855&r1=920854&r2=920855&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-validation_1.0_spec/pom.xml (original)
+++ geronimo/specs/trunk/geronimo-validation_1.0_spec/pom.xml Tue Mar  9 13:09:52 2010
@@ -23,7 +23,7 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 
     <modelVersion>4.0.0</modelVersion>
-    
+
     <parent>
         <groupId>org.apache.geronimo.genesis</groupId>
         <artifactId>genesis-java5-flava</artifactId>
@@ -55,6 +55,15 @@
         <url>http://svn.apache.org/viewcvs.cgi/geronimo/specs/trunk/geronimo-validation_1.0_spec/</url>
     </scm>
 
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-osgi-locator</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+
     <build>
         <pluginManagement>
             <plugins>
@@ -73,10 +82,14 @@
                 <artifactId>maven-bundle-plugin</artifactId>
                 <configuration>
                     <instructions>
+                        <Bundle-SymbolicName>${groupId}.${artifactId};singleton=true</Bundle-SymbolicName>
                         <Specification-Title>JSR-303 Bean Validation API</Specification-Title>
                         <Specification-Vendor>Sun Microsystems, Inc.</Specification-Vendor>
                         <Specification-Version>1.0</Specification-Version>
                         <Export-Package>javax.validation*;version=1.0</Export-Package>
+                        <Import-Package>org.apache.geronimo.osgi.registry.api;resolution:=optional,*</Import-Package>
+                        <Private-Package>org.apache.geronimo.osgi.locator</Private-Package>
+                        <Bundle-Activator>org.apache.geronimo.locator.Activator</Bundle-Activator>
                     </instructions>
                 </configuration>
             </plugin>

Modified: geronimo/specs/trunk/geronimo-validation_1.0_spec/src/main/java/javax/validation/Validation.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-validation_1.0_spec/src/main/java/javax/validation/Validation.java?rev=920855&r1=920854&r2=920855&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-validation_1.0_spec/src/main/java/javax/validation/Validation.java
(original)
+++ geronimo/specs/trunk/geronimo-validation_1.0_spec/src/main/java/javax/validation/Validation.java
Tue Mar  9 13:09:52 2010
@@ -5,9 +5,9 @@
  * 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
@@ -34,11 +34,13 @@ import javax.validation.bootstrap.Provid
 import javax.validation.spi.BootstrapState;
 import javax.validation.spi.ValidationProvider;
 
+import org.apache.geronimo.osgi.locator.ProviderLocator;
+
 /**
  * Note: From Section 4.4.5 Validation of the 1.0 PFD Spec - Validation
  * implementations may only provide the following three public static methods:
  * buildDefaultValidatorFactory(), byDefaultProvider(), byProvider()
- * 
+ *
  * @version $Rev$ $Date$
  */
 public class Validation {
@@ -58,7 +60,7 @@ public class Validation {
 
     /*
      * (non-Javadoc) See Section 4.4.5 Validation - Must be private
-     * 
+     *
      * Geronimo implementation specific code.
      */
 	private static class ProviderSpecificBootstrapImpl<T extends Configuration<T>,
U extends ValidationProvider<T>>
@@ -69,17 +71,17 @@ public class Validation {
 
         /*
          * (non-Javadoc)
-         * 
+         *
          * @see javax.validation.bootstrap.ProviderSpecificBootstrap#ProviderSpecificBootstrap(Class<T>)
          */
-		
+
 		public ProviderSpecificBootstrapImpl(Class<U> validationProviderClass) {
 			providerClass = validationProviderClass;
         }
 
         /*
          * (non-Javadoc)
-         * 
+         *
          * @see javax.validation.bootstrap.ProviderSpecificBootstrap#providerResolver(javax.validation.ValidationProviderResolver)
          */
         public ProviderSpecificBootstrap<T> providerResolver(ValidationProviderResolver
resolver) {
@@ -89,7 +91,7 @@ public class Validation {
 
         /*
          * (non-Javadoc)
-         * 
+         *
          * @see javax.validation.bootstrap.ProviderSpecificBootstrap#configure()
          */
         public T configure() {
@@ -119,7 +121,7 @@ public class Validation {
 
     /*
      * (non-Javadoc) See Section 4.4.5 Validation - Must be private
-     * 
+     *
      * Geronimo implementation specific code.
      */
     private static class GenericBootstrapImpl implements GenericBootstrap, BootstrapState
{
@@ -129,7 +131,7 @@ public class Validation {
 
         /*
          * (non-Javadoc)
-         * 
+         *
          * @see javax.validation.bootstrap.GenericBootstrap#providerResolver(javax.validation.ValidationProviderResolver)
          */
         public GenericBootstrap providerResolver(ValidationProviderResolver resolver) {
@@ -139,7 +141,7 @@ public class Validation {
 
         /*
          * (non-Javadoc)
-         * 
+         *
          * @see javax.validation.spi.BootstrapState#getValidationProviderResolver()
          */
         public ValidationProviderResolver getValidationProviderResolver() {
@@ -148,7 +150,7 @@ public class Validation {
 
         /*
          * (non-Javadoc)
-         * 
+         *
          * @see javax.validation.spi.BootstrapState#getDefaultValidationProviderResolver()
          */
         public ValidationProviderResolver getDefaultValidationProviderResolver() {
@@ -159,7 +161,7 @@ public class Validation {
 
         /*
          * (non-Javadoc)
-         * 
+         *
          * @see javax.validation.bootstrap.GenericBootstrap#configure()
          */
         public Configuration<?> configure() {
@@ -176,21 +178,21 @@ public class Validation {
 
     /*
      * (non-Javadoc) See Section 4.4.5 Validation - Must be private
-     * 
+     *
      * Geronimo implementation specific code.
      */
     private static class DefaultValidationProviderResolver implements ValidationProviderResolver
{
- 
+
         private static final String SERVICES_FILENAME = "META-INF/services/" +
             ValidationProvider.class.getName();
 
         // cache of providers per class loader
         private volatile WeakHashMap<ClassLoader, List<ValidationProvider<?>>>
providerCache =
             new WeakHashMap<ClassLoader, List<ValidationProvider<?>>>();
-        
+
         /*
          * (non-Javadoc)
-         * 
+         *
          * @see javax.validation.ValidationProviderResolver#getValidationProviders()
          */
         public List<ValidationProvider<?>> getValidationProviders() {
@@ -222,13 +224,20 @@ public class Validation {
                                 line = line.trim();
                                 if (!line.startsWith("#")) {
                                     try {
-                                        // try loading the specified class
-                                        final Class<?> provider = cl.loadClass(line);
+                                        Class<?> provider = null;
+                                        try {
+                                            // try loading the specified class
+                                            provider = cl.loadClass(line);
+                                        } catch (ClassNotFoundException e) {
+                                            // last gasp, use the OSGi locator to try to
find this
+                                            provider = ProviderLocator.locate(line);
+                                            if (provider == null) {
+                                                throw new ValidationException("Failed to
load provider " +
+                                                    line + " configured in file " + url,
e);
+                                            }
+                                        }
                                         // create an instance to return
                                         providers.add((ValidationProvider<?>) provider.newInstance());
-                                    } catch (ClassNotFoundException e) {
-                                        throw new ValidationException("Failed to load provider
" +
-                                            line + " configured in file " + url, e);
                                     } catch (InstantiationException e) {
                                         throw new ValidationException("Failed to instantiate
provider " +
                                             line + " configured in file " + url, e);
@@ -251,11 +260,11 @@ public class Validation {
                 } catch (IOException e) {
                     throw new ValidationException("Error trying to load " + SERVICES_FILENAME,
e);
                 }
-                
+
                 // cache the discovered providers
                 providerCache.put(cl, providers);
             }
-            
+
             // caller must handle the case of no providers found
             return providers;
         }



Mime
View raw message