[jboss-cvs] JBossAS SVN: r97561 - in projects/metadata/ejb/trunk/src: main/java/org/jboss/metadata/annotation/creator/ejb/jboss and 8 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Dec 8 15:09:07 EST 2009


Author: jaikiran
Date: 2009-12-08 15:09:06 -0500 (Tue, 08 Dec 2009)
New Revision: 97561

Added:
   projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/LocalBeanProcessor.java
   projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/LocalBeanProcessor.java
   projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/process/processor/ejb/jboss/ImplicitNoInterfaceBeanProcessor.java
   projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/localbean/
   projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/localbean/BeanExplicitlyMarkedAsLocalBean.java
   projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/localbean/BeanMarkedAsLocalBeanInEJBJarXml.java
   projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/localbean/DoNothingNoInterfaceBean.java
   projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/localbean/NoOp.java
   projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/localbean/NotANoInterfaceBean.java
   projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/localbean/unit/
   projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/localbean/unit/LocalBeanTestCase.java
   projects/metadata/ejb/trunk/src/test/resources/org/jboss/metadata/ejb/test/localbean/
   projects/metadata/ejb/trunk/src/test/resources/org/jboss/metadata/ejb/test/localbean/ejb-jar-localbean.xml
Modified:
   projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/AbstractSessionBeanProcessor.java
   projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/AbstractSessionBeanProcessor.java
   projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/jboss/JBossSessionBean31MetaData.java
   projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/SessionBean31MetaData.java
Log:
JBMETA-229 Added metadata support for processing no-interface beans in EJB3.1

Modified: projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/AbstractSessionBeanProcessor.java
===================================================================
--- projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/AbstractSessionBeanProcessor.java	2009-12-08 19:26:21 UTC (rev 97560)
+++ projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/AbstractSessionBeanProcessor.java	2009-12-08 20:09:06 UTC (rev 97561)
@@ -55,6 +55,7 @@
       addTypeProcessor(new RemoteProcessor(finder));
       addTypeProcessor(new RemoteHomeProcessor(finder));
       addTypeProcessor(new ImplicitLocalProcessor(finder));
+      addTypeProcessor(new LocalBeanProcessor(finder));
 
       addMethodProcessor(new InitProcessor(finder));
       addMethodProcessor(new TimeoutProcessor(finder));

Added: projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/LocalBeanProcessor.java
===================================================================
--- projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/LocalBeanProcessor.java	                        (rev 0)
+++ projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/LocalBeanProcessor.java	2009-12-08 20:09:06 UTC (rev 97561)
@@ -0,0 +1,99 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* 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.metadata.annotation.creator.ejb;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+
+import javax.ejb.LocalBean;
+
+import org.jboss.logging.Logger;
+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.spec.SessionBean31MetaData;
+
+/**
+ * LocalBeanProcessor
+ * 
+ * Processes classes for the presence of {@link LocalBean} and sets the {@link SessionBean31MetaData}
+ * accordingly.
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class LocalBeanProcessor extends AbstractFinderUser
+      implements
+         Processor<SessionBean31MetaData, Class<?>>
+{
+
+   /**
+    * Logger
+    */
+   private static Logger logger = Logger.getLogger(LocalBeanProcessor.class);
+
+   /**
+    * The annotations that will be processed by this processor
+    */
+   private static final Collection<Class<? extends Annotation>> ANNOTATION_TYPES = new HashSet<Class<? extends Annotation>>(
+         Arrays.asList(LocalBean.class));
+
+   /**
+    * @param finder
+    */
+   public LocalBeanProcessor(AnnotationFinder<AnnotatedElement> finder)
+   {
+      super(finder);
+   }
+
+   /**
+    * @see org.jboss.metadata.annotation.creator.Processor#getAnnotationTypes()
+    */
+   @Override
+   public Collection<Class<? extends Annotation>> getAnnotationTypes()
+   {
+      return ANNOTATION_TYPES;
+   }
+
+   /**
+    * Process the <code>klass</code> for the presence of {@link LocalBean} annotation
+    * 
+    * @param sessionBeanMetadata The metadata which will be updated accordingly on the 
+    *   presence of {@link LocalBean} 
+    * @param klass The class to be processed
+    */
+   @Override
+   public void process(SessionBean31MetaData sessionBeanMetadata, Class<?> klass)
+   {
+      // first check if @LocalBean has been specified
+      LocalBean localBean = this.finder.getAnnotation(klass, LocalBean.class);
+      if (localBean != null)
+      {
+         sessionBeanMetadata.setNoInterfaceBean(true);
+         return;
+      }
+   }
+
+}

