[jboss-cvs] JBossAS SVN: r79555 - in projects/metadata/trunk: .settings and 3 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Oct 15 17:06:07 EDT 2008


Author: ALRubinger
Date: 2008-10-15 17:06:06 -0400 (Wed, 15 Oct 2008)
New Revision: 79555

Removed:
   projects/metadata/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/ImplicitLocalProcessor.java
Modified:
   projects/metadata/trunk/.classpath
   projects/metadata/trunk/.project
   projects/metadata/trunk/.settings/org.eclipse.jdt.core.prefs
   projects/metadata/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/AbstractSessionBeanProcessor.java
   projects/metadata/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/JBoss50Creator.java
   projects/metadata/trunk/src/main/java/org/jboss/metadata/process/processor/ejb/jboss/SetDefaultLocalBusinessInterfaceProcessor.java
   projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/MyBean.java
Log:
[JBMETA-122] Move the addition of an implicit local business interface to processing on fully-merged view

Modified: projects/metadata/trunk/.classpath
===================================================================
--- projects/metadata/trunk/.classpath	2008-10-15 21:05:15 UTC (rev 79554)
+++ projects/metadata/trunk/.classpath	2008-10-15 21:06:06 UTC (rev 79555)
@@ -1,37 +1,9 @@
-<?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry kind="src" path="src/main/java"/>
-	<classpathentry excluding="**/*.java" kind="src" path="src/main/resources"/>
-	<classpathentry kind="src" path="src/test/java"/>
-	<classpathentry excluding="**/*.java" kind="src" path="src/test/resources"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-	<classpathentry kind="var" path="M2_REPO/javax/activation/activation/1.1/activation-1.1.jar" sourcepath="M2_REPO/javax/activation/activation/1.1/activation-1.1-sources.jar"/>
-	<classpathentry kind="var" path="M2_REPO/org/apache/ant/ant/1.7.0/ant-1.7.0.jar"/>
-	<classpathentry kind="var" path="M2_REPO/org/apache/ant/ant-junit/1.7.0/ant-junit-1.7.0.jar"/>
-	<classpathentry kind="var" path="M2_REPO/org/apache/ant/ant-launcher/1.7.0/ant-launcher-1.7.0.jar"/>
-	<classpathentry kind="var" path="M2_REPO/wutka-dtdparser/dtdparser121/1.2.1/dtdparser121-1.2.1.jar"/>
-	<classpathentry kind="var" path="M2_REPO/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1.jar" sourcepath="M2_REPO/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1-sources.jar"/>
-	<classpathentry kind="var" path="M2_REPO/org/jboss/jboss-common-core/2.2.5.GA/jboss-common-core-2.2.5.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-common-core/2.2.5.GA/jboss-common-core-2.2.5.GA-sources.jar"/>
-	<classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-ejb-api/3.0.0.CR1/jboss-ejb-api-3.0.0.CR1.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-ejb-api/3.0.0.CR1/jboss-ejb-api-3.0.0.CR1-sources.jar"/>
-	<classpathentry kind="var" path="M2_REPO/org/jboss/ejb3/jboss-ejb3-ext-api/0.4/jboss-ejb3-ext-api-0.4.jar" sourcepath="M2_REPO/org/jboss/ejb3/jboss-ejb3-ext-api/0.3/jboss-ejb3-ext-api-0.3-sources.jar"/>
-	<classpathentry kind="var" path="M2_REPO/jboss/jbossws/jboss-jaxrpc/1.0.4.GA/jboss-jaxrpc-1.0.4.GA.jar"/>
-	<classpathentry kind="var" path="M2_REPO/org/jboss/jboss-jaxws/2.0.1.GA/jboss-jaxws-2.0.1.GA.jar"/>
-	<classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-jms-api/1.1.0.CR1/jboss-jms-api-1.1.0.CR1.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-jms-api/1.1.0.CR1/jboss-jms-api-1.1.0.CR1-sources.jar"/>
-	<classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging-log4j/2.0.5.GA/jboss-logging-log4j-2.0.5.GA.jar" sourcepath="M2_REPO/org/jboss/logging/jboss-logging-log4j/2.0.5.GA/jboss-logging-log4j-2.0.5.GA-sources.jar"/>
-	<classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA.jar" sourcepath="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA-sources.jar"/>
-	<classpathentry kind="var" path="M2_REPO/org/jboss/jboss-mdr/2.0.0.Beta15/jboss-mdr-2.0.0.Beta15.jar" sourcepath="M2_REPO/org/jboss/jboss-mdr/2.0.0.Beta15/jboss-mdr-2.0.0.Beta15-sources.jar"/>
-	<classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-persistence-api/3.0.0.CR1/jboss-persistence-api-3.0.0.CR1.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-persistence-api/3.0.0.CR1/jboss-persistence-api-3.0.0.CR1-sources.jar"/>
-	<classpathentry kind="var" path="M2_REPO/jboss/profiler/jvmti/jboss-profiler-jvmti/1.0.0.CR5/jboss-profiler-jvmti-1.0.0.CR5.jar"/>
-	<classpathentry kind="var" path="M2_REPO/org/jboss/jboss-reflect/2.0.0.Beta12/jboss-reflect-2.0.0.Beta12.jar" sourcepath="M2_REPO/org/jboss/jboss-reflect/2.0.0.Beta12/jboss-reflect-2.0.0.Beta12-sources.jar"/>
-	<classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-server-manager/0.1.0.GA/jboss-server-manager-0.1.0.GA.jar" sourcepath="M2_REPO/org/jboss/jbossas/jboss-server-manager/0.1.0.GA/jboss-server-manager-0.1.0.GA-sources.jar"/>
-	<classpathentry kind="var" path="M2_REPO/org/jboss/test/jboss-test/1.1.0.GA/jboss-test-1.1.0.GA.jar" sourcepath="M2_REPO/org/jboss/test/jboss-test/1.1.0.GA/jboss-test-1.1.0.GA-sources.jar"/>
-	<classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-transaction-api/1.0.1.CR1/jboss-transaction-api-1.0.1.CR1.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-transaction-api/1.0.1.CR1/jboss-transaction-api-1.0.1.CR1-sources.jar"/>
-	<classpathentry kind="var" path="M2_REPO/org/jboss/jboss-vfs/2.0.0.Beta11/jboss-vfs-2.0.0.Beta11.jar" sourcepath="M2_REPO/org/jboss/jboss-vfs/2.0.0.Beta11/jboss-vfs-2.0.0.Beta11-sources.jar"/>
-	<classpathentry kind="var" path="M2_REPO/org/jboss/ws/jbossws-spi/1.0.2.GA/jbossws-spi-1.0.2.GA.jar"/>
-	<classpathentry kind="var" path="M2_REPO/org/jboss/jbossxb/2.0.0.CR12/jbossxb-2.0.0.CR12.jar" sourcepath="M2_REPO/org/jboss/jbossxb/2.0.0.CR12/jbossxb-2.0.0.CR12-sources.jar"/>
-	<classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar" sourcepath="M2_REPO/junit/junit/3.8.1/junit-3.8.1-sources.jar"/>
-	<classpathentry kind="var" path="M2_REPO/apache-log4j/log4j/1.2.14/log4j-1.2.14.jar" sourcepath="M2_REPO/apache-log4j/log4j/1.2.14/log4j-1.2.14-sources.jar"/>
-	<classpathentry kind="var" path="M2_REPO/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.jar" sourcepath="M2_REPO/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2-sources.jar"/>
-	<classpathentry kind="var" path="M2_REPO/apache-xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar"/>
-	<classpathentry kind="output" path="target/eclipse-classes"/>
-</classpath>
+  <classpathentry kind="src" path="src/main/java"/>
+  <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
+  <classpathentry kind="src" path="src/test/java" output="target/test-classes"/>
+  <classpathentry kind="src" path="src/test/resources" output="target/test-classes" excluding="**/*.java"/>
+  <classpathentry kind="output" path="target/classes"/>
+  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+  <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+</classpath>
\ No newline at end of file

