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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Mar 9 13:21:23 EST 2010


Author: jaikiran
Date: 2010-03-09 13:21:22 -0500 (Tue, 09 Mar 2010)
New Revision: 102152

Added:
   projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/AccessTimeoutClassProcessor.java
   projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/AccessTimeoutMethodProcessor.java
   projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/LockClassProcessor.java
   projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/LockMethodProcessor.java
   projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/AccessTimeoutMetaData.java
   projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/ConcurrentMethodMetaData.java
   projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/ConcurrentMethodsCollectionToMapAdapter.java
   projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/LockTypeAdapter.java
   projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/TimeUnitAdatper.java
   projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/concurrency/DefaultLockSingletonBean.java
   projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/concurrency/ReadLockSingletonBean.java
   projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/concurrency/WriteLockSingleton.java
   projects/metadata/ejb/trunk/src/test/resources/org/jboss/metadata/ejb/test/concurrency/ejb-jar-locks.xml
Modified:
   projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/SingletonProcessor.java
   projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/StatefulProcessor.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/ConcurrencyManagementTypeAdapter.java
   projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/SessionBean31MetaData.java
   projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/concurrency/unit/ConcurrencyManagementTestCase.java
   projects/metadata/ejb/trunk/src/test/resources/log4j.xml
   projects/metadata/ejb/trunk/src/test/resources/org/jboss/metadata/ejb/test/concurrency/ejb-jar-concurrency.xml
Log:
JBMETA-263 Added metadata support for @Lock @AccessTimeout and their xml equivalents

Modified: projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/SingletonProcessor.java
===================================================================
--- projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/SingletonProcessor.java	2010-03-09 18:04:09 UTC (rev 102151)
+++ projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/SingletonProcessor.java	2010-03-09 18:21:22 UTC (rev 102152)
@@ -29,7 +29,11 @@
 
 import org.jboss.metadata.annotation.creator.ProcessorUtils;
 import org.jboss.metadata.annotation.creator.ejb.jboss.AbstractSessionBeanProcessor;
+import org.jboss.metadata.annotation.creator.ejb.jboss.AccessTimeoutClassProcessor;
+import org.jboss.metadata.annotation.creator.ejb.jboss.AccessTimeoutMethodProcessor;
 import org.jboss.metadata.annotation.creator.ejb.jboss.ConcurrencyManagementProcessor;
+import org.jboss.metadata.annotation.creator.ejb.jboss.LockClassProcessor;
+import org.jboss.metadata.annotation.creator.ejb.jboss.LockMethodProcessor;
 import org.jboss.metadata.annotation.finder.AnnotationFinder;
 import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
 import org.jboss.metadata.ejb.spec.SessionType;
@@ -47,6 +51,11 @@
    {
       super(finder);
       addTypeProcessor(new ConcurrencyManagementProcessor(finder));
+      addTypeProcessor(new LockClassProcessor(finder));
+      addTypeProcessor(new AccessTimeoutClassProcessor(finder));
+      
+      addMethodProcessor(new LockMethodProcessor(finder));
+      addMethodProcessor(new AccessTimeoutMethodProcessor(finder));
    }
 
    @Override

Modified: projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/StatefulProcessor.java
===================================================================
--- projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/StatefulProcessor.java	2010-03-09 18:04:09 UTC (rev 102151)
+++ projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/StatefulProcessor.java	2010-03-09 18:21:22 UTC (rev 102152)
@@ -28,6 +28,8 @@
 import javax.ejb.Stateful;
 
 import org.jboss.metadata.annotation.creator.ProcessorUtils;
+import org.jboss.metadata.annotation.creator.ejb.jboss.AccessTimeoutClassProcessor;
+import org.jboss.metadata.annotation.creator.ejb.jboss.AccessTimeoutMethodProcessor;
 import org.jboss.metadata.annotation.finder.AnnotationFinder;
 import org.jboss.metadata.ejb.spec.SessionBeanMetaData;
 import org.jboss.metadata.ejb.spec.SessionType;
@@ -49,6 +51,9 @@
       addMethodProcessor(new PrePassivateMethodProcessor(finder));
       // concurrency management annotation is applicable for stateful bean
       addTypeProcessor(new ConcurrencyManagementProcessor(finder));
+      addTypeProcessor(new AccessTimeoutClassProcessor(finder));
+      
+      addMethodProcessor(new AccessTimeoutMethodProcessor(finder));
    }
 
    public SessionBeanMetaData create(Class<?> beanClass)

Added: projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/AccessTimeoutClassProcessor.java
===================================================================
--- projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/AccessTimeoutClassProcessor.java	                        (rev 0)
+++ projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/AccessTimeoutClassProcessor.java	2010-03-09 18:21:22 UTC (rev 102152)
@@ -0,0 +1,91 @@
+/*
+* 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.Collection;
+
+import javax.ejb.AccessTimeout;
+
+import org.jboss.metadata.annotation.creator.AbstractFinderUser;
+import org.jboss.metadata.annotation.creator.Processor;
+import org.jboss.metadata.annotation.creator.ProcessorUtils;
+import org.jboss.metadata.annotation.finder.AnnotationFinder;
+import org.jboss.metadata.ejb.jboss.JBossSessionBean31MetaData;
+import org.jboss.metadata.ejb.spec.AccessTimeoutMetaData;
+
+/**
+ * Processes class level {@link AccessTimeout} annotation and creates metadata out of it
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class AccessTimeoutClassProcessor extends AbstractFinderUser
+      implements
+         Processor<JBossSessionBean31MetaData, Class<?>>
+{
+
+   /**
+    * @param finder
+    */
+   public AccessTimeoutClassProcessor(AnnotationFinder<AnnotatedElement> finder)
+   {
+      super(finder);
+
+   }
+
+   /**
+    * @see org.jboss.metadata.annotation.creator.Processor#getAnnotationTypes()
+    */
+   @Override
+   public Collection<Class<? extends Annotation>> getAnnotationTypes()
+   {
+      return ProcessorUtils.createAnnotationSet(AccessTimeout.class);
+   }
+
+   /**
+    * @see org.jboss.metadata.annotation.creator.Processor#process(java.lang.Object, java.lang.reflect.AnnotatedElement)
+    */
+   @Override
+   public void process(JBossSessionBean31MetaData metaData, Class<?> klass)
+   {
+      AccessTimeout accessTimeout = this.finder.getAnnotation(klass, AccessTimeout.class);
+
+      if (accessTimeout == null)
+      {
+         return;
+      }
+      // create an AccessTimeoutMetaData
+      AccessTimeoutMetaData accessTimeoutMetaData = new AccessTimeoutMetaData();
+      accessTimeoutMetaData.setTimeout(accessTimeout.value());
+      // set access timeout unit
+      if (accessTimeout.unit() != null)
+      {
+         accessTimeoutMetaData.setUnit(accessTimeout.unit());
+      }
+      
+      metaData.setAccessTimeout(accessTimeoutMetaData);
+
+   }
+
+}

