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/08/11 18:38:04 UTC

svn commit: r1156664 - in /openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb: BeanContext.java assembler/classic/JndiBuilder.java

Author: dblevins
Date: Thu Aug 11 16:38:04 2011
New Revision: 1156664

URL: http://svn.apache.org/viewvc?rev=1156664&view=rev
Log:
Move the ProxyInterfaceResolver business inside the BeanContext and expose a much cleaner getBusinessRemoteHome(Class mainInterface) and getBusinessLocalHome(Class mainInterface)

Modified:
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/BeanContext.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiBuilder.java

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/BeanContext.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/BeanContext.java?rev=1156664&r1=1156663&r2=1156664&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/BeanContext.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/BeanContext.java Thu Aug 11 16:38:04 2011
@@ -16,6 +16,7 @@
  */
 package org.apache.openejb;
 
+import org.apache.openejb.assembler.classic.ProxyInterfaceResolver;
 import org.apache.openejb.cdi.CdiEjbBean;
 import org.apache.openejb.cdi.ConstructorInjectionBean;
 import org.apache.openejb.cdi.OWBInjector;
@@ -622,6 +623,13 @@ public class BeanContext extends Deploym
         return (BusinessLocalBeanHome) EjbHomeProxyHandler.createHomeProxy(this, InterfaceType.BUSINESS_LOCALBEAN_HOME, interfaces, this.beanClass);
     }
 
+    public BusinessLocalHome getBusinessLocalHome(Class mainInterface) {
+        List<Class> localInterfaces = this.getBusinessLocalInterfaces();
+
+        List<Class> interfaces = ProxyInterfaceResolver.getInterfaces(this.getBeanClass(), mainInterface, localInterfaces);
+        return this.getBusinessLocalHome(interfaces, mainInterface);
+    }
+    
     public BusinessLocalHome getBusinessLocalHome(List<Class> interfaces, Class mainInterface) {
         if (getBusinessLocalInterfaces().size() == 0){
             throw new IllegalStateException("This component has no business local interfaces: " + getDeploymentID());
@@ -643,6 +651,13 @@ public class BeanContext extends Deploym
         return getBusinessRemoteHome(getBusinessRemoteInterfaces(), null);
     }
 
+    public BusinessRemoteHome getBusinessRemoteHome(Class mainInterface) {
+        List<Class> remoteInterfaces = this.getBusinessRemoteInterfaces();
+
+        List<Class> interfaces = ProxyInterfaceResolver.getInterfaces(this.getBeanClass(), mainInterface, remoteInterfaces);
+        return this.getBusinessRemoteHome(interfaces, mainInterface);
+    }
+    
     public BusinessRemoteHome getBusinessRemoteHome(List<Class> interfaces, Class mainInterface) {
         if (getBusinessRemoteInterfaces().size() == 0){
             throw new IllegalStateException("This component has no business remote interfaces: " + getDeploymentID());

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiBuilder.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiBuilder.java?rev=1156664&r1=1156663&r2=1156664&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiBuilder.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiBuilder.java Thu Aug 11 16:38:04 2011
@@ -413,13 +413,10 @@ public class JndiBuilder {
         }
 
         try {
-            List<Class> localInterfaces = bean.getBusinessLocalInterfaces();
-            Class beanClass = bean.getBeanClass();
 
             for (Class interfce : bean.getBusinessLocalInterfaces()) {
 
-                List<Class> interfaces = ProxyInterfaceResolver.getInterfaces(beanClass, interfce, localInterfaces);
-                BeanContext.BusinessLocalHome home = bean.getBusinessLocalHome(interfaces, interfce);
+                BeanContext.BusinessLocalHome home = bean.getBusinessLocalHome(interfce);
                 BusinessLocalReference ref = new BusinessLocalReference(home);
 
                 optionalBind(bindings, ref, "openejb/Deployment/" + format(bean.getDeploymentID(), interfce.getName()));
@@ -439,13 +436,9 @@ public class JndiBuilder {
 
         try {
 
-            List<Class> remoteInterfaces = bean.getBusinessRemoteInterfaces();
-            Class beanClass = bean.getBeanClass();
-
             for (Class interfce : bean.getBusinessRemoteInterfaces()) {
 
-                List<Class> interfaces = ProxyInterfaceResolver.getInterfaces(beanClass, interfce, remoteInterfaces);
-                BeanContext.BusinessRemoteHome home = bean.getBusinessRemoteHome(interfaces, interfce);
+                BeanContext.BusinessRemoteHome home = bean.getBusinessRemoteHome(interfce);
                 BusinessRemoteReference ref = new BusinessRemoteReference(home);
 
                 optionalBind(bindings, ref, "openejb/Deployment/" + format(bean.getDeploymentID(), interfce.getName(), null));