[jboss-cvs] JBossAS SVN: r83990 - in projects/ejb3/trunk: deployers/src/main/java/org/jboss/ejb3/deployers and 3 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Feb 9 03:19:33 EST 2009


Author: jaikiran
Date: 2009-02-09 03:19:32 -0500 (Mon, 09 Feb 2009)
New Revision: 83990

Added:
   projects/ejb3/trunk/deployers/src/main/java/org/jboss/ejb3/deployers/EjbAnnotationMetaDataDeployer.java
   projects/ejb3/trunk/deployers/src/main/java/org/jboss/ejb3/deployers/MergedJBossMetaDataDeployer.java
Removed:
   projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/EjbAnnotationMetaDataDeployer.java
   projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/MergedJBossMetaDataDeployer.java
Modified:
   projects/ejb3/trunk/deployers/pom.xml
   projects/ejb3/trunk/embedded/pom.xml
   projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/EjbMetadataJndiPolicyDecoratorDeployer.java
   projects/ejb3/trunk/embedded/src/main/resources/META-INF/ejb-deployers-beans.xml
   projects/ejb3/trunk/embedded/src/main/resources/META-INF/jpa-deployers-beans.xml
Log:
EJBTHREE-15331) Removed references of deprecated org.jboss.ejb3.embedded.deployers.EjbParsingDeployer2) Removed references of deprecated org.jboss.ejb3.embedded.deployers.JBossEjbParsingDeployer3) Moved org.jboss.ejb3.embedded.deployers.EjbAnnotationMetaDataDeployer and org.jboss.ejb3.embedded.deployers.MergedJBossMetaDataDeployer to jboss-ejb3-deployers project

Modified: projects/ejb3/trunk/deployers/pom.xml
===================================================================
--- projects/ejb3/trunk/deployers/pom.xml	2009-02-09 08:08:07 UTC (rev 83989)
+++ projects/ejb3/trunk/deployers/pom.xml	2009-02-09 08:19:32 UTC (rev 83990)
@@ -24,7 +24,9 @@
 
     <!-- Versioning -->
     <version.org.jboss.deployers.jboss_deployers_spi>2.0.0.CR2</version.org.jboss.deployers.jboss_deployers_spi>
+    <version.org.jboss.as.jboss_as_server>5.0.0.CR2</version.org.jboss.as.jboss_as_server>
     <version.org.jboss.ejb3_jboss.ejb3.common>1.0.0</version.org.jboss.ejb3_jboss.ejb3.common>
+    <version.org.jboss.deployers_jboss-deployers-vfs>2.0.0.CR5</version.org.jboss.deployers_jboss-deployers-vfs>
 
   </properties>
 
@@ -42,7 +44,7 @@
       <groupId>org.jboss.metadata</groupId>
       <artifactId>jboss-metadata</artifactId>
     </dependency>
-      
+
     <dependency>
       <groupId>org.jboss.ejb3</groupId>
       <artifactId>jboss-ejb3-common</artifactId>
@@ -56,5 +58,22 @@
       <version>${version.org.jboss.deployers.jboss_deployers_spi}</version>
     </dependency>
 
-  </dependencies>
+
+  <dependency>
+      <groupId>org.jboss.jbossas</groupId>
+      <artifactId>jboss-as-server</artifactId>
+      <version>${version.org.jboss.as.jboss_as_server}</version>
+      <exclusions>
+          <!-- jboss-jpa-deployers brings in banned dependency on  org.jboss:jboss-transaction-spi, so exclude it -->
+      <exclusion>
+        <groupId>org.jboss.jpa</groupId>
+        <artifactId>jboss-jpa-deployers</artifactId>
+      </exclusion>
+    </exclusions>
+    </dependency>
+
+
+
+    </dependencies>
+
 </project>

