[jboss-cvs] JBossAS SVN: r64617 - trunk/ejb3/src/main/org/jboss/ejb3/deployers.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Aug 16 06:04:21 EDT 2007


Author: wolfc
Date: 2007-08-16 06:04:21 -0400 (Thu, 16 Aug 2007)
New Revision: 64617

Modified:
   trunk/ejb3/src/main/org/jboss/ejb3/deployers/Ejb3ClientDeployer.java
Log:
EJBTHREE-1030: exposing EAR class path directives in JNDI

Modified: trunk/ejb3/src/main/org/jboss/ejb3/deployers/Ejb3ClientDeployer.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/deployers/Ejb3ClientDeployer.java	2007-08-16 08:54:52 UTC (rev 64616)
+++ trunk/ejb3/src/main/org/jboss/ejb3/deployers/Ejb3ClientDeployer.java	2007-08-16 10:04:21 UTC (rev 64617)
@@ -22,6 +22,7 @@
 package org.jboss.ejb3.deployers;
 
 import java.io.InputStream;
+import java.util.List;
 import java.util.jar.Attributes;
 import java.util.jar.Manifest;
 
@@ -32,6 +33,8 @@
 import javax.naming.NamingException;
 
 import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.structure.ClassPathEntry;
+import org.jboss.deployers.spi.structure.StructureMetaData;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
 import org.jboss.deployers.vfs.spi.deployer.AbstractSimpleVFSRealDeployer;
 import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
@@ -69,7 +72,7 @@
    public void deploy(VFSDeploymentUnit unit, ApplicationClientDD metaData) throws DeploymentException
    {
       log.debug("deploy " + unit.getName());
-
+      
       String appClientName = getJndiName(unit, metaData);
 
       try
@@ -79,6 +82,9 @@
          Context encCtx = Util.createSubcontext(iniCtx, appClientName);
          log.debug("Creating client ENC binding under: " + appClientName);
 
+         // Notify the client launcher of extra class path entries in an EAR (See EE 8.2)
+         encCtx.bind("classPathEntries", getClassPathEntries(unit));
+         
          String mainClassName = getMainClassName(unit, true);
 
          Class<?> mainClass = loadClass(unit, mainClassName);
@@ -98,6 +104,20 @@
    }
 
    /**
+    * Get the class path entries which have been determined by the EARStructure.
+    * Will return null if this unit is not part of an ear deployment.
+    */
+   private List<ClassPathEntry> getClassPathEntries(VFSDeploymentUnit unit)
+   {
+//      log.info("class path = " + unit.getTopLevel().getAttachment(StructureMetaData.class).getContext("").getClassPath());
+      StructureMetaData smd = unit.getTopLevel().getAttachment(StructureMetaData.class);
+      if(smd == null)
+         return null;
+      // A context with a patch is the one we want (see AbstractStructureDeployer)
+      return smd.getContext("").getClassPath();
+   }
+   
+   /**
     * If there is no deployment descriptor, or it doesn't specify a JNDI name, then we make up one.
     * We use the basename from di.shortName.
     *




More information about the jboss-cvs-commits mailing list