Modified: projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/AbstractSessionBeanProcessor.java
===================================================================
--- projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/AbstractSessionBeanProcessor.java	2009-12-08 19:26:21 UTC (rev 97560)
+++ projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/AbstractSessionBeanProcessor.java	2009-12-08 20:09:06 UTC (rev 97561)
@@ -62,6 +62,8 @@
       addTypeProcessor(new RemoteBindingsProcessor(finder));
       addTypeProcessor(new RemoteHomeBindingProcessor(finder));
       addTypeProcessor(new AsyncClassProcessor(finder));
+      addTypeProcessor(new LocalBeanProcessor(finder));
+      
 
       addMethodProcessor(new InitProcessor(finder));
       addMethodProcessor(new TimeoutProcessor(finder));

Added: projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/LocalBeanProcessor.java
===================================================================
--- projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/LocalBeanProcessor.java	                        (rev 0)
+++ projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/LocalBeanProcessor.java	2009-12-08 20:09:06 UTC (rev 97561)
@@ -0,0 +1,100 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* 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.metadata.annotation.creator.ejb.jboss;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+
+import javax.ejb.LocalBean;
+
+import org.jboss.logging.Logger;
+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.JBossSessionBean31MetaData;
+import org.jboss.metadata.ejb.spec.SessionBean31MetaData;
+
+/**
+ * LocalBeanProcessor
+ * 
+ * Processes classes for the presence of {@link LocalBean} and sets the {@link SessionBean31MetaData}
+ * accordingly.
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class LocalBeanProcessor extends AbstractFinderUser
+      implements
+         Processor<JBossSessionBean31MetaData, Class<?>>
+{
+
+   /**
+    * Logger
+    */
+   private static Logger logger = Logger.getLogger(LocalBeanProcessor.class);
+
+   /**
+    * The annotations that will be processed by this processor
+    */
+   private static final Collection<Class<? extends Annotation>> ANNOTATION_TYPES = new HashSet<Class<? extends Annotation>>(
+         Arrays.asList(LocalBean.class));
+
+   /**
+    * @param finder
+    */
+   public LocalBeanProcessor(AnnotationFinder<AnnotatedElement> finder)
+   {
+      super(finder);
+   }
+
+   /**
+    * @see org.jboss.metadata.annotation.creator.Processor#getAnnotationTypes()
+    */
+   @Override
+   public Collection<Class<? extends Annotation>> getAnnotationTypes()
+   {
+      return ANNOTATION_TYPES;
+   }
+
+   /**
+    * Process the <code>klass</code> for the presence of {@link LocalBean} annotation
+    * 
+    * @param sessionBeanMetadata The metadata which will be updated accordingly on the 
+    *   presence of {@link LocalBean} 
+    * @param klass The class to be processed
+    */
+   @Override
+   public void process(JBossSessionBean31MetaData sessionBeanMetadata, Class<?> klass)
+   {
+      // first check if @LocalBean has been specified
+      LocalBean localBean = this.finder.getAnnotation(klass, LocalBean.class);
+      if (localBean != null)
+      {
+         sessionBeanMetadata.setNoInterfaceBean(true);
+         return;
+      }
+   }
+
+}

Modified: projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/jboss/JBossSessionBean31MetaData.java
===================================================================
--- projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/jboss/JBossSessionBean31MetaData.java	2009-12-08 19:26:21 UTC (rev 97560)
+++ projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/jboss/JBossSessionBean31MetaData.java	2009-12-08 20:09:06 UTC (rev 97561)
@@ -36,6 +36,11 @@
    private static final long serialVersionUID = 1L;
 
    private AsyncMethodsMetaData asyncMethods;
+   
+   /**
+    * Flag indicating whether this bean has a no-interface view
+    */
+   private boolean noInterfaceBean;
 
    public AsyncMethodsMetaData getAsyncMethods()
    {
@@ -58,6 +63,26 @@
       if(original != null)
          asyncMethods.addAll(original);
    }
+   
+   /**
+    * Returns true if this bean exposes a no-interface view
+    * @return
+    */
+   public boolean isNoInterfaceBean()
+   {
+      return this.noInterfaceBean;
+   }
+   
+   /**
+    * Set the metadata to represent whether this bean
+    * exposes an no-interface view
+    * @param isNoInterfaceBean True if the bean exposes a no-interface
+    *                           view. Else set to false. 
+    */
+   public void setNoInterfaceBean(boolean isNoInterfaceBean)
+   {
+         this.noInterfaceBean = isNoInterfaceBean;
+   }
 
    @Override
    public void merge(JBossEnterpriseBeanMetaData override, JBossEnterpriseBeanMetaData original)
