dblevins 2004/08/26 02:00:46
Modified: modules/core/src/java/org/openejb/core/entity
EntityContainer.java
Log:
Correctly handles local interfaces
Revision Changes Path
1.2 +12 -6
openejb1/modules/core/src/java/org/openejb/core/entity/EntityContainer.java
Index: EntityContainer.java
===================================================================
RCS file:
/home/projects/openejb/scm/openejb1/modules/core/src/java/org/openejb/core/entity/EntityContainer.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- EntityContainer.java 26 Mar 2004 21:42:24 -0000 1.1
+++ EntityContainer.java 26 Aug 2004 06:00:46 -0000 1.2
@@ -50,6 +50,7 @@
import java.util.Properties;
import javax.ejb.EJBHome;
+import javax.ejb.EJBLocalHome;
import javax.ejb.EJBObject;
import javax.ejb.EnterpriseBean;
import javax.ejb.EntityBean;
@@ -240,8 +241,8 @@
throw new org.openejb.ApplicationException(new
RemoteException("Unauthorized Access by Principal Denied"));
// process home interface methods
- if(EJBHome.class.isAssignableFrom(callMethod.getDeclaringClass())){
- if(callMethod.getDeclaringClass()!= EJBHome.class){
+ if(EJBHome.class.isAssignableFrom(callMethod.getDeclaringClass()) ||
EJBLocalHome.class.isAssignableFrom(callMethod.getDeclaringClass()) ){
+ if(callMethod.getDeclaringClass() != EJBHome.class &&
callMethod.getDeclaringClass() != EJBLocalHome.class){
// Its a home interface method, which is declared by the bean provider,
but not a EJBHome method.
// only create(), find<METHOD>( ) and home business methods are
declared by the bean provider.
if(callMethod.getName().equals("create")){
@@ -258,7 +259,7 @@
removeEJBObject(callMethod, args, callContext);
return null;
}
- }else if(EJBObject.class == callMethod.getDeclaringClass()){
+ } else if(EJBObject.class == callMethod.getDeclaringClass()){
removeEJBObject(callMethod, args, callContext);
return null;
}
@@ -510,8 +511,13 @@
txPolicy.afterInvoke( bean, txContext );
}
+ Class callingClass = callMethod.getDeclaringClass();
+ if (EJBLocalHome.class.isAssignableFrom(callingClass)) {
+ return new ProxyInfo(deploymentInfo, primaryKey,
deploymentInfo.getLocalInterface(), this);
+ } else {
+ return new ProxyInfo(deploymentInfo, primaryKey,
deploymentInfo.getRemoteInterface(), this);
+ }
- return new ProxyInfo(deploymentInfo, primaryKey,
deploymentInfo.getRemoteInterface(), this);
}
/**