Copied: projects/ejb3/trunk/deployers/src/main/java/org/jboss/ejb3/deployers/EjbAnnotationMetaDataDeployer.java (from rev 83889, projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/EjbAnnotationMetaDataDeployer.java)
===================================================================
--- projects/ejb3/trunk/deployers/src/main/java/org/jboss/ejb3/deployers/EjbAnnotationMetaDataDeployer.java	                        (rev 0)
+++ projects/ejb3/trunk/deployers/src/main/java/org/jboss/ejb3/deployers/EjbAnnotationMetaDataDeployer.java	2009-02-09 08:19:32 UTC (rev 83990)
@@ -0,0 +1,169 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.deployers;
+
+import java.io.IOException;
+import java.lang.reflect.AnnotatedElement;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.deployment.AnnotatedClassFilter;
+import org.jboss.metadata.annotation.creator.ejb.jboss.JBoss50Creator;
+import org.jboss.metadata.annotation.finder.AnnotationFinder;
+import org.jboss.metadata.annotation.finder.DefaultAnnotationFinder;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.ejb.spec.EjbJar3xMetaData;
+import org.jboss.metadata.ejb.spec.EjbJarMetaData;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class EjbAnnotationMetaDataDeployer extends AbstractDeployer
+{
+   public static final String EJB_ANNOTATED_ATTACHMENT_NAME = "annotated."+EjbJarMetaData.class.getName();
+
+   public EjbAnnotationMetaDataDeployer()
+   {
+      setStage(DeploymentStages.POST_CLASSLOADER);
+      addInput(EjbJarMetaData.class);
+      addOutput(EJB_ANNOTATED_ATTACHMENT_NAME);
+   }
+   
+   public void deploy(DeploymentUnit unit) throws DeploymentException
+   {
+      if (unit instanceof VFSDeploymentUnit == false)
+         return;
+      
+      VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit) unit;
+      deploy(vfsDeploymentUnit);
+   }
+   
+   protected void deploy(VFSDeploymentUnit unit) throws DeploymentException
+   {
+      boolean isComplete = false;
+      EjbJarMetaData ejbJarMetaData = unit.getAttachment(EjbJarMetaData.class);
+      if(ejbJarMetaData != null && ejbJarMetaData instanceof EjbJar3xMetaData)
+      {
+         isComplete |= ((EjbJar3xMetaData) ejbJarMetaData).isMetadataComplete();
+      }
+      
+      if(isComplete)
+      {
+         log.debug("Deployment is metadata-complete, skipping annotation processing"
+               + ", ejbJarMetaData="+ejbJarMetaData);
+         return;
+      }
+      
+      // why is this?
+      VirtualFile root = unit.getRoot();
+      boolean isLeaf = true;
+      try
+      {
+         isLeaf = root.isLeaf();
+      }
+      catch(IOException ignore)
+      {
+         // ignore
+      }
+      if(isLeaf == true)
+         return;
+
+      List<VirtualFile> classpath = unit.getClassPath();
+      if(classpath == null || classpath.isEmpty())
+         return;
+
+      boolean trace = log.isTraceEnabled();
+      if (trace)
+         log.trace("Deploying annotations for unit: " + unit + ", classpath: " + classpath);
+
+      try
+      {
+         processMetaData(unit, classpath);
+      }
+      catch (Exception e)
+      {
+         throw DeploymentException.rethrowAsDeploymentException("Cannot process metadata", e);
+      }
+   }
+   
+   /**
+    * Get the classes we want to scan.
+    *
+    * @param unit the deployment unit
+    * @param mainClassName the main class name
+    * @param classpath the classpath
+    * @return possible classes containing metadata annotations
+    * @throws IOException for any error
+    */
+   protected Collection<Class<?>> getClasses(VFSDeploymentUnit unit, List<VirtualFile> classpath) throws IOException
+   {
+      Map<VirtualFile, Class<?>> classpathClasses = new HashMap<VirtualFile, Class<?>>();
+      for(VirtualFile path : classpath)
+      {
+         AnnotatedClassFilter classVisitor = new AnnotatedClassFilter(unit, unit.getClassLoader(), path, null);
+         path.visit(classVisitor);
+         Map<VirtualFile, Class<?>> classes = classVisitor.getAnnotatedClasses();
+         if(classes != null && classes.size() > 0)
+         {
+            if(log.isTraceEnabled())
+               log.trace("Annotated classes: " + classes);
+            classpathClasses.putAll(classes);
+         }
+      }
+      return classpathClasses.values();
+   }
+
+   /**
+    * Process annotations.
+    *
+    * @param unit the deployment unit
+    * @param finder the annotation finder
+    * @param classes the candidate classes
+    */
+   protected void processJBossMetaData(VFSDeploymentUnit unit, AnnotationFinder<AnnotatedElement> finder, Collection<Class<?>> classes)
+   {
+      // Create the metadata model from the annotations
+      JBoss50Creator creator = new JBoss50Creator(finder);
+      JBossMetaData annotationMetaData = creator.create(classes);
+      if(annotationMetaData != null)
+         unit.addAttachment(EJB_ANNOTATED_ATTACHMENT_NAME, annotationMetaData, JBossMetaData.class);
+   }
+   
+   protected void processMetaData(VFSDeploymentUnit unit, List<VirtualFile> classpath) throws IOException
+   {
+      Collection<Class<?>> classes = getClasses(unit, classpath);
+      if(classes.size() > 0)
+      {
+         AnnotationFinder<AnnotatedElement> finder = new DefaultAnnotationFinder<AnnotatedElement>();
+         processJBossMetaData(unit, finder, classes);
+      }
+   }
+}

