[jboss-cvs] JBossAS SVN: r77249 - in projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy: factory/session/stateful and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Aug 20 12:18:17 EDT 2008
Author: ALRubinger
Date: 2008-08-20 12:18:17 -0400 (Wed, 20 Aug 2008)
New Revision: 77249
Modified:
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/SessionProxyFactoryBase.java
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/session/stateful/StatefulLocalProxyInvocationHandler.java
Log:
[EJBTHREE-1470] Clean create*InvocationHandler API for better readability/extensibility
Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/SessionProxyFactoryBase.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/SessionProxyFactoryBase.java 2008-08-20 15:06:02 UTC (rev 77248)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/SessionProxyFactoryBase.java 2008-08-20 16:18:17 UTC (rev 77249)
@@ -130,13 +130,12 @@
public Object createProxyHome()
{
// Create a new InvocationHandler
- SessionProxyInvocationHandler handler = this.createInvocationHandler((String) null);
+ SessionProxyInvocationHandler handler = this.createHomeInvocationHandler();
try
{
// Create a new Proxy instance, and return
return this.getConstructorProxyHome().newInstance(handler);
-
}
catch (Throwable t)
{
@@ -164,7 +163,7 @@
+ SessionProxyFactory.class.getSimpleName() + " was not properly started?";
// Create a new InvocationHandler
- SessionProxyInvocationHandler handler = this.createInvocationHandler((String) null);
+ SessionProxyInvocationHandler handler = this.createBusinessDefaultInvocationHandler();
try
{
@@ -197,7 +196,7 @@
// Obtain the correct business proxy constructor
Constructor<?> constructor = this.getConstructorsProxySpecificBusinessInterface().get(
businessInterfaceName.trim());
-
+
/*
* In place for web injection (isolated CL)
*/
@@ -205,26 +204,26 @@
try
{
// See if we can get at the bean class from the TCL
- Class<?> businessInterfaceClass = Class.forName(businessInterfaceName,false,tcl);
-
+ Class<?> businessInterfaceClass = Class.forName(businessInterfaceName, false, tcl);
+
// If so, use the TCL to generate the Proxy class, not the Container CL
Set<Class<?>> businessInterfaces = new HashSet<Class<?>>();
businessInterfaces.add(businessInterfaceClass);
constructor = this.createProxyConstructor(businessInterfaces, tcl);
-
+
}
- catch(ClassNotFoundException cce)
+ catch (ClassNotFoundException cce)
{
// Ignore
}
-
// Ensure the constructor was found
assert constructor != null : "No business proxy constructor for \"" + businessInterfaceName
+ "\" was found; not created at start() properly? Bad value bound as RefAddr in JNDI?";
// Create a new InvocationHandler
- SessionProxyInvocationHandler handler = this.createInvocationHandler(businessInterfaceName);
+ SessionProxyInvocationHandler handler = this
+ .createBusinessInterfaceSpecificInvocationHandler(businessInterfaceName);
// Create a new Proxy instance, and return
return constructor.newInstance(handler);
@@ -245,7 +244,7 @@
public Object createProxyEjb2x()
{
// Create a new InvocationHandler
- SessionProxyInvocationHandler handler = this.createInvocationHandler((String) null);
+ SessionProxyInvocationHandler handler = this.createEjb2xComponentInterfaceInvocationHandler();
try
{
@@ -622,10 +621,43 @@
* Returns the Constructor of the SessionProxyInvocationHandler to be used in
* instanciating new handlers to specify in Proxy Creation
*
+ * Used for creating a Handler for a Business Interface-specific proxy
+ *
* @return
*/
- protected abstract SessionProxyInvocationHandler createInvocationHandler(String businessInterfaceName);
+ protected abstract SessionProxyInvocationHandler createBusinessInterfaceSpecificInvocationHandler(
+ String businessInterfaceName);
+ /**
+ * Returns the Constructor of the SessionProxyInvocationHandler to be used in
+ * instanciating new handlers to specify in Proxy Creation
+ *
+ * Used for creating a Handler for a Business Default proxy
+ *
+ * @return
+ */
+ protected abstract SessionProxyInvocationHandler createBusinessDefaultInvocationHandler();
+
+ /**
+ * Returns the Constructor of the SessionProxyInvocationHandler to be used in
+ * instanciating new handlers to specify in Proxy Creation
+ *
+ * Used for creating a Handler for an EJB2.x Component Interface proxy
+ *
+ * @return
+ */
+ protected abstract SessionProxyInvocationHandler createEjb2xComponentInterfaceInvocationHandler();
+
+ /**
+ * Returns the Constructor of the SessionProxyInvocationHandler to be used in
+ * instanciating new handlers to specify in Proxy Creation
+ *
+ * Used for creating a Handler for am EJB2.x Home proxy
+ *
+ * @return
+ */
+ protected abstract SessionProxyInvocationHandler createHomeInvocationHandler();
+
// --------------------------------------------------------------------------------||
// Accessors / Mutators -----------------------------------------------------------||
// --------------------------------------------------------------------------------||
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-20 15:06:02 UTC (rev 77248)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateful/StatefulSessionLocalProxyFactory.java 2008-08-20 16:18:17 UTC (rev 77249)
@@ -108,7 +108,7 @@
// --------------------------------------------------------------------------------||
@Override
- protected SessionProxyInvocationHandler createInvocationHandler(String businessInterfaceName)
+ protected SessionProxyInvocationHandler createBusinessInterfaceSpecificInvocationHandler(String businessInterfaceName)
{
// Obtain target container name
String containerName = this.getContainerName();
@@ -124,4 +124,22 @@
// Return
return handler;
}
+
+ @Override
+ protected SessionProxyInvocationHandler createBusinessDefaultInvocationHandler()
+ {
+ return this.createBusinessInterfaceSpecificInvocationHandler(null);
+ }
+
+ @Override
+ protected SessionProxyInvocationHandler createEjb2xComponentInterfaceInvocationHandler()
+ {
+ return this.createBusinessDefaultInvocationHandler();
+ }
+
+ @Override
+ protected SessionProxyInvocationHandler createHomeInvocationHandler()
+ {
+ return this.createBusinessDefaultInvocationHandler();
+ }
}
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-20 15:06:02 UTC (rev 77248)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateful/StatefulSessionRemoteProxyFactory.java 2008-08-20 16:18:17 UTC (rev 77249)
@@ -136,7 +136,7 @@
// --------------------------------------------------------------------------------||
@Override
- protected SessionProxyInvocationHandler createInvocationHandler(String businessInterfaceName)
+ protected SessionProxyInvocationHandler createBusinessInterfaceSpecificInvocationHandler(String businessInterfaceName)
{
// Obtain target properties
String containerName = this.getContainerName();
@@ -153,7 +153,25 @@
// Return
return handler;
}
+
+ @Override
+ protected SessionProxyInvocationHandler createBusinessDefaultInvocationHandler()
+ {
+ return this.createBusinessInterfaceSpecificInvocationHandler(null);
+ }
+ @Override
+ protected SessionProxyInvocationHandler createEjb2xComponentInterfaceInvocationHandler()
+ {
+ return this.createBusinessDefaultInvocationHandler();
+ }
+
+ @Override
+ protected SessionProxyInvocationHandler createHomeInvocationHandler()
+ {
+ return this.createBusinessDefaultInvocationHandler();
+ }
+
// --------------------------------------------------------------------------------||
// Accessors / Mutators -----------------------------------------------------------||
// --------------------------------------------------------------------------------||
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-20 15:06:02 UTC (rev 77248)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateless/StatelessSessionLocalProxyFactory.java 2008-08-20 16:18:17 UTC (rev 77249)
@@ -111,7 +111,7 @@
// --------------------------------------------------------------------------------||
@Override
- protected SessionProxyInvocationHandler createInvocationHandler(String businessInterfaceName)
+ protected SessionProxyInvocationHandler createBusinessInterfaceSpecificInvocationHandler(String businessInterfaceName)
{
// Obtain container name
String containerName = this.getContainerName();
@@ -126,5 +126,23 @@
// Return
return handler;
+ }
+
+ @Override
+ protected SessionProxyInvocationHandler createBusinessDefaultInvocationHandler()
+ {
+ return this.createBusinessInterfaceSpecificInvocationHandler(null);
}
+
+ @Override
+ protected SessionProxyInvocationHandler createEjb2xComponentInterfaceInvocationHandler()
+ {
+ return this.createBusinessDefaultInvocationHandler();
+ }
+
+ @Override
+ protected SessionProxyInvocationHandler createHomeInvocationHandler()
+ {
+ return this.createBusinessDefaultInvocationHandler();
+ }
}
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-20 15:06:02 UTC (rev 77248)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateless/StatelessSessionRemoteProxyFactory.java 2008-08-20 16:18:17 UTC (rev 77249)
@@ -136,7 +136,7 @@
// --------------------------------------------------------------------------------||
@Override
- protected SessionProxyInvocationHandler createInvocationHandler(String businessInterfaceName)
+ protected SessionProxyInvocationHandler createBusinessInterfaceSpecificInvocationHandler(String businessInterfaceName)
{
// Obtain properties
String containerName = this.getContainerName();
@@ -153,7 +153,25 @@
// Return
return handler;
}
+
+ @Override
+ protected SessionProxyInvocationHandler createBusinessDefaultInvocationHandler()
+ {
+ return this.createBusinessInterfaceSpecificInvocationHandler(null);
+ }
+ @Override
+ protected SessionProxyInvocationHandler createEjb2xComponentInterfaceInvocationHandler()
+ {
+ return this.createBusinessDefaultInvocationHandler();
+ }
+
+ @Override
+ protected SessionProxyInvocationHandler createHomeInvocationHandler()
+ {
+ return this.createBusinessDefaultInvocationHandler();
+ }
+
// --------------------------------------------------------------------------------||
// Accessors / Mutators -----------------------------------------------------------||
// --------------------------------------------------------------------------------||
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-20 15:06:02 UTC (rev 77248)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateful/StatefulLocalProxyInvocationHandler.java 2008-08-20 16:18:17 UTC (rev 77249)
@@ -44,6 +44,19 @@
// --------------------------------------------------------------------------------||
// Constructor --------------------------------------------------------------------||
// --------------------------------------------------------------------------------||
+
+ /**
+ * Constructor
+ *
+ * @param containerName The name of the target container
+ * @param containerGuid The globally-unique name of the container
+ * @param interceptors The interceptors to apply to invocations upon this handler
+ */
+ public StatefulLocalProxyInvocationHandler(final String containerName, final String containerGuid,
+ final Interceptor[] interceptors)
+ {
+ super(containerName, containerGuid, interceptors, null);
+ }
/**
* Constructor
More information about the jboss-cvs-commits
mailing list