3 Replies Latest reply on Oct 8, 2009 8:44 AM by thomas.diesler

    Should BundleStructureDeployer add embedded archives ?

    thomas.diesler

      Currently BundleStructureDeployer adds embedded archives like this

       // Create a context for this jar file with META-INF as the location for metadata
       context = createContext(structureContext, "META-INF");
      
       // The classpath is the root
       addClassPath(structureContext, file, true, true, context);
      
       // Add archive children to the classpath
       for (VirtualFile child : root.getChildren())
       {
       if (child.isArchive())
       addClassPath(structureContext, child, true, true, context);
       }
      


      In this post http://www.jboss.org/index.html?module=bb&op=viewtopic&t=162196

      I describe how Bundle-ClassPath entries cause root files in the classloading policy.

      Should the structure deployer also be Bundle-ClassPath aware or should it perhaps not handle embedded jars at all?

      Please advice.

        • 1. Re: Should BundleStructureDeployer add embedded archives ?
          alesj

           

          "thomas.diesler@jboss.com" wrote:

          Should the structure deployer also be Bundle-ClassPath aware or should it perhaps not handle embedded jars at all?

          Yes, it should be the structure deployer to handle this, not policy creation code.
          See JARStructure and its addClassPath call, where includeRootManifestCP == true.

           // Add the manifest locations
           if (includeRootManifestCP && isLeaf(entry) == false)
           {
           try
           {
           VFSUtils.addManifestLocations(entry, paths);
           }
           catch(Exception e)
           {
           if (trace)
           log.trace("Failed to add manifest locations", e);
           }
           }
          
           ...
          



          • 2. Re: Should BundleStructureDeployer add embedded archives ?
            alesj

             

            "alesj" wrote:

            Yes, it should be the structure deployer to handle this, not policy creation code.

            In this case it could also be some real deployer (pre CL stage),
            similar to what we do in InMemoryClassesDeployer.

            But since you're already parsing manifest for symbolic name in structure deployer,
            I guess you don't gain that much by moving this code on top of existing OSGiMetaData in some real deployer.

            e.g. it would make sense to move it to real deployer and work on existing OSGiMetaData, hence not reading manifest headers twice
            But like I said, this is not the case here, as you *must* already read it in structure deployer

            • 3. Re: Should BundleStructureDeployer add embedded archives ?
              thomas.diesler

              ok, I moved the Bundle-ClassPath handling to the bundle structore deployer. The OSGiClassLoaderFacory picks up the classpath from the structure