[jboss-cvs] JBossAS SVN: r68878 - projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/classloader.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Jan 11 07:20:40 EST 2008
Author: adrian at jboss.org
Date: 2008-01-11 07:20:40 -0500 (Fri, 11 Jan 2008)
New Revision: 68878
Modified:
projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/classloader/VFSClassLoaderPolicy.java
projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/classloader/VFSTopLevelClassLoaderSystemDeployer.java
Log:
Give the VFSClassLoaderPolicy a name. By default is the deployment name or failing that the first root - otherwise empty
Modified: projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/classloader/VFSClassLoaderPolicy.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/classloader/VFSClassLoaderPolicy.java 2008-01-11 11:47:47 UTC (rev 68877)
+++ projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/classloader/VFSClassLoaderPolicy.java 2008-01-11 12:20:40 UTC (rev 68878)
@@ -50,6 +50,9 @@
{
/** The log */
private static Logger log = Logger.getLogger(VFSClassLoaderPolicy.class);
+
+ /** A name for the policy */
+ private String name;
/** The roots */
private VirtualFile[] roots;
@@ -64,6 +67,28 @@
private boolean importAll;
/**
+ * Determine a name from the roots
+ *
+ * @param roots the roots
+ * @return the name
+ */
+ private static String determineName(VirtualFile[] roots)
+ {
+ if (roots == null)
+ return "";
+
+ try
+ {
+ for (VirtualFile root : roots)
+ return root.toURL().toString();
+ }
+ catch (Exception ignored)
+ {
+ }
+ return "";
+ }
+
+ /**
* Create a new VFSClassLoaderPolicy.
*
* @param roots the roots
@@ -74,6 +99,19 @@
{
return new VFSClassLoaderPolicy(roots);
}
+
+ /**
+ * Create a new VFSClassLoaderPolicy.
+ *
+ * @param name a name of the policy
+ * @param roots the roots
+ * @return the classloader policy
+ * @throws IllegalArgumentException for null roots
+ */
+ public static VFSClassLoaderPolicy createVFSClassLoaderPolicy(String name, VirtualFile... roots)
+ {
+ return new VFSClassLoaderPolicy(name, roots);
+ }
/**
* Create a new VFSClassLoaderPolicy.
@@ -95,6 +133,35 @@
}
/**
+ * Create a new VFSClassLoaderPolicy.
+ *
+ * @param name the name
+ * @param roots the roots
+ * @throws IllegalArgumentException for null roots
+ */
+ public VFSClassLoaderPolicy(String name, VirtualFile[] roots)
+ {
+ if (name == null)
+ throw new IllegalArgumentException("Null name");
+ if (roots == null)
+ throw new IllegalArgumentException("Null roots");
+ for (VirtualFile root : roots)
+ {
+ if (root == null)
+ throw new IllegalArgumentException("Null root in " + Arrays.asList(roots));
+ }
+
+ this.name = name;
+ this.roots = roots;
+ }
+
+ @Override
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
* Get the exportAll.
*
* @return the exportAll.
@@ -302,4 +369,4 @@
}
return visitor.getPackages();
}
-}
\ No newline at end of file
+}
Modified: projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/classloader/VFSTopLevelClassLoaderSystemDeployer.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/classloader/VFSTopLevelClassLoaderSystemDeployer.java 2008-01-11 11:47:47 UTC (rev 68877)
+++ projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/classloader/VFSTopLevelClassLoaderSystemDeployer.java 2008-01-11 12:20:40 UTC (rev 68878)
@@ -57,7 +57,7 @@
URL url = new URL(module.getDynamicClassRoot() + "/classes");
roots[i++] = factory.createDirectory(url).getVirtualFile();
- VFSClassLoaderPolicy policy = new VFSClassLoaderPolicy(roots);
+ VFSClassLoaderPolicy policy = new VFSClassLoaderPolicy(module.getName(), roots);
policy.setExportAll(module.getExportAll());
policy.setImportAll(module.isImportAll());
// TODO JBMICROCONT-182 more policy from "module"
More information about the jboss-cvs-commits
mailing list