Modified: projects/metadata/trunk/.project
===================================================================
--- projects/metadata/trunk/.project	2008-10-15 21:05:15 UTC (rev 79554)
+++ projects/metadata/trunk/.project	2008-10-15 21:06:06 UTC (rev 79555)
@@ -6,8 +6,12 @@
     <buildCommand>
       <name>org.eclipse.jdt.core.javabuilder</name>
     </buildCommand>
+    <buildCommand>
+      <name>org.maven.ide.eclipse.maven2Builder</name>
+    </buildCommand>
   </buildSpec>
   <natures>
     <nature>org.eclipse.jdt.core.javanature</nature>
+    <nature>org.maven.ide.eclipse.maven2Nature</nature>
   </natures>
 </projectDescription>
\ No newline at end of file

Modified: projects/metadata/trunk/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/metadata/trunk/.settings/org.eclipse.jdt.core.prefs	2008-10-15 21:05:15 UTC (rev 79554)
+++ projects/metadata/trunk/.settings/org.eclipse.jdt.core.prefs	2008-10-15 21:06:06 UTC (rev 79555)
@@ -1,4 +1,4 @@
-#Sun May 18 02:01:03 EDT 2008
+#Wed Oct 15 02:04:52 GMT-05:00 2008
 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
 eclipse.preferences.version=1
 org.eclipse.jdt.core.compiler.source=1.5

