[jboss-cvs] JBossAS SVN: r73675 - in projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session: stateful and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon May 26 01:33:02 EDT 2008


Author: ALRubinger
Date: 2008-05-26 01:33:01 -0400 (Mon, 26 May 2008)
New Revision: 73675

Modified:
   projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/SessionProxyInvocationHandlerBase.java
   projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateful/StatefulProxyInvocationHandler.java
   projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateless/StatelessProxyInvocationHandler.java
Log:
[EJBTHREE-1345] Centralize Session Bean InvocationHandler.invoke() logic for SLSB and SFSB

Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/SessionProxyInvocationHandlerBase.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/SessionProxyInvocationHandlerBase.java	2008-05-26 05:29:07 UTC (rev 73674)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/SessionProxyInvocationHandlerBase.java	2008-05-26 05:33:01 UTC (rev 73675)
@@ -21,7 +21,18 @@
  */
 package org.jboss.ejb3.proxy.handler.session;
 
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
+import org.jboss.ejb3.common.string.StringUtils;
+import org.jboss.ejb3.proxy.container.InvokableContext;
+import org.jboss.ejb3.proxy.handler.NotEligibleForDirectInvocationException;
 import org.jboss.ejb3.proxy.handler.ProxyInvocationHandlerBase;
