You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2016/04/15 18:49:46 UTC

[4/9] jena git commit: Bundle's classloader used in ServiceLoader#load

Bundle's classloader used in ServiceLoader#load


Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/cbf66954
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/cbf66954
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/cbf66954

Branch: refs/heads/master
Commit: cbf669541b97f8fbd263d11a8a9790773fa132f6
Parents: 10bcc01
Author: Jaroslav Pullmann <ja...@fit.fraunhofer.de>
Authored: Thu Apr 7 16:51:11 2016 +0200
Committer: Jaroslav Pullmann <ja...@fit.fraunhofer.de>
Committed: Thu Apr 7 16:51:11 2016 +0200

----------------------------------------------------------------------
 .../org/apache/jena/osgi/test/JenaOSGITest.java     |  3 +--
 apache-jena-osgi/jena-osgi/pom.xml                  | 16 +++++++++-------
 .../jena/system/JenaSubsystemRegistryBasic.java     |  2 +-
 3 files changed, 11 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/cbf66954/apache-jena-osgi/jena-osgi-test/src/test/java/org/apache/jena/osgi/test/JenaOSGITest.java
----------------------------------------------------------------------
diff --git a/apache-jena-osgi/jena-osgi-test/src/test/java/org/apache/jena/osgi/test/JenaOSGITest.java b/apache-jena-osgi/jena-osgi-test/src/test/java/org/apache/jena/osgi/test/JenaOSGITest.java
index 9a8f475..1d468f1 100644
--- a/apache-jena-osgi/jena-osgi-test/src/test/java/org/apache/jena/osgi/test/JenaOSGITest.java
+++ b/apache-jena-osgi/jena-osgi-test/src/test/java/org/apache/jena/osgi/test/JenaOSGITest.java
@@ -79,8 +79,7 @@ public class JenaOSGITest {
 								.artifactId("apache-karaf").type("zip")
 								.version("3.0.6")).useDeployFolder(false),
 				
-								mavenBundle("org.apache.aries.spifly",
-						"org.apache.aries.spifly.dynamic.bundle", "1.0.8"),
+				//mavenBundle("org.apache.aries.spifly","org.apache.aries.spifly.dynamic.bundle", "1.0.8"),
 
 				mavenBundle("org.apache.jena", "jena-osgi", "3.1.0-SNAPSHOT"),
 				mavenBundle("com.github.andrewoma.dexx", "collection", "0.6.0-SNAPSHOT"),

http://git-wip-us.apache.org/repos/asf/jena/blob/cbf66954/apache-jena-osgi/jena-osgi/pom.xml
----------------------------------------------------------------------
diff --git a/apache-jena-osgi/jena-osgi/pom.xml b/apache-jena-osgi/jena-osgi/pom.xml
index 6225f31..ebf1ba4 100644
--- a/apache-jena-osgi/jena-osgi/pom.xml
+++ b/apache-jena-osgi/jena-osgi/pom.xml
@@ -233,27 +233,29 @@
         <artifactId>maven-bundle-plugin</artifactId>
         <!-- re-enable extensions here for older Mavens -->
         <extensions>true</extensions>
-        <configuration>
+        <configuration>		  
           <instructions>
-            <Export-Package>org.apache.jena.*,!org.apache.jena.ext.*</Export-Package>
+            <Export-Package>org.apache.jena.*,!org.apache.jena.ext.*</Export-Package>			
             <Embed-Dependency>artifactId=jena*;inline=true</Embed-Dependency>
-            <!--
+			<!--            
             <Embed-Dependency>artifactId=jena*;inline=true,artifactId=xercesImpl;inline=true,artifactId=xml-apis;inline=true</Embed-Dependency>
             -->
             <Embed-Transitive>true</Embed-Transitive>
-            <!-- Do not embed but import Xerces classes via OSGi -->
+            <!-- Do not embed but import Xerces classes via OSGi -->			
             <Import-Package>org.osgi.framework.*,org.apache.xml.*,org.apache.xerces.*,!sun.io,!org.apache.avalon.framework.logger,!com.ibm.uvm.tools,!com.sun.jdmk.comm,!org.apache.log,!org.apache.jena.ext.*,sun.misc;resolution:=optional,*</Import-Package>
-            <!--
+			<!--
             <Import-Package>org.osgi.framework.*,!sun.io,!org.apache.avalon.framework.logger,!com.ibm.uvm.tools,!com.sun.jdmk.comm,!org.apache.log,!org.apache.xml.*,!org.apache.xerces.*,!org.apache.jena.ext.*,sun.misc;resolution:=optional,*</Import-Package>
-            -->
+			-->
             <Private-Package>org.apache.jena.ext.*</Private-Package>
-            <Bundle-Activator>org.apache.jena.osgi.Activator</Bundle-Activator>
+            <!--<Bundle-Activator>org.apache.jena.osgi.Activator</Bundle-Activator>-->
             <!-- Standard headers according to OSGi 133 Service Loader Mediator Specification -->
+			<!-- Not needed, if JenaSubsystemRegistryBasic (jena-core) uses an explicit classloader
 			<Require-Capability>
 			  osgi.extender; filter:="(|(osgi.extender=osgi.serviceloader.registrar)(osgi.extender=osgi.serviceloader.processor))",
 			  osgi.serviceloader; filter:="(osgi.serviceloader=org.apache.jena.system.JenaSubsystemLifecycle)";cardinality:=multiple						
 			</Require-Capability>
 			<Provide-Capability>osgi.serviceloader; osgi.serviceloader=org.apache.jena.system.JenaSubsystemLifecycle</Provide-Capability>						
+			-->
 			<!-- SPI-* headers work only with Apache Aries SPI Fly -->
             <!--
 				<SPI-Consumer>*</SPI-Consumer>

http://git-wip-us.apache.org/repos/asf/jena/blob/cbf66954/jena-core/src/main/java/org/apache/jena/system/JenaSubsystemRegistryBasic.java
----------------------------------------------------------------------
diff --git a/jena-core/src/main/java/org/apache/jena/system/JenaSubsystemRegistryBasic.java b/jena-core/src/main/java/org/apache/jena/system/JenaSubsystemRegistryBasic.java
index fd50072..db37924 100644
--- a/jena-core/src/main/java/org/apache/jena/system/JenaSubsystemRegistryBasic.java
+++ b/jena-core/src/main/java/org/apache/jena/system/JenaSubsystemRegistryBasic.java
@@ -40,7 +40,7 @@ public class JenaSubsystemRegistryBasic implements JenaSubsystemRegistry {
     public void load() {
         synchronized (registryLock) {
             // Find subsystems asking for initialization. 
-            ServiceLoader<JenaSubsystemLifecycle> sl = ServiceLoader.load(JenaSubsystemLifecycle.class) ;
+            ServiceLoader<JenaSubsystemLifecycle> sl = ServiceLoader.load(JenaSubsystemLifecycle.class,this.getClass().getClassLoader()) ;
             sl.forEach(this::add) ;
         }
     }