Added: projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/AccessTimeoutMethodProcessor.java
===================================================================
--- projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/AccessTimeoutMethodProcessor.java	                        (rev 0)
+++ projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/AccessTimeoutMethodProcessor.java	2010-03-09 18:21:22 UTC (rev 102152)
@@ -0,0 +1,116 @@
+/*
+* 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.lang.reflect.Method;
+import java.util.Collection;
+
+import javax.ejb.AccessTimeout;
+
+import org.jboss.metadata.annotation.creator.AbstractFinderUser;
+import org.jboss.metadata.annotation.creator.Processor;
+import org.jboss.metadata.annotation.creator.ProcessorUtils;
+import org.jboss.metadata.annotation.finder.AnnotationFinder;
+import org.jboss.metadata.ejb.jboss.JBossSessionBean31MetaData;
+import org.jboss.metadata.ejb.spec.AccessTimeoutMetaData;
+import org.jboss.metadata.ejb.spec.ConcurrentMethodMetaData;
+import org.jboss.metadata.ejb.spec.MethodParametersMetaData;
+import org.jboss.metadata.ejb.spec.NamedMethodMetaData;
+
+/**
+ * Processes method level {@link AccessTimeout} annotation and creates metadata out of it
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class AccessTimeoutMethodProcessor extends AbstractFinderUser
+      implements
+         Processor<JBossSessionBean31MetaData, Method>
+{
+
+   /**
+    * @param finder
+    */
+   public AccessTimeoutMethodProcessor(AnnotationFinder<AnnotatedElement> finder)
+   {
+      super(finder);
+
+   }
+
+   /**
+    * @see org.jboss.metadata.annotation.creator.Processor#getAnnotationTypes()
+    */
+   @Override
+   public Collection<Class<? extends Annotation>> getAnnotationTypes()
+   {
+      return ProcessorUtils.createAnnotationSet(AccessTimeout.class);
+   }
+
+   /**
+    * @see org.jboss.metadata.annotation.creator.Processor#process(java.lang.Object, java.lang.reflect.AnnotatedElement)
+    */
+   @Override
+   public void process(JBossSessionBean31MetaData metaData, Method method)
+   {
+      AccessTimeout accessTimeout = this.finder.getAnnotation(method, AccessTimeout.class);
+
+      if (accessTimeout == null)
+      {
+         return;
+      }
+      // create an AccessTimeoutMetaData
+      AccessTimeoutMetaData accessTimeoutMetaData = new AccessTimeoutMetaData();
+      accessTimeoutMetaData.setTimeout(accessTimeout.value());
+      // set access timeout unit
+      if (accessTimeout.unit() != null)
+      {
+         accessTimeoutMetaData.setUnit(accessTimeout.unit());
+      }
+      // this access timeout has to be applied to concurrency metadata applicable
+      // for the method being processed. So let's create/get the concurrency metadata
+
+      // create a named method metadata for this method
+      NamedMethodMetaData namedMethod = new NamedMethodMetaData();
+      namedMethod.setName(method.getName());
+      MethodParametersMetaData methodParamsMetaData = new MethodParametersMetaData();
+      for (Class<?> parameterType : method.getParameterTypes())
+      {
+         methodParamsMetaData.add(parameterType.getName());
+      }
+      namedMethod.setMethodParams(methodParamsMetaData);
+      // get the concurrent method for this named method
+      ConcurrentMethodMetaData concurrentMethod = metaData.getConcurrentMethods().get(namedMethod);
+      if (concurrentMethod == null)
+      {
+         concurrentMethod = new ConcurrentMethodMetaData();
+         // set the named method in the concurrent method metadata
+         concurrentMethod.setMethod(namedMethod);
+         metaData.getConcurrentMethods().put(namedMethod, concurrentMethod);
+      }
+      // set the access timeout metadata on the concurrent method metadata
+      concurrentMethod.setAccessTimeout(accessTimeoutMetaData);
+
+   }
+
+}

Added: projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/LockClassProcessor.java
===================================================================
--- projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/LockClassProcessor.java	                        (rev 0)
+++ projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/LockClassProcessor.java	2010-03-09 18:21:22 UTC (rev 102152)
@@ -0,0 +1,78 @@
+/*
+* 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.Collection;
+
+import javax.ejb.Lock;
+
+import org.jboss.metadata.annotation.creator.AbstractFinderUser;
+import org.jboss.metadata.annotation.creator.Processor;
+import org.jboss.metadata.annotation.creator.ProcessorUtils;
+import org.jboss.metadata.annotation.finder.AnnotationFinder;
+import org.jboss.metadata.ejb.jboss.JBossSessionBean31MetaData;
+
+/**
+ * Processes class level {@link Lock} annotation and creates metadata out of it
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class LockClassProcessor extends AbstractFinderUser implements Processor<JBossSessionBean31MetaData, Class<?>>
+{
+
+   /**
+    * @param finder
+    */
+   public LockClassProcessor(AnnotationFinder<AnnotatedElement> finder)
+   {
+      super(finder);
+   }
+
+   /**
+    * @see org.jboss.metadata.annotation.creator.Processor#getAnnotationTypes()
+    */
+   @Override
+   public Collection<Class<? extends Annotation>> getAnnotationTypes()
+   {
+      return ProcessorUtils.createAnnotationSet(Lock.class);
+   }
+
+   /**
+    * @see org.jboss.metadata.annotation.creator.Processor#process(java.lang.Object, java.lang.reflect.AnnotatedElement)
+    */
+   @Override
+   public void process(JBossSessionBean31MetaData metaData, Class<?> klass)
+   {
+      Lock lock = this.finder.getAnnotation(klass, Lock.class);
+
+      if (lock == null)
+      {
+         return;
+      }
+      metaData.setLockType(lock.value());
+
+   }
+
+}