Copied: projects/ejb3/trunk/deployers/src/main/java/org/jboss/ejb3/deployers/MergedJBossMetaDataDeployer.java (from rev 83889, projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/MergedJBossMetaDataDeployer.java)
===================================================================
--- projects/ejb3/trunk/deployers/src/main/java/org/jboss/ejb3/deployers/MergedJBossMetaDataDeployer.java	                        (rev 0)
+++ projects/ejb3/trunk/deployers/src/main/java/org/jboss/ejb3/deployers/MergedJBossMetaDataDeployer.java	2009-02-09 08:19:32 UTC (rev 83990)
@@ -0,0 +1,130 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.deployers;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.metadata.ear.jboss.JBossAppMetaData;
+import org.jboss.metadata.ejb.jboss.JBoss50MetaData;
+import org.jboss.metadata.ejb.jboss.JBossAssemblyDescriptorMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.ejb.spec.EjbJarMetaData;
+import org.jboss.metadata.javaee.spec.SecurityRolesMetaData;
+
+/**
+ * A deployer that merges annotation metadata, xml metadata, and jboss metadata
+ * into a merged JBossMetaData. It also incorporates ear level overrides from
+ * the top level JBossAppMetaData attachment.
+ *
+ * @author Scott.Stark at jboss.org
+ * @author adrian at jboss.org
+ * @version $Revision$
+ */
+public class MergedJBossMetaDataDeployer extends AbstractDeployer
+{
+   public static final String EJB_MERGED_ATTACHMENT_NAME = "merged." + JBossMetaData.class.getName();
+
+   /**
+    * Create a new JBossEjbParsingDeployer.
+    */
+   public MergedJBossMetaDataDeployer()
+   {
+      setStage(DeploymentStages.POST_CLASSLOADER);
+      // ejb-jar.xml metadata
+      addInput(EjbJarMetaData.class);
+      // jboss.xml metadata
+      addInput(JBossMetaData.class);
+      // annotated metadata view
+      addInput(EjbAnnotationMetaDataDeployer.EJB_ANNOTATED_ATTACHMENT_NAME);
+      // Output is the merge JBossMetaData view
+      setOutput(JBossMetaData.class);
+      //
+      addOutput(EJB_MERGED_ATTACHMENT_NAME);
+   }
+
+   public void deploy(DeploymentUnit unit) throws DeploymentException
+   {
+      EjbJarMetaData ejbJarMetaData = unit.getAttachment(EjbJarMetaData.class);
+      JBossMetaData metaData = unit.getAttachment(JBossMetaData.class);
+      // Check for an annotated view
+      String key = EjbAnnotationMetaDataDeployer.EJB_ANNOTATED_ATTACHMENT_NAME;
+      JBossMetaData annotatedMetaData = unit.getAttachment(key, JBossMetaData.class);
+      if (ejbJarMetaData == null && metaData == null && annotatedMetaData == null)
+         return;
+
+      JBossMetaData specMetaData = new JBoss50MetaData();
+      if (ejbJarMetaData != null)
+      {
+         specMetaData.merge(null, ejbJarMetaData);
+         if (annotatedMetaData != null)
+         {
+            JBossMetaData specMerged = new JBoss50MetaData();
+            specMerged.merge(specMetaData, annotatedMetaData);
+            specMetaData = specMerged;
+         }
+      }
+      else
+         specMetaData = annotatedMetaData;
+
+      // Create a merged view
+      JBossMetaData mergedMetaData = new JBoss50MetaData();
+      mergedMetaData.merge(metaData, specMetaData);
+      // Incorporate any ear level overrides
+      DeploymentUnit topUnit = unit.getTopLevel();
+      if (topUnit != null && topUnit.getAttachment(JBossAppMetaData.class) != null)
+      {
+         JBossAppMetaData earMetaData = topUnit.getAttachment(JBossAppMetaData.class);
+         // Security domain
+         String securityDomain = earMetaData.getSecurityDomain();
+         if (securityDomain != null && mergedMetaData.getSecurityDomain() == null)
+            mergedMetaData.setSecurityDomain(securityDomain);
+         //Security Roles
+         SecurityRolesMetaData earSecurityRolesMetaData = earMetaData.getSecurityRoles();
+         if (earSecurityRolesMetaData != null)
+         {
+            JBossAssemblyDescriptorMetaData jadmd = mergedMetaData.getAssemblyDescriptor();
+            if (jadmd == null)
+            {
+               jadmd = new JBossAssemblyDescriptorMetaData();
+               mergedMetaData.setAssemblyDescriptor(jadmd);
+            }
+
+            SecurityRolesMetaData mergedSecurityRolesMetaData = jadmd.getSecurityRoles();
+            if (mergedSecurityRolesMetaData == null)
+               jadmd.setSecurityRoles(earSecurityRolesMetaData);
+
+            //perform a merge to rebuild the principalVersusRolesMap
+            if (mergedSecurityRolesMetaData != null)
+            {
+               mergedSecurityRolesMetaData.merge(mergedSecurityRolesMetaData, earSecurityRolesMetaData);
+            }
+         }
+      }
+
+      // Output the merged JBossMetaData
+      unit.getTransientManagedObjects().addAttachment(JBossMetaData.class, mergedMetaData);
+      unit.addAttachment(EJB_MERGED_ATTACHMENT_NAME, mergedMetaData, JBossMetaData.class);
+   }
+
+}

