[jboss-osgi-commits] JBoss-OSGI SVN: r100392 - in projects/jboss-osgi: projects/bundles/blueprint/trunk/.settings and 6 other directories.

jboss-osgi-commits at lists.jboss.org jboss-osgi-commits at lists.jboss.org
Thu Feb 4 02:36:19 EST 2010


Author: thomas.diesler at jboss.com
Date: 2010-02-04 02:36:18 -0500 (Thu, 04 Feb 2010)
New Revision: 100392

Modified:
   projects/jboss-osgi/projects/bundles/blueprint/trunk/.classpath
   projects/jboss-osgi/projects/bundles/blueprint/trunk/.project
   projects/jboss-osgi/projects/bundles/blueprint/trunk/.settings/org.eclipse.jdt.core.prefs
   projects/jboss-osgi/projects/bundles/blueprint/trunk/pom.xml
   projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/internal/ManagedBundleTracker.java
   projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleManagementDeployer.java
   projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml
   projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedBundle.java
   projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-equinox.xml
   projects/jboss-osgi/trunk/pom.xml
Log:
Fix NPE on Bundle.loadClass() in state INSTALLED

Modified: projects/jboss-osgi/projects/bundles/blueprint/trunk/.classpath
===================================================================
--- projects/jboss-osgi/projects/bundles/blueprint/trunk/.classpath	2010-02-04 07:01:16 UTC (rev 100391)
+++ projects/jboss-osgi/projects/bundles/blueprint/trunk/.classpath	2010-02-04 07:36:18 UTC (rev 100392)
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
+	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
+	<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
 	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
-	<classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
-	<classpathentry kind="src" path="src/main/resources"/>
-	<classpathentry kind="src" path="src/main/java"/>
+	<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
 	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
 	<classpathentry kind="output" path="target/classes"/>

Modified: projects/jboss-osgi/projects/bundles/blueprint/trunk/.project
===================================================================
--- projects/jboss-osgi/projects/bundles/blueprint/trunk/.project	2010-02-04 07:01:16 UTC (rev 100391)
+++ projects/jboss-osgi/projects/bundles/blueprint/trunk/.project	2010-02-04 07:36:18 UTC (rev 100392)
@@ -1,23 +1,23 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <projectDescription>
-  <name>jboss-osgi-blueprint</name>
-  <comment></comment>
-  <projects>
-  </projects>
-  <buildSpec>
-    <buildCommand>
-      <name>org.eclipse.jdt.core.javabuilder</name>
-      <arguments>
-      </arguments>
-    </buildCommand>
-    <buildCommand>
-      <name>org.maven.ide.eclipse.maven2Builder</name>
-      <arguments>
-      </arguments>
-    </buildCommand>
-  </buildSpec>
-  <natures>
-    <nature>org.maven.ide.eclipse.maven2Nature</nature>
-    <nature>org.eclipse.jdt.core.javanature</nature>
-  </natures>
+	<name>jboss-osgi-blueprint</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.maven.ide.eclipse.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.maven.ide.eclipse.maven2Nature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
 </projectDescription>

Modified: projects/jboss-osgi/projects/bundles/blueprint/trunk/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/jboss-osgi/projects/bundles/blueprint/trunk/.settings/org.eclipse.jdt.core.prefs	2010-02-04 07:01:16 UTC (rev 100391)
+++ projects/jboss-osgi/projects/bundles/blueprint/trunk/.settings/org.eclipse.jdt.core.prefs	2010-02-04 07:36:18 UTC (rev 100392)
@@ -1,5 +1,6 @@
-#Tue Apr 14 17:48:49 CEST 2009
+#Thu Feb 04 08:05:44 CET 2010
 eclipse.preferences.version=1
 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
 org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
 org.eclipse.jdt.core.compiler.source=1.5

Modified: projects/jboss-osgi/projects/bundles/blueprint/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/blueprint/trunk/pom.xml	2010-02-04 07:01:16 UTC (rev 100391)
+++ projects/jboss-osgi/projects/bundles/blueprint/trunk/pom.xml	2010-02-04 07:36:18 UTC (rev 100392)
@@ -34,7 +34,7 @@
     <version.apache.aries.blueprint>1.0.0.20100120</version.apache.aries.blueprint>
     <version.apache.aries.util>1.0.0.20100120</version.apache.aries.util>
     <version.jboss.osgi.common>1.0.3</version.jboss.osgi.common>