+import org.jboss.ejb3.proxy.lang.SerializableMethod;
+import org.jboss.logging.Logger;
 
 /**
  * SessionProxyInvocationHandlerBase
@@ -37,6 +48,12 @@
          SessionProxyInvocationHandler
 {
    // ------------------------------------------------------------------------------||
+   // Class Members ----------------------------------------------------------------||
+   // ------------------------------------------------------------------------------||
+
+   private static final Logger log = Logger.getLogger(SessionProxyInvocationHandlerBase.class);
+
+   // ------------------------------------------------------------------------------||
    // Constructor ------------------------------------------------------------------||
    // ------------------------------------------------------------------------------||
 
@@ -47,4 +64,49 @@
    {
       super();
    }
+
+   // ------------------------------------------------------------------------------||
+   // Required Implementations -----------------------------------------------------||
+   // ------------------------------------------------------------------------------||
+
+   public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
+   {
+      // Set the invoked method
+      SerializableMethod invokedMethod = new SerializableMethod(method);
+      this.setInvokedMethod(invokedMethod);
+
+      // Attempt to handle directly
+      try
+      {
+         return this.handleInvocationDirectly(proxy, args);
+      }
+      // Ignore this, we just couldn't handle here
+      catch (NotEligibleForDirectInvocationException nefdie)
+      {
+         log.debug("Couldn't handle invocation directly within Proxy " + InvocationHandler.class.getName() + ": "
+               + nefdie.getMessage());
+      }
+
+      // Obtain container name
+      String containerName = StringUtils.adjustWhitespaceStringToNull(this.getContainerName());
+      assert containerName != null : "Container name for invocation must be specified";
+
+      // Assemble arguments for invocation
+      List<Object> invocationArguments = new ArrayList<Object>();
+      // Add proxy as argument
+      invocationArguments.add(proxy);
+      // Add invoked method as argument
+      invocationArguments.add(invokedMethod);
+      // Add rest of arguments
+      invocationArguments.add(args);
+
+      // Invoke
+      //TODO This won't fly for remote, Object Store would be on another Process
+      log.debug("Invoking on Bean with name \"" + this.getContainerName() + "\" method \""
+            + InvokableContext.METHOD_NAME_INVOKE + "\" with arguments : " + invocationArguments);
+      return Ejb3RegistrarLocator.locateRegistrar().invoke(this.getContainerName(),
+            InvokableContext.METHOD_NAME_INVOKE, invocationArguments.toArray(new Object[]
+            {}), InvokableContext.METHOD_SIGNATURE_INVOKE);
+
+   }
 }

Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateful/StatefulProxyInvocationHandler.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateful/StatefulProxyInvocationHandler.java	2008-05-26 05:29:07 UTC (rev 73674)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateful/StatefulProxyInvocationHandler.java	2008-05-26 05:33:01 UTC (rev 73675)
@@ -93,53 +93,6 @@
    // Required Implementations -----------------------------------------------------||
    // ------------------------------------------------------------------------------||
 
-   public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
-   {
-      //TODO 
-      /*
-       * THE FOLLOWING IS A COPY OF THE SLSB IMPLEMENTATION, MUST IMPLEMENT FOR SFSB
-       */
-      log.warn(StatefulProxyInvocationHandler.class.getSimpleName() + " is using SLSB Implementation Copy.");
-
-      // Set the invoked method
-      SerializableMethod invokedMethod = new SerializableMethod(method);
-      this.setInvokedMethod(invokedMethod);
-
-      // Attempt to handle directly
-      try
-      {
-         return this.handleInvocationDirectly(proxy, args);
-      }
-      // Ignore this, we just couldn't handle here
-      catch (NotEligibleForDirectInvocationException nefdie)
-      {
-         log.debug("Couldn't handle invocation directly within Proxy " + InvocationHandler.class.getName() + ": "
-               + nefdie.getMessage());
-      }
-
-      // Obtain container name
-      String containerName = StringUtils.adjustWhitespaceStringToNull(this.getContainerName());
-      assert containerName != null : "Container name for invocation must be specified";
-
-      // Assemble arguments for invocation
-      List<Object> invocationArguments = new ArrayList<Object>();
-      // Add proxy as argument
-      invocationArguments.add(proxy);
-      // Add invoked method as argument
-      invocationArguments.add(invokedMethod);
-      // Add rest of arguments
-      invocationArguments.add(args);
-
-      // Invoke
-      //TODO This won't fly for remote, Object Store would be on another Process
-      log.debug("Invoking on Bean with name \"" + this.getContainerName() + "\" method \""
-            + InvokableContext.METHOD_NAME_INVOKE + "\" with arguments : " + invocationArguments);
-      return Ejb3RegistrarLocator.locateRegistrar().invoke(this.getContainerName(),
-            InvokableContext.METHOD_NAME_INVOKE, invocationArguments.toArray(new Object[]
-            {}), InvokableContext.METHOD_SIGNATURE_INVOKE);
-
-   }
-
    /**
     * Obtains the Session ID for this SFSB instance
     * 

Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateless/StatelessProxyInvocationHandler.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateless/StatelessProxyInvocationHandler.java	2008-05-26 05:29:07 UTC (rev 73674)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateless/StatelessProxyInvocationHandler.java	2008-05-26 05:33:01 UTC (rev 73675)
@@ -22,17 +22,9 @@
 package org.jboss.ejb3.proxy.handler.session.stateless;
 
 import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
-import java.util.ArrayList;
-import java.util.List;
 
-import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
-import org.jboss.ejb3.common.string.StringUtils;
-import org.jboss.ejb3.proxy.container.InvokableContext;
-import org.jboss.ejb3.proxy.handler.NotEligibleForDirectInvocationException;
 import org.jboss.ejb3.proxy.handler.session.SessionSpecProxyInvocationHandlerBase;
-import org.jboss.ejb3.proxy.lang.SerializableMethod;
 import org.jboss.logging.Logger;
 import org.jboss.util.NotImplementedException;
 
@@ -81,47 +73,6 @@
    // Required Implementations -----------------------------------------------------||
    // ------------------------------------------------------------------------------||
 
-   public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
-   {
-      // Set the invoked method
-      SerializableMethod invokedMethod = new SerializableMethod(method);
-      this.setInvokedMethod(invokedMethod);
-
-      // Attempt to handle directly
-      try
-      {
-         return this.handleInvocationDirectly(proxy, args);
-      }
-      // Ignore this, we just couldn't handle here
-      catch (NotEligibleForDirectInvocationException nefdie)
-      {
-         log.debug("Couldn't handle invocation directly within Proxy " + InvocationHandler.class.getName() + ": "
-               + nefdie.getMessage());
-      }
-
-      // Obtain container name
-      String containerName = StringUtils.adjustWhitespaceStringToNull(this.getContainerName());
-      assert containerName != null : "Container name for invocation must be specified";
-
-      // Assemble arguments for invocation
-      List<Object> invocationArguments = new ArrayList<Object>();
-      // Add proxy as argument
-      invocationArguments.add(proxy);
-      // Add invoked method as argument
-      invocationArguments.add(invokedMethod);
-      // Add rest of arguments
-      invocationArguments.add(args);
-
-      // Invoke
-      //TODO This won't fly for remote, Object Store would be on another Process
-      log.debug("Invoking on Bean with name \"" + this.getContainerName() + "\" method \""
-            + InvokableContext.METHOD_NAME_INVOKE + "\" with arguments : " + invocationArguments);
-      return Ejb3RegistrarLocator.locateRegistrar().invoke(this.getContainerName(),
-            InvokableContext.METHOD_NAME_INVOKE, invocationArguments.toArray(new Object[]
-            {}), InvokableContext.METHOD_SIGNATURE_INVOKE);
-
-   }
-
    /**
     * Handles invocation of "equals(Object)" upon a SLSB Proxy
     * 




More information about the jboss-cvs-commits mailing list