@@ -68,6 +93,18 @@
       JBossSessionBean31MetaData soriginal = original instanceof JBossGenericBeanMetaData ? null : (JBossSessionBean31MetaData) original;
       
       merge(joverride != null ? joverride.asyncMethods : null, soriginal != null ? soriginal.asyncMethods : null);
+      
+      // merge the no-interface information
+      if (joverride != null)
+      {
+         this.noInterfaceBean = joverride.isNoInterfaceBean();
+      }
+      else if (soriginal != null)
+      {
+         this.noInterfaceBean = soriginal.isNoInterfaceBean();
+      }
+
+      
    }
    
    @Override
@@ -80,5 +117,15 @@
       SessionBean31MetaData soriginal = (SessionBean31MetaData) original;
       
       merge(joverride != null ? joverride.asyncMethods : null, soriginal != null ? soriginal.getAsyncMethods() : null);
+      
+      // merge the no-interface information
+      if (joverride != null)
+      {
+         this.noInterfaceBean = joverride.isNoInterfaceBean();
+      }
+      else if (soriginal != null)
+      {
+         this.noInterfaceBean = soriginal.isNoInterfaceBean();
+      }
    }
 }

Modified: projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/SessionBean31MetaData.java
===================================================================
--- projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/SessionBean31MetaData.java	2009-12-08 19:26:21 UTC (rev 97560)
+++ projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/SessionBean31MetaData.java	2009-12-08 20:09:06 UTC (rev 97561)
@@ -21,10 +21,12 @@
  */
 package org.jboss.metadata.ejb.spec;
 
+import javax.ejb.LocalBean;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlType;
 
 import org.jboss.metadata.common.ejb.ITimeoutTarget;
+import org.jboss.metadata.javaee.spec.EmptyMetaData;
 import org.jboss.xb.annotations.JBossXmlConstants;
 import org.jboss.xb.annotations.JBossXmlType;
 
@@ -33,7 +35,7 @@
  * @version $Revision: $
  */
 @XmlType(name="session-beanType", propOrder={"descriptionGroup", "ejbName", "mappedName", "home", "remote", "localHome", "local",
-      "businessLocals", "businessRemotes", "serviceEndpoint", "ejbClass", "sessionType", "timeoutMethod", "initMethods", "removeMethods",
+      "businessLocals", "businessRemotes", "localBean", "serviceEndpoint", "ejbClass", "sessionType", "timeoutMethod", "initMethods", "removeMethods",
       "asyncMethods",
       "transactionType", "aroundInvokes", "environmentRefsGroup", "postActivates", "prePassivates", "securityRoleRefs", "securityIdentity"})
 @JBossXmlType(modelGroup=JBossXmlConstants.MODEL_GROUP_UNORDERED_SEQUENCE)
@@ -43,7 +45,12 @@
    private static final long serialVersionUID = 1L;
    
    private AsyncMethodsMetaData asyncMethods;
-
+   
+   /**
+    * For &lt;local-bean&gt;
+    */
+   private EmptyMetaData localBean;
+   
    public AsyncMethodsMetaData getAsyncMethods()
    {
       return asyncMethods;
@@ -58,6 +65,54 @@
       this.asyncMethods = asyncMethods;
    }
    
+   /**
+    *  
+    * @return Returns {@link EmptyMetaData} if the bean represents a no-interface
+    * bean. Else returns null. 
+    * Use the {@link #isNoInterfaceBean()} API which is more intuitive.
+    *   
+    * @see SessionBean31MetaData#isNoInterfaceBean()
+    */
+   public EmptyMetaData getLocalBean()
+   {
+      return this.localBean;
+   }
+   
+   /**
+    * Set the metadata to represent whether this bean
+    * exposes an no-interface view
+    * @param isNoInterfaceBean True if the bean exposes a no-interface
+    *                           view. Else set to false. 
+    */
+   @XmlElement(name="local-bean", required=false)
+   public void setLocalBean(EmptyMetaData localBean)
+   {
+      this.localBean = localBean;
+   }
+   
+   /**
+    * @return Returns true if this bean exposes a no-interface view.
+    * Else returns false. This is similar to {@link #getLocalBean()}, but
+    * is more intuitive
+    * 
+    */
+   public boolean isNoInterfaceBean()
+   {
+      return this.localBean == null ? false : true;
+   }
+   
+   /**
+    * Sets the no-interface information in the metadata  
+    * @param isNoInterfaceBean True if this is a no-interface bean, false otherwise
+    */
+   public void setNoInterfaceBean(boolean isNoInterfaceBean)
+   {
+      this.localBean = isNoInterfaceBean ? new EmptyMetaData() : null;
+   }
+   
+   /**
+    * {@inheritDoc}
+    */
    @Override
    public void merge(EnterpriseBeanMetaData eoverride, EnterpriseBeanMetaData eoriginal)
    {
@@ -70,5 +125,15 @@
          asyncMethods.addAll(override.asyncMethods);
       if(original != null && original.asyncMethods != null)
          asyncMethods.addAll(original.asyncMethods);
+      // merge the no-interface information
+      if (override != null)
+      {
+         this.localBean = override.getLocalBean();
+      }
+      else if (original != null)
+      {
+         this.localBean = original.getLocalBean();
+      }
+      
    }
 }