Modified: projects/ejb3/trunk/embedded/pom.xml
===================================================================
--- projects/ejb3/trunk/embedded/pom.xml	2009-02-09 08:08:07 UTC (rev 83989)
+++ projects/ejb3/trunk/embedded/pom.xml	2009-02-09 08:19:32 UTC (rev 83990)
@@ -5,7 +5,7 @@
   <parent>
     <groupId>org.jboss.ejb3</groupId>
     <artifactId>jboss-ejb3-build</artifactId>
-    <version>1.0.0-Beta9</version>
+    <version>1.0.0</version>
     <relativePath>../build/pom.xml</relativePath>
   </parent>
   <modelVersion>4.0.0</modelVersion>
@@ -22,6 +22,7 @@
   <properties>
     <version.org.jboss.deployers>[2.0.0.CR5]</version.org.jboss.deployers>
     <version.org.jboss.microcontainer>[2.0.0.GA]</version.org.jboss.microcontainer>
+    <version.org.jboss.ejb3_jboss-ejb3-deployers>1.0.1-SNAPSHOT</version.org.jboss.ejb3_jboss-ejb3-deployers>
   </properties>
 
   <build>
@@ -37,6 +38,7 @@
           <!--
           <argLine>-enableassertions</argLine>
           -->
+          
         </configuration>
       </plugin>
     </plugins>
@@ -87,7 +89,7 @@
     <dependency>
       <groupId>org.jboss.ejb3</groupId>
       <artifactId>jboss-ejb3-core</artifactId>
-      <version>1.0.0-Beta10</version>
+      <version>1.0.0</version>
       <exclusions>
         <!-- 
         <exclusion>
@@ -130,7 +132,7 @@
     <dependency>
       <groupId>org.jboss.ejb3</groupId>
       <artifactId>jboss-ejb3-deployers</artifactId>
-      <version>0.1.1</version>
+      <version>${version.org.jboss.ejb3_jboss-ejb3-deployers}</version>
     </dependency>
     <dependency>
       <groupId>org.jboss.deployers</groupId>