Added: projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/LockMethodProcessor.java
===================================================================
--- projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/LockMethodProcessor.java	                        (rev 0)
+++ projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/LockMethodProcessor.java	2010-03-09 18:21:22 UTC (rev 102152)
@@ -0,0 +1,103 @@
+/*
+* 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.lang.reflect.Method;
+import java.util.Collection;
+
+import javax.ejb.Lock;
+
+import org.jboss.metadata.annotation.creator.AbstractFinderUser;
+import org.jboss.metadata.annotation.creator.Processor;
+import org.jboss.metadata.annotation.creator.ProcessorUtils;
+import org.jboss.metadata.annotation.finder.AnnotationFinder;
+import org.jboss.metadata.ejb.jboss.JBossSessionBean31MetaData;
+import org.jboss.metadata.ejb.spec.ConcurrentMethodMetaData;
+import org.jboss.metadata.ejb.spec.MethodParametersMetaData;
+import org.jboss.metadata.ejb.spec.NamedMethodMetaData;
+
+/**
+ * Processes method level {@link Lock} annotation and creates metadata out of it
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class LockMethodProcessor extends AbstractFinderUser implements Processor<JBossSessionBean31MetaData, Method>
+{
+
+   /**
+    * @param finder
+    */
+   public LockMethodProcessor(AnnotationFinder<AnnotatedElement> finder)
+   {
+      super(finder);
+   }
+
+   /**
+    * @see org.jboss.metadata.annotation.creator.Processor#getAnnotationTypes()
+    */
+   @Override
+   public Collection<Class<? extends Annotation>> getAnnotationTypes()
+   {
+      return ProcessorUtils.createAnnotationSet(Lock.class);
+   }
+
+   /**
+    * @see org.jboss.metadata.annotation.creator.Processor#process(java.lang.Object, java.lang.reflect.AnnotatedElement)
+    */
+   @Override
+   public void process(JBossSessionBean31MetaData metaData, Method method)
+   {
+      Lock lock = this.finder.getAnnotation(method, Lock.class);
+      if (lock == null)
+      {
+         return;
+      }
+
+      // create a named method metadata for this method
+      NamedMethodMetaData namedMethod = new NamedMethodMetaData();
+      namedMethod.setName(method.getName());
+      MethodParametersMetaData methodParamsMetaData = new MethodParametersMetaData();
+      for (Class<?> parameterType : method.getParameterTypes())
+      {
+         methodParamsMetaData.add(parameterType.getName());
+      }
+      namedMethod.setMethodParams(methodParamsMetaData);
+      // get the concurrent method for this named method
+      ConcurrentMethodMetaData concurrentMethod = metaData.getConcurrentMethods().get(namedMethod);
+      if (concurrentMethod == null)
+      {
+         concurrentMethod = new ConcurrentMethodMetaData();
+         // set the named method in the concurrent method metadata
+         concurrentMethod.setMethod(namedMethod);
+         metaData.getConcurrentMethods().put(namedMethod, concurrentMethod);
+      }
+      // if the lock type has been set on the annotation, then set it in the concurrent method metadata
+      if (lock.value() != null)
+      {
+         concurrentMethod.setLockType(lock.value());
+      }
+   }
+
+}

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	2010-03-09 18:04:09 UTC (rev 102151)
+++ projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/jboss/JBossSessionBean31MetaData.java	2010-03-09 18:21:22 UTC (rev 102152)
@@ -21,14 +21,21 @@
  */
 package org.jboss.metadata.ejb.jboss;
 
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
 import javax.ejb.ConcurrencyManagementType;
+import javax.ejb.LockType;
 import javax.ejb.Startup;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 
 import org.jboss.metadata.common.ejb.ITimeoutTarget;
+import org.jboss.metadata.ejb.spec.AccessTimeoutMetaData;
 import org.jboss.metadata.ejb.spec.AsyncMethodsMetaData;
-import org.jboss.metadata.ejb.spec.ConcurrencyManagementTypeAdapter;
+import org.jboss.metadata.ejb.spec.ConcurrentMethodMetaData;
 import org.jboss.metadata.ejb.spec.EnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.spec.NamedMethodMetaData;
 import org.jboss.metadata.ejb.spec.SessionBean31MetaData;
 import org.jboss.metadata.ejb.spec.SessionType;
 
@@ -53,10 +60,25 @@
    private Boolean initOnStartup;
 
    /**
+    * Concurrent methods of this bean
+    */
+   private Map<NamedMethodMetaData, ConcurrentMethodMetaData> concurrentMethods;
+
+   /**
+    * Bean level access timeout
+    */
+   private AccessTimeoutMetaData beanLevelAccessTimeout;
+
+   /**
     * Concurrency management type of the bean
     */
    private ConcurrencyManagementType concurrencyManagementType;
 
+   /**
+    * The lock type that is set at the bean level
+    */
+   private LockType beanLevelLockType;
+
    public AsyncMethodsMetaData getAsyncMethods()
    {
       return asyncMethods;
@@ -70,15 +92,6 @@
       this.asyncMethods = asyncMethods;
    }
 
-   private void merge(AsyncMethodsMetaData override, AsyncMethodsMetaData original)
-   {
-      this.asyncMethods = new AsyncMethodsMetaData();
-      if (override != null)
-         asyncMethods.addAll(override);
-      if (original != null)
-         asyncMethods.addAll(original);
-   }
-
    /**
     * Returns true if this bean exposes a no-interface view
     * @return
@@ -140,7 +153,6 @@
     * @param concurrencyManagementType The concurrency management type
     * @throws If the passed <code>concurrencyManagementType</code> is null
     */
-   @XmlJavaTypeAdapter(ConcurrencyManagementTypeAdapter.class)
    public void setConcurrencyManagementType(ConcurrencyManagementType concurrencyManagementType)
    {
       if (concurrencyManagementType == null)
@@ -159,6 +171,76 @@
       return this.concurrencyManagementType;
    }
 
+   /**
+    * Sets the concurrent methods of this bean
+    * @param concurrentMethods
+    * @throws IllegalArgumentException If the passed <code>concurrentMethods</code> is null
+    */
+   public void setConcurrentMethods(Set<ConcurrentMethodMetaData> concurrentMethods)
+   {
+      if (concurrentMethods == null)
+      {
+         throw new IllegalArgumentException("Concurrent methods cannot be set to null");
+      }
+      this.concurrentMethods = new HashMap<NamedMethodMetaData, ConcurrentMethodMetaData>();
+      for (ConcurrentMethodMetaData concurrentMethod : concurrentMethods)
+      {
+         this.concurrentMethods.put(concurrentMethod.getMethod(), concurrentMethod);
+      }
+   }
+
+   /**
+    * Returns a {@link Map} whose key represents a {@link NamedMethodMetaData} and whose value
+    * represents {@link ConcurrentMethodMetaData} of this bean. Returns an empty {@link Map} if
+    * there are no concurrent methods for this bean
+    * @return
+    */
+   public Map<NamedMethodMetaData, ConcurrentMethodMetaData> getConcurrentMethods()
+   {
+      if (this.concurrentMethods == null)
+      {
+         return Collections.EMPTY_MAP;
+      }
+      return this.concurrentMethods;
+   }
+
+   /**
+    * Sets the lock type applicable at the bean level
+    * @param lockType {@link LockType}
+    */
+   public void setLockType(LockType lockType)
+   {
+      this.beanLevelLockType = lockType;
+   }
+
+   /**
+    * Returns the lock type applicable at the bean level
+    * @return
+    */
+   public LockType getLockType()
+   {
+      return this.beanLevelLockType;
+   }
+
+   /**
+    * Sets the bean level access timeout metadata
+    * @param accessTimeout {@link AccessTimeoutMetaData}
+    */
+   public void setAccessTimeout(AccessTimeoutMetaData accessTimeout)
+   {
+      this.beanLevelAccessTimeout = accessTimeout;
+   }
+
+   /**
+    * Returns the access timeout metadata applicable at bean level
+    * 
+    * @return
+    */
+   public AccessTimeoutMetaData getAccessTimeout()
+   {
+      return this.beanLevelAccessTimeout;
+   }
+
    @Override
    public void merge(JBossEnterpriseBeanMetaData override, JBossEnterpriseBeanMetaData original)
    {
@@ -173,24 +255,56 @@
 
       merge(joverride != null ? joverride.asyncMethods : null, soriginal != null ? soriginal.asyncMethods : null);
 
-      // merge the no-interface information
+      // merge the rest
       if (joverride != null)
       {
          this.noInterfaceBean = joverride.isNoInterfaceBean();
+         this.initOnStartup = joverride.isInitOnStartup();
+         if (joverride.concurrencyManagementType != null)
+         {
+            this.concurrencyManagementType = joverride.concurrencyManagementType;
+         }
+         if (joverride.concurrentMethods != null)
+         {
+            if (this.concurrentMethods == null)
+            {
+               this.concurrentMethods = new HashMap<NamedMethodMetaData, ConcurrentMethodMetaData>();
+            }
+            this.concurrentMethods.putAll(joverride.concurrentMethods);
+         }
+         if (joverride.beanLevelLockType != null)
+         {
+            this.beanLevelLockType = joverride.beanLevelLockType;
+         }
+         if (joverride.beanLevelAccessTimeout != null)
+         {
+            this.beanLevelAccessTimeout = joverride.beanLevelAccessTimeout;
+         }
       }
       else if (soriginal != null)
       {
          this.noInterfaceBean = soriginal.isNoInterfaceBean();
-      }
-
-      // merge the init-on-startup information
-      if (joverride != null)
-      {
-         this.initOnStartup = joverride.isInitOnStartup();
-      }
-      else if (soriginal != null)
-      {
          this.initOnStartup = soriginal.isInitOnStartup();
+         if (soriginal.getConcurrencyManagementType() != null)
+         {
+            this.concurrencyManagementType = soriginal.getConcurrencyManagementType();
+         }
+         if (soriginal.concurrentMethods != null)
+         {
+            if (this.concurrentMethods == null)
+            {
+               this.concurrentMethods = new HashMap<NamedMethodMetaData, ConcurrentMethodMetaData>();
+            }
+            this.concurrentMethods.putAll(soriginal.concurrentMethods);
+         }
+         if (soriginal.beanLevelLockType != null)
+         {
+            this.beanLevelLockType = soriginal.beanLevelLockType;
+         }
+         if (soriginal.beanLevelAccessTimeout != null)
+         {
+            this.beanLevelAccessTimeout = soriginal.beanLevelAccessTimeout;
+         }
       }
 
    }
