[jboss-osgi-commits] JBoss-OSGI SVN: r102173 - in projects/jboss-osgi/projects: testing/trunk and 5 other directories.

jboss-osgi-commits at lists.jboss.org jboss-osgi-commits at lists.jboss.org
Tue Mar 9 16:17:01 EST 2010


Author: thomas.diesler at jboss.com
Date: 2010-03-09 16:16:59 -0500 (Tue, 09 Mar 2010)
New Revision: 102173

Modified:
   projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleInfo.java
   projects/jboss-osgi/projects/testing/trunk/pom.xml
   projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiTestHelper.java
   projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedRuntime.java
   projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/OSGiRuntimeImpl.java
   projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteRuntime.java
   projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/testing/SimpleTestCase.java
   projects/jboss-osgi/projects/vfs/trunk/vfs21/src/main/java/org/jboss/osgi/vfs21/VFSAdaptor21.java
   projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VFSAdaptor30.java
   projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VirtualFileAdaptor30.java
Log:
Use getRoot() instead of getChild()

Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleInfo.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleInfo.java	2010-03-09 21:14:14 UTC (rev 102172)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleInfo.java	2010-03-09 21:16:59 UTC (rev 102173)
@@ -263,7 +263,7 @@
    {
       try
       {
-         return AbstractVFS.getChild(url);
+         return AbstractVFS.getRoot(url);
       }
       catch (IOException e)
       {

Modified: projects/jboss-osgi/projects/testing/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/pom.xml	2010-03-09 21:14:14 UTC (rev 102172)
+++ projects/jboss-osgi/projects/testing/trunk/pom.xml	2010-03-09 21:16:59 UTC (rev 102173)
@@ -86,6 +86,11 @@
       <version>${version.jboss.shrinkwrap}</version>
     </dependency>
     <dependency>
+      <groupId>org.jboss.shrinkwrap</groupId>
+      <artifactId>shrinkwrap-impl-base</artifactId>
+      <version>${version.jboss.shrinkwrap}</version>
+    </dependency>
+    <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
     </dependency>
@@ -153,12 +158,6 @@
       <version>${version.jboss.osgi.vfs}</version>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>org.jboss.shrinkwrap</groupId>
-      <artifactId>shrinkwrap-impl-base</artifactId>
-      <version>${version.jboss.shrinkwrap}</version>
-      <scope>test</scope>
-    </dependency>
   </dependencies>
 
   <build>

Modified: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiTestHelper.java
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiTestHelper.java	2010-03-09 21:14:14 UTC (rev 102172)
+++ projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiTestHelper.java	2010-03-09 21:16:59 UTC (rev 102173)
@@ -232,7 +232,7 @@
             if (url == null)
                throw new IllegalArgumentException("Cannot load resource: " + res);
             
-            final VirtualFile file = AbstractVFS.getChild(url);
+            final VirtualFile file = AbstractVFS.getRoot(url);
             if (file.isDirectory())
             {
                addResources(archive, file, file);
@@ -248,7 +248,7 @@
          for(Class<?> clazz : packages)
          {
             URL url = clazz.getResource("/");
-            VirtualFile base = AbstractVFS.getChild(url);
+            VirtualFile base = AbstractVFS.getRoot(url);
             
             String path = clazz.getName().replace('.', '/');
             path = path.substring(0, path.lastIndexOf("/"));
@@ -264,7 +264,7 @@
       exporter.exportZip(target, true);
       target.deleteOnExit();
       
-      return AbstractVFS.getChild(target.toURI().toURL());
+      return AbstractVFS.getRoot(target.toURI().toURL());
    }
 
    private void addResources(JavaArchive archive, VirtualFile basedir, VirtualFile resdir) throws IOException

Modified: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedRuntime.java
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedRuntime.java	2010-03-09 21:14:14 UTC (rev 102172)
+++ projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedRuntime.java	2010-03-09 21:16:59 UTC (rev 102173)
@@ -68,7 +68,7 @@
    OSGiBundle installBundle(BundleInfo info) throws BundleException
    {
       BundleContext context = getSystemContext();
-      String location = fixVirtualFileURL(info.getRootURL()).toExternalForm();
+      String location = toFileURL(info.getRootURL()).toExternalForm();
       Bundle auxBundle = context.installBundle(location);
       OSGiBundle bundle = new EmbeddedBundle(this, auxBundle);
       return registerBundle(bundle.getLocation(), bundle);

Modified: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/OSGiRuntimeImpl.java
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/OSGiRuntimeImpl.java	2010-03-09 21:14:14 UTC (rev 102172)
+++ projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/OSGiRuntimeImpl.java	2010-03-09 21:16:59 UTC (rev 102173)
@@ -186,27 +186,6 @@
 
    abstract OSGiBundle installBundle(BundleInfo info) throws BundleException;
    
-   // [JBVFS-147] Cannot read from vfs: protocol URL 
-   URL fixVirtualFileURL(URL url) 
-   {
-      if (url.getProtocol().equals("vfs"))
-      {
-         File file = new File(url.getPath());
-         if (file.exists())
-         {
-            try
-            {
-               url = file.toURI().toURL();
-            }
-            catch (MalformedURLException e)
-            {
-               // ignore
-            }
-         }
-      }
-      return url;
-   }
-
    public void shutdown()
    {
       log.debug("Start Shutdown");
@@ -421,6 +400,27 @@
       }
    }
 
+   // [JBVFS-147] Cannot read from vfs: protocol URL 
+   URL toFileURL(URL url) 
+   {
+      if (url.getProtocol().equals("vfs"))
+      {
+         File file = new File(url.getPath());
+         if (file.exists())
+         {
+            try
+            {
+               url = file.toURI().toURL();
+            }
+            catch (MalformedURLException e)
+            {
+               // ignore
+            }
+         }
+      }
+      return url;
+   }
+
    VirtualFile toVirtualFile(Archive<?> archive) throws IOException, MalformedURLException
    {
       ZipExporter exporter = archive.as(ZipExporter.class);
@@ -428,7 +428,7 @@
       exporter.exportZip(target, true);
       target.deleteOnExit();
       
-      return AbstractVFS.getChild(target.toURI().toURL());
+      return AbstractVFS.getRoot(target.toURI().toURL());
    }
    
    private void failsafeUninstall(OSGiBundle bundle)

Modified: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteRuntime.java
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteRuntime.java	2010-03-09 21:14:14 UTC (rev 102172)
+++ projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteRuntime.java	2010-03-09 21:16:59 UTC (rev 102173)
@@ -74,7 +74,7 @@
    {
       try
       {
-         String location = fixVirtualFileURL(info.getRootURL()).toExternalForm();
+         String location = toFileURL(info.getRootURL()).toExternalForm();
          long bundleId = getFrameworkMBean().installBundle(location);
          RemoteBundle bundle = new RemoteBundle(this, bundleId);
          return registerBundle(bundle.getLocation(), bundle);

Modified: projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/testing/SimpleTestCase.java
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/testing/SimpleTestCase.java	2010-03-09 21:14:14 UTC (rev 102172)
+++ projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/testing/SimpleTestCase.java	2010-03-09 21:16:59 UTC (rev 102173)
@@ -107,7 +107,7 @@
       OSGiRuntime runtime = getDefaultRuntime();
       try
       {
-         VirtualFile archive = AbstractVFS.getChild(getTestArchiveURL("example-simple.jar"));
+         VirtualFile archive = AbstractVFS.getRoot(getTestArchiveURL("example-simple.jar"));
          OSGiBundle bundle = runtime.installBundle(archive);
          assertBundleState(Bundle.INSTALLED, bundle.getState());
       }

Modified: projects/jboss-osgi/projects/vfs/trunk/vfs21/src/main/java/org/jboss/osgi/vfs21/VFSAdaptor21.java
===================================================================
--- projects/jboss-osgi/projects/vfs/trunk/vfs21/src/main/java/org/jboss/osgi/vfs21/VFSAdaptor21.java	2010-03-09 21:14:14 UTC (rev 102172)
+++ projects/jboss-osgi/projects/vfs/trunk/vfs21/src/main/java/org/jboss/osgi/vfs21/VFSAdaptor21.java	2010-03-09 21:16:59 UTC (rev 102173)
@@ -35,7 +35,7 @@
  */
 public class VFSAdaptor21 implements VFSAdaptor
 {
-   public VirtualFile getChild(URL url) throws IOException
+   public VirtualFile getRoot(URL url) throws IOException
    {
       org.jboss.virtual.VirtualFile root = org.jboss.virtual.VFS.getRoot(url);
       return new VirtualFileAdaptor21(root, root);

Modified: projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VFSAdaptor30.java
===================================================================
--- projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VFSAdaptor30.java	2010-03-09 21:14:14 UTC (rev 102172)
+++ projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VFSAdaptor30.java	2010-03-09 21:16:59 UTC (rev 102173)
@@ -37,7 +37,7 @@
  */
 public class VFSAdaptor30 implements VFSAdaptor
 {
-   public VirtualFile getChild(URL url) throws IOException
+   public VirtualFile getRoot(URL url) throws IOException
    {
       org.jboss.vfs.VirtualFile root;
       try

Modified: projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VirtualFileAdaptor30.java
===================================================================
--- projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VirtualFileAdaptor30.java	2010-03-09 21:14:14 UTC (rev 102172)
+++ projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VirtualFileAdaptor30.java	2010-03-09 21:16:59 UTC (rev 102173)
@@ -109,7 +109,7 @@
    {
       if (path == null)
          throw new IllegalArgumentException("Null path");
-      
+
       if (pattern == null)
          pattern = "*";
 
@@ -119,7 +119,7 @@
       org.jboss.vfs.VirtualFile child = delegate.getChild(path);
       if (child.exists() == false)
          return null;
-      
+
       return new VFSFindEntriesEnumeration(delegate, child, pattern, recurse);
    }
 
@@ -127,14 +127,14 @@
    {
       if (path == null)
          throw new IllegalArgumentException("Null path");
-      
+
       if (path.startsWith("/"))
          path = path.substring(1);
-      
+
       org.jboss.vfs.VirtualFile child = delegate.getChild(path);
       if (child.exists() == false)
          return null;
-      
+
       return new VFSEntryPathsEnumeration(delegate, child);
    }
 



More information about the jboss-osgi-commits mailing list