Deleted: projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/EjbAnnotationMetaDataDeployer.java
===================================================================
--- projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/EjbAnnotationMetaDataDeployer.java	2009-02-09 08:08:07 UTC (rev 83989)
+++ projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/EjbAnnotationMetaDataDeployer.java	2009-02-09 08:19:32 UTC (rev 83990)
@@ -1,169 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ejb3.embedded.deployers;
-
-import java.io.IOException;
-import java.lang.reflect.AnnotatedElement;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.DeploymentStages;
-import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.deployment.AnnotatedClassFilter;
-import org.jboss.metadata.annotation.creator.ejb.jboss.JBoss50Creator;
-import org.jboss.metadata.annotation.finder.AnnotationFinder;
-import org.jboss.metadata.annotation.finder.DefaultAnnotationFinder;
-import org.jboss.metadata.ejb.jboss.JBossMetaData;
-import org.jboss.metadata.ejb.spec.EjbJar3xMetaData;
-import org.jboss.metadata.ejb.spec.EjbJarMetaData;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
- * @version $Revision: $
- */
-public class EjbAnnotationMetaDataDeployer extends AbstractDeployer
-{
-   public static final String EJB_ANNOTATED_ATTACHMENT_NAME = "annotated."+EjbJarMetaData.class.getName();
-
-   public EjbAnnotationMetaDataDeployer()
-   {
-      setStage(DeploymentStages.POST_CLASSLOADER);
-      addInput(EjbJarMetaData.class);
-      addOutput(EJB_ANNOTATED_ATTACHMENT_NAME);
-   }
-   
-   public void deploy(DeploymentUnit unit) throws DeploymentException
-   {
-      if (unit instanceof VFSDeploymentUnit == false)
-         return;
-      
-      VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit) unit;
-      deploy(vfsDeploymentUnit);
-   }
-   
-   protected void deploy(VFSDeploymentUnit unit) throws DeploymentException
-   {
-      boolean isComplete = false;
-      EjbJarMetaData ejbJarMetaData = unit.getAttachment(EjbJarMetaData.class);
-      if(ejbJarMetaData != null && ejbJarMetaData instanceof EjbJar3xMetaData)
-      {
-         isComplete |= ((EjbJar3xMetaData) ejbJarMetaData).isMetadataComplete();
-      }
-      
-      if(isComplete)
-      {
-         log.debug("Deployment is metadata-complete, skipping annotation processing"
-               + ", ejbJarMetaData="+ejbJarMetaData);
-         return;
-      }
-      
-      // why is this?
-      VirtualFile root = unit.getRoot();
-      boolean isLeaf = true;
-      try
-      {
-         isLeaf = root.isLeaf();
-      }
-      catch(IOException ignore)
-      {
-         // ignore
-      }
-      if(isLeaf == true)
-         return;
-
-      List<VirtualFile> classpath = unit.getClassPath();
-      if(classpath == null || classpath.isEmpty())
-         return;
-
-      boolean trace = log.isTraceEnabled();
-      if (trace)
-         log.trace("Deploying annotations for unit: " + unit + ", classpath: " + classpath);
-
-      try
-      {
-         processMetaData(unit, classpath);
-      }
-      catch (Exception e)
-      {
-         throw DeploymentException.rethrowAsDeploymentException("Cannot process metadata", e);
-      }
-   }
-   
-   /**
-    * Get the classes we want to scan.
-    *
-    * @param unit the deployment unit
-    * @param mainClassName the main class name
-    * @param classpath the classpath
-    * @return possible classes containing metadata annotations
-    * @throws IOException for any error
-    */
-   protected Collection<Class<?>> getClasses(VFSDeploymentUnit unit, List<VirtualFile> classpath) throws IOException
-   {
-      Map<VirtualFile, Class<?>> classpathClasses = new HashMap<VirtualFile, Class<?>>();
-      for(VirtualFile path : classpath)
-      {
-         AnnotatedClassFilter classVisitor = new AnnotatedClassFilter(unit, unit.getClassLoader(), path, null);
-         path.visit(classVisitor);
-         Map<VirtualFile, Class<?>> classes = classVisitor.getAnnotatedClasses();
-         if(classes != null && classes.size() > 0)
-         {
-            if(log.isTraceEnabled())
-               log.trace("Annotated classes: " + classes);
-            classpathClasses.putAll(classes);
-         }
-      }
-      return classpathClasses.values();
-   }
-
-   /**
-    * Process annotations.
-    *
-    * @param unit the deployment unit
-    * @param finder the annotation finder
-    * @param classes the candidate classes
-    */
-   protected void processJBossMetaData(VFSDeploymentUnit unit, AnnotationFinder<AnnotatedElement> finder, Collection<Class<?>> classes)
-   {
-      // Create the metadata model from the annotations
-      JBoss50Creator creator = new JBoss50Creator(finder);
-      JBossMetaData annotationMetaData = creator.create(classes);
-      if(annotationMetaData != null)
-         unit.addAttachment(EJB_ANNOTATED_ATTACHMENT_NAME, annotationMetaData, JBossMetaData.class);
-   }
-   
-   protected void processMetaData(VFSDeploymentUnit unit, List<VirtualFile> classpath) throws IOException
-   {
-      Collection<Class<?>> classes = getClasses(unit, classpath);
-      if(classes.size() > 0)
-      {
-         AnnotationFinder<AnnotatedElement> finder = new DefaultAnnotationFinder<AnnotatedElement>();
-         processJBossMetaData(unit, finder, classes);
-      }
-   }
-}

