[jboss-dev-forums] [JBoss Microcontainer Development] - Added initial support for split packages

thomas.diesler@jboss.com do-not-reply at jboss.com
Tue Aug 25 10:59:02 EDT 2009


Folks, this relates to 

https://jira.jboss.org/jira/browse/JBCL-25

What I've basically done is make the generated error dependent on the the SplitPackagePolicy, which can be configured at at PackageCapability


  |             Module otherModule = modulesByPackage.get(exportedPackage);
  |             if (otherModule != null)
  |             {
  |                PackageCapability exportCapability = module.getExportCapability(exportedPackage);
  |                if (exportCapability.getSplitPackagePolicy() == SplitPackagePolicy.Error)
  |                {
  |                   // TODO JBCL-22 ERRORS
  |                   throw new IllegalStateException(module + " cannot be added because it is exports package " + exportedPackage + " which conflicts with " + otherModule);
  |                }
  |             }
  | 


There is additional code that tries to swap the module for an existing export package


  |       // Update the exported packages
  |       if (exportedPackages != null && exportedPackages.isEmpty() == false)
  |       {
  |          for (String exportedPackage : exportedPackages)
  |          {
  |             Module firstModule = modulesByPackage.get(exportedPackage);
  |             PackageCapability exportCapability = module.getExportCapability(exportedPackage);
  |             if (firstModule == null || exportCapability.getSplitPackagePolicy() == SplitPackagePolicy.Last)
  |                modulesByPackage.put(exportedPackage, module);
  |          }
  |       }
  | 

This however, does not work and I'd like to get some insight on how to do this properly

The test that is supposed to verify SplitPackagePolicy.Last is here


  |    public void testSplitPackageLast() throws Exception
  |    {
  |       MockClassLoadingMetaData ab = getModuleAB(null);
  |       MockClassLoadingMetaData ac = getModuleAC(SplitPackagePolicy.Last);
  |       
  |       KernelControllerContext contextAB = install(ab);
  |       try
  |       {
  |          ClassLoader clAB = assertClassLoader(contextAB);
  |          assertLoadClass(A.class, clAB);
  |          assertLoadClass(B.class, clAB);
  |          
  |          KernelControllerContext contextAC = install(ac);
  |          ClassLoader clAC = assertClassLoader(contextAC);
  |          System.out.println("FIXME: SplitPackagePolicy.Last");
  |          // assertLoadClass(A.class, clAC);
  |          assertLoadClass(B.class, clAB);
  |          assertLoadClass(C.class, clAC);
  |       }
  |       finally
  |       {
  |          uninstall(contextAB);
  |       }
  |       assertNoClassLoader(contextAB);
  |    }
  | 


View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4251548#4251548

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4251548



More information about the jboss-dev-forums mailing list