Modified: projects/metadata/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/AbstractSessionBeanProcessor.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/AbstractSessionBeanProcessor.java	2008-10-15 21:05:15 UTC (rev 79554)
+++ projects/metadata/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/AbstractSessionBeanProcessor.java	2008-10-15 21:06:06 UTC (rev 79555)
@@ -55,7 +55,6 @@
       addTypeProcessor(new LocalHomeProcessor(finder));
       addTypeProcessor(new RemoteProcessor(finder));
       addTypeProcessor(new RemoteHomeProcessor(finder));
-      addTypeProcessor(new ImplicitLocalProcessor(finder));
       addTypeProcessor(new LocalBindingProcessor(finder));
       addTypeProcessor(new LocalHomeBindingProcessor(finder));
       addTypeProcessor(new RemoteBindingProcessor(finder));

Deleted: projects/metadata/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/ImplicitLocalProcessor.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/ImplicitLocalProcessor.java	2008-10-15 21:05:15 UTC (rev 79554)
+++ projects/metadata/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/ImplicitLocalProcessor.java	2008-10-15 21:06:06 UTC (rev 79555)
@@ -1,95 +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.metadata.annotation.creator.ejb.jboss;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.AnnotatedElement;
-import java.util.Collection;
-import java.util.Collections;
-
-import javax.ejb.EJBLocalObject;
-import javax.ejb.Remote;
-
-import org.jboss.metadata.annotation.creator.AbstractFinderUser;
-import org.jboss.metadata.annotation.creator.Processor;
-import org.jboss.metadata.annotation.finder.AnnotationFinder;
-import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
-import org.jboss.metadata.ejb.spec.BusinessLocalsMetaData;
-import org.jboss.metadata.lang.ClassHelper;
-
-/**
- * Process the implicit local business interface (4.6.6)
- * 
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class ImplicitLocalProcessor extends AbstractFinderUser implements Processor<JBossSessionBeanMetaData, Class<?>>
-{
-
-   public ImplicitLocalProcessor(AnnotationFinder<AnnotatedElement> finder)
-   {
-      super(finder);
-   }
-
-   public void process(JBossSessionBeanMetaData metaData, Class<?> type)
-   {
-      
-      // If there are already local business interfaces specified
-      if(metaData.getBusinessLocals() != null && metaData.getBusinessLocals().size() > 0)
-         return;
-      
-      // If there are already remote business interfaces specified
-      if(metaData.getBusinessRemotes() != null && metaData.getBusinessRemotes().size() > 0)
-         return;
-      
-      // Don't check super class
-      if(metaData.getEjbName() != null && !metaData.getEjbClass().equals(type.getName()))
-         return;
-      
-      // Get the a single interface
-      Class<?> businessInterface = ClassHelper.extractInterface(type.getInterfaces());
-      if(businessInterface == null)
-         return;
-      
-      // Check if the interface is a remote one      
-      Remote remote = finder.getAnnotation(businessInterface, Remote.class);
-      if(remote != null)
-         return;
-      
-      // A business interface must not extend EJBLocalObject
-      if(EJBLocalObject.class.isAssignableFrom(businessInterface))
-         throw new IllegalStateException("EJB 3.0 Core Specification Violation (4.6.6): The session bean’s business interface "+ businessInterface + " must not extend the javax.ejb.EJBLocalObject interface.");
-      
-      // Add this businessInterface as the local business interface
-      if(metaData.getBusinessLocals() == null)
-         metaData.setBusinessLocals(new BusinessLocalsMetaData());
-      
-      // Finally add local business interface
-      metaData.getBusinessLocals().add(businessInterface.getName());
-   }
-   
-   public Collection<Class<? extends Annotation>> getAnnotationTypes()
-   {
-      // does not process any annotation
-      return Collections.EMPTY_SET;
-   }
-}
\ No newline at end of file

Modified: projects/metadata/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/JBoss50Creator.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/JBoss50Creator.java	2008-10-15 21:05:15 UTC (rev 79554)
+++ projects/metadata/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/JBoss50Creator.java	2008-10-15 21:06:06 UTC (rev 79555)
@@ -42,7 +42,7 @@
 import org.jboss.metadata.process.chain.ProcessorChain;
 import org.jboss.metadata.process.chain.ejb.jboss.JBossMetaDataProcessorChain;
 import org.jboss.metadata.process.processor.ejb.jboss.JBoss50MetaDataValidatorChainProcessor;
-import org.jboss.metadata.validation.chain.ejb.jboss.JBoss50MetaDataValidatorChain;
+import org.jboss.metadata.process.processor.ejb.jboss.SetDefaultLocalBusinessInterfaceProcessor;
 
 /**
  * A JBoss50Creator.
@@ -52,15 +52,16 @@
  * @version $Revision: 1.1 $
  */
 public class JBoss50Creator extends AbstractCreator<JBossMetaData>