@@ -215,6 +329,22 @@
          {
             this.concurrencyManagementType = joverride.concurrencyManagementType;
          }
+         if (joverride.concurrentMethods != null)
+         {
+            if (this.concurrentMethods == null)
+            {
+               this.concurrentMethods = new HashMap<NamedMethodMetaData, ConcurrentMethodMetaData>();
+            }
+            this.concurrentMethods.putAll(joverride.concurrentMethods);
+         }
+         if (joverride.beanLevelLockType != null)
+         {
+            this.beanLevelLockType = joverride.beanLevelLockType;
+         }
+         if (joverride.beanLevelAccessTimeout != null)
+         {
+            this.beanLevelAccessTimeout = joverride.beanLevelAccessTimeout;
+         }
       }
       else if (soriginal != null)
       {
@@ -224,7 +354,33 @@
          {
             this.concurrencyManagementType = soriginal.getConcurrencyManagementType();
          }
+         if (soriginal.getConcurrentMethods() != null)
+         {
+            if (this.concurrentMethods == null)
+            {
+               this.concurrentMethods = new HashMap<NamedMethodMetaData, ConcurrentMethodMetaData>();
+            }
+            this.concurrentMethods.putAll(soriginal.getConcurrentMethods());
+         }
+         if (soriginal.getLockType() != null)
+         {
+            this.beanLevelLockType = soriginal.getLockType();
+         }
+         if (soriginal.getAccessTimeout() != null)
+         {
+            this.beanLevelAccessTimeout = soriginal.getAccessTimeout();
+         }
       }
 
    }
+
+   private void merge(AsyncMethodsMetaData override, AsyncMethodsMetaData original)
+   {
+      this.asyncMethods = new AsyncMethodsMetaData();
+      if (override != null)
+         asyncMethods.addAll(override);
+      if (original != null)
+         asyncMethods.addAll(original);
+   }
+
 }

Added: projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/AccessTimeoutMetaData.java
===================================================================
--- projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/AccessTimeoutMetaData.java	                        (rev 0)
+++ projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/AccessTimeoutMetaData.java	2010-03-09 18:21:22 UTC (rev 102152)
@@ -0,0 +1,74 @@
+/*
+* 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.spec;
+
+import java.io.Serializable;
+import java.util.concurrent.TimeUnit;
+
+import javax.ejb.AccessTimeout;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+/**
+ * Metadata for {@link AccessTimeout}'s xml equivalent
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+ at XmlType(name = "access-timeoutType", propOrder =
+{"timeout", "unit"})
+public class AccessTimeoutMetaData implements Serializable
+{
+
+   /**
+    * 
+    */
+   private static final long serialVersionUID = 1L;
+
+   private long timeout;
+
+   private TimeUnit unit;
+
+   @XmlElement(name = "timeout", required = true)
+   public void setTimeout(long timeout)
+   {
+      this.timeout = timeout;
+   }
+
+   public long getTimeout()
+   {
+      return this.timeout;
+   }
+
+   @XmlElement(name = "unit", required = true)
+   @XmlJavaTypeAdapter(TimeUnitAdatper.class)
+   public void setUnit(TimeUnit timeUnit)
+   {
+      this.unit = timeUnit;
+   }
+
+   public TimeUnit getUnit()
+   {
+      return this.unit;
+   }
+}

Modified: projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/ConcurrencyManagementTypeAdapter.java
===================================================================
--- projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/ConcurrencyManagementTypeAdapter.java	2010-03-09 18:04:09 UTC (rev 102151)
+++ projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/ConcurrencyManagementTypeAdapter.java	2010-03-09 18:21:22 UTC (rev 102152)
@@ -21,6 +21,8 @@
 */
 package org.jboss.metadata.ejb.spec;
 
+import java.util.Locale;
+
 import javax.ejb.ConcurrencyManagementType;
 import javax.xml.bind.annotation.adapters.XmlAdapter;
 
@@ -57,7 +59,7 @@
    @Override
    public ConcurrencyManagementType unmarshal(String cmType) throws Exception
    {
-      String concurrencyManagementType = cmType.toUpperCase();
+      String concurrencyManagementType = cmType.toUpperCase(Locale.ENGLISH);
       return ConcurrencyManagementType.valueOf(concurrencyManagementType);
    }
 

Added: projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/ConcurrentMethodMetaData.java
===================================================================
--- projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/ConcurrentMethodMetaData.java	                        (rev 0)
+++ projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/ConcurrentMethodMetaData.java	2010-03-09 18:21:22 UTC (rev 102152)
@@ -0,0 +1,106 @@
+/*
+* 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.spec;
+
+import java.io.Serializable;
+
+import javax.ejb.Lock;
+import javax.ejb.LockType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+/**
+ * Metadata for methods which specify {@link Lock} for concurrency management
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+ at XmlType(name = "concurrent-methodType", propOrder =
+{"method", "lockType", "accessTimeout"})
+public class ConcurrentMethodMetaData implements Serializable
+{
+
+   private static final long serialVersionUID = 1L;
+
+   private NamedMethodMetaData method;
+
+   private LockType lockType;
+
+   private AccessTimeoutMetaData accessTimeout;
+
+   @XmlElement(name = "method", required = true)
+   public void setMethod(NamedMethodMetaData namedMethod)
+   {
+      this.method = namedMethod;
+   }
+
+   public NamedMethodMetaData getMethod()
+   {
+      return this.method;
+   }
+
+   @XmlElement(name = "lock", required = false)
+   @XmlJavaTypeAdapter(LockTypeAdapter.class)
+   public void setLockType(LockType lockType)
+   {
+      this.lockType = lockType;
+   }
+
+   public LockType getLockType()
+   {
+      return this.lockType;
+   }
+
+   @XmlElement(name = "access-timeout", required = false)
+   public void setAccessTimeout(AccessTimeoutMetaData accessTimeout)
+   {
+      this.accessTimeout = accessTimeout;
+   }
+
+   public AccessTimeoutMetaData getAccessTimeout()
+   {
+      return this.accessTimeout;
+   }
+   
+   /**
+    * A {@link ConcurrentMethodMetaData} is equal to another {@link ConcurrentMethodMetaData} if
+    * the {@link ConcurrentMethodMetaData#method} of both the {@link ConcurrentMethodMetaData} is equal
+    * 
+    * @see java.lang.Object#equals(java.lang.Object)
+    */
+   @Override
+   public boolean equals(Object obj)
+   {
+      if(this == obj)
+         return true;
+      if(!(obj instanceof ConcurrentMethodMetaData))
+         return false;
+      
+      ConcurrentMethodMetaData anotherConcurrentMethod = (ConcurrentMethodMetaData) obj;
+      if (this.method == null)
+      {
+         return false;
+      }
+      return this.method.equals(anotherConcurrentMethod.method);
+   }
+}

