[Jboss-cvs] JBossAS SVN: r55520 - in branches/MC_VDF_WORK/system/src/main/org/jboss/deployers/plugins: . bean classloading jar

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Aug 11 03:17:21 EDT 2006


Author: scott.stark at jboss.org
Date: 2006-08-11 03:17:16 -0400 (Fri, 11 Aug 2006)
New Revision: 55520

Modified:
   branches/MC_VDF_WORK/system/src/main/org/jboss/deployers/plugins/AbstractAspectDeployer.java
   branches/MC_VDF_WORK/system/src/main/org/jboss/deployers/plugins/bean/BeanDeployer.java
   branches/MC_VDF_WORK/system/src/main/org/jboss/deployers/plugins/classloading/ClassLoadingDeployer.java
   branches/MC_VDF_WORK/system/src/main/org/jboss/deployers/plugins/jar/JARDeployer.java
Log:
Add an allowImplicitClasspath flag indicating if non-deployment jars should be added to this deployment

Modified: branches/MC_VDF_WORK/system/src/main/org/jboss/deployers/plugins/AbstractAspectDeployer.java
===================================================================
--- branches/MC_VDF_WORK/system/src/main/org/jboss/deployers/plugins/AbstractAspectDeployer.java	2006-08-11 07:15:31 UTC (rev 55519)
+++ branches/MC_VDF_WORK/system/src/main/org/jboss/deployers/plugins/AbstractAspectDeployer.java	2006-08-11 07:17:16 UTC (rev 55520)
@@ -65,6 +65,9 @@
    protected int relativeOrder = DeployerConstants.DEFAULT_DEPLOYER_ORDER;
    /** The MC kernel context */
    protected KernelControllerContext context;
+   /** A flag indicating if non-deployment jars should be added to this deployment */
+   protected boolean allowImplicitClasspath;
+   /** The kernel event sequence number */
    protected AtomicLong eventSequence = new AtomicLong();
 
    // Constructors --------------------------------------------------
@@ -100,9 +103,20 @@
       this.setEnhancedSuffixes(enhancedSuffixes);
       this.setRelativeOrder(relativeOrder);
    }
+
    
    // AspectDeployer methods  ---------------------------------------
    
+   public boolean isAllowImplicitClasspath()
+   {
+      return allowImplicitClasspath;
+   }
+
+   public void setAllowImplicitClasspath(boolean allowImplicitClasspath)
+   {
+      this.allowImplicitClasspath = allowImplicitClasspath;
+   }
+
    /**
     * Gets a qualifying name for this deployer
     * 
@@ -163,7 +177,8 @@
 
    /**
     * A stub method that should be overriden by deployers that want to
-    * associate themselves with a deployment context.
+    * associate themselves with a deployment context. This should be called
+    * by subclasses to pickup AbstractAspectDeployer context data.
     * 
     * @param ctx - the current deployment context being processed
     * @return false always
@@ -172,7 +187,11 @@
     */
    public boolean analyze(DeploymentContext ctx) throws DeploymentException
    {
-      // No DeploymentEvent.ANALYZE is generated as we don't accept anything
+      if( this.isAllowImplicitClasspath() )
+      {
+         ctx.putContextData(DeployerConstants.class,
+               DeployerConstants.DEPLOYER_ALLOWS_IMPLICIT_CLASSPATH, Boolean.TRUE);
+      }
       return false;
    }
 

Modified: branches/MC_VDF_WORK/system/src/main/org/jboss/deployers/plugins/bean/BeanDeployer.java
===================================================================
--- branches/MC_VDF_WORK/system/src/main/org/jboss/deployers/plugins/bean/BeanDeployer.java	2006-08-11 07:15:31 UTC (rev 55519)
+++ branches/MC_VDF_WORK/system/src/main/org/jboss/deployers/plugins/bean/BeanDeployer.java	2006-08-11 07:17:16 UTC (rev 55520)
@@ -123,6 +123,8 @@
             ctx.putContextData(getClass(), JAR_DESCRIPTOR, Boolean.TRUE);
             // add deployment base to the classpath
             ctx.addClasspathEntry("");
