[jboss-cvs] JBossAS SVN: r76208 - in projects/ejb3/trunk/proxy: src/main/java/org/jboss/ejb3/proxy and 14 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Jul 24 21:50:04 EDT 2008
Author: ALRubinger
Date: 2008-07-24 21:50:04 -0400 (Thu, 24 Jul 2008)
New Revision: 76208
Added:
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/remoting/Ejb3PojiProxy.java
Removed:
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/invocation/
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/lang/SerializableMethod.java
Modified:
projects/ejb3/trunk/proxy/pom.xml
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/container/InvokableContext.java
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/container/StatefulSessionInvokableContext.java
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/StatefulSessionProxyFactoryBase.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/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/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/jndiregistrar/JndiSessionRegistrarBase.java
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/objectfactory/ProxyObjectFactory.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/common/container/SessionContainer.java
projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/container/StatefulContainer.java
projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/jndiregistrar/unit/JndiSessionRegistrarBaseTestCase.java
projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/lang/MyClass.java
projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/lang/unit/SerializableMethodTestCase.java
Log:
[EJBTHREE-1345] Committed latest EJB3 Proxy Dev
Modified: projects/ejb3/trunk/proxy/pom.xml
===================================================================
--- projects/ejb3/trunk/proxy/pom.xml 2008-07-25 01:48:46 UTC (rev 76207)
+++ projects/ejb3/trunk/proxy/pom.xml 2008-07-25 01:50:04 UTC (rev 76208)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.jboss.ejb3</groupId>
<artifactId>jboss-ejb3-build</artifactId>
- <version>0.13.9-SNAPSHOT</version>
+ <version>0.13.11-SNAPSHOT</version>
</parent>
<!-- Model Version -->
@@ -98,22 +98,22 @@
<scope>test</scope>
</dependency>
+ <!-- JBoss Remoting Aspects -->
<dependency>
<groupId>org.jboss.aspects</groupId>
<artifactId>jboss-remoting-aspects</artifactId>
- <version>1.0.1.CR2</version>
</dependency>
<dependency>
<groupId>org.jboss.ejb3</groupId>
<artifactId>jboss-ejb3-common</artifactId>
- <version>0.1.3-SNAPSHOT</version>
+ <version>0.1.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.jboss.ejb3</groupId>
<artifactId>jboss-ejb3-interceptors</artifactId>
- <version>0.13.0</version>
+ <version>0.13.2-SNAPSHOT</version>
</dependency>
<dependency>
Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/container/InvokableContext.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/container/InvokableContext.java 2008-07-25 01:48:46 UTC (rev 76207)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/container/InvokableContext.java 2008-07-25 01:50:04 UTC (rev 76208)
@@ -21,8 +21,8 @@
*/
package org.jboss.ejb3.proxy.container;
+import org.jboss.ejb3.common.lang.SerializableMethod;
import org.jboss.ejb3.interceptors.container.ContainerMethodInvocation;
-import org.jboss.ejb3.proxy.lang.SerializableMethod;
/**
* InvokableContext
Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/container/StatefulSessionInvokableContext.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/container/StatefulSessionInvokableContext.java 2008-07-25 01:48:46 UTC (rev 76207)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/container/StatefulSessionInvokableContext.java 2008-07-25 01:50:04 UTC (rev 76208)
@@ -21,7 +21,7 @@
*/
package org.jboss.ejb3.proxy.container;
-import org.jboss.ejb3.proxy.invocation.StatefulSessionContainerMethodInvocation;
+import org.jboss.ejb3.interceptors.container.StatefulSessionContainerMethodInvocation;
/**
* StatefulSessionInvokableContext
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-07-25 01:48:46 UTC (rev 76207)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/SessionProxyFactoryBase.java 2008-07-25 01:50:04 UTC (rev 76208)
@@ -185,10 +185,11 @@
*/
public Object createProxyBusiness(final String businessInterfaceName)
{
+ // Ensure businessInterfaceName is specified
+ assert businessInterfaceName != null && businessInterfaceName.trim().length() > 0 : "Required business interface type name was not specified";
+
try
{
- // Ensure businessInterfaceName is specified
- assert businessInterfaceName != null && !businessInterfaceName.equals("") : "Required business interface type name was not specified";
// Obtain the correct business proxy constructor
Constructor<?> constructor = this.getConstructorsProxySpecificBusinessInterface().get(
@@ -366,7 +367,7 @@
}
// If there's a home defined and its bound to the same binding as the default
- if (hasHomeInterface && this.getMetadata().determineJndiName().equals(this.getMetadata().getHomeJndiName()))
+ if (hasHomeInterface && this.getMetadata().getJndiName().equals(this.getMetadata().getHomeJndiName()))
{
defaultProxyInterfaces.add(homeInterfaceClass);
}
Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateful/StatefulSessionProxyFactoryBase.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateful/StatefulSessionProxyFactoryBase.java 2008-07-25 01:48:46 UTC (rev 76207)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateful/StatefulSessionProxyFactoryBase.java 2008-07-25 01:50:04 UTC (rev 76208)
@@ -26,11 +26,11 @@
import java.util.Set;
import org.jboss.ejb3.common.registrar.spi.NotBoundException;
+import org.jboss.ejb3.interceptors.container.StatefulSessionContainerMethodInvocation;
import org.jboss.ejb3.proxy.container.StatefulSessionInvokableContext;
import org.jboss.ejb3.proxy.factory.session.SessionProxyFactoryBase;
import org.jboss.ejb3.proxy.handler.session.stateful.StatefulProxyInvocationHandlerBase;
import org.jboss.ejb3.proxy.intf.StatefulSessionProxy;
-import org.jboss.ejb3.proxy.invocation.StatefulSessionContainerMethodInvocation;
import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
/**
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-07-25 01:48:46 UTC (rev 76207)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateful/StatefulSessionRemoteProxyFactory.java 2008-07-25 01:50:04 UTC (rev 76208)
@@ -32,6 +32,7 @@
import org.jboss.ejb3.proxy.factory.session.SessionProxyFactory;
import org.jboss.ejb3.proxy.handler.session.SessionProxyInvocationHandler;
import org.jboss.ejb3.proxy.handler.session.stateful.StatefulRemoteProxyInvocationHandler;
+import org.jboss.ejb3.proxy.remoting.Ejb3PojiProxy;
import org.jboss.ejb3.proxy.remoting.IsLocalProxyFactoryInterceptor;
import org.jboss.logging.Logger;
import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
@@ -182,7 +183,7 @@
// Create a POJI Proxy to the Container
Interceptor[] interceptors =
{IsLocalProxyFactoryInterceptor.singleton, InvokeRemoteInterceptor.singleton};
- PojiProxy handler = new PojiProxy(containerName, locator, interceptors);
+ PojiProxy handler = new Ejb3PojiProxy(containerName, locator, interceptors);
Class<?>[] interfaces = new Class<?>[]
{StatefulSessionInvokableContext.class};
container = (StatefulSessionInvokableContext<?>) Proxy.newProxyInstance(interfaces[0].getClassLoader(),
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-07-25 01:48:46 UTC (rev 76207)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandler.java 2008-07-25 01:50:04 UTC (rev 76208)
@@ -25,7 +25,7 @@
import java.io.Serializable;
import java.lang.reflect.InvocationHandler;
-import org.jboss.ejb3.proxy.lang.SerializableMethod;
+import org.jboss.ejb3.common.lang.SerializableMethod;
/**
* ProxyInvocationHandler
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-07-25 01:48:46 UTC (rev 76207)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandlerBase.java 2008-07-25 01:50:04 UTC (rev 76208)
@@ -21,8 +21,10 @@
*/
package org.jboss.ejb3.proxy.handler;
-import org.jboss.ejb3.proxy.lang.SerializableMethod;
+import java.lang.reflect.Method;
+import org.jboss.ejb3.common.lang.SerializableMethod;
+
/**
* ProxyInvocationHandlerBase
*
@@ -61,11 +63,11 @@
try
{
METHOD_TO_STRING = new SerializableMethod(Object.class
- .getDeclaredMethod(ProxyInvocationHandlerBase.METHOD_NAME_TO_STRING));
+ .getDeclaredMethod(ProxyInvocationHandlerBase.METHOD_NAME_TO_STRING), Object.class);
METHOD_EQUALS = new SerializableMethod(Object.class.getDeclaredMethod(
- ProxyInvocationHandlerBase.METHOD_NAME_EQUALS, Object.class));
+ ProxyInvocationHandlerBase.METHOD_NAME_EQUALS, Object.class), Object.class);
METHOD_HASH_CODE = new SerializableMethod(Object.class
- .getDeclaredMethod(ProxyInvocationHandlerBase.METHOD_NAME_HASH_CODE));
+ .getDeclaredMethod(ProxyInvocationHandlerBase.METHOD_NAME_HASH_CODE), Object.class);
}
catch (NoSuchMethodException nsme)
{
@@ -121,8 +123,11 @@
SerializableMethod invokedMethod = this.getInvokedMethod();
assert invokedMethod != null : "Invoked Method was not set upon invocation of " + this.getClass().getName();
+ // Obtain Declared Method
+ Method declaredMethod = invokedMethod.toMethod();
+
// equals
- if (invokedMethod.equals(ProxyInvocationHandlerBase.METHOD_EQUALS))
+ if (declaredMethod.equals(ProxyInvocationHandlerBase.METHOD_EQUALS.toMethod()))
{
assert args.length == 1 : "Invocation for 'equals' should have exactly one argument, instead was: "
+ invokedMethod;
@@ -130,12 +135,12 @@
return this.invokeEquals(proxy, argument);
}
// toString
- if (invokedMethod.equals(ProxyInvocationHandlerBase.METHOD_TO_STRING))
+ if (declaredMethod.equals(ProxyInvocationHandlerBase.METHOD_TO_STRING.toMethod()))
{
return this.toString();
}
// hashCode
- if (invokedMethod.equals(ProxyInvocationHandlerBase.METHOD_HASH_CODE))
+ if (declaredMethod.equals(ProxyInvocationHandlerBase.METHOD_HASH_CODE.toMethod()))
{
return this.invokeHashCode(proxy);
}
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-07-25 01:48:46 UTC (rev 76207)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/SessionProxyInvocationHandlerBase.java 2008-07-25 01:50:04 UTC (rev 76208)
@@ -21,7 +21,6 @@
*/
package org.jboss.ejb3.proxy.handler.session;
-import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.net.MalformedURLException;
@@ -32,9 +31,8 @@
import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
import org.jboss.ejb3.interceptors.container.ContainerMethodInvocation;
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.ejb3.proxy.remoting.Ejb3PojiProxy;
import org.jboss.ejb3.proxy.remoting.IsLocalProxyFactoryInterceptor;
import org.jboss.logging.Logger;
import org.jboss.remoting.InvokerLocator;
@@ -56,6 +54,8 @@
// Class Members ----------------------------------------------------------------||
// ------------------------------------------------------------------------------||
+ private static final long serialVersionUID = 1L;
+
private static final Logger log = Logger.getLogger(SessionProxyInvocationHandlerBase.class);
// ------------------------------------------------------------------------------||
@@ -70,46 +70,6 @@
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 " + this + ": "
- + nefdie.getMessage());
- }
-
- /*
- * Obtain the Container
- */
- InvokableContext<?> container = this.getContainer();
-
- /*
- * Invoke
- */
-
- // Invoke
- log.debug("Invoking: " + invokedMethod + " with arguments " + args + "...");
- Object result = container.invoke(proxy, invokedMethod, args);
-
- // Return
- return result;
-
- }
-
/**
* Returns the container housed locally
*
@@ -151,7 +111,7 @@
// Create a POJI Proxy to the Container
Interceptor[] interceptors =
{IsLocalProxyFactoryInterceptor.singleton, InvokeRemoteInterceptor.singleton};
- PojiProxy handler = new PojiProxy(this.getContainerName(), locator, interceptors);
+ PojiProxy handler = new Ejb3PojiProxy(this.getContainerName(), locator, interceptors);
Class<?>[] interfaces = new Class<?>[]
{InvokableContext.class};
InvokableContext<? extends ContainerMethodInvocation> container = (InvokableContext<?>) Proxy.newProxyInstance(
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-07-25 01:48:46 UTC (rev 76207)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/SessionSpecProxyInvocationHandlerBase.java 2008-07-25 01:50:04 UTC (rev 76208)
@@ -21,6 +21,13 @@
*/
package org.jboss.ejb3.proxy.handler.session;
+import java.lang.reflect.Method;
+
+import org.jboss.ejb3.common.lang.SerializableMethod;
+import org.jboss.ejb3.proxy.container.InvokableContext;
+import org.jboss.ejb3.proxy.handler.NotEligibleForDirectInvocationException;
+import org.jboss.logging.Logger;
+
/**
* SessionSpecProxyInvocationHandlerBase
*
@@ -35,6 +42,12 @@
SessionSpecProxyInvocationHandler
{
// ------------------------------------------------------------------------------||
+ // Class Members ----------------------------------------------------------------||
+ // ------------------------------------------------------------------------------||
+
+ private static final Logger log = Logger.getLogger(SessionSpecProxyInvocationHandlerBase.class);
+
+ // ------------------------------------------------------------------------------||
// Instance Members -------------------------------------------------------------||
// ------------------------------------------------------------------------------||
@@ -62,7 +75,56 @@
super();
this.setBusinessInterfaceType(businessInterfaceType);
}
+
+ // ------------------------------------------------------------------------------||
+ // Required Implementations -----------------------------------------------------||
+ // ------------------------------------------------------------------------------||
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
+ {
+ // Obtain an explicitly-specified actual class
+ String actualClass = this.getBusinessInterfaceType();
+
+ // Set the invoked method
+ SerializableMethod invokedMethod = new SerializableMethod(method, actualClass);
+ 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 " + this + ": "
+ + nefdie.getMessage());
+ }
+
+ /*
+ * Obtain the Container
+ */
+ InvokableContext<?> container = this.getContainer();
+
+ /*
+ * Invoke
+ */
+
+ // Adjust args if null to empty array
+ if(args==null)
+ {
+ args = new Object[]{};
+ }
+
+ // Invoke
+ log.debug("Invoking: " + invokedMethod + " with arguments " + args + "...");
+ Object result = container.invoke(proxy, invokedMethod, args);
+
+ // Return
+ return result;
+
+ }
+
// ------------------------------------------------------------------------------||
// Accessors / Mutators ---------------------------------------------------------||
// ------------------------------------------------------------------------------||
Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/jndiregistrar/JndiSessionRegistrarBase.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/jndiregistrar/JndiSessionRegistrarBase.java 2008-07-25 01:48:46 UTC (rev 76207)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/jndiregistrar/JndiSessionRegistrarBase.java 2008-07-25 01:50:04 UTC (rev 76208)
@@ -70,7 +70,7 @@
/**
* The value appended to the key used to bind proxy factories to the registry
*/
- private static final String KEY_SUFFIX_PROXY_FACTORY_REGISTRY = "/ProxyFactory";
+ private static final String KEY_PREFIX_PROXY_FACTORY_REGISTRY = "ProxyFactory/";
private static final String OBJECT_FACTORY_CLASSNAME_PREFIX = "Proxy for: ";
@@ -573,7 +573,7 @@
// Bind
try
{
- Util.rebind(context, address, ref);
+ Util.bind(context, address, ref);
log.debug("Bound " + ref.getClass().getName() + " into JNDI at \"" + address + "\"");
}
catch (NamingException e)
@@ -674,20 +674,24 @@
public String getProxyFactoryRegistryKey(JBossSessionBeanMetaData md, boolean isLocal)
{
// Initialize
- String prefix = null;
+ String suffix = null;
// Set Suffix
if (isLocal)
{
- prefix = md.getLocalJndiName();
+ suffix = md.getLocalJndiName();
}
else
{
- prefix = md.getJndiName();
+ suffix = md.getJndiName();
}
+ // Ensure suffix is specified
+ assert suffix != null && !suffix.equals("") : ProxyFactory.class.getSimpleName()
+ + " key prefix for binding to registry is noy specified";
+
// Assemble and return
- String key = prefix + JndiSessionRegistrarBase.KEY_SUFFIX_PROXY_FACTORY_REGISTRY;
+ String key = JndiSessionRegistrarBase.KEY_PREFIX_PROXY_FACTORY_REGISTRY + suffix;
return key;
}
@@ -706,17 +710,37 @@
// what will be castable from the lookup result
StringBuffer defaultRemotes = new StringBuffer();
int remotesCount = 0;
+ int interfaceCount = 0;
for (RefAddr refAddr : refAddrs)
{
remotesCount++;
- defaultRemotes.append(refAddr.getContent());
- if (remotesCount < refAddrs.size())
+ String refAddrType = refAddr.getType();
+ if (isRefAddrTypeEjbInterface(refAddrType))
{
- defaultRemotes.append(", ");
+ if (interfaceCount > 0)
+ {
+ defaultRemotes.append(", ");
+ }
+ defaultRemotes.append(refAddr.getContent());
+ interfaceCount++;
}
}
return defaultRemotes.toString();
}
+
+ /**
+ * Returns whether the specified RefAddr type denotes an EJB Interface
+ *
+ * @param refAddrType
+ * @return
+ */
+ private boolean isRefAddrTypeEjbInterface(String refAddrType)
+ {
+ return refAddrType.equals(ProxyFactoryReferenceAddressTypes.REF_ADDR_TYPE_PROXY_BUSINESS_INTERFACE_LOCAL) ||
+ refAddrType.equals(ProxyFactoryReferenceAddressTypes.REF_ADDR_TYPE_PROXY_BUSINESS_INTERFACE_REMOTE) ||
+ refAddrType.equals(ProxyFactoryReferenceAddressTypes.REF_ADDR_TYPE_PROXY_EJB2x_INTERFACE_HOME_LOCAL) ||
+ refAddrType.equals(ProxyFactoryReferenceAddressTypes.REF_ADDR_TYPE_PROXY_EJB2x_INTERFACE_HOME_REMOTE);
+ }
/**
* Registers the specified proxy factory into the registry
Deleted: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/lang/SerializableMethod.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/lang/SerializableMethod.java 2008-07-25 01:48:46 UTC (rev 76207)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/lang/SerializableMethod.java 2008-07-25 01:50:04 UTC (rev 76208)
@@ -1,349 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ejb3.proxy.lang;
-
-import java.io.Serializable;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * SerializableMethod
- *
- * A Serializable view of an Invoked Method, providing
- * overridden implementations of hashCode, equals, and toString
- *
- * JIRA: EJBTHREE-1269
- *
- * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
- * @version $Revision: $
- */
-public class SerializableMethod implements Serializable
-{
- // ------------------------------------------------------------------------------||
- // Class Members ----------------------------------------------------------------||
- // ------------------------------------------------------------------------------||
-
- private static final long serialVersionUID = 1L;
-
- // ------------------------------------------------------------------------------||
- // Instance Members -------------------------------------------------------------||
- // ------------------------------------------------------------------------------||
-
- /**
- * The name of the method
- */
- private String name;
-
- /**
- * Fully-qualified class name of the method
- */
- private String className;
-
- /**
- * Fully-qualfied class name of the return type of the method
- */
- private String returnType;
-
- /**
- * Array of fully-qualified class names of arguments, in order
- */
- private String[] argumentTypes;
-
- // ------------------------------------------------------------------------------||
- // Constructors -----------------------------------------------------------------||
- // ------------------------------------------------------------------------------||
-
- /**
- * Constructor
- *
- * @param Method The method this view represents
- */
- public SerializableMethod(Method method)
- {
- // Set properties
- this.setName(method.getName());
- this.setClassName(method.getDeclaringClass().getName());
- this.setReturnType(method.getReturnType().getName());
- Class<?>[] paramTypes = method.getParameterTypes();
- List<String> paramTypesString = new ArrayList<String>();
- if (paramTypes != null)
- {
- for (Class<?> paramType : paramTypes)
- {
- paramTypesString.add(paramType.getName());
- }
- }
- this.setArgumentTypes(paramTypesString.toArray(new String[]
- {}));
- }
-
- // ------------------------------------------------------------------------------||
- // Overridden Implementations ---------------------------------------------------||
- // ------------------------------------------------------------------------------||
-
- @Override
- public boolean equals(Object obj)
- {
- // If not an instance of SerializableMethod
- if (!(obj instanceof SerializableMethod))
- {
- // Different types, we can't be equal
- return false;
- }
-
- // Cast
- SerializableMethod other = SerializableMethod.class.cast(obj);
-
- // We're equal if all properties are equal
- return this.getClassName().equals(other.getClassName()) && this.getName().equals(other.getName())
- && Arrays.equals(this.getArgumentTypes(), other.getArgumentTypes());
- }
-
- @Override
- public int hashCode()
- {
- // toString is unique, use it
- return this.toString().hashCode();
- }
-
- @Override
- public String toString()
- {
- // Initialize
- StringBuffer sb = new StringBuffer();
-
- // Construct
- sb.append(this.getClassName());
- sb.append('.');
- sb.append(this.getName());
- sb.append('(');
- int count = 0;
- for (String argType : this.getArgumentTypes())
- {
- count++;
- sb.append(argType);
- if (count < this.getArgumentTypes().length)
- {
- sb.append(',');
- }
- }
- sb.append(')');
-
- // Return
- return sb.toString();
- }
-
- // ------------------------------------------------------------------------------||
- // Functional Methods -----------------------------------------------------------||
- // ------------------------------------------------------------------------------||
-
- /**
- * Obtains the Method described by this view, using the
- * TCL
- *
- * @return
- */
- public Method toMethod()
- {
- return this.toMethod(Thread.currentThread().getContextClassLoader());
- }
-
- /**
- * Obtains the Method described by this view, using the
- * ClassLoader specified
- *
- * @param cl
- * @return
- */
- public Method toMethod(ClassLoader cl)
- {
- // Load the Class described by the Method
- Class<?> invokingClass = this.getClassType(cl);
-
- // Load the argument types
- List<Object> argTypesList = new ArrayList<Object>();
- for (String argTypeName : this.getArgumentTypes())
- {
- Class<?> argType = this.getClassFromName(argTypeName, cl);
- argTypesList.add(argType);
- }
- Class<?>[] argTypes = argTypesList.toArray(new Class<?>[]
- {});
-
- // Obtain the Method
- String methodName = this.getName();
- Method invokedMethod = null;
- try
- {
- invokedMethod = invokingClass.getMethod(methodName, argTypes);
- }
- catch (NoSuchMethodException nsme)
- {
- throw new RuntimeException("Method " + this + " does not exist in " + invokingClass.getName(), nsme);
- }
-
- // Return
- return invokedMethod;
- }
-
- /**
- * Obtains the Class described by this view, using the
- * TCL
- *
- * @return
- */
- public Class<?> getClassType()
- {
- return this.getClassType(Thread.currentThread().getContextClassLoader());
- }
-
- /**
- * Obtains the Class described by this view, using the
- * specified ClassLoader
- *
- * @param cl
- * @return
- */
- public Class<?> getClassType(ClassLoader cl)
- {
- // Obtain
- Class<?> clazz = this.getClassFromName(this.getClassName(), cl);
-
- // Return
- return clazz;
- }
-
- /**
- * Returns the class associated with the given name
- *
- * @param name
- * @param cl
- * @return
- */
- protected Class<?> getClassFromName(String name, ClassLoader cl)
- {
- // Perform assertions
- assert cl != null : ClassLoader.class.getSimpleName() + "must be defined.";
-
- /*
- * Handle Primitives
- */
- if (name.equals(void.class.getName()))
- {
- return void.class;
- }
- if (name.equals(byte.class.getName()))
- {
- return byte.class;
- }
- if (name.equals(short.class.getName()))
- {
- return short.class;
- }
- if (name.equals(int.class.getName()))
- {
- return int.class;
- }
- if (name.equals(long.class.getName()))
- {
- return long.class;
- }
- if (name.equals(char.class.getName()))
- {
- return char.class;
- }
- if (name.equals(boolean.class.getName()))
- {
- return boolean.class;
- }
- if (name.equals(float.class.getName()))
- {
- return float.class;
- }
- if (name.equals(double.class.getName()))
- {
- return double.class;
- }
-
- // Load the Class described by the Method
- Class<?> clazz = null;
-
- try
- {
- clazz = cl.loadClass(name);
- }
- catch (ClassNotFoundException cnfe)
- {
- throw new RuntimeException("Specified calling class, " + name + " could not be found for " + cl, cnfe);
- }
-
- // Return
- return clazz;
- }
-
- // ------------------------------------------------------------------------------||
- // Accessors / Mutators ---------------------------------------------------------||
- // ------------------------------------------------------------------------------||
-
- public String getClassName()
- {
- return className;
- }
-
- public void setClassName(String className)
- {
- this.className = className;
- }
-
- public String getReturnType()
- {
- return returnType;
- }
-
- public void setReturnType(String returnType)
- {
- this.returnType = returnType;
- }
-
- public String[] getArgumentTypes()
- {
- return argumentTypes;
- }
-
- public void setArgumentTypes(String[] argumentTypes)
- {
- this.argumentTypes = argumentTypes;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-
-}
Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/objectfactory/ProxyObjectFactory.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/objectfactory/ProxyObjectFactory.java 2008-07-25 01:48:46 UTC (rev 76207)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/objectfactory/ProxyObjectFactory.java 2008-07-25 01:50:04 UTC (rev 76208)
@@ -43,6 +43,7 @@
import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
import org.jboss.ejb3.common.registrar.spi.NotBoundException;
import org.jboss.ejb3.proxy.factory.ProxyFactory;
+import org.jboss.ejb3.proxy.remoting.Ejb3PojiProxy;
import org.jboss.ejb3.proxy.remoting.IsLocalProxyFactoryInterceptor;
import org.jboss.logging.Logger;
import org.jboss.remoting.InvokerLocator;
@@ -150,7 +151,7 @@
// Create a POJI Proxy to the Registrar
Interceptor[] interceptors =
{IsLocalProxyFactoryInterceptor.singleton, InvokeRemoteInterceptor.singleton};
- PojiProxy handler = new PojiProxy(proxyFactoryRegistryKey, locator, interceptors);
+ PojiProxy handler = new Ejb3PojiProxy(proxyFactoryRegistryKey, locator, interceptors);
Class<?>[] interfaces = new Class<?>[]
{this.getProxyFactoryClass()};
proxyFactory = (ProxyFactory) Proxy.newProxyInstance(interfaces[0].getClassLoader(), interfaces, handler);
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-07-25 01:48:46 UTC (rev 76207)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/objectfactory/session/SessionProxyObjectFactory.java 2008-07-25 01:50:04 UTC (rev 76208)
@@ -96,13 +96,13 @@
if (hasHome && hasBusiness)
{
proxy = sFactory.createProxyDefault();
- log.debug("Created Proxy " + proxy + " for both EJB2.x and EJB3 Business Interfaces.");
+ log.debug("Created Proxy for both EJB2.x Home and EJB3 Business Interfaces.");
}
// If bound to home only
else if (hasHome)
{
proxy = sFactory.createProxyHome();
- log.debug("Created Proxy " + proxy + " for EJB2.x Home Interface(s)");
+ log.debug("Created Proxy for EJB2.x Home Interface(s)");
}
// If bound to business only
else if (hasBusiness)
@@ -130,13 +130,15 @@
// Obtain a proxy specific to this business interface
String businessInterface = businessInterfaces.get(0);
proxy = sFactory.createProxyBusiness(businessInterface);
- log.debug("Created Proxy " + proxy + " for EJB3 Business Interface: " + businessInterface);
+ log.debug("Created Proxy of type " + proxy.getClass().getSimpleName() + " for EJB3 Business Interface: "
+ + businessInterface);
}
else
{
// Use a general-purpose proxy for all business interfaces
proxy = sFactory.createProxyDefault();
- log.debug("Created Proxy " + proxy + " for EJB3 Business Interfaces: " + businessInterfaces);
+ log.debug("Created Proxy of type " + proxy.getClass().getSimpleName() + " for EJB3 Business Interfaces: "
+ + businessInterfaces);
}
}
// No valid type is bound here
Added: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/remoting/Ejb3PojiProxy.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/remoting/Ejb3PojiProxy.java (rev 0)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/remoting/Ejb3PojiProxy.java 2008-07-25 01:50:04 UTC (rev 76208)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.proxy.remoting;
+
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.joinpoint.MethodInvocation;
+import org.jboss.aspects.remoting.PojiProxy;
+import org.jboss.remoting.InvokerLocator;
+
+/**
+ * Ejb3PojiProxy
+ *
+ * An EJB3-specific implementation of the Remoting PojiProxy
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class Ejb3PojiProxy extends PojiProxy
+{
+ // ------------------------------------------------------------------------------||
+ // Class Members ---------------------------------------------------------------||
+ // ------------------------------------------------------------------------------||
+
+ private static final long serialVersionUID = 1L;
+
+ // ------------------------------------------------------------------------------||
+ // Constructor ------------------------------------------------------------------||
+ // ------------------------------------------------------------------------------||
+
+ public Ejb3PojiProxy(Object oid, InvokerLocator uri, Interceptor[] interceptors)
+ {
+ super(oid, uri, interceptors);
+ }
+
+ // ------------------------------------------------------------------------------||
+ // Overridden Implementations ---------------------------------------------------||
+ // ------------------------------------------------------------------------------||
+
+ //TODO Needs new release of jboss-remoting-aspects
+// /**
+// * Adds EJB3-specific metadata to the invocation before it's made
+// */
+// @Override
+// protected void addMetadataToInvocation(MethodInvocation methodInvocation)
+// {
+// // Call Super
+// super.addMetadataToInvocation(methodInvocation);
+//
+// // Add metadata for the IsLocalProxyFactoryInterceptor
+// //TODO
+//
+// }
+}
Modified: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/container/SessionContainer.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/container/SessionContainer.java 2008-07-25 01:48:46 UTC (rev 76207)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/container/SessionContainer.java 2008-07-25 01:50:04 UTC (rev 76208)
@@ -32,11 +32,11 @@
import org.jboss.aop.Dispatcher;
import org.jboss.beans.metadata.api.annotations.Start;
import org.jboss.beans.metadata.api.annotations.Stop;
+import org.jboss.ejb3.common.lang.SerializableMethod;
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.jndiregistrar.JndiSessionRegistrarBase;
-import org.jboss.ejb3.proxy.lang.SerializableMethod;
import org.jboss.logging.Logger;
import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
@@ -157,7 +157,7 @@
}
// Obtain the method for invocation
- Method m = this.getClassLoader().loadClass(method.getClassName()).getDeclaredMethod(method.getName(), argTypes);
+ Method m = this.getClassLoader().loadClass(method.getDeclaringClassName()).getDeclaredMethod(method.getName(), argTypes);
// Invoke on the bean
return invokeBean(proxy, m, args);
Modified: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/container/StatefulContainer.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/container/StatefulContainer.java 2008-07-25 01:48:46 UTC (rev 76207)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/container/StatefulContainer.java 2008-07-25 01:50:04 UTC (rev 76208)
@@ -27,9 +27,9 @@
import java.util.Map;
import java.util.UUID;
+import org.jboss.ejb3.interceptors.container.StatefulSessionContainerMethodInvocation;
import org.jboss.ejb3.proxy.container.StatefulSessionInvokableContext;
import org.jboss.ejb3.proxy.handler.session.stateful.StatefulProxyInvocationHandlerBase;
-import org.jboss.ejb3.proxy.invocation.StatefulSessionContainerMethodInvocation;
import org.jboss.ejb3.proxy.objectstore.ObjectStoreBindings;
import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
Modified: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/jndiregistrar/unit/JndiSessionRegistrarBaseTestCase.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/jndiregistrar/unit/JndiSessionRegistrarBaseTestCase.java 2008-07-25 01:48:46 UTC (rev 76207)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/jndiregistrar/unit/JndiSessionRegistrarBaseTestCase.java 2008-07-25 01:50:04 UTC (rev 76208)
@@ -187,7 +187,8 @@
assertNotNull("Failure - Lookup of remote home of SLSB returned null", home);
- assertTrue("Failure - Remote Home of SLSB, returned from lookup, is NOT instance of " + MyStatelessRemoteHome.class, (home instanceof MyStatelessRemoteHome));
+ assertTrue("Failure - Remote Home of SLSB, returned from lookup, is NOT instance of "
+ + MyStatelessRemoteHome.class, (home instanceof MyStatelessRemoteHome));
// lookup the bean local home to ensure its been bound to the jndi
Object localHome = ctx.lookup(getLocalHomeJndiName(sessionContainer));
@@ -195,7 +196,8 @@
assertNotNull("Failure - Lookup of local home of SLSB, returned null", localHome);
- assertTrue("Failure - Local SLSB returned from lookup is NOT instance of " + MyStatelessLocalHome.class, (localHome instanceof MyStatelessLocalHome));
+ assertTrue("Failure - Local SLSB returned from lookup is NOT instance of " + MyStatelessLocalHome.class,
+ (localHome instanceof MyStatelessLocalHome));
unbindAndTest(ctx, sessionContainer);
@@ -231,14 +233,16 @@
assertNotNull("Failure - Remote object of 3.0 SLSB is null", remote);
- assertTrue("Failure - Remote object of 3.0 SLSB is NOT an instance of " + MyStatelessRemote.class, (remote instanceof MyStatelessRemote));
+ assertTrue("Failure - Remote object of 3.0 SLSB is NOT an instance of " + MyStatelessRemote.class,
+ (remote instanceof MyStatelessRemote));
// lookup the local bean to ensure its been bound to the jndi
Object local = ctx.lookup(getDefaultBusinessLocalJndiName(sessionContainer));
assertNotNull("Failure - Local object of 3.0 SLSB is null", local);
- assertTrue("Failure - Local object of 3.0 SLSB is NOT an instance of " + MyStatelessLocal.class, (local instanceof MyStatelessLocal));
+ assertTrue("Failure - Local object of 3.0 SLSB is NOT an instance of " + MyStatelessLocal.class,
+ (local instanceof MyStatelessLocal));
unbindAndTest(ctx, sessionContainer);
@@ -276,13 +280,15 @@
assertNotNull("Failure - Remote home of 3.0 SLSB is null", home);
- assertTrue("Failure - Remote home of 3.0 SLSB is NOT an instance of " + MyStatelessRemoteHome.class, (home instanceof MyStatelessRemoteHome));
+ assertTrue("Failure - Remote home of 3.0 SLSB is NOT an instance of " + MyStatelessRemoteHome.class,
+ (home instanceof MyStatelessRemoteHome));
Object localHome = ctx.lookup(getLocalHomeJndiName(sessionContainer));
assertNotNull("Failure - Local home of 3.0 SLSB is null", localHome);
- assertTrue("Failure - Remote home of 3.0 SLSB is NOT an instance of " + MyStatelessLocalHome.class, (localHome instanceof MyStatelessLocalHome));
+ assertTrue("Failure - Remote home of 3.0 SLSB is NOT an instance of " + MyStatelessLocalHome.class,
+ (localHome instanceof MyStatelessLocalHome));
unbindAndTest(ctx, sessionContainer);
@@ -317,7 +323,8 @@
assertNotNull("Failure - Lookup of remote bean returned null", remote);
- assertTrue("Failure - Remote bean returned from lookup is NOT instance of " + MyStatelessRemote.class, (remote instanceof MyStatelessRemote));
+ assertTrue("Failure - Remote bean returned from lookup is NOT instance of " + MyStatelessRemote.class,
+ (remote instanceof MyStatelessRemote));
// Now bind to the JNDI, some object
ctx.bind("TestJndiName", "TestJndiObject");
@@ -360,7 +367,8 @@
assertNotNull("Failure - Lookup of remote SFSB returned null", remote);
- assertTrue("Failure - Remote SFSB returned from lookup is NOT instance of " + MyStatefulRemoteBusiness.class, (remote instanceof MyStatefulRemoteBusiness));
+ assertTrue("Failure - Remote SFSB returned from lookup is NOT instance of " + MyStatefulRemoteBusiness.class,
+ (remote instanceof MyStatefulRemoteBusiness));
// lookup local
Object local = (Object) ctx.lookup(getDefaultBusinessLocalJndiName(sessionContainer));
@@ -368,7 +376,8 @@
assertNotNull("Failure - Lookup of local SFSB returned null", local);
- assertTrue("Failure - Local SFSB returned from lookup is NOT instance of " + MyStatefulLocalBusiness.class, (local instanceof MyStatefulLocalBusiness));
+ assertTrue("Failure - Local SFSB returned from lookup is NOT instance of " + MyStatefulLocalBusiness.class,
+ (local instanceof MyStatefulLocalBusiness));
unbindAndTest(ctx, sessionContainer);
@@ -406,14 +415,16 @@
assertNotNull("Failure - Lookup of remote for SFSB returned null", remote);
- assertTrue("Failure - Remote SFSB is NOT instance of " + MyStatefulRemoteBusiness.class, (remote instanceof MyStatefulRemoteBusiness));
+ assertTrue("Failure - Remote SFSB is NOT instance of " + MyStatefulRemoteBusiness.class,
+ (remote instanceof MyStatefulRemoteBusiness));
// lookup the local
Object local = ctx.lookup(getDefaultBusinessLocalJndiName(sessionContainer));
assertNotNull("Failure - Lookup of local for SFSB returned null", local);
- assertTrue("Failure - Local SFSB is NOT instance of " + MyStatefulLocalBusiness.class, (local instanceof MyStatefulLocalBusiness));
+ assertTrue("Failure - Local SFSB is NOT instance of " + MyStatefulLocalBusiness.class,
+ (local instanceof MyStatefulLocalBusiness));
unbindAndTest(ctx, sessionContainer);
@@ -448,14 +459,16 @@
assertNotNull("Failure - Lookup of remote home for SFSB returned null", home);
- assertTrue("Failure - Remote home lookup of SFSB is NOT instance of " + MyStatefulRemoteHome.class, (home instanceof MyStatefulRemoteHome));
+ assertTrue("Failure - Remote home lookup of SFSB is NOT instance of " + MyStatefulRemoteHome.class,
+ (home instanceof MyStatefulRemoteHome));
// lookup the local home
Object localHome = ctx.lookup(getLocalHomeJndiName(sessionContainer));
assertNotNull("Failure - Lookup of local home for SFSB returned null", localHome);
- assertTrue("Failure - Local home lookup of SFSB is NOT instance of " + MyStatefulLocalHome.class, (localHome instanceof MyStatefulLocalHome));
+ assertTrue("Failure - Local home lookup of SFSB is NOT instance of " + MyStatefulLocalHome.class,
+ (localHome instanceof MyStatefulLocalHome));
unbindAndTest(ctx, sessionContainer);
@@ -544,7 +557,8 @@
{
for (String businessRemoteInterfaceName : businessRemotesMetadata)
{
- jndiNames.add(JbossSessionBeanJndiNameResolver.resolveJndiName(metadata, businessRemoteInterfaceName));
+ String jndiName = JbossSessionBeanJndiNameResolver.resolveJndiName(metadata, businessRemoteInterfaceName);
+ jndiNames.add(jndiName);
}
}
@@ -554,11 +568,14 @@
{
for (String businessLocalInterfaceName : businessLocalsMetadata)
{
- jndiNames.add(JbossSessionBeanJndiNameResolver.resolveJndiName(metadata, businessLocalInterfaceName));
+ String jndiName = JbossSessionBeanJndiNameResolver.resolveJndiName(metadata, businessLocalInterfaceName);
+ jndiNames.add(jndiName);
+
}
}
- logger.debug("Number of jndi names associated with session container " + sessionContainer.getName() + " = " + jndiNames.size());
+ logger.debug("Number of jndi names associated with session container " + sessionContainer.getName() + " = "
+ + jndiNames.size());
return jndiNames;
Modified: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/lang/MyClass.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/lang/MyClass.java 2008-07-25 01:48:46 UTC (rev 76207)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/lang/MyClass.java 2008-07-25 01:50:04 UTC (rev 76208)
@@ -24,7 +24,7 @@
import java.lang.reflect.Method;
import java.util.List;
-import org.jboss.ejb3.proxy.lang.SerializableMethod;
+import org.jboss.ejb3.common.lang.SerializableMethod;
import org.jboss.ejb3.test.proxy.lang.unit.SerializableMethodTestCase;
/**
Modified: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/lang/unit/SerializableMethodTestCase.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/lang/unit/SerializableMethodTestCase.java 2008-07-25 01:48:46 UTC (rev 76207)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/lang/unit/SerializableMethodTestCase.java 2008-07-25 01:50:04 UTC (rev 76208)
@@ -28,7 +28,7 @@
import java.lang.reflect.Method;
import java.util.List;
-import org.jboss.ejb3.proxy.lang.SerializableMethod;
+import org.jboss.ejb3.common.lang.SerializableMethod;
import org.jboss.ejb3.test.proxy.lang.MyChildClass;
import org.jboss.ejb3.test.proxy.lang.MyClass;
import org.jboss.ejb3.test.proxy.lang.SerializationUtil;
@@ -73,8 +73,10 @@
Method methodWithNoParamAndReturningVoid = myClass.getClass().getMethod("methodWithNoParamAndReturningVoid",
(Class<?>[]) null);
- SerializableMethod serializableMethod = new SerializableMethod(methodWithNoParamAndReturningVoid);
- SerializableMethod anotherSerializableMethod = new SerializableMethod(methodWithNoParamAndReturningVoid);
+ SerializableMethod serializableMethod = new SerializableMethod(methodWithNoParamAndReturningVoid, myClass
+ .getClass());
+ SerializableMethod anotherSerializableMethod = new SerializableMethod(methodWithNoParamAndReturningVoid, myClass
+ .getClass());
// These 2 SerializableMethod instances should be equal, as they were created for the same Method
assertTrue("Failure - Two SerializableMethod instances created out of the same Method are not equal",
@@ -103,9 +105,10 @@
Method methodAcceptingArrayOfPrimitives = myClass.getClass().getMethod("methodAcceptingArrayOfPrimitives",
new Class[]
{int[].class});
- SerializableMethod serializableMethod_arrayOfPrimitives = new SerializableMethod(methodAcceptingArrayOfPrimitives);
+ SerializableMethod serializableMethod_arrayOfPrimitives = new SerializableMethod(
+ methodAcceptingArrayOfPrimitives, myClass.getClass());
SerializableMethod anotherSerializableMethod_arrayOfPrimitives = new SerializableMethod(
- methodAcceptingArrayOfPrimitives);
+ methodAcceptingArrayOfPrimitives, myClass.getClass());
// test equals
assertTrue(
@@ -122,9 +125,10 @@
Method methodAcceptingArrayOfObjects = myClass.getClass().getMethod("methodAcceptingArrayOfObjects", new Class[]
{Object[].class});
- SerializableMethod serializableMethod_arrayOfObjects = new SerializableMethod(methodAcceptingArrayOfObjects);
+ SerializableMethod serializableMethod_arrayOfObjects = new SerializableMethod(methodAcceptingArrayOfObjects,
+ myClass.getClass());
SerializableMethod anotherSerializableMethod_arrayOfObjects = new SerializableMethod(
- methodAcceptingArrayOfObjects);
+ methodAcceptingArrayOfObjects, myClass.getClass());
// test equals
assertTrue(
@@ -158,8 +162,10 @@
"methodWithParamAndReturningVoid", new Class[]
{Integer.class});
- SerializableMethod serializableMethod = new SerializableMethod(methodAcceptingStringParamAndReturingVoid);
- SerializableMethod anotherSerializableMethod = new SerializableMethod(methodAcceptingIntegerParamAndReturingVoid);
+ SerializableMethod serializableMethod = new SerializableMethod(methodAcceptingStringParamAndReturingVoid, myClass
+ .getClass());
+ SerializableMethod anotherSerializableMethod = new SerializableMethod(methodAcceptingIntegerParamAndReturingVoid,
+ myClass.getClass());
// test the equals
assertFalse("Failure - Two Serializable method instances created for 2 different overloaded methods are equal",
@@ -174,9 +180,9 @@
{int.class});
SerializableMethod serializableMethod_PrimitiveIntParam = new SerializableMethod(
- methodAcceptingPrimitiveIntAndReturningVoid);
+ methodAcceptingPrimitiveIntAndReturningVoid, myClass.getClass());
SerializableMethod serializableMethod_IntegerParam = new SerializableMethod(
- methodAcceptingIntegerParamAndReturingVoid);
+ methodAcceptingIntegerParamAndReturingVoid, myClass.getClass());
// test the equals
assertFalse(
@@ -189,7 +195,8 @@
Method methodAcceptingObject = myClass.getClass().getMethod("methodWithParamAndReturningVoid", new Class[]
{Object.class});
- SerializableMethod serializableMethod_ObjectParam = new SerializableMethod(methodAcceptingObject);
+ SerializableMethod serializableMethod_ObjectParam = new SerializableMethod(methodAcceptingObject, myClass
+ .getClass());
// test the equals
assertFalse(
@@ -214,8 +221,10 @@
Method toStringMethodOfMyClass = myClass.getClass().getDeclaredMethod("toString", (Class<?>[]) null);
Method toStringMethodOfObject = Object.class.getDeclaredMethod("toString", (Class<?>[]) null);
- SerializableMethod serializableMethod_toStringForMyClass = new SerializableMethod(toStringMethodOfMyClass);
- SerializableMethod serializableMethod_toStringForThisTestCase = new SerializableMethod(toStringMethodOfObject);
+ SerializableMethod serializableMethod_toStringForMyClass = new SerializableMethod(toStringMethodOfMyClass,
+ myClass.getClass());
+ SerializableMethod serializableMethod_toStringForThisTestCase = new SerializableMethod(toStringMethodOfObject,
+ Object.class);
// test the equals
assertFalse("Failure - Two SerializableMethod instances for same methods from two different classes are equal",
@@ -240,7 +249,7 @@
Method methodWithParam = myClass.getClass().getMethod("methodAcceptingArrayOfObjects", new Class[]
{Object[].class});
- SerializableMethod serializableMethod = new SerializableMethod(methodWithParam);
+ SerializableMethod serializableMethod = new SerializableMethod(methodWithParam, myClass.getClass());
SerializableMethod copyOfSerializableMethod = (SerializableMethod) SerializationUtil.getCopy(serializableMethod);
@@ -256,7 +265,7 @@
Method method = myClass.getClass().getMethod("methodAcceptingMyClass", new Class[]
{MyClass.class});
- SerializableMethod serializableMethod_nonSerializableParam = new SerializableMethod(method);
+ SerializableMethod serializableMethod_nonSerializableParam = new SerializableMethod(method, myClass.getClass());
SerializableMethod copyOfSerializableMethod_nonSerilizableParam = (SerializableMethod) SerializationUtil
.getCopy(serializableMethod_nonSerializableParam);
@@ -292,17 +301,20 @@
Method toStringMethodOfThisClass = this.getClass().getMethod("toString", (Class<?>[]) null);
Method toStringMethodOfObject = Object.class.getMethod("toString", (Class<?>[]) null);
- SerializableMethod serializableMethod_toStringOfThisClass = new SerializableMethod(toStringMethodOfThisClass);
- SerializableMethod serializableMethod_toStringOfObjectClass = new SerializableMethod(toStringMethodOfObject);
+ SerializableMethod serializableMethod_toStringOfThisClass = new SerializableMethod(toStringMethodOfThisClass,
+ myClass.getClass());
+ SerializableMethod serializableMethod_toStringOfObjectClass = new SerializableMethod(toStringMethodOfObject,
+ Object.class);
// test equals
- assertTrue("Failure - Two SerializableMethod instances of method belonging to the same base class are not equal",
- serializableMethod_toStringOfObjectClass.equals(serializableMethod_toStringOfThisClass));
+ assertTrue(
+ "Failure - Two SerializableMethod instances of method belonging to the same base class must not be equal",
+ !serializableMethod_toStringOfObjectClass.equals(serializableMethod_toStringOfThisClass));
// test hashCode
- assertEquals(
- "Failure - Two SerializableMethod instances of method belonging to the same base class have different hashCode",
- serializableMethod_toStringOfObjectClass.hashCode(), serializableMethod_toStringOfThisClass.hashCode());
+ assertTrue(
+ "Failure - Two SerializableMethod instances of method belonging to the same base class must have different hashCode",
+ serializableMethod_toStringOfObjectClass.hashCode() != serializableMethod_toStringOfThisClass.hashCode());
// Test that the SerializableMethod instances created
// for overridden methods are NOT equal
@@ -312,8 +324,8 @@
Method methodFromParentClass = MyClass.class.getDeclaredMethod("methodWithParamAndReturningVoid", new Class[]
{Integer.class});
- SerializableMethod serializableMethodForChild = new SerializableMethod(methodFromChildClass);
- SerializableMethod serializableMethodForParent = new SerializableMethod(methodFromParentClass);
+ SerializableMethod serializableMethodForChild = new SerializableMethod(methodFromChildClass, MyChildClass.class);
+ SerializableMethod serializableMethodForParent = new SerializableMethod(methodFromParentClass, MyClass.class);
// test equals
assertFalse("Failure - The SerializableMethod instances of method from base class and child class are equal",
@@ -339,8 +351,8 @@
Method anotherGenericMethod = myClass.getClass().getMethod("methodWithGenerics", new Class[]
{List.class, int.class});
- SerializableMethod serializableMethod = new SerializableMethod(genericsMethod);
- SerializableMethod anotherSerializableMethod = new SerializableMethod(anotherGenericMethod);
+ SerializableMethod serializableMethod = new SerializableMethod(genericsMethod, myClass.getClass());
+ SerializableMethod anotherSerializableMethod = new SerializableMethod(anotherGenericMethod, myClass.getClass());
// test equals
assertTrue("Failure - Two SerializableMethod instances for a method involving generics are not equal",
@@ -370,7 +382,7 @@
Method methodWithoutPrimitivesParams = myClass.getClass().getMethod("methodWithParamAndReturningVoid",
new Class[]
{Integer.class});
- SerializableMethod serializableMethod = new SerializableMethod(methodWithoutPrimitivesParams);
+ SerializableMethod serializableMethod = new SerializableMethod(methodWithoutPrimitivesParams, myClass.getClass());
// invoke the toMethod()
Method copyOfMethodWithoutPrimitiveParams = serializableMethod.toMethod();
@@ -404,7 +416,7 @@
Method methodWithGenerics = myClass.getClass().getMethod("methodWithGenerics", new Class[]
{List.class, int.class});
- SerializableMethod serializableMethod = new SerializableMethod(methodWithGenerics);
+ SerializableMethod serializableMethod = new SerializableMethod(methodWithGenerics, myClass.getClass());
Method copyOfMethodWithGenerics = serializableMethod.toMethod();
@@ -437,7 +449,7 @@
Method method = myClass.getClass().getMethod("methodWithPrimitiveParamsAndReturningVoid", new Class[]
{byte.class, short.class, int.class, long.class, char.class, float.class, double.class, boolean.class});
- SerializableMethod serializableMethod = new SerializableMethod(method);
+ SerializableMethod serializableMethod = new SerializableMethod(method, myClass.getClass());
// invoke the toMethod()
Method copyOfMethod = serializableMethod.toMethod();
@@ -467,7 +479,7 @@
Method methodReturningInteger = myClass.getClass().getMethod("methodReturingInteger", new Class[]
{Integer.class});
- SerializableMethod serializableMethod = new SerializableMethod(methodReturningInteger);
+ SerializableMethod serializableMethod = new SerializableMethod(methodReturningInteger, myClass.getClass());
// invoke the toMethod()
Method copyOfMethodReturingInteger = serializableMethod.toMethod();
@@ -501,7 +513,8 @@
Method methodAcceptingArrayOfPrimitives = myClass.getClass().getMethod("methodAcceptingArrayOfPrimitives",
new Class[]
{int[].class});
- SerializableMethod serializableMethod = new SerializableMethod(methodAcceptingArrayOfPrimitives);
+ SerializableMethod serializableMethod = new SerializableMethod(methodAcceptingArrayOfPrimitives, myClass
+ .getClass());
// invoke the toMethod()
Method copyOfMethodAcceptingArrayOfPrimitives = serializableMethod.toMethod();
@@ -523,7 +536,8 @@
Method methodAcceptingArrayOfObjects = myClass.getClass().getMethod("methodAcceptingArrayOfObjects", new Class[]
{Object[].class});
- SerializableMethod serializableMethod_arrayOfObjParams = new SerializableMethod(methodAcceptingArrayOfObjects);
+ SerializableMethod serializableMethod_arrayOfObjParams = new SerializableMethod(methodAcceptingArrayOfObjects,
+ myClass.getClass());
//invoke the toMethod()
Method copyOfMethodAcceptingArrayOfObjects = serializableMethod_arrayOfObjParams.toMethod();
@@ -554,10 +568,14 @@
Method method = myClass.getClass().getMethod("methodAcceptingMyClass", new Class[]
{MyClass.class});
- SerializableMethod serializableMethod = new SerializableMethod(method);
+ Method methodToString = myClass.getClass().getMethod("toString", new Class[]
+ {});
+ SerializableMethod serializableMethod = new SerializableMethod(method, myClass.getClass());
+ SerializableMethod serializableMethodToString = new SerializableMethod(methodToString, myClass.getClass());
// invoke toMethod
Method copyOfMethod = serializableMethod.toMethod(this.getClass().getClassLoader());
+ Method copyOfMethodToString = serializableMethodToString.toMethod(this.getClass().getClassLoader());
// test equals
assertTrue("Failure - equals fails with classsloader passed to toMethod", method.equals(copyOfMethod));
@@ -566,6 +584,9 @@
assertEquals("Failure - hashCode does not match when classloader is passed to toMethod", method.hashCode(),
copyOfMethod.hashCode());
+ // test toString
+ assertEquals("Roundtrip of inherited method toString failed",copyOfMethodToString, methodToString);
+
logger.info("Completed testing the toMethod(Classloader)");
}
@@ -588,7 +609,7 @@
Method method = myClass.getClass().getMethod("methodAcceptingMyClass", new Class[]
{MyClass.class});
- SerializableMethod serializableMethod = new SerializableMethod(method);
+ SerializableMethod serializableMethod = new SerializableMethod(method, myClass.getClass());
// now make a copy through serialization/de-serialization
SerializableMethod copyOfSerializableMethod = (SerializableMethod) SerializationUtil.getCopy(serializableMethod);
More information about the jboss-cvs-commits
mailing list