6 Replies Latest reply on Mar 4, 2010 10:28 AM by asoldano

    Trivial vfs-3.0.x manifest access fails

    thomas.diesler

      When trying to access the manifest from a jar, I get

       

      Caused by: java.io.FileNotFoundException: /home/tdiesler/svn/jboss-osgi/trunk/testsuite/example/target/test-libs/example-simple.jar/META-INF/MANIFEST.MF (Not a directory)
          at java.io.FileInputStream.open(Native Method)
          at java.io.FileInputStream.<init>(FileInputStream.java:106)
          at org.jboss.vfs.spi.RealFileSystem.openInputStream(RealFileSystem.java:67)
          at org.jboss.vfs.VirtualFile.openStream(VirtualFile.java:225)
          at org.jboss.osgi.vfs30.VirtualFileAdaptor30.openStream(VirtualFileAdaptor30.java:106)
          at org.jboss.osgi.vfs.VFSUtils.getManifest(VFSUtils.java:49)
          at org.jboss.osgi.spi.util.BundleInfo.<init>(BundleInfo.java:109)
      
      

       

      Essentially I do

       

      VirtualFile root = VFS.getChild(url);
      VirtualFile manifest = root.getChild(JarFile.MANIFEST_NAME);
      InputStream stream = manifest.openStream();
      

       

      In vfs21 I do

       

      VirtualFile root = VFS.getRoot(url);
      VirtualFile manifest = root.getChild(JarFile.MANIFEST_NAME);
      InputStream stream = manifest.openStream();
      

       

      which works.

        • 1. Re: Trivial vfs-3.0.x manifest access fails
          alesj

          VFS3 requires explicit mount of non-plain files; e.g. zip, gzip, ...

          See AbstractVFSArchiveStructureDeployer in Deployers on how this is done, or VFS tests.

          • 2. Re: Trivial vfs-3.0.x manifest access fails
            thomas.diesler

            I added this

             

                  MountOwner owner = new VirtualFileOwner(root);
                  Automounter.mount(owner, root);
            

             

            which seems to work.

             

            Is this right?

            Is there some cleanup needed?

             

            Please document the correct usage of the API.

             

            Good javadoc with code examples on how to use the API is the minimum.

            Alternatively, you could provide a wiki or docbook.

            • 3. Re: Trivial vfs-3.0.x manifest access fails
              thomas.diesler

              No, I do not want to see some other bit of undocumented code.

              Instead, I want to be directed to the jboss-vfs documentation.

               

              Perhaps you like to confirm that this is indeed on the roadmap.

              https://jira.jboss.org/jira/browse/JBVFS-113

              • 4. Re: Trivial vfs-3.0.x manifest access fails
                alesj

                I added this

                 

                      MountOwner owner = new VirtualFileOwner(root);
                      Automounter.mount(owner, root);
                

                 

                which seems to work.

                 

                Is this right?

                Is there some cleanup needed?

                No need for MountOwner, Automounter::mount takes Object, and wraps it -- same as you did explicitly.

                Yes, you need to preform explicit cleanup as well -- Automounter::mount returns Closeable cleanup handle.

                • 5. Re: Trivial vfs-3.0.x manifest access fails
                  dmlloyd

                  But, don't use automounter unless you have no other choice.  It's not intended as a consumable API; it's only there until we can work out a good way to get mounting into the deployment lifecycle/dependency graph.

                   

                  In fact maybe I can convince John to deprecate it right off...

                   

                  I think it'd be better if we have a deployed MC bean which represents the mount of the archive, and then everything using that mount will have a dependency on that.

                   

                  In the standalone case (e.g. testing) you can just mount the archive and unmount it again in a finally block.

                   

                  Note that the normal mount API is well-documented.

                  • 6. Re: Trivial vfs-3.0.x manifest access fails
                    asoldano

                    david.lloyd@jboss.com ha scritto:

                     

                    I think it'd be better if we have a deployed MC bean which represents the mount of the archive, and then everything using that mount will have a dependency on that.

                     

                    +1