[jboss-cvs] JBossAS SVN: r71306 - in projects/jboss-deployers/trunk: deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Mar 26 12:33:54 EDT 2008


Author: adrian at jboss.org
Date: 2008-03-26 12:33:54 -0400 (Wed, 26 Mar 2008)
New Revision: 71306

Modified:
   projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/structure/VFSDeploymentContext.java
   projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/structure/VFSDeploymentUnit.java
   projects/jboss-deployers/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/classloader/InMemoryClassesDeployer.java
   projects/jboss-deployers/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/AbstractVFSDeploymentContext.java
   projects/jboss-deployers/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/AbstractVFSDeploymentUnit.java
Log:
[JBDEPLOY-22] - In Memory classes should be first in the classpath

Modified: projects/jboss-deployers/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/classloader/InMemoryClassesDeployer.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/classloader/InMemoryClassesDeployer.java	2008-03-26 16:21:47 UTC (rev 71305)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/classloader/InMemoryClassesDeployer.java	2008-03-26 16:33:54 UTC (rev 71306)
@@ -72,7 +72,7 @@
          VirtualFile classes = factory.createDirectory(classesURL).getVirtualFile();
          unit.addAttachment(DYNAMIC_CLASS_URL_KEY, dynamicClassRoot);
          unit.addAttachment(DYNAMIC_CLASS_KEY, classes);
-         unit.addClassPath(classes);
+         unit.prependClassPath(classes);
          log.debug("Dynamic class root for " + unit.getName() + " is " + dynamicClassRoot);
       }
       catch (Exception e)

Modified: projects/jboss-deployers/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/AbstractVFSDeploymentContext.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/AbstractVFSDeploymentContext.java	2008-03-26 16:21:47 UTC (rev 71305)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/AbstractVFSDeploymentContext.java	2008-03-26 16:33:54 UTC (rev 71306)
@@ -287,7 +287,7 @@
          log.trace("ClassPath for " + root.getPathName() + " is " + VFSUtils.getPathsString(paths));
    }
 
-   public void addClassPath(List<VirtualFile> files)
+   public void appendClassPath(List<VirtualFile> files)
    {
       if (files == null)
          throw new IllegalArgumentException("Null files");
@@ -305,7 +305,7 @@
       setClassPath(classPath);
    }
 
-   public void addClassPath(VirtualFile... files)
+   public void prependClassPath(VirtualFile... files)
    {
       if (files == null)
          throw new IllegalArgumentException("Null files");
@@ -314,6 +314,44 @@
       if (classPath == null)
          classPath = new ArrayList<VirtualFile>();
       
+      for (int i = files.length-1; i >= 0; --i)
+      {
+         VirtualFile file = files[i];
+         if (file == null)
+            throw new IllegalArgumentException("Null virtual file in " + files);
+         classPath.add(0, file);
+      }
+      setClassPath(classPath);
+   }
+
+   public void prependClassPath(List<VirtualFile> files)
+   {
+      if (files == null)
+         throw new IllegalArgumentException("Null files");
+
+      List<VirtualFile> classPath = getClassPath();
+      if (classPath == null)
+         classPath = new ArrayList<VirtualFile>();
+      
+      for (int i = files.size()-1; i >= 0; --i)
+      {
+         VirtualFile file = files.get(i);
+         if (file == null)
+            throw new IllegalArgumentException("Null virtual file in " + files);
+         classPath.add(0, file);
+      }
+      setClassPath(classPath);
+   }
+
+   public void appendClassPath(VirtualFile... files)
+   {
+      if (files == null)
+         throw new IllegalArgumentException("Null files");
+
+      List<VirtualFile> classPath = getClassPath();
+      if (classPath == null)
+         classPath = new ArrayList<VirtualFile>();
+      
       for (VirtualFile file : files)
       {
          if (file == null)

Modified: projects/jboss-deployers/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/AbstractVFSDeploymentUnit.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/AbstractVFSDeploymentUnit.java	2008-03-26 16:21:47 UTC (rev 71305)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/AbstractVFSDeploymentUnit.java	2008-03-26 16:33:54 UTC (rev 71306)
@@ -94,14 +94,34 @@
       getDeploymentContext().setClassPath(classPath);
    }
    
+   public void prependClassPath(List<VirtualFile> files)
+   {
+      getDeploymentContext().prependClassPath(files);
+   }
+
+   public void prependClassPath(VirtualFile... files)
+   {
+      getDeploymentContext().prependClassPath(files);
+   }
+   
+   public void appendClassPath(List<VirtualFile> files)
+   {
+      getDeploymentContext().appendClassPath(files);
+   }
+
+   public void appendClassPath(VirtualFile... files)
+   {
+      getDeploymentContext().appendClassPath(files);
+   }
+   
    public void addClassPath(List<VirtualFile> files)
    {
-      getDeploymentContext().addClassPath(files);
+      getDeploymentContext().appendClassPath(files);
    }
 
    public void addClassPath(VirtualFile... files)
    {
-      getDeploymentContext().addClassPath(files);
+      getDeploymentContext().appendClassPath(files);
    }
 
    @Override

Modified: projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/structure/VFSDeploymentContext.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/structure/VFSDeploymentContext.java	2008-03-26 16:21:47 UTC (rev 71305)
+++ projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/structure/VFSDeploymentContext.java	2008-03-26 16:33:54 UTC (rev 71306)
@@ -105,18 +105,32 @@
    void setClassPath(List<VirtualFile> paths);
    
    /**
-    * Add virtual files to the classpath
+    * Prepend virtual files to the classpath
     * 
     * @param files a virtual file
     */
-   void addClassPath(VirtualFile... files);
+   void prependClassPath(VirtualFile... files);
    
    /**
+    * Prepend virtual files to the classpath
+    * 
+    * @param files a virtual file
+    */
+   void prependClassPath(List<VirtualFile> files);
+   
+   /**
+    * Append virtual files to the classpath
+    * 
+    * @param files a virtual file
+    */
+   void appendClassPath(VirtualFile... files);
+   
+   /**
     * Add virtual files to the classpath
     * 
     * @param files a virtual file
     */
-   void addClassPath(List<VirtualFile> files);
+   void appendClassPath(List<VirtualFile> files);
 
    /**
     * Get the top level deployment context

Modified: projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/structure/VFSDeploymentUnit.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/structure/VFSDeploymentUnit.java	2008-03-26 16:21:47 UTC (rev 71305)
+++ projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/structure/VFSDeploymentUnit.java	2008-03-26 16:33:54 UTC (rev 71306)
@@ -91,10 +91,38 @@
    void setClassPath(List<VirtualFile> classPath);
    
    /**
+    * Prepend virtual files to the classpath
+    * 
+    * @param files a virtual file
+    */
+   void prependClassPath(VirtualFile... files);
+   
+   /**
+    * Prepend virtual files to the classpath
+    * 
+    * @param files a virtual file
+    */
+   void prependClassPath(List<VirtualFile> files);
+   
+   /**
+    * Append virtual files to the classpath
+    * 
+    * @param files a virtual file
+    */
+   void appendClassPath(VirtualFile... files);
+   
+   /**
     * Add virtual files to the classpath
     * 
     * @param files a virtual file
     */
+   void appendClassPath(List<VirtualFile> files);
+   
+   /**
+    * Append virtual files to the classpath
+    * 
+    * @param files a virtual file
+    */
    void addClassPath(VirtualFile... files);
    
    /**




More information about the jboss-cvs-commits mailing list