[jboss-cvs] JBossAS SVN: r94514 - projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Oct 8 08:10:01 EDT 2009
Author: thomas.diesler at jboss.com
Date: 2009-10-08 08:10:00 -0400 (Thu, 08 Oct 2009)
New Revision: 94514
Modified:
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleStructureDeployer.java
Log:
Handle Bundle-ClassPath
Modified: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleStructureDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleStructureDeployer.java 2009-10-08 11:52:23 UTC (rev 94513)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleStructureDeployer.java 2009-10-08 12:10:00 UTC (rev 94514)
@@ -23,6 +23,7 @@
// $Id$
+import java.io.IOException;
import java.util.jar.Attributes;
import java.util.jar.Manifest;
@@ -60,15 +61,14 @@
public boolean determineStructure(StructureContext structureContext) throws DeploymentException
{
ContextInfo context = null;
- VirtualFile file = structureContext.getFile();
VirtualFile root = structureContext.getRoot();
try
{
// This file is not for me, because I'm only interested
// in root deployments that contain a MANIFEST.MF
- Manifest manifest = VFSUtils.getManifest(file);
- if (file != root || manifest == null)
+ Manifest manifest = VFSUtils.getManifest(root);
+ if (root != structureContext.getFile() || manifest == null)
return false;
// This file is also not for me, because I need to see Bundle-SymbolicName
@@ -80,15 +80,39 @@
// 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())
+ // Add a classpath entry for every Bundle-ClassPath element
+ String classPath = attribs.getValue(Constants.BUNDLE_CLASSPATH);
+ if (classPath == null)
{
- if (child.isArchive())
- addClassPath(structureContext, child, true, true, context);
+ // No Bundle-ClassPath, just add the root
+ addClassPath(structureContext, root, true, false, context);
}
+ else
+ {
+ String[] classPathArr = classPath.split("[,\\s]");
+ for (String path : classPathArr)
+ {
+ if (path.equals("."))
+ {
+ // Add the root
+ addClassPath(structureContext, root, true, false, context);
+ }
+ else
+ {
+ // [TODO] publish a Framework Event of type INFO
+ // [TODO] locate the class path entry in attached fragments
+ try
+ {
+ VirtualFile child = root.getChild(path);
+ addClassPath(structureContext, child, true, false, context);
+ }
+ catch (IOException ex)
+ {
+ log.info("Cannot find class path '" + path + "' in: " + root);
+ }
+ }
+ }
+ }
// We don't process children as potential subdeployments
@@ -100,7 +124,7 @@
if (context != null)
structureContext.removeChild(context);
- throw DeploymentException.rethrowAsDeploymentException("Error determining structure: " + file.getName(), e);
+ throw DeploymentException.rethrowAsDeploymentException("Error determining structure: " + root.getName(), e);
}
}
}
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list