You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2011/06/06 21:24:08 UTC
svn commit: r1132732 - in
/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core:
cmp/CmpContainer.java entity/EntityContainer.java
Author: dblevins
Date: Mon Jun 6 19:24:08 2011
New Revision: 1132732
URL: http://svn.apache.org/viewvc?rev=1132732&view=rev
Log:
CMP/BMP related tweaks for OPENEJB-1567: Overriding of per-interface transaction attributes only
Modified:
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/CmpContainer.java
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityContainer.java
Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/CmpContainer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/CmpContainer.java?rev=1132732&r1=1132731&r2=1132732&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/CmpContainer.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/CmpContainer.java Mon Jun 6 19:24:08 2011
@@ -254,20 +254,20 @@ public class CmpContainer implements Rpc
if (EJBHome.class.isAssignableFrom(declaringClass) || EJBLocalHome.class.isAssignableFrom(declaringClass)) {
if (declaringClass != EJBHome.class && declaringClass != EJBLocalHome.class) {
if (methodName.startsWith("create")) {
- return createEJBObject(callMethod, args, callContext);
+ return createEJBObject(callMethod, args, callContext, type);
} else if (methodName.equals("findByPrimaryKey")) {
- return findByPrimaryKey(callMethod, args, callContext);
+ return findByPrimaryKey(callMethod, args, callContext, type);
} else if (methodName.startsWith("find")) {
- return findEJBObject(callMethod, args, callContext);
+ return findEJBObject(callMethod, args, callContext, type);
} else {
- return homeMethod(callMethod, args, callContext);
+ return homeMethod(callMethod, args, callContext, type);
}
} else if (methodName.equals("remove")) {
- removeEJBObject(callMethod, callContext);
+ removeEJBObject(callMethod, callContext, type);
return null;
}
} else if ((EJBObject.class == declaringClass || EJBLocalObject.class == declaringClass) && methodName.equals("remove")) {
- removeEJBObject(callMethod, callContext);
+ removeEJBObject(callMethod, callContext, type);
return null;
}
@@ -277,7 +277,7 @@ public class CmpContainer implements Rpc
callContext.set(Method.class, runMethod);
- Object retValue = businessMethod(callMethod, runMethod, args, callContext);
+ Object retValue = businessMethod(callMethod, runMethod, args, callContext, type);
return retValue;
} finally {
@@ -465,10 +465,10 @@ public class CmpContainer implements Rpc
}
}
- private Object businessMethod(Method callMethod, Method runMethod, Object[] args, ThreadContext callContext) throws OpenEJBException {
+ private Object businessMethod(Method callMethod, Method runMethod, Object[] args, ThreadContext callContext, InterfaceType interfaceType) throws OpenEJBException {
BeanContext beanContext = callContext.getBeanContext();
- TransactionPolicy txPolicy = createTransactionPolicy(beanContext.getTransactionType(callMethod), callContext);
+ TransactionPolicy txPolicy = createTransactionPolicy(beanContext.getTransactionType(callMethod, interfaceType), callContext);
EntityBean bean;
Object returnValue = null;
@@ -507,10 +507,10 @@ public class CmpContainer implements Rpc
return returnValue;
}
- private Object homeMethod(Method callMethod, Object[] args, ThreadContext callContext) throws OpenEJBException {
+ private Object homeMethod(Method callMethod, Object[] args, ThreadContext callContext, InterfaceType interfaceType) throws OpenEJBException {
BeanContext beanContext = callContext.getBeanContext();
- TransactionPolicy txPolicy = createTransactionPolicy(beanContext.getTransactionType(callMethod), callContext);
+ TransactionPolicy txPolicy = createTransactionPolicy(beanContext.getTransactionType(callMethod, interfaceType), callContext);
EntityBean bean;
Object returnValue = null;
@@ -562,10 +562,10 @@ public class CmpContainer implements Rpc
return returnValue;
}
- private ProxyInfo createEJBObject(Method callMethod, Object[] args, ThreadContext callContext) throws OpenEJBException {
+ private ProxyInfo createEJBObject(Method callMethod, Object[] args, ThreadContext callContext, InterfaceType interfaceType) throws OpenEJBException {
BeanContext beanContext = callContext.getBeanContext();
- TransactionPolicy txPolicy = createTransactionPolicy(beanContext.getTransactionType(callMethod), callContext);
+ TransactionPolicy txPolicy = createTransactionPolicy(beanContext.getTransactionType(callMethod, interfaceType), callContext);
EntityBean bean;
Object primaryKey = null;
@@ -633,10 +633,10 @@ public class CmpContainer implements Rpc
return new ProxyInfo(beanContext, primaryKey);
}
- private Object findByPrimaryKey(Method callMethod, Object[] args, ThreadContext callContext) throws OpenEJBException {
+ private Object findByPrimaryKey(Method callMethod, Object[] args, ThreadContext callContext, InterfaceType interfaceType) throws OpenEJBException {
BeanContext beanContext = callContext.getBeanContext();
- TransactionPolicy txPolicy = createTransactionPolicy(beanContext.getTransactionType(callMethod), callContext);
+ TransactionPolicy txPolicy = createTransactionPolicy(beanContext.getTransactionType(callMethod, interfaceType), callContext);
try {
EntityBean bean = (EntityBean) cmpEngine.loadBean(callContext, args[0]);
@@ -660,10 +660,10 @@ public class CmpContainer implements Rpc
throw new AssertionError("Should not get here");
}
- private Object findEJBObject(Method callMethod, Object[] args, ThreadContext callContext) throws OpenEJBException {
+ private Object findEJBObject(Method callMethod, Object[] args, ThreadContext callContext, InterfaceType interfaceType) throws OpenEJBException {
BeanContext beanContext = callContext.getBeanContext();
- TransactionPolicy txPolicy = createTransactionPolicy(beanContext.getTransactionType(callMethod), callContext);
+ TransactionPolicy txPolicy = createTransactionPolicy(beanContext.getTransactionType(callMethod, interfaceType), callContext);
try {
List<Object> results = cmpEngine.queryBeans(callContext, callMethod, args);
@@ -794,10 +794,10 @@ public class CmpContainer implements Rpc
return result;
}
- private void removeEJBObject(Method callMethod, ThreadContext callContext) throws OpenEJBException {
+ private void removeEJBObject(Method callMethod, ThreadContext callContext, InterfaceType interfaceType) throws OpenEJBException {
BeanContext beanContext = callContext.getBeanContext();
- TransactionPolicy txPolicy = createTransactionPolicy(beanContext.getTransactionType(callMethod), callContext);
+ TransactionPolicy txPolicy = createTransactionPolicy(beanContext.getTransactionType(callMethod, interfaceType), callContext);
try {
EntityBean entityBean = (EntityBean) cmpEngine.loadBean(callContext, callContext.getPrimaryKey());
Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityContainer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityContainer.java?rev=1132732&r1=1132731&r2=1132732&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityContainer.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityContainer.java Mon Jun 6 19:24:08 2011
@@ -171,20 +171,20 @@ public class EntityContainer implements
if (methodName.startsWith("create")) {
- return createEJBObject(callMethod, args, callContext);
+ return createEJBObject(callMethod, args, callContext, type);
} else if (methodName.startsWith("find")) {
- return findMethod(callMethod, args, callContext);
+ return findMethod(callMethod, args, callContext, type);
} else {
- return homeMethod(callMethod, args, callContext);
+ return homeMethod(callMethod, args, callContext, type);
}
} else if (methodName.equals("remove")) {
- removeEJBObject(callMethod, args, callContext);
+ removeEJBObject(callMethod, args, callContext, type);
return null;
}
} else if ((EJBObject.class == declaringClass || EJBLocalObject.class == declaringClass) && methodName.equals("remove")) {
- removeEJBObject(callMethod, args, callContext);
+ removeEJBObject(callMethod, args, callContext, type);
return null;
}
@@ -193,7 +193,7 @@ public class EntityContainer implements
callContext.set(Method.class, runMethod);
- Object retValue = invoke(callMethod, runMethod, args, callContext);
+ Object retValue = invoke(type, callMethod, runMethod, args, callContext);
return retValue;
@@ -210,9 +210,9 @@ public class EntityContainer implements
return instanceManager;
}
- protected Object invoke(Method callMethod, Method runMethod, Object [] args, ThreadContext callContext) throws OpenEJBException {
+ protected Object invoke(InterfaceType type, Method callMethod, Method runMethod, Object[] args, ThreadContext callContext) throws OpenEJBException {
BeanContext beanContext = callContext.getBeanContext();
- TransactionPolicy txPolicy = createTransactionPolicy(beanContext.getTransactionType(callMethod), callContext);
+ TransactionPolicy txPolicy = createTransactionPolicy(beanContext.getTransactionType(callMethod, type), callContext);
EntityBean bean = null;
@@ -296,7 +296,7 @@ public class EntityContainer implements
protected void didCreateBean(ThreadContext callContext, EntityBean bean) throws OpenEJBException {
}
- protected ProxyInfo createEJBObject(Method callMethod, Object [] args, ThreadContext callContext) throws OpenEJBException {
+ protected ProxyInfo createEJBObject(Method callMethod, Object[] args, ThreadContext callContext, InterfaceType type) throws OpenEJBException {
BeanContext beanContext = callContext.getBeanContext();
callContext.setCurrentOperation(Operation.CREATE);
@@ -315,7 +315,7 @@ public class EntityContainer implements
* super classes afterInvoke( ) method will be executed committing the transaction if its a CMT.
*/
- TransactionPolicy txPolicy = createTransactionPolicy(beanContext.getTransactionType(callMethod), callContext);
+ TransactionPolicy txPolicy = createTransactionPolicy(beanContext.getTransactionType(callMethod, type), callContext);
EntityBean bean = null;
Object primaryKey = null;
@@ -365,11 +365,11 @@ public class EntityContainer implements
}
- protected Object findMethod(Method callMethod, Object [] args, ThreadContext callContext) throws OpenEJBException {
+ protected Object findMethod(Method callMethod, Object[] args, ThreadContext callContext, InterfaceType type) throws OpenEJBException {
BeanContext beanContext = callContext.getBeanContext();
callContext.setCurrentOperation(Operation.FIND);
Method runMethod = beanContext.getMatchingBeanMethod(callMethod);
- Object returnValue = invoke(callMethod, runMethod, args, callContext);
+ Object returnValue = invoke(type, callMethod, runMethod, args, callContext);
/*
* Find operations return either a single primary key or a collection of primary keys.
@@ -397,11 +397,11 @@ public class EntityContainer implements
return returnValue;
}
- protected Object homeMethod(Method callMethod, Object [] args, ThreadContext callContext) throws OpenEJBException {
+ protected Object homeMethod(Method callMethod, Object[] args, ThreadContext callContext, InterfaceType type) throws OpenEJBException {
BeanContext beanContext = callContext.getBeanContext();
callContext.setCurrentOperation(Operation.HOME);
Method runMethod = beanContext.getMatchingBeanMethod(callMethod);
- return invoke(callMethod, runMethod, args, callContext);
+ return invoke(type, callMethod, runMethod, args, callContext);
}
protected void didRemove(EntityBean bean, ThreadContext threadContext) throws OpenEJBException {
@@ -423,11 +423,11 @@ public class EntityContainer implements
}
}
- protected void removeEJBObject(Method callMethod, Object [] args, ThreadContext callContext) throws OpenEJBException {
+ protected void removeEJBObject(Method callMethod, Object[] args, ThreadContext callContext, InterfaceType type) throws OpenEJBException {
callContext.setCurrentOperation(Operation.REMOVE);
BeanContext beanContext = callContext.getBeanContext();
- TransactionPolicy txPolicy = createTransactionPolicy(beanContext.getTransactionType(callMethod), callContext);
+ TransactionPolicy txPolicy = createTransactionPolicy(beanContext.getTransactionType(callMethod, type), callContext);
EntityBean bean = null;
try {