[jboss-cvs] JBossAS SVN: r110031 - in projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata: ejb/jboss and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Dec 20 02:41:57 EST 2010
Author: jaikiran
Date: 2010-12-20 02:41:57 -0500 (Mon, 20 Dec 2010)
New Revision: 110031
Modified:
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/ejb/jboss/JBossSessionBean31MetaData.java
Log:
JBMETA-324 Take into account EJB3.1 spec, section 4.8.5.5 while processing bean's superclass(es) for @Lock annotation
Modified: 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 2010-12-20 06:13:01 UTC (rev 110030)
+++ projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/LockClassProcessor.java 2010-12-20 07:41:57 UTC (rev 110031)
@@ -71,8 +71,10 @@
{
return;
}
- metaData.setLockType(lock.value());
-
+ // EJB3.1 spec, section 4.8.5.5 specifies special meaning for @Lock annotation
+ // on superclass(es) of the bean. So we have to keep track of which exact class
+ // has the @Lock annotation
+ metaData.setLockType(klass.getName(), 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-12-20 06:13:01 UTC (rev 110030)
+++ projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/jboss/JBossSessionBean31MetaData.java 2010-12-20 07:41:57 UTC (rev 110031)
@@ -21,6 +21,19 @@
*/
package org.jboss.metadata.ejb.jboss;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.ejb.ConcurrencyManagementType;
+import javax.ejb.Lock;
+import javax.ejb.LockType;
+import javax.ejb.Schedule;
+import javax.ejb.Startup;
+import javax.xml.bind.annotation.XmlElement;
+
import org.jboss.metadata.common.ejb.IScheduleTarget;
import org.jboss.metadata.common.ejb.ITimeoutTarget;
import org.jboss.metadata.ejb.spec.AccessTimeoutMetaData;
@@ -35,18 +48,6 @@
import org.jboss.metadata.ejb.spec.TimerMetaData;
import org.jboss.metadata.merge.MergeUtil;
-import javax.ejb.ConcurrencyManagementType;
-import javax.ejb.LockType;
-import javax.ejb.Schedule;
-import javax.ejb.Startup;
-import javax.xml.bind.annotation.XmlElement;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
/**
* @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
* @version $Revision: $
@@ -103,6 +104,15 @@
private StatefulTimeoutMetaData statefulTimeout;
+ /**
+ * EJB3.1 spec, section 4.8.5.5 specifies special meaning for @Lock annotation on
+ * bean's super class(es). This map keeps track of the @Lock annotation (if any)
+ * on the super class(es) of the bean. The key of this map is the fully qualified
+ * classname of the class having the @Lock annotation. The value part is the {@link LockType}
+ * specified on that class.
+ */
+ private Map<String, LockType> lockTypeOnNonBeanClasses = new HashMap<String, LockType>();
+
public AsyncMethodsMetaData getAsyncMethods()
{
return asyncMethods;
@@ -238,6 +248,55 @@
}
/**
+ * Sets the {@link LockType lock type} that's available on the passed <code>klass</code>
+ * <p/>
+ *
+ * @param klass The fully qualified classname of the {@link Class} marked with the passed
+ * {@link LockType lock type}
+ * @param lockType The {@link LockType lock type}
+ */
+ public void setLockType(String klass, LockType lockType)
+ {
+ if (klass == null)
+ {
+ throw new IllegalArgumentException("Class cannot be null");
+ }
+ if (klass.equals(this.getEjbClass()))
+ {
+ // set lock type on the bean class
+ this.setLockType(lockType);
+ }
+ else
+ {
+ // add to the non bean class lock types
+ this.lockTypeOnNonBeanClasses.put(klass, lockType);
+ }
+ }
+
+ /**
+ * Returns the {@link LockType lock type} specified on the passed {@link Class klass}. Returns
+ * null if the passed {@link Class klass} has no {@link Lock Lock} annotation
+ *
+ * @param klass The fully qualified classname of the {@link Class} which is being queried
+ * for {@link LockType}
+ * @return
+ */
+ public LockType getLockType(String klass)
+ {
+ if (klass == null)
+ {
+ throw new IllegalArgumentException("Class cannot be null");
+ }
+ if (klass.equals(this.getEjbClass()))
+ {
+ // get the lock type on the bean class
+ return this.getLockType();
+ }
+
+ return this.lockTypeOnNonBeanClasses.get(klass);
+ }
+
+ /**
* Sets the bean level access timeout metadata
* @param accessTimeout {@link AccessTimeoutMetaData}
*/
More information about the jboss-cvs-commits
mailing list