Modified: projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/EjbMetadataJndiPolicyDecoratorDeployer.java
===================================================================
--- projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/EjbMetadataJndiPolicyDecoratorDeployer.java	2009-02-09 08:08:07 UTC (rev 83989)
+++ projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/EjbMetadataJndiPolicyDecoratorDeployer.java	2009-02-09 08:19:32 UTC (rev 83990)
@@ -28,6 +28,7 @@
 import org.jboss.deployers.spi.deployer.DeploymentStages;
 import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.ejb3.deployers.MergedJBossMetaDataDeployer;
 import org.jboss.logging.Logger;
 import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
 import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeansMetaData;
@@ -41,7 +42,7 @@
 
 /**
  * EjbMetadataJndiPolicyDecoratorDeployer
- * 
+ *
  * Decorates merged EJB Metadata with the ability to resolve
  * JNDI targets as dictated by an optionally-specified
  * DefaultJndiBindingPolicy
@@ -185,9 +186,9 @@
     * Obtains the JNDI Binding Policy instance to use for the specified metadata,
     * defaulting to a BasicJndiBindingPolicy if none is explicitly specified either in
     * the metadata itself or in its parent deployable unit
-    * 
+    *
     * @param md The Bean Metadata
-    * @param deployableUnitDefaultJndiPolicyClassName The (optional) JNDI Policy declared 
+    * @param deployableUnitDefaultJndiPolicyClassName The (optional) JNDI Policy declared
     *       by the deployable unit (JBossMetaData)
     * @param cl The Deployable Unit's ClassLoader
     */

