geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickmcgu...@apache.org
Subject svn commit: r919401 - in /geronimo/specs/trunk/geronimo-stax-api_1.0_spec: pom.xml src/main/java/javax/xml/stream/FactoryLocator.java
Date Fri, 05 Mar 2010 13:09:50 GMT
Author: rickmcguire
Date: Fri Mar  5 13:09:49 2010
New Revision: 919401

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

Adding osgi locator support to the stax project. 


Modified:
    geronimo/specs/trunk/geronimo-stax-api_1.0_spec/pom.xml
    geronimo/specs/trunk/geronimo-stax-api_1.0_spec/src/main/java/javax/xml/stream/FactoryLocator.java

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=919401&r1=919400&r2=919401&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 Fri Mar  5 13:09:49 2010
@@ -20,8 +20,8 @@
 
 <!-- $Rev$ $Date$ -->
 
-<project xmlns="http://maven.apache.org/POM/4.0.0" 
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+<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>
@@ -36,12 +36,7 @@
     <artifactId>geronimo-stax-api_1.0_spec</artifactId>
     <packaging>bundle</packaging>
     <name>Streaming API for XML (STAX API 1.0)</name>
-    <version>1.0.1</version>
-
-    <properties>
-	    <geronimo.osgi.export.pkg>javax.xml.stream*</geronimo.osgi.export.pkg>
-        <geronimo.osgi.export.version>1.0</geronimo.osgi.export.version>
-	</properties>
+    <version>1.0.2-SNAPSHOT</version>
 
     <scm>
         <connection>scm:svn:https://svn.apache.org/repos/asf/geronimo/specs/tags/geronimo-stax-api_1.0_spec-1.0.1</connection>
@@ -49,4 +44,35 @@
         <url>https://svn.apache.org/repos/asf/geronimo/specs/tags/geronimo-stax-api_1.0_spec-1.0.1</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>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Bundle-SymbolicName>${groupId}.${artifactId};singleton=true</Bundle-SymbolicName>
+                        <Specification-Title>JSR-137 Streaming API for XML 1.0</Specification-Title>
+                        <Specification-Vendor>Sun Microsystems, Inc.</Specification-Vendor>
+                        <Specification-Version>1.0</Specification-Version>
+                        <Export-Package>javax.xml.stream*;version=1.0.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.osgi.locator.Activator</Bundle-Activator>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
 </project>

Modified: geronimo/specs/trunk/geronimo-stax-api_1.0_spec/src/main/java/javax/xml/stream/FactoryLocator.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-stax-api_1.0_spec/src/main/java/javax/xml/stream/FactoryLocator.java?rev=919401&r1=919400&r2=919401&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-stax-api_1.0_spec/src/main/java/javax/xml/stream/FactoryLocator.java
(original)
+++ geronimo/specs/trunk/geronimo-stax-api_1.0_spec/src/main/java/javax/xml/stream/FactoryLocator.java
Fri Mar  5 13:09:49 2010
@@ -27,9 +27,11 @@
 import java.io.BufferedReader;
 import java.io.InputStreamReader;
 
+import org.apache.geronimo.osgi.locator.ProviderLocator;
+
 /*
  * Here is the beef on the finding the Factory Class
- * 
+ *
  * 1. Use the javax.xml.stream.XMLInputFactory system property. 2. Use the
  * properties file "lib/stax.properties" in the JRE directory. This
  * configuration file is in standard java.util.Properties format and contains
@@ -39,8 +41,8 @@
  * API will look for a classname in the file
  * META-INF/services/javax.xml.stream.XMLInputFactory in jars available to the
  * runtime. Platform default XMLInputFactory instance.
- * 
- * If the user provided a classloader we'll use that...if not, we'll assume the 
+ *
+ * If the user provided a classloader we'll use that...if not, we'll assume the
  * classloader of this class.
  */
 
@@ -117,9 +119,23 @@
 
 			return factoryClass.newInstance();
 		} catch (ClassNotFoundException x) {
-			throw new FactoryConfigurationError("Requested factory "
-					+ className + " cannot be located.  Classloader ="
-					+ classLoader.toString(), x);
+			// if the got a ClassNotFoundException using the provided class loader,
+			// we might be running in an OSGi environment.  In that case, there's
+			// an additional registry we can check to locate the provider.
+			Class factoryClass = ProviderLocator.locate(className);
+			// if not found here, then go ahead and throw the exception
+			if (factoryClass == null) {
+				throw new FactoryConfigurationError("Requested factory "
+						+ className + " cannot be located.  Classloader ="
+						+ classLoader.toString(), x);
+			}
+			// another attempt at instantiating this
+			try {
+				return factoryClass.newInstance();
+			} catch (Exception ex) {
+				throw new FactoryConfigurationError("Requested factory "
+						+ className + " could not be instantiated: " + ex, ex);
+			}
 		} catch (Exception x) {
 			throw new FactoryConfigurationError("Requested factory "
 					+ className + " could not be instantiated: " + x, x);



Mime
View raw message