[Jboss-cvs] JBossAS SVN: r56386 - in projects/microcontainer/trunk/container/src/main/org/jboss: classloading/spi vfs/classloading

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Aug 29 01:51:13 EDT 2006


Author: scott.stark at jboss.org
Date: 2006-08-29 01:51:11 -0400 (Tue, 29 Aug 2006)
New Revision: 56386

Modified:
   projects/microcontainer/trunk/container/src/main/org/jboss/classloading/spi/DomainClassLoader.java
   projects/microcontainer/trunk/container/src/main/org/jboss/vfs/classloading/VFSClassLoader.java
Log:
Add classpath and package name access

Modified: projects/microcontainer/trunk/container/src/main/org/jboss/classloading/spi/DomainClassLoader.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/classloading/spi/DomainClassLoader.java	2006-08-29 05:48:35 UTC (rev 56385)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/classloading/spi/DomainClassLoader.java	2006-08-29 05:51:11 UTC (rev 56386)
@@ -34,7 +34,15 @@
     * 
     */
    void setDomain(ClassLoadingDomain domain);
-   
+
+   public URL[] getClasspath();
+
+   /**
+    * 
+    * @param name
+    * @return
+    * @throws ClassNotFoundException
+    */
    Class loadClass(String name) throws ClassNotFoundException;
 
    /**
@@ -57,6 +65,13 @@
    Enumeration<URL> findResourcesLocally(String name) throws IOException;
 
    /**
+    * Get the possible package names associated with the class loader. This
+    * may be a superset of the currently defined Packages.
+    * 
+    * @return unique package names of classes available to the class loader.
+    */
+   public String[] getPackagNames();
+   /**
     * Get the packages defined by the classloader
     * 
     * @return the packages

Modified: projects/microcontainer/trunk/container/src/main/org/jboss/vfs/classloading/VFSClassLoader.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/vfs/classloading/VFSClassLoader.java	2006-08-29 05:48:35 UTC (rev 56385)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/vfs/classloading/VFSClassLoader.java	2006-08-29 05:51:11 UTC (rev 56386)
@@ -28,7 +28,6 @@
 import java.net.URL;
 import java.security.CodeSource;
 import java.security.PermissionCollection;
-import java.security.Policy;
 import java.security.ProtectionDomain;
 import java.security.SecureClassLoader;
 import java.security.cert.Certificate;
@@ -108,7 +107,44 @@
       classpath.add(cp);
    }
 
+   
+   /* (non-Javadoc)
+    * @see org.jboss.classloading.spi.DomainClassLoader#getClasspath()
+    */
+   public URL[] getClasspath()
+   {
+      ArrayList<URL> cp = new ArrayList<URL>(classpath.size());
+      for(ClassPathVFS entry : classpath)
+      {
+         URL baseURL = entry.vfs.getRootURL();
+         for(String path : entry.searchCtxs)
+         {
+            try
+            {
+               URL entryURL = new URL(baseURL, path);
+               cp.add(entryURL);
+            }
+            catch(MalformedURLException e)
+            {               
+            }
+         }
+      }
+      URL[] theClasspath = new URL[cp.size()];
+      cp.toArray(theClasspath);
+      return theClasspath;
+   }
+
    /**
+    * TODO
+    * @see org.jboss.classloading.spi.DomainClassLoader#getPackagNames()
+    */
+   public String[] getPackagNames()
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   /**
     * Find and define the given java class
     * 
     * @param name - the binary class name




More information about the jboss-cvs-commits mailing list