Deleted: projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/MergedJBossMetaDataDeployer.java
===================================================================
--- projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/MergedJBossMetaDataDeployer.java	2009-02-09 08:08:07 UTC (rev 83989)
+++ projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/MergedJBossMetaDataDeployer.java	2009-02-09 08:19:32 UTC (rev 83990)
@@ -1,132 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ejb3.embedded.deployers;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.DeploymentStages;
-import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.metadata.ear.jboss.JBossAppMetaData;
-import org.jboss.metadata.ejb.jboss.JBoss50MetaData;
-import org.jboss.metadata.ejb.jboss.JBossAssemblyDescriptorMetaData;
-import org.jboss.metadata.ejb.jboss.JBossMetaData;
-import org.jboss.metadata.ejb.spec.EjbJarMetaData;
-import org.jboss.metadata.javaee.spec.SecurityRolesMetaData;
-
-/**
- * A deployer that merges annotation metadata, xml metadata, and jboss metadata
- * into a merged JBossMetaData. It also incorporates ear level overrides from
- * the top level JBossAppMetaData attachment.
- * 
- * @author Scott.Stark at jboss.org
- * @author adrian at jboss.org
- * @version $Revision$
- */
-public class MergedJBossMetaDataDeployer extends AbstractDeployer
-{
-   public static final String EJB_MERGED_ATTACHMENT_NAME = "merged."+JBossMetaData.class.getName();
-
-   /**
-    * Create a new JBossEjbParsingDeployer.
-    */
-   public MergedJBossMetaDataDeployer()
-   {
-      setStage(DeploymentStages.POST_CLASSLOADER);
-      // ejb-jar.xml metadata
-      addInput(EjbJarMetaData.class);
-      // jboss.xml metadata
-      addInput(JBossMetaData.class);
-      // annotated metadata view
-      addInput(EjbAnnotationMetaDataDeployer.EJB_ANNOTATED_ATTACHMENT_NAME);
-      // Output is the merge JBossMetaData view
-      setOutput(JBossMetaData.class);
-      // 
-      addOutput(EJB_MERGED_ATTACHMENT_NAME);
-   }
-
-   public void deploy(DeploymentUnit unit) throws DeploymentException
-   {
-      EjbJarMetaData ejbJarMetaData = unit.getAttachment(EjbJarMetaData.class);
-      JBossMetaData metaData = unit.getAttachment(JBossMetaData.class);
-      // Check for an annotated view
-      String key = EjbAnnotationMetaDataDeployer.EJB_ANNOTATED_ATTACHMENT_NAME;
-      JBossMetaData annotatedMetaData = unit.getAttachment(key, JBossMetaData.class);
-      if(ejbJarMetaData == null && metaData == null && annotatedMetaData == null)
-         return;
-
-      JBossMetaData specMetaData = new JBoss50MetaData();
-      if(ejbJarMetaData != null)
-      {
-         specMetaData.merge(null, ejbJarMetaData);
-         if(annotatedMetaData != null)
-         {
-            JBossMetaData specMerged = new JBoss50MetaData();
-            specMerged.merge(specMetaData, annotatedMetaData);
-            specMetaData = specMerged;
-         }
-      }
-      else
-         specMetaData = annotatedMetaData;
-
-      
-      // Create a merged view
-      JBossMetaData mergedMetaData = new JBoss50MetaData();
-      mergedMetaData.merge(metaData, specMetaData);
-      // Incorporate any ear level overrides
-      DeploymentUnit topUnit = unit.getTopLevel();
-      if(topUnit != null && topUnit.getAttachment(JBossAppMetaData.class) != null)
-      {
-         JBossAppMetaData earMetaData = topUnit.getAttachment(JBossAppMetaData.class);
-         // Security domain
-         String securityDomain = earMetaData.getSecurityDomain();
-         if(securityDomain != null && mergedMetaData.getSecurityDomain() == null)
-            mergedMetaData.setSecurityDomain(securityDomain);
-         //Security Roles
-         SecurityRolesMetaData earSecurityRolesMetaData = earMetaData.getSecurityRoles();
-         if(earSecurityRolesMetaData != null)
-         {
-            JBossAssemblyDescriptorMetaData jadmd = mergedMetaData.getAssemblyDescriptor();
-            if( jadmd == null)
-            {
-               jadmd = new JBossAssemblyDescriptorMetaData();
-               mergedMetaData.setAssemblyDescriptor(jadmd); 
-            }
-            
-            SecurityRolesMetaData mergedSecurityRolesMetaData = jadmd.getSecurityRoles(); 
-            if(mergedSecurityRolesMetaData == null)
-               jadmd.setSecurityRoles(earSecurityRolesMetaData);
-            
-            //perform a merge to rebuild the principalVersusRolesMap
-            if(mergedSecurityRolesMetaData != null )
-            {
-                mergedSecurityRolesMetaData.merge(mergedSecurityRolesMetaData, 
-                     earSecurityRolesMetaData);
-            }
-        }
-      }
-
-      // Output the merged JBossMetaData
-      unit.getTransientManagedObjects().addAttachment(JBossMetaData.class, mergedMetaData);
-      unit.addAttachment(EJB_MERGED_ATTACHMENT_NAME, mergedMetaData, JBossMetaData.class);
-   }
-
-}

Modified: projects/ejb3/trunk/embedded/src/main/resources/META-INF/ejb-deployers-beans.xml
===================================================================
--- projects/ejb3/trunk/embedded/src/main/resources/META-INF/ejb-deployers-beans.xml	2009-02-09 08:08:07 UTC (rev 83989)
+++ projects/ejb3/trunk/embedded/src/main/resources/META-INF/ejb-deployers-beans.xml	2009-02-09 08:19:32 UTC (rev 83990)
@@ -19,29 +19,44 @@
          </map>
       </property>
    </bean>
-   
-   <bean name="EjbParsingDeployer" class="org.jboss.ejb3.embedded.deployers.EjbParsingDeployer">
+
+   <!--  Deployer which parses the ejb-jar.xml -->
+   <bean name="EjbParsingDeployer" class="org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer">
+
+      <constructor>
+      	<parameter class="java.lang.Class">org.jboss.metadata.ejb.spec.EjbJarMetaData</parameter>
+      </constructor>
+      <property name="name">ejb-jar.xml</property>
       <!-- We need to be fast, so no schema validation -->
       <property name="useSchemaValidation">false</property>
    </bean>
-   <bean name="JBossEjbParsingDeployer" class="org.jboss.ejb3.embedded.deployers.JBossEjbParsingDeployer">
+
+   <!-- Deployer which parses jboss.xml -->
+   <bean name="JBossEjbParsingDeployer" class="org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer">
+
+      <constructor>
+      	<parameter class="java.lang.Class">org.jboss.metadata.ejb.jboss.JBossMetaData</parameter>
+      </constructor>
+      <property name="name">jboss.xml</property>
       <!-- We need to be fast, so no schema validation -->
       <property name="useSchemaValidation">false</property>
    </bean>
