[jboss-cvs] JBossAS SVN: r106339 - in projects/ejb3/trunk/core: src/main/java/org/jboss/ejb3 and 5 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Jun 30 05:31:46 EDT 2010
Author: wolfc
Date: 2010-06-30 05:31:46 -0400 (Wed, 30 Jun 2010)
New Revision: 106339
Added:
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/core/context/TxUtil.java
Modified:
projects/ejb3/trunk/core/pom.xml
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContainerInvocation.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/core/context/InvocationContextAdapter.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/core/context/SessionInvocationContextAdapter.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/mdb/MessageContainerInvocation.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionContainerInvocation.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulContainerInvocation.java
projects/ejb3/trunk/core/src/main/resources/ejb3-interceptors-aop.xml
Log:
EJBTHREE-2120: integrated ejb3-tx2
Modified: projects/ejb3/trunk/core/pom.xml
===================================================================
--- projects/ejb3/trunk/core/pom.xml 2010-06-30 09:15:37 UTC (rev 106338)
+++ projects/ejb3/trunk/core/pom.xml 2010-06-30 09:31:46 UTC (rev 106339)
@@ -17,7 +17,7 @@
<!-- Artifact Information -->
<artifactId>jboss-ejb3-core</artifactId>
<packaging>jar</packaging>
- <version>1.4.4-SNAPSHOT</version>
+ <version>1.5.0-SNAPSHOT</version>
<name>JBoss EJB 3.0 Core</name>
<url>http://labs.jboss.com/jbossejb3</url>
<description>JBoss EJB 3.0 Core</description>
@@ -45,6 +45,7 @@
<version.org.jboss.jboss-as>5.1.0.GA</version.org.jboss.jboss-as>
<version.org.jboss.security>2.0.3.SP1</version.org.jboss.security>
<version.org.jboss.ejb3_timerservice-naming>1.0.0-alpha-2</version.org.jboss.ejb3_timerservice-naming>
+ <version.org.jboss.ejb3.tx2>0.0.1-SNAPSHOT</version.org.jboss.ejb3.tx2>
<version.sun-jaxws>2.1.1</version.sun-jaxws>
</properties>
@@ -493,6 +494,12 @@
</dependency>
<dependency>
+ <groupId>org.jboss.ejb3.tx2</groupId>
+ <artifactId>jboss-ejb3-tx2-aop</artifactId>
+ <version>${version.org.jboss.ejb3.tx2}</version>
+ </dependency>
+
+ <dependency>
<groupId>org.jboss.ejb3.vfs</groupId>
<artifactId>jboss-ejb3-vfs-spi</artifactId>
<version>1.0.0-alpha-1</version>
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContainerInvocation.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContainerInvocation.java 2010-06-30 09:15:37 UTC (rev 106338)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContainerInvocation.java 2010-06-30 09:31:46 UTC (rev 106339)
@@ -35,7 +35,7 @@
* @version $Revision$
*/
public abstract class EJBContainerInvocation<A extends EJBContainer, T extends BeanContext<?>> extends ContainerMethodInvocation
- implements org.jboss.ejb3.core.context.EJBInvocation
+ implements org.jboss.ejb3.core.context.EJBInvocation, org.jboss.ejb3.tx2.aop.EJBInvocation
{
private static final long serialVersionUID = 4941832732679380382L;
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/core/context/InvocationContextAdapter.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/core/context/InvocationContextAdapter.java 2010-06-30 09:15:37 UTC (rev 106338)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/core/context/InvocationContextAdapter.java 2010-06-30 09:31:46 UTC (rev 106339)
@@ -23,11 +23,16 @@
import org.jboss.aop.joinpoint.MethodInvocation;
import org.jboss.ejb3.context.base.BaseInvocationContext;
+import org.jboss.ejb3.tx2.spi.TransactionalInvocationContext;
+import javax.ejb.ApplicationException;
+import javax.ejb.TransactionAttributeType;
+
/**
* @author <a href="cdewolf at redhat.com">Carlo de Wolf</a>
*/
public class InvocationContextAdapter extends BaseInvocationContext
+ implements TransactionalInvocationContext
{
private MethodInvocation delegate;
@@ -38,6 +43,24 @@
}
@Override
+ public ApplicationException getApplicationException(Class<?> e)
+ {
+ return TxUtil.getApplicationException(e, delegate);
+ }
+
+ @Override
+ public TransactionAttributeType getTransactionAttribute()
+ {
+ return TxUtil.getTxType(delegate);
+ }
+
+ @Override
+ public int getTransactionTimeout()
+ {
+ return TxUtil.getTransactionTimeout(delegate);
+ }
+
+ @Override
public Object proceed() throws Exception
{
try
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/core/context/SessionInvocationContextAdapter.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/core/context/SessionInvocationContextAdapter.java 2010-06-30 09:15:37 UTC (rev 106338)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/core/context/SessionInvocationContextAdapter.java 2010-06-30 09:31:46 UTC (rev 106339)
@@ -23,11 +23,16 @@
import org.jboss.aop.joinpoint.MethodInvocation;
import org.jboss.ejb3.context.base.BaseSessionInvocationContext;
+import org.jboss.ejb3.tx2.spi.TransactionalInvocationContext;
+import javax.ejb.ApplicationException;
+import javax.ejb.TransactionAttributeType;
+
/**
* @author <a href="cdewolf at redhat.com">Carlo de Wolf</a>
*/
public class SessionInvocationContextAdapter extends BaseSessionInvocationContext
+ implements TransactionalInvocationContext
{
private MethodInvocation delegate;
@@ -38,6 +43,24 @@
}
@Override
+ public ApplicationException getApplicationException(Class<?> e)
+ {
+ return TxUtil.getApplicationException(e, delegate);
+ }
+
+ @Override
+ public TransactionAttributeType getTransactionAttribute()
+ {
+ return TxUtil.getTxType(delegate);
+ }
+
+ @Override
+ public int getTransactionTimeout()
+ {
+ return TxUtil.getTransactionTimeout(delegate);
+ }
+
+ @Override
public Object proceed() throws Exception
{
try
Added: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/core/context/TxUtil.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/core/context/TxUtil.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/core/context/TxUtil.java 2010-06-30 09:31:46 UTC (rev 106339)
@@ -0,0 +1,91 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright (c) 2010, 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.ejb3.core.context;
+
+import org.jboss.aop.Advisor;
+import org.jboss.aop.joinpoint.MethodInvocation;
+import org.jboss.ejb3.annotation.TransactionTimeout;
+import org.jboss.ejb3.interceptors.aop.ExtendedAdvisor;
+
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import java.lang.reflect.Method;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ */
+public class TxUtil extends org.jboss.ejb3.tx.TxUtil
+{
+ protected static int getTransactionTimeout(MethodInvocation invocation)
+ {
+ return getTransactionTimeout(invocation.getAdvisor(), invocation.getActualMethod());
+ }
+
+ protected static int getTransactionTimeout(Advisor advisor, Method method)
+ {
+ TransactionTimeout annotation = (TransactionTimeout)advisor.resolveAnnotation(method, TransactionTimeout.class);
+
+ if (annotation == null)
+ annotation = (TransactionTimeout)advisor.resolveAnnotation(TransactionTimeout.class);
+
+ if (annotation != null)
+ {
+ return annotation.value();
+ }
+
+ return -1;
+ }
+
+ protected static TransactionAttributeType getTxType(MethodInvocation invocation)
+ {
+ return getTxType(invocation.getAdvisor(), invocation.getActualMethod());
+ }
+
+// protected static TransactionAttributeType getTxType(Advisor advisor, Method method)
+// {
+// return org.jboss.ejb3.tx.TxUtil.getTxType(advisor, method);
+// }
+
+ protected static TransactionAttributeType getTxType(Advisor advisor, Method method)
+ {
+ TransactionAttribute tx = null;
+
+ if(method != null)
+ tx = (TransactionAttribute) advisor.resolveAnnotation(method, TransactionAttribute.class);
+
+ if (tx == null)
+ {
+ if (advisor instanceof ExtendedAdvisor && method != null)
+ tx = ((ExtendedAdvisor) advisor).resolveAnnotation(method.getDeclaringClass(), TransactionAttribute.class);
+ else
+ tx = (TransactionAttribute) advisor.resolveAnnotation(TransactionAttribute.class);
+ }
+
+ TransactionAttributeType value = TransactionAttributeType.REQUIRED;
+ if (tx != null && tx.value() != null)
+ {
+ value = tx.value();
+ }
+
+ return value;
+ }
+}
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/mdb/MessageContainerInvocation.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/mdb/MessageContainerInvocation.java 2010-06-30 09:15:37 UTC (rev 106338)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/mdb/MessageContainerInvocation.java 2010-06-30 09:31:46 UTC (rev 106339)
@@ -26,9 +26,8 @@
import org.jboss.aop.joinpoint.Invocation;
import org.jboss.ejb3.BeanContext;
import org.jboss.ejb3.EJBContainerInvocation;
-import org.jboss.ejb3.context.spi.InvocationContext;
import org.jboss.ejb3.core.context.InvocationContextAdapter;
-import org.jboss.ejb3.session.SessionContainerInvocation;
+import org.jboss.ejb3.tx2.spi.TransactionalInvocationContext;
/**
* @author <a href="cdewolf at redhat.com">Carlo de Wolf</a>
@@ -62,7 +61,7 @@
}
- public InvocationContext getInvocationContext()
+ public TransactionalInvocationContext getInvocationContext()
{
return invocationContext;
}
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionContainerInvocation.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionContainerInvocation.java 2010-06-30 09:15:37 UTC (rev 106338)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionContainerInvocation.java 2010-06-30 09:31:46 UTC (rev 106339)
@@ -26,15 +26,15 @@
import org.jboss.aop.joinpoint.Invocation;
import org.jboss.ejb3.BeanContext;
import org.jboss.ejb3.EJBContainerInvocation;
-import org.jboss.ejb3.context.spi.SessionInvocationContext;
import org.jboss.ejb3.core.context.SessionInvocationContextAdapter;
+import org.jboss.ejb3.tx2.spi.TransactionalInvocationContext;
/**
* @author <a href="cdewolf at redhat.com">Carlo de Wolf</a>
*/
public class SessionContainerInvocation<A extends SessionContainer, T extends BeanContext<A>> extends EJBContainerInvocation<A, T>
{
- private SessionInvocationContext invocationContext;
+ private SessionInvocationContextAdapter invocationContext;
public SessionContainerInvocation(Class<?> invokedBusinessInterface, MethodInfo info)
{
@@ -60,8 +60,7 @@
this.interceptors = interceptors;
}
-
- public SessionInvocationContext getInvocationContext()
+ public TransactionalInvocationContext getInvocationContext()
{
return invocationContext;
}
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulContainerInvocation.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulContainerInvocation.java 2010-06-30 09:15:37 UTC (rev 106338)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulContainerInvocation.java 2010-06-30 09:31:46 UTC (rev 106339)
@@ -26,12 +26,10 @@
import org.jboss.aop.advice.Interceptor;
import org.jboss.aop.joinpoint.Invocation;
import org.jboss.ejb3.EJBContainerInvocation;
-import org.jboss.ejb3.context.base.BaseSessionInvocationContext;
-import org.jboss.ejb3.context.spi.InvocationContext;
-import org.jboss.ejb3.context.spi.SessionInvocationContext;
import org.jboss.ejb3.core.context.EJBInvocation;
import org.jboss.ejb3.core.context.SessionInvocationContextAdapter;
import org.jboss.ejb3.interceptors.container.BeanContext;
+import org.jboss.ejb3.tx2.spi.TransactionalInvocationContext;
import java.lang.reflect.Method;
@@ -47,7 +45,7 @@
private static final long serialVersionUID = -7636489066612082373L;
private Object id;
- private SessionInvocationContext invocationContext;
+ private SessionInvocationContextAdapter invocationContext;
public StatefulContainerInvocation(Interceptor[] interceptors, long methodHash, Method advisedMethod, Method unadvisedMethod, Advisor advisor, Object id, Class<?> invokedBusinessInterface)
{
@@ -83,7 +81,7 @@
return wrapper;
}
- public InvocationContext getInvocationContext()
+ public TransactionalInvocationContext getInvocationContext()
{
return invocationContext;
}
Modified: projects/ejb3/trunk/core/src/main/resources/ejb3-interceptors-aop.xml
===================================================================
--- projects/ejb3/trunk/core/src/main/resources/ejb3-interceptors-aop.xml 2010-06-30 09:15:37 UTC (rev 106338)
+++ projects/ejb3/trunk/core/src/main/resources/ejb3-interceptors-aop.xml 2010-06-30 09:31:46 UTC (rev 106339)
@@ -61,7 +61,7 @@
<interceptor class="org.jboss.ejb3.cache.StatefulReplicationInterceptor" scope="PER_VM"/>
<interceptor factory="org.jboss.ejb3.stateful.StatefulRemoveFactory" scope="PER_CLASS_JOINPOINT"/>
<interceptor factory="org.jboss.ejb3.tx.BMTTxInterceptorFactory" scope="PER_CLASS_JOINPOINT"/>
- <interceptor factory="org.jboss.ejb3.tx.CMTTxInterceptorFactory" scope="PER_CLASS_JOINPOINT"/>
+ <interceptor name="CMTTx" factory="org.jboss.ejb3.tx2.aop.CMTTxInterceptorFactory" scope="PER_CLASS"/>
<!-- interceptor factory="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory" scope="PER_CLASS_JOINPOINT"/ -->
<interceptor factory="org.jboss.ejb3.remoting.ReplicantsManagerInterceptorFactory" scope="PER_CLASS"/>
<interceptor class="org.jboss.ejb3.AllowedOperationsInterceptor" scope="PER_VM"/>
@@ -173,7 +173,7 @@
</bind>
<bind pointcut="execution(public * *->*(..))">
<interceptor-ref name="org.jboss.aspects.tx.TxPropagationInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.tx.CMTTxInterceptorFactory"/>
+ <interceptor-ref name="CMTTx"/>
<interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor"/>
<interceptor-ref name="org.jboss.ejb3.tx.BMTTxInterceptorFactory"/>
<interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
@@ -201,7 +201,7 @@
<!-- The additional SLSB specific ones -->
<interceptor-ref name="org.jboss.ejb3.ENCPropagationInterceptor"/>
<interceptor-ref name="org.jboss.aspects.tx.TxPropagationInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.tx.CMTTxInterceptorFactory"/>
+ <interceptor-ref name="CMTTx"/>
<interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor"/>
<interceptor-ref name="org.jboss.ejb3.tx.BMTTxInterceptorFactory"/>
<interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
@@ -226,7 +226,7 @@
</bind>
<bind pointcut="execution(public * *->*(..))">
<interceptor-ref name="org.jboss.aspects.tx.TxPropagationInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.tx.CMTTxInterceptorFactory"/>
+ <interceptor-ref name="CMTTx"/>
<interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor"/>
<interceptor-ref name="org.jboss.ejb3.tx.BMTTxInterceptorFactory"/>
<interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
@@ -263,7 +263,7 @@
</bind>
<bind pointcut="execution(public * *->*(..))">
<interceptor-ref name="org.jboss.aspects.tx.TxPropagationInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.tx.CMTTxInterceptorFactory"/>
+ <interceptor-ref name="CMTTx"/>
</bind>
<bind pointcut="execution(public * *->@javax.ejb.Remove(..))">
<interceptor-ref name="org.jboss.ejb3.stateful.StatefulRemoveFactory"/>
@@ -333,7 +333,7 @@
</bind>
<bind pointcut="execution(public * *->*(..))">
<interceptor-ref name="org.jboss.aspects.tx.TxPropagationInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.tx.CMTTxInterceptorFactory"/>
+ <interceptor-ref name="CMTTx"/>
</bind>
<bind pointcut="execution(public * *->@javax.ejb.Remove(..))">
<interceptor-ref name="org.jboss.ejb3.stateful.StatefulRemoveFactory"/>
@@ -395,7 +395,7 @@
</bind>
<!-- TODO: Authorization? -->
<bind pointcut="execution(public * *->*(..))">
- <interceptor-ref name="org.jboss.ejb3.tx.CMTTxInterceptorFactory"/>
+ <interceptor-ref name="CMTTx"/>
<interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor"/>
<interceptor-ref name="org.jboss.ejb3.tx.BMTTxInterceptorFactory"/>
<interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
@@ -421,7 +421,7 @@
<!-- The additional MDB specific ones -->
<interceptor-ref name="org.jboss.ejb3.ENCPropagationInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.tx.CMTTxInterceptorFactory"/>
+ <interceptor-ref name="CMTTx"/>
<interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor"/>
<interceptor-ref name="org.jboss.ejb3.tx.BMTTxInterceptorFactory"/>
<interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
@@ -437,7 +437,7 @@
<interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/>
</bind>
<bind pointcut="execution(public * *->*(..))">
- <interceptor-ref name="org.jboss.ejb3.tx.CMTTxInterceptorFactory"/>
+ <interceptor-ref name="CMTTx"/>
<interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor"/>
<interceptor-ref name="org.jboss.ejb3.tx.BMTTxInterceptorFactory"/>
<interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
@@ -462,7 +462,7 @@
<advice name="setup" aspect="InvocationContextInterceptor"/>
<!-- TODO: EJB 3.1 PFD 4.8.3: if REQUIRED then interpret as REQUIRES_NEW -->
<!--
- <interceptor-ref name="org.jboss.ejb3.tx.CMTTxInterceptorFactory"/>
+ <interceptor-ref name="CMTTx"/>
<interceptor-ref name="org.jboss.ejb3.tx.BMTTxInterceptorFactory"/>
-->
</stack>
@@ -481,7 +481,7 @@
</bind>
<bind pointcut="execution(public * *->*(..))">
<interceptor-ref name="org.jboss.aspects.tx.TxPropagationInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.tx.CMTTxInterceptorFactory"/>
+ <interceptor-ref name="CMTTx"/>
<interceptor-ref name="org.jboss.ejb3.tx.BMTTxInterceptorFactory"/>
<interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
<interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
@@ -507,7 +507,7 @@
</bind>
<bind pointcut="execution(public * *->*(..))">
<interceptor-ref name="org.jboss.aspects.tx.TxPropagationInterceptor"/>
- <interceptor-ref name="org.jboss.ejb3.tx.CMTTxInterceptorFactory"/>
+ <interceptor-ref name="CMTTx"/>
<interceptor-ref name="org.jboss.ejb3.tx.BMTTxInterceptorFactory"/>
<interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
<interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
More information about the jboss-cvs-commits
mailing list