+            // Call super to pickup any abstract deployer context data
+            super.analyze(ctx);
          }
          catch(IOException ignore)
          {

Modified: branches/MC_VDF_WORK/system/src/main/org/jboss/deployers/plugins/classloading/ClassLoadingDeployer.java
===================================================================
--- branches/MC_VDF_WORK/system/src/main/org/jboss/deployers/plugins/classloading/ClassLoadingDeployer.java	2006-08-11 07:15:31 UTC (rev 55519)
+++ branches/MC_VDF_WORK/system/src/main/org/jboss/deployers/plugins/classloading/ClassLoadingDeployer.java	2006-08-11 07:17:16 UTC (rev 55520)
@@ -23,6 +23,7 @@
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.List;
 import java.util.jar.Attributes;
 import java.util.jar.Manifest;
 
@@ -30,6 +31,8 @@
 import org.jboss.deployers.plugins.DeployerConstants;
 import org.jboss.deployers.spi.DeploymentContext;
 import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.vfs.classloading.VFSClassLoader;
+import org.jboss.vfs.spi.ReadOnlyVFS;
 import org.jboss.vfs.spi.VirtualFile;
 
 /**
@@ -103,7 +106,17 @@
     */
    public void deploy(DeploymentContext ctx) throws DeploymentException
    {
-      
+      VFSClassLoader loader = (VFSClassLoader) ctx.getContextData(DeployerConstants.class,
+            DeployerConstants.CLASSLOADER);
+      if( loader == null )
+      {
+         ReadOnlyVFS vfs = ctx.getVFS();
+         List<String> classpath = ctx.getClasspath();
+         String[] paths = new String[classpath.size()];
+         loader = new VFSClassLoader(paths, vfs);
+         ctx.putContextData(DeployerConstants.class,
+            DeployerConstants.CLASSLOADER, loader);
+      }
    }
 
    public void redeploy(DeploymentContext comp) throws DeploymentException

Modified: branches/MC_VDF_WORK/system/src/main/org/jboss/deployers/plugins/jar/JARDeployer.java
===================================================================
--- branches/MC_VDF_WORK/system/src/main/org/jboss/deployers/plugins/jar/JARDeployer.java	2006-08-11 07:15:31 UTC (rev 55519)
+++ branches/MC_VDF_WORK/system/src/main/org/jboss/deployers/plugins/jar/JARDeployer.java	2006-08-11 07:17:16 UTC (rev 55520)
@@ -25,10 +25,13 @@
 import org.jboss.deployers.plugins.DeployerConstants;
 import org.jboss.deployers.spi.DeploymentContext;
 import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.vfs.spi.VirtualFile;
 
 /**
- * ClassLoadingDeployer
- * TODO: I don't think this deployer is useful any longer
+ * A structural only deployer that should be ordered last to pickup
+ * non-deployment jars in deployments marked with
+ * {@value DeployerConstants#DEPLOYER_ALLOWS_IMPLICIT_CLASSPATH}DEPLOYER_ALLOWS_IMPLICIT_CLASSPATH
+ * key with a value of Boolean.TRUE in the DeploymentContext.contextData map.
  * 
  * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
  * @version $Revision$
@@ -61,33 +64,53 @@
    }
 
    /**
-    * Analyze .jar, .zip deployments
+    * If 
     */
    public boolean analyze(DeploymentContext ctx) throws DeploymentException
    {
-      // not a .jar/.zip deployment
-      return false;
+      boolean isJar = false;
+      if( ctx.getDeploymentTypes().size() == 0 )
+      {
+         String basename = ctx.getFile().getName();
+         VirtualFile vf = ctx.getFile();
+         if (endsWithOneOfTheSuffixes(basename))
+         {
+            DeploymentContext parent = ctx.getParentContext();
+            Boolean implicitClasspath = (Boolean) parent.getContextData(DeployerConstants.class,
+                  DeployerConstants.DEPLOYER_ALLOWS_IMPLICIT_CLASSPATH);
+            if( parent != null && Boolean.TRUE == implicitClasspath )
+            {
+               String path = vf.getPathName();
+               parent.addClasspathEntry(path);
+               isJar = true;
+            }
+         }
+      }
+      return isJar;
    }
    public Object getManagedObject(DeploymentContext ctx)
    {
       return null;
    }
 
+   /**
+    * Noop, only analyze is used to add augment the classpath
+    */
    public void deploy(DeploymentContext comp) throws DeploymentException
    {
-      // TODO Auto-generated method stub
-      
    }
 
+   /**
+    * Noop, only analyze is used to add augment the classpath
+    */
    public void redeploy(DeploymentContext comp) throws DeploymentException
    {
-      // TODO Auto-generated method stub
-      
    }
 
+   /**
+    * Noop, only analyze is used to add augment the classpath
+    */
    public void undeploy(DeploymentContext comp) throws DeploymentException
    {
-      // TODO Auto-generated method stub
-      
    }   
 }




More information about the jboss-cvs-commits mailing list