[jboss-cvs] JBossAS SVN: r112275 - branches/JBPAPP_5_1/ejb3/src/main/org/jboss/ejb3/deployers.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Sep 29 13:38:03 EDT 2011


Author: wolfc
Date: 2011-09-29 13:38:03 -0400 (Thu, 29 Sep 2011)
New Revision: 112275

Modified:
   branches/JBPAPP_5_1/ejb3/src/main/org/jboss/ejb3/deployers/Ejb3JBoss5Deployment.java
Log:
JBPAPP-7792: Scan efficiently for app-client descriptor

Modified: branches/JBPAPP_5_1/ejb3/src/main/org/jboss/ejb3/deployers/Ejb3JBoss5Deployment.java
===================================================================
--- branches/JBPAPP_5_1/ejb3/src/main/org/jboss/ejb3/deployers/Ejb3JBoss5Deployment.java	2011-09-29 09:53:11 UTC (rev 112274)
+++ branches/JBPAPP_5_1/ejb3/src/main/org/jboss/ejb3/deployers/Ejb3JBoss5Deployment.java	2011-09-29 17:38:03 UTC (rev 112275)
@@ -22,6 +22,7 @@
 package org.jboss.ejb3.deployers;
 
 import org.jboss.beans.metadata.plugins.AbstractSupplyMetaData;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
 import org.jboss.deployment.MappedReferenceMetaDataResolverDeployer;
 import org.jboss.deployment.dependency.ContainerDependencyMetaData;
 import org.jboss.ejb3.Container;
@@ -29,10 +30,12 @@
 import org.jboss.ejb3.DeploymentUnit;
 import org.jboss.ejb3.EJBContainer;
 import org.jboss.ejb3.Ejb3Deployment;
+import org.jboss.ejb3.Ejb3HandlerFactory;
 import org.jboss.ejb3.MCDependencyPolicy;
 import org.jboss.ejb3.javaee.JavaEEApplication;
 import org.jboss.ejb3.javaee.JavaEEComponent;
 import org.jboss.ejb3.kernel.JNDIKernelRegistryPlugin;
+import org.jboss.ejb3.vfs.spi.VirtualFile;
 import org.jboss.kernel.Kernel;
 import org.jboss.logging.Logger;
 import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
@@ -42,7 +45,10 @@
 
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
+import javax.naming.InitialContext;
 import javax.security.jacc.PolicyConfiguration;
+import java.io.InputStream;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -55,10 +61,10 @@
 public class Ejb3JBoss5Deployment extends Ejb3Deployment
 {
    private static Logger log = Logger.getLogger(Ejb3JBoss5Deployment.class);
-   private org.jboss.deployers.structure.spi.DeploymentUnit jbossUnit;
+   private VFSDeploymentUnit jbossUnit;
    private Map<String, ContainerDependencyMetaData> endpoints;
 
-   public Ejb3JBoss5Deployment(DeploymentUnit ejb3Unit, Kernel kernel, MBeanServer mbeanServer, org.jboss.deployers.structure.spi.DeploymentUnit jbossUnit, JBoss5DeploymentScope deploymentScope, JBossMetaData metaData)
+   public Ejb3JBoss5Deployment(DeploymentUnit ejb3Unit, Kernel kernel, MBeanServer mbeanServer, VFSDeploymentUnit jbossUnit, JBoss5DeploymentScope deploymentScope, JBossMetaData metaData)
    {
       // Either call the old constructor and do process persistence units
       //super(ejb3Unit, deploymentScope, metaData, persistenceUnitsMetaData);
@@ -79,6 +85,29 @@
       return null;
    }
 
+   @Override
+   protected void deployUrl(Ejb3HandlerFactory factory) throws Exception
+   {
+      // make sure we are not deploying ejbs from client jar
+      if (hasClientDescriptors())
+         return;
+
+      InitialContext ctx = initialContext;
+      // need to look into every entry in the archive to see if anybody has tags
+      // defined.
+      List<VirtualFile> classes = unit.getResources(new org.jboss.ejb3.ClassFileFilter());
+      for (VirtualFile classFile : classes)
+      {
+         InputStream stream = classFile.openStream();
+         deployElement(stream, factory, ctx);
+      }
+   }
+
+   private boolean hasClientDescriptors()
+   {
+      return jbossUnit.getMetaDataFile("application-client.xml") != null || jbossUnit.getMetaDataFile("jboss-client.xml") != null;
+   }
+
    protected void putJaccInService(PolicyConfiguration pc, DeploymentUnit ejb3Unit)
    {
       //Ignore



More information about the jboss-cvs-commits mailing list