[jboss-cvs] JBossAS SVN: r94316 - in projects/jboss-osgi/projects/runtime/microcontainer/trunk: src/main/java/org/jboss/osgi/framework/bundle and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Oct 4 16:32:57 EDT 2009


Author: thomas.diesler at jboss.com
Date: 2009-10-04 16:32:56 -0400 (Sun, 04 Oct 2009)
New Revision: 94316

Modified:
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/.classpath
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/OSGiTestDelegate.java
Log:
Fix missing bundle location with AS integration

Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/.classpath
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/.classpath	2009-10-04 14:45:30 UTC (rev 94315)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/.classpath	2009-10-04 20:32:56 UTC (rev 94316)
@@ -1,6 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry kind="lib" path="/licensed/repo/com.springsource.junit/com.springsource.junit-3.8.2.jar" sourcepath="/home/tdiesler/Download/java/junit/junit3.8.2/src.jar"/>
 	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
 	<classpathentry kind="src" output="target/classes" path="target/generated-sources/javacc"/>
 	<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>

Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java	2009-10-04 14:45:30 UTC (rev 94315)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java	2009-10-04 20:32:56 UTC (rev 94316)
@@ -373,7 +373,7 @@
    }
 
    /**
-    * Install a bundle
+    * Install a bundle from an URL.
     * 
     * @param url the url of the bundle
     * @return the bundle state
@@ -384,21 +384,11 @@
       if (url == null)
          throw new BundleException("Null url");
       
-      VirtualFile root;
-      try
-      {
-         root = VFS.getRoot(url);
-      }
-      catch (IOException e)
-      {
-         throw new BundleException("Invalid bundle location=" + url, e);
-      }
-
-      return install(root, null);
+      return install(url.toExternalForm(), null);
    }
 
    /**
-    * Install a bundle 
+    * Install a bundle from 
     * 
     * @param location the bundle's location identifier
     * @param input an optional input stream to read the bundle content from
@@ -450,13 +440,21 @@
    /**
     * Install a bundle 
     * @param root the virtual file that point to the bundle
-    * @param location the optional bundle location
     * 
     * @return the bundle state
     * @throws BundleException for any error
     */
-   public AbstractBundleState install(VirtualFile root, String location) throws BundleException
+   public AbstractBundleState install(VirtualFile root) throws BundleException
    {
+      return install(root, null);
+   }
+
+   /*
+    * Installs a bundle from the given virtual file. If the location is not explicitly
+    * given, it'll be derived from the virtual file.
+    */
+   private AbstractBundleState install(VirtualFile root, String location) throws BundleException
+   {
       if (location == null)
          location = root.toString();
 
@@ -570,7 +568,7 @@
 
       String location = (String)unit.getAttachment(PROPERTY_BUNDLE_LOCATION);
       if (location == null)
-         throw new IllegalStateException("Cannot obtain bundle location");
+         location = unit.getName();
 
       OSGiBundleState bundleState = new OSGiBundleState(location, osgiMetaData, unit);
       addBundle(bundleState);

Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/OSGiTestDelegate.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/OSGiTestDelegate.java	2009-10-04 14:45:30 UTC (rev 94315)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/OSGiTestDelegate.java	2009-10-04 20:32:56 UTC (rev 94316)
@@ -202,7 +202,7 @@
     */
    public Bundle addBundle(VirtualFile file) throws Exception
    {
-      AbstractBundleState bundleState = getBundleManager().install(file, null);
+      AbstractBundleState bundleState = getBundleManager().install(file);
       return bundleState.getBundleInternal();
    }
 




More information about the jboss-cvs-commits mailing list