-   implements Creator<Collection<Class<?>>, JBoss50MetaData>
+      implements
+         Creator<Collection<Class<?>>, JBoss50MetaData>
 {
-   
+
    /** The ejbJar3xMetaData */
    private EjbJarMetaData ejbJarMetaData;
-   
+
    /** The deploymentUnit classLoader */
    private ClassLoader classLoader;
-   
+
    /**
     * Create a new JBoss50Creator.
     * 
@@ -77,7 +78,7 @@
       addProcessor(new MessageDrivenProcessor(finder));
       addProcessor(new ApplicationExceptionProcessor(finder));
    }
-   
+
    public JBoss50Creator(EjbJarMetaData metaData, ClassLoader classLoader, AnnotationFinder<AnnotatedElement> finder)
    {
       this(finder);
@@ -93,40 +94,38 @@
    public JBoss50MetaData create(Collection<Class<?>> classes)
    {
       // Don't create meta data for a empty collection
-      if((classes == null
-            || classes.isEmpty())
-            && (ejbJarMetaData == null
-                  || ejbJarMetaData.getEnterpriseBeans() == null
-                  || ejbJarMetaData.getEnterpriseBeans().isEmpty()))
+      if ((classes == null || classes.isEmpty())
+            && (ejbJarMetaData == null || ejbJarMetaData.getEnterpriseBeans() == null || ejbJarMetaData
+                  .getEnterpriseBeans().isEmpty()))
          return null;
 
-      
       // Create meta data
       JBoss50MetaData metaData = create();
 
       // Process classes specified in the xml without top-level annotations
       processClassesWithoutTopLevelAnnotations(metaData, classes);
-      
+
       // Process annotations
       processMetaData(classes, metaData);
-      
+
       /*
        * Run a ProcessorChain on the merged metadata
        */
-      
+
       // Make the chain
       ProcessorChain<JBoss50MetaData> chain = new JBossMetaDataProcessorChain<JBoss50MetaData>();
 
-      
+      // Implicit local business interface (JBMETA-40, JBMETA-122, EJBTHREE-1062)
+      chain.addProcessor(SetDefaultLocalBusinessInterfaceProcessor.INSTANCE);
       // Validation Processor
       chain.addProcessor(JBoss50MetaDataValidatorChainProcessor.INSTANCE);
-      
+
       // Process the chain
       metaData = chain.process(metaData);
 
       return metaData;
    }