Added: projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/process/processor/ejb/jboss/ImplicitNoInterfaceBeanProcessor.java
===================================================================
--- projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/process/processor/ejb/jboss/ImplicitNoInterfaceBeanProcessor.java	                        (rev 0)
+++ projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/process/processor/ejb/jboss/ImplicitNoInterfaceBeanProcessor.java	2009-12-08 20:09:06 UTC (rev 97561)
@@ -0,0 +1,250 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* 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.metadata.process.processor.ejb.jboss;
+
+import java.io.Externalizable;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeansMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.ejb.jboss.JBossSessionBean31MetaData;
+import org.jboss.metadata.process.ProcessingException;
+import org.jboss.metadata.process.processor.JBossMetaDataProcessor;
+
+/**
+ * ImplicitNoInterfaceBeanProcessor
+ * 
+ * A EJB3.1 session bean can either explicitly be marked as a no-interface bean
+ * or it can be considered as a no-interface bean based on some implicit rules
+ * defined in EJB3.1 spec (section 4.9.8).
+ * 
+ * This {@link ImplicitNoInterfaceBeanProcessor} is responsible for processing the
+ * bean against the implicit rules and updating the metadata appropriately, if this
+ * is considered as a no-interface bean.
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class ImplicitNoInterfaceBeanProcessor implements JBossMetaDataProcessor<JBossMetaData>
+{
+
+   /**
+    * Logger
+    */
+   private static Logger logger = Logger.getLogger(ImplicitNoInterfaceBeanProcessor.class);
+
+   /**
+    * Classloader used for getting hold of the bean class
+    */
+   private ClassLoader classLoader;
+
+   /**
+    * Constructor
+    * @param classLoader
+    */
+   public ImplicitNoInterfaceBeanProcessor(ClassLoader classLoader)
+   {
+      this.classLoader = classLoader;
+   }
+
+   /** 
+    * Processes the <code>metadata</code> and runs it through the rules defined
+    * by the EJB3.1 spec for implicit no-interface bean (section 4.9.8). Updates
+    * the metadata accordingly to and returns the updated metadata.
+    * 
+    * @see org.jboss.metadata.process.processor.JBossMetaDataProcessor#process(org.jboss.metadata.ejb.jboss.JBossMetaData)
+    */
+   @Override
+   public JBossMetaData process(JBossMetaData metadata) throws ProcessingException
+   {
+      if (metadata == null)
+      {
+         return null;
+      }
+//      if (!metadata.isEJB31())
+//      {
+//         if (logger.isTraceEnabled())
+//         {
+//            logger.trace("Skipping metadata processing for: " + metadata + " since ejb version is " + metadata.getEjbVersion()
+//                  + " - can only process 3.1 version");
+//         }
+//         return metadata;
+//      }
+      // Get EJBs
+      JBossEnterpriseBeansMetaData ejbs = metadata.getEnterpriseBeans();
+      if (ejbs == null)
+      {
+         return metadata;
+      }
+      // For each EJB
+      for (JBossEnterpriseBeanMetaData ejb : ejbs)
+      {
+
+         // Only applies to Session beans
+         if (!ejb.isSession())
+         {
+            continue;
+         }
+         // TODO: Once there's a metadata.isEJB31() API available, then
+         // we won't need this instanceof checking. Although an API like 
+         // that will not help us in avoiding the cast that follows here.
+         if (!(ejb instanceof JBossSessionBean31MetaData))
+         {
+            continue;
+         }
+         // too bad - we need to cast.
+         JBossSessionBean31MetaData jbossSessionBeanMetadata = (JBossSessionBean31MetaData) ejb;
+         // if already marked as no-interface bean, then skip any processing
+         if (jbossSessionBeanMetadata.isNoInterfaceBean())
+         {
+            continue;
+         }
+         if (isEligibleForNoInterfaceView(jbossSessionBeanMetadata))
+         {
+            jbossSessionBeanMetadata.setNoInterfaceBean(true);
+         }
+         
+      }
+      return metadata;
+   }
+
+   /**
+    * 
+    * @param jbossSessionBeanMetadata The bean metadata
+    * @return Returns true if the bean represented by <code>jbossSessionBeanMetadata</code> is eligible
+    * for no-interface view. Else returns false.
+    * @throws ProcessingException If any exception occurs during processing the metadata
+    */
+   private boolean isEligibleForNoInterfaceView(JBossSessionBean31MetaData jbossSessionBeanMetadata)
+         throws ProcessingException
+   {
+      // if already marked as no-interface, then just return true
+      if (jbossSessionBeanMetadata.isNoInterfaceBean())
+      {
+         return true;
+      }
+
+      String beanClassName = jbossSessionBeanMetadata.getEjbClass();
+      // If there are any local business interfaces then its not eligible
+      if (jbossSessionBeanMetadata.getBusinessLocals() != null
+            && !jbossSessionBeanMetadata.getBusinessLocals().isEmpty())
+      {
+         if (logger.isTraceEnabled())
+         {
+            logger.trace("Bean " + beanClassName + " has business local, hence not eligible for no-interface view");
+         }
+         return false;
+      }
+      // If there are any remote business interfaces then its not eligible
+      if (jbossSessionBeanMetadata.getBusinessRemotes() != null
+            && !jbossSessionBeanMetadata.getBusinessRemotes().isEmpty())
+      {
+         if (logger.isTraceEnabled())
+         {
+            logger.trace("Bean " + beanClassName + " has business remote, hence not eligible for no-interface view");
+         }
+         return false;
+      }
+      // If it has a 2.x home or local home view, then its not eligible
+      if (jbossSessionBeanMetadata.getHome() != null || jbossSessionBeanMetadata.getLocalHome() != null)
+      {
+         if (logger.isTraceEnabled())
+         {
+            logger
+                  .trace("Bean " + beanClassName + " has 2.x home/local-home, hence not eligible for no-interface view");
+         }
+         return false;
+      }
+
+      // Check if the bean implements any interfaces
+      Class<?> ejbImplementationClass = null;
+      try
+      {
+         ejbImplementationClass = Class.forName(beanClassName, false, this.classLoader);
+         if (doesBeanImplementAnyInterfaces(ejbImplementationClass))
+         {
+            if (logger.isTraceEnabled())
+            {
+               logger
+                     .trace("Bean "
+                           + beanClassName
+                           + " implements interfaces (other than the one's excluded as per section 4.9.8 of EJB3.1 spec), hence not eligible for no-interface view");
+            }
+            return false;
+         }
+         // The bean satisfies the pre-requisites of a no-interface view.
+         return true;
+      }
+      catch (ClassNotFoundException e)
+      {
+         throw new ProcessingException("Could not load EJB Implementation Class " + beanClassName
+               + " from the specified ClassLoader: " + this.classLoader);
+      }
+   }
+
+   /**
+    * Checks whether the bean class implements any interfaces other than
+    * {@link Serializable} or {@link Externalizable} or anything from javax.ejb.* packages.
+    *
+    * @param beanClass
+    * @return Returns true if the bean implements any interface(s) other than {@link Serializable}
+    *           or {@link Externalizable} or anything from javax.ejb.* packages.
+    * 
+    */
+   private boolean doesBeanImplementAnyInterfaces(Class<?> beanClass)
+   {
+      Class<?>[] interfaces = beanClass.getInterfaces();
+      if (interfaces.length == 0)
+      {
+         return false;
+      }
+
+      // As per section 4.9.8 (bullet 1.3) of EJB3.1 spec
+      // java.io.Serializable; java.io.Externalizable; any of the interfaces defined by the javax.ejb
+      // are excluded from interface check
+
+      // Impl detail : We need an ArrayList because it supports removing of elements through iterator, while
+      // iterating. The List returned through Arrays.asList(...) does not allow this and throws UnsupportedException
+      List<Class<?>> implementedInterfaces = new ArrayList<Class<?>>(Arrays.asList(interfaces));
+      Iterator<Class<?>> implementedInterfacesIterator = implementedInterfaces.iterator();
+      while (implementedInterfacesIterator.hasNext())
+      {
+         Class<?> implementedInterface = implementedInterfacesIterator.next();
+         if (implementedInterface.equals(java.io.Serializable.class)
+               || implementedInterface.equals(java.io.Externalizable.class)
+               || implementedInterface.getName().startsWith("javax.ejb."))
+         {
+            implementedInterfacesIterator.remove();
+         }
+      }
+      // Now that we have removed the interfaces that should be excluded from the check,
+      // if the implementedInterfaces collection is empty then this bean can be considered for no-interface view
+      return !implementedInterfaces.isEmpty();
+   }
+
+}