-    <version.jboss.osgi.framework>1.0.0-SNAPSHOT</version.jboss.osgi.framework>
+    <version.jboss.osgi.framework>1.0.0.Alpha3-SNAPSHOT</version.jboss.osgi.framework>
     <version.jboss.osgi.husky>1.0.3-SNAPSHOT</version.jboss.osgi.husky>
     <version.jboss.osgi.jmx>1.0.3-SNAPSHOT</version.jboss.osgi.jmx>
     <version.jboss.osgi.spi>1.0.4-SNAPSHOT</version.jboss.osgi.spi>

Modified: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/internal/ManagedBundleTracker.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/internal/ManagedBundleTracker.java	2010-02-04 07:01:16 UTC (rev 100391)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/internal/ManagedBundleTracker.java	2010-02-04 07:36:18 UTC (rev 100392)
@@ -46,6 +46,7 @@
    // Provide logging
    private Logger log = LoggerFactory.getLogger(ManagedBundleTracker.class);
 
+   private BundleContext context;
    private MBeanServer mbeanServer;
 
    public ManagedBundleTracker(BundleContext context, MBeanServer mbeanServer)
@@ -73,7 +74,7 @@
    {
       try
       {
-         ManagedBundle mb = new ManagedBundle(bundle);
+         ManagedBundle mb = new ManagedBundle(context, bundle);
          ObjectName oname = mb.getObjectName();
 
          if (mbeanServer.isRegistered(oname) == false)
@@ -95,9 +96,7 @@
    {
       try
       {
-         ManagedBundle mb = new ManagedBundle(bundle);
-         ObjectName oname = mb.getObjectName();
-
+         ObjectName oname = ManagedBundle.getObjectName(bundle);
          if (mbeanServer.isRegistered(oname))
          {
             log.debug("Unregister managed bundle: " + oname);

Modified: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleManagementDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleManagementDeployer.java	2010-02-04 07:01:16 UTC (rev 100391)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleManagementDeployer.java	2010-02-04 07:36:18 UTC (rev 100392)
@@ -31,6 +31,7 @@
 import org.jboss.deployers.structure.spi.DeploymentUnit;
 import org.jboss.osgi.spi.management.ManagedBundle;
 import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
 
 /**
  * Register the Bundle as MBean with JMX.
@@ -40,6 +41,7 @@
  */
 public class BundleManagementDeployer extends AbstractSimpleRealDeployer<Bundle>
 {
+   private BundleContext systemContext;
    private MBeanServer mbeanServer;
 
    public BundleManagementDeployer()
@@ -47,6 +49,11 @@
       super(Bundle.class);
    }
 
+   public void setSystemContext(BundleContext systemContext)
+   {
+      this.systemContext = systemContext;
+   }
+
    public void setMbeanServer(MBeanServer mbeanServer)
    {
       this.mbeanServer = mbeanServer;
@@ -56,7 +63,7 @@
    {
       if (mbeanServer != null)
       {
-         ManagedBundle mb = new ManagedBundle(bundle);
+         ManagedBundle mb = new ManagedBundle(systemContext, bundle);
          ObjectName oname = mb.getObjectName();
          try
          {

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml	2010-02-04 07:01:16 UTC (rev 100391)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml	2010-02-04 07:36:18 UTC (rev 100392)
@@ -26,7 +26,7 @@
   <artifactId>jboss-osgi-framework</artifactId>
   <packaging>bundle</packaging>
 
-  <version>1.0.0-SNAPSHOT</version>
+  <version>1.0.0.Alpha3-SNAPSHOT</version>
 
   <parent>
     <groupId>org.jboss.osgi</groupId>
@@ -57,8 +57,8 @@
     <version.jboss.osgi.deployment>1.0.1-SNAPSHOT</version.jboss.osgi.deployment>
     <version.jboss.osgi.husky>1.0.3-SNAPSHOT</version.jboss.osgi.husky>
     <version.jboss.osgi.jaxb>2.1.10.SP3</version.jboss.osgi.jaxb>
-    <version.jboss.osgi.jmx>1.0.2</version.jboss.osgi.jmx>
-    <version.jboss.osgi.runtime.deployers>1.0.3</version.jboss.osgi.runtime.deployers>
+    <version.jboss.osgi.jmx>1.0.3-SNAPSHOT</version.jboss.osgi.jmx>
+    <version.jboss.osgi.runtime.deployers>1.0.4-SNAPSHOT</version.jboss.osgi.runtime.deployers>
     <version.jboss.osgi.spi>1.0.4-SNAPSHOT</version.jboss.osgi.spi>
     <version.jboss.osgi.xml.binding>2.0.2.Beta3</version.jboss.osgi.xml.binding>
     <version.jboss.test>1.1.4.GA</version.jboss.test>

Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedBundle.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedBundle.java	2010-02-04 07:01:16 UTC (rev 100391)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedBundle.java	2010-02-04 07:36:18 UTC (rev 100392)
@@ -52,12 +52,14 @@
    public static final String PROPERTY_SYMBOLIC_NAME = "name";
    public static final String PROPERTY_VERSION = "version";
 
+   private BundleContext systemContext;
    private Bundle bundle;
    private ObjectName oname;
 
-   public ManagedBundle(Bundle bundle)
+   public ManagedBundle(BundleContext context, Bundle bundle)
    {
       this.bundle = bundle;
+      this.systemContext = context;
       this.oname = getObjectName(bundle);
    }
 
@@ -143,10 +145,7 @@
    public ObjectName loadClass(String name) throws ClassNotFoundException
    {
       Class<?> clazz = bundle.loadClass(name);
-      BundleContext context = bundle.getBundleContext();
-      ServiceReference sref = context.getServiceReference(PackageAdmin.class.getName());
-      PackageAdmin packageAdmin = (PackageAdmin)context.getService(sref);
-      Bundle providingBundle = packageAdmin.getBundle(clazz);
+      Bundle providingBundle = getPackageAdmin().getBundle(clazz);
       return providingBundle != null ? getObjectName(providingBundle) : null;
    }
    
@@ -170,4 +169,10 @@
    {
       bundle.update();
    }
+
+   private PackageAdmin getPackageAdmin()
+   {
+      ServiceReference sref = systemContext.getServiceReference(PackageAdmin.class.getName());
+      return (PackageAdmin)systemContext.getService(sref);
+   }
 }
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-equinox.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-equinox.xml	2010-02-04 07:01:16 UTC (rev 100391)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-equinox.xml	2010-02-04 07:36:18 UTC (rev 100392)
@@ -126,7 +126,8 @@
 
   <!-- The Bundle Management Deployer -->
   <bean name="jboss.osgi:service=BundleManagementDeployer" class="org.jboss.osgi.deployer.BundleManagementDeployer">
-   <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
+    <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext" /></property>
+    <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
   </bean>
 
 </deployment>
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/pom.xml	2010-02-04 07:01:16 UTC (rev 100391)
+++ projects/jboss-osgi/trunk/pom.xml	2010-02-04 07:36:18 UTC (rev 100392)
@@ -57,7 +57,7 @@
     <version.jboss.osgi.common>1.0.3</version.jboss.osgi.common>
     <version.jboss.osgi.common.core>2.2.13.GA</version.jboss.osgi.common.core>
     <version.jboss.osgi.deployment>1.0.1-SNAPSHOT</version.jboss.osgi.deployment>
-    <version.jboss.osgi.framework>1.0.0-SNAPSHOT</version.jboss.osgi.framework>
+    <version.jboss.osgi.framework>1.0.0.Alpha3-SNAPSHOT</version.jboss.osgi.framework>
     <version.jboss.osgi.hotdeploy>1.0.4-SNAPSHOT</version.jboss.osgi.hotdeploy>
     <version.jboss.osgi.husky>1.0.3-SNAPSHOT</version.jboss.osgi.husky>
     <version.jboss.osgi.jaxb>2.1.10.SP3</version.jboss.osgi.jaxb>



More information about the jboss-osgi-commits mailing list