-   
+
    protected JBoss50MetaData create()
    {
       JBoss50MetaData metaData = new JBoss50MetaData();
@@ -134,7 +133,7 @@
       metaData.setEjbVersion("3.0");
       return metaData;
    }
-   
+
    /**
     * Process classes which are defined in the xml and don't have a top-level annotation.
     * TODO - this should not really be handled here.
@@ -144,8 +143,10 @@
     */
    private void processClassesWithoutTopLevelAnnotations(JBossMetaData metaData, Collection<Class<?>> classes)
    {
-      if (ejbJarMetaData == null || classLoader == null)return;
-      if (ejbJarMetaData.getEnterpriseBeans() == null) return;
+      if (ejbJarMetaData == null || classLoader == null)
+         return;
+      if (ejbJarMetaData.getEnterpriseBeans() == null)
+         return;
       for (EnterpriseBeanMetaData bean : ejbJarMetaData.getEnterpriseBeans())
       {
          if (bean.getEjbName() == null || bean.getEjbClass() == null)
@@ -196,7 +197,7 @@
 
       }
    }
-   
+
    /**
     * Validate a class for this deployment
     * 
@@ -207,7 +208,7 @@
       // The AnnotationDeployer picks up only classes based on the AnnotationContext, therefore no further validation
       return true;
    }
-   
+
    /**
     * Get the annotation context. This overrides the inherited method,
     * as we just need the Type annotations. e.g. @Stateful, @Stateless, @Service
@@ -223,24 +224,32 @@
          {
             return getAnnotationsForScope(Scope.TYPE);
          }
-         
-         public Collection<Class<? extends Annotation>> getFieldAnnotations() { return Collections.EMPTY_SET; }
 
-         public Collection<Class<? extends Annotation>> getMethodAnnotations() { return Collections.EMPTY_SET; }
-         
+         public Collection<Class<? extends Annotation>> getFieldAnnotations()
+         {
+            return Collections.EMPTY_SET;
+         }
+
+         public Collection<Class<? extends Annotation>> getMethodAnnotations()
+         {
+            return Collections.EMPTY_SET;
+         }
+
       };
    }
-   
+
    private boolean containsClass(Collection<Class<?>> classes, String className)
    {
-      if(className == null)
-        throw new IllegalArgumentException("null class name.");
-      
-      if(classes == null || classes.isEmpty()) return false;
-      
-      for(Class<?> clazz : classes)
-         if(clazz.getName().equals(className)) return true;
-      
+      if (className == null)
+         throw new IllegalArgumentException("null class name.");
+
+      if (classes == null || classes.isEmpty())
+         return false;
+
+      for (Class<?> clazz : classes)
+         if (clazz.getName().equals(className))
+            return true;
+
       return false;
    }
 }

Modified: projects/metadata/trunk/src/main/java/org/jboss/metadata/process/processor/ejb/jboss/SetDefaultLocalBusinessInterfaceProcessor.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/process/processor/ejb/jboss/SetDefaultLocalBusinessInterfaceProcessor.java	2008-10-15 21:05:15 UTC (rev 79554)
+++ projects/metadata/trunk/src/main/java/org/jboss/metadata/process/processor/ejb/jboss/SetDefaultLocalBusinessInterfaceProcessor.java	2008-10-15 21:06:06 UTC (rev 79555)
@@ -21,8 +21,15 @@
  */
 package org.jboss.metadata.process.processor.ejb.jboss;
 