Added: projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/ConcurrentMethodsCollectionToMapAdapter.java
===================================================================
--- projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/ConcurrentMethodsCollectionToMapAdapter.java	                        (rev 0)
+++ projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/ConcurrentMethodsCollectionToMapAdapter.java	2010-03-09 18:21:22 UTC (rev 102152)
@@ -0,0 +1,85 @@
+/*
+* 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.spec;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+
+/**
+ * An implementation of {@link XmlAdapter} responsible for converting a {@link Collection} of
+ * {@link ConcurrentMethodMetaData} to a {@link Map} whose key is a {@link NamedMethodMetaData}
+ * (returned by {@link ConcurrentMethodMetaData#getMethod()}) and the value is the {@link ConcurrentMethodMetaData} 
+ * and vice-versa
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class ConcurrentMethodsCollectionToMapAdapter
+      extends
+         XmlAdapter<Collection<ConcurrentMethodMetaData>, Map<NamedMethodMetaData, ConcurrentMethodMetaData>>
+{
+
+   /**
+    * Returns the collection of {@link ConcurrentMethodMetaData} from the passed <code>concurrentMethods</code>
+    * {@link Map}
+    * 
+    * @see javax.xml.bind.annotation.adapters.XmlAdapter#marshal(java.lang.Object)
+    */
+   @Override
+   public Collection<ConcurrentMethodMetaData> marshal(
+         Map<NamedMethodMetaData, ConcurrentMethodMetaData> concurrentMethods) throws Exception
+   {
+      if (concurrentMethods == null)
+      {
+         return Collections.EMPTY_SET;
+      }
+      return new HashSet<ConcurrentMethodMetaData>(concurrentMethods.values());
+   }
+
+   /**
+    * Converts the <code>concurrentMethods</code> into a {@link Map} whose key is a {@link NamedMethodMetaData}
+    * (returned by {@link ConcurrentMethodMetaData#getMethod()}) and the value is the {@link ConcurrentMethodMetaData} 
+    * 
+    * @see javax.xml.bind.annotation.adapters.XmlAdapter#unmarshal(java.lang.Object)
+    */
+   @Override
+   public Map<NamedMethodMetaData, ConcurrentMethodMetaData> unmarshal(
+         Collection<ConcurrentMethodMetaData> concurrentMethods) throws Exception
+   {
+      if (concurrentMethods == null)
+      {
+         return Collections.EMPTY_MAP;
+      }
+      Map<NamedMethodMetaData, ConcurrentMethodMetaData> concurrentMethodsMap = new HashMap<NamedMethodMetaData, ConcurrentMethodMetaData>();
+      for (ConcurrentMethodMetaData concurrentMethod : concurrentMethods)
+      {
+         concurrentMethodsMap.put(concurrentMethod.getMethod(), concurrentMethod);
+      }
+      return concurrentMethodsMap;
+   }
+
+}

Added: projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/LockTypeAdapter.java
===================================================================
--- projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/LockTypeAdapter.java	                        (rev 0)
+++ projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/LockTypeAdapter.java	2010-03-09 18:21:22 UTC (rev 102152)
@@ -0,0 +1,67 @@
+/*
+* 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.spec;
+
+import java.util.Locale;
+
+import javax.ejb.LockType;
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+
+/**
+ * Responsible for converting the String value of {@link LockType} to
+ * the corresponding {@link LockType}
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class LockTypeAdapter<T> extends XmlAdapter<String, LockType>
+{
+
+   /**
+    * @see javax.xml.bind.annotation.adapters.XmlAdapter#marshal(java.lang.Object)
+    */
+   @Override
+   public String marshal(LockType lockType) throws Exception
+   {
+      
+      switch (lockType)
+      {
+         case READ :
+            return "Read";
+         case WRITE :
+            return "Write";
+         default :
+            return null;
+      }
+   }
+
+   /**
+    * @see javax.xml.bind.annotation.adapters.XmlAdapter#unmarshal(java.lang.Object)
+    */
+   @Override
+   public LockType unmarshal(String val) throws Exception
+   {
+      String lockType = val.toUpperCase(Locale.ENGLISH);
+      return LockType.valueOf(lockType);
+   }
+
+}

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	2010-03-09 18:04:09 UTC (rev 102151)
+++ projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/SessionBean31MetaData.java	2010-03-09 18:21:22 UTC (rev 102152)
@@ -21,15 +21,18 @@
  */
 package org.jboss.metadata.ejb.spec;
 
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
 import javax.ejb.ConcurrencyManagementType;
+import javax.ejb.LockType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 
 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;
 
 /**
  * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
@@ -38,9 +41,9 @@
 @XmlType(name = "session-beanType", propOrder =
 {"descriptionGroup", "ejbName", "mappedName", "home", "remote", "localHome", "local", "businessLocals",
       "businessRemotes", "localBean", "serviceEndpoint", "ejbClass", "sessionType", "timeoutMethod", "initOnStartup",
-      "concurrencyManagementType", "initMethods", "removeMethods", "asyncMethods", "transactionType", "aroundInvokes",
-      "environmentRefsGroup", "postActivates", "prePassivates", "securityRoleRefs", "securityIdentity"})
- at JBossXmlType(modelGroup = JBossXmlConstants.MODEL_GROUP_UNORDERED_SEQUENCE)
+      "concurrencyManagementType", "concurrentMethods", "initMethods", "removeMethods", "asyncMethods", "transactionType",
+      "aroundInvokes", "environmentRefsGroup", "postActivates", "prePassivates", "securityRoleRefs", "securityIdentity"})
+//@JBossXmlType(modelGroup = JBossXmlConstants.MODEL_GROUP_UNORDERED_SEQUENCE)
 public class SessionBean31MetaData extends SessionBeanMetaData implements ITimeoutTarget // FIXME: AbstractProcessor.processClass doesn't take super interfaces into account
 {
    private static final long serialVersionUID = 1L;
@@ -58,6 +61,21 @@
    private Boolean initOnStartup;
 
    /**
+    * Concurrent methods against each {@link NamedMethodMetaData}
+    */
+   private Map<NamedMethodMetaData, ConcurrentMethodMetaData> concurrentMethods;
+
+   /**
+    * The lock type that is set at the bean level
+    */
+   private LockType beanLevelLockType;
+
+   /**
+    * Bean level access timeout
+    */
+   private AccessTimeoutMetaData beanLevelAccessTimeout;
+
+   /**
     * Concurrency management type of the bean
     */
    private ConcurrencyManagementType concurrencyManagementType;
