[jboss-cvs] JBossAS SVN: r76730 - in projects/ejb3/trunk/proxy/src: main/java/org/jboss/ejb3/proxy/factory/session/stateless and 8 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Aug 6 17:46:07 EDT 2008
Author: ALRubinger
Date: 2008-08-06 17:46:07 -0400 (Wed, 06 Aug 2008)
New Revision: 76730
Modified:
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateful/StatefulSessionLocalProxyFactory.java
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateful/StatefulSessionRemoteProxyFactory.java
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateless/StatelessSessionLocalProxyFactory.java
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateless/StatelessSessionRemoteProxyFactory.java
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandler.java
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandlerBase.java
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/SessionProxyInvocationHandler.java
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/SessionSpecProxyInvocationHandlerBase.java
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateful/StatefulLocalProxyInvocationHandler.java
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateful/StatefulProxyInvocationHandlerBase.java
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateful/StatefulRemoteProxyInvocationHandler.java
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateless/StatelessLocalProxyInvocationHandler.java
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateless/StatelessProxyInvocationHandlerBase.java
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateless/StatelessRemoteProxyInvocationHandler.java
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/invocation/InvokableContextStatefulRemoteProxyInvocationHack.java
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/objectfactory/session/SessionProxyObjectFactory.java
projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/spec_3_4_5/ProxyEqualityTestCaseBase.java
projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/spec_3_4_5/unit/SfsbProxyEqualityTestCase.java
projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/spec_3_4_5/unit/SlsbProxyEqualityTestCase.java
Log:
[EJBTHREE-1345] Clean up the API to abstract target containerName, containerName on Handlers to be set by ProxyFactory only
Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateful/StatefulSessionLocalProxyFactory.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateful/StatefulSessionLocalProxyFactory.java 2008-08-06 21:45:47 UTC (rev 76729)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateful/StatefulSessionLocalProxyFactory.java 2008-08-06 21:46:07 UTC (rev 76730)
@@ -23,10 +23,6 @@
import java.util.Set;
-import org.jboss.ejb3.common.registrar.spi.Ejb3Registrar;
-import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
-import org.jboss.ejb3.common.registrar.spi.NotBoundException;
-import org.jboss.ejb3.proxy.container.StatefulSessionInvokableContext;
import org.jboss.ejb3.proxy.factory.session.SessionProxyFactory;
import org.jboss.ejb3.proxy.handler.session.SessionProxyInvocationHandler;
import org.jboss.ejb3.proxy.handler.session.stateful.StatefulLocalProxyInvocationHandler;
@@ -110,8 +106,12 @@
@Override
protected SessionProxyInvocationHandler createInvocationHandler(String businessInterfaceName)
{
+ // Obtain target container name
+ String containerName = this.getContainerName();
+
// Create
- SessionProxyInvocationHandler handler = new StatefulLocalProxyInvocationHandler(businessInterfaceName);
+ SessionProxyInvocationHandler handler = new StatefulLocalProxyInvocationHandler(containerName,
+ businessInterfaceName);
// Return
return handler;
Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateful/StatefulSessionRemoteProxyFactory.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateful/StatefulSessionRemoteProxyFactory.java 2008-08-06 21:45:47 UTC (rev 76729)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateful/StatefulSessionRemoteProxyFactory.java 2008-08-06 21:46:07 UTC (rev 76730)
@@ -134,9 +134,13 @@
@Override
protected SessionProxyInvocationHandler createInvocationHandler(String businessInterfaceName)
{
+ // Obtain target properties
+ String containterName = this.getContainerName();
+ String url = this.getUrl();
+
// Create
- SessionProxyInvocationHandler handler = new StatefulRemoteProxyInvocationHandler(businessInterfaceName, this
- .getUrl());
+ SessionProxyInvocationHandler handler = new StatefulRemoteProxyInvocationHandler(containterName,
+ businessInterfaceName, url);
// Return
return handler;
Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateless/StatelessSessionLocalProxyFactory.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateless/StatelessSessionLocalProxyFactory.java 2008-08-06 21:45:47 UTC (rev 76729)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateless/StatelessSessionLocalProxyFactory.java 2008-08-06 21:46:07 UTC (rev 76730)
@@ -109,8 +109,12 @@
@Override
protected SessionProxyInvocationHandler createInvocationHandler(String businessInterfaceName)
{
+ // Obtain container name
+ String containerName = this.getContainerName();
+
// Create
- SessionProxyInvocationHandler handler = new StatelessLocalProxyInvocationHandler(businessInterfaceName);
+ SessionProxyInvocationHandler handler = new StatelessLocalProxyInvocationHandler(containerName,
+ businessInterfaceName);
// Return
return handler;
Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateless/StatelessSessionRemoteProxyFactory.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateless/StatelessSessionRemoteProxyFactory.java 2008-08-06 21:45:47 UTC (rev 76729)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateless/StatelessSessionRemoteProxyFactory.java 2008-08-06 21:46:07 UTC (rev 76730)
@@ -125,8 +125,8 @@
protected String getInterceptorStackName()
{
return StatelessSessionRemoteProxyFactory.STACK_NAME_STATELESS_SESSION_CLIENT_INTERCEPTORS;
- }
-
+ }
+
// --------------------------------------------------------------------------------||
// Required Implementations -------------------------------------------------------||
// --------------------------------------------------------------------------------||
@@ -134,9 +134,13 @@
@Override
protected SessionProxyInvocationHandler createInvocationHandler(String businessInterfaceName)
{
+ // Obtain properties
+ String containerName = this.getContainerName();
+ String url = this.getUrl();
+
// Create
- SessionProxyInvocationHandler handler = new StatelessRemoteProxyInvocationHandler(businessInterfaceName, this
- .getUrl());
+ SessionProxyInvocationHandler handler = new StatelessRemoteProxyInvocationHandler(containerName,
+ businessInterfaceName, url);
// Return
return handler;
@@ -151,7 +155,7 @@
return url;
}
- public void setUrl(String url)
+ public void setUrl(final String url)
{
this.url = url;
}
Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandler.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandler.java 2008-08-06 21:45:47 UTC (rev 76729)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandler.java 2008-08-06 21:46:07 UTC (rev 76730)
@@ -48,18 +48,4 @@
*/
SerializableMethod getInvokedMethod();
- /**
- * Get the target container name
- *
- * @return
- */
- String getContainerName();
-
- /**
- * Sets the target container name
- *
- * @param containerName
- */
- void setContainerName(String containerName);
-
}
\ No newline at end of file
Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandlerBase.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandlerBase.java 2008-08-06 21:45:47 UTC (rev 76729)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandlerBase.java 2008-08-06 21:46:07 UTC (rev 76730)
@@ -97,9 +97,12 @@
/**
* Constructor
+ *
+ * @param containerName The name of the target container
*/
- protected ProxyInvocationHandlerBase()
+ protected ProxyInvocationHandlerBase(final String containerName)
{
+ this.setContainerName(containerName);
}
// ------------------------------------------------------------------------------||
@@ -185,13 +188,14 @@
this.invokedMethod = invokedMethod;
}
- public String getContainerName()
+ protected String getContainerName()
{
return containerName;
}
- public void setContainerName(String containerName)
+ protected void setContainerName(final String containerName)
{
+ assert containerName != null && containerName.trim().length() > 0 : "Container Name must be specified";
this.containerName = containerName;
}
}
Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/SessionProxyInvocationHandler.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/SessionProxyInvocationHandler.java 2008-08-06 21:45:47 UTC (rev 76729)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/SessionProxyInvocationHandler.java 2008-08-06 21:46:07 UTC (rev 76730)
@@ -38,10 +38,5 @@
*/
public interface SessionProxyInvocationHandler extends ProxyInvocationHandler, InvocationHandler, Serializable
{
- /**
- * Sets the target container name
- *
- * @param containerName
- */
- void setContainerName(String containerName);
+
}
\ No newline at end of file
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-08-06 21:45:47 UTC (rev 76729)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/SessionProxyInvocationHandlerBase.java 2008-08-06 21:46:07 UTC (rev 76730)
@@ -21,20 +21,11 @@
*/
package org.jboss.ejb3.proxy.handler.session;
-import java.lang.reflect.Proxy;
-import java.net.MalformedURLException;
-
-import org.jboss.aop.advice.Interceptor;
-import org.jboss.aspects.remoting.InvokeRemoteInterceptor;
-import org.jboss.aspects.remoting.PojiProxy;
import org.jboss.ejb3.common.registrar.spi.Ejb3Registrar;
import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
import org.jboss.ejb3.proxy.container.InvokableContext;
import org.jboss.ejb3.proxy.handler.ProxyInvocationHandlerBase;
-import org.jboss.ejb3.proxy.invocation.InvokableContextStatefulRemoteProxyInvocationHack;
-import org.jboss.ejb3.proxy.remoting.IsLocalProxyFactoryInterceptor;
import org.jboss.logging.Logger;
-import org.jboss.remoting.InvokerLocator;
/**
* SessionProxyInvocationHandlerBase
@@ -63,10 +54,12 @@
/**
* Constructor
+ *
+ * @param containerName The name of the target Container
*/
- protected SessionProxyInvocationHandlerBase()
+ protected SessionProxyInvocationHandlerBase(final String containerName)
{
- super();
+ super(containerName);
}
/**
Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/SessionSpecProxyInvocationHandlerBase.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/SessionSpecProxyInvocationHandlerBase.java 2008-08-06 21:45:47 UTC (rev 76729)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/SessionSpecProxyInvocationHandlerBase.java 2008-08-06 21:46:07 UTC (rev 76730)
@@ -70,9 +70,9 @@
* marking this invocation hander as specific to a given
* EJB3 Business Interface
*/
- protected SessionSpecProxyInvocationHandlerBase(String businessInterfaceType)
+ protected SessionSpecProxyInvocationHandlerBase(final String containerName, final String businessInterfaceType)
{
- super();
+ super(containerName);
this.setBusinessInterfaceType(businessInterfaceType);
}
Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateful/StatefulLocalProxyInvocationHandler.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateful/StatefulLocalProxyInvocationHandler.java 2008-08-06 21:45:47 UTC (rev 76729)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateful/StatefulLocalProxyInvocationHandler.java 2008-08-06 21:46:07 UTC (rev 76730)
@@ -45,13 +45,14 @@
/**
* Constructor
*
+ * @param containerName The name of the target container
* @param businessInterfaceType The possibly null businessInterfaceType
* marking this invocation hander as specific to a given
* EJB3 Business Interface
*/
- public StatefulLocalProxyInvocationHandler(String businessInterfaceType)
+ public StatefulLocalProxyInvocationHandler(final String containerName, final String businessInterfaceType)
{
- super(businessInterfaceType);
+ super(containerName, businessInterfaceType);
}
// --------------------------------------------------------------------------------||
Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateful/StatefulProxyInvocationHandlerBase.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateful/StatefulProxyInvocationHandlerBase.java 2008-08-06 21:45:47 UTC (rev 76729)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateful/StatefulProxyInvocationHandlerBase.java 2008-08-06 21:46:07 UTC (rev 76730)
@@ -75,13 +75,14 @@
/**
* Constructor
*
+ * @param containerName The name of the target container
* @param businessInterfaceType The possibly null businessInterfaceType
* marking this invocation hander as specific to a given
* EJB3 Business Interface
*/
- public StatefulProxyInvocationHandlerBase(String businessInterfaceType)
+ public StatefulProxyInvocationHandlerBase(final String containerName, final String businessInterfaceType)
{
- super(businessInterfaceType);
+ super(containerName, businessInterfaceType);
}
// ------------------------------------------------------------------------------||
@@ -219,6 +220,8 @@
// Create a POJI Proxy to the Container
Interceptor[] interceptors =
{IsLocalProxyFactoryInterceptor.singleton, InvokeRemoteInterceptor.singleton};
+ String containerName = this.getContainerName();
+ assert containerName != null && containerName.trim().length() > 0 : "Container Name must be set";
PojiProxy handler = new InvokableContextStatefulRemoteProxyInvocationHack(this.getContainerName(), locator,
interceptors, this.getSessionId());
Class<?>[] interfaces = new Class<?>[]
Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateful/StatefulRemoteProxyInvocationHandler.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateful/StatefulRemoteProxyInvocationHandler.java 2008-08-06 21:45:47 UTC (rev 76729)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateful/StatefulRemoteProxyInvocationHandler.java 2008-08-06 21:46:07 UTC (rev 76730)
@@ -51,14 +51,16 @@
/**
* Constructor
*
+ * @param containerName The name of the target container
* @param businessInterfaceType The possibly null businessInterfaceType
* marking this invocation hander as specific to a given
* EJB3 Business Interface
- * @param url The URL to the Remote Host
+ * @param url The URL to the Remote Host
*/
- public StatefulRemoteProxyInvocationHandler(String businessInterfaceType, String url)
+ public StatefulRemoteProxyInvocationHandler(final String containerName, final String businessInterfaceType,
+ final String url)
{
- super(businessInterfaceType);
+ super(containerName, businessInterfaceType);
this.setUrl(url);
}
Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateless/StatelessLocalProxyInvocationHandler.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateless/StatelessLocalProxyInvocationHandler.java 2008-08-06 21:45:47 UTC (rev 76729)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateless/StatelessLocalProxyInvocationHandler.java 2008-08-06 21:46:07 UTC (rev 76730)
@@ -45,13 +45,14 @@
/**
* Constructor
*
+ * @param containerName The name of the target Container
* @param businessInterfaceType The possibly null businessInterfaceType
* marking this invocation hander as specific to a given
* EJB3 Business Interface
*/
- public StatelessLocalProxyInvocationHandler(String businessInterfaceType)
+ public StatelessLocalProxyInvocationHandler(final String containerName, final String businessInterfaceType)
{
- super(businessInterfaceType);
+ super(containerName, businessInterfaceType);
}
// --------------------------------------------------------------------------------||
Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateless/StatelessProxyInvocationHandlerBase.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateless/StatelessProxyInvocationHandlerBase.java 2008-08-06 21:45:47 UTC (rev 76729)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateless/StatelessProxyInvocationHandlerBase.java 2008-08-06 21:46:07 UTC (rev 76730)
@@ -56,22 +56,25 @@
/**
* Constructor
+ *
+ * @param containerName
*/
- public StatelessProxyInvocationHandlerBase()
+ public StatelessProxyInvocationHandlerBase(final String containerName)
{
- this(null);
+ this(containerName, null);
}
/**
* Constructor
*
+ * @param containerName The name of the target Container
* @param businessInterfaceType The possibly null businessInterfaceType
* marking this invocation hander as specific to a given
* EJB3 Business Interface
*/
- public StatelessProxyInvocationHandlerBase(String businessInterfaceType)
+ public StatelessProxyInvocationHandlerBase(final String containerName, final String businessInterfaceType)
{
- super(businessInterfaceType);
+ super(containerName, businessInterfaceType);
}
// ------------------------------------------------------------------------------||
@@ -185,8 +188,9 @@
protected StatelessProxyInvocationHandlerBase getInvocationHandler(Object proxy)
{
InvocationHandler handler = Proxy.getInvocationHandler(proxy);
- assert handler instanceof StatelessProxyInvocationHandlerBase : "Expected " + InvocationHandler.class.getSimpleName()
- + " of type " + StatelessProxyInvocationHandlerBase.class.getName() + ", but instead was " + handler;
+ assert handler instanceof StatelessProxyInvocationHandlerBase : "Expected "
+ + InvocationHandler.class.getSimpleName() + " of type "
+ + StatelessProxyInvocationHandlerBase.class.getName() + ", but instead was " + handler;
return (StatelessProxyInvocationHandlerBase) handler;
}
Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateless/StatelessRemoteProxyInvocationHandler.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateless/StatelessRemoteProxyInvocationHandler.java 2008-08-06 21:45:47 UTC (rev 76729)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateless/StatelessRemoteProxyInvocationHandler.java 2008-08-06 21:46:07 UTC (rev 76730)
@@ -60,14 +60,16 @@
/**
* Constructor
*
+ * @param containerName The name of the target container
* @param businessInterfaceType The possibly null businessInterfaceType
* marking this invocation hander as specific to a given
* EJB3 Business Interface
- * @param url The URL to the Remote Host
+ * @param url The URL to the Remote Host
*/
- public StatelessRemoteProxyInvocationHandler(String businessInterfaceType, String url)
+ public StatelessRemoteProxyInvocationHandler(final String containerName, final String businessInterfaceType,
+ final String url)
{
- super(businessInterfaceType);
+ super(containerName,businessInterfaceType);
this.setUrl(url);
}
Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/invocation/InvokableContextStatefulRemoteProxyInvocationHack.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/invocation/InvokableContextStatefulRemoteProxyInvocationHack.java 2008-08-06 21:45:47 UTC (rev 76729)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/invocation/InvokableContextStatefulRemoteProxyInvocationHack.java 2008-08-06 21:46:07 UTC (rev 76730)
@@ -33,6 +33,7 @@
import org.jboss.ejb3.proxy.container.InvokableContext;
import org.jboss.ejb3.proxy.remoting.StatefulSessionRemotingMetadata;
import org.jboss.ejb3.stateful.StatefulRemoteInvocation;
+import org.jboss.logging.Logger;
import org.jboss.remoting.InvokerLocator;
/**
@@ -54,18 +55,42 @@
public class InvokableContextStatefulRemoteProxyInvocationHack extends PojiProxy
{
+ // --------------------------------------------------------------------------------||
+ // Class Members ------------------------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+
+ private static final Logger log = Logger.getLogger(InvokableContextStatefulRemoteProxyInvocationHack.class);
+
+ // --------------------------------------------------------------------------------||
+ // Instance Members ---------------------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+
/**
* The Session ID to be used in SFSB Invocations
*/
private Serializable sessionId;
+ // --------------------------------------------------------------------------------||
+ // Constructor --------------------------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+
public InvokableContextStatefulRemoteProxyInvocationHack(Object oid, InvokerLocator uri, Interceptor[] interceptors,
Serializable sessionId)
{
+ // Call Super Implementation
super(oid, uri, interceptors);
+
+ // Some sanity checks
+ assert oid !=null : "Specified OID is null";
+
+ // Set additional properties
this.setSessionId(sessionId);
}
+ // --------------------------------------------------------------------------------||
+ // Overridden Implementations -----------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+
/**
* Constructs a MethodInvocation from the specified Method and
* arguments
@@ -119,6 +144,9 @@
Method dynamicInvokeMethod = serializableMethod.toMethod();
long hash = MethodHashing.calculateHash(dynamicInvokeMethod);
+ // Log
+ log.debug("Received invocation request to method " + serializableMethod + "; using hash: " + hash);
+
/*
* Build the invocation and return
*
@@ -127,7 +155,7 @@
* via ProxyTestClassProxyHack, an indirection to allow the proper CL to be set
*/
MethodInvocation sri = new StatefulRemoteInvocation(this.getInterceptors(), hash, dynamicInvokeMethod,
- dynamicInvokeMethod, null, null);
+ dynamicInvokeMethod, null, this.getSessionId());
return sri;
}
@@ -168,6 +196,10 @@
invocation.setArguments(arguments);
}
+ // --------------------------------------------------------------------------------||
+ // Accessors / Mutators -----------------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+
protected Serializable getSessionId()
{
return sessionId;
Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/objectfactory/session/SessionProxyObjectFactory.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/objectfactory/session/SessionProxyObjectFactory.java 2008-08-06 21:45:47 UTC (rev 76729)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/objectfactory/session/SessionProxyObjectFactory.java 2008-08-06 21:46:07 UTC (rev 76730)
@@ -21,8 +21,6 @@
*/
package org.jboss.ejb3.proxy.objectfactory.session;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Proxy;
import java.util.List;
import java.util.Map;
@@ -30,7 +28,6 @@
import org.jboss.ejb3.proxy.factory.ProxyFactory;
import org.jboss.ejb3.proxy.factory.session.SessionProxyFactory;
-import org.jboss.ejb3.proxy.handler.session.SessionProxyInvocationHandler;
import org.jboss.ejb3.proxy.objectfactory.Ejb3RegistrarProxyObjectFactory;
import org.jboss.ejb3.proxy.objectfactory.ProxyFactoryReferenceAddressTypes;
import org.jboss.logging.Logger;
@@ -151,17 +148,9 @@
// Obtain the target container name
String containerName = this.getSingleRequiredReferenceAddressValue(name, referenceAddresses,
ProxyFactoryReferenceAddressTypes.REF_ADDR_TYPE_EJBCONTAINER_NAME);
+ assert containerName != null && containerName.trim().length() > 0 : "Container Name must be specified via reference address + \""
+ + ProxyFactoryReferenceAddressTypes.REF_ADDR_TYPE_EJBCONTAINER_NAME + "\"";
- // Get the proxy's invocation handler
- InvocationHandler handler = Proxy.getInvocationHandler(proxy);
-
- // Set the target Container Name
- assert handler instanceof SessionProxyInvocationHandler : InvocationHandler.class.getSimpleName()
- + " must be of type " + SessionProxyInvocationHandler.class.getName() + " but instead was assignable to "
- + handler.getClass().getInterfaces();
- SessionProxyInvocationHandler sHandler = (SessionProxyInvocationHandler) handler;
- sHandler.setContainerName(containerName);
-
// Return
return proxy;
}
Modified: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/spec_3_4_5/ProxyEqualityTestCaseBase.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/spec_3_4_5/ProxyEqualityTestCaseBase.java 2008-08-06 21:45:47 UTC (rev 76729)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/spec_3_4_5/ProxyEqualityTestCaseBase.java 2008-08-06 21:46:07 UTC (rev 76730)
@@ -21,14 +21,11 @@
*/
package org.jboss.ejb3.test.proxy.spec_3_4_5;
-import java.lang.reflect.Proxy;
-
import junit.framework.TestCase;
import org.jboss.ejb3.common.registrar.plugin.mc.Ejb3McRegistrar;
import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
import org.jboss.ejb3.proxy.factory.session.SessionProxyFactory;
-import org.jboss.ejb3.proxy.handler.ProxyInvocationHandler;
import org.jboss.ejb3.test.mc.bootstrap.EmbeddedTestMcBootstrap;
import org.jboss.ejb3.test.proxy.common.container.SessionContainer;
import org.jboss.logging.Logger;
@@ -80,9 +77,6 @@
// Create Proxy
Object proxy = this.createProxyDefault(factory);
- // Manually set the target container
- this.setContainerNameOnProxy(proxy);
-
// Ensure equal to itself by value
TestCase
.assertTrue(
@@ -104,9 +98,6 @@
// Create Proxy
Object proxy = this.createProxyDefault(factory);
- // Manually set the target container
- this.setContainerNameOnProxy(proxy);
-
// Ensure equal to itself by value
TestCase
.assertTrue(
@@ -150,18 +141,6 @@
return factory.createProxyDefault();
}
- /**
- * Sets the Container Name on the specified proxy
- *
- * @param proxy
- */
- protected void setContainerNameOnProxy(Object proxy)
- {
- // Get the InvocationHander for the Proxy
- ProxyInvocationHandler handler = (ProxyInvocationHandler) Proxy.getInvocationHandler(proxy);
- handler.setContainerName(ProxyEqualityTestCaseBase.getContainerName());
- }
-
// --------------------------------------------------------------------------------||
// Specifications -----------------------------------------------------------------||
// --------------------------------------------------------------------------------||
Modified: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/spec_3_4_5/unit/SfsbProxyEqualityTestCase.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/spec_3_4_5/unit/SfsbProxyEqualityTestCase.java 2008-08-06 21:45:47 UTC (rev 76729)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/spec_3_4_5/unit/SfsbProxyEqualityTestCase.java 2008-08-06 21:46:07 UTC (rev 76730)
@@ -81,10 +81,6 @@
this.setSessionIdOnProxy(proxy1, new Integer(1));
this.setSessionIdOnProxy(proxy2, new Integer(2));
- // Manually set the target container
- this.setContainerNameOnProxy(proxy1);
- this.setContainerNameOnProxy(proxy2);
-
// Ensure they're not equal to one another
TestCase
.assertTrue(
@@ -113,10 +109,6 @@
this.setSessionIdOnProxy(proxy1, new Integer(1));
this.setSessionIdOnProxy(proxy2, new Integer(2));
- // Manually set the target container
- this.setContainerNameOnProxy(proxy1);
- this.setContainerNameOnProxy(proxy2);
-
// Ensure they're not equal to one another
TestCase
.assertTrue(
Modified: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/spec_3_4_5/unit/SlsbProxyEqualityTestCase.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/spec_3_4_5/unit/SlsbProxyEqualityTestCase.java 2008-08-06 21:45:47 UTC (rev 76729)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/spec_3_4_5/unit/SlsbProxyEqualityTestCase.java 2008-08-06 21:46:07 UTC (rev 76730)
@@ -71,10 +71,6 @@
Object proxy1 = factory.createProxyDefault();
Object proxy2 = factory.createProxyDefault();
- // Manually set the target container
- this.setContainerNameOnProxy(proxy1);
- this.setContainerNameOnProxy(proxy2);
-
// Ensure they're equal to one another
TestCase
.assertTrue(
@@ -99,10 +95,6 @@
Object proxy1 = factory.createProxyDefault();
Object proxy2 = factory.createProxyDefault();
- // Manually set the target container
- this.setContainerNameOnProxy(proxy1);
- this.setContainerNameOnProxy(proxy2);
-
// Ensure they're equal to one another
TestCase
.assertTrue(
More information about the jboss-cvs-commits
mailing list