You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2008/01/07 15:05:59 UTC

svn commit: r609611 - in /servicemix/smx4/nmr/trunk: jbi/api/ jbi/commands/ jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/ jbi/osgi/ jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ nmr/api/ nmr/commands/ nmr/core/...

Author: gnodet
Date: Mon Jan  7 06:05:58 2008
New Revision: 609611

URL: http://svn.apache.org/viewvc?rev=609611&view=rev
Log:
Remove some DynamicImport packages and fix some classloader issues

Modified:
    servicemix/smx4/nmr/trunk/jbi/api/pom.xml
    servicemix/smx4/nmr/trunk/jbi/commands/pom.xml
    servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/ComponentImpl.java
    servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/Deployer.java
    servicemix/smx4/nmr/trunk/jbi/osgi/pom.xml
    servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ComponentRegistryImpl.java
    servicemix/smx4/nmr/trunk/nmr/api/pom.xml
    servicemix/smx4/nmr/trunk/nmr/commands/pom.xml
    servicemix/smx4/nmr/trunk/nmr/core/pom.xml
    servicemix/smx4/nmr/trunk/nmr/osgi/pom.xml

Modified: servicemix/smx4/nmr/trunk/jbi/api/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/api/pom.xml?rev=609611&r1=609610&r2=609611&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/api/pom.xml (original)
+++ servicemix/smx4/nmr/trunk/jbi/api/pom.xml Mon Jan  7 06:05:58 2008
@@ -52,7 +52,6 @@
                         <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
                         <Export-Package>javax.jbi*</Export-Package>
                         <Import-Package>*</Import-Package>
-                        <DynamicImport-Package>*</DynamicImport-Package>
                     </instructions>
                 </configuration>
             </plugin>

Modified: servicemix/smx4/nmr/trunk/jbi/commands/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/commands/pom.xml?rev=609611&r1=609610&r2=609611&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/commands/pom.xml (original)
+++ servicemix/smx4/nmr/trunk/jbi/commands/pom.xml Mon Jan  7 06:05:58 2008
@@ -55,7 +55,6 @@
                     <instructions>
                         <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
                         <Export-Package>${pom.artifactId}*</Export-Package>
-                        <DynamicImport-Package>*</DynamicImport-Package>
                         <Spring-Context>*;publish-context:=false;create-asynchronously:=false</Spring-Context>
                     </instructions>
                 </configuration>