@@ -152,6 +170,7 @@
     * @param concurrencyManagementType The concurrency management type
     * @throws If the passed <code>concurrencyManagementType</code> is null
     */
+   @XmlElement(name = "concurrency-management-type", required = false)
    @XmlJavaTypeAdapter(ConcurrencyManagementTypeAdapter.class)
    public void setConcurrencyManagementType(ConcurrencyManagementType concurrencyManagementType)
    {
@@ -172,6 +191,71 @@
    }
 
    /**
+    * Sets the concurrent methods of this bean
+    * @param concurrentMethods
+    * @throws IllegalArgumentException If the passed <code>concurrentMethods</code> is null
+    */
+   @XmlElement(name = "concurrent-method", required = false)
+   @XmlJavaTypeAdapter (ConcurrentMethodsCollectionToMapAdapter.class)
+   public void setConcurrentMethods(Map<NamedMethodMetaData, ConcurrentMethodMetaData> concurrentMethods)
+   {
+      this.concurrentMethods = concurrentMethods;
+   }
+
+   /**
+    * Returns a {@link Map} whose key represents a {@link NamedMethodMetaData} and whose value
+    * represents {@link ConcurrentMethodMetaData} of this bean. Returns an empty {@link Map} if
+    * there are no concurrent methods for this bean
+    * @return
+    */
+   public Map<NamedMethodMetaData, ConcurrentMethodMetaData> getConcurrentMethods()
+   {
+      if (this.concurrentMethods == null)
+      {
+         return Collections.EMPTY_MAP;
+      }
+      return this.concurrentMethods;
+   }
+
+
+   /**
+    * Sets the lock type applicable at the bean level
+    * @param lockType {@link LockType}
+    */
+   public void setLockType(LockType lockType)
+   {
+      this.beanLevelLockType = lockType;
+   }
+
+   /**
+    * Returns the lock type applicable at the bean level
+    * @return
+    */
+   public LockType getLockType()
+   {
+      return this.beanLevelLockType;
+   }
+
+   /**
+    * Sets the bean level access timeout metadata
+    * @param accessTimeout {@link AccessTimeoutMetaData}
+    */
+   public void setAccessTimeout(AccessTimeoutMetaData accessTimeout)
+   {
+      this.beanLevelAccessTimeout = accessTimeout;
+   }
+
+   /**
+    * Returns the access timeout metadata applicable at bean level
+    * 
+    * @return
+    */
+   public AccessTimeoutMetaData getAccessTimeout()
+   {
+      return this.beanLevelAccessTimeout;
+   }
+
+   /**
     * {@inheritDoc}
     */
    @Override
@@ -203,6 +287,22 @@
          {
             this.concurrencyManagementType = override.concurrencyManagementType;
          }
+         if (override.concurrentMethods != null)
+         {
+            if (this.concurrentMethods == null)
+            {
+               this.concurrentMethods = new HashMap<NamedMethodMetaData, ConcurrentMethodMetaData>();
+            }
+            this.concurrentMethods.putAll(override.concurrentMethods);
+         }
+         if (override.beanLevelLockType != null)
+         {
+            this.beanLevelLockType = override.beanLevelLockType;
+         }
+         if (override.beanLevelAccessTimeout != null)
+         {
+            this.beanLevelAccessTimeout = override.beanLevelAccessTimeout;
+         }
       }
       else if (original != null)
       {
@@ -218,6 +318,22 @@
          {
             this.concurrencyManagementType = original.concurrencyManagementType;
          }
+         if (original.concurrentMethods != null)
+         {
+            if (this.concurrentMethods == null)
+            {
+               this.concurrentMethods = new HashMap<NamedMethodMetaData, ConcurrentMethodMetaData>();
+            }
+            this.concurrentMethods.putAll(original.concurrentMethods);
+         }
+         if (original.beanLevelLockType != null)
+         {
+            this.beanLevelLockType = original.beanLevelLockType;
+         }
+         if (original.beanLevelAccessTimeout != null)
+         {
+            this.beanLevelAccessTimeout = original.beanLevelAccessTimeout;
+         }
       }
    }
 }

Added: projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/TimeUnitAdatper.java
===================================================================
--- projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/TimeUnitAdatper.java	                        (rev 0)
+++ projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/TimeUnitAdatper.java	2010-03-09 18:21:22 UTC (rev 102152)
@@ -0,0 +1,76 @@
+/*
+* 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.spec;
+
+import java.util.Locale;
+import java.util.concurrent.TimeUnit;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+
+/**
+ * Responsible for converting the String value of {@link TimeUnit} to
+ * the corresponding {@link TimeUnit}
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class TimeUnitAdatper extends XmlAdapter<String, TimeUnit>
+{
+
+   /**
+    * @see javax.xml.bind.annotation.adapters.XmlAdapter#marshal(java.lang.Object)
+    */
+   @Override
+   public String marshal(TimeUnit val) throws Exception
+   {
+      switch (val)
+      {
+         case DAYS :
+            return "Days";
+         case HOURS :
+            return "Hours";
+         case MICROSECONDS :
+            return "Microseconds";
+         case MILLISECONDS :
+            return "Milliseconds";
+         case MINUTES :
+            return "Minutes";
+         case NANOSECONDS :
+            return "Nanoseconds";
+         case SECONDS :
+            return "Seconds";
+         default :
+            return null;
+      }
+   }
+
+   /**
+    * @see javax.xml.bind.annotation.adapters.XmlAdapter#unmarshal(java.lang.Object)
+    */
+   @Override
+   public TimeUnit unmarshal(String val) throws Exception
+   {
+      String timeUnit = val.toUpperCase(Locale.ENGLISH);
+      return TimeUnit.valueOf(timeUnit);
+   }
+
+}