-   <bean name="EjbAnnotationMetaDataDeployer" class="org.jboss.ejb3.embedded.deployers.EjbAnnotationMetaDataDeployer"/>
-   
-   <bean name="MergedJBossMetaDataDeployer" class="org.jboss.ejb3.embedded.deployers.MergedJBossMetaDataDeployer"/>
-   
-   <bean name="EjbMetadataJndiPolicyDecoratorDeployer" class="org.jboss.ejb3.embedded.deployers.EjbMetadataJndiPolicyDecoratorDeployer"/>
-   
+
+
+   <bean name="EjbAnnotationMetaDataDeployer" class="org.jboss.ejb3.deployers.EjbAnnotationMetaDataDeployer"/>
+
+   <bean name="MergedJBossMetaDataDeployer" class="org.jboss.ejb3.deployers.MergedJBossMetaDataDeployer"/>
+
+   <bean name="EjbMetadataJndiPolicyDecoratorDeployer" class="org.jboss.ejb3.deployers.EjbMetadataJndiPolicyDecoratorDeployer"/>
+
    <!-- EJB3 ProcessorChain Deployer -->
    <bean name="Ejb3MetadataProcessingDeployer" class="org.jboss.ejb3.deployers.Ejb3MetadataProcessingDeployer" />
-   
+
    <bean name="EjbModuleDeployer" class="org.jboss.ejb3.embedded.deployers.EjbModuleDeployer"/>
    <bean name="EjbComponentDeployer" class="org.jboss.ejb3.embedded.deployers.EjbComponentDeployer"/>
 
    <bean name="MessageDestinationReferenceResolver" class="org.jboss.ejb3.embedded.resolvers.EmbeddedMessageDestinationReferenceResolver"/>
-   
+
    <!-- EJB3 Cache Factory Registry -->
    <bean name="EJB3CacheFactoryRegistry" class="org.jboss.ejb3.cache.CacheFactoryRegistry">
       <property name="factories">
@@ -66,7 +81,7 @@
          </map>
       </property>
    </bean>
-   
+
    <!-- EJB3 Persistence Manager Factory Registry -->
    <bean name="EJB3PersistenceManagerFactoryRegistry" class="org.jboss.ejb3.cache.persistence.PersistenceManagerFactoryRegistry">
       <property name="factories">
@@ -81,7 +96,7 @@
          </map>
       </property>
    </bean>
-   
+
    <!-- EJB3 Pool Factory Registry -->
    <bean name="EJB3PoolFactoryRegistry" class="org.jboss.ejb3.pool.PoolFactoryRegistry">
       <property name="factories">
@@ -101,7 +116,7 @@
          </map>
       </property>
    </bean>
-   
+
    <!-- SFSB JNDI Registrar -->
    <bean name="org.jboss.ejb3.JndiRegistrar.Session.SFSBJndiRegistrar"
       class="org.jboss.ejb3.proxy.jndiregistrar.JndiStatefulSessionRegistrar">

Modified: projects/ejb3/trunk/embedded/src/main/resources/META-INF/jpa-deployers-beans.xml
===================================================================
--- projects/ejb3/trunk/embedded/src/main/resources/META-INF/jpa-deployers-beans.xml	2009-02-09 08:08:07 UTC (rev 83989)
+++ projects/ejb3/trunk/embedded/src/main/resources/META-INF/jpa-deployers-beans.xml	2009-02-09 08:19:32 UTC (rev 83990)
@@ -4,6 +4,9 @@
    
    <bean name="JavaEEModuleInformer" class="org.jboss.ejb3.embedded.javaee.SimpleJavaEEModuleInformer"/>
    
+   <bean name="SpecCompliantSearchStrategy" class="org.jboss.jpa.resolvers.strategy.SpecCompliantSearchStrategy"/>
+   
+   <!-- DefaultPersistenceUnitDependencyResolver for spec compliant resolving. Uses SpecCompliantSearchStrategy-->
    <bean name="PersistenceUnitDependencyResolver" class="org.jboss.jpa.resolvers.DefaultPersistenceUnitDependencyResolver"/>
    
    <bean name="PersistenceParsingDeployer" class="org.jboss.jpa.deployers.PersistenceParsingDeployer"/>




More information about the jboss-cvs-commits mailing list