Modified: servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/ComponentImpl.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/ComponentImpl.java?rev=609611&r1=609610&r2=609611&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/ComponentImpl.java (original)
+++ servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/ComponentImpl.java Mon Jan  7 06:05:58 2008
@@ -150,8 +150,14 @@
         }
 
         public void init(ComponentContext context) throws JBIException {
-            lifeCycle.init(context);
-            state = State.Initialized;
+            ClassLoader cl = Thread.currentThread().getContextClassLoader();
+            try {
+                Thread.currentThread().setContextClassLoader(lifeCycle.getClass().getClassLoader());
+                lifeCycle.init(context);
+                state = State.Initialized;
+            } finally {
+                Thread.currentThread().setContextClassLoader(cl);
+            }
         }
 
         public void shutDown() throws JBIException {

Modified: servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/Deployer.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/Deployer.java?rev=609611&r1=609610&r2=609611&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/Deployer.java (original)
+++ servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/Deployer.java Mon Jan  7 06:05:58 2008
@@ -96,7 +96,9 @@
 
     @Override
     protected void register(Bundle bundle) {
+        ClassLoader cl = Thread.currentThread().getContextClassLoader();
         try {
+            Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
             URL url = bundle.getResource(JBI_DESCRIPTOR);
             Descriptor descriptor = DescriptorFactory.buildDescriptor(url);
             DescriptorFactory.checkDescriptor(descriptor);
@@ -112,6 +114,8 @@
             LOGGER.warn("JBI artifact requirements not met. Installation pending.");
         } catch (Exception e) {
             LOGGER.error("Error handling bundle event", e);
+        } finally {
+            Thread.currentThread().setContextClassLoader(cl);
         }
     }
 

Modified: servicemix/smx4/nmr/trunk/jbi/osgi/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/osgi/pom.xml?rev=609611&r1=609610&r2=609611&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/osgi/pom.xml (original)
+++ servicemix/smx4/nmr/trunk/jbi/osgi/pom.xml Mon Jan  7 06:05:58 2008
@@ -54,8 +54,7 @@
                 <configuration>
                     <instructions>
                         <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
-                        <Import-Package></Import-Package>
-                        <DynamicImport-Package>*</DynamicImport-Package>
+                        <Import-Package>org.apache.servicemix.jbi.runtime,org.apache.servicemix.jbi.runtime.impl</Import-Package>
                         <Spring-Context>*;publish-context:=false;create-asynchronously:=false</Spring-Context>
                     </instructions>
                 </configuration>

Modified: servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ComponentRegistryImpl.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ComponentRegistryImpl.java?rev=609611&r1=609610&r2=609611&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ComponentRegistryImpl.java (original)
+++ servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ComponentRegistryImpl.java Mon Jan  7 06:05:58 2008
@@ -70,7 +70,9 @@
      * @param properties the associated metadata
      */
     public void register(Component component, Map<String, ?> properties) {
+        ClassLoader cl = Thread.currentThread().getContextClassLoader();
         try {
+            Thread.currentThread().setContextClassLoader(component.getClass().getClassLoader());
             if (components.containsValue(component)) {
                 // Component is already registered
                 return;
@@ -88,6 +90,8 @@
             }
         } catch (JBIException e) {
             throw new ServiceMixException(e);
+        } finally {
+            Thread.currentThread().setContextClassLoader(cl);
         }
     }
 

Modified: servicemix/smx4/nmr/trunk/nmr/api/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/nmr/api/pom.xml?rev=609611&r1=609610&r2=609611&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/nmr/api/pom.xml (original)
+++ servicemix/smx4/nmr/trunk/nmr/api/pom.xml Mon Jan  7 06:05:58 2008
@@ -60,7 +60,6 @@
                         <Export-Package>
                             ${pom.artifactId},${pom.artifactId}.service,${pom.artifactId}.event,${pom.artifactId}.internal
                         </Export-Package>
-                        <DynamicImport-Package>*</DynamicImport-Package>
                     </instructions>
                 </configuration>
             </plugin>

Modified: servicemix/smx4/nmr/trunk/nmr/commands/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/nmr/commands/pom.xml?rev=609611&r1=609610&r2=609611&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/nmr/commands/pom.xml (original)
+++ servicemix/smx4/nmr/trunk/nmr/commands/pom.xml Mon Jan  7 06:05:58 2008
@@ -55,7 +55,6 @@
                     <instructions>
                         <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
                         <Export-Package>${pom.artifactId}</Export-Package>
-                        <DynamicImport-Package>*</DynamicImport-Package>
                         <Spring-Context>*;publish-context:=false;create-asynchronously:=false</Spring-Context>
                     </instructions>
                 </configuration>

Modified: servicemix/smx4/nmr/trunk/nmr/core/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/nmr/core/pom.xml?rev=609611&r1=609610&r2=609611&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/nmr/core/pom.xml (original)
+++ servicemix/smx4/nmr/trunk/nmr/core/pom.xml Mon Jan  7 06:05:58 2008
@@ -56,7 +56,6 @@
                     <instructions>
                         <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
                         <Export-Package>${pom.artifactId}</Export-Package>
-                        <DynamicImport-Package>*</DynamicImport-Package>
                     </instructions>
                 </configuration>
             </plugin>

Modified: servicemix/smx4/nmr/trunk/nmr/osgi/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/nmr/osgi/pom.xml?rev=609611&r1=609610&r2=609611&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/nmr/osgi/pom.xml (original)
+++ servicemix/smx4/nmr/trunk/nmr/osgi/pom.xml Mon Jan  7 06:05:58 2008
@@ -82,8 +82,7 @@
                 <configuration>
                     <instructions>
                         <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
-                        <Import-Package></Import-Package>
-                        <DynamicImport-Package>*</DynamicImport-Package>
+                        <Import-Package>org.apache.servicemix.nmr.core</Import-Package>
                         <Spring-Context>*;publish-context:=false;create-asynchronously:=false</Spring-Context>
                     </instructions>
                 </configuration>