+import javax.ejb.EJBLocalObject;
+
 import org.jboss.logging.Logger;
 import org.jboss.metadata.ejb.jboss.JBoss50MetaData;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeansMetaData;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+import org.jboss.metadata.ejb.spec.BusinessLocalsMetaData;
+import org.jboss.metadata.lang.ClassHelper;
 import org.jboss.metadata.process.ProcessingException;
 import org.jboss.metadata.process.processor.JBossMetaDataProcessor;
 
@@ -61,8 +68,71 @@
       // Sanity check
       assert metadata != null : "Specified metadata was null";
 
-      //TODO
+      // Get EJBs
+      JBossEnterpriseBeansMetaData ejbs = metadata.getEnterpriseBeans();
 
+      // For each EJB
+      for (JBossEnterpriseBeanMetaData ejb : ejbs)
+      {
+
+         // Only applies to Session beans
+         if (!ejb.isSession())
+         {
+            continue;
+         }
+
+         // Cast
+         JBossSessionBeanMetaData smd = (JBossSessionBeanMetaData) ejb;
+
+         /*
+          * Maintainer's note:
+          * 
+          * This processing check must be executed within the TCL
+          * for the deployment it's checking.  ie. The classes 
+          * specified in the metadata must be visible to the TCL
+          */
+
+         // Load the EJB Implementation Class
+         String ejbImplementationClassName = smd.getEjbClass();
+         ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+         Class<?> ejbImplementationClass = null;
+         try
+         {
+            ejbImplementationClass = Class.forName(ejbImplementationClassName, false, tcl);
+         }
+         catch (ClassNotFoundException e)
+         {
+            throw new ProcessingException(this
+                  + " must be run on metadata while the deployment's ClassLoader is the Thread Context ClassLoader");
+         }
+
+         // If there are already local business interfaces specified
+         if (smd.getBusinessLocals() != null && smd.getBusinessLocals().size() > 0)
+            continue;
+
+         // If there are already remote business interfaces specified
+         if (smd.getBusinessRemotes() != null && smd.getBusinessRemotes().size() > 0)
+            continue;
+
+         // Get the a single interface
+         Class<?> businessInterface = ClassHelper.extractInterface(ejbImplementationClass.getInterfaces());
+         if (businessInterface == null)
+            continue;
+
+         // A business interface must not extend EJBLocalObject
+         if (EJBLocalObject.class.isAssignableFrom(businessInterface))
+            throw new IllegalStateException(
+                  "EJB 3.0 Core Specification Violation (4.6.6): The session bean’s business interface "
+                        + businessInterface + " must not extend the javax.ejb.EJBLocalObject interface.");
+
+         // Add this businessInterface as the local business interface
+         if (smd.getBusinessLocals() == null)
+            smd.setBusinessLocals(new BusinessLocalsMetaData());
+
+         // Finally add local business interface
+         smd.getBusinessLocals().add(businessInterface.getName());
+      }
+
       // Return
       return metadata;
 

Modified: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/MyBean.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/MyBean.java	2008-10-15 21:05:15 UTC (rev 79554)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/MyBean.java	2008-10-15 21:06:06 UTC (rev 79555)
@@ -23,7 +23,6 @@
 
 import java.io.Serializable;
 
-import javax.ejb.Remote;
 import javax.ejb.Stateless;
 
 /**




More information about the jboss-cvs-commits mailing list