[jboss-cvs] JBossAS SVN: r97448 - in projects/jboss-osgi/trunk/reactor/framework/src: test/java/org/jboss/test/osgi/service/support/d and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Dec 4 06:19:50 EST 2009


Author: alesj
Date: 2009-12-04 06:19:50 -0500 (Fri, 04 Dec 2009)
New Revision: 97448

Modified:
   projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
   projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceState.java
   projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/service/support/d/D.java
   projects/jboss-osgi/trunk/reactor/framework/src/test/resources/bundles/service/service-bundle4/META-INF/MANIFEST.MF
Log:
Expose NCDFE for Bundle class.

Modified: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java	2009-12-04 10:52:06 UTC (rev 97447)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java	2009-12-04 11:19:50 UTC (rev 97448)
@@ -371,9 +371,16 @@
             OSGiBundleState bundleState = unit.getAttachment(OSGiBundleState.class);
             if (bundleState == null)
             {
-               bundleState = addDeployment(unit);
-               bundleState.changeState(Bundle.ACTIVE);
-               unit.addAttachment(OSGiBundleState.class, bundleState);
+               try
+               {
+                  bundleState = addDeployment(unit);
+                  bundleState.startInternal();
+                  unit.addAttachment(OSGiBundleState.class, bundleState);
+               }
+               catch (Throwable t)
+               {
+                  throw new RuntimeException("Cannot dynamically add generic bundle: " + unit, t);
+               }
             }
             return bundleState;
          }

Modified: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceState.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceState.java	2009-12-04 10:52:06 UTC (rev 97447)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceState.java	2009-12-04 11:19:50 UTC (rev 97448)
@@ -307,6 +307,11 @@
 
    public ClassLoader getClassLoader() throws Throwable
    {
+      return getClassLoaderInternal();
+   }
+
+   private ClassLoader getClassLoaderInternal()
+   {
       SecurityManager sm = System.getSecurityManager();
       if (sm != null)
          sm.checkPermission(GET_CLASSLOADER_PERMISSION);
@@ -370,7 +375,7 @@
       checkPermission("get", false);
 
       Object service = serviceOrFactory;
-      if (serviceOrFactory instanceof ServiceFactory)
+      if (isServiceFactory)
       {
          if (serviceCache == null)
             serviceCache = new ConcurrentHashMap<AbstractBundleState, Object>();
@@ -589,7 +594,7 @@
       builder.append("id=").append(getServiceId());
       builder.append(" bundle=").append(getBundleState().getCanonicalName());
       builder.append(" classes=").append(Arrays.asList(getClasses()));
-      builder.append(serviceOrFactory instanceof ServiceFactory ? " factory=" : " service=").append(serviceOrFactory);
+      builder.append(isServiceFactory ? " factory=" : " service=").append(serviceOrFactory);
       if (properties != null)
          builder.append(" properties=").append(properties);
       builder.append("}");
@@ -627,7 +632,7 @@
 
                   if (using.ungetContex(this) == false)
                   {
-                     if (serviceOrFactory instanceof ServiceFactory)
+                     if (isServiceFactory)
                      {
                         ServiceFactory serviceFactory = (ServiceFactory)serviceOrFactory;
                         try

Modified: projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/service/support/d/D.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/service/support/d/D.java	2009-12-04 10:52:06 UTC (rev 97447)
+++ projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/service/support/d/D.java	2009-12-04 11:19:50 UTC (rev 97448)
@@ -34,6 +34,7 @@
    public Object getService(Bundle bundle, ServiceRegistration registration)
    {
       A a = new A();
+      // TODO -- why this doesn't work? java.lang.NoClassDefFoundError: org/osgi/framework/Bundle
       a.msg = bundle.getSymbolicName();
       return a;
    }

Modified: projects/jboss-osgi/trunk/reactor/framework/src/test/resources/bundles/service/service-bundle4/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/test/resources/bundles/service/service-bundle4/META-INF/MANIFEST.MF	2009-12-04 10:52:06 UTC (rev 97447)
+++ projects/jboss-osgi/trunk/reactor/framework/src/test/resources/bundles/service/service-bundle4/META-INF/MANIFEST.MF	2009-12-04 11:19:50 UTC (rev 97448)
@@ -4,4 +4,4 @@
 Implementation-Vendor: jboss.org
 Bundle-Name: Service4
 Bundle-SymbolicName: org.jboss.test.osgi.service4
-Import-Package: org.jboss.test.osgi.service.support.a;org.jboss.test.osgi.service.support.c;org.jboss.test.osgi.service.support.d
+Import-Package: org.jboss.test.osgi.service.support.a;org.jboss.test.osgi.service.support.c;org.jboss.test.osgi.service.support.d;org.osgi.framework




More information about the jboss-cvs-commits mailing list