Added: projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/concurrency/DefaultLockSingletonBean.java
===================================================================
--- projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/concurrency/DefaultLockSingletonBean.java	                        (rev 0)
+++ projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/concurrency/DefaultLockSingletonBean.java	2010-03-09 18:21:22 UTC (rev 102152)
@@ -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.concurrency;
+
+import javax.ejb.Singleton;
+
+/**
+ * DefaultLockSingletonBean
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+ at Singleton
+public class DefaultLockSingletonBean
+{
+
+}

Added: projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/concurrency/ReadLockSingletonBean.java
===================================================================
--- projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/concurrency/ReadLockSingletonBean.java	                        (rev 0)
+++ projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/concurrency/ReadLockSingletonBean.java	2010-03-09 18:21:22 UTC (rev 102152)
@@ -0,0 +1,43 @@
+/*
+* 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.concurrency;
+
+import javax.ejb.Lock;
+import javax.ejb.LockType;
+import javax.ejb.Singleton;
+
+/**
+ * ReadLockSingletonBean
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+ at Singleton
+ at Lock (LockType.READ)
+public class ReadLockSingletonBean
+{
+
+   public void doNothing()
+   {
+      
+   }
+}

Added: projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/concurrency/WriteLockSingleton.java
===================================================================
--- projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/concurrency/WriteLockSingleton.java	                        (rev 0)
+++ projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/concurrency/WriteLockSingleton.java	2010-03-09 18:21:22 UTC (rev 102152)
@@ -0,0 +1,39 @@
+/*
+* 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.concurrency;
+
+import javax.ejb.Lock;
+import javax.ejb.LockType;
+import javax.ejb.Singleton;
+
+/**
+ * WriteLockSingleton
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+ at Singleton
+ at Lock (LockType.WRITE)
+public class WriteLockSingleton
+{
+
+}

Modified: projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/concurrency/unit/ConcurrencyManagementTestCase.java
===================================================================
--- projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/concurrency/unit/ConcurrencyManagementTestCase.java	2010-03-09 18:04:09 UTC (rev 102151)
+++ projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/concurrency/unit/ConcurrencyManagementTestCase.java	2010-03-09 18:21:22 UTC (rev 102152)
@@ -29,9 +29,13 @@
 import java.lang.reflect.AnnotatedElement;
 import java.net.URL;
 import java.util.Collection;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
 
 import javax.ejb.ConcurrencyManagement;
 import javax.ejb.ConcurrencyManagementType;
+import javax.ejb.Lock;
+import javax.ejb.LockType;
 
 import org.jboss.metadata.annotation.creator.ejb.jboss.JBoss50Creator;
 import org.jboss.metadata.annotation.finder.AnnotationFinder;
@@ -39,15 +43,22 @@
 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.AccessTimeoutMetaData;
+import org.jboss.metadata.ejb.spec.ConcurrentMethodMetaData;
 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.MethodParametersMetaData;
+import org.jboss.metadata.ejb.spec.NamedMethodMetaData;
 import org.jboss.metadata.ejb.spec.SessionBean31MetaData;
 import org.jboss.metadata.ejb.test.concurrency.BMCSingletonBean;
 import org.jboss.metadata.ejb.test.concurrency.CMCSingletonBean;
 import org.jboss.metadata.ejb.test.concurrency.CMCStatefulBean;
 import org.jboss.metadata.ejb.test.concurrency.DefaultConcurrencySingletonBean;
 import org.jboss.metadata.ejb.test.concurrency.DefaultConcurrencyStatefulBean;
+import org.jboss.metadata.ejb.test.concurrency.DefaultLockSingletonBean;
+import org.jboss.metadata.ejb.test.concurrency.ReadLockSingletonBean;
+import org.jboss.metadata.ejb.test.concurrency.WriteLockSingleton;
 import org.jboss.test.metadata.common.PackageScanner;
 import org.jboss.test.metadata.common.ScanPackage;
 import org.jboss.xb.binding.JBossXBException;
@@ -59,8 +70,8 @@
 import org.junit.Test;
 
 /**
- * Test that the metadata for concurrency management annotation and 
- * it's equivalent xml element is processed correctly
+ * Test that the metadata for concurrency management related annotations and 
+ * their equivalent xml elements are processed correctly
  *
  * @author Jaikiran Pai
  * @version $Revision: $
@@ -78,7 +89,7 @@
       schemaBindingResolver = new MultiClassSchemaResolver();
       schemaBindingResolver.mapLocationToClass("ejb-jar_3_1.xsd", EjbJar31MetaData.class);
    }
-   
+
    /**
     * Tests that the {@link ConcurrencyManagement} annotation is processed correctly
     * 
@@ -103,7 +114,7 @@
       this.assertContainerConcurrencyManagement(metaData, CMCStatefulBean.class.getSimpleName());
 
    }
-   
+
    /**
     * Test that the concurrency management in ejb-jar.xml is processed correctly
     * 
@@ -115,17 +126,136 @@
       EjbJarMetaData jarMetaData = unmarshal(EjbJarMetaData.class,
             "/org/jboss/metadata/ejb/test/concurrency/ejb-jar-concurrency.xml");
       assertNotNull(jarMetaData);
-      
+
       this.assertBeanConcurrencyManagement(jarMetaData, "BMCSingletonBean");
-      
+
       this.assertContainerConcurrencyManagement(jarMetaData, "CMCSingletonBean");
       this.assertContainerConcurrencyManagement(jarMetaData, "CMCStatefulBean");
-      
+
       this.assertNullConcurrencyManagement(jarMetaData, "DefaultConcurrencySingletonBean");
       this.assertNullConcurrencyManagement(jarMetaData, "DefaultConcurrencyStatefulBean");
    }
 
    /**
+    * Tests that the {@link Lock} annotation is processed correctly
+    * 
+    * @throws Exception
+    */
+   @Test
+   @ScanPackage("org.jboss.metadata.ejb.test.concurrency")
+   public void testLockManagementAnnotationProcessing() 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 created for singleton bean was null", metaData);
+
+      JBossEnterpriseBeanMetaData enterpriseBean = metaData.getEnterpriseBean(ReadLockSingletonBean.class
+            .getSimpleName());
+      this.assertSessionBean(enterpriseBean);
+      JBossSessionBean31MetaData sessionBean = (JBossSessionBean31MetaData) enterpriseBean;
+      assertEquals("Unexpected locktype on bean " + ReadLockSingletonBean.class, LockType.READ, sessionBean
+            .getLockType());
+
+      JBossEnterpriseBeanMetaData anotherBean = metaData.getEnterpriseBean(DefaultLockSingletonBean.class
+            .getSimpleName());
+      this.assertSessionBean(anotherBean);
+      JBossSessionBean31MetaData defaultLockBean = (JBossSessionBean31MetaData) anotherBean;
+      assertNull("Bean " + DefaultLockSingletonBean.class + " had explicit lock type set", defaultLockBean
+            .getLockType());
+
+      JBossEnterpriseBeanMetaData writeLockEnterpriseBean = metaData.getEnterpriseBean(WriteLockSingleton.class
+            .getSimpleName());
+      this.assertSessionBean(writeLockEnterpriseBean);
+      JBossSessionBean31MetaData writeLockBean = (JBossSessionBean31MetaData) writeLockEnterpriseBean;
+      assertEquals("Unexpected locktype on bean " + WriteLockSingleton.class, LockType.WRITE, writeLockBean
+            .getLockType());
+
+   }
+
+   /**
+    * Test that the concurrent-method xml elements in ejb-jar.xml is processed correctly
+    * for methods named "*"
+    * 
+    * @throws Exception
+    */
+   @Test
+   public void testLockManagementXMLProcessing() throws Exception
+   {
+      EjbJarMetaData jarMetaData = unmarshal(EjbJarMetaData.class,
+            "/org/jboss/metadata/ejb/test/concurrency/ejb-jar-locks.xml");
+      assertNotNull(jarMetaData);
+
+      String beanName = "AllMethodsReadLockBean";
+      EnterpriseBeanMetaData enterpriseBean = jarMetaData.getEnterpriseBean(beanName);
+      this.assertSessionBean(enterpriseBean);
+      SessionBean31MetaData sessionBean = (SessionBean31MetaData) enterpriseBean;
+
+      Map<NamedMethodMetaData, ConcurrentMethodMetaData> concurrentMethods = sessionBean.getConcurrentMethods();
+      assertNotNull("Concurrent methods metdata was null for bean " + beanName, concurrentMethods);
+
+      NamedMethodMetaData allMethods = new NamedMethodMetaData();
+      allMethods.setMethodName("*");
+
+      assertTrue("Concurrent methods metadata does not contain method '*'", concurrentMethods.containsKey(allMethods));
+
+      ConcurrentMethodMetaData concurrentMethodMetaData = concurrentMethods.get(allMethods);
+      assertEquals("Unexpected locktype on method", LockType.READ, concurrentMethodMetaData.getLockType());
+
+      AccessTimeoutMetaData accessTimeout = concurrentMethodMetaData.getAccessTimeout();
+      assertNotNull("Access timeout not specified on method", accessTimeout);
+
+      assertEquals("Unexpected timeout value", 10, accessTimeout.getTimeout());
+      assertEquals("Unexpected timeout unit", TimeUnit.SECONDS, accessTimeout.getUnit());
+
+   }
+
+   /**
+    * Test that the concurrent-method xml elements in ejb-jar.xml is processed correctly
+    * for a specific named method
+    * 
+    * @throws Exception
+    */
+   @Test
+   public void testLockManagementXMLProcessingForSpecificMethod() throws Exception
+   {
+      EjbJarMetaData jarMetaData = unmarshal(EjbJarMetaData.class,
+            "/org/jboss/metadata/ejb/test/concurrency/ejb-jar-locks.xml");
+      assertNotNull(jarMetaData);
+
+      String oneMethodWriteLockBeanName = "OneMethodWithWriteLockBean";
+
+      EnterpriseBeanMetaData bean = jarMetaData.getEnterpriseBean(oneMethodWriteLockBeanName);
+      this.assertSessionBean(bean);
+      SessionBean31MetaData oneMethodWriteLockBean = (SessionBean31MetaData) bean;
+
+      Map<NamedMethodMetaData, ConcurrentMethodMetaData> concurrentMethodsOnBean = oneMethodWriteLockBean
+            .getConcurrentMethods();
+      assertNotNull("Concurrent methods metdata was null for bean " + oneMethodWriteLockBeanName,
+            concurrentMethodsOnBean);
+
+      NamedMethodMetaData methodWithWriteLock = new NamedMethodMetaData();
+      String methodName = "methodWithWriteLock";
+      methodWithWriteLock.setMethodName(methodName);
+
+      MethodParametersMetaData methodParams = new MethodParametersMetaData();
+      methodParams.add(Integer.class.getName());
+
+      methodWithWriteLock.setMethodParams(methodParams);
+
+      assertTrue("Concurrent methods metadata does not contain method named " + methodName, concurrentMethodsOnBean
+            .containsKey(methodWithWriteLock));
+
+      ConcurrentMethodMetaData concurrentMethodWithWriteLock = concurrentMethodsOnBean.get(methodWithWriteLock);
+      assertEquals("Unexpected locktype on method", LockType.WRITE, concurrentMethodWithWriteLock.getLockType());
+
+      assertNull("Unexpectedly found access timeout on method " + methodName, concurrentMethodWithWriteLock
+            .getAccessTimeout());
+
+   }
+
+   /**
     * Utility method
     * @param <T>
     * @param type
@@ -150,6 +280,7 @@
     */
    private void assertSessionBean(JBossEnterpriseBeanMetaData enterpriseBean)
    {
+      assertNotNull("Null enterprisebean", enterpriseBean);
       assertTrue("Bean " + enterpriseBean.getName() + " is not a session bean", enterpriseBean.isSession());
    }
 