Added: projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/localbean/BeanExplicitlyMarkedAsLocalBean.java
===================================================================
--- projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/localbean/BeanExplicitlyMarkedAsLocalBean.java	                        (rev 0)
+++ projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/localbean/BeanExplicitlyMarkedAsLocalBean.java	2009-12-08 20:09:06 UTC (rev 97561)
@@ -0,0 +1,38 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* 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.metadata.ejb.test.localbean;
+
+import javax.ejb.LocalBean;
+import javax.ejb.Stateful;
+
+/**
+ * BeanExplicitlyMarkedAsLocalBean
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+ at Stateful
+ at LocalBean
+public class BeanExplicitlyMarkedAsLocalBean
+{
+
+}

Added: projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/localbean/BeanMarkedAsLocalBeanInEJBJarXml.java
===================================================================
--- projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/localbean/BeanMarkedAsLocalBeanInEJBJarXml.java	                        (rev 0)
+++ projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/localbean/BeanMarkedAsLocalBeanInEJBJarXml.java	2009-12-08 20:09:06 UTC (rev 97561)
@@ -0,0 +1,37 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* 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.metadata.ejb.test.localbean;
+
+import javax.ejb.Stateful;
+
+/**
+ * BeanMarkedAsLocalBeanInEJBJarXml
+ * A bean which is marked as a local-bean through ejb-jar.xml
+ * 
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+ at Stateful
+public class BeanMarkedAsLocalBeanInEJBJarXml
+{
+
+}

Added: projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/localbean/DoNothingNoInterfaceBean.java
===================================================================
--- projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/localbean/DoNothingNoInterfaceBean.java	                        (rev 0)
+++ projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/localbean/DoNothingNoInterfaceBean.java	2009-12-08 20:09:06 UTC (rev 97561)
@@ -0,0 +1,36 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* 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.metadata.ejb.test.localbean;
+
+import javax.ejb.Stateless;
+
+/**
+ * SimpleNoInterfaceSLSB
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+ at Stateless
+public class DoNothingNoInterfaceBean
+{
+
+}

Added: projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/localbean/NoOp.java
===================================================================
--- projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/localbean/NoOp.java	                        (rev 0)
+++ projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/localbean/NoOp.java	2009-12-08 20:09:06 UTC (rev 97561)
@@ -0,0 +1,33 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* 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.metadata.ejb.test.localbean;
+
+/**
+ * NoOp
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public interface NoOp
+{
+
+}

Added: projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/localbean/NotANoInterfaceBean.java
===================================================================
--- projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/localbean/NotANoInterfaceBean.java	                        (rev 0)
+++ projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/localbean/NotANoInterfaceBean.java	2009-12-08 20:09:06 UTC (rev 97561)
@@ -0,0 +1,38 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* 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.metadata.ejb.test.localbean;
+
+import javax.ejb.Local;
+import javax.ejb.Stateful;
+
+/**
+ * NotANoInterfaceBean
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+ at Stateful
+ at Local (NoOp.class)
+public class NotANoInterfaceBean
+{
+
+}

Added: projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/localbean/unit/LocalBeanTestCase.java
===================================================================
--- projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/localbean/unit/LocalBeanTestCase.java	                        (rev 0)
+++ projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/localbean/unit/LocalBeanTestCase.java	2009-12-08 20:09:06 UTC (rev 97561)
@@ -0,0 +1,234 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* 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.metadata.ejb.test.localbean.unit;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.lang.reflect.AnnotatedElement;
+import java.net.URL;
+import java.util.Collection;
+
+import javax.ejb.LocalBean;
+
+import org.jboss.logging.Logger;
+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.JBoss50MetaData;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.ejb.jboss.JBossSessionBean31MetaData;
+import org.jboss.metadata.ejb.spec.EjbJar31MetaData;
+import org.jboss.metadata.ejb.spec.EjbJarMetaData;
+import org.jboss.metadata.ejb.spec.EnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.spec.SessionBean31MetaData;
+import org.jboss.metadata.ejb.test.localbean.BeanExplicitlyMarkedAsLocalBean;
+import org.jboss.metadata.ejb.test.localbean.BeanMarkedAsLocalBeanInEJBJarXml;
+import org.jboss.metadata.ejb.test.localbean.DoNothingNoInterfaceBean;
+import org.jboss.metadata.ejb.test.localbean.NotANoInterfaceBean;
+import org.jboss.metadata.process.processor.JBossMetaDataProcessor;
+import org.jboss.metadata.process.processor.ejb.jboss.ImplicitNoInterfaceBeanProcessor;
+import org.jboss.test.metadata.common.PackageScanner;
+import org.jboss.test.metadata.common.ScanPackage;
+import org.jboss.xb.binding.JBossXBException;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import org.jboss.xb.binding.resolver.MultiClassSchemaResolver;
+import org.jboss.xb.binding.resolver.MutableSchemaResolver;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * LocalBeanTestCase
+ * 
+ * Tests the metadata support for a no-interface bean. This includes tests
+ * for setting the metadata based on annotations, ejb-jar.xml and even implicit
+ * no-interface bean rules.
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class LocalBeanTestCase
+{
+   private static Logger logger = Logger.getLogger(LocalBeanTestCase.class);
+
+   private static MutableSchemaResolver schemaBindingResolver;
+
+   private static UnmarshallerFactory unmarshallerFactory = UnmarshallerFactory.newInstance();
+
+   @BeforeClass
+   public static void beforeClass()
+   {
+      schemaBindingResolver = new MultiClassSchemaResolver();
+      schemaBindingResolver.mapLocationToClass("ejb-jar_3_1.xsd", EjbJar31MetaData.class);
+   }
+
+   /**
+    * Tests that a ejb-jar.xml is parsed correctly for the presence/absence of local-bean
+    * element and metadata set appropriately.
+    * 
+    * @throws Exception
+    */
+   @Test
+   public void testParseEjbJarXml() throws Exception
+   {
+      EjbJarMetaData jarMetaData = unmarshal(EjbJarMetaData.class,
+            "/org/jboss/metadata/ejb/test/localbean/ejb-jar-localbean.xml");
+      assertNotNull(jarMetaData);
+      assertNoInterfaceBean(jarMetaData, "SimpleNoInterfaceSLSB", true);
+      assertNoInterfaceBean(jarMetaData, "NormalSLSB", false);
+   }
+
+   /**
+    * Tests that a bean marked explicitly with {@link LocalBean} annotation is 
+    * considered as a no-interface bean.
+    * 
+    * @throws Exception
+    */
+   @Test
+   @ScanPackage("org.jboss.metadata.ejb.test.localbean")
+   public void testScanOfExplicitlyMarkedLocalBean() throws Exception
+   {
+      AnnotationFinder<AnnotatedElement> finder = new DefaultAnnotationFinder<AnnotatedElement>();
+      JBoss50Creator creator = new JBoss50Creator(finder);
+      Collection<Class<?>> classes = PackageScanner.loadClasses();
+      JBossMetaData metaData = creator.create(classes);
+      assertNotNull(metaData);
+      this.assertNoInterfaceBean(metaData, BeanExplicitlyMarkedAsLocalBean.class.getSimpleName(), true);
+   }
+
+   /**
+    * Tests that a bean which is *not* explicitly marked with {@link LocalBean} or
+    * local-bean element in ejb-jar.xml, is processed for implicit no-interface rules
+    * (through {@link ImplicitNoInterfaceBeanProcessor}) and the metadata set appropriately.
+    * 
+    * @throws Exception
+    */
+   @Test
+   @ScanPackage("org.jboss.metadata.ejb.test.localbean")
+   public void testScanForImplicitLocalBean() throws Exception
+   {
+      AnnotationFinder<AnnotatedElement> finder = new DefaultAnnotationFinder<AnnotatedElement>();
+      JBoss50Creator creator = new JBoss50Creator(finder);
+      Collection<Class<?>> classes = PackageScanner.loadClasses();
+      JBossMetaData metaData = creator.create(classes);
+      assertNotNull(metaData);
+
+      // now process this metadata through the ImplicitNoInterfaceBeanProcessor
+      ClassLoader cl = Thread.currentThread().getContextClassLoader();
+      JBossMetaDataProcessor<JBossMetaData> metadataProcessor = new ImplicitNoInterfaceBeanProcessor(cl);
+      metaData = metadataProcessor.process(metaData);
+
+      this.assertNoInterfaceBean(metaData, DoNothingNoInterfaceBean.class.getSimpleName(), true);
+      this.assertNoInterfaceBean(metaData, NotANoInterfaceBean.class.getSimpleName(), false);
+
+      // also make sure that after processing through implicit processor, the explicitly marked
+      // LocalBean is still considered a nointerface bean
+      this.assertNoInterfaceBean(metaData, BeanExplicitlyMarkedAsLocalBean.class.getSimpleName(), true);
+
+   }
+
+   /**
+    * Tests that metadata created out of ejb-jar.xml and through annotations and 
+    * then merged, maintains the correct no-interface information
+    */
+   @Test
+   @ScanPackage("org.jboss.metadata.ejb.test.localbean")
+   public void testMerge() throws Exception
+   {
+      // first create metadata from annotations
+      AnnotationFinder<AnnotatedElement> finder = new DefaultAnnotationFinder<AnnotatedElement>();
+      JBoss50Creator creator = new JBoss50Creator(finder);
+      Collection<Class<?>> classes = PackageScanner.loadClasses();
+      JBossMetaData metaDataFromAnnotations = creator.create(classes);
+      assertNotNull(metaDataFromAnnotations);
+
+      // now create metadata from ejb-jar.xml
+      EjbJarMetaData ejbJarMetadataFromXml = unmarshal(EjbJarMetaData.class,
+            "/org/jboss/metadata/ejb/test/localbean/ejb-jar-localbean.xml");
+      // create jbossmetadata out of ejbjarmetadata
+      JBossMetaData jbossMetadataFromXml = new JBoss50MetaData();
+      jbossMetadataFromXml.merge(null, ejbJarMetadataFromXml);
+
+      // now merge (annotations and xml metadata)
+      JBossMetaData mergedMetadata = new JBoss50MetaData();
+      // note, xml overrides annotations and hence this order of parameter passing
+      mergedMetadata.merge(jbossMetadataFromXml, metaDataFromAnnotations);
+
+      // now check that the bean marked as local-bean in xml, is considered as a no-interface bean
+      this.assertNoInterfaceBean(mergedMetadata, BeanMarkedAsLocalBeanInEJBJarXml.class.getSimpleName(), true);
+   }
+
+   /**
+    * Utility method
+    * @param <T>
+    * @param type
+    * @param resource
+    * @return
+    * @throws JBossXBException
+    */
+   private static <T> T unmarshal(Class<T> type, String resource) throws JBossXBException
+   {
+      Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller();
+      unmarshaller.setValidation(false);
+      URL url = type.getResource(resource);
+      if (url == null)
+         throw new IllegalArgumentException("Failed to find resource " + resource);
+      return type.cast(unmarshaller.unmarshal(url.toString(), schemaBindingResolver));
+   }
+
+   /**
+    * Utility method for testing
+    * 
+    * @param ejbJarMetadata
+    * @param beanName
+    * @param expected
+    */
+   private void assertNoInterfaceBean(EjbJarMetaData ejbJarMetadata, String beanName, boolean expected)
+   {
+      EnterpriseBeanMetaData enterpriseBean = ejbJarMetadata.getEnterpriseBean(beanName);
+      assertTrue("metadata " + enterpriseBean.getClass() + " is not of type " + SessionBean31MetaData.class,
+            (enterpriseBean instanceof SessionBean31MetaData));
+      SessionBean31MetaData noInterfaceBean = (SessionBean31MetaData) enterpriseBean;
+      assertEquals("Is " + beanName + " a no-interface bean?", expected, noInterfaceBean.isNoInterfaceBean());
+
+   }
+
+   /**
+    * Utility method for testing 
+    * @param jbossMetadata
+    * @param beanName
+    * @param expected
+    */
+   private void assertNoInterfaceBean(JBossMetaData jbossMetadata, String beanName, boolean expected)
+   {
+      JBossEnterpriseBeanMetaData enterpriseBean = jbossMetadata.getEnterpriseBean(beanName);
+      assertTrue("metadata " + enterpriseBean.getClass() + " is not of type " + JBossSessionBean31MetaData.class,
+            (enterpriseBean instanceof JBossSessionBean31MetaData));
+      JBossSessionBean31MetaData noInterfaceBean = (JBossSessionBean31MetaData) enterpriseBean;
+      assertEquals("Is " + beanName + " a no-interface bean?", expected, noInterfaceBean.isNoInterfaceBean());
+
+   }
+
+}

Added: projects/metadata/ejb/trunk/src/test/resources/org/jboss/metadata/ejb/test/localbean/ejb-jar-localbean.xml
===================================================================
--- projects/metadata/ejb/trunk/src/test/resources/org/jboss/metadata/ejb/test/localbean/ejb-jar-localbean.xml	                        (rev 0)
+++ projects/metadata/ejb/trunk/src/test/resources/org/jboss/metadata/ejb/test/localbean/ejb-jar-localbean.xml	2009-12-08 20:09:06 UTC (rev 97561)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
+      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+      	  http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd"
+      version="3.1">
+   <enterprise-beans>
+      <session>
+         <ejb-name>SimpleNoInterfaceSLSB</ejb-name>
+           <local-bean/> 
+      </session>
+      <session>
+         <ejb-name>NormalSLSB</ejb-name>
+      </session>
+      <session>
+         <ejb-name>BeanMarkedAsLocalBeanInEJBJarXml</ejb-name>
+         <local-bean/>
+      </session>
+   </enterprise-beans>
+</ejb-jar>
\ No newline at end of file




More information about the jboss-cvs-commits mailing list