@@ -160,6 +291,7 @@
     */
    private void assertSessionBean(EnterpriseBeanMetaData enterpriseBean)
    {
+      assertNotNull("Null enterprisebean", enterpriseBean);
       assertTrue("Bean " + enterpriseBean.getName() + " is not a session bean", enterpriseBean.isSession());
    }
 
@@ -206,8 +338,7 @@
       assertEquals("Bean " + beanName + " does not have bean managed concurrency", ConcurrencyManagementType.BEAN,
             sessionBean.getConcurrencyManagementType());
    }
-   
-   
+
    /**
     * Utility method to assert that the bean does not have any concurrency management set
     * @param metaData

Modified: projects/metadata/ejb/trunk/src/test/resources/log4j.xml
===================================================================
--- projects/metadata/ejb/trunk/src/test/resources/log4j.xml	2010-03-09 18:04:09 UTC (rev 102151)
+++ projects/metadata/ejb/trunk/src/test/resources/log4j.xml	2010-03-09 18:21:22 UTC (rev 102152)
@@ -106,7 +106,10 @@
   <!-- ======================= -->
   <!-- Setup the Root category -->
   <!-- ======================= -->
-
+  
+  <category name="org.jboss.xb">
+    <priority value="ALL"/>
+  </category>
   <root>
     <appender-ref ref="CONSOLE"/>
     <appender-ref ref="FILE"/>

Modified: projects/metadata/ejb/trunk/src/test/resources/org/jboss/metadata/ejb/test/concurrency/ejb-jar-concurrency.xml
===================================================================
--- projects/metadata/ejb/trunk/src/test/resources/org/jboss/metadata/ejb/test/concurrency/ejb-jar-concurrency.xml	2010-03-09 18:04:09 UTC (rev 102151)
+++ projects/metadata/ejb/trunk/src/test/resources/org/jboss/metadata/ejb/test/concurrency/ejb-jar-concurrency.xml	2010-03-09 18:21:22 UTC (rev 102152)
@@ -29,5 +29,6 @@
             <ejb-name>DefaultConcurrencyStatefulBean</ejb-name>
             <session-type>Stateful</session-type>
         </session>
+        
     </enterprise-beans>
 </ejb-jar>

Added: projects/metadata/ejb/trunk/src/test/resources/org/jboss/metadata/ejb/test/concurrency/ejb-jar-locks.xml
===================================================================
--- projects/metadata/ejb/trunk/src/test/resources/org/jboss/metadata/ejb/test/concurrency/ejb-jar-locks.xml	                        (rev 0)
+++ projects/metadata/ejb/trunk/src/test/resources/org/jboss/metadata/ejb/test/concurrency/ejb-jar-locks.xml	2010-03-09 18:21:22 UTC (rev 102152)
@@ -0,0 +1,40 @@
+<?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>AllMethodsReadLockBean</ejb-name>
+            <session-type>Singleton</session-type>
+            <concurrency-management-type>Container</concurrency-management-type>
+            <concurrent-method>
+                <method>
+                    <method-name>*</method-name>
+                </method>
+                <lock>Read</lock>
+                <access-timeout>
+                    <timeout>10</timeout>
+                    <unit>Seconds</unit>
+                </access-timeout>
+            </concurrent-method>
+        </session>
+        
+        <session>
+            <ejb-name>OneMethodWithWriteLockBean</ejb-name>
+            <session-type>Singleton</session-type>
+            <concurrency-management-type>Bean</concurrency-management-type>
+            <concurrent-method>
+                <method>
+                    <method-name>methodWithWriteLock</method-name>
+                    <method-params>
+                        <method-param>java.lang.Integer</method-param>
+                    </method-params>
+                </method>
+                <lock>Write</lock>
+            </concurrent-method>
+        </session>
+    </enterprise-beans>
+</ejb-jar>




More information about the jboss-cvs-commits mailing list