[jboss-cvs] JBossAS SVN: r72638 - in projects/ejb3/trunk/core: .settings and 24 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Apr 23 17:35:40 EDT 2008
Author: ALRubinger
Date: 2008-04-23 17:35:39 -0400 (Wed, 23 Apr 2008)
New Revision: 72638
Added:
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/LocalProxyInvocationHandler.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/JBossProxy.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/JndiSessionProxyObjectFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/ProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/ProxyUtils.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/BaseSessionProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/ProxyFactoryHelper.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/ProxyFactoryNotRegisteredException.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/RemoteProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/RemoteProxyFactoryRegistry.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/SessionProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/service/
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/service/BaseServiceProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/service/ServiceLocalProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/service/ServiceRemoteProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulRemoteProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulClusterProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulRemoteProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessRemoteProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessClusterProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessLocalProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessRemoteProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/BaseProxyInvocationHandler.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/BaseProxyInvocationHandlerRemote.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/BaseSessionRemoteProxyInvocationHandler.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandler.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/RemoteProxyInvocationHandler.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/service/
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/service/ServiceLocalProxyInvocationHandler.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/service/ServiceRemoteProxyInvocationHandler.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulClusteredInvocationHandler.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulHomeRemoteProxyInvocationHandler.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulLocalHomeProxyInvocationHandler.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulLocalProxyInvocationHandler.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulRemoteProxyInvocationHandler.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateless/
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateless/StatelessClusteredInvocationHandler.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateless/StatelessLocalProxyInvocationHandler.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateless/StatelessRemoteProxyInvocationHandler.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/impl/
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/impl/EJBMetaDataImpl.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/impl/HomeHandleImpl.java
Removed:
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/JBossProxy.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/JndiProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/LocalProxy.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/ProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/ProxyFactoryHelper.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/ProxyUtils.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/EJBMetaDataImpl.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/BaseSessionProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/ProxyFactoryHelper.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/ProxyFactoryNotRegisteredException.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/RemoteProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/RemoteProxyFactoryRegistry.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/SessionProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/service/
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/service/BaseServiceProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/service/ServiceLocalProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/service/ServiceRemoteProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulRemoteProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulClusterProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulRemoteProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessRemoteProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessClusterProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessLocalProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessRemoteProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handle/
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/BaseProxyInvocationHandler.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/BaseProxyInvocationHandlerRemote.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/BaseSessionRemoteProxyInvocationHandler.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandler.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/RemoteProxyInvocationHandler.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/service/
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/service/ServiceLocalProxyInvocationHandler.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/service/ServiceRemoteProxyInvocationHandler.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulClusteredInvocationHandler.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulHomeRemoteProxyInvocationHandler.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulLocalHomeProxyInvocationHandler.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulLocalProxyInvocationHandler.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulRemoteProxyInvocationHandler.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateless/
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateless/StatelessClusteredInvocationHandler.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateless/StatelessLocalProxyInvocationHandler.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateless/StatelessRemoteProxyInvocationHandler.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/impl/EJBMetaDataImpl.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/impl/HomeHandleImpl.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/BaseRemoteProxy.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/Proxy.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/ProxyFactoryNotRegisteredException.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/RemoteProxy.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/RemoteProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/RemoteProxyFactoryRegistry.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/BaseServiceProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/ServiceLocalProxy.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/ServiceLocalProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/ServiceRemoteProxy.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/ServiceRemoteProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/BaseSessionProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/BaseSessionRemoteProxy.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/BaseStatefulProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/BaseStatefulRemoteProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulClusterProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulClusteredProxy.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulHomeRemoteProxy.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulLocalHomeProxy.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulLocalProxy.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulRemoteProxy.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulRemoteProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/BaseStatelessProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/BaseStatelessRemoteProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessClusterProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessClusteredProxy.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessLocalProxy.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessLocalProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessRemoteProxy.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessRemoteProxyFactory.java
Modified:
projects/ejb3/trunk/core/.classpath
projects/ejb3/trunk/core/.project
projects/ejb3/trunk/core/.settings/org.eclipse.jdt.core.prefs
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContainer.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/Ejb3Deployment.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/Ejb3DescriptorHandler.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/asynchronous/Asynch.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/enc/DeploymentEjbResolver.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/mdb/MDB.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/mdb/MessagingContainer.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/mdb/ProducerFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/mdb/RemoteProducerFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/ServiceContainer.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/ProxyDeployer.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionContainer.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulLocalProxyFactory.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulSessionContextDelegate.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessSessionContextImpl.java
projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/asynchronous/Tester.java
projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/asynchronous/TesterMBean.java
projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/asynchronous/unit/AsynchronousTestCase.java
projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/bank/TellerRemoteProxyFactory.java
projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/stateful/StatefulRemoteProxyFactory.java
projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/statefulproxyfactoryoverride/StatefulRemoteProxyFactory.java
Log:
[EJBTHREE-1269] Merged dev/ejbthree1269 back into trunk from 72135:72636
Modified: projects/ejb3/trunk/core/.classpath
===================================================================
--- projects/ejb3/trunk/core/.classpath 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/.classpath 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,150 +1,150 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src/main/java"/>
- <classpathentry excluding="**/*.java" kind="src" path="src/main/resources"/>
- <classpathentry kind="src" output="target/tests-classes" path="src/test/java"/>
- <classpathentry excluding="**/*.java" kind="src" output="target/tests-classes" path="src/test/resources"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="var" path="M2_REPO/javax/activation/activation/1.0.2/activation-1.0.2.jar"/>
- <classpathentry kind="var" path="M2_REPO/ant/ant/1.6.5/ant-1.6.5.jar" sourcepath="M2_REPO/ant/ant/1.6.5/ant-1.6.5-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant/1.7.0/ant-1.7.0.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant-junit/1.7.0/ant-junit-1.7.0.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant-launcher/1.7.0/ant-launcher-1.7.0.jar"/>
- <classpathentry kind="var" path="M2_REPO/antlr/antlr/2.7.6/antlr-2.7.6.jar" sourcepath="M2_REPO/antlr/antlr/2.7.6/antlr-2.7.6-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/asm/asm/1.5.3/asm-1.5.3.jar"/>
- <classpathentry kind="var" path="M2_REPO/asm/asm-attrs/1.5.3/asm-attrs-1.5.3.jar"/>
- <classpathentry kind="var" path="M2_REPO/apache-avalon/avalon-framework/4.1.5/avalon-framework-4.1.5.jar"/>
- <classpathentry kind="var" path="M2_REPO/bcel/bcel/5.1/bcel-5.1.jar" sourcepath="M2_REPO/bcel/bcel/5.1/bcel-5.1-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/bsh/bsh/1.3.0/bsh-1.3.0.jar"/>
- <classpathentry kind="var" path="M2_REPO/cglib/cglib/2.1_3/cglib-2.1_3.jar" sourcepath="M2_REPO/cglib/cglib/2.1_3/cglib-2.1_3-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/commons-collections/commons-collections/2.1.1/commons-collections-2.1.1.jar" sourcepath="M2_REPO/commons-collections/commons-collections/2.1.1/commons-collections-2.1.1-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/apache-httpclient/commons-httpclient/2.0.2/commons-httpclient-2.0.2.jar"/>
- <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar" sourcepath="M2_REPO/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/oswego-concurrent/concurrent/1.3.4-jboss-update1/concurrent-1.3.4-jboss-update1.jar" sourcepath="M2_REPO/oswego-concurrent/concurrent/1.3.4-jboss-update1/concurrent-1.3.4-jboss-update1-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar" sourcepath="M2_REPO/dom4j/dom4j/1.6.1/dom4j-1.6.1-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/wutka-dtdparser/dtdparser121/1.2.1/dtdparser121-1.2.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/net/sf/ehcache/ehcache/1.2.3/ehcache-1.2.3.jar" sourcepath="M2_REPO/net/sf/ehcache/ehcache/1.2.3/ehcache-1.2.3-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/hibernate/ejb3-persistence/1.0.1.GA/ejb3-persistence-1.0.1.GA.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate/3.2.6.ga/hibernate-3.2.6.ga.jar" sourcepath="M2_REPO/org/hibernate/hibernate/3.2.6.ga/hibernate-3.2.6.ga-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-annotations/3.3.1.GA/hibernate-annotations-3.3.1.GA.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-commons-annotations/3.0.0.ga/hibernate-commons-annotations-3.0.0.ga.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-entitymanager/3.3.2.GA/hibernate-entitymanager-3.3.2.GA.jar"/>
- <classpathentry kind="var" path="M2_REPO/hsqldb/hsqldb/1.8.0.7/hsqldb-1.8.0.7.jar"/>
- <classpathentry kind="var" path="M2_REPO/javax/security/jaas/1.0.01/jaas-1.0.01.jar"/>
- <classpathentry kind="var" path="M2_REPO/javax/security/jacc/1.0/jacc-1.0.jar"/>
- <classpathentry kind="var" path="M2_REPO/jacorb/jacorb/2.3.0jboss.patch5-brew/jacorb-2.3.0jboss.patch5-brew.jar"/>
- <classpathentry kind="var" path="M2_REPO/urbanophile/java-getopt/1.0.9/java-getopt-1.0.9.jar"/>
- <classpathentry kind="var" path="M2_REPO/javassist/javassist/3.4.GA/javassist-3.4.GA.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/javassist/3.6.0.GA/javassist-3.6.0.GA.jar" sourcepath="M2_REPO/org/jboss/javassist/3.6.0.GA/javassist-3.6.0.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1.jar" sourcepath="M2_REPO/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/sun-jaxb/jaxb-api/2.1.4/jaxb-api-2.1.4.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/aop/jboss-aop/2.0.0.CR7/jboss-aop-2.0.0.CR7.jar" sourcepath="M2_REPO/org/jboss/aop/jboss-aop/2.0.0.CR7/jboss-aop-2.0.0.CR7-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/aop/jboss-aop-aspects/2.0.0.CR7/jboss-aop-aspects-2.0.0.CR7.jar" sourcepath="M2_REPO/org/jboss/aop/jboss-aop-aspects/2.0.0.CR7/jboss-aop-aspects-2.0.0.CR7-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/jboss/aop/jboss-aop-deployer-jdk50/2.0.0.CR8/jboss-aop-deployer-jdk50-2.0.0.CR8.jar"/>
- <classpathentry kind="var" path="M2_REPO/jboss/aop/jboss-aop-jboss4-jdk50/2.0.0.CR8/jboss-aop-jboss4-jdk50-2.0.0.CR8.jar"/>
- <classpathentry kind="var" path="M2_REPO/jboss/aop/jboss-aop-jdk50/2.0.0.CR8/jboss-aop-jdk50-2.0.0.CR8.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-aop-mc-int/2.0.0.Beta13/jboss-aop-mc-int-2.0.0.Beta13.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-as-aspects/5.0.0-SNAPSHOT/jboss-as-aspects-5.0.0-SNAPSHOT.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-as-bootstrap/5.0.0-SNAPSHOT/jboss-as-bootstrap-5.0.0-SNAPSHOT.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-as-connector/5.0.0-SNAPSHOT/jboss-as-connector-5.0.0-SNAPSHOT.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-as-j2se/5.0.0-SNAPSHOT/jboss-as-j2se-5.0.0-SNAPSHOT.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-as-j2se/5.0.0-SNAPSHOT/jboss-as-j2se-5.0.0-SNAPSHOT-tests.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-as-jmx/5.0.0-SNAPSHOT/jboss-as-jmx-5.0.0-SNAPSHOT.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-as-main/5.0.0-SNAPSHOT/jboss-as-main-5.0.0-SNAPSHOT.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-as-mbeans/5.0.0-SNAPSHOT/jboss-as-mbeans-5.0.0-SNAPSHOT.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-as-naming/5.0.0-SNAPSHOT/jboss-as-naming-5.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/jbossas/jboss-as-naming/5.0.0-SNAPSHOT/jboss-as-naming-5.0.0-SNAPSHOT-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-as-profileservice/5.0.0-SNAPSHOT/jboss-as-profileservice-5.0.0-SNAPSHOT.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-as-server/5.0.0-SNAPSHOT/jboss-as-server-5.0.0-SNAPSHOT.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-as-server/5.0.0-SNAPSHOT/jboss-as-server-5.0.0-SNAPSHOT-client.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-as-server-manager/0.1.0-SNAPSHOT/jboss-as-server-manager-0.1.0-SNAPSHOT.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-as-system/5.0.0-SNAPSHOT/jboss-as-system-5.0.0-SNAPSHOT.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-as-system-jmx/5.0.0-SNAPSHOT/jboss-as-system-jmx-5.0.0-SNAPSHOT.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/cl/jboss-classloader/2.0.0.Beta11/jboss-classloader-2.0.0.Beta11.jar" sourcepath="M2_REPO/org/jboss/cl/jboss-classloader/2.0.0.Beta11/jboss-classloader-2.0.0.Beta11-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/cl/jboss-classloading/2.0.0.Beta11/jboss-classloading-2.0.0.Beta11.jar" sourcepath="M2_REPO/org/jboss/cl/jboss-classloading/2.0.0.Beta11/jboss-classloading-2.0.0.Beta11-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-classloading-spi/5.0.0.Beta4/jboss-classloading-spi-5.0.0.Beta4.jar" sourcepath="M2_REPO/org/jboss/jboss-classloading-spi/5.0.0.Beta4/jboss-classloading-spi-5.0.0.Beta4-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/cl/jboss-classloading-vfs/2.0.0.Beta11/jboss-classloading-vfs-2.0.0.Beta11.jar" sourcepath="M2_REPO/org/jboss/cl/jboss-classloading-vfs/2.0.0.Beta11/jboss-classloading-vfs-2.0.0.Beta11-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/jboss/jboss-common-core/2.0.2.GA/jboss-common-core-2.0.2.GA.jar" sourcepath="M2_REPO/jboss/jboss-common-core/2.0.2.GA/jboss-common-core-2.0.2.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-common-core/2.2.5.GA/jboss-common-core-2.2.5.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-common-core/2.2.5.GA/jboss-common-core-2.2.5.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/jboss/jboss-common-logging-log4j/2.0.4.GA/jboss-common-logging-log4j-2.0.4.GA.jar" sourcepath="M2_REPO/jboss/jboss-common-logging-log4j/2.0.4.GA/jboss-common-logging-log4j-2.0.4.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/jboss/jboss-common-logging-spi/2.0.4.GA/jboss-common-logging-spi-2.0.4.GA.jar" sourcepath="M2_REPO/jboss/jboss-common-logging-spi/2.0.4.GA/jboss-common-logging-spi-2.0.4.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-container/2.0.0.Beta9/jboss-container-2.0.0.Beta9.jar" sourcepath="M2_REPO/org/jboss/microcontainer/jboss-container/2.0.0.Beta9/jboss-container-2.0.0.Beta9-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-corba-ots-spi/5.0.0.Beta4/jboss-corba-ots-spi-5.0.0.Beta4.jar" sourcepath="M2_REPO/org/jboss/jboss-corba-ots-spi/5.0.0.Beta4/jboss-corba-ots-spi-5.0.0.Beta4-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-dependency/2.0.0.Beta9/jboss-dependency-2.0.0.Beta9.jar" sourcepath="M2_REPO/org/jboss/microcontainer/jboss-dependency/2.0.0.Beta9/jboss-dependency-2.0.0.Beta9-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/deployers/jboss-deployers-client/2.0.0.Beta14/jboss-deployers-client-2.0.0.Beta14.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/deployers/jboss-deployers-client-spi/2.0.0.Beta14/jboss-deployers-client-spi-2.0.0.Beta14.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-deployers-client-spi/2.0.0.Beta6/jboss-deployers-client-spi-2.0.0.Beta6.jar" sourcepath="M2_REPO/org/jboss/microcontainer/jboss-deployers-client-spi/2.0.0.Beta6/jboss-deployers-client-spi-2.0.0.Beta6-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/deployers/jboss-deployers-core/2.0.0.Beta14/jboss-deployers-core-2.0.0.Beta14.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/deployers/jboss-deployers-core-spi/2.0.0.Beta14/jboss-deployers-core-spi-2.0.0.Beta14.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-deployers-core-spi/2.0.0.Beta9/jboss-deployers-core-spi-2.0.0.Beta9.jar" sourcepath="M2_REPO/org/jboss/microcontainer/jboss-deployers-core-spi/2.0.0.Beta9/jboss-deployers-core-spi-2.0.0.Beta9-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/deployers/jboss-deployers-impl/2.0.0.Beta14/jboss-deployers-impl-2.0.0.Beta14.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/deployers/jboss-deployers-spi/2.0.0.Beta14/jboss-deployers-spi-2.0.0.Beta14.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/deployers/jboss-deployers-structure-spi/2.0.0.Beta14/jboss-deployers-structure-spi-2.0.0.Beta14.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/deployers/jboss-deployers-vfs/2.0.0.Beta14/jboss-deployers-vfs-2.0.0.Beta14.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/deployers/jboss-deployers-vfs-spi/2.0.0.Beta14/jboss-deployers-vfs-spi-2.0.0.Beta14.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-ejb-api/3.0.0.Beta3Update1/jboss-ejb-api-3.0.0.Beta3Update1.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-ejb-api/3.0.0.Beta3Update1/jboss-ejb-api-3.0.0.Beta3Update1-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/ejb3/jboss-ejb3-ext-api/0.3/jboss-ejb3-ext-api-0.3.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/ejb3/jboss-ejb3-ext-api-impl/0.3-SNAPSHOT/jboss-ejb3-ext-api-impl-0.3-SNAPSHOT.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/ejb3/jboss-ejb3-metadata/0.12.1/jboss-ejb3-metadata-0.12.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/embedded/jboss-embedded/beta3-SNAPSHOT/jboss-embedded-beta3-SNAPSHOT.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/cluster/jboss-ha-client/1.0.0.GA/jboss-ha-client-1.0.0.GA.jar" sourcepath="M2_REPO/org/jboss/cluster/jboss-ha-client/1.0.0.GA/jboss-ha-client-1.0.0.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/cluster/jboss-ha-server-api/1.0.0.GA/jboss-ha-server-api-1.0.0.GA.jar" sourcepath="M2_REPO/org/jboss/cluster/jboss-ha-server-api/1.0.0.GA/jboss-ha-server-api-1.0.0.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-jacc-api/1.1.0.Beta3Update1/jboss-jacc-api-1.1.0.Beta3Update1.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-jacc-api/1.1.0.Beta3Update1/jboss-jacc-api-1.1.0.Beta3Update1-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-jaspi-api/1.0-BETA1/jboss-jaspi-api-1.0-BETA1.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-jaspi-api/1.0-BETA1/jboss-jaspi-api-1.0-BETA1-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-javaee/5.0.0.Beta3/jboss-javaee-5.0.0.Beta3.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-javaee/5.0.0.Beta3/jboss-javaee-5.0.0.Beta3-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/jboss/jbossws/jboss-jaxrpc/1.0.4.GA/jboss-jaxrpc-1.0.4.GA.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-jaxws/2.0.1.GA/jboss-jaxws-2.0.1.GA.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-jca-api/1.5.0.Beta3Update1/jboss-jca-api-1.5.0.Beta3Update1.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-jca-api/1.5.0.Beta3Update1/jboss-jca-api-1.5.0.Beta3Update1-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-jms-api/1.1.0-SNAPSHOT/jboss-jms-api-1.1.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-jms-api/1.1.0-SNAPSHOT/jboss-jms-api-1.1.0-SNAPSHOT-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-kernel/2.0.0.Beta9/jboss-kernel-2.0.0.Beta9.jar" sourcepath="M2_REPO/org/jboss/microcontainer/jboss-kernel/2.0.0.Beta9/jboss-kernel-2.0.0.Beta9-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/jboss/jboss-logging-log4j/2.0.2.GA/jboss-logging-log4j-2.0.2.GA.jar" sourcepath="M2_REPO/jboss/jboss-logging-log4j/2.0.2.GA/jboss-logging-log4j-2.0.2.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging-log4j/2.0.5.GA/jboss-logging-log4j-2.0.5.GA.jar" sourcepath="M2_REPO/org/jboss/logging/jboss-logging-log4j/2.0.5.GA/jboss-logging-log4j-2.0.5.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/jboss/jboss-logging-spi/2.0.3.GA/jboss-logging-spi-2.0.3.GA.jar" sourcepath="M2_REPO/jboss/jboss-logging-spi/2.0.3.GA/jboss-logging-spi-2.0.3.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA.jar" sourcepath="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/man/jboss-managed/2.0.0.Beta12/jboss-managed-2.0.0.Beta12.jar" sourcepath="M2_REPO/org/jboss/man/jboss-managed/2.0.0.Beta12/jboss-managed-2.0.0.Beta12-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-managed/2.0.0.Beta9/jboss-managed-2.0.0.Beta9.jar" sourcepath="M2_REPO/org/jboss/microcontainer/jboss-managed/2.0.0.Beta9/jboss-managed-2.0.0.Beta9-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/metadata/jboss-metadata/1.0.0-SNAPSHOT/jboss-metadata-1.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/metadata/jboss-metadata/1.0.0.Beta7/jboss-metadata-1.0.0.Beta7-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/man/jboss-metatype/2.0.0.Beta12/jboss-metatype-2.0.0.Beta12.jar" sourcepath="M2_REPO/org/jboss/man/jboss-metatype/2.0.0.Beta12/jboss-metatype-2.0.0.Beta12-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-metatype/2.0.0.Beta9/jboss-metatype-2.0.0.Beta9.jar" sourcepath="M2_REPO/org/jboss/microcontainer/jboss-metatype/2.0.0.Beta9/jboss-metatype-2.0.0.Beta9-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-persistence-api/3.0.0.Beta3Update1/jboss-persistence-api-3.0.0.Beta3Update1.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-persistence-api/3.0.0.Beta3Update1/jboss-persistence-api-3.0.0.Beta3Update1-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/jboss/profiler/jvmti/jboss-profiler-jvmti/1.0.0.CR5/jboss-profiler-jvmti-1.0.0.CR5.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-reflect/2.0.0.Beta12/jboss-reflect-2.0.0.Beta12.jar" sourcepath="M2_REPO/org/jboss/jboss-reflect/2.0.0.Beta12/jboss-reflect-2.0.0.Beta12-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/jboss/remoting/jboss-remoting/2.4.0.CR1/jboss-remoting-2.4.0.CR1.jar" sourcepath="M2_REPO/jboss/remoting/jboss-remoting/2.4.0.CR1/jboss-remoting-2.4.0.CR1-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/aspects/jboss-remoting-aspects/1.0.0-SNAPSHOT/jboss-remoting-aspects-1.0.0-SNAPSHOT.jar"/>
- <classpathentry kind="var" path="M2_REPO/jboss/jbossws/jboss-saaj/3.0.1-native-2.0.4.GA/jboss-saaj-3.0.1-native-2.0.4.GA.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/aspects/jboss-security-aspects/1.0.0-SNAPSHOT/jboss-security-aspects-1.0.0-SNAPSHOT.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/security/jboss-security-spi/2.0.2.Beta6/jboss-security-spi-2.0.2.Beta6.jar"/>
- <classpathentry kind="var" path="M2_REPO/jboss/jboss-serialization/1.0.3.GA/jboss-serialization-1.0.3.GA.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-servlet-api/2.5.0-SNAPSHOT/jboss-servlet-api-2.5.0-SNAPSHOT.jar"/>
- <classpathentry kind="var" path="M2_REPO/jboss/aop/jboss-standalone-aspect-library-jdk50/2.0.0.CR8/jboss-standalone-aspect-library-jdk50-2.0.0.CR8.jar"/>
- <classpathentry kind="var" path="M2_REPO/jboss/jboss-test/1.0.3.GA/jboss-test-1.0.3.GA.jar" sourcepath="M2_REPO/jboss/jboss-test/1.0.3.GA/jboss-test-1.0.3.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-test/1.0.6-SNAPSHOT/jboss-test-1.0.6-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/jboss-test/1.0.6-SNAPSHOT/jboss-test-1.0.6-SNAPSHOT-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-transaction-api/1.0.1.20070913080910/jboss-transaction-api-1.0.1.20070913080910.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-transaction-api/1.0.1.20070913080910/jboss-transaction-api-1.0.1.20070913080910-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/aspects/jboss-transaction-aspects/1.0.0-SNAPSHOT/jboss-transaction-aspects-1.0.0-SNAPSHOT.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-transaction-spi/5.0.0.Beta4/jboss-transaction-spi-5.0.0.Beta4.jar" sourcepath="M2_REPO/org/jboss/jboss-transaction-spi/5.0.0.Beta4/jboss-transaction-spi-5.0.0.Beta4-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-vfs/2.0.0.Beta8/jboss-vfs-2.0.0.Beta8.jar" sourcepath="M2_REPO/org/jboss/jboss-vfs/2.0.0.Beta8/jboss-vfs-2.0.0.Beta8-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/cache/jbosscache-core/2.1.0.CR4/jbosscache-core-2.1.0.CR4.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/security/jbosssx/2.0.2.Beta6/jbosssx-2.0.2.Beta6.jar" sourcepath="M2_REPO/org/jboss/security/jbosssx/2.0.2.Beta5/jbosssx-2.0.2.Beta5-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/ws/jbossws-spi/1.0.2.GA/jbossws-spi-1.0.2.GA.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jbossxb/2.0.0.CR8/jbossxb-2.0.0.CR8.jar" sourcepath="M2_REPO/org/jboss/jbossxb/2.0.0.CR8/jbossxb-2.0.0.CR8-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/jgroups/jgroups/2.6.1/jgroups-2.6.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jnpserver/5.0.0.Beta4/jnpserver-5.0.0.Beta4.jar" sourcepath="M2_REPO/org/jboss/jnpserver/5.0.0.Beta4/jnpserver-5.0.0.Beta4-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/jpl-pattern/jpl-pattern/1.0/jpl-pattern-1.0.jar"/>
- <classpathentry kind="var" path="M2_REPO/jpl-util/jpl-util/1.0/jpl-util-1.0.jar"/>
- <classpathentry kind="var" path="M2_REPO/javax/transaction/jta/1.0.1B/jta-1.0.1B.jar"/>
- <classpathentry kind="var" path="M2_REPO/junit/junit/4.4/junit-4.4.jar" sourcepath="M2_REPO/junit/junit/4.4/junit-4.4-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/apache-log4j/log4j/1.2.14/log4j-1.2.14.jar" sourcepath="M2_REPO/apache-log4j/log4j/1.2.14/log4j-1.2.14-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14.jar" sourcepath="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/javax/mail/mail/1.4/mail-1.4.jar" sourcepath="M2_REPO/javax/mail/mail/1.4/mail-1.4-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/qdox/qdox/1.6/qdox-1.6.jar" sourcepath="M2_REPO/qdox/qdox/1.6/qdox-1.6-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/quartz/quartz/1.6.0/quartz-1.6.0.jar"/>
- <classpathentry kind="var" path="M2_REPO/javax/xml/soap/saaj-api/1.3/saaj-api-1.3.jar"/>
- <classpathentry kind="var" path="M2_REPO/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.jar" sourcepath="M2_REPO/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/trove/trove/1.0.2/trove-1.0.2.jar"/>
- <classpathentry kind="var" path="M2_REPO/apache-slide/webdavlib/2.0/webdavlib-2.0.jar"/>
- <classpathentry kind="var" path="M2_REPO/apache-xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/apache-xerces/xml-apis/2.7.1/xml-apis-2.7.1.jar"/>
- <classpathentry combineaccessrules="false" kind="src" path="/cache"/>
- <classpathentry combineaccessrules="false" kind="src" path="/security"/>
- <classpathentry combineaccessrules="false" kind="src" path="/interceptors"/>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
+<classpath>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
+ <classpathentry kind="src" path="src/test/java" output="target/tests-classes"/>
+ <classpathentry kind="src" path="src/test/resources" output="target/tests-classes" excluding="**/*.java"/>
+ <classpathentry kind="output" path="target/classes"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="var" path="M2_REPO/javax/activation/activation/1.0.2/activation-1.0.2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/ant/ant/1.6.5/ant-1.6.5.jar" sourcepath="M2_REPO/ant/ant/1.6.5/ant-1.6.5-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant/1.7.0/ant-1.7.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant-junit/1.7.0/ant-junit-1.7.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant-launcher/1.7.0/ant-launcher-1.7.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/antlr/antlr/2.7.6/antlr-2.7.6.jar" sourcepath="M2_REPO/antlr/antlr/2.7.6/antlr-2.7.6-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/asm/asm/1.5.3/asm-1.5.3.jar"/>
+ <classpathentry kind="var" path="M2_REPO/asm/asm-attrs/1.5.3/asm-attrs-1.5.3.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/security/authorization-spi/2.0.2.Beta6/authorization-spi-2.0.2.Beta6.jar" sourcepath="M2_REPO/org/jboss/security/authorization-spi/2.0.2.Beta6/authorization-spi-2.0.2.Beta6-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/bcel/bcel/5.1/bcel-5.1.jar" sourcepath="M2_REPO/bcel/bcel/5.1/bcel-5.1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/bsh/bsh/1.3.0/bsh-1.3.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/cglib/cglib/2.1_3/cglib-2.1_3.jar" sourcepath="M2_REPO/cglib/cglib/2.1_3/cglib-2.1_3-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/commons-collections/commons-collections/2.1.1/commons-collections-2.1.1.jar" sourcepath="M2_REPO/commons-collections/commons-collections/2.1.1/commons-collections-2.1.1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/apache-httpclient/commons-httpclient/2.0.2/commons-httpclient-2.0.2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar" sourcepath="M2_REPO/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/oswego-concurrent/concurrent/1.3.4-jboss-update1/concurrent-1.3.4-jboss-update1.jar" sourcepath="M2_REPO/oswego-concurrent/concurrent/1.3.4-jboss-update1/concurrent-1.3.4-jboss-update1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar" sourcepath="M2_REPO/dom4j/dom4j/1.6.1/dom4j-1.6.1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/wutka-dtdparser/dtdparser121/1.2.1/dtdparser121-1.2.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/net/sf/ehcache/ehcache/1.2.3/ehcache-1.2.3.jar" sourcepath="M2_REPO/net/sf/ehcache/ehcache/1.2.3/ehcache-1.2.3-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/hibernate/ejb3-persistence/1.0.1.GA/ejb3-persistence-1.0.1.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate/3.2.6.ga/hibernate-3.2.6.ga.jar" sourcepath="M2_REPO/org/hibernate/hibernate/3.2.6.ga/hibernate-3.2.6.ga-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-annotations/3.3.1.GA/hibernate-annotations-3.3.1.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-commons-annotations/3.0.0.ga/hibernate-commons-annotations-3.0.0.ga.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-entitymanager/3.3.2.GA/hibernate-entitymanager-3.3.2.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/hsqldb/hsqldb/1.8.0.7/hsqldb-1.8.0.7.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/security/identity-impl/2.0.2.Beta6/identity-impl-2.0.2.Beta6.jar" sourcepath="M2_REPO/org/jboss/security/identity-impl/2.0.2.Beta6/identity-impl-2.0.2.Beta6-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/security/identity-spi/2.0.2.Beta6/identity-spi-2.0.2.Beta6.jar" sourcepath="M2_REPO/org/jboss/security/identity-spi/2.0.2.Beta6/identity-spi-2.0.2.Beta6-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javax/security/jaas/1.0.01/jaas-1.0.01.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javax/security/jacc/1.0/jacc-1.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/urbanophile/java-getopt/1.0.9/java-getopt-1.0.9.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javassist/javassist/3.4.GA/javassist-3.4.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/javassist/3.6.0.GA/javassist-3.6.0.GA.jar" sourcepath="M2_REPO/org/jboss/javassist/3.6.0.GA/javassist-3.6.0.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1.jar" sourcepath="M2_REPO/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/sun-jaxb/jaxb-api/2.1.4/jaxb-api-2.1.4.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/aop/jboss-aop/2.0.0.CR7/jboss-aop-2.0.0.CR7.jar" sourcepath="M2_REPO/org/jboss/aop/jboss-aop/2.0.0.CR7/jboss-aop-2.0.0.CR7-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/aop/jboss-aop-aspects/2.0.0.CR7/jboss-aop-aspects-2.0.0.CR7.jar" sourcepath="M2_REPO/org/jboss/aop/jboss-aop-aspects/2.0.0.CR7/jboss-aop-aspects-2.0.0.CR7-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/aop/jboss-aop-jdk50/2.0.0.CR8/jboss-aop-jdk50-2.0.0.CR8.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-aop-mc-int/2.0.0.Beta13/jboss-aop-mc-int-2.0.0.Beta13.jar" sourcepath="M2_REPO/org/jboss/microcontainer/jboss-aop-mc-int/2.0.0.Beta13/jboss-aop-mc-int-2.0.0.Beta13-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-as-bootstrap/5.0.0-SNAPSHOT/jboss-as-bootstrap-5.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/jbossas/jboss-as-bootstrap/5.0.0-SNAPSHOT/jboss-as-bootstrap-5.0.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-as-connector/5.0.0-SNAPSHOT/jboss-as-connector-5.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/jbossas/jboss-as-connector/5.0.0-SNAPSHOT/jboss-as-connector-5.0.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-as-j2se/5.0.0-SNAPSHOT/jboss-as-j2se-5.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/jbossas/jboss-as-j2se/5.0.0-SNAPSHOT/jboss-as-j2se-5.0.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-as-j2se/5.0.0-SNAPSHOT/jboss-as-j2se-5.0.0-SNAPSHOT-tests.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-as-jmx/5.0.0-SNAPSHOT/jboss-as-jmx-5.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/jbossas/jboss-as-jmx/5.0.0-SNAPSHOT/jboss-as-jmx-5.0.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-as-main/5.0.0-SNAPSHOT/jboss-as-main-5.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/jbossas/jboss-as-main/5.0.0-SNAPSHOT/jboss-as-main-5.0.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-as-mbeans/5.0.0-SNAPSHOT/jboss-as-mbeans-5.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/jbossas/jboss-as-mbeans/5.0.0-SNAPSHOT/jboss-as-mbeans-5.0.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-as-security/5.0.0-SNAPSHOT/jboss-as-security-5.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/jbossas/jboss-as-security/5.0.0-SNAPSHOT/jboss-as-security-5.0.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-as-server/5.0.0-SNAPSHOT/jboss-as-server-5.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/jbossas/jboss-as-server/5.0.0-SNAPSHOT/jboss-as-server-5.0.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-as-server-manager/0.1.0-SNAPSHOT/jboss-as-server-manager-0.1.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/jbossas/jboss-as-server-manager/0.1.0-SNAPSHOT/jboss-as-server-manager-0.1.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-as-system/5.0.0-SNAPSHOT/jboss-as-system-5.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/jbossas/jboss-as-system/5.0.0-SNAPSHOT/jboss-as-system-5.0.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-as-system-jmx/5.0.0-SNAPSHOT/jboss-as-system-jmx-5.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/jbossas/jboss-as-system-jmx/5.0.0-SNAPSHOT/jboss-as-system-jmx-5.0.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/cl/jboss-classloader/2.0.0.Beta11/jboss-classloader-2.0.0.Beta11.jar" sourcepath="M2_REPO/org/jboss/cl/jboss-classloader/2.0.0.Beta11/jboss-classloader-2.0.0.Beta11-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/cl/jboss-classloading/2.0.0.Beta11/jboss-classloading-2.0.0.Beta11.jar" sourcepath="M2_REPO/org/jboss/cl/jboss-classloading/2.0.0.Beta11/jboss-classloading-2.0.0.Beta11-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-classloading-spi/5.0.0.Beta4/jboss-classloading-spi-5.0.0.Beta4.jar" sourcepath="M2_REPO/org/jboss/jboss-classloading-spi/5.0.0.Beta4/jboss-classloading-spi-5.0.0.Beta4-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/cl/jboss-classloading-vfs/2.0.0.Beta11/jboss-classloading-vfs-2.0.0.Beta11.jar" sourcepath="M2_REPO/org/jboss/cl/jboss-classloading-vfs/2.0.0.Beta11/jboss-classloading-vfs-2.0.0.Beta11-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-common-core/2.0.2.GA/jboss-common-core-2.0.2.GA.jar" sourcepath="M2_REPO/jboss/jboss-common-core/2.0.2.GA/jboss-common-core-2.0.2.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-common-core/2.2.5.GA/jboss-common-core-2.2.5.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-common-core/2.2.5.GA/jboss-common-core-2.2.5.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-common-logging-log4j/2.0.4.GA/jboss-common-logging-log4j-2.0.4.GA.jar" sourcepath="M2_REPO/jboss/jboss-common-logging-log4j/2.0.4.GA/jboss-common-logging-log4j-2.0.4.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-common-logging-spi/2.0.4.GA/jboss-common-logging-spi-2.0.4.GA.jar" sourcepath="M2_REPO/jboss/jboss-common-logging-spi/2.0.4.GA/jboss-common-logging-spi-2.0.4.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-container/2.0.0.Beta9/jboss-container-2.0.0.Beta9.jar" sourcepath="M2_REPO/org/jboss/microcontainer/jboss-container/2.0.0.Beta9/jboss-container-2.0.0.Beta9-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-dependency/2.0.0.Beta9/jboss-dependency-2.0.0.Beta9.jar" sourcepath="M2_REPO/org/jboss/microcontainer/jboss-dependency/2.0.0.Beta9/jboss-dependency-2.0.0.Beta9-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/deployers/jboss-deployers-client/2.0.0-SNAPSHOT/jboss-deployers-client-2.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/deployers/jboss-deployers-client/2.0.0-SNAPSHOT/jboss-deployers-client-2.0.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/deployers/jboss-deployers-client-spi/2.0.0-SNAPSHOT/jboss-deployers-client-spi-2.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/deployers/jboss-deployers-client-spi/2.0.0-SNAPSHOT/jboss-deployers-client-spi-2.0.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-deployers-client-spi/2.0.0.Beta6/jboss-deployers-client-spi-2.0.0.Beta6.jar" sourcepath="M2_REPO/org/jboss/microcontainer/jboss-deployers-client-spi/2.0.0.Beta6/jboss-deployers-client-spi-2.0.0.Beta6-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/deployers/jboss-deployers-core/2.0.0-SNAPSHOT/jboss-deployers-core-2.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/deployers/jboss-deployers-core/2.0.0-SNAPSHOT/jboss-deployers-core-2.0.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/deployers/jboss-deployers-core-spi/2.0.0-SNAPSHOT/jboss-deployers-core-spi-2.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/deployers/jboss-deployers-core-spi/2.0.0-SNAPSHOT/jboss-deployers-core-spi-2.0.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-deployers-core-spi/2.0.0.Beta9/jboss-deployers-core-spi-2.0.0.Beta9.jar" sourcepath="M2_REPO/org/jboss/microcontainer/jboss-deployers-core-spi/2.0.0.Beta9/jboss-deployers-core-spi-2.0.0.Beta9-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/deployers/jboss-deployers-impl/2.0.0-SNAPSHOT/jboss-deployers-impl-2.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/deployers/jboss-deployers-impl/2.0.0-SNAPSHOT/jboss-deployers-impl-2.0.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/deployers/jboss-deployers-spi/2.0.0-SNAPSHOT/jboss-deployers-spi-2.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/deployers/jboss-deployers-spi/2.0.0-SNAPSHOT/jboss-deployers-spi-2.0.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/deployers/jboss-deployers-structure-spi/2.0.0-SNAPSHOT/jboss-deployers-structure-spi-2.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/deployers/jboss-deployers-structure-spi/2.0.0-SNAPSHOT/jboss-deployers-structure-spi-2.0.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/deployers/jboss-deployers-vfs/2.0.0-SNAPSHOT/jboss-deployers-vfs-2.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/deployers/jboss-deployers-vfs/2.0.0-SNAPSHOT/jboss-deployers-vfs-2.0.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/deployers/jboss-deployers-vfs-spi/2.0.0-SNAPSHOT/jboss-deployers-vfs-spi-2.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/deployers/jboss-deployers-vfs-spi/2.0.0-SNAPSHOT/jboss-deployers-vfs-spi-2.0.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-ejb-api/3.0.0.CR1/jboss-ejb-api-3.0.0.CR1.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-ejb-api/3.0.0.CR1/jboss-ejb-api-3.0.0.CR1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/ejb3/jboss-ejb3-async/0.1.0-SNAPSHOT/jboss-ejb3-async-0.1.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/ejb3/jboss-ejb3-async/0.1.0-SNAPSHOT/jboss-ejb3-async-0.1.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/ejb3/jboss-ejb3-cache/0.13.0-SNAPSHOT/jboss-ejb3-cache-0.13.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/ejb3/jboss-ejb3-cache/0.13.0-SNAPSHOT/jboss-ejb3-cache-0.13.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/ejb3/jboss-ejb3-ext-api/0.3/jboss-ejb3-ext-api-0.3.jar" sourcepath="M2_REPO/org/jboss/ejb3/jboss-ejb3-ext-api/0.3/jboss-ejb3-ext-api-0.3-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/ejb3/jboss-ejb3-ext-api-impl/0.3-SNAPSHOT/jboss-ejb3-ext-api-impl-0.3-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/ejb3/jboss-ejb3-ext-api-impl/0.3-SNAPSHOT/jboss-ejb3-ext-api-impl-0.3-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/ejb3/jboss-ejb3-interceptors/0.13.0-SNAPSHOT/jboss-ejb3-interceptors-0.13.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/ejb3/jboss-ejb3-interceptors/0.13.0-SNAPSHOT/jboss-ejb3-interceptors-0.13.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/ejb3/jboss-ejb3-metadata/0.12.1/jboss-ejb3-metadata-0.12.1.jar" sourcepath="M2_REPO/org/jboss/ejb3/jboss-ejb3-metadata/0.12.1/jboss-ejb3-metadata-0.12.1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/ejb3/jboss-ejb3-security/0.13.0-SNAPSHOT/jboss-ejb3-security-0.13.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/ejb3/jboss-ejb3-security/0.13.0-SNAPSHOT/jboss-ejb3-security-0.13.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/embedded/jboss-embedded/beta3-SNAPSHOT/jboss-embedded-beta3-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/cluster/jboss-ha-client/1.1.0-SNAPSHOT/jboss-ha-client-1.1.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/cluster/jboss-ha-client/1.1.0-SNAPSHOT/jboss-ha-client-1.1.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/cluster/jboss-ha-server-api/1.1.0-SNAPSHOT/jboss-ha-server-api-1.1.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/cluster/jboss-ha-server-api/1.1.0-SNAPSHOT/jboss-ha-server-api-1.1.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-jacc-api/1.1.0.CR1/jboss-jacc-api-1.1.0.CR1.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-jacc-api/1.1.0.CR1/jboss-jacc-api-1.1.0.CR1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-jaspi-api/1.0.0.CR1/jboss-jaspi-api-1.0.0.CR1.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-jaspi-api/1.0.0.CR1/jboss-jaspi-api-1.0.0.CR1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-javaee/5.0.0.Beta3/jboss-javaee-5.0.0.Beta3.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-javaee/5.0.0.Beta3/jboss-javaee-5.0.0.Beta3-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jbossws/jboss-jaxrpc/1.0.4.GA/jboss-jaxrpc-1.0.4.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-jaxws/2.0.1.GA/jboss-jaxws-2.0.1.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-jca-api/1.5.0.CR1/jboss-jca-api-1.5.0.CR1.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-jca-api/1.5.0.CR1/jboss-jca-api-1.5.0.CR1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-jms-api/1.1.0.CR1/jboss-jms-api-1.1.0.CR1.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-jms-api/1.1.0.CR1/jboss-jms-api-1.1.0.CR1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-kernel/2.0.0.Beta9/jboss-kernel-2.0.0.Beta9.jar" sourcepath="M2_REPO/org/jboss/microcontainer/jboss-kernel/2.0.0.Beta9/jboss-kernel-2.0.0.Beta9-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-logging-log4j/2.0.2.GA/jboss-logging-log4j-2.0.2.GA.jar" sourcepath="M2_REPO/jboss/jboss-logging-log4j/2.0.2.GA/jboss-logging-log4j-2.0.2.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging-log4j/2.0.5.GA/jboss-logging-log4j-2.0.5.GA.jar" sourcepath="M2_REPO/org/jboss/logging/jboss-logging-log4j/2.0.5.GA/jboss-logging-log4j-2.0.5.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-logging-spi/2.0.3.GA/jboss-logging-spi-2.0.3.GA.jar" sourcepath="M2_REPO/jboss/jboss-logging-spi/2.0.3.GA/jboss-logging-spi-2.0.3.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA.jar" sourcepath="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/man/jboss-managed/2.0.0.Beta12/jboss-managed-2.0.0.Beta12.jar" sourcepath="M2_REPO/org/jboss/man/jboss-managed/2.0.0.Beta12/jboss-managed-2.0.0.Beta12-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-managed/2.0.0.Beta9/jboss-managed-2.0.0.Beta9.jar" sourcepath="M2_REPO/org/jboss/microcontainer/jboss-managed/2.0.0.Beta9/jboss-managed-2.0.0.Beta9-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/metadata/jboss-metadata/1.0.0-SNAPSHOT/jboss-metadata-1.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/metadata/jboss-metadata/1.0.0-SNAPSHOT/jboss-metadata-1.0.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/man/jboss-metatype/2.0.0.Beta12/jboss-metatype-2.0.0.Beta12.jar" sourcepath="M2_REPO/org/jboss/man/jboss-metatype/2.0.0.Beta12/jboss-metatype-2.0.0.Beta12-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-metatype/2.0.0.Beta9/jboss-metatype-2.0.0.Beta9.jar" sourcepath="M2_REPO/org/jboss/microcontainer/jboss-metatype/2.0.0.Beta9/jboss-metatype-2.0.0.Beta9-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-persistence-api/3.0.0.CR1/jboss-persistence-api-3.0.0.CR1.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-persistence-api/3.0.0.CR1/jboss-persistence-api-3.0.0.CR1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/profiler/jvmti/jboss-profiler-jvmti/1.0.0.CR5/jboss-profiler-jvmti-1.0.0.CR5.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-reflect/2.0.0.Beta12/jboss-reflect-2.0.0.Beta12.jar" sourcepath="M2_REPO/org/jboss/jboss-reflect/2.0.0.Beta12/jboss-reflect-2.0.0.Beta12-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/remoting/jboss-remoting/2.4.0.CR1/jboss-remoting-2.4.0.CR1.jar" sourcepath="M2_REPO/jboss/remoting/jboss-remoting/2.4.0.CR1/jboss-remoting-2.4.0.CR1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/aspects/jboss-remoting-aspects/1.0.0-SNAPSHOT/jboss-remoting-aspects-1.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/aspects/jboss-remoting-aspects/1.0.0-SNAPSHOT/jboss-remoting-aspects-1.0.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jbossws/jboss-saaj/3.0.1-native-2.0.4.GA/jboss-saaj-3.0.1-native-2.0.4.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/aspects/jboss-security-aspects/1.0.0-SNAPSHOT/jboss-security-aspects-1.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/aspects/jboss-security-aspects/1.0.0-SNAPSHOT/jboss-security-aspects-1.0.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/security/jboss-security-spi/2.0.2.Beta6/jboss-security-spi-2.0.2.Beta6.jar" sourcepath="M2_REPO/org/jboss/security/jboss-security-spi/2.0.2.Beta6/jboss-security-spi-2.0.2.Beta6-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/security/jboss-security-spi-bare/2.0.2.Beta6/jboss-security-spi-bare-2.0.2.Beta6.jar" sourcepath="M2_REPO/org/jboss/security/jboss-security-spi-bare/2.0.2.Beta6/jboss-security-spi-bare-2.0.2.Beta6-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-serialization/1.0.3.GA/jboss-serialization-1.0.3.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-server-manager/0.1.0.GA/jboss-server-manager-0.1.0.GA.jar" sourcepath="M2_REPO/org/jboss/jbossas/jboss-server-manager/0.1.0.GA/jboss-server-manager-0.1.0.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-servlet-api/2.5.0-SNAPSHOT/jboss-servlet-api-2.5.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-servlet-api/2.5.0-SNAPSHOT/jboss-servlet-api-2.5.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-test/1.0.3.GA/jboss-test-1.0.3.GA.jar" sourcepath="M2_REPO/jboss/jboss-test/1.0.3.GA/jboss-test-1.0.3.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-test/1.0.6-SNAPSHOT/jboss-test-1.0.6-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/jboss-test/1.0.6-SNAPSHOT/jboss-test-1.0.6-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/test/jboss-test/1.1.0.GA/jboss-test-1.1.0.GA.jar" sourcepath="M2_REPO/org/jboss/test/jboss-test/1.1.0.GA/jboss-test-1.1.0.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-transaction-api/1.0.1.20070913080910/jboss-transaction-api-1.0.1.20070913080910.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-transaction-api/1.0.1.20070913080910/jboss-transaction-api-1.0.1.20070913080910-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/aspects/jboss-transaction-aspects/1.0.0-SNAPSHOT/jboss-transaction-aspects-1.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/aspects/jboss-transaction-aspects/1.0.0-SNAPSHOT/jboss-transaction-aspects-1.0.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-transaction-spi/5.0.0.Beta4/jboss-transaction-spi-5.0.0.Beta4.jar" sourcepath="M2_REPO/org/jboss/jboss-transaction-spi/5.0.0.Beta4/jboss-transaction-spi-5.0.0.Beta4-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-vfs/2.0.0.Beta8/jboss-vfs-2.0.0.Beta8.jar" sourcepath="M2_REPO/org/jboss/jboss-vfs/2.0.0.Beta8/jboss-vfs-2.0.0.Beta8-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/cache/jbosscache-core/2.1.0.CR4/jbosscache-core-2.1.0.CR4.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/security/jbosssx/2.0.2.Beta6/jbosssx-2.0.2.Beta6.jar" sourcepath="M2_REPO/org/jboss/security/jbosssx/2.0.2.Beta6/jbosssx-2.0.2.Beta6-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/security/jbosssx-client/2.0.2.Beta6/jbosssx-client-2.0.2.Beta6.jar" sourcepath="M2_REPO/org/jboss/security/jbosssx-client/2.0.2.Beta6/jbosssx-client-2.0.2.Beta6-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/ws/jbossws-spi/1.0.2.GA/jbossws-spi-1.0.2.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jbossxb/2.0.0.CR8/jbossxb-2.0.0.CR8.jar" sourcepath="M2_REPO/org/jboss/jbossxb/2.0.0.CR8/jbossxb-2.0.0.CR8-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jgroups/jgroups/2.6.1/jgroups-2.6.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/naming/jnp-client/5.0.0.CR1/jnp-client-5.0.0.CR1.jar" sourcepath="M2_REPO/org/jboss/naming/jnp-client/5.0.0.CR1/jnp-client-5.0.0.CR1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/naming/jnpserver/5.0.0.CR1/jnpserver-5.0.0.CR1.jar" sourcepath="M2_REPO/org/jboss/naming/jnpserver/5.0.0.CR1/jnpserver-5.0.0.CR1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jpl-pattern/jpl-pattern/1.0/jpl-pattern-1.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jpl-util/jpl-util/1.0/jpl-util-1.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javax/transaction/jta/1.0.1B/jta-1.0.1B.jar"/>
+ <classpathentry kind="var" path="M2_REPO/junit/junit/4.4/junit-4.4.jar" sourcepath="M2_REPO/junit/junit/4.4/junit-4.4-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/apache-log4j/log4j/1.2.14/log4j-1.2.14.jar" sourcepath="M2_REPO/apache-log4j/log4j/1.2.14/log4j-1.2.14-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14.jar" sourcepath="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javax/mail/mail/1.4/mail-1.4.jar" sourcepath="M2_REPO/javax/mail/mail/1.4/mail-1.4-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/qdox/qdox/1.6/qdox-1.6.jar" sourcepath="M2_REPO/qdox/qdox/1.6/qdox-1.6-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/quartz/quartz/1.6.0/quartz-1.6.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javax/xml/soap/saaj-api/1.3/saaj-api-1.3.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar" sourcepath="M2_REPO/javax/servlet/servlet-api/2.5/servlet-api-2.5-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.jar" sourcepath="M2_REPO/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/trove/trove/1.0.2/trove-1.0.2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/apache-slide/webdavlib/2.0/webdavlib-2.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/apache-xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/apache-xerces/xml-apis/2.7.1/xml-apis-2.7.1.jar"/>
+</classpath>
\ No newline at end of file
Modified: projects/ejb3/trunk/core/.project
===================================================================
--- projects/ejb3/trunk/core/.project 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/.project 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,16 +1,13 @@
-<projectDescription>
- <name>jboss-ejb3-core</name>
- <comment>JBoss EJB 3.0 Core</comment>
- <projects>
- <project>jboss-ejb3-cache</project>
- <project>jboss-ejb3-interceptors</project>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
+<projectDescription>
+ <name>jboss-ejb3-core</name>
+ <comment>JBoss EJB 3.0 Core</comment>
+ <projects/>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
</projectDescription>
\ No newline at end of file
Modified: projects/ejb3/trunk/core/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/ejb3/trunk/core/.settings/org.eclipse.jdt.core.prefs 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/.settings/org.eclipse.jdt.core.prefs 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,4 +1,4 @@
-#Fri Apr 11 09:55:41 CEST 2008
+#Wed Apr 23 16:07:04 GMT-05:00 2008
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.source=1.5
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContainer.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContainer.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -80,6 +80,7 @@
import org.jboss.ejb3.pool.Pool;
import org.jboss.ejb3.pool.PoolFactory;
import org.jboss.ejb3.pool.PoolFactoryRegistry;
+import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
import org.jboss.ejb3.security.SecurityDomainManager;
import org.jboss.ejb3.statistics.InvocationStatistics;
import org.jboss.ejb3.tx.UserTransactionImpl;
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/Ejb3Deployment.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/Ejb3Deployment.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/Ejb3Deployment.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -59,7 +59,8 @@
import org.jboss.ejb3.metadata.jpa.spec.PersistenceUnitMetaData;
import org.jboss.ejb3.metadata.jpa.spec.PersistenceUnitsMetaData;
import org.jboss.ejb3.pool.PoolFactoryRegistry;
-import org.jboss.ejb3.remoting.RemoteProxyFactoryRegistry;
+import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
+import org.jboss.ejb3.proxy.factory.RemoteProxyFactoryRegistry;
import org.jboss.logging.Logger;
import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
import org.jboss.metadata.ejb.jboss.JBossGenericBeanMetaData;
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/Ejb3DescriptorHandler.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/Ejb3DescriptorHandler.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/Ejb3DescriptorHandler.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -135,6 +135,7 @@
import org.jboss.ejb3.lang.ClassHelper;
import org.jboss.ejb3.mdb.ConsumerContainer;
import org.jboss.ejb3.mdb.MDB;
+import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
import org.jboss.ejb3.service.ServiceContainer;
import org.jboss.ejb3.stateful.StatefulContainer;
import org.jboss.logging.Logger;
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/JBossProxy.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/JBossProxy.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/JBossProxy.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,31 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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;
-
-/**
- * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
- * @version $Revision$
- */
-public interface JBossProxy
-{
- Object getAsynchronousProxy();
-}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/JndiProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/JndiProxyFactory.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/JndiProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,68 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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;
-
-import java.util.Hashtable;
-
-import javax.ejb.EJBException;
-
-import org.jnp.interfaces.MarshalledValuePair;
-import javax.naming.Context;
-import javax.naming.Name;
-import javax.naming.Reference;
-import javax.naming.spi.ObjectFactory;
-import org.jboss.logging.Logger;
-
-/**
- * Responsible for creating an EJB proxy
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- */
-public class JndiProxyFactory implements ObjectFactory
-{
- private static final Logger log = Logger.getLogger(JndiProxyFactory.class);
-
- public static final String FACTORY = "FACTORY";
-
- public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment) throws Exception
- {
- Reference ref = (Reference) obj;
- String factoryName = (String) ref.get(FACTORY).getContent();
-
- try
- {
- ProxyFactory factory = (ProxyFactory) nameCtx.lookup(factoryName);
-
- Object proxy = factory.createProxyBusiness();
- MarshalledValuePair marshalledProxy = new MarshalledValuePair(proxy);
- return marshalledProxy.get();
- }
- catch (EJBException e)
- {
- throw e;
- }
- catch (ClassCastException e)
- {
- throw new EJBException("Invalid invocation of local interface", e);
- }
- }
-}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/LocalProxy.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/LocalProxy.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/LocalProxy.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,85 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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;
-
-
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.lang.reflect.InvocationHandler;
-import org.jboss.ejb3.remoting.Proxy;
-import org.jboss.logging.Logger;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public abstract class LocalProxy implements InvocationHandler, Externalizable, Proxy
-{
- private static Logger log = Logger.getLogger(LocalProxy.class);
-
- private transient Container container = null;
- protected String containerClusterUid;
- protected String containerGuid;
- protected String proxyName;
-
-
- public LocalProxy()
- {
- }
-
- protected LocalProxy(Container container)
- {
- this.container = container;
- this.containerGuid = Ejb3Registry.guid(container);
- this.containerClusterUid = Ejb3Registry.clusterUid(container);
- proxyName = container.getEjbName();
- }
-
- protected Container getContainer()
- {
- if(container == null)
- container = Ejb3Registry.findContainer(containerGuid);
- if(container == null)
- log.warn("Container " + containerGuid + " is not yet available");
- return container;
- }
-
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- {
- this.containerGuid = in.readUTF();
- this.containerClusterUid = in.readUTF();
- this.proxyName = in.readUTF();
- }
-
- public void writeExternal(ObjectOutput out) throws IOException
- {
- out.writeUTF(containerGuid);
- out.writeUTF(containerClusterUid);
- out.writeUTF(proxyName);
- }
-
- public abstract String toString();
-}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/LocalProxyInvocationHandler.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/LocalProxyInvocationHandler.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/LocalProxyInvocationHandler.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/LocalProxyInvocationHandler.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.lang.reflect.InvocationHandler;
+
+import org.jboss.ejb3.proxy.handler.BaseProxyInvocationHandler;
+import org.jboss.ejb3.proxy.handler.ProxyInvocationHandler;
+import org.jboss.logging.Logger;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+public abstract class LocalProxyInvocationHandler extends BaseProxyInvocationHandler implements InvocationHandler, Externalizable, ProxyInvocationHandler
+{
+ private static Logger log = Logger.getLogger(LocalProxyInvocationHandler.class);
+
+ private transient Container container = null;
+
+ protected String containerClusterUid;
+
+ protected String containerGuid;
+
+ protected String proxyName;
+
+ protected LocalProxyInvocationHandler()
+ {
+ }
+
+ protected LocalProxyInvocationHandler(Container container, String businessInterfaceType)
+ {
+ this.setBusinessInterfaceType(businessInterfaceType);
+ this.container = container;
+ this.containerGuid = Ejb3Registry.guid(container);
+ this.containerClusterUid = Ejb3Registry.clusterUid(container);
+ proxyName = container.getEjbName();
+ }
+
+ protected Container getContainer()
+ {
+ if (container == null)
+ container = Ejb3Registry.findContainer(containerGuid);
+ if (container == null)
+ log.warn("Container " + containerGuid + " is not yet available");
+ return container;
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
+ {
+ this.containerGuid = in.readUTF();
+ this.containerClusterUid = in.readUTF();
+ this.proxyName = in.readUTF();
+ }
+
+ public void writeExternal(ObjectOutput out) throws IOException
+ {
+ out.writeUTF(containerGuid);
+ out.writeUTF(containerClusterUid);
+ out.writeUTF(proxyName);
+ }
+
+ public abstract String toString();
+
+}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/ProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/ProxyFactory.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/ProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,41 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public interface ProxyFactory
-{
- public Object createHomeProxy();
-
- public Object createProxyBusiness();
-
- public Object createProxyBusiness(Object id);
-
- public void start() throws Exception;
-
- public void stop() throws Exception;
-}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/ProxyFactoryHelper.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/ProxyFactoryHelper.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/ProxyFactoryHelper.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,1053 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import javax.ejb.EJBHome;
-import javax.ejb.EJBLocalHome;
-import javax.ejb.EJBLocalObject;
-import javax.ejb.EJBObject;
-import javax.ejb.Local;
-import javax.ejb.LocalHome;
-import javax.ejb.Remote;
-import javax.ejb.RemoteHome;
-import javax.jws.WebService;
-import javax.management.ObjectInstance;
-import javax.management.ObjectName;
-
-import org.jboss.ejb3.annotation.JndiBindingPolicy;
-import org.jboss.ejb3.annotation.LocalBinding;
-import org.jboss.ejb3.annotation.LocalHomeBinding;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.annotation.RemoteBindings;
-import org.jboss.ejb3.annotation.RemoteHomeBinding;
-import org.jboss.ejb3.annotation.impl.LocalImpl;
-import org.jboss.ejb3.annotation.impl.RemoteImpl;
-import org.jboss.ejb3.jndipolicy.DefaultJndiBindingPolicy;
-import org.jboss.ejb3.jndipolicy.Ejb3DeploymentSummary;
-import org.jboss.ejb3.jndipolicy.impl.PackagingBasedJndiBindingPolicy;
-import org.jboss.ejb3.lang.ClassHelper;
-import org.jboss.ejb3.remoting.RemoteProxyFactory;
-import org.jboss.ejb3.service.ServiceContainer;
-import org.jboss.ejb3.session.SessionContainer;
-import org.jboss.ejb3.stateful.StatefulContainer;
-import org.jboss.ejb3.stateless.StatelessContainer;
-import org.jboss.logging.Logger;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public class ProxyFactoryHelper
-{
- private static final Logger log = Logger.getLogger(ProxyFactoryHelper.class);
-
- private static String getEndpointInterface(Container container)
- {
- WebService ws = (javax.jws.WebService) ((EJBContainer) container).resolveAnnotation(javax.jws.WebService.class);
- if (ws != null)
- {
- return ws.endpointInterface();
- }
- return null;
- }
-
- /**
- *
- * @param container
- * @return the local interfaces of the container or an empty array
- */
- public static Class<?>[] getLocalAndBusinessLocalInterfaces(Container container)
- {
- // Initialize
- Set<Class<?>> localAndBusinessLocalInterfaces = new HashSet<Class<?>>();
-
- // Obtain Bean Class
- Class<?> beanClass = container.getBeanClass();
-
- // Obtain @Local
- Local localAnnotation = ((EJBContainer) container).getAnnotation(Local.class);
-
- // Obtain @LocalHome
- LocalHome localHomeAnnotation = ((EJBContainer) container).getAnnotation(LocalHome.class);
-
- // Obtain @Remote
- Remote remoteAnnotation = ((EJBContainer) container).getAnnotation(Remote.class);
-
- // Obtain Remote and Business Remote interfaces
- Class<?>[] remoteAndBusinessRemoteInterfaces = ProxyFactoryHelper.getRemoteAndBusinessRemoteInterfaces(container);
-
- // Obtain all business interfaces from the bean class
- Set<Class<?>> businessInterfacesImplementedByBeanClass = ProxyFactoryHelper.getBusinessInterfaces(beanClass);
-
- // Obtain all business interfaces directly implemented by the bean class (not including supers)
- Set<Class<?>> businessInterfacesDirectlyImplementedByBeanClass = ProxyFactoryHelper.getBusinessInterfaces(
- beanClass, false);
-
- // Determine whether Stateful or Stateless
- boolean isStateless = (container instanceof StatelessContainer) ? true : false;
-
- // EJBTHREE-1127
- // Determine local interface from return value of "create" in Local Home
- if (localHomeAnnotation != null)
- {
- localAndBusinessLocalInterfaces.addAll(ProxyFactoryHelper.getReturnTypesFromCreateMethods(localHomeAnnotation
- .value(), isStateless));
- }
-
- // For each of the business interfaces implemented by the bean class
- for (Class<?> clazz : businessInterfacesImplementedByBeanClass)
- {
- // If @Local is on the interface
- if (clazz.isAnnotationPresent(Local.class))
- {
- // Add to the list of locals
- localAndBusinessLocalInterfaces.add(clazz);
- }
- }
-
- // EJBTHREE-1062
- // EJB 3 Core Specification 4.6.6
- // If bean class implements a single interface, that interface is assumed to be the
- // business interface of the bean. This business interface will be a local interface unless the
- // interface is designated as a remote business interface by use of the Remote
- // annotation on the bean class or interface or by means of the deployment descriptor.
- if (businessInterfacesDirectlyImplementedByBeanClass.size() == 1 && localAndBusinessLocalInterfaces.size() == 0)
- {
- // Obtain the implemented interface
- Class<?> singleInterface = businessInterfacesDirectlyImplementedByBeanClass.iterator().next();
-
- // If not explicitly marked as @Remote, and is a valid business interface
- if (remoteAnnotation == null && singleInterface.getAnnotation(Remote.class) == null)
- {
- // Return the implemented interface, adding to the container
- Class<?>[] returnValue = new Class[]
- {singleInterface};
- Local li = new LocalImpl(returnValue);
- ((EJBContainer) container).getAnnotations().addClassAnnotation(Local.class, li);
- return returnValue;
- }
- }
-
- // @Local was defined
- if (localAnnotation != null)
- {
- // If @Local has no value or empty value
- if (localAnnotation.value() == null || localAnnotation.value().length == 0)
- {
- // If @Local is defined with no value and there are no business interfaces
- if (businessInterfacesImplementedByBeanClass.size() == 0)
- {
- throw new RuntimeException("Use of empty @Local on bean " + container.getEjbName()
- + " and there are no valid business interfaces");
- }
- // If more than one business interface is directly implemented by the bean class
- else if (businessInterfacesImplementedByBeanClass.size() > 1)
- {
- throw new RuntimeException("Use of empty @Local on bean " + container.getEjbName()
- + " with more than one default interface " + businessInterfacesImplementedByBeanClass);
- }
- // JIRA EJBTHREE-1062
- // EJB 3 4.6.6
- // If the bean class implements only one business interface, that
- //interface is exposed as local business if not denoted as @Remote
- else
- {
- // If not explicitly marked as @Remote
- if (remoteAnnotation == null)
- {
- // Return the implemented interface and add to container
- Class<?>[] returnValue = businessInterfacesImplementedByBeanClass.toArray(new Class<?>[]
- {});
- Local li = new LocalImpl(returnValue);
- ((EJBContainer) container).getAnnotations().addClassAnnotation(Local.class, li);
- return returnValue;
- }
- }
- }
- // @Local has value
- else
- {
- // For each of the interfaces in @Local.value
- for (Class<?> clazz : localAnnotation.value())
- {
- // Add to the list of locals
- localAndBusinessLocalInterfaces.add(clazz);
- }
-
- // For each of the business interfaces implemented by the bean class
- for (Class<?> clazz : businessInterfacesImplementedByBeanClass)
- {
- // If @Local is on the interface
- if (clazz.isAnnotationPresent(Local.class))
- {
- // Add to the list of locals
- localAndBusinessLocalInterfaces.add(clazz);
- }
- }
- }
- }
-
- // If local interfaces have been defined/discovered
- if (localAndBusinessLocalInterfaces.size() > 0)
- {
- // Check to ensure @Local and @Remote are not defined on the same interface
- // EJBTHREE-751
- for (Class<?> remoteInterface : remoteAndBusinessRemoteInterfaces)
- {
- for (Class<?> localInterface : localAndBusinessLocalInterfaces)
- {
- if (localInterface.equals(remoteInterface))
- {
- throw new RuntimeException("@Remote and @Local may not both be specified on the same interface \""
- + remoteInterface.toString() + "\" per EJB3 Spec 4.6.7, Bullet 5.4");
- }
- }
- }
-
- // Return local interfaces, first adding to the container
- Class<?>[] rtn = localAndBusinessLocalInterfaces.toArray(new Class<?>[]
- {});
- localAnnotation = new LocalImpl(rtn);
- ((EJBContainer) container).getAnnotations().addClassAnnotation(Local.class, localAnnotation);
- return rtn;
- }
- // If no local interfaces have been defined/discovered
- else
- {
- // Obtain WS Endpoint
- String endpoint = ProxyFactoryHelper.getEndpointInterface(container);
-
- // If neither WS Endpoint or remotes are defined
- if (remoteAndBusinessRemoteInterfaces.length == 0 && endpoint == null)
- throw new RuntimeException(
- "Bean Class "
- + beanClass.getName()
- + " has no local, webservice, or remote interfaces defined and does not implement at least one business interface: "
- + container.getEjbName());
-
- }
-
- // No local or business local interfaces discovered
- return new Class<?>[]
- {};
- }
-
- /**
- * Resolve the potential business interfaces on an enterprise bean.
- * Returns all interfaces implemented by this class and its supers which
- * are potentially a business interface.
- *
- * Note: for normal operation call container.getBusinessInterfaces().
- *
- * @param beanClass the EJB implementation class
- * @return a list of potential business interfaces
- * @see org.jboss.ejb3.EJBContainer#getBusinessInterfaces()
- */
- public static Set<Class<?>> getBusinessInterfaces(Class<?> beanClass)
- {
- // Obtain all business interfaces implemented by this bean class and its superclasses
- return ProxyFactoryHelper.getBusinessInterfaces(beanClass, new HashSet<Class<?>>());
- }
-
- /**
- * Resolve the potential business interfaces on an enterprise bean.
- * Returns all interfaces implemented by this class and, optionally, its supers which
- * are potentially a business interface.
- *
- * Note: for normal operation call container.getBusinessInterfaces().
- *
- * @param beanClass the EJB implementation class
- * @param includeSupers Whether or not to include superclasses of the specified beanClass in this check
- * @return a list of potential business interfaces
- * @see org.jboss.ejb3.EJBContainer#getBusinessInterfaces()
- */
- public static Set<Class<?>> getBusinessInterfaces(Class<?> beanClass, boolean includeSupers)
- {
- // Obtain all business interfaces implemented by this bean class and optionally, its superclass
- return ProxyFactoryHelper.getBusinessInterfaces(beanClass, new HashSet<Class<?>>(), includeSupers);
- }
-
- private static Set<Class<?>> getBusinessInterfaces(Class<?> beanClass, Set<Class<?>> interfaces)
- {
- return ProxyFactoryHelper.getBusinessInterfaces(beanClass, interfaces, true);
- }
-
- private static Set<Class<?>> getBusinessInterfaces(Class<?> beanClass, Set<Class<?>> interfaces,
- boolean includeSupers)
- {
- /*
- * 4.6.6:
- * The following interfaces are excluded when determining whether the bean class has
- * more than one interface: java.io.Serializable; java.io.Externalizable;
- * any of the interfaces defined by the javax.ejb package.
- */
- for (Class<?> intf : beanClass.getInterfaces())
- {
- if (intf.equals(java.io.Externalizable.class))
- continue;
- if (intf.equals(java.io.Serializable.class))
- continue;
- if (intf.getName().startsWith("javax.ejb"))
- continue;
-
- // FIXME Other aop frameworks might add other interfaces, this should really be configurable
- if (intf.getName().startsWith("org.jboss.aop"))
- continue;
-
- interfaces.add(intf);
- }
-
- // If there's no superclass, or we shouldn't check the superclass, return
- if (!includeSupers || beanClass.getSuperclass() == null)
- {
- return interfaces;
- }
- else
- {
- // Include any superclasses' interfaces
- return getBusinessInterfaces(beanClass.getSuperclass(), interfaces);
- }
- }
-
- public static Class<?> getLocalHomeInterface(Container container)
- {
- LocalHome li = ((EJBContainer) container).getAnnotation(javax.ejb.LocalHome.class);
- if (li != null)
- return li.value();
- return null;
- }
-
- public static Class<?> getRemoteHomeInterface(Container container)
- {
- RemoteHome li = ((EJBContainer) container).getAnnotation(javax.ejb.RemoteHome.class);
- if (li != null)
- return li.value();
- return null;
- }
-
- public static boolean publishesInterface(Container container, Class<?> businessInterface)
- {
- if (!(container instanceof SessionContainer))
- return false;
- Class<?>[] remotes = getRemoteAndBusinessRemoteInterfaces(container);
- for (Class<?> intf : remotes)
- {
- if (intf.getName().equals(businessInterface.getName()))
- return true;
- }
-
- Class<?> remoteHome = getRemoteHomeInterface(container);
- if (remoteHome != null)
- {
- if (businessInterface.getName().equals(remoteHome.getName()))
- {
- return true;
- }
- }
- Class<?>[] locals = getLocalAndBusinessLocalInterfaces(container);
- for (Class<?> clazz : locals)
- {
- if (clazz.getName().equals(businessInterface.getName()))
- {
- return true;
- }
- }
- Class<?> localHome = getLocalHomeInterface(container);
- if (localHome != null)
- {
- if (businessInterface.getName().equals(localHome.getName()))
- {
- return true;
- }
- }
-
- return false;
- }
-
- /**
- * Obtains the JNDI name for the specified container; may either be explicitly-defined by
- * annotation / XML or will otherwise default to the configured JNDI Binding Policy
- *
- * @param container
- * @param businessInterface
- * @return
- */
- public static String getJndiName(EJBContainer container, Class<?> businessInterface)
- {
- assert container != null : "container is null";
- assert businessInterface != null : "businessInterface is null";
-
- // Initialize to defaults of remote and not home
- String jndiName = null;
- boolean isHome = false;
- boolean isLocal = false;
-
- // Determine if remote
- Class<?>[] remotes = ProxyFactoryHelper.getRemoteAndBusinessRemoteInterfaces(container);
- for (Class<?> clazz : remotes)
- {
- if (clazz.getName().equals(businessInterface.getName()))
- {
- // Check for declared @RemoteBindings
- RemoteBindings bindings = ((EJBContainer) container).getAnnotation(RemoteBindings.class);
- if (bindings != null)
- {
- // Encountered, return
- return bindings.value()[0].jndiBinding();
- }
- // Check for declared @RemoteBinding
- RemoteBinding binding = ((EJBContainer) container).getAnnotation(RemoteBinding.class);
- if (binding != null)
- {
- // Encountered, return
- return binding.jndiBinding();
- }
- }
- }
-
- // Determine if remote home
- Class<?> remoteHome = getRemoteHomeInterface(container);
- if (remoteHome != null)
- {
- if (businessInterface.getName().equals(remoteHome.getName()))
- {
- // Check for declared @RemoteHomeBinding
- RemoteHomeBinding binding = ((EJBContainer) container).getAnnotation(RemoteHomeBinding.class);
- if (binding != null)
- {
- // Encountered, return
- return binding.jndiBinding();
- }
-
- // Set home for policy
- isHome = true;
- }
- }
-
- // Determine if local and home
- Class<?> localHome = getLocalHomeInterface(container);
- if (localHome != null)
- {
- if (businessInterface.getName().equals(localHome.getName()))
- {
- // Check for declared @LocalHomeBinding
- LocalHomeBinding binding = ((EJBContainer) container).getAnnotation(LocalHomeBinding.class);
- if (binding != null)
- {
- // Encountered, return
- return binding.jndiBinding();
- }
-
- // Set local and home for policy
- isHome = true;
- isLocal = true;
- }
- }
-
- // Determine if local
- Class<?>[] locals = getLocalAndBusinessLocalInterfaces(container);
- for (Class<?> clazz : locals)
- {
- if (clazz.getName().equals(businessInterface.getName()))
- {
- // Check for declared @LocalBinding
- LocalBinding binding = ((EJBContainer) container).getAnnotation(LocalBinding.class);
- if (binding != null)
- {
- // Encountered, return
- return binding.jndiBinding();
- }
-
- // Set local for policy
- isLocal = true;
- }
- }
-
- // If JNDI Name has not been explicitly specified, use policy
- if (jndiName == null)
- {
- // Log
- log.debug("JNDI name has not been explicitly set for EJB " + container.getEjbName() + ", interface "
- + businessInterface.getName());
-
- // Set JNDI name
- Ejb3DeploymentSummary summary = ProxyFactoryHelper.getDeploymentSummaryFromContainer(container);
- summary.setHome(isHome);
- summary.setLocal(isLocal);
- jndiName = ProxyFactoryHelper.getJndiBindingPolicy(container).getJndiName(summary);
- }
-
- // Return
- return jndiName;
- }
-
- /**
- * Returns all local interfaces in the specified container; interfaces
- * marked as "local" via either annotation or XML and extending EJBLocalObject
- *
- * @param container
- * @return
- */
- public static Class<?>[] getLocalInterfaces(Container container)
- {
- return ProxyFactoryHelper.getInterfacesAssignableFromClass(ProxyFactoryHelper
- .getLocalAndBusinessLocalInterfaces(container), EJBLocalObject.class, true);
- }
-
- /**
- * Returns all remote interfaces in the specified container; interfaces
- * marked as "remote" via either annotation or XML and extending EJBObject
- *
- * @param container
- * @return
- */
- public static Class<?>[] getRemoteInterfaces(Container container)
- {
- return ProxyFactoryHelper.getInterfacesAssignableFromClass(ProxyFactoryHelper
- .getRemoteAndBusinessRemoteInterfaces(container), EJBObject.class, true);
- }
-
- /**
- * Returns all local business interfaces in the specified container; interfaces
- * marked as "local" via either annotation or XML and not extending EJBLocalObject
- *
- * @param container
- * @return
- */
- public static Class<?>[] getLocalBusinessInterfaces(Container container)
- {
- return ProxyFactoryHelper.getInterfacesAssignableFromClass(ProxyFactoryHelper
- .getLocalAndBusinessLocalInterfaces(container), EJBLocalObject.class, false);
- }
-
- /**
- * Returns all remote business interfaces in the specified container; interfaces
- * marked as "remote" via either annotation or XML and not extending EJBObject
- *
- * @param container
- * @return
- */
- public static Class<?>[] getRemoteBusinessInterfaces(Container container)
- {
- return ProxyFactoryHelper.getInterfacesAssignableFromClass(ProxyFactoryHelper
- .getRemoteAndBusinessRemoteInterfaces(container), EJBObject.class, false);
- }
-
- /**
- * Returns an subset of the specified array of interfaces either
- * assignable to or not assignable to the specified class, depending
- * upon the flag "assignable"
- *
- * @param interfaces
- * @param clazz
- * @param assignable
- * @return
- */
- private static Class<?>[] getInterfacesAssignableFromClass(Class<?>[] interfaces, Class<?> clazz, boolean assignable)
- {
- // Initialize
- List<Class<?>> subset = new ArrayList<Class<?>>();
-
- // For all interfaces
- for (Class<?> interfaze : interfaces)
- {
- // If we want assignable classes only
- if (assignable && clazz.isAssignableFrom(interfaze))
- {
- subset.add(interfaze);
- }
-
- // If we want classes not assignable only
- if (!assignable && !clazz.isAssignableFrom(interfaze))
- {
- subset.add(interfaze);
- }
- }
-
- // Return
- return subset.toArray(new Class<?>[]
- {});
- }
-
- /**
- * Returns all remote and remote business interfaces in the specified container,
- * designated by @Remote or in ejb-jar.xml as "remote" or "business-remote"
- *
- * @param container
- * @return the remote interfaces of the container or an empty array
- */
- public static Class<?>[] getRemoteAndBusinessRemoteInterfaces(Container container)
- {
- // Initialize
- Remote remoteAnnotation = ((EJBContainer) container).getAnnotation(Remote.class);
- RemoteHome remoteHomeAnnotation = ((EJBContainer) container).getAnnotation(RemoteHome.class);
- Set<Class<?>> remoteAndRemoteBusinessInterfaces = new HashSet<Class<?>>();
- Class<?> beanClass = container.getBeanClass();
- boolean isStateless = (container instanceof StatelessContainer) ? true : false;
-
- // Obtain business interfaces
- Class<?>[] businessInterfaces = ProxyFactoryHelper.getBusinessInterfaces(beanClass).toArray(new Class[]
- {});
-
- // EJBTHREE-1127
- // Determine remote interface from return value of "create" in Remote Home
- if (remoteHomeAnnotation != null)
- {
- remoteAndRemoteBusinessInterfaces.addAll(ProxyFactoryHelper.getReturnTypesFromCreateMethods(
- remoteHomeAnnotation.value(), isStateless));
- }
-
- // If @Remote is not defined
- if (remoteAnnotation == null)
- {
- // For each of the business interfaces
- for (Class<?> clazz : businessInterfaces)
- {
- // If @Remote is on the business interface
- if (clazz.isAnnotationPresent(Remote.class))
- {
- // Add to the list of remotes
- remoteAndRemoteBusinessInterfaces.add(clazz);
- }
- }
- }
- // @Remote was defined
- else
- {
- // @Remote declares interfaces, add these
- if (remoteAnnotation.value().length > 0)
- {
- for (Class<?> clazz : remoteAnnotation.value())
- {
- remoteAndRemoteBusinessInterfaces.add(clazz);
- }
- }
- // @Remote is empty
- else
- {
- // No business interfaces were defined on the bean
- if (businessInterfaces.length == 0)
- {
- throw new RuntimeException("Use of empty @Remote on bean " + container.getEjbName()
- + " and there are no valid business interfaces");
- }
-
- // More than one default interface, cannot be marked as @Remote
- else if (businessInterfaces.length > 1)
- {
- throw new RuntimeException("Use of empty @Remote on bean " + container.getEjbName()
- + " with more than one default interface " + businessInterfaces);
- }
- // Only one default interface, mark as @Remote and return
- else
- {
- Class<?>[] rtn =
- {(Class<?>) businessInterfaces[0]};
- remoteAnnotation = new RemoteImpl(rtn);
- ((EJBContainer) container).getAnnotations().addClassAnnotation(javax.ejb.Remote.class, remoteAnnotation);
- return rtn;
- }
- }
- }
-
- // If remotes were found
- if (remoteAndRemoteBusinessInterfaces.size() > 0)
- {
- // Set interfaces and return
- Class<?>[] remotesArray = remoteAndRemoteBusinessInterfaces
- .toArray(new Class[remoteAndRemoteBusinessInterfaces.size()]);
- remoteAnnotation = new RemoteImpl(remotesArray);
- ((EJBContainer) container).getAnnotations().addClassAnnotation(Remote.class, remoteAnnotation);
- return remoteAnnotation.value();
- }
- // No remotes were found
- else
- {
- return new Class<?>[]
- {};
- }
- }
-
- /**
- * Obtains the return types declared by the "create" methods for the specified home interface.
- *
- * @param homeInterface
- * @param isStateless Flag to indicate whether this is for a Stateful or Stateless container
- * @return
- */
- private static Set<Class<?>> getReturnTypesFromCreateMethods(Class<?> homeInterface, boolean isStateless)
- {
- // Ensure we've been passed a Home or LocalHome interface (Developers only)
- assert (EJBHome.class.isAssignableFrom(homeInterface) || EJBLocalHome.class.isAssignableFrom(homeInterface));
-
- // Ensure we've been passed a Home or LocalHome interface (End-User)
- if (!EJBHome.class.isAssignableFrom(homeInterface) && !EJBLocalHome.class.isAssignableFrom(homeInterface))
- {
- throw new RuntimeException("Declared EJB 2.1 Home Interface " + homeInterface.getName() + " does not extend "
- + EJBHome.class.getName() + " or " + EJBLocalHome.class.getName()
- + " as required by EJB 3.0 Core Specification 4.6.8 and 4.6.10");
- }
-
- // Initialize
- Set<Class<?>> types = new HashSet<Class<?>>();
- List<Method> createMethods = null;
-
- // If for a Stateless Container
- if (isStateless)
- {
- // Initialize error message
- String specViolationErrorMessage = "EJB 3.0 Specification Violation (4.6.8 Bullet 4, 4.6.10 Bullet 4): \""
- + "A stateless session bean must define exactly one create method with no arguments." + "\"; found in "
- + homeInterface.getName();
-
- // Get all methods with signature "create"
- createMethods = new ArrayList<Method>();
- try
- {
- createMethods.add(homeInterface.getMethod("create", new Class<?>[]
- {}));
- }
- // EJB 3.0 Specification 4.6.8 Bullet 4 Violation
- // EJBTHREE-1156
- catch (NoSuchMethodException e)
- {
- throw new RuntimeException(specViolationErrorMessage);
- }
-
- // Ensure only one create method is defined
- // EJB 3.0 Specification 4.6.8 Bullet 4 Violation
- // EJBTHREE-1156
- if (createMethods.size() > 1)
- {
- throw new RuntimeException(specViolationErrorMessage);
- }
- }
- else
- {
- // Obtain all "create<METHOD>" methods
- createMethods = ClassHelper.getAllMethodsByPrefix(homeInterface, "create");
- }
- if (createMethods.size() == 0)
- {
- throw new RuntimeException("EJB 3.0 Core Specification Violation (4.6.8 Bullet 5): EJB2.1 Home Interface "
- + homeInterface + " does not declare a \'create<METHOD>\' method");
- }
-
- // Add all return types
- for (Method method : createMethods)
- {
- types.add(method.getReturnType());
- }
-
- // Return
- return types;
- }
-
- public static String getClientBindUrl(RemoteBinding binding) throws Exception
- {
- String clientBindUrl = binding.clientBindUrl();
- if (clientBindUrl.trim().length() == 0)
- {
- if (binding.invokerName()!=null && binding.invokerName().trim().length() != 0)
- {
- try
- {
- ObjectName connectionON = new ObjectName(binding.invokerName());
- KernelAbstraction kernelAbstraction = KernelAbstractionFactory.getInstance();
- clientBindUrl = (String)kernelAbstraction.getAttribute(connectionON, "InvokerLocator");
- }
- catch (Exception e)
- {
- log.warn("Unable to find InvokerLocator " + binding.invokerName() + ". Using default. " + e);
- clientBindUrl = RemoteProxyFactory.DEFAULT_CLIENT_BINDING;
- }
- }
- else
- {
- try
- {
- ObjectName connectionON = new ObjectName("jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3");
- KernelAbstraction kernelAbstraction = KernelAbstractionFactory.getInstance();
- clientBindUrl = (String)kernelAbstraction.getAttribute(connectionON, "InvokerLocator");
- }
- catch (Exception e)
- {
- log.warn("Unable to find default InvokerLocator. Using default. " + e);
- clientBindUrl = RemoteProxyFactory.DEFAULT_CLIENT_BINDING;
- }
- }
- }
- else if (clientBindUrl.indexOf("0.0.0.0") != -1)
- {
- KernelAbstraction kernelAbstraction = KernelAbstractionFactory.getInstance();
- ObjectName query = new ObjectName("jboss.remoting:type=Connector,handler=ejb3,*");
- Set mbeanSet = kernelAbstraction.getMBeans(query);
-
- URI targetUri = new URI(clientBindUrl);
- Iterator mbeans = mbeanSet.iterator();
- while (mbeans.hasNext())
- {
- ObjectInstance invokerInstance = (ObjectInstance)mbeans.next();
- ObjectName invokerName = invokerInstance.getObjectName();
- String invokerLocator = (String)kernelAbstraction.getAttribute(invokerName, "InvokerLocator");
- URI uri = new URI(invokerLocator);
-
- if (uri.getScheme().equals(targetUri.getScheme()) && uri.getPort() == targetUri.getPort())
- {
- return invokerLocator;
- }
- }
- }
-
- if (clientBindUrl == null)
- clientBindUrl = RemoteProxyFactory.DEFAULT_CLIENT_BINDING;
-
- return clientBindUrl;
- }
-
- /**
- * Create a Proxy Constructor for the specified interfaces, using the specified CL
- *
- * @param interfaces
- * @param cl
- * @return
- * @throws Exception
- */
- public static Constructor<?> createProxyConstructor(Class<?>[] interfaces, ClassLoader cl) throws Exception
- {
- Class<?> proxyClass = java.lang.reflect.Proxy.getProxyClass(cl, interfaces);
- return proxyClass.getConstructor(InvocationHandler.class);
- }
-
- public static String getHomeJndiName(EJBContainer container)
- {
- // Use explicitly-specified binding, if defined
- RemoteHomeBinding binding = container.getAnnotation(RemoteHomeBinding.class);
- if (binding != null)
- return binding.jndiBinding();
-
- // Use Default JNDI Binding Policy
- return ProxyFactoryHelper.getJndiBindingPolicy(container).getDefaultRemoteHomeJndiName(
- ProxyFactoryHelper.getDeploymentSummaryFromContainer(container));
- }
-
- public static String getLocalHomeJndiName(EJBContainer container)
- {
- // Use explicitly-specified binding, if defined
- LocalHomeBinding binding = container.getAnnotation(LocalHomeBinding.class);
- if (binding != null)
- return binding.jndiBinding();
-
- // Use Default JNDI Binding Policy
- return ProxyFactoryHelper.getJndiBindingPolicy(container).getDefaultLocalHomeJndiName(
- ProxyFactoryHelper.getDeploymentSummaryFromContainer(container));
- }
-
- public static String getLocalJndiName(EJBContainer container)
- {
- return ProxyFactoryHelper.getLocalJndiName(container, true);
- }
-
- private static String getLocalJndiName(EJBContainer container, boolean conflictCheck)
- {
- // See if local binding is explicitly-defined
- LocalBinding localBinding = container.getAnnotation(LocalBinding.class);
-
- // If none specified
- if (localBinding == null)
- {
- // Get JNDI name from policy
- String name = ProxyFactoryHelper.getJndiBindingPolicy(container).getDefaultLocalJndiName(
- ProxyFactoryHelper.getDeploymentSummaryFromContainer(container));
-
- // If we should check for naming conflict
- if (conflictCheck){
- // Check
- ProxyFactoryHelper.checkForJndiNamingConflict(container);
- }
-
- // Return
- return name;
- }
- // Local Binding was explicitly-specified, use it
- else
- {
- return localBinding.jndiBinding();
- }
- }
-
- public static String getRemoteBusinessJndiName(EJBContainer container)
- {
- return ProxyFactoryHelper.getRemoteBusinessJndiName(container, true);
- }
-
- public static String getRemoteBusinessJndiName(EJBContainer container, boolean check)
- {
- RemoteBinding binding = container.getAnnotation(RemoteBinding.class);
-
- return ProxyFactoryHelper.getRemoteBusinessJndiName(container, binding);
- }
-
- private static void checkForJndiNamingConflict(EJBContainer container)
- {
- if (container.getAnnotation(Local.class) != null)
- {
- Ejb3DeploymentSummary summary = ProxyFactoryHelper.getDeploymentSummaryFromContainer(container);
- String localJndiName = ProxyFactoryHelper.getJndiBindingPolicy(container).getDefaultLocalJndiName(summary);
- String remoteJndiName = ProxyFactoryHelper.getJndiBindingPolicy(container).getDefaultRemoteJndiName(summary);
- String ejbName = container.getEjbName();
- if ((localJndiName.equals(remoteJndiName)))
- {
- throw new javax.ejb.EJBException("Conflict between default jndi name " + remoteJndiName
- + " for both remote and local for ejb-name:" + ejbName + ", bean class=" + container.getBeanClass());
- }
-
- }
- }
-
- private static String getRemoteBusinessJndiName(EJBContainer container, RemoteBinding binding)
- {
- return ProxyFactoryHelper.getRemoteBusinessJndiName(container, binding, true);
- }
-
- public static String getRemoteBusinessJndiName(EJBContainer container, RemoteBinding binding, boolean conflictCheck)
- {
- // Initialize
- String jndiName = null;
-
- // If binding is not defined
- if (binding == null || binding.jndiBinding() == null || binding.jndiBinding().trim().equals(""))
- {
- // Use the default
- jndiName = getDefaultRemoteBusinessJndiName(container);
-
- // If we should check for a naming conflict
- if (conflictCheck)
- {
- // Check
- ProxyFactoryHelper.checkForJndiNamingConflict(container);
- }
-
- }
- // Binding is explicitly-defined
- else
- {
- // use it
- jndiName = binding.jndiBinding();
- }
-
- // Return
- return jndiName;
- }
-
- public static String getDefaultRemoteBusinessJndiName(EJBContainer container)
- {
- // Obtain JNDI Binding Policy
- DefaultJndiBindingPolicy policy = ProxyFactoryHelper.getJndiBindingPolicy(container);
-
- // Obtain Deployment Summary
- Ejb3DeploymentSummary summary = ProxyFactoryHelper.getDeploymentSummaryFromContainer(container);
-
- // Return the policy's default remote name for this summary
- return policy.getDefaultRemoteJndiName(summary);
- }
-
- /**
- * Obtains the JNDI Binding Policy for the specified container
- *
- * @param container
- * @author ALR
- * @return
- */
- private static DefaultJndiBindingPolicy getJndiBindingPolicy(EJBContainer container)
- {
- // Attempt to obtain the binding policy from annotation repo
- JndiBindingPolicy bindingPolicy = container.getAnnotation(JndiBindingPolicy.class);
-
- // Initialize
- Class<? extends DefaultJndiBindingPolicy> policy = null;
-
- // If policy is defined
- if (bindingPolicy != null){
- // Use it
- policy = bindingPolicy.policy();
- }
- // No policy defined
- else
- {
- // Use default policy
- Class<? extends DefaultJndiBindingPolicy> policyClass = PackagingBasedJndiBindingPolicy.class;
- // Log warning
- log.warn("No default JNDI Binding Policy Defined (see ejb3-interceptors-aop.xml for example); defaulting to "
- + policyClass.getName());
- policy = policyClass;
- }
-
- // Log
- log.debug("Obtaining JNDI name from policy " + policy.getName());
-
- try
- {
- // Instanciate the policy and return
- return policy.newInstance();
- }
- catch (InstantiationException e)
- {
- throw new RuntimeException("Could not instanciate JNDI Binding Policy: " + policy.getName(), e);
- }
- catch (IllegalAccessException e)
- {
- throw new RuntimeException(e);
- }
- }
-
- private static Ejb3DeploymentSummary getDeploymentSummaryFromContainer(EJBContainer container)
- {
- // Construct Deployment Summary
- Ejb3DeploymentSummary summary = new Ejb3DeploymentSummary();
- summary.setEjbName(container.getEjbName());
- summary.setService(container instanceof ServiceContainer);
- summary.setStateful(container instanceof StatefulContainer);
- summary.setDeploymentName(container.getDeployment().getName());
- summary.setBeanClass(container.getBeanClass());
- DeploymentScope scope = container.getDeployment().getEar();
- if (scope != null)
- {
- summary.setDeploymentScopeBaseName(scope.getBaseName());
- }
-
- // Return
- return summary;
- }
-}
\ No newline at end of file
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/ProxyUtils.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/ProxyUtils.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/ProxyUtils.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,160 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import javax.ejb.EJBHome;
-import javax.ejb.EJBObject;
-import org.jboss.aop.advice.Interceptor;
-import org.jboss.aop.joinpoint.MethodInvocation;
-import org.jboss.aop.util.MethodHashing;
-import org.jboss.aop.util.PayloadKey;
-import org.jboss.aspects.asynch.AsynchMixin;
-import org.jboss.aspects.asynch.AsynchProvider;
-import org.jboss.aspects.asynch.AsynchProxyInterceptor;
-import org.jboss.aspects.asynch.FutureHolder;
-import org.jboss.ejb3.asynchronous.AsynchronousInterceptor;
-import org.jboss.ejb3.remoting.Proxy;
-
-/**
- * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
- * @version $Revision$
- */
-public class ProxyUtils
-{
- public final static Class ASYNCH_PROVIDER_CLASS = AsynchProvider.class;
- public final static long GET_ASYNCHRONOUS;
- public static final long TO_STRING;
- public static final long EQUALS;
- public static final long HASHCODE;
- public static final Method GET_PRIMARY_KEY;
- public static final Method GET_HANDLE;
- public static final Method GET_EJB_HOME;
- public static final Method IS_IDENTICAL;
- public static final Method GET_HOME_HANDLE;
- public static final Method GET_EJB_METADATA;
- public static final Method REMOVE;
-
- static
- {
- try
- {
- Class[] empty = {};
-
- Method method = JBossProxy.class.getMethod("getAsynchronousProxy", empty);
- GET_ASYNCHRONOUS = MethodHashing.calculateHash(method);
- TO_STRING = MethodHashing.calculateHash(Object.class.getDeclaredMethod("toString", empty));
- EQUALS = MethodHashing.calculateHash(Object.class.getDeclaredMethod("equals", new Class[]{Object.class}));
- HASHCODE = MethodHashing.calculateHash(Object.class.getDeclaredMethod("hashCode", empty));
-
- GET_PRIMARY_KEY = EJBObject.class.getMethod("getPrimaryKey", empty);
- GET_HANDLE = EJBObject.class.getMethod("getHandle", empty);
- GET_EJB_HOME = EJBObject.class.getMethod("getEJBHome", empty);
- IS_IDENTICAL = EJBObject.class.getMethod("isIdentical", new Class[] { EJBObject.class });
- REMOVE = EJBObject.class.getMethod("remove", empty);
-
- GET_HOME_HANDLE = EJBHome.class.getMethod("getHomeHandle", empty);
- GET_EJB_METADATA = EJBHome.class.getMethod("getEJBMetaData", empty);
- }
- catch (NoSuchMethodException e)
- {
- throw new RuntimeException(e);
- }
- }
-
- public static boolean isAsynchronous(Class[] infs)
- {
- for (int i = 0; i < infs.length; i++)
- {
- if (infs[i] == ASYNCH_PROVIDER_CLASS)
- {
- return true;
- }
- }
- return false;
- }
-
- public static Class[] addAsynchProviderInterface(Class[] infs)
- {
- ArrayList interfaces = new ArrayList();
-
- for (int i = 0; i < infs.length; i++)
- {
- if (infs[i] == ASYNCH_PROVIDER_CLASS)
- {
- //This should not happen
- continue;
- }
- interfaces.add(infs[i]);
- }
-
- interfaces.add(ASYNCH_PROVIDER_CLASS);
- return (Class[]) interfaces.toArray(new Class[interfaces.size()]);
- }
-
- public static Interceptor[] addAsynchProxyInterceptor(AsynchMixin mixin, Interceptor[] interceptors)
- {
- AsynchProxyInterceptor interceptor = new AsynchProxyInterceptor(mixin);
- Interceptor[] newInterceptors = null;
- newInterceptors = new Interceptor[interceptors.length + 1];
- newInterceptors[0] = interceptor;
- System.arraycopy(interceptors, 0, newInterceptors, 1, interceptors.length);
- return newInterceptors;
- }
-
- public static void addLocalAsynchronousInfo(MethodInvocation invocation, FutureHolder provider)
- {
- if (provider != null)
- {
- invocation.getMetaData().addMetaData(AsynchronousInterceptor.ASYNCH, AsynchronousInterceptor.INVOKE_ASYNCH, "YES", PayloadKey.AS_IS);
- invocation.getMetaData().addMetaData(AsynchronousInterceptor.ASYNCH, AsynchronousInterceptor.FUTURE_HOLDER, provider, PayloadKey.AS_IS);
- }
- }
-
- public static Object handleCallLocally(Object jbproxy, Proxy ih, Method m, Object[] args)
- {
- long hash = MethodHashing.calculateHash(m);
- return handleCallLocally(hash, jbproxy, ih, m, args);
- }
-
- public static Object handleCallLocally(long hash, Object jbproxy, Proxy ih, Method m, Object[] args)
- {
- if (hash == ProxyUtils.GET_ASYNCHRONOUS)
- {
- return ih.getAsynchronousProxy((JBossProxy)jbproxy);
- }
- else if (hash == TO_STRING)
- {
- return ih.toString();
- }
- else if (hash == HASHCODE)
- {
- return new Integer(ih.toString().hashCode());
- }
- else if (hash == EQUALS)
- {
- return new Boolean(ih.toString().equals(args[0].toString()));
- }
- return null;
- }
-}
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/asynchronous/Asynch.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/asynchronous/Asynch.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/asynchronous/Asynch.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -21,7 +21,7 @@
*/
package org.jboss.ejb3.asynchronous;
-import org.jboss.ejb3.JBossProxy;
+import org.jboss.ejb3.proxy.JBossProxy;
import org.jboss.aspects.asynch.Future;
import org.jboss.aspects.asynch.AsynchProvider;
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/enc/DeploymentEjbResolver.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/enc/DeploymentEjbResolver.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/enc/DeploymentEjbResolver.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -24,9 +24,9 @@
import org.jboss.ejb3.EJBContainer;
import org.jboss.ejb3.Ejb3Deployment;
import org.jboss.ejb3.Ejb3Registry;
-import org.jboss.ejb3.ProxyFactoryHelper;
import org.jboss.ejb3.Container;
import org.jboss.ejb3.DeploymentScope;
+import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
import org.jboss.logging.Logger;
import javax.naming.NameNotFoundException;
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/mdb/MDB.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/mdb/MDB.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/mdb/MDB.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -35,8 +35,8 @@
import org.jboss.aop.Domain;
import org.jboss.ejb3.Ejb3Deployment;
-import org.jboss.ejb3.ProxyFactoryHelper;
import org.jboss.ejb3.annotation.DefaultActivationSpecs;
+import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
import org.jboss.metadata.ejb.jboss.JBossMessageDrivenBeanMetaData;
import org.jboss.metadata.ejb.spec.NamedMethodMetaData;
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/mdb/MessagingContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/mdb/MessagingContainer.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/mdb/MessagingContainer.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -45,10 +45,10 @@
import org.jboss.ejb3.EJBContainerInvocation;
import org.jboss.ejb3.Ejb3Deployment;
import org.jboss.ejb3.Ejb3Module;
-import org.jboss.ejb3.ProxyFactoryHelper;
import org.jboss.ejb3.annotation.ResourceAdapter;
import org.jboss.ejb3.jms.JMSDestinationFactory;
import org.jboss.ejb3.mdb.inflow.JBossMessageEndpointFactory;
+import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
import org.jboss.ejb3.timerservice.TimedObjectInvoker;
import org.jboss.ejb3.timerservice.TimerServiceFactory;
import org.jboss.jms.jndi.JMSProviderAdapter;
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/mdb/ProducerFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/mdb/ProducerFactory.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/mdb/ProducerFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -21,7 +21,6 @@
*/
package org.jboss.ejb3.mdb;
-import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Hashtable;
@@ -34,15 +33,13 @@
import javax.naming.Reference;
import javax.naming.StringRefAddr;
-import org.jboss.aop.util.MethodHashing;
import org.jboss.ejb3.Container;
-import org.jboss.ejb3.JndiProxyFactory;
-import org.jboss.ejb3.ProxyFactory;
import org.jboss.ejb3.annotation.MessageProperties;
import org.jboss.ejb3.annotation.Producer;
import org.jboss.ejb3.annotation.Producers;
-import org.jboss.ejb3.annotation.impl.MessagePropertiesImpl;
import org.jboss.ejb3.annotation.impl.ProducerImpl;
+import org.jboss.ejb3.proxy.ProxyFactory;
+import org.jboss.ejb3.proxy.JndiSessionProxyObjectFactory;
import org.jboss.logging.Logger;
import org.jboss.util.naming.Util;
@@ -55,19 +52,20 @@
{
private static final Logger log = Logger.getLogger(ProducerFactory.class);
- protected Class producer;
+ protected Class<?> producer;
protected MessageProperties props;
protected Destination dest;
- protected HashMap methodMap;
+ protected HashMap<?,?> methodMap;
protected ProducerImpl pImpl;
protected String jndiName;
protected InitialContext ctx;
- protected Hashtable initialContextProperties;
+ protected Hashtable<?,?> initialContextProperties;
public static final String PROXY_FACTORY_NAME = "PRODUCER_FACTORY";
- protected ProducerFactory(ConsumerContainer container, Class producer, MessageProperties props, Destination dest, InitialContext ctx, Hashtable ctxProperties)
+ protected ProducerFactory(ConsumerContainer container, Class<?> producer, MessageProperties props, Destination dest,
+ InitialContext ctx, Hashtable<?, ?> ctxProperties)
{
this.producer = producer;
this.props = props;
@@ -134,8 +132,8 @@
Name name = baseCtx.getNameParser("").parse(jndiName);
baseCtx = Util.createSubcontext(baseCtx, name.getPrefix(name.size() - 1));
String atom = name.get(name.size() - 1);
- RefAddr refAddr = new StringRefAddr(JndiProxyFactory.FACTORY, atom + PROXY_FACTORY_NAME);
- Reference ref = new Reference("java.lang.Object", refAddr, JndiProxyFactory.class.getName(), null);
+ RefAddr refAddr = new StringRefAddr(JndiSessionProxyObjectFactory.REF_ADDR_NAME_JNDI_BINDING_DELEGATE_PROXY_FACTORY, atom + PROXY_FACTORY_NAME);
+ Reference ref = new Reference("java.lang.Object", refAddr, JndiSessionProxyObjectFactory.class.getName(), null);
try
{
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/mdb/RemoteProducerFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/mdb/RemoteProducerFactory.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/mdb/RemoteProducerFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -32,9 +32,9 @@
import org.jboss.aop.advice.Interceptor;
import org.jboss.aspects.remoting.Remoting;
import org.jboss.ejb3.Container;
-import org.jboss.ejb3.ProxyFactory;
import org.jboss.ejb3.annotation.MessageProperties;
-import org.jboss.ejb3.remoting.RemoteProxyFactory;
+import org.jboss.ejb3.proxy.ProxyFactory;
+import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
import org.jboss.util.naming.Util;
/**
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/EJBMetaDataImpl.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/EJBMetaDataImpl.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/EJBMetaDataImpl.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,154 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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;
-
-import java.io.Serializable;
-import java.rmi.RemoteException;
-
-import javax.ejb.EJBException;
-import javax.ejb.EJBHome;
-import javax.ejb.EJBMetaData;
-import javax.ejb.HomeHandle;
-
-/**
- * An implementation of the EJBMetaData interface which allows a
- * client to obtain the enterprise Bean's meta-data information.
- *
- * @author Rickard Oberg (rickard.oberg at telkel.com)
- * @author <a href="mailto:marc.fleury at telkel.com">Marc Fleury</a>
- * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
- * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
- * @version $Revision$
- */
-public class EJBMetaDataImpl
- implements EJBMetaData, Serializable
-{
- /** Serial Version Identifier. @since 1.1 */
- private static final long serialVersionUID = -3698855455664391097L;
-
- // Attributes ----------------------------------------------------
- private final Class<?> remote;
- private final Class<?> home;
- private final Class<?> pkClass;
-
- private final boolean session;
- private final boolean statelessSession;
- private final HomeHandle homeHandle;
-
- // Constructors --------------------------------------------------
-
- /**
- * Construct an <tt>EJBMetaDataImpl</tt>.
- * this should only be accessible from the factory.
- */
- public EJBMetaDataImpl(final Class<?> remote,
- final Class<?> home,
- final Class<?> pkClass,
- final boolean session,
- final boolean statelessSession,
- final HomeHandle homeHandle)
- {
- this.remote = remote;
- this.home = home;
- this.pkClass = pkClass;
- this.session = session;
- this.statelessSession = statelessSession;
- this.homeHandle = homeHandle;
- }
-
- // Constructors --------------------------------------------------
-
- // EJBMetaData ---------------------------------------------------
-
-
- // EJBMetaData ---------------------------------------------------
-
- /**
- * Obtain the home interface of the enterprise Bean.
- *
- * @throws EJBException Failed to get EJBHome object.
- */
-
- public EJBHome getEJBHome()
- {
- try
- {
- return homeHandle.getEJBHome();
- }
- catch (EJBException e)
- {
- throw e;
- }
- catch (RemoteException e)
- {
- e.printStackTrace();
- throw new EJBException(e);
- }
- }
-
- /**
- * Obtain the Class object for the enterprise Bean's home interface.
- */
- public Class<?> getHomeInterfaceClass()
- {
- return home;
- }
-
- /**
- * Obtain the Class object for the enterprise Bean's remote interface.
- */
- public Class<?> getRemoteInterfaceClass()
- {
- return remote;
- }
-
- /**
- * Obtain the Class object for the enterprise Bean's primary key class.
- */
- public Class<?> getPrimaryKeyClass()
- {
- if (session == true)
- throw new RuntimeException("A session bean does not have a primary key class");
-
- return pkClass;
- }
-
- /**
- * Test if the enterprise Bean's type is "session".
- *
- * @return True if the type of the enterprise Bean is session bean.
- */
- public boolean isSession()
- {
- return session;
- }
-
- /**
- * Test if the enterprise Bean's type is "stateless session".
- *
- * @return True if the type of the enterprise Bean is stateless session.
- */
- public boolean isStatelessSession()
- {
- return statelessSession;
- }
-}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/JBossProxy.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/JBossProxy.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/JBossProxy.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/JBossProxy.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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;
+
+/**
+ *
+ *
+ * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision$
+ */
+public interface JBossProxy
+{
+ Object getAsynchronousProxy();
+}
\ No newline at end of file
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/JndiSessionProxyObjectFactory.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/JndiSessionProxyObjectFactory.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/JndiSessionProxyObjectFactory.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/JndiSessionProxyObjectFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,122 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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;
+
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.Name;
+import javax.naming.RefAddr;
+import javax.naming.Reference;
+import javax.naming.spi.ObjectFactory;
+
+import org.jboss.logging.Logger;
+import org.jnp.interfaces.MarshalledValuePair;
+
+/**
+ * JndiProxyFactory
+ *
+ * Responsible for delegating to the appropriate Proxy Factory
+ * for creation of a Proxy, and setting appropriately
+ * the target "
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ */
+public class JndiSessionProxyObjectFactory implements ObjectFactory
+{
+ // -------------------------------------------------------------------------------------------||
+ // Class Members -----------------------------------------------------------------------------||
+ // -------------------------------------------------------------------------------------------||
+
+ private static final Logger logger = Logger.getLogger(JndiSessionProxyObjectFactory.class);
+
+ public static final String REF_ADDR_NAME_JNDI_BINDING_DELEGATE_PROXY_FACTORY = "FACTORY";
+
+ public static final String REF_ADDR_NAME_BUSINESS_INTERFACE_TYPE = "BUSINESS_INTERFACE_TYPE";
+
+ // -------------------------------------------------------------------------------------------||
+ // Required Implementations ------------------------------------------------------------------||
+ // -------------------------------------------------------------------------------------------||
+
+ /**
+ * Using the ProxyFactory located at the RefAddr(REF_ADDR_NAME_JNDI_BINDING_DELEGATE_PROXY_FACTORY)
+ * specified by obj, create a new Proxy, set the target business interface
+ * (if specified by RefAddr(REF_ADDR_NAME_BUSINESS_INTERFACE_TYPE)), and return to the client.
+ */
+ public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment)
+ throws Exception
+ {
+ // Initialize
+ Reference ref = null;
+ String proxyFactoryJndiBinding = null;
+ ProxyFactory proxyFactory = null;
+
+ // Obtain the reference
+ try
+ {
+ ref = Reference.class.cast(obj);
+ logger.trace("Obtained " + Reference.class.getName() + " from " + obj);
+ }
+ catch (ClassCastException cce)
+ {
+ // Throw descriptive exception
+ throw new RuntimeException("Object at JNDI at " + nameCtx + name.toString() + " was not of expected type "
+ + Reference.class.getName(), cce);
+ }
+
+ // Obtain the JNDI Binding of the factory to use
+ try
+ {
+ RefAddr refAddr = ref.get(JndiSessionProxyObjectFactory.REF_ADDR_NAME_JNDI_BINDING_DELEGATE_PROXY_FACTORY);
+ Object content = refAddr.getContent();
+ proxyFactoryJndiBinding = String.class.cast(content);
+ logger.trace(ProxyFactory.class.getName() + " is located in JNDI at " + proxyFactoryJndiBinding);
+ }
+ catch (ClassCastException cce)
+ {
+ // Throw descriptive exception
+ throw new RuntimeException("Content for Reference name "
+ + JndiSessionProxyObjectFactory.REF_ADDR_NAME_JNDI_BINDING_DELEGATE_PROXY_FACTORY + " bound in JNDI at "
+ + nameCtx + name.toString() + " was not of expected type " + String.class.getName(), cce);
+ }
+
+ // Get the Proxy Factory from JNDI
+ Object proxyFactoryObj = nameCtx.lookup(proxyFactoryJndiBinding);
+ try
+ {
+ proxyFactory = ProxyFactory.class.cast(proxyFactoryObj);
+ logger.trace("Found " + ProxyFactory.class.getName() + " instance at " + proxyFactoryJndiBinding);
+ }
+ catch (ClassCastException e)
+ {
+ throw new RuntimeException("Expected " + ProxyFactory.class.getName() + " instance in JNDI at "
+ + proxyFactoryJndiBinding + ", instead got " + proxyFactoryObj);
+ }
+
+ // Create a business (EJB30 View) Proxy via the Factory
+ Object proxy = proxyFactory.createProxyBusiness();
+
+ // Marshall and return
+ MarshalledValuePair marshalledProxy = new MarshalledValuePair(proxy);
+ return marshalledProxy.get();
+ }
+}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/ProxyFactory.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/ProxyFactory.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/ProxyFactory.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/ProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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;
+
+/**
+ * Contract for a generic EJB3 Proxy Factory
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision$
+ */
+public interface ProxyFactory
+{
+ /**
+ * Create an EJB 2.1 Home Proxy
+ *
+ * @return
+ */
+ public Object createHomeProxy();
+
+ /**
+ * Create an EJB3 Business proxy with no
+ * specific target business interface
+ *
+ * @return
+ */
+ public Object createProxyBusiness();
+
+ /**
+ * Lifecycle Start
+ *
+ * @throws Exception
+ */
+ public void start() throws Exception;
+
+ /**
+ * Lifecycle Stop
+ *
+ * @throws Exception
+ */
+ public void stop() throws Exception;
+}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/ProxyUtils.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/ProxyUtils.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/ProxyUtils.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/ProxyUtils.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,162 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+
+import javax.ejb.EJBHome;
+import javax.ejb.EJBObject;
+
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.joinpoint.MethodInvocation;
+import org.jboss.aop.util.MethodHashing;
+import org.jboss.aop.util.PayloadKey;
+import org.jboss.aspects.asynch.AsynchMixin;
+import org.jboss.aspects.asynch.AsynchProvider;
+import org.jboss.aspects.asynch.AsynchProxyInterceptor;
+import org.jboss.aspects.asynch.FutureHolder;
+import org.jboss.ejb3.asynchronous.AsynchronousInterceptor;
+import org.jboss.ejb3.proxy.handler.ProxyInvocationHandler;
+
+/**
+ * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
+ * @version $Revision$
+ */
+public class ProxyUtils
+{
+ public final static Class<AsynchProvider> ASYNCH_PROVIDER_CLASS = AsynchProvider.class;
+ public final static long GET_ASYNCHRONOUS;
+ public static final long TO_STRING;
+ public static final long EQUALS;
+ public static final long HASHCODE;
+ public static final Method GET_PRIMARY_KEY;
+ public static final Method GET_HANDLE;
+ public static final Method GET_EJB_HOME;
+ public static final Method IS_IDENTICAL;
+ public static final Method GET_HOME_HANDLE;
+ public static final Method GET_EJB_METADATA;
+ public static final Method REMOVE;
+
+ static
+ {
+ try
+ {
+ Class<?>[] empty = {};
+
+ Method method = JBossProxy.class.getMethod("getAsynchronousProxy", empty);
+ GET_ASYNCHRONOUS = MethodHashing.calculateHash(method);
+ TO_STRING = MethodHashing.calculateHash(Object.class.getDeclaredMethod("toString", empty));
+ EQUALS = MethodHashing.calculateHash(Object.class.getDeclaredMethod("equals", new Class<?>[]{Object.class}));
+ HASHCODE = MethodHashing.calculateHash(Object.class.getDeclaredMethod("hashCode", empty));
+
+ GET_PRIMARY_KEY = EJBObject.class.getMethod("getPrimaryKey", empty);
+ GET_HANDLE = EJBObject.class.getMethod("getHandle", empty);
+ GET_EJB_HOME = EJBObject.class.getMethod("getEJBHome", empty);
+ IS_IDENTICAL = EJBObject.class.getMethod("isIdentical", new Class<?>[] { EJBObject.class });
+ REMOVE = EJBObject.class.getMethod("remove", empty);
+
+ GET_HOME_HANDLE = EJBHome.class.getMethod("getHomeHandle", empty);
+ GET_EJB_METADATA = EJBHome.class.getMethod("getEJBMetaData", empty);
+ }
+ catch (NoSuchMethodException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static boolean isAsynchronous(Class<?>[] infs)
+ {
+ for (int i = 0; i < infs.length; i++)
+ {
+ if (infs[i] == ASYNCH_PROVIDER_CLASS)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static Class<?>[] addAsynchProviderInterface(Class<?>[] infs)
+ {
+ ArrayList<Class<?>> interfaces = new ArrayList<Class<?>>();
+
+ for (int i = 0; i < infs.length; i++)
+ {
+ if (infs[i] == ASYNCH_PROVIDER_CLASS)
+ {
+ //This should not happen
+ continue;
+ }
+ interfaces.add(infs[i]);
+ }
+
+ interfaces.add(ASYNCH_PROVIDER_CLASS);
+ return (Class<?>[]) interfaces.toArray(new Class<?>[interfaces.size()]);
+ }
+
+ public static Interceptor[] addAsynchProxyInterceptor(AsynchMixin mixin, Interceptor[] interceptors)
+ {
+ AsynchProxyInterceptor interceptor = new AsynchProxyInterceptor(mixin);
+ Interceptor[] newInterceptors = null;
+ newInterceptors = new Interceptor[interceptors.length + 1];
+ newInterceptors[0] = interceptor;
+ System.arraycopy(interceptors, 0, newInterceptors, 1, interceptors.length);
+ return newInterceptors;
+ }
+
+ public static void addLocalAsynchronousInfo(MethodInvocation invocation, FutureHolder provider)
+ {
+ if (provider != null)
+ {
+ invocation.getMetaData().addMetaData(AsynchronousInterceptor.ASYNCH, AsynchronousInterceptor.INVOKE_ASYNCH, "YES", PayloadKey.AS_IS);
+ invocation.getMetaData().addMetaData(AsynchronousInterceptor.ASYNCH, AsynchronousInterceptor.FUTURE_HOLDER, provider, PayloadKey.AS_IS);
+ }
+ }
+
+ public static Object handleCallLocally(Object jbproxy, ProxyInvocationHandler ih, Method m, Object[] args)
+ {
+ long hash = MethodHashing.calculateHash(m);
+ return handleCallLocally(hash, jbproxy, ih, m, args);
+ }
+
+ public static Object handleCallLocally(long hash, Object jbproxy, ProxyInvocationHandler ih, Method m, Object[] args)
+ {
+ if (hash == ProxyUtils.GET_ASYNCHRONOUS)
+ {
+ return ih.getAsynchronousProxy((JBossProxy)jbproxy);
+ }
+ else if (hash == TO_STRING)
+ {
+ return ih.toString();
+ }
+ else if (hash == HASHCODE)
+ {
+ return new Integer(ih.toString().hashCode());
+ }
+ else if (hash == EQUALS)
+ {
+ return new Boolean(ih.toString().equals(args[0].toString()));
+ }
+ return null;
+ }
+}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory)
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/BaseSessionProxyFactory.java
===================================================================
--- projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/BaseSessionProxyFactory.java 2008-04-23 20:41:05 UTC (rev 72636)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/BaseSessionProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,648 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.factory;
-
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.ejb.EJBException;
-import javax.ejb.EJBHome;
-import javax.ejb.EJBLocalHome;
-import javax.ejb.EJBLocalObject;
-import javax.ejb.EJBMetaData;
-import javax.ejb.EJBObject;
-import javax.ejb.Handle;
-import javax.ejb.HomeHandle;
-import javax.ejb.RemoteHome;
-import javax.naming.NameNotFoundException;
-import javax.naming.NamingException;
-
-import org.jboss.ejb3.EJBContainer;
-import org.jboss.ejb3.Ejb3Registry;
-import org.jboss.ejb3.SpecificationInterfaceType;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.proxy.JBossProxy;
-import org.jboss.ejb3.proxy.handler.BaseSessionRemoteProxyInvocationHandler;
-import org.jboss.ejb3.proxy.impl.EJBMetaDataImpl;
-import org.jboss.ejb3.proxy.impl.HomeHandleImpl;
-import org.jboss.ejb3.session.ProxyAccessType;
-import org.jboss.ejb3.session.SessionContainer;
-import org.jboss.ejb3.session.SessionSpecContainer;
-import org.jboss.logging.Logger;
-import org.jboss.util.naming.Util;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- * @version $Revision$
- */
-public abstract class BaseSessionProxyFactory implements SessionProxyFactory, Externalizable
-{
- @SuppressWarnings("unused")
- private static final Logger log = Logger.getLogger(BaseSessionProxyFactory.class);
-
- private static final String JNDI_NAME_SUFFIX_PROXY_FACTORY = "/ProxyFactory";
-
- private SessionSpecContainer container;
- protected String containerGuid;
- protected String containerClusterUid;
- protected boolean isClustered = false;
- protected String jndiName;
-
- /**
- * Proxy Constructor for the Business Interfaces' Proxy
- */
- protected Constructor<?> businessProxyConstructor;
-
- /**
- * Proxy Constructor for the EJBObject/EJBLocalObject Proxy
- */
- protected Constructor<?> ejb21ProxyConstructor;
-
- private static final String METHOD_PREFIX_EJB21_CREATE = "create";
-
- public BaseSessionProxyFactory()
- {
- }
-
- protected BaseSessionProxyFactory(SessionSpecContainer container)
- {
- assert container != null : "container is null";
-
- setContainer(container);
- }
-
- public Object createHomeProxy()
- {
- throw new RuntimeException("NYI");
- }
-
- /**
- * Creates the Proxy constructors
- */
- protected void createProxyConstructors() throws Exception
- {
- // Obtain this bean class' CL
- ClassLoader cl = this.getContainer().getBeanClass().getClassLoader();
-
- // Create business proxy constructor
- Class<?>[] businessInterfaces = this.getInterfacesForBusinessProxy();
- this.businessProxyConstructor = ProxyFactoryHelper.createProxyConstructor(businessInterfaces, cl);
-
- // Create EJB21 proxy constructor
- Class<?>[] ejb21Interfaces = this.getInterfacesForEjb21Proxy();
- if (ejb21Interfaces != null)
- {
- this.ejb21ProxyConstructor = ProxyFactoryHelper.createProxyConstructor(ejb21Interfaces, cl);
- }
-
-
- /* plain jdk
- Class<?> proxyClass = java.lang.reflect.Proxy.getProxyClass(getContainer().getBeanClass().getClassLoader(), interfaces);
- final Class<?>[] constructorParams =
- {InvocationHandler.class};
- businessProxyConstructor = proxyClass.getConstructor(constructorParams);
-
- */
-
- /* javassist */
- /*
- proxyFactory = new javassist.util.proxy.ProxyFactory()
- {
- @Override
- protected ClassLoader getClassLoader()
- {
- return container.getBeanClass().getClassLoader();
- }
- };
- proxyFactory.setInterfaces(interfaces);
- proxyFactory.setSuperclass(JavassistProxy.class);
- proxyClass = proxyFactory.createClass();
- proxyConstructor = proxyClass.getConstructor((Class[]) null);
- */
-
- /* cglib */
- /*
- proxyClass = net.sf.cglib.proxy.Proxy.getProxyClass(container.getBeanClass().getClassLoader(), interfaces);
- final Class[] constructorParams = {net.sf.cglib.proxy.InvocationHandler.class};
- proxyConstructor = proxyClass.getConstructor(constructorParams);
- */
- }
-
- protected void bindProxy(Object proxy) throws NamingException
- {
- try
- {
- //TODO Dev
-// // Bind the Proxy Factory if not yet bound
-// try
-// {
-// // Check if bound yet
-// Util.lookup(this.getJndiNameProxyFactory(), this.getClass());
-// }
-// // Proxy factory is not yet bound
-// catch(NameNotFoundException nnfe)
-// {
-// // Bind Proxy Factory
-// log.debug("Binding proxy factory " + this.toString() + " for " + this.getContainer().getEjbName()
-// + " in JNDI at " + this.getJndiNameProxyFactory());
-// Util.rebind(this.getContainer().getInitialContext(), this.getJndiNameProxyFactory(), this);
-// }
-// // Unexpected Exception
-// catch (Exception e)
-// {
-// throw new RuntimeException(e);
-// }
-
- // Bind the proxy itself
- log.debug("Binding proxy for " + getContainer().getEjbName() + " in JNDI at " + this.getJndiName());
- Util.rebind(getContainer().getInitialContext(), this.getJndiName(), proxy);
-
- //
-
- } catch (NamingException e)
- {
- NamingException namingException = new NamingException("Could not bind session proxy with ejb name "
- + getContainer().getEjbName() + " into JNDI under jndiName: "
- + getContainer().getInitialContext().getNameInNamespace() + "/" + this.getJndiName());
- namingException.setRootCause(e);
- throw namingException;
- }
- }
-
- /**
- * Whether or not to bind the home and business interfaces together
- *
- * @return
- */
- protected abstract boolean bindHomeAndBusinessTogether();
-
- protected Object constructProxyBusiness(InvocationHandler handler)
- {
- // Return
- return this.constructProxy(handler, SpecificationInterfaceType.EJB30_BUSINESS);
- }
-
- protected Object constructEjb21Proxy(InvocationHandler handler)
- {
- // Return
- return this.constructProxy(handler, SpecificationInterfaceType.EJB21);
- }
-
- /**
- * Construct a new Proxy of the specified type using the
- * specified handler as argument to the Constructor
- *
- * @param handler
- * @param specType
- * @return
- */
- protected Object constructProxy(final InvocationHandler handler, SpecificationInterfaceType specType)
- {
- // Initialize
- Object obj = null;
-
- try
- {
- // Business Proxy
- if (specType.equals(SpecificationInterfaceType.EJB30_BUSINESS))
- {
- obj = this.businessProxyConstructor.newInstance(handler);
- }
- // EJBObject/EJBLocalObject
- else if (specType.equals(SpecificationInterfaceType.EJB21))
- {
- // If there's no EJB21 View
- if (this.ejb21ProxyConstructor == null)
- {
- throw new IllegalStateException(
- "EJB3 Specification Violation Section 4.3.3: \""
- + "Only session beans with a remote EJBObject / local EJBLocalObject interface can call this method.");
- }
-
- obj = this.ejb21ProxyConstructor.newInstance(handler);
- }
- }
- catch (InstantiationException e)
- {
- throw new RuntimeException(e);
- }
- catch (IllegalAccessException e)
- {
- throw new RuntimeException(e);
- }
- catch (InvocationTargetException e)
- {
- Throwable t = e.getTargetException();
- if (t instanceof RuntimeException)
- throw (RuntimeException) t;
- throw new RuntimeException(t);
- }
-
- // Ensure Proxy object was created
- assert obj != null : "Proxy Object must not be null";
-
- // Return
- return obj;
- }
-
-
- protected void setContainer(SessionSpecContainer container)
- {
- this.container = container;
- this.containerGuid = Ejb3Registry.guid(container);
- this.containerClusterUid = Ejb3Registry.clusterUid(container);
- this.isClustered = container.isClustered();
- }
-
- protected SessionSpecContainer getContainer()
- {
- if (container == null)
- {
- container = (SessionSpecContainer)Ejb3Registry.findContainer(containerGuid);
-
- if (container == null && isClustered)
- container = (SessionSpecContainer)Ejb3Registry.getClusterContainer(containerClusterUid);
- }
-
- return container;
- }
-
- /**
- * Obtains interfaces to be used in the business proxy
- *
- * @return
- */
- protected Class<?>[] getInterfacesForBusinessProxy()
- {
- return this.getInterfacesForProxy(this.getProxyAccessType(), SpecificationInterfaceType.EJB30_BUSINESS);
- }
-
- /**
- * Obtains interfaces to be used in the EJB21 proxy. Returns null if none defined
- *
- * @return
- */
- protected Class<?>[] getInterfacesForEjb21Proxy()
- {
- return this.getInterfacesForProxy(this.getProxyAccessType(), SpecificationInterfaceType.EJB21);
- }
-
- /**
- * Returns an array of interfaces to be used for the proxy;
- * will return null if none are defined.
- *
- * @param accessType
- * @param specType
- * @return
- */
- private Class<?>[] getInterfacesForProxy(ProxyAccessType accessType, SpecificationInterfaceType specType)
- {
-
- // Initialize
- Set<Class<?>> interfaces = new HashSet<Class<?>>();
- SessionContainer container = this.getContainer();
-
- // Initialize array of interfaces
- Set<Class<?>> intfs = new HashSet<Class<?>>();
-
- // If Local
- if (accessType.equals(ProxyAccessType.LOCAL))
- {
-
- // If business
- if (specType.equals(SpecificationInterfaceType.EJB30_BUSINESS))
- {
- intfs.addAll(Arrays.asList(ProxyFactoryHelper.getLocalBusinessInterfaces(container)));
-
- // If binding home with local business
- if(this.bindHomeAndBusinessTogether())
- {
- Class<?> home = this.getHomeType();
- if (home != null)
- {
- intfs.add(home);
- }
- }
- }
- // If EJBLocalObject
- else
- {
- // Add local interfaces
- intfs.addAll(Arrays.asList(ProxyFactoryHelper.getLocalInterfaces(container)));
-
- // If no interfaces
- if (intfs.size() == 0)
- {
- return null;
- }
-
- // Add EJBLocalObject
- intfs.add(EJBLocalObject.class);
- }
- }
- // If remote
- else
- {
- // If business
- if (specType.equals(SpecificationInterfaceType.EJB30_BUSINESS))
- {
- intfs.addAll(Arrays.asList(ProxyFactoryHelper.getRemoteBusinessInterfaces(container)));
-
- // If binding home with remote business
- if(this.bindHomeAndBusinessTogether())
- {
- Class<?> home = this.getHomeType();
- if (home != null)
- {
- intfs.add(home);
- }
- }
-
- }
- // If EJBObject
- else
- {
- // Add remote interfaces
- intfs.addAll(Arrays.asList(ProxyFactoryHelper.getRemoteInterfaces(container)));
-
- // If no interfaces
- if (intfs.size() == 0)
- {
- return null;
- }
-
- // Add EJBObject
- intfs.add(EJBObject.class);
- }
- }
-
- // Add all interfaces
- for (Class<?> interfaze : intfs)
- {
- interfaces.add(interfaze);
- }
-
- // Add JBossProxy
- interfaces.add(JBossProxy.class);
-
- // Return
- return interfaces.toArray(new Class[]
- {});
- }
-
- /**
- * Defines the access type for this Proxies created by this Factory
- *
- * @return
- */
- protected abstract ProxyAccessType getProxyAccessType();
-
- protected void setEjb21Objects(BaseSessionRemoteProxyInvocationHandler proxy)
- {
- proxy.setHandle(this.createHandle());
- proxy.setHomeHandle(getHomeHandle());
- proxy.setEjbMetaData(getEjbMetaData());
- }
-
- abstract protected Handle createHandle();
-
- protected HomeHandle getHomeHandle()
- {
- EJBContainer ejbContainer = (EJBContainer)container;
-
- HomeHandleImpl homeHandle = null;
-
- RemoteBinding remoteBindingAnnotation = ejbContainer.getAnnotation(RemoteBinding.class);
- if (remoteBindingAnnotation != null)
- homeHandle = new HomeHandleImpl(ProxyFactoryHelper.getHomeJndiName(container));
-
- return homeHandle;
- }
-
- /**
- * Returns the interface type for Home
- *
- * @return
- */
- protected abstract Class<?> getHomeType();
-
- protected final String getJndiName()
- {
- return this.jndiName;
- }
-
- public final String getJndiNameProxyFactory()
- {
- return this.getJndiName() + BaseSessionProxyFactory.JNDI_NAME_SUFFIX_PROXY_FACTORY;
- }
-
- protected EJBMetaData getEjbMetaData()
- {
- Class<?> remote = null;
- Class<?> home = null;
- Class<?> pkClass = Object.class;
- HomeHandleImpl homeHandle = null;
-
- EJBContainer ejbContainer = (EJBContainer)container;
-
- Class<?>[] remotes = ProxyFactoryHelper.getRemoteInterfaces(this.getContainer());
- if (remotes != null && remotes.length > 0)
- {
- remote = remotes[0];
- }
- RemoteHome homeAnnotation = ejbContainer.getAnnotation(RemoteHome.class);
- if (homeAnnotation != null)
- home = homeAnnotation.value();
- RemoteBinding remoteBindingAnnotation = ejbContainer.getAnnotation(RemoteBinding.class);
- if (remoteBindingAnnotation != null)
- homeHandle = new HomeHandleImpl(remoteBindingAnnotation.jndiBinding());
-
- EJBMetaDataImpl metadata = new EJBMetaDataImpl(remote, home, pkClass, true, false, homeHandle);
-
- return metadata;
- }
-
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- {
- containerGuid = in.readUTF();
- containerClusterUid = in.readUTF();
- isClustered = in.readBoolean();
-
- if (getContainer() == null)
- throw new EJBException("Invalid (i.e. remote) invocation of local interface (null container) for " + containerGuid);
- }
-
- public void writeExternal(ObjectOutput out) throws IOException
- {
- out.writeUTF(containerGuid);
- out.writeUTF(containerClusterUid);
- out.writeBoolean(isClustered);
- }
-
- /**
- * Ensures that an EJB 2.1 view is complete; the following rules apply:
- *
- * 1) If EJBHome/EJBLocalHome is defined, at least one EJBObject/EJBLocalObject is defined.
- * 2) If one EJBObject/EJBLocalObject is defined, an EJBHome/EJBLocalHome is defined.
- *
- * @param home
- * @param localOrRemoteInterfaces
- * @throws RuntimeException
- */
- protected void validateCompleteEjb21View(Class<?> home, Class<?>[] localOrRemoteInterfaces) throws RuntimeException
- {
- // Ensure specified home is EJBHome or EJBLocalHome
- assert (home == null || (EJBHome.class.isAssignableFrom(home) || EJBLocalHome.class.isAssignableFrom(home)));
-
- // Ensure all interfaces passed are either EJBObject or EJBLocalObject
- for (Class<?> localOrRemoteInterface : localOrRemoteInterfaces)
- {
- assert (EJBObject.class.isAssignableFrom(localOrRemoteInterface) || EJBLocalObject.class
- .isAssignableFrom(localOrRemoteInterface));
- }
-
- // If home is defined and there are no local/remote interfaces
- if (home != null && localOrRemoteInterfaces.length == 0)
- {
- throw new RuntimeException("EJBTHREE-1075: " + container.getBeanClassName() + " defines home"
- + " but provides no local/remote interfaces extending " + EJBLocalObject.class.getName() + "/"
- + EJBObject.class.getName() + "; EJB 2.1 view cannot be realized");
- }
-
- // If local/remote interfaces are defined, but no remote home
- if (home == null && localOrRemoteInterfaces.length != 0)
- {
- throw new RuntimeException("EJBTHREE-1075: " + container.getBeanClassName()
- + " defines local/remote interfaces" + " but provides no home; EJB 2.1 view cannot be realized");
- }
- }
-
- /**
- * Validates that the specified EJB2.1 Home interface returns only
- * valid remote/local interfaces from "create<METHOD>" methods. If no
- * home is defined, the method will return without further checks
- *
- * @param home
- */
- protected void validateHomeReturnsNoBusinessInterfaces(Class<?> home)
- {
- // Only perform if home is defined; otherwise no EJB2.1 view
- if(home==null)
- {
- return;
- }
-
- // Sanity checks
- assert EJBHome.class.isAssignableFrom(home) || EJBLocalHome.class.isAssignableFrom(home) : "Specified home interface, "
- + home.getName() + ", must be of type " + EJBHome.class.getName() + " or " + EJBLocalHome.class.getName();
- assert home.isInterface() : "Specified home interface, " + home.getName() + " is not an interface.";
-
- // Initialize
- Set<Method> creates = new HashSet<Method>();
-
- // Obtain all "create<METHOD>" methods
- Method[] all = home.getDeclaredMethods();
-
- // For each method
- for (Method method : all)
- {
- // If a "create<METHOD>" method
- if (method.getName().startsWith(BaseSessionProxyFactory.METHOD_PREFIX_EJB21_CREATE))
- {
- // Add to the Set of Creates
- creates.add(method);
- }
- }
-
- // For all "create<METHOD>" methods
- for (Method create : creates)
- {
- // Init
- boolean isLocal = true;
-
- // Set as remote if applicable
- if (EJBHome.class.isAssignableFrom(home))
- {
- isLocal = false;
- }
-
- // If local (EJBLocalHome)
- if (isLocal)
- {
- // Validate return type is local interface
- if (!EJBLocalObject.class.isAssignableFrom(create.getReturnType()))
- {
- throw new RuntimeException("EJB 3 Core Specification Section 4.6.10: "
- + "The return type for a create<METHOD> method must be"
- + " the session bean's local interface type. " + home.getName() + " has method "
- + create.getName() + " which returns " + create.getReturnType().getName() + ". [EJBTHREE-1059]");
- }
- }
- // If remote (EJBHome)
- else
- {
- // Validate return type is remote interface
- if (!EJBObject.class.isAssignableFrom(create.getReturnType()))
- {
- throw new RuntimeException("EJB 3 Core Specification Section 4.6.8: "
- + "The return type for a create<METHOD> method "
- + "must be the session bean’s remote interface type. " + home.getName() + " has method "
- + create.getName() + " which returns " + create.getReturnType().getName() + ". [EJBTHREE-1059]");
- }
- }
- }
- }
-
- /**
- * Validates that any EJB2.1 Views associated with this ProxyFactory
- * are valid
- *
- * @param home
- * @param localOrRemoteInterfaces
- * @throws RuntimeException
- */
- protected void validateEjb21Views(Class<?> home,Class<?>[] localOrRemoteInterfaces) throws RuntimeException
- {
- // Ensure EJB2.1 Views are complete (EJBTHREE-1075)
- this.validateCompleteEjb21View(home, localOrRemoteInterfaces);
-
- // Ensure EJB2.1 Home returns only local/remote interfaces
- this.validateHomeReturnsNoBusinessInterfaces(home);
- }
-
- /**
- * Validates that any EJB2.1 Views associated with this ProxyFactory
- * are valid
- */
- protected abstract void validateEjb21Views();
-}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/BaseSessionProxyFactory.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/BaseSessionProxyFactory.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/BaseSessionProxyFactory.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/BaseSessionProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,648 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.factory;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.ejb.EJBException;
+import javax.ejb.EJBHome;
+import javax.ejb.EJBLocalHome;
+import javax.ejb.EJBLocalObject;
+import javax.ejb.EJBMetaData;
+import javax.ejb.EJBObject;
+import javax.ejb.Handle;
+import javax.ejb.HomeHandle;
+import javax.ejb.RemoteHome;
+import javax.naming.NameNotFoundException;
+import javax.naming.NamingException;
+
+import org.jboss.ejb3.EJBContainer;
+import org.jboss.ejb3.Ejb3Registry;
+import org.jboss.ejb3.SpecificationInterfaceType;
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.proxy.JBossProxy;
+import org.jboss.ejb3.proxy.handler.BaseSessionRemoteProxyInvocationHandler;
+import org.jboss.ejb3.proxy.impl.EJBMetaDataImpl;
+import org.jboss.ejb3.proxy.impl.HomeHandleImpl;
+import org.jboss.ejb3.session.ProxyAccessType;
+import org.jboss.ejb3.session.SessionContainer;
+import org.jboss.ejb3.session.SessionSpecContainer;
+import org.jboss.logging.Logger;
+import org.jboss.util.naming.Util;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ * @version $Revision$
+ */
+public abstract class BaseSessionProxyFactory implements SessionProxyFactory, Externalizable
+{
+ @SuppressWarnings("unused")
+ private static final Logger log = Logger.getLogger(BaseSessionProxyFactory.class);
+
+ private static final String JNDI_NAME_SUFFIX_PROXY_FACTORY = "/ProxyFactory";
+
+ private SessionSpecContainer container;
+ protected String containerGuid;
+ protected String containerClusterUid;
+ protected boolean isClustered = false;
+ protected String jndiName;
+
+ /**
+ * Proxy Constructor for the Business Interfaces' Proxy
+ */
+ protected Constructor<?> businessProxyConstructor;
+
+ /**
+ * Proxy Constructor for the EJBObject/EJBLocalObject Proxy
+ */
+ protected Constructor<?> ejb21ProxyConstructor;
+
+ private static final String METHOD_PREFIX_EJB21_CREATE = "create";
+
+ public BaseSessionProxyFactory()
+ {
+ }
+
+ protected BaseSessionProxyFactory(SessionSpecContainer container)
+ {
+ assert container != null : "container is null";
+
+ setContainer(container);
+ }
+
+ public Object createHomeProxy()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ /**
+ * Creates the Proxy constructors
+ */
+ protected void createProxyConstructors() throws Exception
+ {
+ // Obtain this bean class' CL
+ ClassLoader cl = this.getContainer().getBeanClass().getClassLoader();
+
+ // Create business proxy constructor
+ Class<?>[] businessInterfaces = this.getInterfacesForBusinessProxy();
+ this.businessProxyConstructor = ProxyFactoryHelper.createProxyConstructor(businessInterfaces, cl);
+
+ // Create EJB21 proxy constructor
+ Class<?>[] ejb21Interfaces = this.getInterfacesForEjb21Proxy();
+ if (ejb21Interfaces != null)
+ {
+ this.ejb21ProxyConstructor = ProxyFactoryHelper.createProxyConstructor(ejb21Interfaces, cl);
+ }
+
+
+ /* plain jdk
+ Class<?> proxyClass = java.lang.reflect.Proxy.getProxyClass(getContainer().getBeanClass().getClassLoader(), interfaces);
+ final Class<?>[] constructorParams =
+ {InvocationHandler.class};
+ businessProxyConstructor = proxyClass.getConstructor(constructorParams);
+
+ */
+
+ /* javassist */
+ /*
+ proxyFactory = new javassist.util.proxy.ProxyFactory()
+ {
+ @Override
+ protected ClassLoader getClassLoader()
+ {
+ return container.getBeanClass().getClassLoader();
+ }
+ };
+ proxyFactory.setInterfaces(interfaces);
+ proxyFactory.setSuperclass(JavassistProxy.class);
+ proxyClass = proxyFactory.createClass();
+ proxyConstructor = proxyClass.getConstructor((Class[]) null);
+ */
+
+ /* cglib */
+ /*
+ proxyClass = net.sf.cglib.proxy.Proxy.getProxyClass(container.getBeanClass().getClassLoader(), interfaces);
+ final Class[] constructorParams = {net.sf.cglib.proxy.InvocationHandler.class};
+ proxyConstructor = proxyClass.getConstructor(constructorParams);
+ */
+ }
+
+ protected void bindProxy(Object proxy) throws NamingException
+ {
+ try
+ {
+ //TODO Dev
+// // Bind the Proxy Factory if not yet bound
+// try
+// {
+// // Check if bound yet
+// Util.lookup(this.getJndiNameProxyFactory(), this.getClass());
+// }
+// // Proxy factory is not yet bound
+// catch(NameNotFoundException nnfe)
+// {
+// // Bind Proxy Factory
+// log.debug("Binding proxy factory " + this.toString() + " for " + this.getContainer().getEjbName()
+// + " in JNDI at " + this.getJndiNameProxyFactory());
+// Util.rebind(this.getContainer().getInitialContext(), this.getJndiNameProxyFactory(), this);
+// }
+// // Unexpected Exception
+// catch (Exception e)
+// {
+// throw new RuntimeException(e);
+// }
+
+ // Bind the proxy itself
+ log.debug("Binding proxy for " + getContainer().getEjbName() + " in JNDI at " + this.getJndiName());
+ Util.rebind(getContainer().getInitialContext(), this.getJndiName(), proxy);
+
+ //
+
+ } catch (NamingException e)
+ {
+ NamingException namingException = new NamingException("Could not bind session proxy with ejb name "
+ + getContainer().getEjbName() + " into JNDI under jndiName: "
+ + getContainer().getInitialContext().getNameInNamespace() + "/" + this.getJndiName());
+ namingException.setRootCause(e);
+ throw namingException;
+ }
+ }
+
+ /**
+ * Whether or not to bind the home and business interfaces together
+ *
+ * @return
+ */
+ protected abstract boolean bindHomeAndBusinessTogether();
+
+ protected Object constructProxyBusiness(InvocationHandler handler)
+ {
+ // Return
+ return this.constructProxy(handler, SpecificationInterfaceType.EJB30_BUSINESS);
+ }
+
+ protected Object constructEjb21Proxy(InvocationHandler handler)
+ {
+ // Return
+ return this.constructProxy(handler, SpecificationInterfaceType.EJB21);
+ }
+
+ /**
+ * Construct a new Proxy of the specified type using the
+ * specified handler as argument to the Constructor
+ *
+ * @param handler
+ * @param specType
+ * @return
+ */
+ protected Object constructProxy(final InvocationHandler handler, SpecificationInterfaceType specType)
+ {
+ // Initialize
+ Object obj = null;
+
+ try
+ {
+ // Business Proxy
+ if (specType.equals(SpecificationInterfaceType.EJB30_BUSINESS))
+ {
+ obj = this.businessProxyConstructor.newInstance(handler);
+ }
+ // EJBObject/EJBLocalObject
+ else if (specType.equals(SpecificationInterfaceType.EJB21))
+ {
+ // If there's no EJB21 View
+ if (this.ejb21ProxyConstructor == null)
+ {
+ throw new IllegalStateException(
+ "EJB3 Specification Violation Section 4.3.3: \""
+ + "Only session beans with a remote EJBObject / local EJBLocalObject interface can call this method.");
+ }
+
+ obj = this.ejb21ProxyConstructor.newInstance(handler);
+ }
+ }
+ catch (InstantiationException e)
+ {
+ throw new RuntimeException(e);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new RuntimeException(e);
+ }
+ catch (InvocationTargetException e)
+ {
+ Throwable t = e.getTargetException();
+ if (t instanceof RuntimeException)
+ throw (RuntimeException) t;
+ throw new RuntimeException(t);
+ }
+
+ // Ensure Proxy object was created
+ assert obj != null : "Proxy Object must not be null";
+
+ // Return
+ return obj;
+ }
+
+
+ protected void setContainer(SessionSpecContainer container)
+ {
+ this.container = container;
+ this.containerGuid = Ejb3Registry.guid(container);
+ this.containerClusterUid = Ejb3Registry.clusterUid(container);
+ this.isClustered = container.isClustered();
+ }
+
+ protected SessionSpecContainer getContainer()
+ {
+ if (container == null)
+ {
+ container = (SessionSpecContainer)Ejb3Registry.findContainer(containerGuid);
+
+ if (container == null && isClustered)
+ container = (SessionSpecContainer)Ejb3Registry.getClusterContainer(containerClusterUid);
+ }
+
+ return container;
+ }
+
+ /**
+ * Obtains interfaces to be used in the business proxy
+ *
+ * @return
+ */
+ protected Class<?>[] getInterfacesForBusinessProxy()
+ {
+ return this.getInterfacesForProxy(this.getProxyAccessType(), SpecificationInterfaceType.EJB30_BUSINESS);
+ }
+
+ /**
+ * Obtains interfaces to be used in the EJB21 proxy. Returns null if none defined
+ *
+ * @return
+ */
+ protected Class<?>[] getInterfacesForEjb21Proxy()
+ {
+ return this.getInterfacesForProxy(this.getProxyAccessType(), SpecificationInterfaceType.EJB21);
+ }
+
+ /**
+ * Returns an array of interfaces to be used for the proxy;
+ * will return null if none are defined.
+ *
+ * @param accessType
+ * @param specType
+ * @return
+ */
+ private Class<?>[] getInterfacesForProxy(ProxyAccessType accessType, SpecificationInterfaceType specType)
+ {
+
+ // Initialize
+ Set<Class<?>> interfaces = new HashSet<Class<?>>();
+ SessionContainer container = this.getContainer();
+
+ // Initialize array of interfaces
+ Set<Class<?>> intfs = new HashSet<Class<?>>();
+
+ // If Local
+ if (accessType.equals(ProxyAccessType.LOCAL))
+ {
+
+ // If business
+ if (specType.equals(SpecificationInterfaceType.EJB30_BUSINESS))
+ {
+ intfs.addAll(Arrays.asList(ProxyFactoryHelper.getLocalBusinessInterfaces(container)));
+
+ // If binding home with local business
+ if(this.bindHomeAndBusinessTogether())
+ {
+ Class<?> home = this.getHomeType();
+ if (home != null)
+ {
+ intfs.add(home);
+ }
+ }
+ }
+ // If EJBLocalObject
+ else
+ {
+ // Add local interfaces
+ intfs.addAll(Arrays.asList(ProxyFactoryHelper.getLocalInterfaces(container)));
+
+ // If no interfaces
+ if (intfs.size() == 0)
+ {
+ return null;
+ }
+
+ // Add EJBLocalObject
+ intfs.add(EJBLocalObject.class);
+ }
+ }
+ // If remote
+ else
+ {
+ // If business
+ if (specType.equals(SpecificationInterfaceType.EJB30_BUSINESS))
+ {
+ intfs.addAll(Arrays.asList(ProxyFactoryHelper.getRemoteBusinessInterfaces(container)));
+
+ // If binding home with remote business
+ if(this.bindHomeAndBusinessTogether())
+ {
+ Class<?> home = this.getHomeType();
+ if (home != null)
+ {
+ intfs.add(home);
+ }
+ }
+
+ }
+ // If EJBObject
+ else
+ {
+ // Add remote interfaces
+ intfs.addAll(Arrays.asList(ProxyFactoryHelper.getRemoteInterfaces(container)));
+
+ // If no interfaces
+ if (intfs.size() == 0)
+ {
+ return null;
+ }
+
+ // Add EJBObject
+ intfs.add(EJBObject.class);
+ }
+ }
+
+ // Add all interfaces
+ for (Class<?> interfaze : intfs)
+ {
+ interfaces.add(interfaze);
+ }
+
+ // Add JBossProxy
+ interfaces.add(JBossProxy.class);
+
+ // Return
+ return interfaces.toArray(new Class[]
+ {});
+ }
+
+ /**
+ * Defines the access type for this Proxies created by this Factory
+ *
+ * @return
+ */
+ protected abstract ProxyAccessType getProxyAccessType();
+
+ protected void setEjb21Objects(BaseSessionRemoteProxyInvocationHandler proxy)
+ {
+ proxy.setHandle(this.createHandle());
+ proxy.setHomeHandle(getHomeHandle());
+ proxy.setEjbMetaData(getEjbMetaData());
+ }
+
+ abstract protected Handle createHandle();
+
+ protected HomeHandle getHomeHandle()
+ {
+ EJBContainer ejbContainer = (EJBContainer)container;
+
+ HomeHandleImpl homeHandle = null;
+
+ RemoteBinding remoteBindingAnnotation = ejbContainer.getAnnotation(RemoteBinding.class);
+ if (remoteBindingAnnotation != null)
+ homeHandle = new HomeHandleImpl(ProxyFactoryHelper.getHomeJndiName(container));
+
+ return homeHandle;
+ }
+
+ /**
+ * Returns the interface type for Home
+ *
+ * @return
+ */
+ protected abstract Class<?> getHomeType();
+
+ protected final String getJndiName()
+ {
+ return this.jndiName;
+ }
+
+ public final String getJndiNameProxyFactory()
+ {
+ return this.getJndiName() + BaseSessionProxyFactory.JNDI_NAME_SUFFIX_PROXY_FACTORY;
+ }
+
+ protected EJBMetaData getEjbMetaData()
+ {
+ Class<?> remote = null;
+ Class<?> home = null;
+ Class<?> pkClass = Object.class;
+ HomeHandleImpl homeHandle = null;
+
+ EJBContainer ejbContainer = (EJBContainer)container;
+
+ Class<?>[] remotes = ProxyFactoryHelper.getRemoteInterfaces(this.getContainer());
+ if (remotes != null && remotes.length > 0)
+ {
+ remote = remotes[0];
+ }
+ RemoteHome homeAnnotation = ejbContainer.getAnnotation(RemoteHome.class);
+ if (homeAnnotation != null)
+ home = homeAnnotation.value();
+ RemoteBinding remoteBindingAnnotation = ejbContainer.getAnnotation(RemoteBinding.class);
+ if (remoteBindingAnnotation != null)
+ homeHandle = new HomeHandleImpl(remoteBindingAnnotation.jndiBinding());
+
+ EJBMetaDataImpl metadata = new EJBMetaDataImpl(remote, home, pkClass, true, false, homeHandle);
+
+ return metadata;
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
+ {
+ containerGuid = in.readUTF();
+ containerClusterUid = in.readUTF();
+ isClustered = in.readBoolean();
+
+ if (getContainer() == null)
+ throw new EJBException("Invalid (i.e. remote) invocation of local interface (null container) for " + containerGuid);
+ }
+
+ public void writeExternal(ObjectOutput out) throws IOException
+ {
+ out.writeUTF(containerGuid);
+ out.writeUTF(containerClusterUid);
+ out.writeBoolean(isClustered);
+ }
+
+ /**
+ * Ensures that an EJB 2.1 view is complete; the following rules apply:
+ *
+ * 1) If EJBHome/EJBLocalHome is defined, at least one EJBObject/EJBLocalObject is defined.
+ * 2) If one EJBObject/EJBLocalObject is defined, an EJBHome/EJBLocalHome is defined.
+ *
+ * @param home
+ * @param localOrRemoteInterfaces
+ * @throws RuntimeException
+ */
+ protected void validateCompleteEjb21View(Class<?> home, Class<?>[] localOrRemoteInterfaces) throws RuntimeException
+ {
+ // Ensure specified home is EJBHome or EJBLocalHome
+ assert (home == null || (EJBHome.class.isAssignableFrom(home) || EJBLocalHome.class.isAssignableFrom(home)));
+
+ // Ensure all interfaces passed are either EJBObject or EJBLocalObject
+ for (Class<?> localOrRemoteInterface : localOrRemoteInterfaces)
+ {
+ assert (EJBObject.class.isAssignableFrom(localOrRemoteInterface) || EJBLocalObject.class
+ .isAssignableFrom(localOrRemoteInterface));
+ }
+
+ // If home is defined and there are no local/remote interfaces
+ if (home != null && localOrRemoteInterfaces.length == 0)
+ {
+ throw new RuntimeException("EJBTHREE-1075: " + container.getBeanClassName() + " defines home"
+ + " but provides no local/remote interfaces extending " + EJBLocalObject.class.getName() + "/"
+ + EJBObject.class.getName() + "; EJB 2.1 view cannot be realized");
+ }
+
+ // If local/remote interfaces are defined, but no remote home
+ if (home == null && localOrRemoteInterfaces.length != 0)
+ {
+ throw new RuntimeException("EJBTHREE-1075: " + container.getBeanClassName()
+ + " defines local/remote interfaces" + " but provides no home; EJB 2.1 view cannot be realized");
+ }
+ }
+
+ /**
+ * Validates that the specified EJB2.1 Home interface returns only
+ * valid remote/local interfaces from "create<METHOD>" methods. If no
+ * home is defined, the method will return without further checks
+ *
+ * @param home
+ */
+ protected void validateHomeReturnsNoBusinessInterfaces(Class<?> home)
+ {
+ // Only perform if home is defined; otherwise no EJB2.1 view
+ if(home==null)
+ {
+ return;
+ }
+
+ // Sanity checks
+ assert EJBHome.class.isAssignableFrom(home) || EJBLocalHome.class.isAssignableFrom(home) : "Specified home interface, "
+ + home.getName() + ", must be of type " + EJBHome.class.getName() + " or " + EJBLocalHome.class.getName();
+ assert home.isInterface() : "Specified home interface, " + home.getName() + " is not an interface.";
+
+ // Initialize
+ Set<Method> creates = new HashSet<Method>();
+
+ // Obtain all "create<METHOD>" methods
+ Method[] all = home.getDeclaredMethods();
+
+ // For each method
+ for (Method method : all)
+ {
+ // If a "create<METHOD>" method
+ if (method.getName().startsWith(BaseSessionProxyFactory.METHOD_PREFIX_EJB21_CREATE))
+ {
+ // Add to the Set of Creates
+ creates.add(method);
+ }
+ }
+
+ // For all "create<METHOD>" methods
+ for (Method create : creates)
+ {
+ // Init
+ boolean isLocal = true;
+
+ // Set as remote if applicable
+ if (EJBHome.class.isAssignableFrom(home))
+ {
+ isLocal = false;
+ }
+
+ // If local (EJBLocalHome)
+ if (isLocal)
+ {
+ // Validate return type is local interface
+ if (!EJBLocalObject.class.isAssignableFrom(create.getReturnType()))
+ {
+ throw new RuntimeException("EJB 3 Core Specification Section 4.6.10: "
+ + "The return type for a create<METHOD> method must be"
+ + " the session bean's local interface type. " + home.getName() + " has method "
+ + create.getName() + " which returns " + create.getReturnType().getName() + ". [EJBTHREE-1059]");
+ }
+ }
+ // If remote (EJBHome)
+ else
+ {
+ // Validate return type is remote interface
+ if (!EJBObject.class.isAssignableFrom(create.getReturnType()))
+ {
+ throw new RuntimeException("EJB 3 Core Specification Section 4.6.8: "
+ + "The return type for a create<METHOD> method "
+ + "must be the session bean’s remote interface type. " + home.getName() + " has method "
+ + create.getName() + " which returns " + create.getReturnType().getName() + ". [EJBTHREE-1059]");
+ }
+ }
+ }
+ }
+
+ /**
+ * Validates that any EJB2.1 Views associated with this ProxyFactory
+ * are valid
+ *
+ * @param home
+ * @param localOrRemoteInterfaces
+ * @throws RuntimeException
+ */
+ protected void validateEjb21Views(Class<?> home,Class<?>[] localOrRemoteInterfaces) throws RuntimeException
+ {
+ // Ensure EJB2.1 Views are complete (EJBTHREE-1075)
+ this.validateCompleteEjb21View(home, localOrRemoteInterfaces);
+
+ // Ensure EJB2.1 Home returns only local/remote interfaces
+ this.validateHomeReturnsNoBusinessInterfaces(home);
+ }
+
+ /**
+ * Validates that any EJB2.1 Views associated with this ProxyFactory
+ * are valid
+ */
+ protected abstract void validateEjb21Views();
+}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/ProxyFactoryHelper.java
===================================================================
--- projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/ProxyFactoryHelper.java 2008-04-23 20:41:05 UTC (rev 72636)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/ProxyFactoryHelper.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,1057 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.factory;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import javax.ejb.EJBHome;
-import javax.ejb.EJBLocalHome;
-import javax.ejb.EJBLocalObject;
-import javax.ejb.EJBObject;
-import javax.ejb.Local;
-import javax.ejb.LocalHome;
-import javax.ejb.Remote;
-import javax.ejb.RemoteHome;
-import javax.jws.WebService;
-import javax.management.ObjectInstance;
-import javax.management.ObjectName;
-
-import org.jboss.ejb3.Container;
-import org.jboss.ejb3.DeploymentScope;
-import org.jboss.ejb3.EJBContainer;
-import org.jboss.ejb3.KernelAbstraction;
-import org.jboss.ejb3.KernelAbstractionFactory;
-import org.jboss.ejb3.annotation.JndiBindingPolicy;
-import org.jboss.ejb3.annotation.LocalBinding;
-import org.jboss.ejb3.annotation.LocalHomeBinding;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.annotation.RemoteBindings;
-import org.jboss.ejb3.annotation.RemoteHomeBinding;
-import org.jboss.ejb3.annotation.impl.LocalImpl;
-import org.jboss.ejb3.annotation.impl.RemoteImpl;
-import org.jboss.ejb3.jndipolicy.DefaultJndiBindingPolicy;
-import org.jboss.ejb3.jndipolicy.Ejb3DeploymentSummary;
-import org.jboss.ejb3.jndipolicy.impl.PackagingBasedJndiBindingPolicy;
-import org.jboss.ejb3.lang.ClassHelper;
-import org.jboss.ejb3.service.ServiceContainer;
-import org.jboss.ejb3.session.SessionContainer;
-import org.jboss.ejb3.stateful.StatefulContainer;
-import org.jboss.ejb3.stateless.StatelessContainer;
-import org.jboss.logging.Logger;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public class ProxyFactoryHelper
-{
- private static final Logger log = Logger.getLogger(ProxyFactoryHelper.class);
-
- private static String getEndpointInterface(Container container)
- {
- WebService ws = (javax.jws.WebService) ((EJBContainer) container).resolveAnnotation(javax.jws.WebService.class);
- if (ws != null)
- {
- return ws.endpointInterface();
- }
- return null;
- }
-
- /**
- *
- * @param container
- * @return the local interfaces of the container or an empty array
- */
- public static Class<?>[] getLocalAndBusinessLocalInterfaces(Container container)
- {
- // Initialize
- Set<Class<?>> localAndBusinessLocalInterfaces = new HashSet<Class<?>>();
-
- // Obtain Bean Class
- Class<?> beanClass = container.getBeanClass();
-
- // Obtain @Local
- Local localAnnotation = ((EJBContainer) container).getAnnotation(Local.class);
-
- // Obtain @LocalHome
- LocalHome localHomeAnnotation = ((EJBContainer) container).getAnnotation(LocalHome.class);
-
- // Obtain @Remote
- Remote remoteAnnotation = ((EJBContainer) container).getAnnotation(Remote.class);
-
- // Obtain Remote and Business Remote interfaces
- Class<?>[] remoteAndBusinessRemoteInterfaces = ProxyFactoryHelper.getRemoteAndBusinessRemoteInterfaces(container);
-
- // Obtain all business interfaces from the bean class
- Set<Class<?>> businessInterfacesImplementedByBeanClass = ProxyFactoryHelper.getBusinessInterfaces(beanClass);
-
- // Obtain all business interfaces directly implemented by the bean class (not including supers)
- Set<Class<?>> businessInterfacesDirectlyImplementedByBeanClass = ProxyFactoryHelper.getBusinessInterfaces(
- beanClass, false);
-
- // Determine whether Stateful or Stateless
- boolean isStateless = (container instanceof StatelessContainer) ? true : false;
-
- // EJBTHREE-1127
- // Determine local interface from return value of "create" in Local Home
- if (localHomeAnnotation != null)
- {
- localAndBusinessLocalInterfaces.addAll(ProxyFactoryHelper.getReturnTypesFromCreateMethods(localHomeAnnotation
- .value(), isStateless));
- }
-
- // For each of the business interfaces implemented by the bean class
- for (Class<?> clazz : businessInterfacesImplementedByBeanClass)
- {
- // If @Local is on the interface
- if (clazz.isAnnotationPresent(Local.class))
- {
- // Add to the list of locals
- localAndBusinessLocalInterfaces.add(clazz);
- }
- }
-
- // EJBTHREE-1062
- // EJB 3 Core Specification 4.6.6
- // If bean class implements a single interface, that interface is assumed to be the
- // business interface of the bean. This business interface will be a local interface unless the
- // interface is designated as a remote business interface by use of the Remote
- // annotation on the bean class or interface or by means of the deployment descriptor.
- if (businessInterfacesDirectlyImplementedByBeanClass.size() == 1 && localAndBusinessLocalInterfaces.size() == 0)
- {
- // Obtain the implemented interface
- Class<?> singleInterface = businessInterfacesDirectlyImplementedByBeanClass.iterator().next();
-
- // If not explicitly marked as @Remote, and is a valid business interface
- if (remoteAnnotation == null && singleInterface.getAnnotation(Remote.class) == null)
- {
- // Return the implemented interface, adding to the container
- Class<?>[] returnValue = new Class[]
- {singleInterface};
- Local li = new LocalImpl(returnValue);
- ((EJBContainer) container).getAnnotations().addClassAnnotation(Local.class, li);
- return returnValue;
- }
- }
-
- // @Local was defined
- if (localAnnotation != null)
- {
- // If @Local has no value or empty value
- if (localAnnotation.value() == null || localAnnotation.value().length == 0)
- {
- // If @Local is defined with no value and there are no business interfaces
- if (businessInterfacesImplementedByBeanClass.size() == 0)
- {
- throw new RuntimeException("Use of empty @Local on bean " + container.getEjbName()
- + " and there are no valid business interfaces");
- }
- // If more than one business interface is directly implemented by the bean class
- else if (businessInterfacesImplementedByBeanClass.size() > 1)
- {
- throw new RuntimeException("Use of empty @Local on bean " + container.getEjbName()
- + " with more than one default interface " + businessInterfacesImplementedByBeanClass);
- }
- // JIRA EJBTHREE-1062
- // EJB 3 4.6.6
- // If the bean class implements only one business interface, that
- //interface is exposed as local business if not denoted as @Remote
- else
- {
- // If not explicitly marked as @Remote
- if (remoteAnnotation == null)
- {
- // Return the implemented interface and add to container
- Class<?>[] returnValue = businessInterfacesImplementedByBeanClass.toArray(new Class<?>[]
- {});
- Local li = new LocalImpl(returnValue);
- ((EJBContainer) container).getAnnotations().addClassAnnotation(Local.class, li);
- return returnValue;
- }
- }
- }
- // @Local has value
- else
- {
- // For each of the interfaces in @Local.value
- for (Class<?> clazz : localAnnotation.value())
- {
- // Add to the list of locals
- localAndBusinessLocalInterfaces.add(clazz);
- }
-
- // For each of the business interfaces implemented by the bean class
- for (Class<?> clazz : businessInterfacesImplementedByBeanClass)
- {
- // If @Local is on the interface
- if (clazz.isAnnotationPresent(Local.class))
- {
- // Add to the list of locals
- localAndBusinessLocalInterfaces.add(clazz);
- }
- }
- }
- }
-
- // If local interfaces have been defined/discovered
- if (localAndBusinessLocalInterfaces.size() > 0)
- {
- // Check to ensure @Local and @Remote are not defined on the same interface
- // EJBTHREE-751
- for (Class<?> remoteInterface : remoteAndBusinessRemoteInterfaces)
- {
- for (Class<?> localInterface : localAndBusinessLocalInterfaces)
- {
- if (localInterface.equals(remoteInterface))
- {
- throw new RuntimeException("@Remote and @Local may not both be specified on the same interface \""
- + remoteInterface.toString() + "\" per EJB3 Spec 4.6.7, Bullet 5.4");
- }
- }
- }
-
- // Return local interfaces, first adding to the container
- Class<?>[] rtn = localAndBusinessLocalInterfaces.toArray(new Class<?>[]
- {});
- localAnnotation = new LocalImpl(rtn);
- ((EJBContainer) container).getAnnotations().addClassAnnotation(Local.class, localAnnotation);
- return rtn;
- }
- // If no local interfaces have been defined/discovered
- else
- {
- // Obtain WS Endpoint
- String endpoint = ProxyFactoryHelper.getEndpointInterface(container);
-
- // If neither WS Endpoint or remotes are defined
- if (remoteAndBusinessRemoteInterfaces.length == 0 && endpoint == null)
- throw new RuntimeException(
- "Bean Class "
- + beanClass.getName()
- + " has no local, webservice, or remote interfaces defined and does not implement at least one business interface: "
- + container.getEjbName());
-
- }
-
- // No local or business local interfaces discovered
- return new Class<?>[]
- {};
- }
-
- /**
- * Resolve the potential business interfaces on an enterprise bean.
- * Returns all interfaces implemented by this class and its supers which
- * are potentially a business interface.
- *
- * Note: for normal operation call container.getBusinessInterfaces().
- *
- * @param beanClass the EJB implementation class
- * @return a list of potential business interfaces
- * @see org.jboss.ejb3.EJBContainer#getBusinessInterfaces()
- */
- public static Set<Class<?>> getBusinessInterfaces(Class<?> beanClass)
- {
- // Obtain all business interfaces implemented by this bean class and its superclasses
- return ProxyFactoryHelper.getBusinessInterfaces(beanClass, new HashSet<Class<?>>());
- }
-
- /**
- * Resolve the potential business interfaces on an enterprise bean.
- * Returns all interfaces implemented by this class and, optionally, its supers which
- * are potentially a business interface.
- *
- * Note: for normal operation call container.getBusinessInterfaces().
- *
- * @param beanClass the EJB implementation class
- * @param includeSupers Whether or not to include superclasses of the specified beanClass in this check
- * @return a list of potential business interfaces
- * @see org.jboss.ejb3.EJBContainer#getBusinessInterfaces()
- */
- public static Set<Class<?>> getBusinessInterfaces(Class<?> beanClass, boolean includeSupers)
- {
- // Obtain all business interfaces implemented by this bean class and optionally, its superclass
- return ProxyFactoryHelper.getBusinessInterfaces(beanClass, new HashSet<Class<?>>(), includeSupers);
- }
-
- private static Set<Class<?>> getBusinessInterfaces(Class<?> beanClass, Set<Class<?>> interfaces)
- {
- return ProxyFactoryHelper.getBusinessInterfaces(beanClass, interfaces, true);
- }
-
- private static Set<Class<?>> getBusinessInterfaces(Class<?> beanClass, Set<Class<?>> interfaces,
- boolean includeSupers)
- {
- /*
- * 4.6.6:
- * The following interfaces are excluded when determining whether the bean class has
- * more than one interface: java.io.Serializable; java.io.Externalizable;
- * any of the interfaces defined by the javax.ejb package.
- */
- for (Class<?> intf : beanClass.getInterfaces())
- {
- if (intf.equals(java.io.Externalizable.class))
- continue;
- if (intf.equals(java.io.Serializable.class))
- continue;
- if (intf.getName().startsWith("javax.ejb"))
- continue;
-
- // FIXME Other aop frameworks might add other interfaces, this should really be configurable
- if (intf.getName().startsWith("org.jboss.aop"))
- continue;
-
- interfaces.add(intf);
- }
-
- // If there's no superclass, or we shouldn't check the superclass, return
- if (!includeSupers || beanClass.getSuperclass() == null)
- {
- return interfaces;
- }
- else
- {
- // Include any superclasses' interfaces
- return getBusinessInterfaces(beanClass.getSuperclass(), interfaces);
- }
- }
-
- public static Class<?> getLocalHomeInterface(Container container)
- {
- LocalHome li = ((EJBContainer) container).getAnnotation(javax.ejb.LocalHome.class);
- if (li != null)
- return li.value();
- return null;
- }
-
- public static Class<?> getRemoteHomeInterface(Container container)
- {
- RemoteHome li = ((EJBContainer) container).getAnnotation(javax.ejb.RemoteHome.class);
- if (li != null)
- return li.value();
- return null;
- }
-
- public static boolean publishesInterface(Container container, Class<?> businessInterface)
- {
- if (!(container instanceof SessionContainer))
- return false;
- Class<?>[] remotes = getRemoteAndBusinessRemoteInterfaces(container);
- for (Class<?> intf : remotes)
- {
- if (intf.getName().equals(businessInterface.getName()))
- return true;
- }
-
- Class<?> remoteHome = getRemoteHomeInterface(container);
- if (remoteHome != null)
- {
- if (businessInterface.getName().equals(remoteHome.getName()))
- {
- return true;
- }
- }
- Class<?>[] locals = getLocalAndBusinessLocalInterfaces(container);
- for (Class<?> clazz : locals)
- {
- if (clazz.getName().equals(businessInterface.getName()))
- {
- return true;
- }
- }
- Class<?> localHome = getLocalHomeInterface(container);
- if (localHome != null)
- {
- if (businessInterface.getName().equals(localHome.getName()))
- {
- return true;
- }
- }
-
- return false;
- }
-
- /**
- * Obtains the JNDI name for the specified container; may either be explicitly-defined by
- * annotation / XML or will otherwise default to the configured JNDI Binding Policy
- *
- * @param container
- * @param businessInterface
- * @return
- */
- public static String getJndiName(EJBContainer container, Class<?> businessInterface)
- {
- assert container != null : "container is null";
- assert businessInterface != null : "businessInterface is null";
-
- // Initialize to defaults of remote and not home
- String jndiName = null;
- boolean isHome = false;
- boolean isLocal = false;
-
- // Determine if remote
- Class<?>[] remotes = ProxyFactoryHelper.getRemoteAndBusinessRemoteInterfaces(container);
- for (Class<?> clazz : remotes)
- {
- if (clazz.getName().equals(businessInterface.getName()))
- {
- // Check for declared @RemoteBindings
- RemoteBindings bindings = ((EJBContainer) container).getAnnotation(RemoteBindings.class);
- if (bindings != null)
- {
- // Encountered, return
- return bindings.value()[0].jndiBinding();
- }
- // Check for declared @RemoteBinding
- RemoteBinding binding = ((EJBContainer) container).getAnnotation(RemoteBinding.class);
- if (binding != null)
- {
- // Encountered, return
- return binding.jndiBinding();
- }
- }
- }
-
- // Determine if remote home
- Class<?> remoteHome = getRemoteHomeInterface(container);
- if (remoteHome != null)
- {
- if (businessInterface.getName().equals(remoteHome.getName()))
- {
- // Check for declared @RemoteHomeBinding
- RemoteHomeBinding binding = ((EJBContainer) container).getAnnotation(RemoteHomeBinding.class);
- if (binding != null)
- {
- // Encountered, return
- return binding.jndiBinding();
- }
-
- // Set home for policy
- isHome = true;
- }
- }
-
- // Determine if local and home
- Class<?> localHome = getLocalHomeInterface(container);
- if (localHome != null)
- {
- if (businessInterface.getName().equals(localHome.getName()))
- {
- // Check for declared @LocalHomeBinding
- LocalHomeBinding binding = ((EJBContainer) container).getAnnotation(LocalHomeBinding.class);
- if (binding != null)
- {
- // Encountered, return
- return binding.jndiBinding();
- }
-
- // Set local and home for policy
- isHome = true;
- isLocal = true;
- }
- }
-
- // Determine if local
- Class<?>[] locals = getLocalAndBusinessLocalInterfaces(container);
- for (Class<?> clazz : locals)
- {
- if (clazz.getName().equals(businessInterface.getName()))
- {
- // Check for declared @LocalBinding
- LocalBinding binding = ((EJBContainer) container).getAnnotation(LocalBinding.class);
- if (binding != null)
- {
- // Encountered, return
- return binding.jndiBinding();
- }
-
- // Set local for policy
- isLocal = true;
- }
- }
-
- // If JNDI Name has not been explicitly specified, use policy
- if (jndiName == null)
- {
- // Log
- log.debug("JNDI name has not been explicitly set for EJB " + container.getEjbName() + ", interface "
- + businessInterface.getName());
-
- // Set JNDI name
- Ejb3DeploymentSummary summary = ProxyFactoryHelper.getDeploymentSummaryFromContainer(container);
- summary.setHome(isHome);
- summary.setLocal(isLocal);
- jndiName = ProxyFactoryHelper.getJndiBindingPolicy(container).getJndiName(summary);
- }
-
- // Return
- return jndiName;
- }
-
- /**
- * Returns all local interfaces in the specified container; interfaces
- * marked as "local" via either annotation or XML and extending EJBLocalObject
- *
- * @param container
- * @return
- */
- public static Class<?>[] getLocalInterfaces(Container container)
- {
- return ProxyFactoryHelper.getInterfacesAssignableFromClass(ProxyFactoryHelper
- .getLocalAndBusinessLocalInterfaces(container), EJBLocalObject.class, true);
- }
-
- /**
- * Returns all remote interfaces in the specified container; interfaces
- * marked as "remote" via either annotation or XML and extending EJBObject
- *
- * @param container
- * @return
- */
- public static Class<?>[] getRemoteInterfaces(Container container)
- {
- return ProxyFactoryHelper.getInterfacesAssignableFromClass(ProxyFactoryHelper
- .getRemoteAndBusinessRemoteInterfaces(container), EJBObject.class, true);
- }
-
- /**
- * Returns all local business interfaces in the specified container; interfaces
- * marked as "local" via either annotation or XML and not extending EJBLocalObject
- *
- * @param container
- * @return
- */
- public static Class<?>[] getLocalBusinessInterfaces(Container container)
- {
- return ProxyFactoryHelper.getInterfacesAssignableFromClass(ProxyFactoryHelper
- .getLocalAndBusinessLocalInterfaces(container), EJBLocalObject.class, false);
- }
-
- /**
- * Returns all remote business interfaces in the specified container; interfaces
- * marked as "remote" via either annotation or XML and not extending EJBObject
- *
- * @param container
- * @return
- */
- public static Class<?>[] getRemoteBusinessInterfaces(Container container)
- {
- return ProxyFactoryHelper.getInterfacesAssignableFromClass(ProxyFactoryHelper
- .getRemoteAndBusinessRemoteInterfaces(container), EJBObject.class, false);
- }
-
- /**
- * Returns an subset of the specified array of interfaces either
- * assignable to or not assignable to the specified class, depending
- * upon the flag "assignable"
- *
- * @param interfaces
- * @param clazz
- * @param assignable
- * @return
- */
- private static Class<?>[] getInterfacesAssignableFromClass(Class<?>[] interfaces, Class<?> clazz, boolean assignable)
- {
- // Initialize
- List<Class<?>> subset = new ArrayList<Class<?>>();
-
- // For all interfaces
- for (Class<?> interfaze : interfaces)
- {
- // If we want assignable classes only
- if (assignable && clazz.isAssignableFrom(interfaze))
- {
- subset.add(interfaze);
- }
-
- // If we want classes not assignable only
- if (!assignable && !clazz.isAssignableFrom(interfaze))
- {
- subset.add(interfaze);
- }
- }
-
- // Return
- return subset.toArray(new Class<?>[]
- {});
- }
-
- /**
- * Returns all remote and remote business interfaces in the specified container,
- * designated by @Remote or in ejb-jar.xml as "remote" or "business-remote"
- *
- * @param container
- * @return the remote interfaces of the container or an empty array
- */
- public static Class<?>[] getRemoteAndBusinessRemoteInterfaces(Container container)
- {
- // Initialize
- Remote remoteAnnotation = ((EJBContainer) container).getAnnotation(Remote.class);
- RemoteHome remoteHomeAnnotation = ((EJBContainer) container).getAnnotation(RemoteHome.class);
- Set<Class<?>> remoteAndRemoteBusinessInterfaces = new HashSet<Class<?>>();
- Class<?> beanClass = container.getBeanClass();
- boolean isStateless = (container instanceof StatelessContainer) ? true : false;
-
- // Obtain business interfaces
- Class<?>[] businessInterfaces = ProxyFactoryHelper.getBusinessInterfaces(beanClass).toArray(new Class[]
- {});
-
- // EJBTHREE-1127
- // Determine remote interface from return value of "create" in Remote Home
- if (remoteHomeAnnotation != null)
- {
- remoteAndRemoteBusinessInterfaces.addAll(ProxyFactoryHelper.getReturnTypesFromCreateMethods(
- remoteHomeAnnotation.value(), isStateless));
- }
-
- // If @Remote is not defined
- if (remoteAnnotation == null)
- {
- // For each of the business interfaces
- for (Class<?> clazz : businessInterfaces)
- {
- // If @Remote is on the business interface
- if (clazz.isAnnotationPresent(Remote.class))
- {
- // Add to the list of remotes
- remoteAndRemoteBusinessInterfaces.add(clazz);
- }
- }
- }
- // @Remote was defined
- else
- {
- // @Remote declares interfaces, add these
- if (remoteAnnotation.value().length > 0)
- {
- for (Class<?> clazz : remoteAnnotation.value())
- {
- remoteAndRemoteBusinessInterfaces.add(clazz);
- }
- }
- // @Remote is empty
- else
- {
- // No business interfaces were defined on the bean
- if (businessInterfaces.length == 0)
- {
- throw new RuntimeException("Use of empty @Remote on bean " + container.getEjbName()
- + " and there are no valid business interfaces");
- }
-
- // More than one default interface, cannot be marked as @Remote
- else if (businessInterfaces.length > 1)
- {
- throw new RuntimeException("Use of empty @Remote on bean " + container.getEjbName()
- + " with more than one default interface " + businessInterfaces);
- }
- // Only one default interface, mark as @Remote and return
- else
- {
- Class<?>[] rtn =
- {(Class<?>) businessInterfaces[0]};
- remoteAnnotation = new RemoteImpl(rtn);
- ((EJBContainer) container).getAnnotations().addClassAnnotation(javax.ejb.Remote.class, remoteAnnotation);
- return rtn;
- }
- }
- }
-
- // If remotes were found
- if (remoteAndRemoteBusinessInterfaces.size() > 0)
- {
- // Set interfaces and return
- Class<?>[] remotesArray = remoteAndRemoteBusinessInterfaces
- .toArray(new Class[remoteAndRemoteBusinessInterfaces.size()]);
- remoteAnnotation = new RemoteImpl(remotesArray);
- ((EJBContainer) container).getAnnotations().addClassAnnotation(Remote.class, remoteAnnotation);
- return remoteAnnotation.value();
- }
- // No remotes were found
- else
- {
- return new Class<?>[]
- {};
- }
- }
-
- /**
- * Obtains the return types declared by the "create" methods for the specified home interface.
- *
- * @param homeInterface
- * @param isStateless Flag to indicate whether this is for a Stateful or Stateless container
- * @return
- */
- private static Set<Class<?>> getReturnTypesFromCreateMethods(Class<?> homeInterface, boolean isStateless)
- {
- // Ensure we've been passed a Home or LocalHome interface (Developers only)
- assert (EJBHome.class.isAssignableFrom(homeInterface) || EJBLocalHome.class.isAssignableFrom(homeInterface));
-
- // Ensure we've been passed a Home or LocalHome interface (End-User)
- if (!EJBHome.class.isAssignableFrom(homeInterface) && !EJBLocalHome.class.isAssignableFrom(homeInterface))
- {
- throw new RuntimeException("Declared EJB 2.1 Home Interface " + homeInterface.getName() + " does not extend "
- + EJBHome.class.getName() + " or " + EJBLocalHome.class.getName()
- + " as required by EJB 3.0 Core Specification 4.6.8 and 4.6.10");
- }
-
- // Initialize
- Set<Class<?>> types = new HashSet<Class<?>>();
- List<Method> createMethods = null;
-
- // If for a Stateless Container
- if (isStateless)
- {
- // Initialize error message
- String specViolationErrorMessage = "EJB 3.0 Specification Violation (4.6.8 Bullet 4, 4.6.10 Bullet 4): \""
- + "A stateless session bean must define exactly one create method with no arguments." + "\"; found in "
- + homeInterface.getName();
-
- // Get all methods with signature "create"
- createMethods = new ArrayList<Method>();
- try
- {
- createMethods.add(homeInterface.getMethod("create", new Class<?>[]
- {}));
- }
- // EJB 3.0 Specification 4.6.8 Bullet 4 Violation
- // EJBTHREE-1156
- catch (NoSuchMethodException e)
- {
- throw new RuntimeException(specViolationErrorMessage);
- }
-
- // Ensure only one create method is defined
- // EJB 3.0 Specification 4.6.8 Bullet 4 Violation
- // EJBTHREE-1156
- if (createMethods.size() > 1)
- {
- throw new RuntimeException(specViolationErrorMessage);
- }
- }
- else
- {
- // Obtain all "create<METHOD>" methods
- createMethods = ClassHelper.getAllMethodsByPrefix(homeInterface, "create");
- }
- if (createMethods.size() == 0)
- {
- throw new RuntimeException("EJB 3.0 Core Specification Violation (4.6.8 Bullet 5): EJB2.1 Home Interface "
- + homeInterface + " does not declare a \'create<METHOD>\' method");
- }
-
- // Add all return types
- for (Method method : createMethods)
- {
- types.add(method.getReturnType());
- }
-
- // Return
- return types;
- }
-
- public static String getClientBindUrl(RemoteBinding binding) throws Exception
- {
- String clientBindUrl = binding.clientBindUrl();
- if (clientBindUrl.trim().length() == 0)
- {
- if (binding.invokerName()!=null && binding.invokerName().trim().length() != 0)
- {
- try
- {
- ObjectName connectionON = new ObjectName(binding.invokerName());
- KernelAbstraction kernelAbstraction = KernelAbstractionFactory.getInstance();
- clientBindUrl = (String)kernelAbstraction.getAttribute(connectionON, "InvokerLocator");
- }
- catch (Exception e)
- {
- log.warn("Unable to find InvokerLocator " + binding.invokerName() + ". Using default. " + e);
- clientBindUrl = RemoteProxyFactory.DEFAULT_CLIENT_BINDING;
- }
- }
- else
- {
- try
- {
- ObjectName connectionON = new ObjectName("jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3");
- KernelAbstraction kernelAbstraction = KernelAbstractionFactory.getInstance();
- clientBindUrl = (String)kernelAbstraction.getAttribute(connectionON, "InvokerLocator");
- }
- catch (Exception e)
- {
- log.warn("Unable to find default InvokerLocator. Using default. " + e);
- clientBindUrl = RemoteProxyFactory.DEFAULT_CLIENT_BINDING;
- }
- }
- }
- else if (clientBindUrl.indexOf("0.0.0.0") != -1)
- {
- KernelAbstraction kernelAbstraction = KernelAbstractionFactory.getInstance();
- ObjectName query = new ObjectName("jboss.remoting:type=Connector,handler=ejb3,*");
- Set mbeanSet = kernelAbstraction.getMBeans(query);
-
- URI targetUri = new URI(clientBindUrl);
- Iterator mbeans = mbeanSet.iterator();
- while (mbeans.hasNext())
- {
- ObjectInstance invokerInstance = (ObjectInstance)mbeans.next();
- ObjectName invokerName = invokerInstance.getObjectName();
- String invokerLocator = (String)kernelAbstraction.getAttribute(invokerName, "InvokerLocator");
- URI uri = new URI(invokerLocator);
-
- if (uri.getScheme().equals(targetUri.getScheme()) && uri.getPort() == targetUri.getPort())
- {
- return invokerLocator;
- }
- }
- }
-
- if (clientBindUrl == null)
- clientBindUrl = RemoteProxyFactory.DEFAULT_CLIENT_BINDING;
-
- return clientBindUrl;
- }
-
- /**
- * Create a Proxy Constructor for the specified interfaces, using the specified CL
- *
- * @param interfaces
- * @param cl
- * @return
- * @throws Exception
- */
- public static Constructor<?> createProxyConstructor(Class<?>[] interfaces, ClassLoader cl) throws Exception
- {
- Class<?> proxyClass = java.lang.reflect.Proxy.getProxyClass(cl, interfaces);
- return proxyClass.getConstructor(InvocationHandler.class);
- }
-
- public static String getHomeJndiName(EJBContainer container)
- {
- // Use explicitly-specified binding, if defined
- RemoteHomeBinding binding = container.getAnnotation(RemoteHomeBinding.class);
- if (binding != null)
- return binding.jndiBinding();
-
- // Use Default JNDI Binding Policy
- return ProxyFactoryHelper.getJndiBindingPolicy(container).getDefaultRemoteHomeJndiName(
- ProxyFactoryHelper.getDeploymentSummaryFromContainer(container));
- }
-
- public static String getLocalHomeJndiName(EJBContainer container)
- {
- // Use explicitly-specified binding, if defined
- LocalHomeBinding binding = container.getAnnotation(LocalHomeBinding.class);
- if (binding != null)
- return binding.jndiBinding();
-
- // Use Default JNDI Binding Policy
- return ProxyFactoryHelper.getJndiBindingPolicy(container).getDefaultLocalHomeJndiName(
- ProxyFactoryHelper.getDeploymentSummaryFromContainer(container));
- }
-
- public static String getLocalJndiName(EJBContainer container)
- {
- return ProxyFactoryHelper.getLocalJndiName(container, true);
- }
-
- private static String getLocalJndiName(EJBContainer container, boolean conflictCheck)
- {
- // See if local binding is explicitly-defined
- LocalBinding localBinding = container.getAnnotation(LocalBinding.class);
-
- // If none specified
- if (localBinding == null)
- {
- // Get JNDI name from policy
- String name = ProxyFactoryHelper.getJndiBindingPolicy(container).getDefaultLocalJndiName(
- ProxyFactoryHelper.getDeploymentSummaryFromContainer(container));
-
- // If we should check for naming conflict
- if (conflictCheck){
- // Check
- ProxyFactoryHelper.checkForJndiNamingConflict(container);
- }
-
- // Return
- return name;
- }
- // Local Binding was explicitly-specified, use it
- else
- {
- return localBinding.jndiBinding();
- }
- }
-
- public static String getRemoteBusinessJndiName(EJBContainer container)
- {
- return ProxyFactoryHelper.getRemoteBusinessJndiName(container, true);
- }
-
- public static String getRemoteBusinessJndiName(EJBContainer container, boolean check)
- {
- RemoteBinding binding = container.getAnnotation(RemoteBinding.class);
-
- return ProxyFactoryHelper.getRemoteBusinessJndiName(container, binding);
- }
-
- private static void checkForJndiNamingConflict(EJBContainer container)
- {
- if (container.getAnnotation(Local.class) != null)
- {
- Ejb3DeploymentSummary summary = ProxyFactoryHelper.getDeploymentSummaryFromContainer(container);
- String localJndiName = ProxyFactoryHelper.getJndiBindingPolicy(container).getDefaultLocalJndiName(summary);
- String remoteJndiName = ProxyFactoryHelper.getJndiBindingPolicy(container).getDefaultRemoteJndiName(summary);
- String ejbName = container.getEjbName();
- if ((localJndiName.equals(remoteJndiName)))
- {
- throw new javax.ejb.EJBException("Conflict between default jndi name " + remoteJndiName
- + " for both remote and local for ejb-name:" + ejbName + ", bean class=" + container.getBeanClass());
- }
-
- }
- }
-
- private static String getRemoteBusinessJndiName(EJBContainer container, RemoteBinding binding)
- {
- return ProxyFactoryHelper.getRemoteBusinessJndiName(container, binding, true);
- }
-
- public static String getRemoteBusinessJndiName(EJBContainer container, RemoteBinding binding, boolean conflictCheck)
- {
- // Initialize
- String jndiName = null;
-
- // If binding is not defined
- if (binding == null || binding.jndiBinding() == null || binding.jndiBinding().trim().equals(""))
- {
- // Use the default
- jndiName = getDefaultRemoteBusinessJndiName(container);
-
- // If we should check for a naming conflict
- if (conflictCheck)
- {
- // Check
- ProxyFactoryHelper.checkForJndiNamingConflict(container);
- }
-
- }
- // Binding is explicitly-defined
- else
- {
- // use it
- jndiName = binding.jndiBinding();
- }
-
- // Return
- return jndiName;
- }
-
- public static String getDefaultRemoteBusinessJndiName(EJBContainer container)
- {
- // Obtain JNDI Binding Policy
- DefaultJndiBindingPolicy policy = ProxyFactoryHelper.getJndiBindingPolicy(container);
-
- // Obtain Deployment Summary
- Ejb3DeploymentSummary summary = ProxyFactoryHelper.getDeploymentSummaryFromContainer(container);
-
- // Return the policy's default remote name for this summary
- return policy.getDefaultRemoteJndiName(summary);
- }
-
- /**
- * Obtains the JNDI Binding Policy for the specified container
- *
- * @param container
- * @author ALR
- * @return
- */
- private static DefaultJndiBindingPolicy getJndiBindingPolicy(EJBContainer container)
- {
- // Attempt to obtain the binding policy from annotation repo
- JndiBindingPolicy bindingPolicy = container.getAnnotation(JndiBindingPolicy.class);
-
- // Initialize
- Class<? extends DefaultJndiBindingPolicy> policy = null;
-
- // If policy is defined
- if (bindingPolicy != null){
- // Use it
- policy = bindingPolicy.policy();
- }
- // No policy defined
- else
- {
- // Use default policy
- Class<? extends DefaultJndiBindingPolicy> policyClass = PackagingBasedJndiBindingPolicy.class;
- // Log warning
- log.warn("No default JNDI Binding Policy Defined (see ejb3-interceptors-aop.xml for example); defaulting to "
- + policyClass.getName());
- policy = policyClass;
- }
-
- // Log
- log.debug("Obtaining JNDI name from policy " + policy.getName());
-
- try
- {
- // Instanciate the policy and return
- return policy.newInstance();
- }
- catch (InstantiationException e)
- {
- throw new RuntimeException("Could not instanciate JNDI Binding Policy: " + policy.getName(), e);
- }
- catch (IllegalAccessException e)
- {
- throw new RuntimeException(e);
- }
- }
-
- private static Ejb3DeploymentSummary getDeploymentSummaryFromContainer(EJBContainer container)
- {
- // Construct Deployment Summary
- Ejb3DeploymentSummary summary = new Ejb3DeploymentSummary();
- summary.setEjbName(container.getEjbName());
- summary.setService(container instanceof ServiceContainer);
- summary.setStateful(container instanceof StatefulContainer);
- summary.setDeploymentName(container.getDeployment().getName());
- summary.setBeanClass(container.getBeanClass());
- DeploymentScope scope = container.getDeployment().getEar();
- if (scope != null)
- {
- summary.setDeploymentScopeBaseName(scope.getBaseName());
- }
-
- // Return
- return summary;
- }
-}
\ No newline at end of file
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/ProxyFactoryHelper.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/ProxyFactoryHelper.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/ProxyFactoryHelper.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/ProxyFactoryHelper.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,1057 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.factory;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.ejb.EJBHome;
+import javax.ejb.EJBLocalHome;
+import javax.ejb.EJBLocalObject;
+import javax.ejb.EJBObject;
+import javax.ejb.Local;
+import javax.ejb.LocalHome;
+import javax.ejb.Remote;
+import javax.ejb.RemoteHome;
+import javax.jws.WebService;
+import javax.management.ObjectInstance;
+import javax.management.ObjectName;
+
+import org.jboss.ejb3.Container;
+import org.jboss.ejb3.DeploymentScope;
+import org.jboss.ejb3.EJBContainer;
+import org.jboss.ejb3.KernelAbstraction;
+import org.jboss.ejb3.KernelAbstractionFactory;
+import org.jboss.ejb3.annotation.JndiBindingPolicy;
+import org.jboss.ejb3.annotation.LocalBinding;
+import org.jboss.ejb3.annotation.LocalHomeBinding;
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.annotation.RemoteBindings;
+import org.jboss.ejb3.annotation.RemoteHomeBinding;
+import org.jboss.ejb3.annotation.impl.LocalImpl;
+import org.jboss.ejb3.annotation.impl.RemoteImpl;
+import org.jboss.ejb3.jndipolicy.DefaultJndiBindingPolicy;
+import org.jboss.ejb3.jndipolicy.Ejb3DeploymentSummary;
+import org.jboss.ejb3.jndipolicy.impl.PackagingBasedJndiBindingPolicy;
+import org.jboss.ejb3.lang.ClassHelper;
+import org.jboss.ejb3.service.ServiceContainer;
+import org.jboss.ejb3.session.SessionContainer;
+import org.jboss.ejb3.stateful.StatefulContainer;
+import org.jboss.ejb3.stateless.StatelessContainer;
+import org.jboss.logging.Logger;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+public class ProxyFactoryHelper
+{
+ private static final Logger log = Logger.getLogger(ProxyFactoryHelper.class);
+
+ private static String getEndpointInterface(Container container)
+ {
+ WebService ws = (javax.jws.WebService) ((EJBContainer) container).resolveAnnotation(javax.jws.WebService.class);
+ if (ws != null)
+ {
+ return ws.endpointInterface();
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @param container
+ * @return the local interfaces of the container or an empty array
+ */
+ public static Class<?>[] getLocalAndBusinessLocalInterfaces(Container container)
+ {
+ // Initialize
+ Set<Class<?>> localAndBusinessLocalInterfaces = new HashSet<Class<?>>();
+
+ // Obtain Bean Class
+ Class<?> beanClass = container.getBeanClass();
+
+ // Obtain @Local
+ Local localAnnotation = ((EJBContainer) container).getAnnotation(Local.class);
+
+ // Obtain @LocalHome
+ LocalHome localHomeAnnotation = ((EJBContainer) container).getAnnotation(LocalHome.class);
+
+ // Obtain @Remote
+ Remote remoteAnnotation = ((EJBContainer) container).getAnnotation(Remote.class);
+
+ // Obtain Remote and Business Remote interfaces
+ Class<?>[] remoteAndBusinessRemoteInterfaces = ProxyFactoryHelper.getRemoteAndBusinessRemoteInterfaces(container);
+
+ // Obtain all business interfaces from the bean class
+ Set<Class<?>> businessInterfacesImplementedByBeanClass = ProxyFactoryHelper.getBusinessInterfaces(beanClass);
+
+ // Obtain all business interfaces directly implemented by the bean class (not including supers)
+ Set<Class<?>> businessInterfacesDirectlyImplementedByBeanClass = ProxyFactoryHelper.getBusinessInterfaces(
+ beanClass, false);
+
+ // Determine whether Stateful or Stateless
+ boolean isStateless = (container instanceof StatelessContainer) ? true : false;
+
+ // EJBTHREE-1127
+ // Determine local interface from return value of "create" in Local Home
+ if (localHomeAnnotation != null)
+ {
+ localAndBusinessLocalInterfaces.addAll(ProxyFactoryHelper.getReturnTypesFromCreateMethods(localHomeAnnotation
+ .value(), isStateless));
+ }
+
+ // For each of the business interfaces implemented by the bean class
+ for (Class<?> clazz : businessInterfacesImplementedByBeanClass)
+ {
+ // If @Local is on the interface
+ if (clazz.isAnnotationPresent(Local.class))
+ {
+ // Add to the list of locals
+ localAndBusinessLocalInterfaces.add(clazz);
+ }
+ }
+
+ // EJBTHREE-1062
+ // EJB 3 Core Specification 4.6.6
+ // If bean class implements a single interface, that interface is assumed to be the
+ // business interface of the bean. This business interface will be a local interface unless the
+ // interface is designated as a remote business interface by use of the Remote
+ // annotation on the bean class or interface or by means of the deployment descriptor.
+ if (businessInterfacesDirectlyImplementedByBeanClass.size() == 1 && localAndBusinessLocalInterfaces.size() == 0)
+ {
+ // Obtain the implemented interface
+ Class<?> singleInterface = businessInterfacesDirectlyImplementedByBeanClass.iterator().next();
+
+ // If not explicitly marked as @Remote, and is a valid business interface
+ if (remoteAnnotation == null && singleInterface.getAnnotation(Remote.class) == null)
+ {
+ // Return the implemented interface, adding to the container
+ Class<?>[] returnValue = new Class[]
+ {singleInterface};
+ Local li = new LocalImpl(returnValue);
+ ((EJBContainer) container).getAnnotations().addClassAnnotation(Local.class, li);
+ return returnValue;
+ }
+ }
+
+ // @Local was defined
+ if (localAnnotation != null)
+ {
+ // If @Local has no value or empty value
+ if (localAnnotation.value() == null || localAnnotation.value().length == 0)
+ {
+ // If @Local is defined with no value and there are no business interfaces
+ if (businessInterfacesImplementedByBeanClass.size() == 0)
+ {
+ throw new RuntimeException("Use of empty @Local on bean " + container.getEjbName()
+ + " and there are no valid business interfaces");
+ }
+ // If more than one business interface is directly implemented by the bean class
+ else if (businessInterfacesImplementedByBeanClass.size() > 1)
+ {
+ throw new RuntimeException("Use of empty @Local on bean " + container.getEjbName()
+ + " with more than one default interface " + businessInterfacesImplementedByBeanClass);
+ }
+ // JIRA EJBTHREE-1062
+ // EJB 3 4.6.6
+ // If the bean class implements only one business interface, that
+ //interface is exposed as local business if not denoted as @Remote
+ else
+ {
+ // If not explicitly marked as @Remote
+ if (remoteAnnotation == null)
+ {
+ // Return the implemented interface and add to container
+ Class<?>[] returnValue = businessInterfacesImplementedByBeanClass.toArray(new Class<?>[]
+ {});
+ Local li = new LocalImpl(returnValue);
+ ((EJBContainer) container).getAnnotations().addClassAnnotation(Local.class, li);
+ return returnValue;
+ }
+ }
+ }
+ // @Local has value
+ else
+ {
+ // For each of the interfaces in @Local.value
+ for (Class<?> clazz : localAnnotation.value())
+ {
+ // Add to the list of locals
+ localAndBusinessLocalInterfaces.add(clazz);
+ }
+
+ // For each of the business interfaces implemented by the bean class
+ for (Class<?> clazz : businessInterfacesImplementedByBeanClass)
+ {
+ // If @Local is on the interface
+ if (clazz.isAnnotationPresent(Local.class))
+ {
+ // Add to the list of locals
+ localAndBusinessLocalInterfaces.add(clazz);
+ }
+ }
+ }
+ }
+
+ // If local interfaces have been defined/discovered
+ if (localAndBusinessLocalInterfaces.size() > 0)
+ {
+ // Check to ensure @Local and @Remote are not defined on the same interface
+ // EJBTHREE-751
+ for (Class<?> remoteInterface : remoteAndBusinessRemoteInterfaces)
+ {
+ for (Class<?> localInterface : localAndBusinessLocalInterfaces)
+ {
+ if (localInterface.equals(remoteInterface))
+ {
+ throw new RuntimeException("@Remote and @Local may not both be specified on the same interface \""
+ + remoteInterface.toString() + "\" per EJB3 Spec 4.6.7, Bullet 5.4");
+ }
+ }
+ }
+
+ // Return local interfaces, first adding to the container
+ Class<?>[] rtn = localAndBusinessLocalInterfaces.toArray(new Class<?>[]
+ {});
+ localAnnotation = new LocalImpl(rtn);
+ ((EJBContainer) container).getAnnotations().addClassAnnotation(Local.class, localAnnotation);
+ return rtn;
+ }
+ // If no local interfaces have been defined/discovered
+ else
+ {
+ // Obtain WS Endpoint
+ String endpoint = ProxyFactoryHelper.getEndpointInterface(container);
+
+ // If neither WS Endpoint or remotes are defined
+ if (remoteAndBusinessRemoteInterfaces.length == 0 && endpoint == null)
+ throw new RuntimeException(
+ "Bean Class "
+ + beanClass.getName()
+ + " has no local, webservice, or remote interfaces defined and does not implement at least one business interface: "
+ + container.getEjbName());
+
+ }
+
+ // No local or business local interfaces discovered
+ return new Class<?>[]
+ {};
+ }
+
+ /**
+ * Resolve the potential business interfaces on an enterprise bean.
+ * Returns all interfaces implemented by this class and its supers which
+ * are potentially a business interface.
+ *
+ * Note: for normal operation call container.getBusinessInterfaces().
+ *
+ * @param beanClass the EJB implementation class
+ * @return a list of potential business interfaces
+ * @see org.jboss.ejb3.EJBContainer#getBusinessInterfaces()
+ */
+ public static Set<Class<?>> getBusinessInterfaces(Class<?> beanClass)
+ {
+ // Obtain all business interfaces implemented by this bean class and its superclasses
+ return ProxyFactoryHelper.getBusinessInterfaces(beanClass, new HashSet<Class<?>>());
+ }
+
+ /**
+ * Resolve the potential business interfaces on an enterprise bean.
+ * Returns all interfaces implemented by this class and, optionally, its supers which
+ * are potentially a business interface.
+ *
+ * Note: for normal operation call container.getBusinessInterfaces().
+ *
+ * @param beanClass the EJB implementation class
+ * @param includeSupers Whether or not to include superclasses of the specified beanClass in this check
+ * @return a list of potential business interfaces
+ * @see org.jboss.ejb3.EJBContainer#getBusinessInterfaces()
+ */
+ public static Set<Class<?>> getBusinessInterfaces(Class<?> beanClass, boolean includeSupers)
+ {
+ // Obtain all business interfaces implemented by this bean class and optionally, its superclass
+ return ProxyFactoryHelper.getBusinessInterfaces(beanClass, new HashSet<Class<?>>(), includeSupers);
+ }
+
+ private static Set<Class<?>> getBusinessInterfaces(Class<?> beanClass, Set<Class<?>> interfaces)
+ {
+ return ProxyFactoryHelper.getBusinessInterfaces(beanClass, interfaces, true);
+ }
+
+ private static Set<Class<?>> getBusinessInterfaces(Class<?> beanClass, Set<Class<?>> interfaces,
+ boolean includeSupers)
+ {
+ /*
+ * 4.6.6:
+ * The following interfaces are excluded when determining whether the bean class has
+ * more than one interface: java.io.Serializable; java.io.Externalizable;
+ * any of the interfaces defined by the javax.ejb package.
+ */
+ for (Class<?> intf : beanClass.getInterfaces())
+ {
+ if (intf.equals(java.io.Externalizable.class))
+ continue;
+ if (intf.equals(java.io.Serializable.class))
+ continue;
+ if (intf.getName().startsWith("javax.ejb"))
+ continue;
+
+ // FIXME Other aop frameworks might add other interfaces, this should really be configurable
+ if (intf.getName().startsWith("org.jboss.aop"))
+ continue;
+
+ interfaces.add(intf);
+ }
+
+ // If there's no superclass, or we shouldn't check the superclass, return
+ if (!includeSupers || beanClass.getSuperclass() == null)
+ {
+ return interfaces;
+ }
+ else
+ {
+ // Include any superclasses' interfaces
+ return getBusinessInterfaces(beanClass.getSuperclass(), interfaces);
+ }
+ }
+
+ public static Class<?> getLocalHomeInterface(Container container)
+ {
+ LocalHome li = ((EJBContainer) container).getAnnotation(javax.ejb.LocalHome.class);
+ if (li != null)
+ return li.value();
+ return null;
+ }
+
+ public static Class<?> getRemoteHomeInterface(Container container)
+ {
+ RemoteHome li = ((EJBContainer) container).getAnnotation(javax.ejb.RemoteHome.class);
+ if (li != null)
+ return li.value();
+ return null;
+ }
+
+ public static boolean publishesInterface(Container container, Class<?> businessInterface)
+ {
+ if (!(container instanceof SessionContainer))
+ return false;
+ Class<?>[] remotes = getRemoteAndBusinessRemoteInterfaces(container);
+ for (Class<?> intf : remotes)
+ {
+ if (intf.getName().equals(businessInterface.getName()))
+ return true;
+ }
+
+ Class<?> remoteHome = getRemoteHomeInterface(container);
+ if (remoteHome != null)
+ {
+ if (businessInterface.getName().equals(remoteHome.getName()))
+ {
+ return true;
+ }
+ }
+ Class<?>[] locals = getLocalAndBusinessLocalInterfaces(container);
+ for (Class<?> clazz : locals)
+ {
+ if (clazz.getName().equals(businessInterface.getName()))
+ {
+ return true;
+ }
+ }
+ Class<?> localHome = getLocalHomeInterface(container);
+ if (localHome != null)
+ {
+ if (businessInterface.getName().equals(localHome.getName()))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Obtains the JNDI name for the specified container; may either be explicitly-defined by
+ * annotation / XML or will otherwise default to the configured JNDI Binding Policy
+ *
+ * @param container
+ * @param businessInterface
+ * @return
+ */
+ public static String getJndiName(EJBContainer container, Class<?> businessInterface)
+ {
+ assert container != null : "container is null";
+ assert businessInterface != null : "businessInterface is null";
+
+ // Initialize to defaults of remote and not home
+ String jndiName = null;
+ boolean isHome = false;
+ boolean isLocal = false;
+
+ // Determine if remote
+ Class<?>[] remotes = ProxyFactoryHelper.getRemoteAndBusinessRemoteInterfaces(container);
+ for (Class<?> clazz : remotes)
+ {
+ if (clazz.getName().equals(businessInterface.getName()))
+ {
+ // Check for declared @RemoteBindings
+ RemoteBindings bindings = ((EJBContainer) container).getAnnotation(RemoteBindings.class);
+ if (bindings != null)
+ {
+ // Encountered, return
+ return bindings.value()[0].jndiBinding();
+ }
+ // Check for declared @RemoteBinding
+ RemoteBinding binding = ((EJBContainer) container).getAnnotation(RemoteBinding.class);
+ if (binding != null)
+ {
+ // Encountered, return
+ return binding.jndiBinding();
+ }
+ }
+ }
+
+ // Determine if remote home
+ Class<?> remoteHome = getRemoteHomeInterface(container);
+ if (remoteHome != null)
+ {
+ if (businessInterface.getName().equals(remoteHome.getName()))
+ {
+ // Check for declared @RemoteHomeBinding
+ RemoteHomeBinding binding = ((EJBContainer) container).getAnnotation(RemoteHomeBinding.class);
+ if (binding != null)
+ {
+ // Encountered, return
+ return binding.jndiBinding();
+ }
+
+ // Set home for policy
+ isHome = true;
+ }
+ }
+
+ // Determine if local and home
+ Class<?> localHome = getLocalHomeInterface(container);
+ if (localHome != null)
+ {
+ if (businessInterface.getName().equals(localHome.getName()))
+ {
+ // Check for declared @LocalHomeBinding
+ LocalHomeBinding binding = ((EJBContainer) container).getAnnotation(LocalHomeBinding.class);
+ if (binding != null)
+ {
+ // Encountered, return
+ return binding.jndiBinding();
+ }
+
+ // Set local and home for policy
+ isHome = true;
+ isLocal = true;
+ }
+ }
+
+ // Determine if local
+ Class<?>[] locals = getLocalAndBusinessLocalInterfaces(container);
+ for (Class<?> clazz : locals)
+ {
+ if (clazz.getName().equals(businessInterface.getName()))
+ {
+ // Check for declared @LocalBinding
+ LocalBinding binding = ((EJBContainer) container).getAnnotation(LocalBinding.class);
+ if (binding != null)
+ {
+ // Encountered, return
+ return binding.jndiBinding();
+ }
+
+ // Set local for policy
+ isLocal = true;
+ }
+ }
+
+ // If JNDI Name has not been explicitly specified, use policy
+ if (jndiName == null)
+ {
+ // Log
+ log.debug("JNDI name has not been explicitly set for EJB " + container.getEjbName() + ", interface "
+ + businessInterface.getName());
+
+ // Set JNDI name
+ Ejb3DeploymentSummary summary = ProxyFactoryHelper.getDeploymentSummaryFromContainer(container);
+ summary.setHome(isHome);
+ summary.setLocal(isLocal);
+ jndiName = ProxyFactoryHelper.getJndiBindingPolicy(container).getJndiName(summary);
+ }
+
+ // Return
+ return jndiName;
+ }
+
+ /**
+ * Returns all local interfaces in the specified container; interfaces
+ * marked as "local" via either annotation or XML and extending EJBLocalObject
+ *
+ * @param container
+ * @return
+ */
+ public static Class<?>[] getLocalInterfaces(Container container)
+ {
+ return ProxyFactoryHelper.getInterfacesAssignableFromClass(ProxyFactoryHelper
+ .getLocalAndBusinessLocalInterfaces(container), EJBLocalObject.class, true);
+ }
+
+ /**
+ * Returns all remote interfaces in the specified container; interfaces
+ * marked as "remote" via either annotation or XML and extending EJBObject
+ *
+ * @param container
+ * @return
+ */
+ public static Class<?>[] getRemoteInterfaces(Container container)
+ {
+ return ProxyFactoryHelper.getInterfacesAssignableFromClass(ProxyFactoryHelper
+ .getRemoteAndBusinessRemoteInterfaces(container), EJBObject.class, true);
+ }
+
+ /**
+ * Returns all local business interfaces in the specified container; interfaces
+ * marked as "local" via either annotation or XML and not extending EJBLocalObject
+ *
+ * @param container
+ * @return
+ */
+ public static Class<?>[] getLocalBusinessInterfaces(Container container)
+ {
+ return ProxyFactoryHelper.getInterfacesAssignableFromClass(ProxyFactoryHelper
+ .getLocalAndBusinessLocalInterfaces(container), EJBLocalObject.class, false);
+ }
+
+ /**
+ * Returns all remote business interfaces in the specified container; interfaces
+ * marked as "remote" via either annotation or XML and not extending EJBObject
+ *
+ * @param container
+ * @return
+ */
+ public static Class<?>[] getRemoteBusinessInterfaces(Container container)
+ {
+ return ProxyFactoryHelper.getInterfacesAssignableFromClass(ProxyFactoryHelper
+ .getRemoteAndBusinessRemoteInterfaces(container), EJBObject.class, false);
+ }
+
+ /**
+ * Returns an subset of the specified array of interfaces either
+ * assignable to or not assignable to the specified class, depending
+ * upon the flag "assignable"
+ *
+ * @param interfaces
+ * @param clazz
+ * @param assignable
+ * @return
+ */
+ private static Class<?>[] getInterfacesAssignableFromClass(Class<?>[] interfaces, Class<?> clazz, boolean assignable)
+ {
+ // Initialize
+ List<Class<?>> subset = new ArrayList<Class<?>>();
+
+ // For all interfaces
+ for (Class<?> interfaze : interfaces)
+ {
+ // If we want assignable classes only
+ if (assignable && clazz.isAssignableFrom(interfaze))
+ {
+ subset.add(interfaze);
+ }
+
+ // If we want classes not assignable only
+ if (!assignable && !clazz.isAssignableFrom(interfaze))
+ {
+ subset.add(interfaze);
+ }
+ }
+
+ // Return
+ return subset.toArray(new Class<?>[]
+ {});
+ }
+
+ /**
+ * Returns all remote and remote business interfaces in the specified container,
+ * designated by @Remote or in ejb-jar.xml as "remote" or "business-remote"
+ *
+ * @param container
+ * @return the remote interfaces of the container or an empty array
+ */
+ public static Class<?>[] getRemoteAndBusinessRemoteInterfaces(Container container)
+ {
+ // Initialize
+ Remote remoteAnnotation = ((EJBContainer) container).getAnnotation(Remote.class);
+ RemoteHome remoteHomeAnnotation = ((EJBContainer) container).getAnnotation(RemoteHome.class);
+ Set<Class<?>> remoteAndRemoteBusinessInterfaces = new HashSet<Class<?>>();
+ Class<?> beanClass = container.getBeanClass();
+ boolean isStateless = (container instanceof StatelessContainer) ? true : false;
+
+ // Obtain business interfaces
+ Class<?>[] businessInterfaces = ProxyFactoryHelper.getBusinessInterfaces(beanClass).toArray(new Class[]
+ {});
+
+ // EJBTHREE-1127
+ // Determine remote interface from return value of "create" in Remote Home
+ if (remoteHomeAnnotation != null)
+ {
+ remoteAndRemoteBusinessInterfaces.addAll(ProxyFactoryHelper.getReturnTypesFromCreateMethods(
+ remoteHomeAnnotation.value(), isStateless));
+ }
+
+ // If @Remote is not defined
+ if (remoteAnnotation == null)
+ {
+ // For each of the business interfaces
+ for (Class<?> clazz : businessInterfaces)
+ {
+ // If @Remote is on the business interface
+ if (clazz.isAnnotationPresent(Remote.class))
+ {
+ // Add to the list of remotes
+ remoteAndRemoteBusinessInterfaces.add(clazz);
+ }
+ }
+ }
+ // @Remote was defined
+ else
+ {
+ // @Remote declares interfaces, add these
+ if (remoteAnnotation.value().length > 0)
+ {
+ for (Class<?> clazz : remoteAnnotation.value())
+ {
+ remoteAndRemoteBusinessInterfaces.add(clazz);
+ }
+ }
+ // @Remote is empty
+ else
+ {
+ // No business interfaces were defined on the bean
+ if (businessInterfaces.length == 0)
+ {
+ throw new RuntimeException("Use of empty @Remote on bean " + container.getEjbName()
+ + " and there are no valid business interfaces");
+ }
+
+ // More than one default interface, cannot be marked as @Remote
+ else if (businessInterfaces.length > 1)
+ {
+ throw new RuntimeException("Use of empty @Remote on bean " + container.getEjbName()
+ + " with more than one default interface " + businessInterfaces);
+ }
+ // Only one default interface, mark as @Remote and return
+ else
+ {
+ Class<?>[] rtn =
+ {(Class<?>) businessInterfaces[0]};
+ remoteAnnotation = new RemoteImpl(rtn);
+ ((EJBContainer) container).getAnnotations().addClassAnnotation(javax.ejb.Remote.class, remoteAnnotation);
+ return rtn;
+ }
+ }
+ }
+
+ // If remotes were found
+ if (remoteAndRemoteBusinessInterfaces.size() > 0)
+ {
+ // Set interfaces and return
+ Class<?>[] remotesArray = remoteAndRemoteBusinessInterfaces
+ .toArray(new Class[remoteAndRemoteBusinessInterfaces.size()]);
+ remoteAnnotation = new RemoteImpl(remotesArray);
+ ((EJBContainer) container).getAnnotations().addClassAnnotation(Remote.class, remoteAnnotation);
+ return remoteAnnotation.value();
+ }
+ // No remotes were found
+ else
+ {
+ return new Class<?>[]
+ {};
+ }
+ }
+
+ /**
+ * Obtains the return types declared by the "create" methods for the specified home interface.
+ *
+ * @param homeInterface
+ * @param isStateless Flag to indicate whether this is for a Stateful or Stateless container
+ * @return
+ */
+ private static Set<Class<?>> getReturnTypesFromCreateMethods(Class<?> homeInterface, boolean isStateless)
+ {
+ // Ensure we've been passed a Home or LocalHome interface (Developers only)
+ assert (EJBHome.class.isAssignableFrom(homeInterface) || EJBLocalHome.class.isAssignableFrom(homeInterface));
+
+ // Ensure we've been passed a Home or LocalHome interface (End-User)
+ if (!EJBHome.class.isAssignableFrom(homeInterface) && !EJBLocalHome.class.isAssignableFrom(homeInterface))
+ {
+ throw new RuntimeException("Declared EJB 2.1 Home Interface " + homeInterface.getName() + " does not extend "
+ + EJBHome.class.getName() + " or " + EJBLocalHome.class.getName()
+ + " as required by EJB 3.0 Core Specification 4.6.8 and 4.6.10");
+ }
+
+ // Initialize
+ Set<Class<?>> types = new HashSet<Class<?>>();
+ List<Method> createMethods = null;
+
+ // If for a Stateless Container
+ if (isStateless)
+ {
+ // Initialize error message
+ String specViolationErrorMessage = "EJB 3.0 Specification Violation (4.6.8 Bullet 4, 4.6.10 Bullet 4): \""
+ + "A stateless session bean must define exactly one create method with no arguments." + "\"; found in "
+ + homeInterface.getName();
+
+ // Get all methods with signature "create"
+ createMethods = new ArrayList<Method>();
+ try
+ {
+ createMethods.add(homeInterface.getMethod("create", new Class<?>[]
+ {}));
+ }
+ // EJB 3.0 Specification 4.6.8 Bullet 4 Violation
+ // EJBTHREE-1156
+ catch (NoSuchMethodException e)
+ {
+ throw new RuntimeException(specViolationErrorMessage);
+ }
+
+ // Ensure only one create method is defined
+ // EJB 3.0 Specification 4.6.8 Bullet 4 Violation
+ // EJBTHREE-1156
+ if (createMethods.size() > 1)
+ {
+ throw new RuntimeException(specViolationErrorMessage);
+ }
+ }
+ else
+ {
+ // Obtain all "create<METHOD>" methods
+ createMethods = ClassHelper.getAllMethodsByPrefix(homeInterface, "create");
+ }
+ if (createMethods.size() == 0)
+ {
+ throw new RuntimeException("EJB 3.0 Core Specification Violation (4.6.8 Bullet 5): EJB2.1 Home Interface "
+ + homeInterface + " does not declare a \'create<METHOD>\' method");
+ }
+
+ // Add all return types
+ for (Method method : createMethods)
+ {
+ types.add(method.getReturnType());
+ }
+
+ // Return
+ return types;
+ }
+
+ public static String getClientBindUrl(RemoteBinding binding) throws Exception
+ {
+ String clientBindUrl = binding.clientBindUrl();
+ if (clientBindUrl.trim().length() == 0)
+ {
+ if (binding.invokerName()!=null && binding.invokerName().trim().length() != 0)
+ {
+ try
+ {
+ ObjectName connectionON = new ObjectName(binding.invokerName());
+ KernelAbstraction kernelAbstraction = KernelAbstractionFactory.getInstance();
+ clientBindUrl = (String)kernelAbstraction.getAttribute(connectionON, "InvokerLocator");
+ }
+ catch (Exception e)
+ {
+ log.warn("Unable to find InvokerLocator " + binding.invokerName() + ". Using default. " + e);
+ clientBindUrl = RemoteProxyFactory.DEFAULT_CLIENT_BINDING;
+ }
+ }
+ else
+ {
+ try
+ {
+ ObjectName connectionON = new ObjectName("jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3");
+ KernelAbstraction kernelAbstraction = KernelAbstractionFactory.getInstance();
+ clientBindUrl = (String)kernelAbstraction.getAttribute(connectionON, "InvokerLocator");
+ }
+ catch (Exception e)
+ {
+ log.warn("Unable to find default InvokerLocator. Using default. " + e);
+ clientBindUrl = RemoteProxyFactory.DEFAULT_CLIENT_BINDING;
+ }
+ }
+ }
+ else if (clientBindUrl.indexOf("0.0.0.0") != -1)
+ {
+ KernelAbstraction kernelAbstraction = KernelAbstractionFactory.getInstance();
+ ObjectName query = new ObjectName("jboss.remoting:type=Connector,handler=ejb3,*");
+ Set mbeanSet = kernelAbstraction.getMBeans(query);
+
+ URI targetUri = new URI(clientBindUrl);
+ Iterator mbeans = mbeanSet.iterator();
+ while (mbeans.hasNext())
+ {
+ ObjectInstance invokerInstance = (ObjectInstance)mbeans.next();
+ ObjectName invokerName = invokerInstance.getObjectName();
+ String invokerLocator = (String)kernelAbstraction.getAttribute(invokerName, "InvokerLocator");
+ URI uri = new URI(invokerLocator);
+
+ if (uri.getScheme().equals(targetUri.getScheme()) && uri.getPort() == targetUri.getPort())
+ {
+ return invokerLocator;
+ }
+ }
+ }
+
+ if (clientBindUrl == null)
+ clientBindUrl = RemoteProxyFactory.DEFAULT_CLIENT_BINDING;
+
+ return clientBindUrl;
+ }
+
+ /**
+ * Create a Proxy Constructor for the specified interfaces, using the specified CL
+ *
+ * @param interfaces
+ * @param cl
+ * @return
+ * @throws Exception
+ */
+ public static Constructor<?> createProxyConstructor(Class<?>[] interfaces, ClassLoader cl) throws Exception
+ {
+ Class<?> proxyClass = java.lang.reflect.Proxy.getProxyClass(cl, interfaces);
+ return proxyClass.getConstructor(InvocationHandler.class);
+ }
+
+ public static String getHomeJndiName(EJBContainer container)
+ {
+ // Use explicitly-specified binding, if defined
+ RemoteHomeBinding binding = container.getAnnotation(RemoteHomeBinding.class);
+ if (binding != null)
+ return binding.jndiBinding();
+
+ // Use Default JNDI Binding Policy
+ return ProxyFactoryHelper.getJndiBindingPolicy(container).getDefaultRemoteHomeJndiName(
+ ProxyFactoryHelper.getDeploymentSummaryFromContainer(container));
+ }
+
+ public static String getLocalHomeJndiName(EJBContainer container)
+ {
+ // Use explicitly-specified binding, if defined
+ LocalHomeBinding binding = container.getAnnotation(LocalHomeBinding.class);
+ if (binding != null)
+ return binding.jndiBinding();
+
+ // Use Default JNDI Binding Policy
+ return ProxyFactoryHelper.getJndiBindingPolicy(container).getDefaultLocalHomeJndiName(
+ ProxyFactoryHelper.getDeploymentSummaryFromContainer(container));
+ }
+
+ public static String getLocalJndiName(EJBContainer container)
+ {
+ return ProxyFactoryHelper.getLocalJndiName(container, true);
+ }
+
+ private static String getLocalJndiName(EJBContainer container, boolean conflictCheck)
+ {
+ // See if local binding is explicitly-defined
+ LocalBinding localBinding = container.getAnnotation(LocalBinding.class);
+
+ // If none specified
+ if (localBinding == null)
+ {
+ // Get JNDI name from policy
+ String name = ProxyFactoryHelper.getJndiBindingPolicy(container).getDefaultLocalJndiName(
+ ProxyFactoryHelper.getDeploymentSummaryFromContainer(container));
+
+ // If we should check for naming conflict
+ if (conflictCheck){
+ // Check
+ ProxyFactoryHelper.checkForJndiNamingConflict(container);
+ }
+
+ // Return
+ return name;
+ }
+ // Local Binding was explicitly-specified, use it
+ else
+ {
+ return localBinding.jndiBinding();
+ }
+ }
+
+ public static String getRemoteBusinessJndiName(EJBContainer container)
+ {
+ return ProxyFactoryHelper.getRemoteBusinessJndiName(container, true);
+ }
+
+ public static String getRemoteBusinessJndiName(EJBContainer container, boolean check)
+ {
+ RemoteBinding binding = container.getAnnotation(RemoteBinding.class);
+
+ return ProxyFactoryHelper.getRemoteBusinessJndiName(container, binding);
+ }
+
+ private static void checkForJndiNamingConflict(EJBContainer container)
+ {
+ if (container.getAnnotation(Local.class) != null)
+ {
+ Ejb3DeploymentSummary summary = ProxyFactoryHelper.getDeploymentSummaryFromContainer(container);
+ String localJndiName = ProxyFactoryHelper.getJndiBindingPolicy(container).getDefaultLocalJndiName(summary);
+ String remoteJndiName = ProxyFactoryHelper.getJndiBindingPolicy(container).getDefaultRemoteJndiName(summary);
+ String ejbName = container.getEjbName();
+ if ((localJndiName.equals(remoteJndiName)))
+ {
+ throw new javax.ejb.EJBException("Conflict between default jndi name " + remoteJndiName
+ + " for both remote and local for ejb-name:" + ejbName + ", bean class=" + container.getBeanClass());
+ }
+
+ }
+ }
+
+ private static String getRemoteBusinessJndiName(EJBContainer container, RemoteBinding binding)
+ {
+ return ProxyFactoryHelper.getRemoteBusinessJndiName(container, binding, true);
+ }
+
+ public static String getRemoteBusinessJndiName(EJBContainer container, RemoteBinding binding, boolean conflictCheck)
+ {
+ // Initialize
+ String jndiName = null;
+
+ // If binding is not defined
+ if (binding == null || binding.jndiBinding() == null || binding.jndiBinding().trim().equals(""))
+ {
+ // Use the default
+ jndiName = getDefaultRemoteBusinessJndiName(container);
+
+ // If we should check for a naming conflict
+ if (conflictCheck)
+ {
+ // Check
+ ProxyFactoryHelper.checkForJndiNamingConflict(container);
+ }
+
+ }
+ // Binding is explicitly-defined
+ else
+ {
+ // use it
+ jndiName = binding.jndiBinding();
+ }
+
+ // Return
+ return jndiName;
+ }
+
+ public static String getDefaultRemoteBusinessJndiName(EJBContainer container)
+ {
+ // Obtain JNDI Binding Policy
+ DefaultJndiBindingPolicy policy = ProxyFactoryHelper.getJndiBindingPolicy(container);
+
+ // Obtain Deployment Summary
+ Ejb3DeploymentSummary summary = ProxyFactoryHelper.getDeploymentSummaryFromContainer(container);
+
+ // Return the policy's default remote name for this summary
+ return policy.getDefaultRemoteJndiName(summary);
+ }
+
+ /**
+ * Obtains the JNDI Binding Policy for the specified container
+ *
+ * @param container
+ * @author ALR
+ * @return
+ */
+ private static DefaultJndiBindingPolicy getJndiBindingPolicy(EJBContainer container)
+ {
+ // Attempt to obtain the binding policy from annotation repo
+ JndiBindingPolicy bindingPolicy = container.getAnnotation(JndiBindingPolicy.class);
+
+ // Initialize
+ Class<? extends DefaultJndiBindingPolicy> policy = null;
+
+ // If policy is defined
+ if (bindingPolicy != null){
+ // Use it
+ policy = bindingPolicy.policy();
+ }
+ // No policy defined
+ else
+ {
+ // Use default policy
+ Class<? extends DefaultJndiBindingPolicy> policyClass = PackagingBasedJndiBindingPolicy.class;
+ // Log warning
+ log.warn("No default JNDI Binding Policy Defined (see ejb3-interceptors-aop.xml for example); defaulting to "
+ + policyClass.getName());
+ policy = policyClass;
+ }
+
+ // Log
+ log.debug("Obtaining JNDI name from policy " + policy.getName());
+
+ try
+ {
+ // Instanciate the policy and return
+ return policy.newInstance();
+ }
+ catch (InstantiationException e)
+ {
+ throw new RuntimeException("Could not instanciate JNDI Binding Policy: " + policy.getName(), e);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private static Ejb3DeploymentSummary getDeploymentSummaryFromContainer(EJBContainer container)
+ {
+ // Construct Deployment Summary
+ Ejb3DeploymentSummary summary = new Ejb3DeploymentSummary();
+ summary.setEjbName(container.getEjbName());
+ summary.setService(container instanceof ServiceContainer);
+ summary.setStateful(container instanceof StatefulContainer);
+ summary.setDeploymentName(container.getDeployment().getName());
+ summary.setBeanClass(container.getBeanClass());
+ DeploymentScope scope = container.getDeployment().getEar();
+ if (scope != null)
+ {
+ summary.setDeploymentScopeBaseName(scope.getBaseName());
+ }
+
+ // Return
+ return summary;
+ }
+}
\ No newline at end of file
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/ProxyFactoryNotRegisteredException.java
===================================================================
--- projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/ProxyFactoryNotRegisteredException.java 2008-04-23 20:41:05 UTC (rev 72636)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/ProxyFactoryNotRegisteredException.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,51 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2007, 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.factory;
-
-/**
- * ProxyFactoryNotRegisteredException
- *
- * Thrown when attempting to retrieve a proxy factory with
- * unrecognized name from the registry
- *
- * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
- * @version $Revision: $
- */
-public class ProxyFactoryNotRegisteredException extends Exception
-{
-
- // Class Members
- private static final long serialVersionUID = -881723607135494483L;
-
- // Constructors
-
- public ProxyFactoryNotRegisteredException()
- {
- super();
- }
-
- public ProxyFactoryNotRegisteredException(String message)
- {
- super(message);
- }
-
-}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/ProxyFactoryNotRegisteredException.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/ProxyFactoryNotRegisteredException.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/ProxyFactoryNotRegisteredException.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/ProxyFactoryNotRegisteredException.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, 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.factory;
+
+/**
+ * ProxyFactoryNotRegisteredException
+ *
+ * Thrown when attempting to retrieve a proxy factory with
+ * unrecognized name from the registry
+ *
+ * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
+ * @version $Revision: $
+ */
+public class ProxyFactoryNotRegisteredException extends Exception
+{
+
+ // Class Members
+ private static final long serialVersionUID = -881723607135494483L;
+
+ // Constructors
+
+ public ProxyFactoryNotRegisteredException()
+ {
+ super();
+ }
+
+ public ProxyFactoryNotRegisteredException(String message)
+ {
+ super(message);
+ }
+
+}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/RemoteProxyFactory.java
===================================================================
--- projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/RemoteProxyFactory.java 2008-04-23 20:41:05 UTC (rev 72636)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/RemoteProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,37 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.factory;
-
-import org.jboss.ejb3.proxy.ProxyFactory;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public interface RemoteProxyFactory extends ProxyFactory
-{
- public static final String DEFAULT_CLIENT_BINDING = "socket://0.0.0.0:3873";
-
-// public void setRemoteBinding(RemoteBinding binding);
-}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/RemoteProxyFactory.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/RemoteProxyFactory.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/RemoteProxyFactory.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/RemoteProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.factory;
+
+import org.jboss.ejb3.proxy.ProxyFactory;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+public interface RemoteProxyFactory extends ProxyFactory
+{
+ public static final String DEFAULT_CLIENT_BINDING = "socket://0.0.0.0:3873";
+
+// public void setRemoteBinding(RemoteBinding binding);
+}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/RemoteProxyFactoryRegistry.java
===================================================================
--- projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/RemoteProxyFactoryRegistry.java 2008-04-23 20:41:05 UTC (rev 72636)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/RemoteProxyFactoryRegistry.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,105 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2007, 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.factory;
-
-import org.jboss.ejb3.remoting.LoadBalancePolicyNotRegisteredException;
-import org.jboss.ha.client.loadbalance.LoadBalancePolicy;
-
-import java.util.Map;
-
-/**
- * Registry for all configured Remote Proxy Factory implementations
- *
- * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
- * @version $Revision: $
- */
-public class RemoteProxyFactoryRegistry
-{
- // Instance Members
- private Map<String, Class<? extends RemoteProxyFactory>> factories;
-
- private Map<String, Class<LoadBalancePolicy>> loadBalancePolicies;
-
- // Accessors / Mutators
-
- public Map<String, Class<? extends RemoteProxyFactory>> getFactories()
- {
- return factories;
- }
-
- public void setFactories(Map<String, Class<? extends RemoteProxyFactory>> factories)
- {
- this.factories = factories;
- }
-
- public Map<String, Class<LoadBalancePolicy>> getLoadBalancePolicies()
- {
- return loadBalancePolicies;
- }
-
- public void setLoadBalancePolicies(Map<String, Class<LoadBalancePolicy>> loadBalancePolicies)
- {
- this.loadBalancePolicies = loadBalancePolicies;
- }
-
- // Functional Methods
-
- /**
- * Obtains the Proxy Factory Class with the specified registered name
- *
- * @param name The registered name of the proxy factory to retrieve
- * @return The Proxy Factory
- */
- public Class<? extends RemoteProxyFactory> getProxyFactoryClass(String name) throws ProxyFactoryNotRegisteredException
- {
- // Obtain proxy factory
- Class<? extends RemoteProxyFactory> proxyFactory = this.factories.get(name);
-
- // Ensure registered
- if (proxyFactory == null)
- {
- throw new ProxyFactoryNotRegisteredException("Remoting Proxy Factory with name " + name
- + " is not registered.");
- }
-
- // Return
- return proxyFactory;
-
- }
-
- public Class<LoadBalancePolicy> getLoadBalancePolicy(String name) throws LoadBalancePolicyNotRegisteredException
- {
- // Obtain Load Balance Policy
- Class<LoadBalancePolicy> loadBalancePolicy = this.loadBalancePolicies.get(name);
-
- // Ensure registered
- if (loadBalancePolicy == null)
- {
- throw new LoadBalancePolicyNotRegisteredException("LoadBalancePolicy with name " + name
- + " is not registered.");
- }
-
- // Return
- return loadBalancePolicy;
-
- }
-}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/RemoteProxyFactoryRegistry.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/RemoteProxyFactoryRegistry.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/RemoteProxyFactoryRegistry.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/RemoteProxyFactoryRegistry.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,105 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, 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.factory;
+
+import org.jboss.ejb3.remoting.LoadBalancePolicyNotRegisteredException;
+import org.jboss.ha.client.loadbalance.LoadBalancePolicy;
+
+import java.util.Map;
+
+/**
+ * Registry for all configured Remote Proxy Factory implementations
+ *
+ * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
+ * @version $Revision: $
+ */
+public class RemoteProxyFactoryRegistry
+{
+ // Instance Members
+ private Map<String, Class<? extends RemoteProxyFactory>> factories;
+
+ private Map<String, Class<LoadBalancePolicy>> loadBalancePolicies;
+
+ // Accessors / Mutators
+
+ public Map<String, Class<? extends RemoteProxyFactory>> getFactories()
+ {
+ return factories;
+ }
+
+ public void setFactories(Map<String, Class<? extends RemoteProxyFactory>> factories)
+ {
+ this.factories = factories;
+ }
+
+ public Map<String, Class<LoadBalancePolicy>> getLoadBalancePolicies()
+ {
+ return loadBalancePolicies;
+ }
+
+ public void setLoadBalancePolicies(Map<String, Class<LoadBalancePolicy>> loadBalancePolicies)
+ {
+ this.loadBalancePolicies = loadBalancePolicies;
+ }
+
+ // Functional Methods
+
+ /**
+ * Obtains the Proxy Factory Class with the specified registered name
+ *
+ * @param name The registered name of the proxy factory to retrieve
+ * @return The Proxy Factory
+ */
+ public Class<? extends RemoteProxyFactory> getProxyFactoryClass(String name) throws ProxyFactoryNotRegisteredException
+ {
+ // Obtain proxy factory
+ Class<? extends RemoteProxyFactory> proxyFactory = this.factories.get(name);
+
+ // Ensure registered
+ if (proxyFactory == null)
+ {
+ throw new ProxyFactoryNotRegisteredException("Remoting Proxy Factory with name " + name
+ + " is not registered.");
+ }
+
+ // Return
+ return proxyFactory;
+
+ }
+
+ public Class<LoadBalancePolicy> getLoadBalancePolicy(String name) throws LoadBalancePolicyNotRegisteredException
+ {
+ // Obtain Load Balance Policy
+ Class<LoadBalancePolicy> loadBalancePolicy = this.loadBalancePolicies.get(name);
+
+ // Ensure registered
+ if (loadBalancePolicy == null)
+ {
+ throw new LoadBalancePolicyNotRegisteredException("LoadBalancePolicy with name " + name
+ + " is not registered.");
+ }
+
+ // Return
+ return loadBalancePolicy;
+
+ }
+}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/SessionProxyFactory.java
===================================================================
--- projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/SessionProxyFactory.java 2008-04-23 20:41:05 UTC (rev 72636)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/SessionProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,47 +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.factory;
-
-import org.jboss.ejb3.proxy.ProxyFactory;
-
-/**
- * SessionProxyFactory
- *
- * Contract for a Proxy Factory specific to
- * operations required by Session implementations
- *
- * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
- * @version $Revision: $
- */
-public interface SessionProxyFactory extends ProxyFactory
-{
- /**
- * Create an EJB3 Business Proxy with the specified
- * target business interface name (should be expressed as
- * a fully-qualified class name)
- *
- * @param id
- * @param businessInterfaceName
- * @return
- */
- public Object createProxyBusiness(String businessInterfaceName);
-}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/SessionProxyFactory.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/SessionProxyFactory.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/SessionProxyFactory.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/SessionProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,47 @@
+/*
+ * 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.factory;
+
+import org.jboss.ejb3.proxy.ProxyFactory;
+
+/**
+ * SessionProxyFactory
+ *
+ * Contract for a Proxy Factory specific to
+ * operations required by Session implementations
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public interface SessionProxyFactory extends ProxyFactory
+{
+ /**
+ * Create an EJB3 Business Proxy with the specified
+ * target business interface name (should be expressed as
+ * a fully-qualified class name)
+ *
+ * @param id
+ * @param businessInterfaceName
+ * @return
+ */
+ public Object createProxyBusiness(String businessInterfaceName);
+}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/service (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/service)
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/service/BaseServiceProxyFactory.java
===================================================================
--- projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/service/BaseServiceProxyFactory.java 2008-04-23 20:41:05 UTC (rev 72636)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/service/BaseServiceProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,89 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.factory.service;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationHandler;
-
-import javax.naming.NamingException;
-
-import org.jboss.ejb3.proxy.ProxyFactory;
-import org.jboss.ejb3.service.ServiceContainer;
-import org.jboss.util.naming.Util;
-
-/**
- * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
- * @version $Revision$
- */
-public abstract class BaseServiceProxyFactory implements ProxyFactory
-{
- protected Constructor<?> proxyConstructor;
- protected String jndiName;
- protected ServiceContainer container;
-
- protected BaseServiceProxyFactory(ServiceContainer container, String jndiName)
- {
- assert container != null : "container is null";
- assert jndiName != null : "jndiName is null";
-
- this.container = container;
- this.jndiName = jndiName;
- }
-
- public Object createHomeProxy()
- {
- throw new UnsupportedOperationException("service can't have a home interface");
- }
-
- public Object createProxyBusiness(Object id)
- {
- if(id != null)
- throw new IllegalArgumentException("service proxy must not have an id");
- return createProxyBusiness();
- }
-
- public void start() throws Exception
- {
- Class<?>[] interfaces = getInterfaces();
- Class<?> proxyClass = java.lang.reflect.Proxy.getProxyClass(container.getBeanClass().getClassLoader(), interfaces);
- proxyConstructor = proxyClass.getConstructor(InvocationHandler.class);
-
- try
- {
- Util.rebind(container.getInitialContext(), jndiName, createProxyBusiness());
- } catch (NamingException e)
- {
- NamingException namingException = new NamingException("Could not bind service proxy factory for EJB container with ejb name " + container.getEjbName() + " into JNDI under jndiName: " + container.getInitialContext().getNameInNamespace() + "/" + jndiName);
- namingException.setRootCause(e);
- throw namingException;
- }
- }
-
- public void stop() throws Exception
- {
- Util.unbind(container.getInitialContext(), jndiName);
- }
-
- protected abstract Class<?>[] getInterfaces();
-
- protected final void initializeJndiName() {};
-}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/service/BaseServiceProxyFactory.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/service/BaseServiceProxyFactory.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/service/BaseServiceProxyFactory.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/service/BaseServiceProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,89 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.factory.service;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationHandler;
+
+import javax.naming.NamingException;
+
+import org.jboss.ejb3.proxy.ProxyFactory;
+import org.jboss.ejb3.service.ServiceContainer;
+import org.jboss.util.naming.Util;
+
+/**
+ * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
+ * @version $Revision$
+ */
+public abstract class BaseServiceProxyFactory implements ProxyFactory
+{
+ protected Constructor<?> proxyConstructor;
+ protected String jndiName;
+ protected ServiceContainer container;
+
+ protected BaseServiceProxyFactory(ServiceContainer container, String jndiName)
+ {
+ assert container != null : "container is null";
+ assert jndiName != null : "jndiName is null";
+
+ this.container = container;
+ this.jndiName = jndiName;
+ }
+
+ public Object createHomeProxy()
+ {
+ throw new UnsupportedOperationException("service can't have a home interface");
+ }
+
+ public Object createProxyBusiness(Object id)
+ {
+ if(id != null)
+ throw new IllegalArgumentException("service proxy must not have an id");
+ return createProxyBusiness();
+ }
+
+ public void start() throws Exception
+ {
+ Class<?>[] interfaces = getInterfaces();
+ Class<?> proxyClass = java.lang.reflect.Proxy.getProxyClass(container.getBeanClass().getClassLoader(), interfaces);
+ proxyConstructor = proxyClass.getConstructor(InvocationHandler.class);
+
+ try
+ {
+ Util.rebind(container.getInitialContext(), jndiName, createProxyBusiness());
+ } catch (NamingException e)
+ {
+ NamingException namingException = new NamingException("Could not bind service proxy factory for EJB container with ejb name " + container.getEjbName() + " into JNDI under jndiName: " + container.getInitialContext().getNameInNamespace() + "/" + jndiName);
+ namingException.setRootCause(e);
+ throw namingException;
+ }
+ }
+
+ public void stop() throws Exception
+ {
+ Util.unbind(container.getInitialContext(), jndiName);
+ }
+
+ protected abstract Class<?>[] getInterfaces();
+
+ protected final void initializeJndiName() {};
+}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/service/ServiceLocalProxyFactory.java
===================================================================
--- projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/service/ServiceLocalProxyFactory.java 2008-04-23 20:41:05 UTC (rev 72636)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/service/ServiceLocalProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,87 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.factory.service;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.jboss.ejb3.annotation.LocalBinding;
-import org.jboss.ejb3.proxy.JBossProxy;
-import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
-import org.jboss.ejb3.proxy.handler.service.ServiceLocalProxyInvocationHandler;
-import org.jboss.ejb3.service.ServiceContainer;
-
-
-/**
- * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
- * @version $Revision$
- */
-public class ServiceLocalProxyFactory extends BaseServiceProxyFactory
-{
- public ServiceLocalProxyFactory(ServiceContainer container, LocalBinding binding)
- {
- super(container, binding.jndiBinding());
- }
-
- protected Class<?>[] getInterfaces()
- {
- // Initialize
- Set<Class<?>> uniqueInterfaces = new HashSet<Class<?>>();
-
- // Obtain interfaces and add as unique
- uniqueInterfaces.addAll(Arrays.asList(ProxyFactoryHelper.getLocalAndBusinessLocalInterfaces(container))) ;
-
- // Add JBossProxy
- uniqueInterfaces.add(JBossProxy.class);
-
- // Return
- return uniqueInterfaces.toArray(new Class<?>[]{});
- }
-
- public Object createProxyBusiness()
- {
- try
- {
- Object[] args = {new ServiceLocalProxyInvocationHandler(container)};
- return proxyConstructor.newInstance(args);
- }
- catch (InstantiationException e)
- {
- throw new RuntimeException(e);
- }
- catch (IllegalAccessException e)
- {
- throw new RuntimeException(e);
- }
- catch (IllegalArgumentException e)
- {
- throw new RuntimeException(e);
- }
- catch (InvocationTargetException e)
- {
- throw new RuntimeException(e.getTargetException());
- }
- }
-
-}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/service/ServiceLocalProxyFactory.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/service/ServiceLocalProxyFactory.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/service/ServiceLocalProxyFactory.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/service/ServiceLocalProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,87 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.factory.service;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.ejb3.annotation.LocalBinding;
+import org.jboss.ejb3.proxy.JBossProxy;
+import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
+import org.jboss.ejb3.proxy.handler.service.ServiceLocalProxyInvocationHandler;
+import org.jboss.ejb3.service.ServiceContainer;
+
+
+/**
+ * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
+ * @version $Revision$
+ */
+public class ServiceLocalProxyFactory extends BaseServiceProxyFactory
+{
+ public ServiceLocalProxyFactory(ServiceContainer container, LocalBinding binding)
+ {
+ super(container, binding.jndiBinding());
+ }
+
+ protected Class<?>[] getInterfaces()
+ {
+ // Initialize
+ Set<Class<?>> uniqueInterfaces = new HashSet<Class<?>>();
+
+ // Obtain interfaces and add as unique
+ uniqueInterfaces.addAll(Arrays.asList(ProxyFactoryHelper.getLocalAndBusinessLocalInterfaces(container))) ;
+
+ // Add JBossProxy
+ uniqueInterfaces.add(JBossProxy.class);
+
+ // Return
+ return uniqueInterfaces.toArray(new Class<?>[]{});
+ }
+
+ public Object createProxyBusiness()
+ {
+ try
+ {
+ Object[] args = {new ServiceLocalProxyInvocationHandler(container)};
+ return proxyConstructor.newInstance(args);
+ }
+ catch (InstantiationException e)
+ {
+ throw new RuntimeException(e);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new RuntimeException(e);
+ }
+ catch (IllegalArgumentException e)
+ {
+ throw new RuntimeException(e);
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new RuntimeException(e.getTargetException());
+ }
+ }
+
+}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/service/ServiceRemoteProxyFactory.java
===================================================================
--- projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/service/ServiceRemoteProxyFactory.java 2008-04-23 20:41:05 UTC (rev 72636)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/service/ServiceRemoteProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,114 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.factory.service;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.aop.advice.AdviceStack;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.proxy.JBossProxy;
-import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
-import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
-import org.jboss.ejb3.proxy.handler.service.ServiceRemoteProxyInvocationHandler;
-import org.jboss.ejb3.service.ServiceContainer;
-import org.jboss.remoting.InvokerLocator;
-
-
-/**
- * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
- * @version $Revision$
- */
-public class ServiceRemoteProxyFactory extends BaseServiceProxyFactory implements RemoteProxyFactory
-{
- private RemoteBinding binding;
- private InvokerLocator locator;
-
- public ServiceRemoteProxyFactory(ServiceContainer container, RemoteBinding binding)
- {
- super(container, binding.jndiBinding());
-
- this.binding = binding;
- }
-
-// public void setRemoteBinding(RemoteBinding binding)
-// {
-// this.binding = binding;
-// }
-
- protected Class<?>[] getInterfaces()
- {
- // Initialize
- Set<Class<?>> uniqueInterfaces = new HashSet<Class<?>>();
-
- // Obtain interfaces and add as unique
- uniqueInterfaces.addAll(Arrays.asList(ProxyFactoryHelper.getRemoteAndBusinessRemoteInterfaces(container)));
-
- // Add JBossProxy
- uniqueInterfaces.add(JBossProxy.class);
-
- // Return
- return uniqueInterfaces.toArray(new Class<?>[]{});
- }
-
- public void start() throws Exception
- {
- String clientBindUrl = ProxyFactoryHelper.getClientBindUrl(binding);
- locator = new InvokerLocator(clientBindUrl);
- super.start();
- }
-
- public Object createProxyBusiness()
- {
- try
- {
- String stackName = "ServiceClientInterceptors";
- if (binding.interceptorStack() != null && !binding.interceptorStack().equals(""))
- {
- stackName = binding.interceptorStack();
- }
- AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
- Object[] args = {new ServiceRemoteProxyInvocationHandler(container, stack.createInterceptors(container.getAdvisor(), null), locator)};
- return proxyConstructor.newInstance(args);
- }
- catch (InstantiationException e)
- {
- throw new RuntimeException(e);
- }
- catch (IllegalAccessException e)
- {
- throw new RuntimeException(e);
- }
- catch (IllegalArgumentException e)
- {
- throw new RuntimeException(e);
- }
- catch (InvocationTargetException e)
- {
- throw new RuntimeException(e.getTargetException());
- }
- }
-
-}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/service/ServiceRemoteProxyFactory.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/service/ServiceRemoteProxyFactory.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/service/ServiceRemoteProxyFactory.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/service/ServiceRemoteProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,114 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.factory.service;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.advice.AdviceStack;
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.proxy.JBossProxy;
+import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
+import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
+import org.jboss.ejb3.proxy.handler.service.ServiceRemoteProxyInvocationHandler;
+import org.jboss.ejb3.service.ServiceContainer;
+import org.jboss.remoting.InvokerLocator;
+
+
+/**
+ * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
+ * @version $Revision$
+ */
+public class ServiceRemoteProxyFactory extends BaseServiceProxyFactory implements RemoteProxyFactory
+{
+ private RemoteBinding binding;
+ private InvokerLocator locator;
+
+ public ServiceRemoteProxyFactory(ServiceContainer container, RemoteBinding binding)
+ {
+ super(container, binding.jndiBinding());
+
+ this.binding = binding;
+ }
+
+// public void setRemoteBinding(RemoteBinding binding)
+// {
+// this.binding = binding;
+// }
+
+ protected Class<?>[] getInterfaces()
+ {
+ // Initialize
+ Set<Class<?>> uniqueInterfaces = new HashSet<Class<?>>();
+
+ // Obtain interfaces and add as unique
+ uniqueInterfaces.addAll(Arrays.asList(ProxyFactoryHelper.getRemoteAndBusinessRemoteInterfaces(container)));
+
+ // Add JBossProxy
+ uniqueInterfaces.add(JBossProxy.class);
+
+ // Return
+ return uniqueInterfaces.toArray(new Class<?>[]{});
+ }
+
+ public void start() throws Exception
+ {
+ String clientBindUrl = ProxyFactoryHelper.getClientBindUrl(binding);
+ locator = new InvokerLocator(clientBindUrl);
+ super.start();
+ }
+
+ public Object createProxyBusiness()
+ {
+ try
+ {
+ String stackName = "ServiceClientInterceptors";
+ if (binding.interceptorStack() != null && !binding.interceptorStack().equals(""))
+ {
+ stackName = binding.interceptorStack();
+ }
+ AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
+ Object[] args = {new ServiceRemoteProxyInvocationHandler(container, stack.createInterceptors(container.getAdvisor(), null), locator)};
+ return proxyConstructor.newInstance(args);
+ }
+ catch (InstantiationException e)
+ {
+ throw new RuntimeException(e);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new RuntimeException(e);
+ }
+ catch (IllegalArgumentException e)
+ {
+ throw new RuntimeException(e);
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new RuntimeException(e.getTargetException());
+ }
+ }
+
+}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful)
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulProxyFactory.java
===================================================================
--- projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulProxyFactory.java 2008-04-23 20:41:05 UTC (rev 72636)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,137 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.factory.stateful;
-
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-
-import javax.naming.Context;
-import javax.naming.Name;
-import javax.naming.NamingException;
-import javax.naming.RefAddr;
-import javax.naming.Reference;
-import javax.naming.StringRefAddr;
-
-import org.jboss.ejb3.proxy.JndiSessionProxyObjectFactory;
-import org.jboss.ejb3.proxy.ProxyFactory;
-import org.jboss.ejb3.proxy.factory.BaseSessionProxyFactory;
-import org.jboss.ejb3.session.SessionSpecContainer;
-import org.jboss.logging.Logger;
-import org.jboss.util.naming.Util;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public abstract class BaseStatefulProxyFactory extends BaseSessionProxyFactory implements ProxyFactory
-{
- // Class Members
-
- @SuppressWarnings("unused")
- private static final Logger log = Logger.getLogger(BaseStatefulProxyFactory.class);
-
- public static final String PROXY_FACTORY_NAME = "StatefulProxyFactory";
-
- /**
- * Do not call, only for externalizable
- */
- protected BaseStatefulProxyFactory()
- {
- super();
- }
-
- public BaseStatefulProxyFactory(SessionSpecContainer container, String jndiName)
- {
- super(container);
-
- assert jndiName != null : "jndiName is null";
-
- this.jndiName = jndiName;
- }
-
- public void init() throws Exception
- {
- // Ensure EJB2.1 View is Complete
- this.validateEjb21Views();
-
- // Create the Proxy Constructors
- this.createProxyConstructors();
- }
-
- public void start() throws Exception
- {
- this.init();
-
- // Bind the Proxy Factory
- Context ctx = getContainer().getInitialContext();
- Name name = ctx.getNameParser("").parse(jndiName);
- ctx = Util.createSubcontext(ctx, name.getPrefix(name.size() - 1));
- String atom = name.get(name.size() - 1);
- RefAddr refAddr = new StringRefAddr(JndiSessionProxyObjectFactory.REF_ADDR_NAME_JNDI_BINDING_DELEGATE_PROXY_FACTORY, jndiName + PROXY_FACTORY_NAME);
- Reference ref = new Reference(Object.class.getName(), refAddr, JndiSessionProxyObjectFactory.class.getName(), null);
- try
- {
- log.debug("Binding reference for " + getContainer().getEjbName() + " in JNDI at " + atom);
- Util.rebind(ctx, atom, ref);
- }
- catch (NamingException e)
- {
- NamingException namingException = new NamingException("Could not bind stateful proxy with ejb name "
- + getContainer().getEjbName() + " into JNDI under jndiName: " + ctx.getNameInNamespace() + "/" + atom);
- namingException.setRootCause(e);
- throw namingException;
- }
- }
-
- public void stop() throws Exception
- {
- Util.unbind(getContainer().getInitialContext(), jndiName);
- }
-
- protected final void initializeJndiName() {};
-
- @Override
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- {
- super.readExternal(in);
- try
- {
- init();
- }
- catch(Exception e)
- {
- log.error(e.getMessage(), e);
- throw new IOException(e.getMessage());
- }
- this.jndiName = in.readUTF();
- }
-
- @Override
- public void writeExternal(ObjectOutput out) throws IOException
- {
- super.writeExternal(out);
- out.writeUTF(jndiName);
- }
-}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulProxyFactory.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulProxyFactory.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulProxyFactory.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,137 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.factory.stateful;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
+import javax.naming.Context;
+import javax.naming.Name;
+import javax.naming.NamingException;
+import javax.naming.RefAddr;
+import javax.naming.Reference;
+import javax.naming.StringRefAddr;
+
+import org.jboss.ejb3.proxy.JndiSessionProxyObjectFactory;
+import org.jboss.ejb3.proxy.ProxyFactory;
+import org.jboss.ejb3.proxy.factory.BaseSessionProxyFactory;
+import org.jboss.ejb3.session.SessionSpecContainer;
+import org.jboss.logging.Logger;
+import org.jboss.util.naming.Util;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+public abstract class BaseStatefulProxyFactory extends BaseSessionProxyFactory implements ProxyFactory
+{
+ // Class Members
+
+ @SuppressWarnings("unused")
+ private static final Logger log = Logger.getLogger(BaseStatefulProxyFactory.class);
+
+ public static final String PROXY_FACTORY_NAME = "StatefulProxyFactory";
+
+ /**
+ * Do not call, only for externalizable
+ */
+ protected BaseStatefulProxyFactory()
+ {
+ super();
+ }
+
+ public BaseStatefulProxyFactory(SessionSpecContainer container, String jndiName)
+ {
+ super(container);
+
+ assert jndiName != null : "jndiName is null";
+
+ this.jndiName = jndiName;
+ }
+
+ public void init() throws Exception
+ {
+ // Ensure EJB2.1 View is Complete
+ this.validateEjb21Views();
+
+ // Create the Proxy Constructors
+ this.createProxyConstructors();
+ }
+
+ public void start() throws Exception
+ {
+ this.init();
+
+ // Bind the Proxy Factory
+ Context ctx = getContainer().getInitialContext();
+ Name name = ctx.getNameParser("").parse(jndiName);
+ ctx = Util.createSubcontext(ctx, name.getPrefix(name.size() - 1));
+ String atom = name.get(name.size() - 1);
+ RefAddr refAddr = new StringRefAddr(JndiSessionProxyObjectFactory.REF_ADDR_NAME_JNDI_BINDING_DELEGATE_PROXY_FACTORY, jndiName + PROXY_FACTORY_NAME);
+ Reference ref = new Reference(Object.class.getName(), refAddr, JndiSessionProxyObjectFactory.class.getName(), null);
+ try
+ {
+ log.debug("Binding reference for " + getContainer().getEjbName() + " in JNDI at " + atom);
+ Util.rebind(ctx, atom, ref);
+ }
+ catch (NamingException e)
+ {
+ NamingException namingException = new NamingException("Could not bind stateful proxy with ejb name "
+ + getContainer().getEjbName() + " into JNDI under jndiName: " + ctx.getNameInNamespace() + "/" + atom);
+ namingException.setRootCause(e);
+ throw namingException;
+ }
+ }
+
+ public void stop() throws Exception
+ {
+ Util.unbind(getContainer().getInitialContext(), jndiName);
+ }
+
+ protected final void initializeJndiName() {};
+
+ @Override
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
+ {
+ super.readExternal(in);
+ try
+ {
+ init();
+ }
+ catch(Exception e)
+ {
+ log.error(e.getMessage(), e);
+ throw new IOException(e.getMessage());
+ }
+ this.jndiName = in.readUTF();
+ }
+
+ @Override
+ public void writeExternal(ObjectOutput out) throws IOException
+ {
+ super.writeExternal(out);
+ out.writeUTF(jndiName);
+ }
+}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulRemoteProxyFactory.java
===================================================================
--- projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulRemoteProxyFactory.java 2008-04-23 20:41:05 UTC (rev 72636)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulRemoteProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,203 +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.factory.stateful;
-
-import javax.ejb.EJBObject;
-import javax.ejb.RemoteHome;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.aop.advice.AdviceStack;
-import org.jboss.ejb3.SpecificationInterfaceType;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
-import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
-import org.jboss.ejb3.proxy.handler.stateful.StatefulRemoteProxyInvocationHandler;
-import org.jboss.ejb3.session.ProxyAccessType;
-import org.jboss.ejb3.session.SessionContainer;
-import org.jboss.ejb3.session.SessionSpecContainer;
-import org.jboss.ejb3.stateful.StatefulHandleRemoteImpl;
-import org.jboss.logging.Logger;
-import org.jboss.remoting.InvokerLocator;
-
-/**
- * BaseStatefulRemoteProxyFactory
- *
- * Common base for factories generating remoting-enabled
- * proxies (ie. remote and clustering)
- *
- * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
- * @version $Revision: $
- */
-public abstract class BaseStatefulRemoteProxyFactory extends BaseStatefulProxyFactory implements RemoteProxyFactory
-{
- // Class Members
-
- private static final Logger log = Logger.getLogger(BaseStatefulRemoteProxyFactory.class);
-
- // Instance Members
-
- private RemoteBinding binding;
-
- private InvokerLocator locator;
-
- // Constructor
- public BaseStatefulRemoteProxyFactory(SessionSpecContainer container, RemoteBinding binding)
- {
- super(container, binding.jndiBinding());
-
- this.binding = binding;
-
- try
- {
- String clientBindUrl = ProxyFactoryHelper.getClientBindUrl(this.getBinding());
- this.locator = new InvokerLocator(clientBindUrl);
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- }
-
- // Required Implementations
-
- @Override
- protected ProxyAccessType getProxyAccessType()
- {
- return ProxyAccessType.REMOTE;
- }
-
- @Override
- protected void validateEjb21Views()
- {
- // Obtain Container
- SessionContainer container = this.getContainer();
-
- // Obtain @RemoteHome
- RemoteHome remoteHome = container.getAnnotation(RemoteHome.class);
-
- // Ensure that if EJB 2.1 Components are defined, they're complete
- this.validateEjb21Views(remoteHome == null ? null : remoteHome.value(), ProxyFactoryHelper
- .getRemoteInterfaces(container));
- }
-
- public Object createProxyBusiness()
- {
- return this.createProxyBusiness(null);
- }
-
- public Object createProxyBusiness(String businessInterfaceType)
- {
- Object id = getContainer().createSession();
- return this.createProxyBusiness(id, businessInterfaceType);
- }
-
- public Object createProxyBusiness(Object id, String businessInterfaceType)
- {
- return this.createProxy(id,SpecificationInterfaceType.EJB30_BUSINESS, businessInterfaceType);
- }
-
- // Specifications
-
- abstract String getStackNameInterceptors();
-
- // Functional Methods
-
- @Override
- protected boolean bindHomeAndBusinessTogether()
- {
- SessionSpecContainer container = this.getContainer();
- String homeJndiName = ProxyFactoryHelper.getHomeJndiName(container);
- String remoteBusinessJndiName = ProxyFactoryHelper.getRemoteBusinessJndiName(container);
- return homeJndiName.equals(remoteBusinessJndiName);
- }
-
- Object createProxy(Object id,SpecificationInterfaceType type, String businessInterfaceType)
- {
- String stackName = this.getStackNameInterceptors();
- RemoteBinding binding = this.getBinding();
- if (binding.interceptorStack() != null && !binding.interceptorStack().trim().equals(""))
- {
- stackName = binding.interceptorStack();
- }
- AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
- if (stack == null) throw new RuntimeException("unable to find interceptor stack: " + stackName);
- StatefulRemoteProxyInvocationHandler proxy = new StatefulRemoteProxyInvocationHandler(getContainer(), stack.createInterceptors(getContainer()
- .getAdvisor(), null), this.getLocator(), id, businessInterfaceType);
-
- if(type.equals(SpecificationInterfaceType.EJB21))
- {
- this.getContainer();
- return this.constructEjb21Proxy(proxy);
- }
- else
- {
- return this.constructProxyBusiness(proxy);
- }
- }
-
- @Override
- protected StatefulHandleRemoteImpl createHandle()
- {
- EJBObject proxy = this.createProxyEjb21(null);
- return this.createHandle(proxy);
- }
-
- protected StatefulHandleRemoteImpl createHandle(EJBObject proxy)
- {
- StatefulHandleRemoteImpl handle = new StatefulHandleRemoteImpl(proxy);
- return handle;
- }
-
- public EJBObject createProxyEjb21(String businessInterfaceType)
- {
- Object id = getContainer().createSession();
- return this.createProxyEjb21(id, businessInterfaceType);
- }
-
- @SuppressWarnings("unchecked")
- public <T extends EJBObject> T createProxyEjb21(Object id, String businessInterfaceType)
- {
- // Cast explicitly to catch improper proxies
- return (T) this.createProxy(id, SpecificationInterfaceType.EJB21, businessInterfaceType);
- }
-
- @Override
- public void start() throws Exception
- {
- super.start();
- }
-
- // Accessors / Mutators
-
- RemoteBinding getBinding()
- {
- assert this.binding!=null : "RemoteBinding has not been initialized";
- return this.binding;
- }
-
- InvokerLocator getLocator()
- {
- assert this.locator!=null : "InvokerLocator has not been initialized";
- return this.locator;
- }
-
-}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulRemoteProxyFactory.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulRemoteProxyFactory.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulRemoteProxyFactory.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulRemoteProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,203 @@
+/*
+ * 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.factory.stateful;
+
+import javax.ejb.EJBObject;
+import javax.ejb.RemoteHome;
+
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.advice.AdviceStack;
+import org.jboss.ejb3.SpecificationInterfaceType;
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
+import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
+import org.jboss.ejb3.proxy.handler.stateful.StatefulRemoteProxyInvocationHandler;
+import org.jboss.ejb3.session.ProxyAccessType;
+import org.jboss.ejb3.session.SessionContainer;
+import org.jboss.ejb3.session.SessionSpecContainer;
+import org.jboss.ejb3.stateful.StatefulHandleRemoteImpl;
+import org.jboss.logging.Logger;
+import org.jboss.remoting.InvokerLocator;
+
+/**
+ * BaseStatefulRemoteProxyFactory
+ *
+ * Common base for factories generating remoting-enabled
+ * proxies (ie. remote and clustering)
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public abstract class BaseStatefulRemoteProxyFactory extends BaseStatefulProxyFactory implements RemoteProxyFactory
+{
+ // Class Members
+
+ private static final Logger log = Logger.getLogger(BaseStatefulRemoteProxyFactory.class);
+
+ // Instance Members
+
+ private RemoteBinding binding;
+
+ private InvokerLocator locator;
+
+ // Constructor
+ public BaseStatefulRemoteProxyFactory(SessionSpecContainer container, RemoteBinding binding)
+ {
+ super(container, binding.jndiBinding());
+
+ this.binding = binding;
+
+ try
+ {
+ String clientBindUrl = ProxyFactoryHelper.getClientBindUrl(this.getBinding());
+ this.locator = new InvokerLocator(clientBindUrl);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ // Required Implementations
+
+ @Override
+ protected ProxyAccessType getProxyAccessType()
+ {
+ return ProxyAccessType.REMOTE;
+ }
+
+ @Override
+ protected void validateEjb21Views()
+ {
+ // Obtain Container
+ SessionContainer container = this.getContainer();
+
+ // Obtain @RemoteHome
+ RemoteHome remoteHome = container.getAnnotation(RemoteHome.class);
+
+ // Ensure that if EJB 2.1 Components are defined, they're complete
+ this.validateEjb21Views(remoteHome == null ? null : remoteHome.value(), ProxyFactoryHelper
+ .getRemoteInterfaces(container));
+ }
+
+ public Object createProxyBusiness()
+ {
+ return this.createProxyBusiness(null);
+ }
+
+ public Object createProxyBusiness(String businessInterfaceType)
+ {
+ Object id = getContainer().createSession();
+ return this.createProxyBusiness(id, businessInterfaceType);
+ }
+
+ public Object createProxyBusiness(Object id, String businessInterfaceType)
+ {
+ return this.createProxy(id,SpecificationInterfaceType.EJB30_BUSINESS, businessInterfaceType);
+ }
+
+ // Specifications
+
+ abstract String getStackNameInterceptors();
+
+ // Functional Methods
+
+ @Override
+ protected boolean bindHomeAndBusinessTogether()
+ {
+ SessionSpecContainer container = this.getContainer();
+ String homeJndiName = ProxyFactoryHelper.getHomeJndiName(container);
+ String remoteBusinessJndiName = ProxyFactoryHelper.getRemoteBusinessJndiName(container);
+ return homeJndiName.equals(remoteBusinessJndiName);
+ }
+
+ Object createProxy(Object id,SpecificationInterfaceType type, String businessInterfaceType)
+ {
+ String stackName = this.getStackNameInterceptors();
+ RemoteBinding binding = this.getBinding();
+ if (binding.interceptorStack() != null && !binding.interceptorStack().trim().equals(""))
+ {
+ stackName = binding.interceptorStack();
+ }
+ AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
+ if (stack == null) throw new RuntimeException("unable to find interceptor stack: " + stackName);
+ StatefulRemoteProxyInvocationHandler proxy = new StatefulRemoteProxyInvocationHandler(getContainer(), stack.createInterceptors(getContainer()
+ .getAdvisor(), null), this.getLocator(), id, businessInterfaceType);
+
+ if(type.equals(SpecificationInterfaceType.EJB21))
+ {
+ this.getContainer();
+ return this.constructEjb21Proxy(proxy);
+ }
+ else
+ {
+ return this.constructProxyBusiness(proxy);
+ }
+ }
+
+ @Override
+ protected StatefulHandleRemoteImpl createHandle()
+ {
+ EJBObject proxy = this.createProxyEjb21(null);
+ return this.createHandle(proxy);
+ }
+
+ protected StatefulHandleRemoteImpl createHandle(EJBObject proxy)
+ {
+ StatefulHandleRemoteImpl handle = new StatefulHandleRemoteImpl(proxy);
+ return handle;
+ }
+
+ public EJBObject createProxyEjb21(String businessInterfaceType)
+ {
+ Object id = getContainer().createSession();
+ return this.createProxyEjb21(id, businessInterfaceType);
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T extends EJBObject> T createProxyEjb21(Object id, String businessInterfaceType)
+ {
+ // Cast explicitly to catch improper proxies
+ return (T) this.createProxy(id, SpecificationInterfaceType.EJB21, businessInterfaceType);
+ }
+
+ @Override
+ public void start() throws Exception
+ {
+ super.start();
+ }
+
+ // Accessors / Mutators
+
+ RemoteBinding getBinding()
+ {
+ assert this.binding!=null : "RemoteBinding has not been initialized";
+ return this.binding;
+ }
+
+ InvokerLocator getLocator()
+ {
+ assert this.locator!=null : "InvokerLocator has not been initialized";
+ return this.locator;
+ }
+
+}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulClusterProxyFactory.java
===================================================================
--- projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulClusterProxyFactory.java 2008-04-23 20:41:05 UTC (rev 72636)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulClusterProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,241 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.factory.stateful;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.ejb.RemoteHome;
-import javax.naming.NamingException;
-
-import org.jboss.aop.Dispatcher;
-import org.jboss.aspects.remoting.FamilyWrapper;
-import org.jboss.aspects.remoting.Remoting;
-import org.jboss.ejb3.annotation.Clustered;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.annotation.defaults.ClusteredDefaults;
-import org.jboss.ejb3.proxy.ProxyFactory;
-import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
-import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
-import org.jboss.ejb3.proxy.factory.RemoteProxyFactoryRegistry;
-import org.jboss.ejb3.remoting.LoadBalancePolicyNotRegisteredException;
-import org.jboss.ejb3.session.ProxyAccessType;
-import org.jboss.ejb3.session.SessionContainer;
-import org.jboss.ejb3.session.SessionSpecContainer;
-import org.jboss.ha.client.loadbalance.FirstAvailable;
-import org.jboss.ha.client.loadbalance.LoadBalancePolicy;
-import org.jboss.ha.framework.interfaces.ClusteringTargetsRepository;
-import org.jboss.ha.framework.interfaces.DistributedReplicantManager;
-import org.jboss.ha.framework.interfaces.HAPartition;
-import org.jboss.ha.framework.server.HATarget;
-import org.jboss.logging.Logger;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.util.NotImplementedException;
-import org.jboss.util.naming.Util;
-
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @author Brian Stansberry
- *
- * @version $Revision$
- */
-public class StatefulClusterProxyFactory extends BaseStatefulRemoteProxyFactory
- implements RemoteProxyFactory, DistributedReplicantManager.ReplicantListener
-{
- private static final Logger log = Logger.getLogger(StatefulClusterProxyFactory.class);
-
- private static String STACK_NAME_CLUSTERED_STATEFUL_SESSION_CLIENT_INTERCEPTORS = "ClusteredStatefulSessionClientInterceptors";
-
- private Clustered clustered;
- private DistributedReplicantManager drm;
- private HATarget hatarget;
- private String proxyFamilyName;
- private LoadBalancePolicy lbPolicy;
- private FamilyWrapper wrapper;
-
- public StatefulClusterProxyFactory(SessionSpecContainer container, RemoteBinding binding, Clustered clustered)
- {
- super(container, binding);
-
- assert clustered != null : "clustered is null";
-
- this.clustered = clustered;
- }
-
- /**
- * Returns the interface type for Home
- *
- * @return
- */
- @Override
- protected Class<?> getHomeType()
- {
- // Not Supported
- return null;
- }
-
- /**
- * Defines the access type for this Proxies created by this Factory
- *
- * @return
- */
- @Override
- protected ProxyAccessType getProxyAccessType(){
- return ProxyAccessType.REMOTE;
- }
-
- /**
- * Whether or not to bind the home and business interfaces together
- *
- * @return
- */
- @Override
- protected boolean bindHomeAndBusinessTogether()
- {
- // Not Supported
- return false;
- }
-
- protected void validateEjb21Views()
- {
- // Obtain Container
- SessionContainer container = this.getContainer();
-
- // Obtain @RemoteHome
- RemoteHome remoteHome = container.getAnnotation(RemoteHome.class);
-
- // Ensure that if EJB 2.1 Components are defined, they're complete
- this.validateEjb21Views(remoteHome == null ? null : remoteHome.value(), ProxyFactoryHelper
- .getRemoteInterfaces(container));
-
- }
-
- public void start() throws Exception
- {
- this.init();
-
- RemoteBinding binding = this.getBinding();
- InvokerLocator locator = this.getLocator();
- SessionContainer container = this.getContainer();
- String partitionName = container.getPartitionName();
- proxyFamilyName = container.getDeploymentQualifiedName() + locator.getProtocol() + partitionName;
- HAPartition partition = (HAPartition) this.getContainer().getInitialContext().lookup(
- "/HAPartition/" + partitionName);
- hatarget = new HATarget(partition, proxyFamilyName, locator, HATarget.ENABLE_INVOCATIONS);
- ClusteringTargetsRepository.initTarget(proxyFamilyName, hatarget.getReplicants());
- container.getClusterFamilies().put(proxyFamilyName, hatarget);
-
- if (clustered.loadBalancePolicy() == null || clustered.loadBalancePolicy().equals(ClusteredDefaults.LOAD_BALANCE_POLICY_DEFAULT))
- {
- lbPolicy = new FirstAvailable();
- }
- else
- {
- String policyClass = clustered.loadBalancePolicy();
- try
- {
- RemoteProxyFactoryRegistry registry = container.getDeployment().getRemoteProxyFactoryRegistry();
- Class<LoadBalancePolicy> policy = registry.getLoadBalancePolicy(policyClass);
- policyClass = policy.getName();
- }
- catch (LoadBalancePolicyNotRegisteredException e){}
-
- lbPolicy = (LoadBalancePolicy)Thread.currentThread().getContextClassLoader().loadClass(policyClass)
- .newInstance();
- }
- wrapper = new FamilyWrapper(proxyFamilyName, hatarget.getReplicants());
-
- this.drm = partition.getDistributedReplicantManager();
- drm.registerListener(proxyFamilyName, this);
-
- super.start();
-
- Class<?>[] interfaces = {ProxyFactory.class};
- String targetId = getTargetId();
- Object factoryProxy = Remoting.createPojiProxy(targetId, interfaces, ProxyFactoryHelper.getClientBindUrl(binding));
- try
- {
- Util.rebind(getContainer().getInitialContext(), jndiName + PROXY_FACTORY_NAME, factoryProxy);
- } catch (NamingException e)
- {
- NamingException namingException = new NamingException("Could not bind stateful cluster proxy with ejb name "
- + getContainer().getEjbName() + " into JNDI under jndiName: "
- + getContainer().getInitialContext().getNameInNamespace() + "/" + jndiName + PROXY_FACTORY_NAME);
- namingException.setRootCause(e);
- throw namingException;
- }
- assert !Dispatcher.singleton.isRegistered(targetId) : targetId + " is already registered";
- Dispatcher.singleton.registerTarget(targetId, this);
-
- }
-
- @Override
- String getStackNameInterceptors()
- {
- return StatefulClusterProxyFactory.STACK_NAME_CLUSTERED_STATEFUL_SESSION_CLIENT_INTERCEPTORS;
- }
-
- public Object createProxyBusiness(Object id)
- {
- throw new RuntimeException("NYI");
- }
-
- public void stop() throws Exception
- {
- Dispatcher.singleton.unregisterTarget(getTargetId());
- hatarget.destroy();
- drm.unregisterListener(proxyFamilyName, this);
- this.getContainer().getClusterFamilies().remove(proxyFamilyName);
- Util.unbind(getContainer().getInitialContext(), jndiName + PROXY_FACTORY_NAME);
- super.stop();
- }
-
- /**
- * @return unique name for this proxy factory
- */
- protected String getTargetId()
- {
- assert jndiName != null : "jndiName is null";
- String partition = ((SessionContainer) getContainer()).getPartitionName();
- return jndiName + PROXY_FACTORY_NAME + "@" + partition;
- }
-
- public synchronized void replicantsChanged (String key,
- List newReplicants,
- int newReplicantsViewId,
- boolean merge)
- {
- try
- {
- // Update the FamilyClusterInfo with the new targets
- ArrayList targets = new ArrayList(newReplicants);
- wrapper.get().updateClusterInfo(targets, newReplicantsViewId);
- }
- catch (Exception e)
- {
- log.error(e);
- }
- }
-}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulClusterProxyFactory.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulClusterProxyFactory.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulClusterProxyFactory.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulClusterProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,241 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.factory.stateful;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.ejb.RemoteHome;
+import javax.naming.NamingException;
+
+import org.jboss.aop.Dispatcher;
+import org.jboss.aspects.remoting.FamilyWrapper;
+import org.jboss.aspects.remoting.Remoting;
+import org.jboss.ejb3.annotation.Clustered;
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.annotation.defaults.ClusteredDefaults;
+import org.jboss.ejb3.proxy.ProxyFactory;
+import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
+import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
+import org.jboss.ejb3.proxy.factory.RemoteProxyFactoryRegistry;
+import org.jboss.ejb3.remoting.LoadBalancePolicyNotRegisteredException;
+import org.jboss.ejb3.session.ProxyAccessType;
+import org.jboss.ejb3.session.SessionContainer;
+import org.jboss.ejb3.session.SessionSpecContainer;
+import org.jboss.ha.client.loadbalance.FirstAvailable;
+import org.jboss.ha.client.loadbalance.LoadBalancePolicy;
+import org.jboss.ha.framework.interfaces.ClusteringTargetsRepository;
+import org.jboss.ha.framework.interfaces.DistributedReplicantManager;
+import org.jboss.ha.framework.interfaces.HAPartition;
+import org.jboss.ha.framework.server.HATarget;
+import org.jboss.logging.Logger;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.util.NotImplementedException;
+import org.jboss.util.naming.Util;
+
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @author Brian Stansberry
+ *
+ * @version $Revision$
+ */
+public class StatefulClusterProxyFactory extends BaseStatefulRemoteProxyFactory
+ implements RemoteProxyFactory, DistributedReplicantManager.ReplicantListener
+{
+ private static final Logger log = Logger.getLogger(StatefulClusterProxyFactory.class);
+
+ private static String STACK_NAME_CLUSTERED_STATEFUL_SESSION_CLIENT_INTERCEPTORS = "ClusteredStatefulSessionClientInterceptors";
+
+ private Clustered clustered;
+ private DistributedReplicantManager drm;
+ private HATarget hatarget;
+ private String proxyFamilyName;
+ private LoadBalancePolicy lbPolicy;
+ private FamilyWrapper wrapper;
+
+ public StatefulClusterProxyFactory(SessionSpecContainer container, RemoteBinding binding, Clustered clustered)
+ {
+ super(container, binding);
+
+ assert clustered != null : "clustered is null";
+
+ this.clustered = clustered;
+ }
+
+ /**
+ * Returns the interface type for Home
+ *
+ * @return
+ */
+ @Override
+ protected Class<?> getHomeType()
+ {
+ // Not Supported
+ return null;
+ }
+
+ /**
+ * Defines the access type for this Proxies created by this Factory
+ *
+ * @return
+ */
+ @Override
+ protected ProxyAccessType getProxyAccessType(){
+ return ProxyAccessType.REMOTE;
+ }
+
+ /**
+ * Whether or not to bind the home and business interfaces together
+ *
+ * @return
+ */
+ @Override
+ protected boolean bindHomeAndBusinessTogether()
+ {
+ // Not Supported
+ return false;
+ }
+
+ protected void validateEjb21Views()
+ {
+ // Obtain Container
+ SessionContainer container = this.getContainer();
+
+ // Obtain @RemoteHome
+ RemoteHome remoteHome = container.getAnnotation(RemoteHome.class);
+
+ // Ensure that if EJB 2.1 Components are defined, they're complete
+ this.validateEjb21Views(remoteHome == null ? null : remoteHome.value(), ProxyFactoryHelper
+ .getRemoteInterfaces(container));
+
+ }
+
+ public void start() throws Exception
+ {
+ this.init();
+
+ RemoteBinding binding = this.getBinding();
+ InvokerLocator locator = this.getLocator();
+ SessionContainer container = this.getContainer();
+ String partitionName = container.getPartitionName();
+ proxyFamilyName = container.getDeploymentQualifiedName() + locator.getProtocol() + partitionName;
+ HAPartition partition = (HAPartition) this.getContainer().getInitialContext().lookup(
+ "/HAPartition/" + partitionName);
+ hatarget = new HATarget(partition, proxyFamilyName, locator, HATarget.ENABLE_INVOCATIONS);
+ ClusteringTargetsRepository.initTarget(proxyFamilyName, hatarget.getReplicants());
+ container.getClusterFamilies().put(proxyFamilyName, hatarget);
+
+ if (clustered.loadBalancePolicy() == null || clustered.loadBalancePolicy().equals(ClusteredDefaults.LOAD_BALANCE_POLICY_DEFAULT))
+ {
+ lbPolicy = new FirstAvailable();
+ }
+ else
+ {
+ String policyClass = clustered.loadBalancePolicy();
+ try
+ {
+ RemoteProxyFactoryRegistry registry = container.getDeployment().getRemoteProxyFactoryRegistry();
+ Class<LoadBalancePolicy> policy = registry.getLoadBalancePolicy(policyClass);
+ policyClass = policy.getName();
+ }
+ catch (LoadBalancePolicyNotRegisteredException e){}
+
+ lbPolicy = (LoadBalancePolicy)Thread.currentThread().getContextClassLoader().loadClass(policyClass)
+ .newInstance();
+ }
+ wrapper = new FamilyWrapper(proxyFamilyName, hatarget.getReplicants());
+
+ this.drm = partition.getDistributedReplicantManager();
+ drm.registerListener(proxyFamilyName, this);
+
+ super.start();
+
+ Class<?>[] interfaces = {ProxyFactory.class};
+ String targetId = getTargetId();
+ Object factoryProxy = Remoting.createPojiProxy(targetId, interfaces, ProxyFactoryHelper.getClientBindUrl(binding));
+ try
+ {
+ Util.rebind(getContainer().getInitialContext(), jndiName + PROXY_FACTORY_NAME, factoryProxy);
+ } catch (NamingException e)
+ {
+ NamingException namingException = new NamingException("Could not bind stateful cluster proxy with ejb name "
+ + getContainer().getEjbName() + " into JNDI under jndiName: "
+ + getContainer().getInitialContext().getNameInNamespace() + "/" + jndiName + PROXY_FACTORY_NAME);
+ namingException.setRootCause(e);
+ throw namingException;
+ }
+ assert !Dispatcher.singleton.isRegistered(targetId) : targetId + " is already registered";
+ Dispatcher.singleton.registerTarget(targetId, this);
+
+ }
+
+ @Override
+ String getStackNameInterceptors()
+ {
+ return StatefulClusterProxyFactory.STACK_NAME_CLUSTERED_STATEFUL_SESSION_CLIENT_INTERCEPTORS;
+ }
+
+ public Object createProxyBusiness(Object id)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public void stop() throws Exception
+ {
+ Dispatcher.singleton.unregisterTarget(getTargetId());
+ hatarget.destroy();
+ drm.unregisterListener(proxyFamilyName, this);
+ this.getContainer().getClusterFamilies().remove(proxyFamilyName);
+ Util.unbind(getContainer().getInitialContext(), jndiName + PROXY_FACTORY_NAME);
+ super.stop();
+ }
+
+ /**
+ * @return unique name for this proxy factory
+ */
+ protected String getTargetId()
+ {
+ assert jndiName != null : "jndiName is null";
+ String partition = ((SessionContainer) getContainer()).getPartitionName();
+ return jndiName + PROXY_FACTORY_NAME + "@" + partition;
+ }
+
+ public synchronized void replicantsChanged (String key,
+ List newReplicants,
+ int newReplicantsViewId,
+ boolean merge)
+ {
+ try
+ {
+ // Update the FamilyClusterInfo with the new targets
+ ArrayList targets = new ArrayList(newReplicants);
+ wrapper.get().updateClusterInfo(targets, newReplicantsViewId);
+ }
+ catch (Exception e)
+ {
+ log.error(e);
+ }
+ }
+}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulProxyFactory.java
===================================================================
--- projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulProxyFactory.java 2008-04-23 20:41:05 UTC (rev 72636)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,48 +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.factory.stateful;
-
-import org.jboss.ejb3.proxy.factory.SessionProxyFactory;
-
-/**
- * StatefulProxyFactory
- *
- * Contract for a Proxy Factory specific to
- * operations required by a SFSB implementation
- *
- * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
- * @version $Revision: $
- */
-public interface StatefulProxyFactory extends SessionProxyFactory
-{
- /**
- * Create a SFSB Business Proxy with the specified
- * Session ID and
- * target business interface name (should be expressed as
- * a fully-qualified class name)
- *
- * @param id
- * @param businessInterfaceName
- * @return
- */
- public Object createProxyBusiness(Object id, String businessInterfaceName);
-}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulProxyFactory.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulProxyFactory.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulProxyFactory.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,48 @@
+/*
+ * 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.factory.stateful;
+
+import org.jboss.ejb3.proxy.factory.SessionProxyFactory;
+
+/**
+ * StatefulProxyFactory
+ *
+ * Contract for a Proxy Factory specific to
+ * operations required by a SFSB implementation
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public interface StatefulProxyFactory extends SessionProxyFactory
+{
+ /**
+ * Create a SFSB Business Proxy with the specified
+ * Session ID and
+ * target business interface name (should be expressed as
+ * a fully-qualified class name)
+ *
+ * @param id
+ * @param businessInterfaceName
+ * @return
+ */
+ public Object createProxyBusiness(Object id, String businessInterfaceName);
+}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulRemoteProxyFactory.java
===================================================================
--- projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulRemoteProxyFactory.java 2008-04-23 20:41:05 UTC (rev 72636)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulRemoteProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,184 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.factory.stateful;
-
-import java.lang.reflect.Proxy;
-
-import javax.ejb.RemoteHome;
-import javax.naming.NamingException;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.aop.Dispatcher;
-import org.jboss.aop.advice.AdviceStack;
-import org.jboss.aop.advice.Interceptor;
-import org.jboss.aspects.remoting.InvokeRemoteInterceptor;
-import org.jboss.aspects.remoting.PojiProxy;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.proxy.ProxyFactory;
-import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
-import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
-import org.jboss.ejb3.proxy.handler.BaseSessionRemoteProxyInvocationHandler;
-import org.jboss.ejb3.proxy.handler.stateful.StatefulHomeRemoteProxyInvocationHandler;
-import org.jboss.ejb3.remoting.IsLocalProxyFactoryInterceptor;
-import org.jboss.ejb3.session.SessionContainer;
-import org.jboss.ejb3.session.SessionSpecContainer;
-import org.jboss.logging.Logger;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.util.naming.Util;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @author Brian Stansberry
- *
- * @version $Revision$
- */
-public class StatefulRemoteProxyFactory extends BaseStatefulRemoteProxyFactory implements RemoteProxyFactory
-{
- private static final Logger log = Logger.getLogger(StatefulRemoteProxyFactory.class);
-
- private static final String STACK_NAME_STATEFUL_SESSION_CLIENT_INTERCEPTORS = "StatefulSessionClientInterceptors";
-
- public StatefulRemoteProxyFactory(SessionSpecContainer container, RemoteBinding binding)
- {
- super(container, binding);
- }
-
- @Override
- public void start() throws Exception
- {
- super.start();
- Class<?>[] interfaces = {ProxyFactory.class};
- String targetId = getTargetId();
- String clientBindUrl = ProxyFactoryHelper.getClientBindUrl(this.getBinding());
- Object factoryProxy = createPojiProxy(targetId, interfaces, clientBindUrl);
- log.debug("Binding proxy factory for " + getContainer().getEjbName() + " in JNDI at " + jndiName + PROXY_FACTORY_NAME + " with client bind url " + clientBindUrl);
- try
- {
- Util.rebind(getContainer().getInitialContext(), jndiName + PROXY_FACTORY_NAME, factoryProxy);
- }
- catch (NamingException e)
- {
- NamingException namingException = new NamingException("Could not bind stateful remote proxy with ejb name " + getContainer().getEjbName() + " into JNDI under jndiName: " + getContainer().getInitialContext().getNameInNamespace() + "/" + jndiName + PROXY_FACTORY_NAME);
- namingException.setRootCause(e);
- throw namingException;
- }
- assert !Dispatcher.singleton.isRegistered(targetId) : targetId + " is already registered";
- Dispatcher.singleton.registerTarget(targetId, this);
-
- SessionSpecContainer statefulContainer = this.getContainer();
- RemoteHome remoteHome = statefulContainer.getAnnotation(RemoteHome.class);
- if (remoteHome != null && !bindHomeAndBusinessTogether())
- {
- Object homeProxy = createHomeProxy(remoteHome.value());
- String homeJndiName = ProxyFactoryHelper.getHomeJndiName(statefulContainer);
- log.debug("Binding home proxy at " + homeJndiName);
- Util.rebind(this.getContainer().getInitialContext(), homeJndiName, homeProxy);
- }
- }
-
- @Override
- public void stop() throws Exception
- {
- Util.unbind(getContainer().getInitialContext(), jndiName + PROXY_FACTORY_NAME);
- Dispatcher.singleton.unregisterTarget(getTargetId());
-
- SessionContainer statefulContainer = this.getContainer();
- RemoteHome remoteHome = statefulContainer.getAnnotation(RemoteHome.class);
- if (remoteHome != null && !bindHomeAndBusinessTogether())
- {
- Util.unbind(this.getContainer().getInitialContext(), ProxyFactoryHelper.getHomeJndiName(getContainer()));
- }
- super.stop();
- }
-
- public Object createHomeProxy(Class<?> homeInterface)
- {
- try
- {
- String stackName = StatefulRemoteProxyFactory.STACK_NAME_STATEFUL_SESSION_CLIENT_INTERCEPTORS;
- RemoteBinding binding = this.getBinding();
- if (binding.interceptorStack() != null && !binding.interceptorStack().trim().equals(""))
- {
- stackName = binding.interceptorStack();
- }
- AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
- if (stack == null) throw new RuntimeException("unable to find interceptor stack: " + stackName);
- StatefulHomeRemoteProxyInvocationHandler proxy = new StatefulHomeRemoteProxyInvocationHandler(getContainer(), stack.createInterceptors(
- getContainer().getAdvisor(), null), this.getLocator());
-
- setEjb21Objects(proxy);
- Class<?>[] intfs = {homeInterface};
- return java.lang.reflect.Proxy.newProxyInstance(getContainer().getBeanClass().getClassLoader(), intfs, proxy);
- }
- catch (IllegalArgumentException e)
- {
- throw new RuntimeException(e);
- }
- }
-
- @Override
- protected void setEjb21Objects(BaseSessionRemoteProxyInvocationHandler proxy)
- {
- proxy.setHandle(this.createHandle());
- proxy.setHomeHandle(getHomeHandle());
- proxy.setEjbMetaData(getEjbMetaData());
- }
-
- /**
- * Returns the interface type for Home
- *
- * @return
- */
- @Override
- protected Class<?> getHomeType()
- {
- return ProxyFactoryHelper.getRemoteHomeInterface(this.getContainer());
- }
-
- @Override
- String getStackNameInterceptors()
- {
- return StatefulRemoteProxyFactory.STACK_NAME_STATEFUL_SESSION_CLIENT_INTERCEPTORS;
- }
-
- /**
- * @return unique name for this proxy factory
- */
- protected String getTargetId()
- {
- assert jndiName != null : "jndiName is null";
- return jndiName + PROXY_FACTORY_NAME;
- }
-
- protected Object createPojiProxy(Object oid, Class<?>[] interfaces, String uri) throws Exception
- {
- InvokerLocator locator = new InvokerLocator(uri);
- Interceptor[] interceptors = {IsLocalProxyFactoryInterceptor.singleton, InvokeRemoteInterceptor.singleton};
- PojiProxy proxy = new PojiProxy(oid, locator, interceptors);
- return Proxy.newProxyInstance(interfaces[0].getClassLoader(), interfaces, proxy);
-
- }
-
-
-}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulRemoteProxyFactory.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulRemoteProxyFactory.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulRemoteProxyFactory.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulRemoteProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,184 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.factory.stateful;
+
+import java.lang.reflect.Proxy;
+
+import javax.ejb.RemoteHome;
+import javax.naming.NamingException;
+
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.Dispatcher;
+import org.jboss.aop.advice.AdviceStack;
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aspects.remoting.InvokeRemoteInterceptor;
+import org.jboss.aspects.remoting.PojiProxy;
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.proxy.ProxyFactory;
+import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
+import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
+import org.jboss.ejb3.proxy.handler.BaseSessionRemoteProxyInvocationHandler;
+import org.jboss.ejb3.proxy.handler.stateful.StatefulHomeRemoteProxyInvocationHandler;
+import org.jboss.ejb3.remoting.IsLocalProxyFactoryInterceptor;
+import org.jboss.ejb3.session.SessionContainer;
+import org.jboss.ejb3.session.SessionSpecContainer;
+import org.jboss.logging.Logger;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.util.naming.Util;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @author Brian Stansberry
+ *
+ * @version $Revision$
+ */
+public class StatefulRemoteProxyFactory extends BaseStatefulRemoteProxyFactory implements RemoteProxyFactory
+{
+ private static final Logger log = Logger.getLogger(StatefulRemoteProxyFactory.class);
+
+ private static final String STACK_NAME_STATEFUL_SESSION_CLIENT_INTERCEPTORS = "StatefulSessionClientInterceptors";
+
+ public StatefulRemoteProxyFactory(SessionSpecContainer container, RemoteBinding binding)
+ {
+ super(container, binding);
+ }
+
+ @Override
+ public void start() throws Exception
+ {
+ super.start();
+ Class<?>[] interfaces = {ProxyFactory.class};
+ String targetId = getTargetId();
+ String clientBindUrl = ProxyFactoryHelper.getClientBindUrl(this.getBinding());
+ Object factoryProxy = createPojiProxy(targetId, interfaces, clientBindUrl);
+ log.debug("Binding proxy factory for " + getContainer().getEjbName() + " in JNDI at " + jndiName + PROXY_FACTORY_NAME + " with client bind url " + clientBindUrl);
+ try
+ {
+ Util.rebind(getContainer().getInitialContext(), jndiName + PROXY_FACTORY_NAME, factoryProxy);
+ }
+ catch (NamingException e)
+ {
+ NamingException namingException = new NamingException("Could not bind stateful remote proxy with ejb name " + getContainer().getEjbName() + " into JNDI under jndiName: " + getContainer().getInitialContext().getNameInNamespace() + "/" + jndiName + PROXY_FACTORY_NAME);
+ namingException.setRootCause(e);
+ throw namingException;
+ }
+ assert !Dispatcher.singleton.isRegistered(targetId) : targetId + " is already registered";
+ Dispatcher.singleton.registerTarget(targetId, this);
+
+ SessionSpecContainer statefulContainer = this.getContainer();
+ RemoteHome remoteHome = statefulContainer.getAnnotation(RemoteHome.class);
+ if (remoteHome != null && !bindHomeAndBusinessTogether())
+ {
+ Object homeProxy = createHomeProxy(remoteHome.value());
+ String homeJndiName = ProxyFactoryHelper.getHomeJndiName(statefulContainer);
+ log.debug("Binding home proxy at " + homeJndiName);
+ Util.rebind(this.getContainer().getInitialContext(), homeJndiName, homeProxy);
+ }
+ }
+
+ @Override
+ public void stop() throws Exception
+ {
+ Util.unbind(getContainer().getInitialContext(), jndiName + PROXY_FACTORY_NAME);
+ Dispatcher.singleton.unregisterTarget(getTargetId());
+
+ SessionContainer statefulContainer = this.getContainer();
+ RemoteHome remoteHome = statefulContainer.getAnnotation(RemoteHome.class);
+ if (remoteHome != null && !bindHomeAndBusinessTogether())
+ {
+ Util.unbind(this.getContainer().getInitialContext(), ProxyFactoryHelper.getHomeJndiName(getContainer()));
+ }
+ super.stop();
+ }
+
+ public Object createHomeProxy(Class<?> homeInterface)
+ {
+ try
+ {
+ String stackName = StatefulRemoteProxyFactory.STACK_NAME_STATEFUL_SESSION_CLIENT_INTERCEPTORS;
+ RemoteBinding binding = this.getBinding();
+ if (binding.interceptorStack() != null && !binding.interceptorStack().trim().equals(""))
+ {
+ stackName = binding.interceptorStack();
+ }
+ AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
+ if (stack == null) throw new RuntimeException("unable to find interceptor stack: " + stackName);
+ StatefulHomeRemoteProxyInvocationHandler proxy = new StatefulHomeRemoteProxyInvocationHandler(getContainer(), stack.createInterceptors(
+ getContainer().getAdvisor(), null), this.getLocator());
+
+ setEjb21Objects(proxy);
+ Class<?>[] intfs = {homeInterface};
+ return java.lang.reflect.Proxy.newProxyInstance(getContainer().getBeanClass().getClassLoader(), intfs, proxy);
+ }
+ catch (IllegalArgumentException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Override
+ protected void setEjb21Objects(BaseSessionRemoteProxyInvocationHandler proxy)
+ {
+ proxy.setHandle(this.createHandle());
+ proxy.setHomeHandle(getHomeHandle());
+ proxy.setEjbMetaData(getEjbMetaData());
+ }
+
+ /**
+ * Returns the interface type for Home
+ *
+ * @return
+ */
+ @Override
+ protected Class<?> getHomeType()
+ {
+ return ProxyFactoryHelper.getRemoteHomeInterface(this.getContainer());
+ }
+
+ @Override
+ String getStackNameInterceptors()
+ {
+ return StatefulRemoteProxyFactory.STACK_NAME_STATEFUL_SESSION_CLIENT_INTERCEPTORS;
+ }
+
+ /**
+ * @return unique name for this proxy factory
+ */
+ protected String getTargetId()
+ {
+ assert jndiName != null : "jndiName is null";
+ return jndiName + PROXY_FACTORY_NAME;
+ }
+
+ protected Object createPojiProxy(Object oid, Class<?>[] interfaces, String uri) throws Exception
+ {
+ InvokerLocator locator = new InvokerLocator(uri);
+ Interceptor[] interceptors = {IsLocalProxyFactoryInterceptor.singleton, InvokeRemoteInterceptor.singleton};
+ PojiProxy proxy = new PojiProxy(oid, locator, interceptors);
+ return Proxy.newProxyInstance(interfaces[0].getClassLoader(), interfaces, proxy);
+
+ }
+
+
+}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless)
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessProxyFactory.java
===================================================================
--- projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessProxyFactory.java 2008-04-23 20:41:05 UTC (rev 72636)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,139 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.factory.stateless;
-
-import org.jboss.ejb3.proxy.factory.SessionProxyFactory;
-import org.jboss.ejb3.session.ProxyAccessType;
-import org.jboss.ejb3.session.SessionSpecContainer;
-import org.jboss.logging.Logger;
-import org.jboss.util.naming.Util;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public abstract class BaseStatelessProxyFactory extends org.jboss.ejb3.proxy.factory.BaseSessionProxyFactory implements SessionProxyFactory
-{
- private static final Logger log = Logger.getLogger(BaseStatelessProxyFactory.class);
-
- public BaseStatelessProxyFactory(SessionSpecContainer container, String jndiName)
- {
- super(container);
-
- assert jndiName != null : "jndiName is null";
-
- this.jndiName = jndiName;
- }
-
- /**
- * Adapt the JDK to cglib.
- *
- * This is a named class because it implements both InvocationHandler and Serializable.
- */
- /* TODO: fix EJBTHREE-485 without cglib
- private static class CGLibInvocationHandlerAdapter implements net.sf.cglib.proxy.InvocationHandler, Serializable
- {
- private static final long serialVersionUID = 1L;
-
- private InvocationHandler delegate;
-
- private CGLibInvocationHandlerAdapter(InvocationHandler delegate)
- {
- if(delegate == null)
- throw new IllegalArgumentException("delegate must not be null");
- this.delegate = delegate;
- }
-
- public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
- {
- return delegate.invoke(proxy, method, args);
- }
-
- }
- */
-
-// /**
-// * Adapt the InvocationHandler to MethodHandler.
-// *
-// * This is a named class because it implements both MethodHandler and Serializable.
-// */
-// private static class MethodHandlerAdapter implements MethodHandler, Serializable
-// {
-// private static final long serialVersionUID = 1L;
-//
-// private InvocationHandler delegate;
-//
-// private MethodHandlerAdapter(InvocationHandler delegate)
-// {
-// if(delegate == null)
-// throw new IllegalArgumentException("delegate must not be null");
-// this.delegate = delegate;
-// }
-//
-// public Object invoke(Object self, Method thisMethod, Method process, Object[] args) throws Throwable
-// {
-// return delegate.invoke(self, thisMethod, args);
-// }
-// }
-
- public void init() throws Exception
- {
- this.createProxyConstructors();
- this.validateEjb21Views();
- }
-
- /* for debugging purposes * /
- private static void describeClass(Class cls) {
- System.err.println("class " + cls + " has the following:");
- for(Class i : cls.getInterfaces()) {
- System.err.println(" interface: " + i);
- }
- for(Method m : cls.getDeclaredMethods()) {
- System.err.println(" method: " + m);
- }
- System.err.println(" classloader = " + cls.getClassLoader());
- if(cls.getSuperclass() != null)
- describeClass(cls.getSuperclass());
- }
- */
-
- public void start() throws Exception
- {
- init();
-
- Object proxy = createProxyBusiness();
- //describeClass(proxy.getClass());
- bindProxy(proxy);
- }
-
- public void stop() throws Exception
- {
- Util.unbind(getContainer().getInitialContext(), jndiName);
- }
-
- protected abstract void validateEjb21Views();
-
- protected abstract ProxyAccessType getProxyAccessType();
-
-}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessProxyFactory.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessProxyFactory.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessProxyFactory.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,139 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.factory.stateless;
+
+import org.jboss.ejb3.proxy.factory.SessionProxyFactory;
+import org.jboss.ejb3.session.ProxyAccessType;
+import org.jboss.ejb3.session.SessionSpecContainer;
+import org.jboss.logging.Logger;
+import org.jboss.util.naming.Util;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+public abstract class BaseStatelessProxyFactory extends org.jboss.ejb3.proxy.factory.BaseSessionProxyFactory implements SessionProxyFactory
+{
+ private static final Logger log = Logger.getLogger(BaseStatelessProxyFactory.class);
+
+ public BaseStatelessProxyFactory(SessionSpecContainer container, String jndiName)
+ {
+ super(container);
+
+ assert jndiName != null : "jndiName is null";
+
+ this.jndiName = jndiName;
+ }
+
+ /**
+ * Adapt the JDK to cglib.
+ *
+ * This is a named class because it implements both InvocationHandler and Serializable.
+ */
+ /* TODO: fix EJBTHREE-485 without cglib
+ private static class CGLibInvocationHandlerAdapter implements net.sf.cglib.proxy.InvocationHandler, Serializable
+ {
+ private static final long serialVersionUID = 1L;
+
+ private InvocationHandler delegate;
+
+ private CGLibInvocationHandlerAdapter(InvocationHandler delegate)
+ {
+ if(delegate == null)
+ throw new IllegalArgumentException("delegate must not be null");
+ this.delegate = delegate;
+ }
+
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
+ {
+ return delegate.invoke(proxy, method, args);
+ }
+
+ }
+ */
+
+// /**
+// * Adapt the InvocationHandler to MethodHandler.
+// *
+// * This is a named class because it implements both MethodHandler and Serializable.
+// */
+// private static class MethodHandlerAdapter implements MethodHandler, Serializable
+// {
+// private static final long serialVersionUID = 1L;
+//
+// private InvocationHandler delegate;
+//
+// private MethodHandlerAdapter(InvocationHandler delegate)
+// {
+// if(delegate == null)
+// throw new IllegalArgumentException("delegate must not be null");
+// this.delegate = delegate;
+// }
+//
+// public Object invoke(Object self, Method thisMethod, Method process, Object[] args) throws Throwable
+// {
+// return delegate.invoke(self, thisMethod, args);
+// }
+// }
+
+ public void init() throws Exception
+ {
+ this.createProxyConstructors();
+ this.validateEjb21Views();
+ }
+
+ /* for debugging purposes * /
+ private static void describeClass(Class cls) {
+ System.err.println("class " + cls + " has the following:");
+ for(Class i : cls.getInterfaces()) {
+ System.err.println(" interface: " + i);
+ }
+ for(Method m : cls.getDeclaredMethods()) {
+ System.err.println(" method: " + m);
+ }
+ System.err.println(" classloader = " + cls.getClassLoader());
+ if(cls.getSuperclass() != null)
+ describeClass(cls.getSuperclass());
+ }
+ */
+
+ public void start() throws Exception
+ {
+ init();
+
+ Object proxy = createProxyBusiness();
+ //describeClass(proxy.getClass());
+ bindProxy(proxy);
+ }
+
+ public void stop() throws Exception
+ {
+ Util.unbind(getContainer().getInitialContext(), jndiName);
+ }
+
+ protected abstract void validateEjb21Views();
+
+ protected abstract ProxyAccessType getProxyAccessType();
+
+}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessRemoteProxyFactory.java
===================================================================
--- projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessRemoteProxyFactory.java 2008-04-23 20:41:05 UTC (rev 72636)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessRemoteProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,141 +0,0 @@
-package org.jboss.ejb3.proxy.factory.stateless;
-
-import javax.ejb.EJBObject;
-import javax.ejb.RemoteHome;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.aop.advice.AdviceStack;
-import org.jboss.ejb3.SpecificationInterfaceType;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
-import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
-import org.jboss.ejb3.proxy.handler.stateless.StatelessRemoteProxyInvocationHandler;
-import org.jboss.ejb3.session.ProxyAccessType;
-import org.jboss.ejb3.session.SessionContainer;
-import org.jboss.ejb3.session.SessionSpecContainer;
-import org.jboss.ejb3.stateless.StatelessHandleRemoteImpl;
-import org.jboss.remoting.InvokerLocator;
-
-public abstract class BaseStatelessRemoteProxyFactory extends BaseStatelessProxyFactory implements RemoteProxyFactory
-{
-
- // Instance Members
-
- private RemoteBinding binding;
-
- private InvokerLocator locator;
-
- // Constructor
- public BaseStatelessRemoteProxyFactory(SessionSpecContainer container, RemoteBinding binding)
- {
- super(container, binding.jndiBinding());
-
- this.binding = binding;
-
- try
- {
- String clientBindUrl = ProxyFactoryHelper.getClientBindUrl(this.getBinding());
- this.locator = new InvokerLocator(clientBindUrl);
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- }
-
- // Required Implementations
-
- @Override
- protected final ProxyAccessType getProxyAccessType()
- {
- return ProxyAccessType.REMOTE;
- }
-
- @Override
- protected final void validateEjb21Views()
- {
- // Obtain Container
- SessionContainer container = this.getContainer();
-
- // Obtain @RemoteHome
- RemoteHome remoteHome = container.getAnnotation(RemoteHome.class);
-
- // Ensure that if EJB 2.1 Components are defined, they're complete
- this.validateEjb21Views(remoteHome == null ? null : remoteHome.value(), ProxyFactoryHelper
- .getRemoteInterfaces(container));
- }
-
- // Specifications
-
- abstract String getStackNameInterceptors();
-
- // Functional Methods
-
- protected boolean bindHomeAndEjb21ViewTogether(SessionContainer container)
- {
- String homeJndiName = ProxyFactoryHelper.getHomeJndiName(container);
- String remoteBusinessJndiName = ProxyFactoryHelper.getRemoteBusinessJndiName(container);
- return homeJndiName.equals(remoteBusinessJndiName);
- }
-
- public Object createProxyBusiness()
- {
- return this.createProxyBusiness(null);
- }
-
- public Object createProxyBusiness(String businessInterfaceType)
- {
- return this.createProxy(SpecificationInterfaceType.EJB30_BUSINESS, businessInterfaceType);
- }
-
- public Object createProxy(SpecificationInterfaceType type, String businessInterfaceType)
- {
- String stackName = this.getStackNameInterceptors();
- if (binding.interceptorStack() != null && !binding.interceptorStack().equals(""))
- {
- stackName = binding.interceptorStack();
- }
- AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
- StatelessRemoteProxyInvocationHandler proxy = new StatelessRemoteProxyInvocationHandler(getContainer(),
- stack.createInterceptors(getContainer().getAdvisor(), null), locator, businessInterfaceType);
-
- if(type.equals(SpecificationInterfaceType.EJB21))
- {
- return this.constructEjb21Proxy(proxy);
- }
- else
- {
- return this.constructProxyBusiness(proxy);
- }
- }
-
- @Override
- public final StatelessHandleRemoteImpl createHandle()
- {
- EJBObject proxy = this.createProxyEjb21(null);
- StatelessHandleRemoteImpl handle = new StatelessHandleRemoteImpl(proxy);
- return handle;
- }
-
- @SuppressWarnings("unchecked")
- public <T extends EJBObject> T createProxyEjb21(String businessInterfaceType)
- {
- // Cast explicitly to catch improper proxies
- return (T) this.createProxy(SpecificationInterfaceType.EJB21, businessInterfaceType);
- }
-
- // Accessors / Mutators
-
- RemoteBinding getBinding()
- {
- assert this.binding!=null : "RemoteBinding has not been initialized";
- return this.binding;
- }
-
- InvokerLocator getLocator()
- {
- assert this.locator!=null : "InvokerLocator has not been initialized";
- return this.locator;
- }
-
-}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessRemoteProxyFactory.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessRemoteProxyFactory.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessRemoteProxyFactory.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessRemoteProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,141 @@
+package org.jboss.ejb3.proxy.factory.stateless;
+
+import javax.ejb.EJBObject;
+import javax.ejb.RemoteHome;
+
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.advice.AdviceStack;
+import org.jboss.ejb3.SpecificationInterfaceType;
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
+import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
+import org.jboss.ejb3.proxy.handler.stateless.StatelessRemoteProxyInvocationHandler;
+import org.jboss.ejb3.session.ProxyAccessType;
+import org.jboss.ejb3.session.SessionContainer;
+import org.jboss.ejb3.session.SessionSpecContainer;
+import org.jboss.ejb3.stateless.StatelessHandleRemoteImpl;
+import org.jboss.remoting.InvokerLocator;
+
+public abstract class BaseStatelessRemoteProxyFactory extends BaseStatelessProxyFactory implements RemoteProxyFactory
+{
+
+ // Instance Members
+
+ private RemoteBinding binding;
+
+ private InvokerLocator locator;
+
+ // Constructor
+ public BaseStatelessRemoteProxyFactory(SessionSpecContainer container, RemoteBinding binding)
+ {
+ super(container, binding.jndiBinding());
+
+ this.binding = binding;
+
+ try
+ {
+ String clientBindUrl = ProxyFactoryHelper.getClientBindUrl(this.getBinding());
+ this.locator = new InvokerLocator(clientBindUrl);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ // Required Implementations
+
+ @Override
+ protected final ProxyAccessType getProxyAccessType()
+ {
+ return ProxyAccessType.REMOTE;
+ }
+
+ @Override
+ protected final void validateEjb21Views()
+ {
+ // Obtain Container
+ SessionContainer container = this.getContainer();
+
+ // Obtain @RemoteHome
+ RemoteHome remoteHome = container.getAnnotation(RemoteHome.class);
+
+ // Ensure that if EJB 2.1 Components are defined, they're complete
+ this.validateEjb21Views(remoteHome == null ? null : remoteHome.value(), ProxyFactoryHelper
+ .getRemoteInterfaces(container));
+ }
+
+ // Specifications
+
+ abstract String getStackNameInterceptors();
+
+ // Functional Methods
+
+ protected boolean bindHomeAndEjb21ViewTogether(SessionContainer container)
+ {
+ String homeJndiName = ProxyFactoryHelper.getHomeJndiName(container);
+ String remoteBusinessJndiName = ProxyFactoryHelper.getRemoteBusinessJndiName(container);
+ return homeJndiName.equals(remoteBusinessJndiName);
+ }
+
+ public Object createProxyBusiness()
+ {
+ return this.createProxyBusiness(null);
+ }
+
+ public Object createProxyBusiness(String businessInterfaceType)
+ {
+ return this.createProxy(SpecificationInterfaceType.EJB30_BUSINESS, businessInterfaceType);
+ }
+
+ public Object createProxy(SpecificationInterfaceType type, String businessInterfaceType)
+ {
+ String stackName = this.getStackNameInterceptors();
+ if (binding.interceptorStack() != null && !binding.interceptorStack().equals(""))
+ {
+ stackName = binding.interceptorStack();
+ }
+ AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
+ StatelessRemoteProxyInvocationHandler proxy = new StatelessRemoteProxyInvocationHandler(getContainer(),
+ stack.createInterceptors(getContainer().getAdvisor(), null), locator, businessInterfaceType);
+
+ if(type.equals(SpecificationInterfaceType.EJB21))
+ {
+ return this.constructEjb21Proxy(proxy);
+ }
+ else
+ {
+ return this.constructProxyBusiness(proxy);
+ }
+ }
+
+ @Override
+ public final StatelessHandleRemoteImpl createHandle()
+ {
+ EJBObject proxy = this.createProxyEjb21(null);
+ StatelessHandleRemoteImpl handle = new StatelessHandleRemoteImpl(proxy);
+ return handle;
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T extends EJBObject> T createProxyEjb21(String businessInterfaceType)
+ {
+ // Cast explicitly to catch improper proxies
+ return (T) this.createProxy(SpecificationInterfaceType.EJB21, businessInterfaceType);
+ }
+
+ // Accessors / Mutators
+
+ RemoteBinding getBinding()
+ {
+ assert this.binding!=null : "RemoteBinding has not been initialized";
+ return this.binding;
+ }
+
+ InvokerLocator getLocator()
+ {
+ assert this.locator!=null : "InvokerLocator has not been initialized";
+ return this.locator;
+ }
+
+}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessClusterProxyFactory.java
===================================================================
--- projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessClusterProxyFactory.java 2008-04-23 20:41:05 UTC (rev 72636)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessClusterProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,204 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.factory.stateless;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.aop.advice.AdviceStack;
-import org.jboss.aspects.remoting.FamilyWrapper;
-import org.jboss.ejb3.SpecificationInterfaceType;
-import org.jboss.ejb3.annotation.Clustered;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.annotation.defaults.ClusteredDefaults;
-import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
-import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
-import org.jboss.ejb3.proxy.factory.RemoteProxyFactoryRegistry;
-import org.jboss.ejb3.proxy.handler.stateless.StatelessClusteredInvocationHandler;
-import org.jboss.ejb3.remoting.LoadBalancePolicyNotRegisteredException;
-import org.jboss.ejb3.session.SessionSpecContainer;
-import org.jboss.ejb3.stateless.StatelessContainer;
-import org.jboss.ha.client.loadbalance.LoadBalancePolicy;
-import org.jboss.ha.client.loadbalance.RandomRobin;
-import org.jboss.ha.framework.interfaces.ClusteringTargetsRepository;
-import org.jboss.ha.framework.interfaces.DistributedReplicantManager;
-import org.jboss.ha.framework.interfaces.HAPartition;
-import org.jboss.ha.framework.server.HATarget;
-import org.jboss.logging.Logger;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.util.NotImplementedException;
-
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public class StatelessClusterProxyFactory extends BaseStatelessRemoteProxyFactory
- implements RemoteProxyFactory, DistributedReplicantManager.ReplicantListener
-{
- private static final Logger log = Logger.getLogger(StatelessClusterProxyFactory.class);
-
- private static final String STACK_NAME_CLUSTERED_STATELESS_SESSION_CLIENT_INTERCEPTORS = "ClusteredStatelessSessionClientInterceptors";
-
- private RemoteBinding binding;
- private Clustered clustered;
- private InvokerLocator locator;
- private DistributedReplicantManager drm;
- private HATarget hatarget;
- private String proxyFamilyName;
- private LoadBalancePolicy lbPolicy;
- private FamilyWrapper wrapper;
- private Object proxy;
-
- public StatelessClusterProxyFactory(SessionSpecContainer container, RemoteBinding binding, Clustered clustered)
- {
- super(container, binding);
-
- assert clustered != null : "clustered is null";
-
- this.binding = binding;
- this.clustered = clustered;
- }
-
- public void start() throws Exception
- {
- String clientBindUrl = ProxyFactoryHelper.getClientBindUrl(binding);
- locator = new InvokerLocator(clientBindUrl);
- String partitionName = ((StatelessContainer) getContainer()).getPartitionName();
- proxyFamilyName = ((StatelessContainer) getContainer()).getDeploymentQualifiedName() + locator.getProtocol() + partitionName;
- HAPartition partition = (HAPartition) getContainer().getInitialContext().lookup("/HAPartition/" + partitionName);
- hatarget = new HATarget(partition, proxyFamilyName, locator, HATarget.ENABLE_INVOCATIONS);
- ClusteringTargetsRepository.initTarget(proxyFamilyName, hatarget.getReplicants());
- StatelessContainer container = (StatelessContainer) getContainer();
-
- container.getClusterFamilies().put(proxyFamilyName, hatarget);
-
- if (clustered.loadBalancePolicy() == null || clustered.loadBalancePolicy().equals(ClusteredDefaults.LOAD_BALANCE_POLICY_DEFAULT))
- {
- lbPolicy = new RandomRobin();
- }
- else
- {
- String policyClass = clustered.loadBalancePolicy();
- try
- {
- RemoteProxyFactoryRegistry registry = container.getDeployment().getRemoteProxyFactoryRegistry();
- Class<LoadBalancePolicy> policy = registry.getLoadBalancePolicy(policyClass);
- policyClass = policy.getName();
- }
- catch (LoadBalancePolicyNotRegisteredException e){}
-
- lbPolicy = (LoadBalancePolicy)Thread.currentThread().getContextClassLoader().loadClass(policyClass)
- .newInstance();
- }
- wrapper = new FamilyWrapper(proxyFamilyName, hatarget.getReplicants());
-
- this.drm = partition.getDistributedReplicantManager();
- drm.registerListener(proxyFamilyName, this);
-
- super.start();
- }
-
- public void stop() throws Exception
- {
- super.stop();
- proxy = null;
- hatarget.destroy();
- drm.unregisterListener(proxyFamilyName, this);
- ((StatelessContainer) getContainer()).getClusterFamilies().remove(proxyFamilyName);
- }
-
- public Object createProxyBusiness(String businessInterfaceClassName)
- {
- Object containerId = getContainer().getObjectName().getCanonicalName();
- String stackName = this.getStackNameInterceptors();
- if (binding.interceptorStack() != null && !binding.interceptorStack().equals(""))
- {
- stackName = binding.interceptorStack();
- }
- AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
- /*
- Object[] args = {new StatelessClusteredProxy(containerId, stack.createInterceptors((Advisor) container, null), wrapper, lbPolicy)};
- return proxyConstructor.newInstance(args);
- */
- String partitionName = ((StatelessContainer) getContainer()).getPartitionName();
-
- proxy = constructProxy(new StatelessClusteredInvocationHandler(getContainer(), stack.createInterceptors(
- getContainer().getAdvisor(), null), wrapper, lbPolicy, partitionName, businessInterfaceClassName),
- SpecificationInterfaceType.EJB30_BUSINESS);
- return proxy;
- }
-
- /**
- * Whether or not to bind the home and business interfaces together
- *
- * @return
- */
- @Override
- protected boolean bindHomeAndBusinessTogether(){
- // Not Supported
- return false;
- }
-
- public synchronized void replicantsChanged (String key,
- List newReplicants,
- int newReplicantsViewId,
- boolean merge)
- {
- try
- {
- // Update the FamilyClusterInfo with the new targets
- ArrayList targets = new ArrayList(newReplicants);
- wrapper.get().updateClusterInfo(targets, newReplicantsViewId);
-
- // Rebind the proxy as the old one has been serialized
- if (proxy != null)
- bindProxy(proxy);
- }
- catch (Exception e)
- {
- log.error(e);
- }
- }
-
- /**
- * Returns the interface type for Home
- *
- * @param container
- * @return
- */
- @Override
- protected Class<?> getHomeType()
- {
- // Not Supported
- return null;
- }
-
- @Override
- String getStackNameInterceptors()
- {
- return StatelessClusterProxyFactory.STACK_NAME_CLUSTERED_STATELESS_SESSION_CLIENT_INTERCEPTORS;
- }
-}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessClusterProxyFactory.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessClusterProxyFactory.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessClusterProxyFactory.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessClusterProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,204 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.factory.stateless;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.advice.AdviceStack;
+import org.jboss.aspects.remoting.FamilyWrapper;
+import org.jboss.ejb3.SpecificationInterfaceType;
+import org.jboss.ejb3.annotation.Clustered;
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.annotation.defaults.ClusteredDefaults;
+import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
+import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
+import org.jboss.ejb3.proxy.factory.RemoteProxyFactoryRegistry;
+import org.jboss.ejb3.proxy.handler.stateless.StatelessClusteredInvocationHandler;
+import org.jboss.ejb3.remoting.LoadBalancePolicyNotRegisteredException;
+import org.jboss.ejb3.session.SessionSpecContainer;
+import org.jboss.ejb3.stateless.StatelessContainer;
+import org.jboss.ha.client.loadbalance.LoadBalancePolicy;
+import org.jboss.ha.client.loadbalance.RandomRobin;
+import org.jboss.ha.framework.interfaces.ClusteringTargetsRepository;
+import org.jboss.ha.framework.interfaces.DistributedReplicantManager;
+import org.jboss.ha.framework.interfaces.HAPartition;
+import org.jboss.ha.framework.server.HATarget;
+import org.jboss.logging.Logger;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.util.NotImplementedException;
+
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+public class StatelessClusterProxyFactory extends BaseStatelessRemoteProxyFactory
+ implements RemoteProxyFactory, DistributedReplicantManager.ReplicantListener
+{
+ private static final Logger log = Logger.getLogger(StatelessClusterProxyFactory.class);
+
+ private static final String STACK_NAME_CLUSTERED_STATELESS_SESSION_CLIENT_INTERCEPTORS = "ClusteredStatelessSessionClientInterceptors";
+
+ private RemoteBinding binding;
+ private Clustered clustered;
+ private InvokerLocator locator;
+ private DistributedReplicantManager drm;
+ private HATarget hatarget;
+ private String proxyFamilyName;
+ private LoadBalancePolicy lbPolicy;
+ private FamilyWrapper wrapper;
+ private Object proxy;
+
+ public StatelessClusterProxyFactory(SessionSpecContainer container, RemoteBinding binding, Clustered clustered)
+ {
+ super(container, binding);
+
+ assert clustered != null : "clustered is null";
+
+ this.binding = binding;
+ this.clustered = clustered;
+ }
+
+ public void start() throws Exception
+ {
+ String clientBindUrl = ProxyFactoryHelper.getClientBindUrl(binding);
+ locator = new InvokerLocator(clientBindUrl);
+ String partitionName = ((StatelessContainer) getContainer()).getPartitionName();
+ proxyFamilyName = ((StatelessContainer) getContainer()).getDeploymentQualifiedName() + locator.getProtocol() + partitionName;
+ HAPartition partition = (HAPartition) getContainer().getInitialContext().lookup("/HAPartition/" + partitionName);
+ hatarget = new HATarget(partition, proxyFamilyName, locator, HATarget.ENABLE_INVOCATIONS);
+ ClusteringTargetsRepository.initTarget(proxyFamilyName, hatarget.getReplicants());
+ StatelessContainer container = (StatelessContainer) getContainer();
+
+ container.getClusterFamilies().put(proxyFamilyName, hatarget);
+
+ if (clustered.loadBalancePolicy() == null || clustered.loadBalancePolicy().equals(ClusteredDefaults.LOAD_BALANCE_POLICY_DEFAULT))
+ {
+ lbPolicy = new RandomRobin();
+ }
+ else
+ {
+ String policyClass = clustered.loadBalancePolicy();
+ try
+ {
+ RemoteProxyFactoryRegistry registry = container.getDeployment().getRemoteProxyFactoryRegistry();
+ Class<LoadBalancePolicy> policy = registry.getLoadBalancePolicy(policyClass);
+ policyClass = policy.getName();
+ }
+ catch (LoadBalancePolicyNotRegisteredException e){}
+
+ lbPolicy = (LoadBalancePolicy)Thread.currentThread().getContextClassLoader().loadClass(policyClass)
+ .newInstance();
+ }
+ wrapper = new FamilyWrapper(proxyFamilyName, hatarget.getReplicants());
+
+ this.drm = partition.getDistributedReplicantManager();
+ drm.registerListener(proxyFamilyName, this);
+
+ super.start();
+ }
+
+ public void stop() throws Exception
+ {
+ super.stop();
+ proxy = null;
+ hatarget.destroy();
+ drm.unregisterListener(proxyFamilyName, this);
+ ((StatelessContainer) getContainer()).getClusterFamilies().remove(proxyFamilyName);
+ }
+
+ public Object createProxyBusiness(String businessInterfaceClassName)
+ {
+ Object containerId = getContainer().getObjectName().getCanonicalName();
+ String stackName = this.getStackNameInterceptors();
+ if (binding.interceptorStack() != null && !binding.interceptorStack().equals(""))
+ {
+ stackName = binding.interceptorStack();
+ }
+ AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
+ /*
+ Object[] args = {new StatelessClusteredProxy(containerId, stack.createInterceptors((Advisor) container, null), wrapper, lbPolicy)};
+ return proxyConstructor.newInstance(args);
+ */
+ String partitionName = ((StatelessContainer) getContainer()).getPartitionName();
+
+ proxy = constructProxy(new StatelessClusteredInvocationHandler(getContainer(), stack.createInterceptors(
+ getContainer().getAdvisor(), null), wrapper, lbPolicy, partitionName, businessInterfaceClassName),
+ SpecificationInterfaceType.EJB30_BUSINESS);
+ return proxy;
+ }
+
+ /**
+ * Whether or not to bind the home and business interfaces together
+ *
+ * @return
+ */
+ @Override
+ protected boolean bindHomeAndBusinessTogether(){
+ // Not Supported
+ return false;
+ }
+
+ public synchronized void replicantsChanged (String key,
+ List newReplicants,
+ int newReplicantsViewId,
+ boolean merge)
+ {
+ try
+ {
+ // Update the FamilyClusterInfo with the new targets
+ ArrayList targets = new ArrayList(newReplicants);
+ wrapper.get().updateClusterInfo(targets, newReplicantsViewId);
+
+ // Rebind the proxy as the old one has been serialized
+ if (proxy != null)
+ bindProxy(proxy);
+ }
+ catch (Exception e)
+ {
+ log.error(e);
+ }
+ }
+
+ /**
+ * Returns the interface type for Home
+ *
+ * @param container
+ * @return
+ */
+ @Override
+ protected Class<?> getHomeType()
+ {
+ // Not Supported
+ return null;
+ }
+
+ @Override
+ String getStackNameInterceptors()
+ {
+ return StatelessClusterProxyFactory.STACK_NAME_CLUSTERED_STATELESS_SESSION_CLIENT_INTERCEPTORS;
+ }
+}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessLocalProxyFactory.java
===================================================================
--- projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessLocalProxyFactory.java 2008-04-23 20:41:05 UTC (rev 72636)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessLocalProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,156 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.factory.stateless;
-
-import javax.ejb.EJBLocalObject;
-import javax.ejb.LocalHome;
-
-import org.jboss.ejb3.EJBContainer;
-import org.jboss.ejb3.SpecificationInterfaceType;
-import org.jboss.ejb3.annotation.LocalBinding;
-import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
-import org.jboss.ejb3.proxy.handler.stateless.StatelessLocalProxyInvocationHandler;
-import org.jboss.ejb3.session.ProxyAccessType;
-import org.jboss.ejb3.session.SessionSpecContainer;
-import org.jboss.ejb3.stateless.StatelessHandleRemoteImpl;
-import org.jboss.logging.Logger;
-import org.jboss.util.naming.Util;
-
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public class StatelessLocalProxyFactory extends BaseStatelessProxyFactory
-{
- private static final Logger log = Logger.getLogger(StatelessLocalProxyFactory.class);
-
- public StatelessLocalProxyFactory(SessionSpecContainer container, LocalBinding binding)
- {
- super(container, binding.jndiBinding());
- }
-
- /**
- * Returns the interface type for Home
- *
- * @param container
- * @return
- */
- @Override
- protected Class<?> getHomeType()
- {
- return ProxyFactoryHelper.getLocalHomeInterface(this.getContainer());
- }
-
- @Override
- protected ProxyAccessType getProxyAccessType()
- {
- return ProxyAccessType.LOCAL;
- }
-
-
- protected void validateEjb21Views(){
-
- EJBContainer container = this.getContainer();
-
- LocalHome localHome = container.getAnnotation(LocalHome.class);
-
- // Ensure that if EJB 2.1 Components are defined, they're complete
- this.validateEjb21Views(localHome == null ? null : localHome.value(), ProxyFactoryHelper
- .getLocalInterfaces(container));
- }
-
- /**
- * Whether or not to bind the home and business interfaces together
- *
- * @return
- */
- @Override
- protected boolean bindHomeAndBusinessTogether()
- {
- return ProxyFactoryHelper.getLocalHomeJndiName(this.getContainer()).equals(jndiName);
- }
-
- @Override
- public void start() throws Exception
- {
- super.start();
- SessionSpecContainer statelessContainer = getContainer();
- LocalHome localHome = statelessContainer.getAnnotation(LocalHome.class);
- if (localHome != null && !bindHomeAndBusinessTogether())
- {
- Class<?>[] interfaces =
- {localHome.value()};
- Object homeProxy = java.lang.reflect.Proxy.newProxyInstance(getContainer().getBeanClass().getClassLoader(),
- interfaces, new StatelessLocalProxyInvocationHandler(getContainer(), null));
- Util.rebind(getContainer().getInitialContext(), ProxyFactoryHelper.getLocalHomeJndiName(getContainer()), homeProxy);
- }
- }
-
- @Override
- public void stop() throws Exception
- {
- super.stop();
- SessionSpecContainer statelessContainer = this.getContainer();
- LocalHome localHome = statelessContainer.getAnnotation(LocalHome.class);
- if (localHome != null && !bindHomeAndBusinessTogether())
- {
- Util.unbind(getContainer().getInitialContext(), ProxyFactoryHelper.getLocalHomeJndiName(getContainer()));
- }
- }
-
- public Object createProxyBusiness()
- {
- return this.createProxyBusiness(null);
- }
-
- public Object createProxyBusiness(String businessInterfaceType)
- {
- return this
- .constructProxyBusiness(new StatelessLocalProxyInvocationHandler(getContainer(), businessInterfaceType));
- }
-
- @SuppressWarnings("unchecked")
- public <T extends EJBLocalObject> T createProxyEjb21(String businessInterfaceType)
- {
- return (T) this.createProxy(SpecificationInterfaceType.EJB21, businessInterfaceType);
- }
-
- private Object createProxy(SpecificationInterfaceType type, String businessInterfaceType)
- {
- StatelessLocalProxyInvocationHandler proxy = new StatelessLocalProxyInvocationHandler(this.getContainer(),
- businessInterfaceType);
- return type.equals(SpecificationInterfaceType.EJB30_BUSINESS) ? this.constructProxyBusiness(proxy) : this
- .constructEjb21Proxy(proxy);
- }
-
- @Override
- protected StatelessHandleRemoteImpl createHandle()
- {
- // Local beans have no Handle
- //TODO Rework the contract such that this method does not need to be
- // defined for local proxy factories
- return null;
- }
-}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessLocalProxyFactory.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessLocalProxyFactory.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessLocalProxyFactory.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessLocalProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,156 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.factory.stateless;
+
+import javax.ejb.EJBLocalObject;
+import javax.ejb.LocalHome;
+
+import org.jboss.ejb3.EJBContainer;
+import org.jboss.ejb3.SpecificationInterfaceType;
+import org.jboss.ejb3.annotation.LocalBinding;
+import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
+import org.jboss.ejb3.proxy.handler.stateless.StatelessLocalProxyInvocationHandler;
+import org.jboss.ejb3.session.ProxyAccessType;
+import org.jboss.ejb3.session.SessionSpecContainer;
+import org.jboss.ejb3.stateless.StatelessHandleRemoteImpl;
+import org.jboss.logging.Logger;
+import org.jboss.util.naming.Util;
+
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+public class StatelessLocalProxyFactory extends BaseStatelessProxyFactory
+{
+ private static final Logger log = Logger.getLogger(StatelessLocalProxyFactory.class);
+
+ public StatelessLocalProxyFactory(SessionSpecContainer container, LocalBinding binding)
+ {
+ super(container, binding.jndiBinding());
+ }
+
+ /**
+ * Returns the interface type for Home
+ *
+ * @param container
+ * @return
+ */
+ @Override
+ protected Class<?> getHomeType()
+ {
+ return ProxyFactoryHelper.getLocalHomeInterface(this.getContainer());
+ }
+
+ @Override
+ protected ProxyAccessType getProxyAccessType()
+ {
+ return ProxyAccessType.LOCAL;
+ }
+
+
+ protected void validateEjb21Views(){
+
+ EJBContainer container = this.getContainer();
+
+ LocalHome localHome = container.getAnnotation(LocalHome.class);
+
+ // Ensure that if EJB 2.1 Components are defined, they're complete
+ this.validateEjb21Views(localHome == null ? null : localHome.value(), ProxyFactoryHelper
+ .getLocalInterfaces(container));
+ }
+
+ /**
+ * Whether or not to bind the home and business interfaces together
+ *
+ * @return
+ */
+ @Override
+ protected boolean bindHomeAndBusinessTogether()
+ {
+ return ProxyFactoryHelper.getLocalHomeJndiName(this.getContainer()).equals(jndiName);
+ }
+
+ @Override
+ public void start() throws Exception
+ {
+ super.start();
+ SessionSpecContainer statelessContainer = getContainer();
+ LocalHome localHome = statelessContainer.getAnnotation(LocalHome.class);
+ if (localHome != null && !bindHomeAndBusinessTogether())
+ {
+ Class<?>[] interfaces =
+ {localHome.value()};
+ Object homeProxy = java.lang.reflect.Proxy.newProxyInstance(getContainer().getBeanClass().getClassLoader(),
+ interfaces, new StatelessLocalProxyInvocationHandler(getContainer(), null));
+ Util.rebind(getContainer().getInitialContext(), ProxyFactoryHelper.getLocalHomeJndiName(getContainer()), homeProxy);
+ }
+ }
+
+ @Override
+ public void stop() throws Exception
+ {
+ super.stop();
+ SessionSpecContainer statelessContainer = this.getContainer();
+ LocalHome localHome = statelessContainer.getAnnotation(LocalHome.class);
+ if (localHome != null && !bindHomeAndBusinessTogether())
+ {
+ Util.unbind(getContainer().getInitialContext(), ProxyFactoryHelper.getLocalHomeJndiName(getContainer()));
+ }
+ }
+
+ public Object createProxyBusiness()
+ {
+ return this.createProxyBusiness(null);
+ }
+
+ public Object createProxyBusiness(String businessInterfaceType)
+ {
+ return this
+ .constructProxyBusiness(new StatelessLocalProxyInvocationHandler(getContainer(), businessInterfaceType));
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T extends EJBLocalObject> T createProxyEjb21(String businessInterfaceType)
+ {
+ return (T) this.createProxy(SpecificationInterfaceType.EJB21, businessInterfaceType);
+ }
+
+ private Object createProxy(SpecificationInterfaceType type, String businessInterfaceType)
+ {
+ StatelessLocalProxyInvocationHandler proxy = new StatelessLocalProxyInvocationHandler(this.getContainer(),
+ businessInterfaceType);
+ return type.equals(SpecificationInterfaceType.EJB30_BUSINESS) ? this.constructProxyBusiness(proxy) : this
+ .constructEjb21Proxy(proxy);
+ }
+
+ @Override
+ protected StatelessHandleRemoteImpl createHandle()
+ {
+ // Local beans have no Handle
+ //TODO Rework the contract such that this method does not need to be
+ // defined for local proxy factories
+ return null;
+ }
+}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessRemoteProxyFactory.java
===================================================================
--- projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessRemoteProxyFactory.java 2008-04-23 20:41:05 UTC (rev 72636)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessRemoteProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,148 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.factory.stateless;
-
-import javax.ejb.RemoteHome;
-import javax.naming.NamingException;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.aop.advice.AdviceStack;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
-import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
-import org.jboss.ejb3.proxy.handler.stateless.StatelessRemoteProxyInvocationHandler;
-import org.jboss.ejb3.session.SessionSpecContainer;
-import org.jboss.logging.Logger;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.util.naming.Util;
-
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public class StatelessRemoteProxyFactory extends BaseStatelessRemoteProxyFactory implements RemoteProxyFactory
-{
- private static final Logger log = Logger.getLogger(StatelessRemoteProxyFactory.class);
-
- private static final String STACK_NAME_STATELESS_SESSION_CLIENT_INTERCEPTORS = "StatelessSessionClientInterceptors";
-
- public StatelessRemoteProxyFactory(SessionSpecContainer container, RemoteBinding binding)
- {
- super(container, binding);
- }
-
- /**
- * Whether or not to bind the home and business interfaces together
- *
- * @return
- */
- @Override
- protected boolean bindHomeAndBusinessTogether()
- {
- SessionSpecContainer container = this.getContainer();
- return ProxyFactoryHelper.getHomeJndiName(container).equals(ProxyFactoryHelper.getRemoteBusinessJndiName(container));
- }
-
- public void init() throws Exception
- {
- super.init();
- }
-
- public void start() throws Exception
- {
- super.start();
- RemoteHome remoteHome = this.getContainer().getAnnotation(RemoteHome.class);
- if (remoteHome != null && !bindHomeAndEjb21ViewTogether(this.getContainer()))
- {
- Object homeProxy = createHomeProxy(remoteHome.value());
- String jndiName = ProxyFactoryHelper.getHomeJndiName(getContainer());
- try
- {
- log.debug("Binding proxy for " + getContainer().getEjbName() + " in JNDI at " + jndiName);
- Util.rebind(getContainer().getInitialContext(), jndiName, homeProxy);
- }
- catch (NamingException e)
- {
- NamingException namingException = new NamingException("Could not bind stateless home proxy with ejb name " + getContainer().getEjbName() + " into JNDI under jndiName: " + getContainer().getInitialContext().getNameInNamespace() + "/" + jndiName);
- namingException.setRootCause(e);
- throw namingException;
- }
-
- }
- }
-
- public void stop() throws Exception
- {
- super.stop();
- SessionSpecContainer statelessContainer = this.getContainer();
- RemoteHome remoteHome = this.getContainer().getAnnotation(RemoteHome.class);
- if (remoteHome != null && !bindHomeAndEjb21ViewTogether(statelessContainer))
- {
- Util.unbind(getContainer().getInitialContext(), ProxyFactoryHelper.getHomeJndiName(getContainer()));
- }
- }
-
- public Object createHomeProxy(Class<?> homeInterface)
- {
- try
- {
- String stackName = this.getStackNameInterceptors();
- RemoteBinding binding = this.getBinding();
- InvokerLocator locator = this.getLocator();
- if (binding.interceptorStack() != null && !binding.interceptorStack().equals(""))
- {
- stackName = binding.interceptorStack();
- }
- AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
- StatelessRemoteProxyInvocationHandler proxy = new StatelessRemoteProxyInvocationHandler(getContainer(), stack
- .createInterceptors(getContainer().getAdvisor(), null), locator, null);
- setEjb21Objects(proxy);
- Class<?>[] interfaces = {homeInterface};
- return java.lang.reflect.Proxy.newProxyInstance(getContainer().getBeanClass().getClassLoader(), interfaces, proxy);
- }
- catch (IllegalArgumentException e)
- {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * Returns the interface type for Home
- *
- * @return
- */
- @Override
- protected Class<?> getHomeType()
- {
- return ProxyFactoryHelper.getRemoteHomeInterface(this.getContainer());
- }
-
- @Override
- String getStackNameInterceptors()
- {
- return StatelessRemoteProxyFactory.STACK_NAME_STATELESS_SESSION_CLIENT_INTERCEPTORS;
- }
-
-}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessRemoteProxyFactory.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessRemoteProxyFactory.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessRemoteProxyFactory.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessRemoteProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,148 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.factory.stateless;
+
+import javax.ejb.RemoteHome;
+import javax.naming.NamingException;
+
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.advice.AdviceStack;
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
+import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
+import org.jboss.ejb3.proxy.handler.stateless.StatelessRemoteProxyInvocationHandler;
+import org.jboss.ejb3.session.SessionSpecContainer;
+import org.jboss.logging.Logger;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.util.naming.Util;
+
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+public class StatelessRemoteProxyFactory extends BaseStatelessRemoteProxyFactory implements RemoteProxyFactory
+{
+ private static final Logger log = Logger.getLogger(StatelessRemoteProxyFactory.class);
+
+ private static final String STACK_NAME_STATELESS_SESSION_CLIENT_INTERCEPTORS = "StatelessSessionClientInterceptors";
+
+ public StatelessRemoteProxyFactory(SessionSpecContainer container, RemoteBinding binding)
+ {
+ super(container, binding);
+ }
+
+ /**
+ * Whether or not to bind the home and business interfaces together
+ *
+ * @return
+ */
+ @Override
+ protected boolean bindHomeAndBusinessTogether()
+ {
+ SessionSpecContainer container = this.getContainer();
+ return ProxyFactoryHelper.getHomeJndiName(container).equals(ProxyFactoryHelper.getRemoteBusinessJndiName(container));
+ }
+
+ public void init() throws Exception
+ {
+ super.init();
+ }
+
+ public void start() throws Exception
+ {
+ super.start();
+ RemoteHome remoteHome = this.getContainer().getAnnotation(RemoteHome.class);
+ if (remoteHome != null && !bindHomeAndEjb21ViewTogether(this.getContainer()))
+ {
+ Object homeProxy = createHomeProxy(remoteHome.value());
+ String jndiName = ProxyFactoryHelper.getHomeJndiName(getContainer());
+ try
+ {
+ log.debug("Binding proxy for " + getContainer().getEjbName() + " in JNDI at " + jndiName);
+ Util.rebind(getContainer().getInitialContext(), jndiName, homeProxy);
+ }
+ catch (NamingException e)
+ {
+ NamingException namingException = new NamingException("Could not bind stateless home proxy with ejb name " + getContainer().getEjbName() + " into JNDI under jndiName: " + getContainer().getInitialContext().getNameInNamespace() + "/" + jndiName);
+ namingException.setRootCause(e);
+ throw namingException;
+ }
+
+ }
+ }
+
+ public void stop() throws Exception
+ {
+ super.stop();
+ SessionSpecContainer statelessContainer = this.getContainer();
+ RemoteHome remoteHome = this.getContainer().getAnnotation(RemoteHome.class);
+ if (remoteHome != null && !bindHomeAndEjb21ViewTogether(statelessContainer))
+ {
+ Util.unbind(getContainer().getInitialContext(), ProxyFactoryHelper.getHomeJndiName(getContainer()));
+ }
+ }
+
+ public Object createHomeProxy(Class<?> homeInterface)
+ {
+ try
+ {
+ String stackName = this.getStackNameInterceptors();
+ RemoteBinding binding = this.getBinding();
+ InvokerLocator locator = this.getLocator();
+ if (binding.interceptorStack() != null && !binding.interceptorStack().equals(""))
+ {
+ stackName = binding.interceptorStack();
+ }
+ AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
+ StatelessRemoteProxyInvocationHandler proxy = new StatelessRemoteProxyInvocationHandler(getContainer(), stack
+ .createInterceptors(getContainer().getAdvisor(), null), locator, null);
+ setEjb21Objects(proxy);
+ Class<?>[] interfaces = {homeInterface};
+ return java.lang.reflect.Proxy.newProxyInstance(getContainer().getBeanClass().getClassLoader(), interfaces, proxy);
+ }
+ catch (IllegalArgumentException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Returns the interface type for Home
+ *
+ * @return
+ */
+ @Override
+ protected Class<?> getHomeType()
+ {
+ return ProxyFactoryHelper.getRemoteHomeInterface(this.getContainer());
+ }
+
+ @Override
+ String getStackNameInterceptors()
+ {
+ return StatelessRemoteProxyFactory.STACK_NAME_STATELESS_SESSION_CLIENT_INTERCEPTORS;
+ }
+
+}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/handler)
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/BaseProxyInvocationHandler.java
===================================================================
--- projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/handler/BaseProxyInvocationHandler.java 2008-04-23 20:41:05 UTC (rev 72636)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/BaseProxyInvocationHandler.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,59 +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.handler;
-
-
-/**
- * BaseProxy
- *
- * Abstract base upon which all Proxy InvocationHandlers
- * may extend
- *
- * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
- * @version $Revision: $
- */
-public abstract class BaseProxyInvocationHandler implements ProxyInvocationHandler
-{
- // ------------------------------------------------------------------------------||
- // Instance Members -------------------------------------------------------------||
- // ------------------------------------------------------------------------------||
-
- /**
- * Fully-qualified name of the class targeted either for injection
- * or casting to support getInvokedBusinessInterface
- */
- private String businessInterfaceType;
-
- // ------------------------------------------------------------------------------||
- // Accessors / Mutators ---------------------------------------------------------||
- // ------------------------------------------------------------------------------||
-
- public String getBusinessInterfaceType()
- {
- return businessInterfaceType;
- }
-
- protected void setBusinessInterfaceType(String businessInterfaceType)
- {
- this.businessInterfaceType = businessInterfaceType;
- }
-}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/BaseProxyInvocationHandler.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/handler/BaseProxyInvocationHandler.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/BaseProxyInvocationHandler.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/BaseProxyInvocationHandler.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,59 @@
+/*
+ * 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.handler;
+
+
+/**
+ * BaseProxy
+ *
+ * Abstract base upon which all Proxy InvocationHandlers
+ * may extend
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public abstract class BaseProxyInvocationHandler implements ProxyInvocationHandler
+{
+ // ------------------------------------------------------------------------------||
+ // Instance Members -------------------------------------------------------------||
+ // ------------------------------------------------------------------------------||
+
+ /**
+ * Fully-qualified name of the class targeted either for injection
+ * or casting to support getInvokedBusinessInterface
+ */
+ private String businessInterfaceType;
+
+ // ------------------------------------------------------------------------------||
+ // Accessors / Mutators ---------------------------------------------------------||
+ // ------------------------------------------------------------------------------||
+
+ public String getBusinessInterfaceType()
+ {
+ return businessInterfaceType;
+ }
+
+ protected void setBusinessInterfaceType(String businessInterfaceType)
+ {
+ this.businessInterfaceType = businessInterfaceType;
+ }
+}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/BaseProxyInvocationHandlerRemote.java
===================================================================
--- projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/handler/BaseProxyInvocationHandlerRemote.java 2008-04-23 20:41:05 UTC (rev 72636)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/BaseProxyInvocationHandlerRemote.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,81 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.handler;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-
-import org.jboss.aop.advice.Interceptor;
-import org.jboss.aop.metadata.SimpleMetaData;
-import org.jboss.ejb3.Container;
-import org.jboss.ejb3.Ejb3Registry;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public abstract class BaseProxyInvocationHandlerRemote extends BaseProxyInvocationHandler implements java.io.Serializable, InvocationHandler, RemoteProxyInvocationHandler
-{
- private static final long serialVersionUID = 1126421850898582900L;
-
- protected String containerId;
- protected String containerGuid;
- protected Interceptor[] interceptors;
- protected SimpleMetaData metadata;
-
- protected BaseProxyInvocationHandlerRemote(Container container, Interceptor[] interceptors, String businessInterfaceType)
- {
- this.containerId = container.getObjectName().getCanonicalName();
- this.containerGuid = Ejb3Registry.guid(container);
- this.interceptors = interceptors;
- this.setBusinessInterfaceType(businessInterfaceType);
- }
-
- protected BaseProxyInvocationHandlerRemote(String containerId, String containerGuid, Interceptor[] interceptors, String businessInterfaceType)
- {
- this.containerId = containerId;
- this.containerGuid = containerGuid;
- this.interceptors = interceptors;
- this.setBusinessInterfaceType(businessInterfaceType);
- }
-
- protected BaseProxyInvocationHandlerRemote()
- {
- }
-
- public SimpleMetaData getMetaData()
- {
- synchronized (this)
- {
- if (metadata == null) metadata = new SimpleMetaData();
- }
- return metadata;
- }
-
- public abstract Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable;
-
- //Force all remote proxies to override toString()
- public abstract String toString();
-}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/BaseProxyInvocationHandlerRemote.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/handler/BaseProxyInvocationHandlerRemote.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/BaseProxyInvocationHandlerRemote.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/BaseProxyInvocationHandlerRemote.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.handler;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.metadata.SimpleMetaData;
+import org.jboss.ejb3.Container;
+import org.jboss.ejb3.Ejb3Registry;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+public abstract class BaseProxyInvocationHandlerRemote extends BaseProxyInvocationHandler implements java.io.Serializable, InvocationHandler, RemoteProxyInvocationHandler
+{
+ private static final long serialVersionUID = 1126421850898582900L;
+
+ protected String containerId;
+ protected String containerGuid;
+ protected Interceptor[] interceptors;
+ protected SimpleMetaData metadata;
+
+ protected BaseProxyInvocationHandlerRemote(Container container, Interceptor[] interceptors, String businessInterfaceType)
+ {
+ this.containerId = container.getObjectName().getCanonicalName();
+ this.containerGuid = Ejb3Registry.guid(container);
+ this.interceptors = interceptors;
+ this.setBusinessInterfaceType(businessInterfaceType);
+ }
+
+ protected BaseProxyInvocationHandlerRemote(String containerId, String containerGuid, Interceptor[] interceptors, String businessInterfaceType)
+ {
+ this.containerId = containerId;
+ this.containerGuid = containerGuid;
+ this.interceptors = interceptors;
+ this.setBusinessInterfaceType(businessInterfaceType);
+ }
+
+ protected BaseProxyInvocationHandlerRemote()
+ {
+ }
+
+ public SimpleMetaData getMetaData()
+ {
+ synchronized (this)
+ {
+ if (metadata == null) metadata = new SimpleMetaData();
+ }
+ return metadata;
+ }
+
+ public abstract Object invoke(Object proxy, Method method, Object[] args)
+ throws Throwable;
+
+ //Force all remote proxies to override toString()
+ public abstract String toString();
+}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/BaseSessionRemoteProxyInvocationHandler.java
===================================================================
--- projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/handler/BaseSessionRemoteProxyInvocationHandler.java 2008-04-23 20:41:05 UTC (rev 72636)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/BaseSessionRemoteProxyInvocationHandler.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,81 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.handler;
-
-import javax.ejb.EJBMetaData;
-import javax.ejb.Handle;
-import javax.ejb.HomeHandle;
-
-import org.jboss.aop.advice.Interceptor;
-import org.jboss.ejb3.Container;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- * @version $Revision$
- */
-public abstract class BaseSessionRemoteProxyInvocationHandler extends org.jboss.ejb3.proxy.handler.BaseProxyInvocationHandlerRemote
-{
- private static final long serialVersionUID = 8310915813626447181L;
-
- protected Object id;
-
- protected Handle handle;
- protected HomeHandle homeHandle;
- protected EJBMetaData ejbMetaData;
-
- public BaseSessionRemoteProxyInvocationHandler(Container container, Interceptor[] interceptors, String businessInterfaceType)
- {
- super(container, interceptors, businessInterfaceType);
- }
-
- public BaseSessionRemoteProxyInvocationHandler(String containerId, String containerGuid, Interceptor[] interceptors,
- String businessInterfaceType)
- {
- super(containerId, containerGuid, interceptors, businessInterfaceType);
- }
-
- protected BaseSessionRemoteProxyInvocationHandler()
- {
- }
-
- public Handle getHandle()
- {
- return this.handle;
- }
-
- public void setHandle(Handle handle)
- {
- this.handle = handle;
- }
-
- public void setHomeHandle(HomeHandle homeHandle)
- {
- this.homeHandle = homeHandle;
- }
-
- public void setEjbMetaData(EJBMetaData ejbMetaData)
- {
- this.ejbMetaData = ejbMetaData;
- }
-}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/BaseSessionRemoteProxyInvocationHandler.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/handler/BaseSessionRemoteProxyInvocationHandler.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/BaseSessionRemoteProxyInvocationHandler.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/BaseSessionRemoteProxyInvocationHandler.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.handler;
+
+import javax.ejb.EJBMetaData;
+import javax.ejb.Handle;
+import javax.ejb.HomeHandle;
+
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.ejb3.Container;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ * @version $Revision$
+ */
+public abstract class BaseSessionRemoteProxyInvocationHandler extends org.jboss.ejb3.proxy.handler.BaseProxyInvocationHandlerRemote
+{
+ private static final long serialVersionUID = 8310915813626447181L;
+
+ protected Object id;
+
+ protected Handle handle;
+ protected HomeHandle homeHandle;
+ protected EJBMetaData ejbMetaData;
+
+ public BaseSessionRemoteProxyInvocationHandler(Container container, Interceptor[] interceptors, String businessInterfaceType)
+ {
+ super(container, interceptors, businessInterfaceType);
+ }
+
+ public BaseSessionRemoteProxyInvocationHandler(String containerId, String containerGuid, Interceptor[] interceptors,
+ String businessInterfaceType)
+ {
+ super(containerId, containerGuid, interceptors, businessInterfaceType);
+ }
+
+ protected BaseSessionRemoteProxyInvocationHandler()
+ {
+ }
+
+ public Handle getHandle()
+ {
+ return this.handle;
+ }
+
+ public void setHandle(Handle handle)
+ {
+ this.handle = handle;
+ }
+
+ public void setHomeHandle(HomeHandle homeHandle)
+ {
+ this.homeHandle = homeHandle;
+ }
+
+ public void setEjbMetaData(EJBMetaData ejbMetaData)
+ {
+ this.ejbMetaData = ejbMetaData;
+ }
+}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandler.java
===================================================================
--- projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandler.java 2008-04-23 20:41:05 UTC (rev 72636)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandler.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,44 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.handler;
-
-/**
- * ProxyInvocationHandler
- *
- * Defines
- *
- * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
- * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
- * @version $Revision$
- */
-public interface ProxyInvocationHandler
-{
- /**
- * For use in hashCode, toString() and equals() *
- */
- String toString();
-
- Object getAsynchronousProxy(Object proxy);
-
- String getBusinessInterfaceType();
-}
\ No newline at end of file
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandler.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandler.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandler.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandler.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.handler;
+
+/**
+ * ProxyInvocationHandler
+ *
+ * Defines
+ *
+ * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision$
+ */
+public interface ProxyInvocationHandler
+{
+ /**
+ * For use in hashCode, toString() and equals() *
+ */
+ String toString();
+
+ Object getAsynchronousProxy(Object proxy);
+
+ String getBusinessInterfaceType();
+}
\ No newline at end of file
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/RemoteProxyInvocationHandler.java
===================================================================
--- projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/handler/RemoteProxyInvocationHandler.java 2008-04-23 20:41:05 UTC (rev 72636)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/RemoteProxyInvocationHandler.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,35 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.handler;
-
-import org.jboss.aop.metadata.SimpleMetaData;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public interface RemoteProxyInvocationHandler extends ProxyInvocationHandler
-{
- SimpleMetaData getMetaData();
-}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/RemoteProxyInvocationHandler.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/handler/RemoteProxyInvocationHandler.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/RemoteProxyInvocationHandler.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/RemoteProxyInvocationHandler.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.handler;
+
+import org.jboss.aop.metadata.SimpleMetaData;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+public interface RemoteProxyInvocationHandler extends ProxyInvocationHandler
+{
+ SimpleMetaData getMetaData();
+}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/service (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/handler/service)
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/service/ServiceLocalProxyInvocationHandler.java
===================================================================
--- projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/handler/service/ServiceLocalProxyInvocationHandler.java 2008-04-23 20:41:05 UTC (rev 72636)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/service/ServiceLocalProxyInvocationHandler.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,116 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.handler.service;
-
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-
-import org.jboss.aspects.asynch.AsynchMixin;
-import org.jboss.aspects.asynch.AsynchProvider;
-import org.jboss.aspects.asynch.FutureHolder;
-import org.jboss.ejb3.Container;
-import org.jboss.ejb3.LocalProxyInvocationHandler;
-import org.jboss.ejb3.proxy.JBossProxy;
-import org.jboss.ejb3.proxy.ProxyUtils;
-import org.jboss.ejb3.service.ServiceContainer;
-
-/**
- * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
- * @version $Revision$
- */
-public class ServiceLocalProxyInvocationHandler extends LocalProxyInvocationHandler
-{
- private static final long serialVersionUID = -4023671606878355605L;
-
- AsynchProvider provider;
-
- public ServiceLocalProxyInvocationHandler()
- {
- }
-
- public ServiceLocalProxyInvocationHandler(Container container)
- {
- super(container, null);
- }
-
- public ServiceLocalProxyInvocationHandler(AsynchProvider provider, Container container)
- {
- super(container, null);
- this.provider = provider;
- }
-
- public Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable
- {
- if (method.getDeclaringClass() == AsynchProvider.class)
- {
- return provider.getFuture();
- }
-
- Object ret = ProxyUtils.handleCallLocally((JBossProxy) proxy, this, method, args);
- if (ret != null)
- {
- return ret;
- }
-
- ServiceContainer sc = (ServiceContainer) getContainer();
- return sc.localInvoke(method, args, (FutureHolder) provider);
- }
-
- public Object getAsynchronousProxy(Object proxy)
- {
- Class<?>[] infs = proxy.getClass().getInterfaces();
- if (!ProxyUtils.isAsynchronous(infs))
- {
- Class<?>[] interfaces = ProxyUtils.addAsynchProviderInterface(infs);
- AsynchMixin mixin = new AsynchMixin();
- ServiceLocalProxyInvocationHandler handler = new ServiceLocalProxyInvocationHandler(mixin, getContainer());
- return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, handler);
- }
-
- //I was already asynchronous
- return proxy;
- }
-
- //@Override
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- {
- super.readExternal(in);
- provider = (AsynchProvider)in.readObject();
- }
-
- //@Override
- public void writeExternal(ObjectOutput out) throws IOException
- {
- super.writeExternal(out);
- out.writeObject(provider);
- }
-
- public String toString()
- {
- return proxyName;
- }
-
-}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/service/ServiceLocalProxyInvocationHandler.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/handler/service/ServiceLocalProxyInvocationHandler.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/service/ServiceLocalProxyInvocationHandler.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/service/ServiceLocalProxyInvocationHandler.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,116 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.handler.service;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+import org.jboss.aspects.asynch.AsynchMixin;
+import org.jboss.aspects.asynch.AsynchProvider;
+import org.jboss.aspects.asynch.FutureHolder;
+import org.jboss.ejb3.Container;
+import org.jboss.ejb3.LocalProxyInvocationHandler;
+import org.jboss.ejb3.proxy.JBossProxy;
+import org.jboss.ejb3.proxy.ProxyUtils;
+import org.jboss.ejb3.service.ServiceContainer;
+
+/**
+ * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
+ * @version $Revision$
+ */
+public class ServiceLocalProxyInvocationHandler extends LocalProxyInvocationHandler
+{
+ private static final long serialVersionUID = -4023671606878355605L;
+
+ AsynchProvider provider;
+
+ public ServiceLocalProxyInvocationHandler()
+ {
+ }
+
+ public ServiceLocalProxyInvocationHandler(Container container)
+ {
+ super(container, null);
+ }
+
+ public ServiceLocalProxyInvocationHandler(AsynchProvider provider, Container container)
+ {
+ super(container, null);
+ this.provider = provider;
+ }
+
+ public Object invoke(Object proxy, Method method, Object[] args)
+ throws Throwable
+ {
+ if (method.getDeclaringClass() == AsynchProvider.class)
+ {
+ return provider.getFuture();
+ }
+
+ Object ret = ProxyUtils.handleCallLocally((JBossProxy) proxy, this, method, args);
+ if (ret != null)
+ {
+ return ret;
+ }
+
+ ServiceContainer sc = (ServiceContainer) getContainer();
+ return sc.localInvoke(method, args, (FutureHolder) provider);
+ }
+
+ public Object getAsynchronousProxy(Object proxy)
+ {
+ Class<?>[] infs = proxy.getClass().getInterfaces();
+ if (!ProxyUtils.isAsynchronous(infs))
+ {
+ Class<?>[] interfaces = ProxyUtils.addAsynchProviderInterface(infs);
+ AsynchMixin mixin = new AsynchMixin();
+ ServiceLocalProxyInvocationHandler handler = new ServiceLocalProxyInvocationHandler(mixin, getContainer());
+ return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, handler);
+ }
+
+ //I was already asynchronous
+ return proxy;
+ }
+
+ //@Override
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
+ {
+ super.readExternal(in);
+ provider = (AsynchProvider)in.readObject();
+ }
+
+ //@Override
+ public void writeExternal(ObjectOutput out) throws IOException
+ {
+ super.writeExternal(out);
+ out.writeObject(provider);
+ }
+
+ public String toString()
+ {
+ return proxyName;
+ }
+
+}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/service/ServiceRemoteProxyInvocationHandler.java
===================================================================
--- projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/handler/service/ServiceRemoteProxyInvocationHandler.java 2008-04-23 20:41:05 UTC (rev 72636)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/service/ServiceRemoteProxyInvocationHandler.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,124 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.handler.service;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-
-import org.jboss.aop.Dispatcher;
-import org.jboss.aop.advice.Interceptor;
-import org.jboss.aop.joinpoint.MethodInvocation;
-import org.jboss.aop.util.MethodHashing;
-import org.jboss.aop.util.PayloadKey;
-import org.jboss.aspects.asynch.AsynchMixin;
-import org.jboss.aspects.asynch.AsynchProvider;
-import org.jboss.aspects.remoting.InvokeRemoteInterceptor;
-import org.jboss.ejb3.Container;
-import org.jboss.ejb3.asynchronous.AsynchronousInterceptor;
-import org.jboss.ejb3.proxy.JBossProxy;
-import org.jboss.ejb3.proxy.ProxyUtils;
-import org.jboss.ejb3.remoting.IsLocalInterceptor;
-import org.jboss.remoting.InvokerLocator;
-
-/**
- * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
- * @version $Revision$
- */
-public class ServiceRemoteProxyInvocationHandler extends org.jboss.ejb3.proxy.handler.BaseProxyInvocationHandlerRemote
-{
- private static final long serialVersionUID = 306994045720155142L;
-
- protected InvokerLocator uri;
- AsynchProvider provider;
-
- public ServiceRemoteProxyInvocationHandler(Container container, Interceptor[] interceptors, InvokerLocator uri)
- {
- super(container, interceptors, null);
- this.uri = uri;
- }
-
- public ServiceRemoteProxyInvocationHandler(AsynchProvider provider, String containerId, String containerGuid,
- Interceptor[] interceptors, InvokerLocator uri)
- {
- super(containerId, containerGuid, interceptors, null);
- this.uri = uri;
- this.provider = provider;
- }
-
- protected ServiceRemoteProxyInvocationHandler()
- {
- }
-
-
- public Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable
- {
- if (method.getDeclaringClass() == AsynchProvider.class)
- {
- return provider.getFuture();
- }
-
- long hash = MethodHashing.calculateHash(method);
- Object ret = ProxyUtils.handleCallLocally((JBossProxy) proxy, this, method, args);
- if (ret != null)
- {
- return ret;
- }
-
- MethodInvocation sri = new MethodInvocation(interceptors, hash, method, method, null);
- sri.setArguments(args);
- sri.setInstanceResolver(metadata);
- sri.getMetaData().addMetaData(Dispatcher.DISPATCHER, Dispatcher.OID, containerId, PayloadKey.AS_IS);
- sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.INVOKER_LOCATOR, uri, PayloadKey.AS_IS);
- sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.SUBSYSTEM, "AOP", PayloadKey.AS_IS);
- sri.getMetaData().addMetaData(IsLocalInterceptor.IS_LOCAL, IsLocalInterceptor.GUID, containerGuid, PayloadKey.AS_IS);
-
-
- if (provider != null)
- {
- sri.getMetaData().addMetaData(AsynchronousInterceptor.ASYNCH, AsynchronousInterceptor.INVOKE_ASYNCH, "YES", PayloadKey.AS_IS);
- }
- return sri.invokeNext();
- }
-
- public Object getAsynchronousProxy(Object proxy)
- {
- Class[] infs = proxy.getClass().getInterfaces();
- if (!ProxyUtils.isAsynchronous(infs))
- {
- Class[] interfaces = ProxyUtils.addAsynchProviderInterface(infs);
- AsynchMixin mixin = new AsynchMixin();
- Interceptor[] newInterceptors = ProxyUtils.addAsynchProxyInterceptor(mixin, interceptors);
- ServiceRemoteProxyInvocationHandler handler = new ServiceRemoteProxyInvocationHandler(mixin, containerId, containerGuid, newInterceptors, uri);
- return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, handler);
- }
-
- //I was already asynchronous
- return proxy;
- }
-
-
- public String toString()
- {
- return containerId.toString();
- }
-}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/service/ServiceRemoteProxyInvocationHandler.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/handler/service/ServiceRemoteProxyInvocationHandler.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/service/ServiceRemoteProxyInvocationHandler.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/service/ServiceRemoteProxyInvocationHandler.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,124 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.handler.service;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+import org.jboss.aop.Dispatcher;
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.joinpoint.MethodInvocation;
+import org.jboss.aop.util.MethodHashing;
+import org.jboss.aop.util.PayloadKey;
+import org.jboss.aspects.asynch.AsynchMixin;
+import org.jboss.aspects.asynch.AsynchProvider;
+import org.jboss.aspects.remoting.InvokeRemoteInterceptor;
+import org.jboss.ejb3.Container;
+import org.jboss.ejb3.asynchronous.AsynchronousInterceptor;
+import org.jboss.ejb3.proxy.JBossProxy;
+import org.jboss.ejb3.proxy.ProxyUtils;
+import org.jboss.ejb3.remoting.IsLocalInterceptor;
+import org.jboss.remoting.InvokerLocator;
+
+/**
+ * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
+ * @version $Revision$
+ */
+public class ServiceRemoteProxyInvocationHandler extends org.jboss.ejb3.proxy.handler.BaseProxyInvocationHandlerRemote
+{
+ private static final long serialVersionUID = 306994045720155142L;
+
+ protected InvokerLocator uri;
+ AsynchProvider provider;
+
+ public ServiceRemoteProxyInvocationHandler(Container container, Interceptor[] interceptors, InvokerLocator uri)
+ {
+ super(container, interceptors, null);
+ this.uri = uri;
+ }
+
+ public ServiceRemoteProxyInvocationHandler(AsynchProvider provider, String containerId, String containerGuid,
+ Interceptor[] interceptors, InvokerLocator uri)
+ {
+ super(containerId, containerGuid, interceptors, null);
+ this.uri = uri;
+ this.provider = provider;
+ }
+
+ protected ServiceRemoteProxyInvocationHandler()
+ {
+ }
+
+
+ public Object invoke(Object proxy, Method method, Object[] args)
+ throws Throwable
+ {
+ if (method.getDeclaringClass() == AsynchProvider.class)
+ {
+ return provider.getFuture();
+ }
+
+ long hash = MethodHashing.calculateHash(method);
+ Object ret = ProxyUtils.handleCallLocally((JBossProxy) proxy, this, method, args);
+ if (ret != null)
+ {
+ return ret;
+ }
+
+ MethodInvocation sri = new MethodInvocation(interceptors, hash, method, method, null);
+ sri.setArguments(args);
+ sri.setInstanceResolver(metadata);
+ sri.getMetaData().addMetaData(Dispatcher.DISPATCHER, Dispatcher.OID, containerId, PayloadKey.AS_IS);
+ sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.INVOKER_LOCATOR, uri, PayloadKey.AS_IS);
+ sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.SUBSYSTEM, "AOP", PayloadKey.AS_IS);
+ sri.getMetaData().addMetaData(IsLocalInterceptor.IS_LOCAL, IsLocalInterceptor.GUID, containerGuid, PayloadKey.AS_IS);
+
+
+ if (provider != null)
+ {
+ sri.getMetaData().addMetaData(AsynchronousInterceptor.ASYNCH, AsynchronousInterceptor.INVOKE_ASYNCH, "YES", PayloadKey.AS_IS);
+ }
+ return sri.invokeNext();
+ }
+
+ public Object getAsynchronousProxy(Object proxy)
+ {
+ Class[] infs = proxy.getClass().getInterfaces();
+ if (!ProxyUtils.isAsynchronous(infs))
+ {
+ Class[] interfaces = ProxyUtils.addAsynchProviderInterface(infs);
+ AsynchMixin mixin = new AsynchMixin();
+ Interceptor[] newInterceptors = ProxyUtils.addAsynchProxyInterceptor(mixin, interceptors);
+ ServiceRemoteProxyInvocationHandler handler = new ServiceRemoteProxyInvocationHandler(mixin, containerId, containerGuid, newInterceptors, uri);
+ return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, handler);
+ }
+
+ //I was already asynchronous
+ return proxy;
+ }
+
+
+ public String toString()
+ {
+ return containerId.toString();
+ }
+}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful)
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulClusteredInvocationHandler.java
===================================================================
--- projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulClusteredInvocationHandler.java 2008-04-23 20:41:05 UTC (rev 72636)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulClusteredInvocationHandler.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,169 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.handler.stateful;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-
-import org.jboss.aop.Dispatcher;
-import org.jboss.aop.advice.Interceptor;
-import org.jboss.aop.util.MethodHashing;
-import org.jboss.aop.util.PayloadKey;
-import org.jboss.aspects.asynch.AsynchMixin;
-import org.jboss.aspects.asynch.AsynchProvider;
-import org.jboss.aspects.remoting.ClusterConstants;
-import org.jboss.aspects.remoting.FamilyWrapper;
-import org.jboss.aspects.remoting.InvokeRemoteInterceptor;
-import org.jboss.ejb3.Container;
-import org.jboss.ejb3.asynchronous.AsynchronousInterceptor;
-import org.jboss.ejb3.proxy.JBossProxy;
-import org.jboss.ejb3.proxy.ProxyUtils;
-import org.jboss.ejb3.remoting.ClusteredIsLocalInterceptor;
-import org.jboss.ejb3.remoting.IsLocalInterceptor;
-import org.jboss.ejb3.stateful.ForwardId;
-import org.jboss.ejb3.stateful.StatefulConstants;
-import org.jboss.ejb3.stateful.StatefulRemoteInvocation;
-import org.jboss.ha.client.loadbalance.LoadBalancePolicy;
-import org.jboss.util.id.GUID;
-
-/**
- * InvocationHandler for a clustered SFSB proxy.
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @author Brian Stansberry
- * @version $Revision: 68144 $
- */
-public class StatefulClusteredInvocationHandler extends org.jboss.ejb3.proxy.handler.BaseProxyInvocationHandlerRemote
-{
- private static final long serialVersionUID = -1797802577940671292L;
-
- private Object id;
- protected FamilyWrapper family;
- protected LoadBalancePolicy lbPolicy;
- AsynchProvider provider;
- protected String partitionName;
-
-
- public StatefulClusteredInvocationHandler(Container container, Interceptor[] interceptors, FamilyWrapper family,
- LoadBalancePolicy lb, String partitionName, String businessInterfaceClassName)
- {
- super(container, interceptors, businessInterfaceClassName);
- this.family = family;
- this.lbPolicy = lb;
- this.partitionName = partitionName;
- }
-
- public StatefulClusteredInvocationHandler(AsynchProvider provider, String containerId, String containerGuid,
- Interceptor[] interceptors, FamilyWrapper family, LoadBalancePolicy lb, String partitionName,
- String businessInterfaceClassName)
- {
- super(containerId, containerGuid, interceptors, businessInterfaceClassName);
- this.provider = provider;
- this.family = family;
- this.lbPolicy = lb;
- this.partitionName = partitionName;
- }
-
- protected StatefulClusteredInvocationHandler()
- {
- }
-
- public Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable
- {
- if (method.getDeclaringClass() == AsynchProvider.class)
- {
- return provider.getFuture();
- }
-
- long hash = MethodHashing.calculateHash(method);
- Object ret = ProxyUtils.handleCallLocally(hash, (JBossProxy) proxy, this, method, args);
- if (ret != null)
- {
- return ret;
- }
-
- StatefulRemoteInvocation sri = new StatefulRemoteInvocation(interceptors, hash, method, method, null, id);
- sri.setArguments(args);
- sri.setInstanceResolver(metadata);
- sri.getMetaData().addMetaData(Dispatcher.DISPATCHER, Dispatcher.OID, containerId, PayloadKey.AS_IS);
- sri.getMetaData().addMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.CLUSTER_FAMILY_WRAPPER, family, PayloadKey.AS_IS);
- sri.getMetaData().addMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.LOADBALANCE_POLICY, lbPolicy, PayloadKey.AS_IS);
- sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.SUBSYSTEM, "AOP", PayloadKey.AS_IS);
- sri.getMetaData().addMetaData(ClusteredIsLocalInterceptor.PARTITION_NAME, ClusteredIsLocalInterceptor.PARTITION_NAME, partitionName, PayloadKey.TRANSIENT);
- sri.getMetaData().addMetaData(IsLocalInterceptor.IS_LOCAL, IsLocalInterceptor.GUID, containerGuid, PayloadKey.AS_IS);
-
- if (provider != null)
- {
- sri.getMetaData().addMetaData(AsynchronousInterceptor.ASYNCH, AsynchronousInterceptor.INVOKE_ASYNCH, "YES", PayloadKey.AS_IS);
- }
- try
- {
- Object rtn = sri.invokeNext();
- // if this is first invocation then container passes back actual ID
- if (id == null)
- {
- id = sri.getResponseAttachment(StatefulConstants.NEW_ID);
- }
- return rtn;
- }
- catch (ForwardId forward)
- {
- // if this is first invocation then container passes back actual ID
- // The ForwardId exception is needed if 1st operation throws an exception
- id = forward.getId();
- throw forward.getCause();
- }
- }
-
- public Object getAsynchronousProxy(Object proxy)
- {
- Class<?>[] infs = proxy.getClass().getInterfaces();
- if (!ProxyUtils.isAsynchronous(infs))
- {
- Class<?>[] interfaces = ProxyUtils.addAsynchProviderInterface(infs);
- AsynchMixin mixin = new AsynchMixin();
- Interceptor[] newInterceptors = ProxyUtils.addAsynchProxyInterceptor(mixin, interceptors);
- StatefulClusteredInvocationHandler handler = new StatefulClusteredInvocationHandler(mixin, containerId,
- containerGuid, newInterceptors, family, lbPolicy, partitionName, this.getBusinessInterfaceType());
- return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, handler);
- }
-
- //I was already asynchronous
- return proxy;
- }
-
- public String toString()
- {
- if (id != null)
- {
- return containerId.toString() + ":" + id.toString();
- }
- else
- {
- //If the proxy has not been used yet, create a temporary id
- GUID guid = new GUID();
- return containerId.toString() + ":" + guid.toString();
- }
- }
-
-}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulClusteredInvocationHandler.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulClusteredInvocationHandler.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulClusteredInvocationHandler.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulClusteredInvocationHandler.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,169 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.handler.stateful;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+import org.jboss.aop.Dispatcher;
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.util.MethodHashing;
+import org.jboss.aop.util.PayloadKey;
+import org.jboss.aspects.asynch.AsynchMixin;
+import org.jboss.aspects.asynch.AsynchProvider;
+import org.jboss.aspects.remoting.ClusterConstants;
+import org.jboss.aspects.remoting.FamilyWrapper;
+import org.jboss.aspects.remoting.InvokeRemoteInterceptor;
+import org.jboss.ejb3.Container;
+import org.jboss.ejb3.asynchronous.AsynchronousInterceptor;
+import org.jboss.ejb3.proxy.JBossProxy;
+import org.jboss.ejb3.proxy.ProxyUtils;
+import org.jboss.ejb3.remoting.ClusteredIsLocalInterceptor;
+import org.jboss.ejb3.remoting.IsLocalInterceptor;
+import org.jboss.ejb3.stateful.ForwardId;
+import org.jboss.ejb3.stateful.StatefulConstants;
+import org.jboss.ejb3.stateful.StatefulRemoteInvocation;
+import org.jboss.ha.client.loadbalance.LoadBalancePolicy;
+import org.jboss.util.id.GUID;
+
+/**
+ * InvocationHandler for a clustered SFSB proxy.
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @author Brian Stansberry
+ * @version $Revision: 68144 $
+ */
+public class StatefulClusteredInvocationHandler extends org.jboss.ejb3.proxy.handler.BaseProxyInvocationHandlerRemote
+{
+ private static final long serialVersionUID = -1797802577940671292L;
+
+ private Object id;
+ protected FamilyWrapper family;
+ protected LoadBalancePolicy lbPolicy;
+ AsynchProvider provider;
+ protected String partitionName;
+
+
+ public StatefulClusteredInvocationHandler(Container container, Interceptor[] interceptors, FamilyWrapper family,
+ LoadBalancePolicy lb, String partitionName, String businessInterfaceClassName)
+ {
+ super(container, interceptors, businessInterfaceClassName);
+ this.family = family;
+ this.lbPolicy = lb;
+ this.partitionName = partitionName;
+ }
+
+ public StatefulClusteredInvocationHandler(AsynchProvider provider, String containerId, String containerGuid,
+ Interceptor[] interceptors, FamilyWrapper family, LoadBalancePolicy lb, String partitionName,
+ String businessInterfaceClassName)
+ {
+ super(containerId, containerGuid, interceptors, businessInterfaceClassName);
+ this.provider = provider;
+ this.family = family;
+ this.lbPolicy = lb;
+ this.partitionName = partitionName;
+ }
+
+ protected StatefulClusteredInvocationHandler()
+ {
+ }
+
+ public Object invoke(Object proxy, Method method, Object[] args)
+ throws Throwable
+ {
+ if (method.getDeclaringClass() == AsynchProvider.class)
+ {
+ return provider.getFuture();
+ }
+
+ long hash = MethodHashing.calculateHash(method);
+ Object ret = ProxyUtils.handleCallLocally(hash, (JBossProxy) proxy, this, method, args);
+ if (ret != null)
+ {
+ return ret;
+ }
+
+ StatefulRemoteInvocation sri = new StatefulRemoteInvocation(interceptors, hash, method, method, null, id);
+ sri.setArguments(args);
+ sri.setInstanceResolver(metadata);
+ sri.getMetaData().addMetaData(Dispatcher.DISPATCHER, Dispatcher.OID, containerId, PayloadKey.AS_IS);
+ sri.getMetaData().addMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.CLUSTER_FAMILY_WRAPPER, family, PayloadKey.AS_IS);
+ sri.getMetaData().addMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.LOADBALANCE_POLICY, lbPolicy, PayloadKey.AS_IS);
+ sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.SUBSYSTEM, "AOP", PayloadKey.AS_IS);
+ sri.getMetaData().addMetaData(ClusteredIsLocalInterceptor.PARTITION_NAME, ClusteredIsLocalInterceptor.PARTITION_NAME, partitionName, PayloadKey.TRANSIENT);
+ sri.getMetaData().addMetaData(IsLocalInterceptor.IS_LOCAL, IsLocalInterceptor.GUID, containerGuid, PayloadKey.AS_IS);
+
+ if (provider != null)
+ {
+ sri.getMetaData().addMetaData(AsynchronousInterceptor.ASYNCH, AsynchronousInterceptor.INVOKE_ASYNCH, "YES", PayloadKey.AS_IS);
+ }
+ try
+ {
+ Object rtn = sri.invokeNext();
+ // if this is first invocation then container passes back actual ID
+ if (id == null)
+ {
+ id = sri.getResponseAttachment(StatefulConstants.NEW_ID);
+ }
+ return rtn;
+ }
+ catch (ForwardId forward)
+ {
+ // if this is first invocation then container passes back actual ID
+ // The ForwardId exception is needed if 1st operation throws an exception
+ id = forward.getId();
+ throw forward.getCause();
+ }
+ }
+
+ public Object getAsynchronousProxy(Object proxy)
+ {
+ Class<?>[] infs = proxy.getClass().getInterfaces();
+ if (!ProxyUtils.isAsynchronous(infs))
+ {
+ Class<?>[] interfaces = ProxyUtils.addAsynchProviderInterface(infs);
+ AsynchMixin mixin = new AsynchMixin();
+ Interceptor[] newInterceptors = ProxyUtils.addAsynchProxyInterceptor(mixin, interceptors);
+ StatefulClusteredInvocationHandler handler = new StatefulClusteredInvocationHandler(mixin, containerId,
+ containerGuid, newInterceptors, family, lbPolicy, partitionName, this.getBusinessInterfaceType());
+ return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, handler);
+ }
+
+ //I was already asynchronous
+ return proxy;
+ }
+
+ public String toString()
+ {
+ if (id != null)
+ {
+ return containerId.toString() + ":" + id.toString();
+ }
+ else
+ {
+ //If the proxy has not been used yet, create a temporary id
+ GUID guid = new GUID();
+ return containerId.toString() + ":" + guid.toString();
+ }
+ }
+
+}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulHomeRemoteProxyInvocationHandler.java
===================================================================
--- projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulHomeRemoteProxyInvocationHandler.java 2008-04-23 20:41:05 UTC (rev 72636)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulHomeRemoteProxyInvocationHandler.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,140 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.handler.stateful;
-
-import java.lang.reflect.Method;
-
-import javax.ejb.EJBMetaData;
-import javax.ejb.HomeHandle;
-
-import org.jboss.aop.Dispatcher;
-import org.jboss.aop.advice.Interceptor;
-import org.jboss.aop.util.MethodHashing;
-import org.jboss.aop.util.PayloadKey;
-import org.jboss.aspects.remoting.InvokeRemoteInterceptor;
-import org.jboss.ejb3.Container;
-import org.jboss.ejb3.proxy.ProxyUtils;
-import org.jboss.ejb3.remoting.IsLocalInterceptor;
-import org.jboss.ejb3.stateful.StatefulHandleRemoteImpl;
-import org.jboss.ejb3.stateful.StatefulRemoteInvocation;
-import org.jboss.logging.Logger;
-import org.jboss.remoting.InvokerLocator;
-
-/**
- * StatefulHomeRemoteProxyInvocationHandler
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision: 72001 $
- */
-public class StatefulHomeRemoteProxyInvocationHandler extends org.jboss.ejb3.proxy.handler.BaseSessionRemoteProxyInvocationHandler
-{
- private static final long serialVersionUID = 5509794838403316545L;
-
- private static final Logger log = Logger.getLogger(StatefulHomeRemoteProxyInvocationHandler.class);
-
- protected InvokerLocator uri;
- private HomeHandle homeHandle;
- private EJBMetaData ejbMetaData;
-
- public StatefulHomeRemoteProxyInvocationHandler(Container container, Interceptor[] interceptors, InvokerLocator uri)
- {
- super(container, interceptors, null);
- this.uri = uri;
- }
-
- public StatefulHomeRemoteProxyInvocationHandler(Container container, Interceptor[] interceptors, InvokerLocator uri, Object id)
- {
- super(container, interceptors, null);
- this.uri = uri;
- this.id = id;
- }
-
- protected StatefulHomeRemoteProxyInvocationHandler()
- {
- }
-
- public void setHandle(StatefulHandleRemoteImpl handle)
- {
- this.handle = handle;
- }
-
- public void setHomeHandle(HomeHandle homeHandle)
- {
- this.homeHandle = homeHandle;
- }
-
- public void setEjbMetaData(EJBMetaData ejbMetaData)
- {
- this.ejbMetaData = ejbMetaData;
- }
-
- public Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable
- {
- long hash = MethodHashing.calculateHash(method);
- Object ret = ProxyUtils.handleCallLocally(hash, proxy, this, method, args);
- if (ret != null)
- {
- return ret;
- }
-
- ret = handleEjb21CallLocally(method, args);
- if (ret != null)
- {
- return ret;
- }
-
- StatefulRemoteInvocation sri = new StatefulRemoteInvocation(interceptors, hash, method, method, null, null);
- sri.setArguments(args);
- sri.setInstanceResolver(metadata);
- sri.getMetaData().addMetaData(Dispatcher.DISPATCHER, Dispatcher.OID, containerId, PayloadKey.AS_IS);
- sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.INVOKER_LOCATOR, uri, PayloadKey.AS_IS);
- sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.SUBSYSTEM, "AOP", PayloadKey.AS_IS);
- sri.getMetaData().addMetaData(IsLocalInterceptor.IS_LOCAL, IsLocalInterceptor.GUID, containerGuid, PayloadKey.AS_IS);
-
- return sri.invokeNext();
- }
-
- public Object getAsynchronousProxy(Object proxy)
- {
- throw new RuntimeException("NOT IMPLEMENTED");
- }
-
- public String toString()
- {
- return containerId.toString() + ":Home";
- }
-
- private Object handleEjb21CallLocally(Method method, Object[] args)
- {
- if (method.equals(ProxyUtils.GET_HOME_HANDLE))
- {
- return homeHandle;
- }
- else if (method.equals(ProxyUtils.GET_EJB_METADATA))
- {
- return ejbMetaData;
- }
-
- return null;
- }
-}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulHomeRemoteProxyInvocationHandler.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulHomeRemoteProxyInvocationHandler.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulHomeRemoteProxyInvocationHandler.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulHomeRemoteProxyInvocationHandler.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,140 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.handler.stateful;
+
+import java.lang.reflect.Method;
+
+import javax.ejb.EJBMetaData;
+import javax.ejb.HomeHandle;
+
+import org.jboss.aop.Dispatcher;
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.util.MethodHashing;
+import org.jboss.aop.util.PayloadKey;
+import org.jboss.aspects.remoting.InvokeRemoteInterceptor;
+import org.jboss.ejb3.Container;
+import org.jboss.ejb3.proxy.ProxyUtils;
+import org.jboss.ejb3.remoting.IsLocalInterceptor;
+import org.jboss.ejb3.stateful.StatefulHandleRemoteImpl;
+import org.jboss.ejb3.stateful.StatefulRemoteInvocation;
+import org.jboss.logging.Logger;
+import org.jboss.remoting.InvokerLocator;
+
+/**
+ * StatefulHomeRemoteProxyInvocationHandler
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision: 72001 $
+ */
+public class StatefulHomeRemoteProxyInvocationHandler extends org.jboss.ejb3.proxy.handler.BaseSessionRemoteProxyInvocationHandler
+{
+ private static final long serialVersionUID = 5509794838403316545L;
+
+ private static final Logger log = Logger.getLogger(StatefulHomeRemoteProxyInvocationHandler.class);
+
+ protected InvokerLocator uri;
+ private HomeHandle homeHandle;
+ private EJBMetaData ejbMetaData;
+
+ public StatefulHomeRemoteProxyInvocationHandler(Container container, Interceptor[] interceptors, InvokerLocator uri)
+ {
+ super(container, interceptors, null);
+ this.uri = uri;
+ }
+
+ public StatefulHomeRemoteProxyInvocationHandler(Container container, Interceptor[] interceptors, InvokerLocator uri, Object id)
+ {
+ super(container, interceptors, null);
+ this.uri = uri;
+ this.id = id;
+ }
+
+ protected StatefulHomeRemoteProxyInvocationHandler()
+ {
+ }
+
+ public void setHandle(StatefulHandleRemoteImpl handle)
+ {
+ this.handle = handle;
+ }
+
+ public void setHomeHandle(HomeHandle homeHandle)
+ {
+ this.homeHandle = homeHandle;
+ }
+
+ public void setEjbMetaData(EJBMetaData ejbMetaData)
+ {
+ this.ejbMetaData = ejbMetaData;
+ }
+
+ public Object invoke(Object proxy, Method method, Object[] args)
+ throws Throwable
+ {
+ long hash = MethodHashing.calculateHash(method);
+ Object ret = ProxyUtils.handleCallLocally(hash, proxy, this, method, args);
+ if (ret != null)
+ {
+ return ret;
+ }
+
+ ret = handleEjb21CallLocally(method, args);
+ if (ret != null)
+ {
+ return ret;
+ }
+
+ StatefulRemoteInvocation sri = new StatefulRemoteInvocation(interceptors, hash, method, method, null, null);
+ sri.setArguments(args);
+ sri.setInstanceResolver(metadata);
+ sri.getMetaData().addMetaData(Dispatcher.DISPATCHER, Dispatcher.OID, containerId, PayloadKey.AS_IS);
+ sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.INVOKER_LOCATOR, uri, PayloadKey.AS_IS);
+ sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.SUBSYSTEM, "AOP", PayloadKey.AS_IS);
+ sri.getMetaData().addMetaData(IsLocalInterceptor.IS_LOCAL, IsLocalInterceptor.GUID, containerGuid, PayloadKey.AS_IS);
+
+ return sri.invokeNext();
+ }
+
+ public Object getAsynchronousProxy(Object proxy)
+ {
+ throw new RuntimeException("NOT IMPLEMENTED");
+ }
+
+ public String toString()
+ {
+ return containerId.toString() + ":Home";
+ }
+
+ private Object handleEjb21CallLocally(Method method, Object[] args)
+ {
+ if (method.equals(ProxyUtils.GET_HOME_HANDLE))
+ {
+ return homeHandle;
+ }
+ else if (method.equals(ProxyUtils.GET_EJB_METADATA))
+ {
+ return ejbMetaData;
+ }
+
+ return null;
+ }
+}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulLocalHomeProxyInvocationHandler.java
===================================================================
--- projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulLocalHomeProxyInvocationHandler.java 2008-04-23 20:41:05 UTC (rev 72636)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulLocalHomeProxyInvocationHandler.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,67 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.handler.stateful;
-
-import java.lang.reflect.Method;
-
-import org.jboss.ejb3.Container;
-import org.jboss.ejb3.LocalProxyInvocationHandler;
-import org.jboss.ejb3.session.SessionContainer;
-
-/**
- * StatefulLocalHomeProxyInvocationHandler
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision: 68194 $
- */
-public class StatefulLocalHomeProxyInvocationHandler extends LocalProxyInvocationHandler
-{
- private static final long serialVersionUID = -9026021347498876589L;
-
- public StatefulLocalHomeProxyInvocationHandler()
- {
- super();
- }
-
- public StatefulLocalHomeProxyInvocationHandler(Container container)
- {
- super(container, null);
- }
-
- public Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable
- {
- SessionContainer sfsb = (SessionContainer) getContainer();
- return sfsb.localHomeInvoke(method, args);
- }
-
- public Object getAsynchronousProxy(Object proxy)
- {
- throw new RuntimeException("NOT AVAILABLE FOR HOME PROXIES");
- }
-
- public String toString()
- {
- return proxyName + ": Home Proxy";
- }
-
-}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulLocalHomeProxyInvocationHandler.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulLocalHomeProxyInvocationHandler.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulLocalHomeProxyInvocationHandler.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulLocalHomeProxyInvocationHandler.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.handler.stateful;
+
+import java.lang.reflect.Method;
+
+import org.jboss.ejb3.Container;
+import org.jboss.ejb3.LocalProxyInvocationHandler;
+import org.jboss.ejb3.session.SessionContainer;
+
+/**
+ * StatefulLocalHomeProxyInvocationHandler
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision: 68194 $
+ */
+public class StatefulLocalHomeProxyInvocationHandler extends LocalProxyInvocationHandler
+{
+ private static final long serialVersionUID = -9026021347498876589L;
+
+ public StatefulLocalHomeProxyInvocationHandler()
+ {
+ super();
+ }
+
+ public StatefulLocalHomeProxyInvocationHandler(Container container)
+ {
+ super(container, null);
+ }
+
+ public Object invoke(Object proxy, Method method, Object[] args)
+ throws Throwable
+ {
+ SessionContainer sfsb = (SessionContainer) getContainer();
+ return sfsb.localHomeInvoke(method, args);
+ }
+
+ public Object getAsynchronousProxy(Object proxy)
+ {
+ throw new RuntimeException("NOT AVAILABLE FOR HOME PROXIES");
+ }
+
+ public String toString()
+ {
+ return proxyName + ": Home Proxy";
+ }
+
+}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulLocalProxyInvocationHandler.java
===================================================================
--- projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulLocalProxyInvocationHandler.java 2008-04-23 20:41:05 UTC (rev 72636)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulLocalProxyInvocationHandler.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,147 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.handler.stateful;
-
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.rmi.dgc.VMID;
-
-import javax.ejb.EJBException;
-
-import org.jboss.aspects.asynch.AsynchMixin;
-import org.jboss.aspects.asynch.AsynchProvider;
-import org.jboss.aspects.asynch.FutureHolder;
-import org.jboss.ejb3.Container;
-import org.jboss.ejb3.Ejb3Registry;
-import org.jboss.ejb3.LocalProxyInvocationHandler;
-import org.jboss.ejb3.proxy.ProxyUtils;
-import org.jboss.ejb3.session.SessionContainer;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision: 68194 $
- */
-public class StatefulLocalProxyInvocationHandler extends LocalProxyInvocationHandler
-{
- private static final long serialVersionUID = 206913210970415540L;
-
- protected Object id;
- AsynchProvider provider;
-
- protected boolean isClustered = false;
-
- public StatefulLocalProxyInvocationHandler(Container container, Object id, VMID vmid, String businessInterfaceType)
- {
- super(container, businessInterfaceType);
- this.id = id;
- this.containerGuid = Ejb3Registry.guid(container, vmid);
- isClustered = ((SessionContainer) container).isClustered();
- }
-
- public StatefulLocalProxyInvocationHandler(AsynchProvider provider, Container container, Object id,
- String businessInterfaceType)
- {
- super(container, businessInterfaceType);
- this.provider = provider;
- this.id = id;
- this.containerGuid = Ejb3Registry.guid(container);
- isClustered = ((SessionContainer) container).isClustered();
- }
-
- public StatefulLocalProxyInvocationHandler()
- {
- }
-
- //@Override
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- {
- super.readExternal(in);
- id = in.readObject();
- isClustered = in.readBoolean();
- }
-
- //@Override
- public void writeExternal(ObjectOutput out) throws IOException
- {
- super.writeExternal(out);
- out.writeObject(id);
- out.writeBoolean(isClustered);
- }
-
- public Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable
- {
- if (method.getDeclaringClass() == AsynchProvider.class)
- {
- return provider.getFuture();
- }
-
- // Make sure we get the cache id before getting the asynchronous interface
- Object ret = ProxyUtils.handleCallLocally(proxy, this, method, args);
- if (ret != null)
- {
- return ret;
- }
-
- Container container = Ejb3Registry.findContainer(containerGuid);
- if (isClustered && container == null && Ejb3Registry.hasClusterContainer(containerClusterUid))
- container = Ejb3Registry.getClusterContainer(containerClusterUid);
-
- if (container == null)
- throw new EJBException("Invalid (i.e. remote) invocation of local interface (null container) for " + containerGuid);
-
- SessionContainer sfsb = (SessionContainer)container;
- return sfsb.localInvoke(id, method, args, (FutureHolder) provider);
- }
-
- public Object getAsynchronousProxy(Object proxy)
- {
- Class<?>[] infs = proxy.getClass().getInterfaces();
- if (!ProxyUtils.isAsynchronous(infs))
- {
- Class<?>[] interfaces = ProxyUtils.addAsynchProviderInterface(infs);
- AsynchMixin mixin = new AsynchMixin();
- StatefulLocalProxyInvocationHandler handler = new StatefulLocalProxyInvocationHandler(mixin, getContainer(),
- id, this.getBusinessInterfaceType());
- return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, handler);
- }
-
- //I was already asynchronous
- return proxy;
- }
-
- public String toString()
- {
- if (getContainer() != null && id != null)
- {
- return getContainer().getEjbName().toString() + ":" + id.toString();
- }
-
- return proxyName;
- }
-
-}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulLocalProxyInvocationHandler.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulLocalProxyInvocationHandler.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulLocalProxyInvocationHandler.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulLocalProxyInvocationHandler.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,147 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.handler.stateful;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.rmi.dgc.VMID;
+
+import javax.ejb.EJBException;
+
+import org.jboss.aspects.asynch.AsynchMixin;
+import org.jboss.aspects.asynch.AsynchProvider;
+import org.jboss.aspects.asynch.FutureHolder;
+import org.jboss.ejb3.Container;
+import org.jboss.ejb3.Ejb3Registry;
+import org.jboss.ejb3.LocalProxyInvocationHandler;
+import org.jboss.ejb3.proxy.ProxyUtils;
+import org.jboss.ejb3.session.SessionContainer;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision: 68194 $
+ */
+public class StatefulLocalProxyInvocationHandler extends LocalProxyInvocationHandler
+{
+ private static final long serialVersionUID = 206913210970415540L;
+
+ protected Object id;
+ AsynchProvider provider;
+
+ protected boolean isClustered = false;
+
+ public StatefulLocalProxyInvocationHandler(Container container, Object id, VMID vmid, String businessInterfaceType)
+ {
+ super(container, businessInterfaceType);
+ this.id = id;
+ this.containerGuid = Ejb3Registry.guid(container, vmid);
+ isClustered = ((SessionContainer) container).isClustered();
+ }
+
+ public StatefulLocalProxyInvocationHandler(AsynchProvider provider, Container container, Object id,
+ String businessInterfaceType)
+ {
+ super(container, businessInterfaceType);
+ this.provider = provider;
+ this.id = id;
+ this.containerGuid = Ejb3Registry.guid(container);
+ isClustered = ((SessionContainer) container).isClustered();
+ }
+
+ public StatefulLocalProxyInvocationHandler()
+ {
+ }
+
+ //@Override
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
+ {
+ super.readExternal(in);
+ id = in.readObject();
+ isClustered = in.readBoolean();
+ }
+
+ //@Override
+ public void writeExternal(ObjectOutput out) throws IOException
+ {
+ super.writeExternal(out);
+ out.writeObject(id);
+ out.writeBoolean(isClustered);
+ }
+
+ public Object invoke(Object proxy, Method method, Object[] args)
+ throws Throwable
+ {
+ if (method.getDeclaringClass() == AsynchProvider.class)
+ {
+ return provider.getFuture();
+ }
+
+ // Make sure we get the cache id before getting the asynchronous interface
+ Object ret = ProxyUtils.handleCallLocally(proxy, this, method, args);
+ if (ret != null)
+ {
+ return ret;
+ }
+
+ Container container = Ejb3Registry.findContainer(containerGuid);
+ if (isClustered && container == null && Ejb3Registry.hasClusterContainer(containerClusterUid))
+ container = Ejb3Registry.getClusterContainer(containerClusterUid);
+
+ if (container == null)
+ throw new EJBException("Invalid (i.e. remote) invocation of local interface (null container) for " + containerGuid);
+
+ SessionContainer sfsb = (SessionContainer)container;
+ return sfsb.localInvoke(id, method, args, (FutureHolder) provider);
+ }
+
+ public Object getAsynchronousProxy(Object proxy)
+ {
+ Class<?>[] infs = proxy.getClass().getInterfaces();
+ if (!ProxyUtils.isAsynchronous(infs))
+ {
+ Class<?>[] interfaces = ProxyUtils.addAsynchProviderInterface(infs);
+ AsynchMixin mixin = new AsynchMixin();
+ StatefulLocalProxyInvocationHandler handler = new StatefulLocalProxyInvocationHandler(mixin, getContainer(),
+ id, this.getBusinessInterfaceType());
+ return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, handler);
+ }
+
+ //I was already asynchronous
+ return proxy;
+ }
+
+ public String toString()
+ {
+ if (getContainer() != null && id != null)
+ {
+ return getContainer().getEjbName().toString() + ":" + id.toString();
+ }
+
+ return proxyName;
+ }
+
+}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulRemoteProxyInvocationHandler.java
===================================================================
--- projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulRemoteProxyInvocationHandler.java 2008-04-23 20:41:05 UTC (rev 72636)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulRemoteProxyInvocationHandler.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,202 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.handler.stateful;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-
-import javax.ejb.EJBMetaData;
-import javax.ejb.Handle;
-import javax.ejb.HomeHandle;
-
-import org.jboss.aop.Dispatcher;
-import org.jboss.aop.advice.Interceptor;
-import org.jboss.aop.util.MethodHashing;
-import org.jboss.aop.util.PayloadKey;
-import org.jboss.aspects.asynch.AsynchMixin;
-import org.jboss.aspects.asynch.AsynchProvider;
-import org.jboss.aspects.remoting.InvokeRemoteInterceptor;
-import org.jboss.ejb3.Container;
-import org.jboss.ejb3.asynchronous.AsynchronousInterceptor;
-import org.jboss.ejb3.proxy.ProxyUtils;
-import org.jboss.ejb3.remoting.IsLocalInterceptor;
-import org.jboss.ejb3.stateful.ForwardId;
-import org.jboss.ejb3.stateful.StatefulConstants;
-import org.jboss.ejb3.stateful.StatefulHandleRemoteImpl;
-import org.jboss.ejb3.stateful.StatefulRemoteInvocation;
-import org.jboss.logging.Logger;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.util.id.GUID;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision: 72001 $
- */
-public class StatefulRemoteProxyInvocationHandler extends org.jboss.ejb3.proxy.handler.BaseSessionRemoteProxyInvocationHandler
-{
- private static final long serialVersionUID = -2164496320326661428L;
-
- private static final Logger log = Logger.getLogger(StatefulRemoteProxyInvocationHandler.class);
-
- protected InvokerLocator uri;
- AsynchProvider provider;
-
- private Handle handle;
- private HomeHandle homeHandle;
- private EJBMetaData ejbMetaData;
-
- public StatefulRemoteProxyInvocationHandler(Container container, Interceptor[] interceptors, InvokerLocator uri, Object id,
- String businessInterfaceType)
- {
- super(container, interceptors, businessInterfaceType);
- this.uri = uri;
- this.id = id;
- }
-
- public StatefulRemoteProxyInvocationHandler(AsynchProvider provider, String containerId, String containerGuid,
- Interceptor[] interceptors, InvokerLocator uri, String businessInterfaceType)
- {
- super(containerId, containerGuid, interceptors, businessInterfaceType);
- this.uri = uri;
- this.provider = provider;
- }
-
- protected StatefulRemoteProxyInvocationHandler()
- {
- }
-
- public void setHandle(StatefulHandleRemoteImpl handle)
- {
- this.handle = handle;
- }
-
- public void setHomeHandle(HomeHandle homeHandle)
- {
- this.homeHandle = homeHandle;
- }
-
- public void setEjbMetaData(EJBMetaData ejbMetaData)
- {
- this.ejbMetaData = ejbMetaData;
- }
-
- public Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable
- {
- if (method.getDeclaringClass() == AsynchProvider.class)
- {
- return provider.getFuture();
- }
-
- long hash = MethodHashing.calculateHash(method);
- Object ret = ProxyUtils.handleCallLocally(hash, proxy, this, method, args);
- if (ret != null)
- {
- return ret;
- }
-
- ret = handleEjb21CallLocally(method, args);
- if (ret != null)
- {
- return ret;
- }
-
- StatefulRemoteInvocation sri = new StatefulRemoteInvocation(interceptors, hash, method, method, null, id);
- sri.setArguments(args);
- sri.setInstanceResolver(metadata);
- sri.getMetaData().addMetaData(Dispatcher.DISPATCHER, Dispatcher.OID, containerId, PayloadKey.AS_IS);
- sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.INVOKER_LOCATOR, uri, PayloadKey.AS_IS);
- sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.SUBSYSTEM, "AOP", PayloadKey.AS_IS);
- sri.getMetaData().addMetaData(IsLocalInterceptor.IS_LOCAL, IsLocalInterceptor.GUID, containerGuid, PayloadKey.AS_IS);
-
- if (provider != null)
- {
- sri.getMetaData().addMetaData(AsynchronousInterceptor.ASYNCH, AsynchronousInterceptor.INVOKE_ASYNCH, "YES", PayloadKey.AS_IS);
- }
- try
- {
- Object rtn = sri.invokeNext();
- // if this is first invocation then container passes back actual ID
- if (id == null)
- {
- id = sri.getResponseAttachment(StatefulConstants.NEW_ID);
- }
- return rtn;
- }
- catch (ForwardId forward)
- {
- // if this is first invocation then container passes back actual ID
- // The ForwardId exception is needed if 1st operation throws an exception
- id = forward.getId();
- throw forward.getCause();
- }
- }
-
- public Object getAsynchronousProxy(Object proxy)
- {
- Class<?>[] infs = proxy.getClass().getInterfaces();
- if (!ProxyUtils.isAsynchronous(infs))
- {
- Class<?>[] interfaces = ProxyUtils.addAsynchProviderInterface(infs);
- AsynchMixin mixin = new AsynchMixin();
- Interceptor[] newInterceptors = ProxyUtils.addAsynchProxyInterceptor(mixin, interceptors);
- StatefulRemoteProxyInvocationHandler handler = new StatefulRemoteProxyInvocationHandler(mixin, containerId, containerGuid, newInterceptors, uri,
- this.getBusinessInterfaceType());
- return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, handler);
- }
-
- //I was already asynchronous
- return proxy;
- }
-
- public String toString()
- {
- if (id != null)
- {
- return containerId.toString() + ":" + id.toString();
- }
- else
- {
- //If the proxy has not been used yet, create a temporary id
- GUID guid = new GUID();
- return containerId.toString() + ":" + guid.toString();
- }
- }
-
- private Object handleEjb21CallLocally(Method method, Object[] args)
- {
- if (method.equals(ProxyUtils.GET_HOME_HANDLE))
- {
- return homeHandle;
- } else if (method.equals(ProxyUtils.GET_EJB_METADATA))
- {
- return ejbMetaData;
- } else if (method.equals(ProxyUtils.GET_HANDLE))
- {
- return handle;
- }
-
- return null;
- }
-}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulRemoteProxyInvocationHandler.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulRemoteProxyInvocationHandler.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulRemoteProxyInvocationHandler.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulRemoteProxyInvocationHandler.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,202 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.handler.stateful;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+import javax.ejb.EJBMetaData;
+import javax.ejb.Handle;
+import javax.ejb.HomeHandle;
+
+import org.jboss.aop.Dispatcher;
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.util.MethodHashing;
+import org.jboss.aop.util.PayloadKey;
+import org.jboss.aspects.asynch.AsynchMixin;
+import org.jboss.aspects.asynch.AsynchProvider;
+import org.jboss.aspects.remoting.InvokeRemoteInterceptor;
+import org.jboss.ejb3.Container;
+import org.jboss.ejb3.asynchronous.AsynchronousInterceptor;
+import org.jboss.ejb3.proxy.ProxyUtils;
+import org.jboss.ejb3.remoting.IsLocalInterceptor;
+import org.jboss.ejb3.stateful.ForwardId;
+import org.jboss.ejb3.stateful.StatefulConstants;
+import org.jboss.ejb3.stateful.StatefulHandleRemoteImpl;
+import org.jboss.ejb3.stateful.StatefulRemoteInvocation;
+import org.jboss.logging.Logger;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.util.id.GUID;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision: 72001 $
+ */
+public class StatefulRemoteProxyInvocationHandler extends org.jboss.ejb3.proxy.handler.BaseSessionRemoteProxyInvocationHandler
+{
+ private static final long serialVersionUID = -2164496320326661428L;
+
+ private static final Logger log = Logger.getLogger(StatefulRemoteProxyInvocationHandler.class);
+
+ protected InvokerLocator uri;
+ AsynchProvider provider;
+
+ private Handle handle;
+ private HomeHandle homeHandle;
+ private EJBMetaData ejbMetaData;
+
+ public StatefulRemoteProxyInvocationHandler(Container container, Interceptor[] interceptors, InvokerLocator uri, Object id,
+ String businessInterfaceType)
+ {
+ super(container, interceptors, businessInterfaceType);
+ this.uri = uri;
+ this.id = id;
+ }
+
+ public StatefulRemoteProxyInvocationHandler(AsynchProvider provider, String containerId, String containerGuid,
+ Interceptor[] interceptors, InvokerLocator uri, String businessInterfaceType)
+ {
+ super(containerId, containerGuid, interceptors, businessInterfaceType);
+ this.uri = uri;
+ this.provider = provider;
+ }
+
+ protected StatefulRemoteProxyInvocationHandler()
+ {
+ }
+
+ public void setHandle(StatefulHandleRemoteImpl handle)
+ {
+ this.handle = handle;
+ }
+
+ public void setHomeHandle(HomeHandle homeHandle)
+ {
+ this.homeHandle = homeHandle;
+ }
+
+ public void setEjbMetaData(EJBMetaData ejbMetaData)
+ {
+ this.ejbMetaData = ejbMetaData;
+ }
+
+ public Object invoke(Object proxy, Method method, Object[] args)
+ throws Throwable
+ {
+ if (method.getDeclaringClass() == AsynchProvider.class)
+ {
+ return provider.getFuture();
+ }
+
+ long hash = MethodHashing.calculateHash(method);
+ Object ret = ProxyUtils.handleCallLocally(hash, proxy, this, method, args);
+ if (ret != null)
+ {
+ return ret;
+ }
+
+ ret = handleEjb21CallLocally(method, args);
+ if (ret != null)
+ {
+ return ret;
+ }
+
+ StatefulRemoteInvocation sri = new StatefulRemoteInvocation(interceptors, hash, method, method, null, id);
+ sri.setArguments(args);
+ sri.setInstanceResolver(metadata);
+ sri.getMetaData().addMetaData(Dispatcher.DISPATCHER, Dispatcher.OID, containerId, PayloadKey.AS_IS);
+ sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.INVOKER_LOCATOR, uri, PayloadKey.AS_IS);
+ sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.SUBSYSTEM, "AOP", PayloadKey.AS_IS);
+ sri.getMetaData().addMetaData(IsLocalInterceptor.IS_LOCAL, IsLocalInterceptor.GUID, containerGuid, PayloadKey.AS_IS);
+
+ if (provider != null)
+ {
+ sri.getMetaData().addMetaData(AsynchronousInterceptor.ASYNCH, AsynchronousInterceptor.INVOKE_ASYNCH, "YES", PayloadKey.AS_IS);
+ }
+ try
+ {
+ Object rtn = sri.invokeNext();
+ // if this is first invocation then container passes back actual ID
+ if (id == null)
+ {
+ id = sri.getResponseAttachment(StatefulConstants.NEW_ID);
+ }
+ return rtn;
+ }
+ catch (ForwardId forward)
+ {
+ // if this is first invocation then container passes back actual ID
+ // The ForwardId exception is needed if 1st operation throws an exception
+ id = forward.getId();
+ throw forward.getCause();
+ }
+ }
+
+ public Object getAsynchronousProxy(Object proxy)
+ {
+ Class<?>[] infs = proxy.getClass().getInterfaces();
+ if (!ProxyUtils.isAsynchronous(infs))
+ {
+ Class<?>[] interfaces = ProxyUtils.addAsynchProviderInterface(infs);
+ AsynchMixin mixin = new AsynchMixin();
+ Interceptor[] newInterceptors = ProxyUtils.addAsynchProxyInterceptor(mixin, interceptors);
+ StatefulRemoteProxyInvocationHandler handler = new StatefulRemoteProxyInvocationHandler(mixin, containerId, containerGuid, newInterceptors, uri,
+ this.getBusinessInterfaceType());
+ return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, handler);
+ }
+
+ //I was already asynchronous
+ return proxy;
+ }
+
+ public String toString()
+ {
+ if (id != null)
+ {
+ return containerId.toString() + ":" + id.toString();
+ }
+ else
+ {
+ //If the proxy has not been used yet, create a temporary id
+ GUID guid = new GUID();
+ return containerId.toString() + ":" + guid.toString();
+ }
+ }
+
+ private Object handleEjb21CallLocally(Method method, Object[] args)
+ {
+ if (method.equals(ProxyUtils.GET_HOME_HANDLE))
+ {
+ return homeHandle;
+ } else if (method.equals(ProxyUtils.GET_EJB_METADATA))
+ {
+ return ejbMetaData;
+ } else if (method.equals(ProxyUtils.GET_HANDLE))
+ {
+ return handle;
+ }
+
+ return null;
+ }
+}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateless (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/handler/stateless)
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateless/StatelessClusteredInvocationHandler.java
===================================================================
--- projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/handler/stateless/StatelessClusteredInvocationHandler.java 2008-04-23 20:41:05 UTC (rev 72636)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateless/StatelessClusteredInvocationHandler.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,140 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.handler.stateless;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import org.jboss.aop.Dispatcher;
-import org.jboss.aop.advice.Interceptor;
-import org.jboss.aop.joinpoint.MethodInvocation;
-import org.jboss.aop.util.MethodHashing;
-import org.jboss.aop.util.PayloadKey;
-import org.jboss.aspects.asynch.AsynchMixin;
-import org.jboss.aspects.asynch.AsynchProvider;
-import org.jboss.aspects.remoting.ClusterConstants;
-import org.jboss.aspects.remoting.FamilyWrapper;
-import org.jboss.aspects.remoting.InvokeRemoteInterceptor;
-import org.jboss.ejb3.Container;
-import org.jboss.ejb3.Ejb3Registry;
-import org.jboss.ejb3.asynchronous.AsynchronousInterceptor;
-import org.jboss.ejb3.proxy.JBossProxy;
-import org.jboss.ejb3.proxy.ProxyUtils;
-import org.jboss.ejb3.proxy.handler.BaseProxyInvocationHandlerRemote;
-import org.jboss.ejb3.remoting.ClusteredIsLocalInterceptor;
-import org.jboss.ejb3.remoting.IsLocalInterceptor;
-import org.jboss.ha.client.loadbalance.LoadBalancePolicy;
-
-/**
- * InvocationHandler for a clustered SLSB proxy.
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @author Brian Stansberry
- * @version $Revision$
- */
-public class StatelessClusteredInvocationHandler extends BaseProxyInvocationHandlerRemote
-{
- private static final long serialVersionUID = -4100015258079818357L;
-
- protected FamilyWrapper family;
- protected LoadBalancePolicy lbPolicy;
- AsynchProvider provider;
- protected String partitionName;
-
- public StatelessClusteredInvocationHandler(Container container, Interceptor[] interceptors, FamilyWrapper family,
- LoadBalancePolicy lbPolicy, String partitionName, String businessInterfaceClassName)
- {
- super(container, interceptors, businessInterfaceClassName);
- this.family = family;
- this.lbPolicy = lbPolicy;
- this.partitionName = partitionName;
- }
-
- public StatelessClusteredInvocationHandler(AsynchProvider provider, String containerId, String containerGuid,
- Interceptor[] interceptors, FamilyWrapper family, LoadBalancePolicy lbPolicy, String partitionName,
- String businessInterfaceClassName)
- {
- super(containerId, containerGuid, interceptors, businessInterfaceClassName);
- this.provider = provider;
- this.family = family;
- this.lbPolicy = lbPolicy;
- this.partitionName = partitionName;
- }
-
- public StatelessClusteredInvocationHandler()
- {
- }
-
- public Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable
- {
- if (method.getDeclaringClass() == AsynchProvider.class)
- {
- return provider.getFuture();
- }
-
- long hash = MethodHashing.calculateHash(method);
- Object ret = ProxyUtils.handleCallLocally(hash, (JBossProxy) proxy, this, method, args);
- if (ret != null)
- {
- return ret;
- }
-
- MethodInvocation sri = new MethodInvocation(interceptors, hash, method, method, null);
- sri.setArguments(args);
- sri.setInstanceResolver(metadata);
- sri.getMetaData().addMetaData(Dispatcher.DISPATCHER, Dispatcher.OID, containerId, PayloadKey.AS_IS);
- sri.getMetaData().addMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.CLUSTER_FAMILY_WRAPPER, family, PayloadKey.AS_IS);
- sri.getMetaData().addMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.LOADBALANCE_POLICY, lbPolicy, PayloadKey.AS_IS);
- sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.SUBSYSTEM, "AOP", PayloadKey.AS_IS);
- sri.getMetaData().addMetaData(ClusteredIsLocalInterceptor.PARTITION_NAME, ClusteredIsLocalInterceptor.PARTITION_NAME, partitionName, PayloadKey.TRANSIENT);
- sri.getMetaData().addMetaData(IsLocalInterceptor.IS_LOCAL, IsLocalInterceptor.GUID, containerGuid, PayloadKey.AS_IS);
-
- if (provider != null)
- {
- sri.getMetaData().addMetaData(AsynchronousInterceptor.ASYNCH, AsynchronousInterceptor.INVOKE_ASYNCH, "YES", PayloadKey.AS_IS);
- }
- return sri.invokeNext();
- }
-
- public Object getAsynchronousProxy(Object proxy)
- {
- Class<?>[] infs = proxy.getClass().getInterfaces();
- if (!ProxyUtils.isAsynchronous(infs))
- {
- Class<?>[] interfaces = ProxyUtils.addAsynchProviderInterface(infs);
- AsynchMixin mixin = new AsynchMixin();
- Interceptor[] newInterceptors = ProxyUtils.addAsynchProxyInterceptor(mixin, interceptors);
- StatelessClusteredInvocationHandler handler = new StatelessClusteredInvocationHandler(mixin, containerId,
- containerGuid, newInterceptors, family, lbPolicy, partitionName, this.getBusinessInterfaceType());
- return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, handler);
- }
-
- //I was already asynchronous
- return proxy;
- }
-
- public String toString()
- {
- return containerId.toString();
- }
-
-}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateless/StatelessClusteredInvocationHandler.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/handler/stateless/StatelessClusteredInvocationHandler.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateless/StatelessClusteredInvocationHandler.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateless/StatelessClusteredInvocationHandler.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,140 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.handler.stateless;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import org.jboss.aop.Dispatcher;
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.joinpoint.MethodInvocation;
+import org.jboss.aop.util.MethodHashing;
+import org.jboss.aop.util.PayloadKey;
+import org.jboss.aspects.asynch.AsynchMixin;
+import org.jboss.aspects.asynch.AsynchProvider;
+import org.jboss.aspects.remoting.ClusterConstants;
+import org.jboss.aspects.remoting.FamilyWrapper;
+import org.jboss.aspects.remoting.InvokeRemoteInterceptor;
+import org.jboss.ejb3.Container;
+import org.jboss.ejb3.Ejb3Registry;
+import org.jboss.ejb3.asynchronous.AsynchronousInterceptor;
+import org.jboss.ejb3.proxy.JBossProxy;
+import org.jboss.ejb3.proxy.ProxyUtils;
+import org.jboss.ejb3.proxy.handler.BaseProxyInvocationHandlerRemote;
+import org.jboss.ejb3.remoting.ClusteredIsLocalInterceptor;
+import org.jboss.ejb3.remoting.IsLocalInterceptor;
+import org.jboss.ha.client.loadbalance.LoadBalancePolicy;
+
+/**
+ * InvocationHandler for a clustered SLSB proxy.
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @author Brian Stansberry
+ * @version $Revision$
+ */
+public class StatelessClusteredInvocationHandler extends BaseProxyInvocationHandlerRemote
+{
+ private static final long serialVersionUID = -4100015258079818357L;
+
+ protected FamilyWrapper family;
+ protected LoadBalancePolicy lbPolicy;
+ AsynchProvider provider;
+ protected String partitionName;
+
+ public StatelessClusteredInvocationHandler(Container container, Interceptor[] interceptors, FamilyWrapper family,
+ LoadBalancePolicy lbPolicy, String partitionName, String businessInterfaceClassName)
+ {
+ super(container, interceptors, businessInterfaceClassName);
+ this.family = family;
+ this.lbPolicy = lbPolicy;
+ this.partitionName = partitionName;
+ }
+
+ public StatelessClusteredInvocationHandler(AsynchProvider provider, String containerId, String containerGuid,
+ Interceptor[] interceptors, FamilyWrapper family, LoadBalancePolicy lbPolicy, String partitionName,
+ String businessInterfaceClassName)
+ {
+ super(containerId, containerGuid, interceptors, businessInterfaceClassName);
+ this.provider = provider;
+ this.family = family;
+ this.lbPolicy = lbPolicy;
+ this.partitionName = partitionName;
+ }
+
+ public StatelessClusteredInvocationHandler()
+ {
+ }
+
+ public Object invoke(Object proxy, Method method, Object[] args)
+ throws Throwable
+ {
+ if (method.getDeclaringClass() == AsynchProvider.class)
+ {
+ return provider.getFuture();
+ }
+
+ long hash = MethodHashing.calculateHash(method);
+ Object ret = ProxyUtils.handleCallLocally(hash, (JBossProxy) proxy, this, method, args);
+ if (ret != null)
+ {
+ return ret;
+ }
+
+ MethodInvocation sri = new MethodInvocation(interceptors, hash, method, method, null);
+ sri.setArguments(args);
+ sri.setInstanceResolver(metadata);
+ sri.getMetaData().addMetaData(Dispatcher.DISPATCHER, Dispatcher.OID, containerId, PayloadKey.AS_IS);
+ sri.getMetaData().addMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.CLUSTER_FAMILY_WRAPPER, family, PayloadKey.AS_IS);
+ sri.getMetaData().addMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.LOADBALANCE_POLICY, lbPolicy, PayloadKey.AS_IS);
+ sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.SUBSYSTEM, "AOP", PayloadKey.AS_IS);
+ sri.getMetaData().addMetaData(ClusteredIsLocalInterceptor.PARTITION_NAME, ClusteredIsLocalInterceptor.PARTITION_NAME, partitionName, PayloadKey.TRANSIENT);
+ sri.getMetaData().addMetaData(IsLocalInterceptor.IS_LOCAL, IsLocalInterceptor.GUID, containerGuid, PayloadKey.AS_IS);
+
+ if (provider != null)
+ {
+ sri.getMetaData().addMetaData(AsynchronousInterceptor.ASYNCH, AsynchronousInterceptor.INVOKE_ASYNCH, "YES", PayloadKey.AS_IS);
+ }
+ return sri.invokeNext();
+ }
+
+ public Object getAsynchronousProxy(Object proxy)
+ {
+ Class<?>[] infs = proxy.getClass().getInterfaces();
+ if (!ProxyUtils.isAsynchronous(infs))
+ {
+ Class<?>[] interfaces = ProxyUtils.addAsynchProviderInterface(infs);
+ AsynchMixin mixin = new AsynchMixin();
+ Interceptor[] newInterceptors = ProxyUtils.addAsynchProxyInterceptor(mixin, interceptors);
+ StatelessClusteredInvocationHandler handler = new StatelessClusteredInvocationHandler(mixin, containerId,
+ containerGuid, newInterceptors, family, lbPolicy, partitionName, this.getBusinessInterfaceType());
+ return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, handler);
+ }
+
+ //I was already asynchronous
+ return proxy;
+ }
+
+ public String toString()
+ {
+ return containerId.toString();
+ }
+
+}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateless/StatelessLocalProxyInvocationHandler.java
===================================================================
--- projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/handler/stateless/StatelessLocalProxyInvocationHandler.java 2008-04-23 20:41:05 UTC (rev 72636)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateless/StatelessLocalProxyInvocationHandler.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,130 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.handler.stateless;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-
-import javax.ejb.EJBException;
-
-import org.jboss.aspects.asynch.AsynchMixin;
-import org.jboss.aspects.asynch.AsynchProvider;
-import org.jboss.aspects.asynch.FutureHolder;
-import org.jboss.ejb3.Container;
-import org.jboss.ejb3.LocalProxyInvocationHandler;
-import org.jboss.ejb3.proxy.ProxyUtils;
-import org.jboss.ejb3.stateless.StatelessContainer;
-import org.jboss.logging.Logger;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public class StatelessLocalProxyInvocationHandler extends LocalProxyInvocationHandler
-{
- private static final long serialVersionUID = -3241008127518089831L;
-
- private static final Logger log = Logger.getLogger(StatelessLocalProxyInvocationHandler.class);
-
- AsynchProvider provider;
-
- public StatelessLocalProxyInvocationHandler()
- {
- }
-
- public StatelessLocalProxyInvocationHandler(Container container, String businessInterfaceType)
- {
- super(container, businessInterfaceType);
- }
-
- public StatelessLocalProxyInvocationHandler(AsynchProvider provider, Container container,
- String businessInterfaceType)
- {
- super(container, businessInterfaceType);
- this.provider = provider;
- }
-
- public Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable
- {
- if (method.getDeclaringClass() == AsynchProvider.class)
- {
- return provider.getFuture();
- }
-
- Object ret = ProxyUtils.handleCallLocally(proxy, this, method, args);
- if (ret != null)
- {
- return ret;
- }
-
- StatelessContainer container = (StatelessContainer) getContainer();
-
- if (container == null)
- {
- throw new EJBException("Invalid invocation of local interface (null container)");
- }
-
- return container.localInvoke(method, args, (FutureHolder) provider);
- }
-
- public Object getAsynchronousProxy(Object proxy)
- {
- Class<?>[] infs = proxy.getClass().getInterfaces();
- if (!ProxyUtils.isAsynchronous(infs))
- {
- Class<?>[] interfaces = ProxyUtils.addAsynchProviderInterface(infs);
- AsynchMixin mixin = new AsynchMixin();
- StatelessLocalProxyInvocationHandler handler = new StatelessLocalProxyInvocationHandler(mixin, getContainer(),
- this.getBusinessInterfaceType());
- return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, handler);
- }
-
- //I was already asynchronous
- return proxy;
- }
-/*
- @Override
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- {
- super.readExternal(in);
- provider = (AsynchProvider)in.readObject();
- }
-
- @Override
- public void writeExternal(ObjectOutput out) throws IOException
- {
- super.writeExternal(out);
- out.writeObject(provider);
- }
-*/
-
- public String toString()
- {
- if (getContainer() == null)
- return proxyName;
- else
- return getContainer().getEjbName();
- }
-}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateless/StatelessLocalProxyInvocationHandler.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/handler/stateless/StatelessLocalProxyInvocationHandler.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateless/StatelessLocalProxyInvocationHandler.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateless/StatelessLocalProxyInvocationHandler.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,130 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.handler.stateless;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+import javax.ejb.EJBException;
+
+import org.jboss.aspects.asynch.AsynchMixin;
+import org.jboss.aspects.asynch.AsynchProvider;
+import org.jboss.aspects.asynch.FutureHolder;
+import org.jboss.ejb3.Container;
+import org.jboss.ejb3.LocalProxyInvocationHandler;
+import org.jboss.ejb3.proxy.ProxyUtils;
+import org.jboss.ejb3.stateless.StatelessContainer;
+import org.jboss.logging.Logger;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+public class StatelessLocalProxyInvocationHandler extends LocalProxyInvocationHandler
+{
+ private static final long serialVersionUID = -3241008127518089831L;
+
+ private static final Logger log = Logger.getLogger(StatelessLocalProxyInvocationHandler.class);
+
+ AsynchProvider provider;
+
+ public StatelessLocalProxyInvocationHandler()
+ {
+ }
+
+ public StatelessLocalProxyInvocationHandler(Container container, String businessInterfaceType)
+ {
+ super(container, businessInterfaceType);
+ }
+
+ public StatelessLocalProxyInvocationHandler(AsynchProvider provider, Container container,
+ String businessInterfaceType)
+ {
+ super(container, businessInterfaceType);
+ this.provider = provider;
+ }
+
+ public Object invoke(Object proxy, Method method, Object[] args)
+ throws Throwable
+ {
+ if (method.getDeclaringClass() == AsynchProvider.class)
+ {
+ return provider.getFuture();
+ }
+
+ Object ret = ProxyUtils.handleCallLocally(proxy, this, method, args);
+ if (ret != null)
+ {
+ return ret;
+ }
+
+ StatelessContainer container = (StatelessContainer) getContainer();
+
+ if (container == null)
+ {
+ throw new EJBException("Invalid invocation of local interface (null container)");
+ }
+
+ return container.localInvoke(method, args, (FutureHolder) provider);
+ }
+
+ public Object getAsynchronousProxy(Object proxy)
+ {
+ Class<?>[] infs = proxy.getClass().getInterfaces();
+ if (!ProxyUtils.isAsynchronous(infs))
+ {
+ Class<?>[] interfaces = ProxyUtils.addAsynchProviderInterface(infs);
+ AsynchMixin mixin = new AsynchMixin();
+ StatelessLocalProxyInvocationHandler handler = new StatelessLocalProxyInvocationHandler(mixin, getContainer(),
+ this.getBusinessInterfaceType());
+ return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, handler);
+ }
+
+ //I was already asynchronous
+ return proxy;
+ }
+/*
+ @Override
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
+ {
+ super.readExternal(in);
+ provider = (AsynchProvider)in.readObject();
+ }
+
+ @Override
+ public void writeExternal(ObjectOutput out) throws IOException
+ {
+ super.writeExternal(out);
+ out.writeObject(provider);
+ }
+*/
+
+ public String toString()
+ {
+ if (getContainer() == null)
+ return proxyName;
+ else
+ return getContainer().getEjbName();
+ }
+}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateless/StatelessRemoteProxyInvocationHandler.java
===================================================================
--- projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/handler/stateless/StatelessRemoteProxyInvocationHandler.java 2008-04-23 20:41:05 UTC (rev 72636)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateless/StatelessRemoteProxyInvocationHandler.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,150 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.handler.stateless;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-
-import org.jboss.aop.Dispatcher;
-import org.jboss.aop.advice.Interceptor;
-import org.jboss.aop.joinpoint.MethodInvocation;
-import org.jboss.aop.util.MethodHashing;
-import org.jboss.aop.util.PayloadKey;
-import org.jboss.aspects.asynch.AsynchMixin;
-import org.jboss.aspects.asynch.AsynchProvider;
-import org.jboss.aspects.remoting.InvokeRemoteInterceptor;
-import org.jboss.ejb3.Container;
-import org.jboss.ejb3.asynchronous.AsynchronousInterceptor;
-import org.jboss.ejb3.proxy.ProxyUtils;
-import org.jboss.ejb3.proxy.handler.BaseSessionRemoteProxyInvocationHandler;
-import org.jboss.ejb3.remoting.IsLocalInterceptor;
-import org.jboss.logging.Logger;
-import org.jboss.remoting.InvokerLocator;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public class StatelessRemoteProxyInvocationHandler extends org.jboss.ejb3.proxy.handler.BaseSessionRemoteProxyInvocationHandler
-{
- private static final long serialVersionUID = 2583299153931800023L;
- private static final Logger log = Logger.getLogger(StatelessRemoteProxyInvocationHandler.class);
-
- protected InvokerLocator uri;
- AsynchProvider provider;
-
- public StatelessRemoteProxyInvocationHandler(Container container, Interceptor[] interceptors, InvokerLocator uri, String businessInterfaceType)
- {
- super(container, interceptors, businessInterfaceType);
- this.uri = uri;
- }
-
- public StatelessRemoteProxyInvocationHandler(AsynchProvider provider, String containerId, String containerGuid, Interceptor[] interceptors, InvokerLocator uri, String businessInterfaceType)
- {
- super(containerId, containerGuid, interceptors, businessInterfaceType);
- this.uri = uri;
- this.provider = provider;
- }
-
-
- protected StatelessRemoteProxyInvocationHandler()
- {
- }
-
-
- public Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable
- {
- if (method.getDeclaringClass() == AsynchProvider.class)
- {
- return provider.getFuture();
- }
-
- long hash = MethodHashing.calculateHash(method);
- Object ret = ProxyUtils.handleCallLocally(hash, proxy, this, method, args);
- if (ret != null)
- {
- return ret;
- }
-
- ret = handleEjb21CallLocally(method, args);
- if (ret != null)
- {
- return ret;
- }
-
- MethodInvocation sri = new MethodInvocation(interceptors, hash, method, method, null);
- sri.setArguments(args);
- sri.setInstanceResolver(metadata);
- sri.getMetaData().addMetaData(Dispatcher.DISPATCHER, Dispatcher.OID, containerId, PayloadKey.AS_IS);
- sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.INVOKER_LOCATOR, uri, PayloadKey.AS_IS);
- sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.SUBSYSTEM, "AOP", PayloadKey.AS_IS);
- sri.getMetaData().addMetaData(IsLocalInterceptor.IS_LOCAL, IsLocalInterceptor.GUID, containerGuid, PayloadKey.AS_IS);
-
-
- if (provider != null)
- {
- sri.getMetaData().addMetaData(AsynchronousInterceptor.ASYNCH, AsynchronousInterceptor.INVOKE_ASYNCH, "YES", PayloadKey.AS_IS);
- }
- return sri.invokeNext();
- }
-
- public Object getAsynchronousProxy(Object proxy)
- {
- Class<?>[] infs = proxy.getClass().getInterfaces();
- if (!ProxyUtils.isAsynchronous(infs))
- {
- Class<?>[] interfaces = ProxyUtils.addAsynchProviderInterface(infs);
- AsynchMixin mixin = new AsynchMixin();
- Interceptor[] newInterceptors = ProxyUtils.addAsynchProxyInterceptor(mixin, interceptors);
- StatelessRemoteProxyInvocationHandler handler = new StatelessRemoteProxyInvocationHandler(mixin, containerId,
- containerGuid, newInterceptors, uri, this.getBusinessInterfaceType());
- return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, handler);
- }
-
- //I was already asynchronous
- return proxy;
- }
-
- public String toString()
- {
- return containerId.toString();
- }
-
- private Object handleEjb21CallLocally(Method method, Object[] args)
- {
- if (method.equals(ProxyUtils.GET_HOME_HANDLE))
- {
- return homeHandle;
- } else if (method.equals(ProxyUtils.GET_EJB_METADATA))
- {
- return ejbMetaData;
- } else if (method.equals(ProxyUtils.GET_HANDLE))
- {
- return handle;
- }
-
- return null;
- }
-}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateless/StatelessRemoteProxyInvocationHandler.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/handler/stateless/StatelessRemoteProxyInvocationHandler.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateless/StatelessRemoteProxyInvocationHandler.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateless/StatelessRemoteProxyInvocationHandler.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,150 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.handler.stateless;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+import org.jboss.aop.Dispatcher;
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.joinpoint.MethodInvocation;
+import org.jboss.aop.util.MethodHashing;
+import org.jboss.aop.util.PayloadKey;
+import org.jboss.aspects.asynch.AsynchMixin;
+import org.jboss.aspects.asynch.AsynchProvider;
+import org.jboss.aspects.remoting.InvokeRemoteInterceptor;
+import org.jboss.ejb3.Container;
+import org.jboss.ejb3.asynchronous.AsynchronousInterceptor;
+import org.jboss.ejb3.proxy.ProxyUtils;
+import org.jboss.ejb3.proxy.handler.BaseSessionRemoteProxyInvocationHandler;
+import org.jboss.ejb3.remoting.IsLocalInterceptor;
+import org.jboss.logging.Logger;
+import org.jboss.remoting.InvokerLocator;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+public class StatelessRemoteProxyInvocationHandler extends org.jboss.ejb3.proxy.handler.BaseSessionRemoteProxyInvocationHandler
+{
+ private static final long serialVersionUID = 2583299153931800023L;
+ private static final Logger log = Logger.getLogger(StatelessRemoteProxyInvocationHandler.class);
+
+ protected InvokerLocator uri;
+ AsynchProvider provider;
+
+ public StatelessRemoteProxyInvocationHandler(Container container, Interceptor[] interceptors, InvokerLocator uri, String businessInterfaceType)
+ {
+ super(container, interceptors, businessInterfaceType);
+ this.uri = uri;
+ }
+
+ public StatelessRemoteProxyInvocationHandler(AsynchProvider provider, String containerId, String containerGuid, Interceptor[] interceptors, InvokerLocator uri, String businessInterfaceType)
+ {
+ super(containerId, containerGuid, interceptors, businessInterfaceType);
+ this.uri = uri;
+ this.provider = provider;
+ }
+
+
+ protected StatelessRemoteProxyInvocationHandler()
+ {
+ }
+
+
+ public Object invoke(Object proxy, Method method, Object[] args)
+ throws Throwable
+ {
+ if (method.getDeclaringClass() == AsynchProvider.class)
+ {
+ return provider.getFuture();
+ }
+
+ long hash = MethodHashing.calculateHash(method);
+ Object ret = ProxyUtils.handleCallLocally(hash, proxy, this, method, args);
+ if (ret != null)
+ {
+ return ret;
+ }
+
+ ret = handleEjb21CallLocally(method, args);
+ if (ret != null)
+ {
+ return ret;
+ }
+
+ MethodInvocation sri = new MethodInvocation(interceptors, hash, method, method, null);
+ sri.setArguments(args);
+ sri.setInstanceResolver(metadata);
+ sri.getMetaData().addMetaData(Dispatcher.DISPATCHER, Dispatcher.OID, containerId, PayloadKey.AS_IS);
+ sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.INVOKER_LOCATOR, uri, PayloadKey.AS_IS);
+ sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.SUBSYSTEM, "AOP", PayloadKey.AS_IS);
+ sri.getMetaData().addMetaData(IsLocalInterceptor.IS_LOCAL, IsLocalInterceptor.GUID, containerGuid, PayloadKey.AS_IS);
+
+
+ if (provider != null)
+ {
+ sri.getMetaData().addMetaData(AsynchronousInterceptor.ASYNCH, AsynchronousInterceptor.INVOKE_ASYNCH, "YES", PayloadKey.AS_IS);
+ }
+ return sri.invokeNext();
+ }
+
+ public Object getAsynchronousProxy(Object proxy)
+ {
+ Class<?>[] infs = proxy.getClass().getInterfaces();
+ if (!ProxyUtils.isAsynchronous(infs))
+ {
+ Class<?>[] interfaces = ProxyUtils.addAsynchProviderInterface(infs);
+ AsynchMixin mixin = new AsynchMixin();
+ Interceptor[] newInterceptors = ProxyUtils.addAsynchProxyInterceptor(mixin, interceptors);
+ StatelessRemoteProxyInvocationHandler handler = new StatelessRemoteProxyInvocationHandler(mixin, containerId,
+ containerGuid, newInterceptors, uri, this.getBusinessInterfaceType());
+ return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, handler);
+ }
+
+ //I was already asynchronous
+ return proxy;
+ }
+
+ public String toString()
+ {
+ return containerId.toString();
+ }
+
+ private Object handleEjb21CallLocally(Method method, Object[] args)
+ {
+ if (method.equals(ProxyUtils.GET_HOME_HANDLE))
+ {
+ return homeHandle;
+ } else if (method.equals(ProxyUtils.GET_EJB_METADATA))
+ {
+ return ejbMetaData;
+ } else if (method.equals(ProxyUtils.GET_HANDLE))
+ {
+ return handle;
+ }
+
+ return null;
+ }
+}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/impl (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/impl)
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/impl/EJBMetaDataImpl.java
===================================================================
--- projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/impl/EJBMetaDataImpl.java 2008-04-23 20:41:05 UTC (rev 72636)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/impl/EJBMetaDataImpl.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,154 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.impl;
-
-import java.io.Serializable;
-import java.rmi.RemoteException;
-
-import javax.ejb.EJBException;
-import javax.ejb.EJBHome;
-import javax.ejb.EJBMetaData;
-import javax.ejb.HomeHandle;
-
-/**
- * An implementation of the EJBMetaData interface which allows a
- * client to obtain the enterprise Bean's meta-data information.
- *
- * @author Rickard Oberg (rickard.oberg at telkel.com)
- * @author <a href="mailto:marc.fleury at telkel.com">Marc Fleury</a>
- * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
- * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
- * @version $Revision$
- */
-public class EJBMetaDataImpl
- implements EJBMetaData, Serializable
-{
- /** Serial Version Identifier. @since 1.1 */
- private static final long serialVersionUID = -3698855455664391097L;
-
- // Attributes ----------------------------------------------------
- private final Class<?> remote;
- private final Class<?> home;
- private final Class<?> pkClass;
-
- private final boolean session;
- private final boolean statelessSession;
- private final HomeHandle homeHandle;
-
- // Constructors --------------------------------------------------
-
- /**
- * Construct an <tt>EJBMetaDataImpl</tt>.
- * this should only be accessible from the factory.
- */
- public EJBMetaDataImpl(final Class<?> remote,
- final Class<?> home,
- final Class<?> pkClass,
- final boolean session,
- final boolean statelessSession,
- final HomeHandle homeHandle)
- {
- this.remote = remote;
- this.home = home;
- this.pkClass = pkClass;
- this.session = session;
- this.statelessSession = statelessSession;
- this.homeHandle = homeHandle;
- }
-
- // Constructors --------------------------------------------------
-
- // EJBMetaData ---------------------------------------------------
-
-
- // EJBMetaData ---------------------------------------------------
-
- /**
- * Obtain the home interface of the enterprise Bean.
- *
- * @throws EJBException Failed to get EJBHome object.
- */
-
- public EJBHome getEJBHome()
- {
- try
- {
- return homeHandle.getEJBHome();
- }
- catch (EJBException e)
- {
- throw e;
- }
- catch (RemoteException e)
- {
- e.printStackTrace();
- throw new EJBException(e);
- }
- }
-
- /**
- * Obtain the Class object for the enterprise Bean's home interface.
- */
- public Class<?> getHomeInterfaceClass()
- {
- return home;
- }
-
- /**
- * Obtain the Class object for the enterprise Bean's remote interface.
- */
- public Class<?> getRemoteInterfaceClass()
- {
- return remote;
- }
-
- /**
- * Obtain the Class object for the enterprise Bean's primary key class.
- */
- public Class<?> getPrimaryKeyClass()
- {
- if (session == true)
- throw new RuntimeException("A session bean does not have a primary key class");
-
- return pkClass;
- }
-
- /**
- * Test if the enterprise Bean's type is "session".
- *
- * @return True if the type of the enterprise Bean is session bean.
- */
- public boolean isSession()
- {
- return session;
- }
-
- /**
- * Test if the enterprise Bean's type is "stateless session".
- *
- * @return True if the type of the enterprise Bean is stateless session.
- */
- public boolean isStatelessSession()
- {
- return statelessSession;
- }
-}
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/impl/EJBMetaDataImpl.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/impl/EJBMetaDataImpl.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/impl/EJBMetaDataImpl.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/impl/EJBMetaDataImpl.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,154 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.impl;
+
+import java.io.Serializable;
+import java.rmi.RemoteException;
+
+import javax.ejb.EJBException;
+import javax.ejb.EJBHome;
+import javax.ejb.EJBMetaData;
+import javax.ejb.HomeHandle;
+
+/**
+ * An implementation of the EJBMetaData interface which allows a
+ * client to obtain the enterprise Bean's meta-data information.
+ *
+ * @author Rickard Oberg (rickard.oberg at telkel.com)
+ * @author <a href="mailto:marc.fleury at telkel.com">Marc Fleury</a>
+ * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision$
+ */
+public class EJBMetaDataImpl
+ implements EJBMetaData, Serializable
+{
+ /** Serial Version Identifier. @since 1.1 */
+ private static final long serialVersionUID = -3698855455664391097L;
+
+ // Attributes ----------------------------------------------------
+ private final Class<?> remote;
+ private final Class<?> home;
+ private final Class<?> pkClass;
+
+ private final boolean session;
+ private final boolean statelessSession;
+ private final HomeHandle homeHandle;
+
+ // Constructors --------------------------------------------------
+
+ /**
+ * Construct an <tt>EJBMetaDataImpl</tt>.
+ * this should only be accessible from the factory.
+ */
+ public EJBMetaDataImpl(final Class<?> remote,
+ final Class<?> home,
+ final Class<?> pkClass,
+ final boolean session,
+ final boolean statelessSession,
+ final HomeHandle homeHandle)
+ {
+ this.remote = remote;
+ this.home = home;
+ this.pkClass = pkClass;
+ this.session = session;
+ this.statelessSession = statelessSession;
+ this.homeHandle = homeHandle;
+ }
+
+ // Constructors --------------------------------------------------
+
+ // EJBMetaData ---------------------------------------------------
+
+
+ // EJBMetaData ---------------------------------------------------
+
+ /**
+ * Obtain the home interface of the enterprise Bean.
+ *
+ * @throws EJBException Failed to get EJBHome object.
+ */
+
+ public EJBHome getEJBHome()
+ {
+ try
+ {
+ return homeHandle.getEJBHome();
+ }
+ catch (EJBException e)
+ {
+ throw e;
+ }
+ catch (RemoteException e)
+ {
+ e.printStackTrace();
+ throw new EJBException(e);
+ }
+ }
+
+ /**
+ * Obtain the Class object for the enterprise Bean's home interface.
+ */
+ public Class<?> getHomeInterfaceClass()
+ {
+ return home;
+ }
+
+ /**
+ * Obtain the Class object for the enterprise Bean's remote interface.
+ */
+ public Class<?> getRemoteInterfaceClass()
+ {
+ return remote;
+ }
+
+ /**
+ * Obtain the Class object for the enterprise Bean's primary key class.
+ */
+ public Class<?> getPrimaryKeyClass()
+ {
+ if (session == true)
+ throw new RuntimeException("A session bean does not have a primary key class");
+
+ return pkClass;
+ }
+
+ /**
+ * Test if the enterprise Bean's type is "session".
+ *
+ * @return True if the type of the enterprise Bean is session bean.
+ */
+ public boolean isSession()
+ {
+ return session;
+ }
+
+ /**
+ * Test if the enterprise Bean's type is "stateless session".
+ *
+ * @return True if the type of the enterprise Bean is stateless session.
+ */
+ public boolean isStatelessSession()
+ {
+ return statelessSession;
+ }
+}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/impl/HomeHandleImpl.java
===================================================================
--- projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/impl/HomeHandleImpl.java 2008-04-23 20:41:05 UTC (rev 72636)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/impl/HomeHandleImpl.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,138 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.impl;
-
-import javax.ejb.HomeHandle;
-import javax.ejb.EJBHome;
-
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import java.rmi.ServerException;
-import java.rmi.RemoteException;
-import java.io.ObjectStreamField;
-import java.io.ObjectInputStream;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-import java.util.Hashtable;
-
-import org.jboss.ejb3.InitialContextFactory;
-import org.jboss.naming.NamingContextFactory;
-
-
-/**
- * An EJB home handle implementation.
- *
- * @author <a href="mailto:marc.fleury at jboss.org">Marc Fleury</a>.
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class HomeHandleImpl
- implements HomeHandle
-{
- // Constants -----------------------------------------------------
-
- /** Serial Version Identifier. */
- static final long serialVersionUID = 208629381571948124L;
- /** The persistent field defintions */
- private static final ObjectStreamField[] serialPersistentFields =
- new ObjectStreamField[]
- {
- new ObjectStreamField("jndiName", String.class),
- new ObjectStreamField("jndiEnv", Hashtable.class)
- };
-
- /** The JNDI name of the home inteface binding */
- private String jndiName;
- /** The JNDI env in effect when the home handle was created */
- private Hashtable jndiEnv;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- /**
- * Construct a <tt>HomeHandleImpl</tt>.
- *
- * @param handle The initial context handle that will be used
- * to restore the naming context or null to use
- * a fresh InitialContext object.
- * @param name JNDI name.
- */
- public HomeHandleImpl(String jndiName)
- {
- this.jndiName = jndiName;
- this.jndiEnv = (Hashtable) NamingContextFactory.lastInitialContextEnv.get();
- }
-
- // Public --------------------------------------------------------
-
- // Handle implementation -----------------------------------------
-
- /**
- * HomeHandle implementation.
- *
- * @return <tt>EJBHome</tt> reference.
- *
- * @throws ServerException Could not get EJBObject.
- * @throws RemoteException
- */
- public EJBHome getEJBHome() throws RemoteException
- {
- try
- {
- InitialContext ic = InitialContextFactory.getInitialContext(jndiEnv);
-
- EJBHome home = (EJBHome) ic.lookup(jndiName);
- return home;
- }
- catch (NamingException e)
- {
- throw new ServerException("Could not get EJBHome", e);
- }
- }
-
- /**
- * @return the jndi name
- */
- public String getJNDIName()
- {
- return jndiName;
- }
-
- private void readObject(ObjectInputStream ois)
- throws IOException, ClassNotFoundException
- {
- ObjectInputStream.GetField getField = ois.readFields();
- jndiName = (String) getField.get("jndiName", null);
- jndiEnv = (Hashtable) getField.get("jndiEnv", null);
- }
-
- private void writeObject(ObjectOutputStream oos)
- throws IOException
- {
- ObjectOutputStream.PutField putField = oos.putFields();
- putField.put("jndiName", jndiName);
- putField.put("jndiEnv", jndiEnv);
- oos.writeFields();
- }
-}
-
Copied: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/impl/HomeHandleImpl.java (from rev 72636, projects/ejb3/dev/ejbthree1269/core/src/main/java/org/jboss/ejb3/proxy/impl/HomeHandleImpl.java)
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/impl/HomeHandleImpl.java (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/impl/HomeHandleImpl.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -0,0 +1,138 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.impl;
+
+import javax.ejb.HomeHandle;
+import javax.ejb.EJBHome;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import java.rmi.ServerException;
+import java.rmi.RemoteException;
+import java.io.ObjectStreamField;
+import java.io.ObjectInputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.util.Hashtable;
+
+import org.jboss.ejb3.InitialContextFactory;
+import org.jboss.naming.NamingContextFactory;
+
+
+/**
+ * An EJB home handle implementation.
+ *
+ * @author <a href="mailto:marc.fleury at jboss.org">Marc Fleury</a>.
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class HomeHandleImpl
+ implements HomeHandle
+{
+ // Constants -----------------------------------------------------
+
+ /** Serial Version Identifier. */
+ static final long serialVersionUID = 208629381571948124L;
+ /** The persistent field defintions */
+ private static final ObjectStreamField[] serialPersistentFields =
+ new ObjectStreamField[]
+ {
+ new ObjectStreamField("jndiName", String.class),
+ new ObjectStreamField("jndiEnv", Hashtable.class)
+ };
+
+ /** The JNDI name of the home inteface binding */
+ private String jndiName;
+ /** The JNDI env in effect when the home handle was created */
+ private Hashtable jndiEnv;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ /**
+ * Construct a <tt>HomeHandleImpl</tt>.
+ *
+ * @param handle The initial context handle that will be used
+ * to restore the naming context or null to use
+ * a fresh InitialContext object.
+ * @param name JNDI name.
+ */
+ public HomeHandleImpl(String jndiName)
+ {
+ this.jndiName = jndiName;
+ this.jndiEnv = (Hashtable) NamingContextFactory.lastInitialContextEnv.get();
+ }
+
+ // Public --------------------------------------------------------
+
+ // Handle implementation -----------------------------------------
+
+ /**
+ * HomeHandle implementation.
+ *
+ * @return <tt>EJBHome</tt> reference.
+ *
+ * @throws ServerException Could not get EJBObject.
+ * @throws RemoteException
+ */
+ public EJBHome getEJBHome() throws RemoteException
+ {
+ try
+ {
+ InitialContext ic = InitialContextFactory.getInitialContext(jndiEnv);
+
+ EJBHome home = (EJBHome) ic.lookup(jndiName);
+ return home;
+ }
+ catch (NamingException e)
+ {
+ throw new ServerException("Could not get EJBHome", e);
+ }
+ }
+
+ /**
+ * @return the jndi name
+ */
+ public String getJNDIName()
+ {
+ return jndiName;
+ }
+
+ private void readObject(ObjectInputStream ois)
+ throws IOException, ClassNotFoundException
+ {
+ ObjectInputStream.GetField getField = ois.readFields();
+ jndiName = (String) getField.get("jndiName", null);
+ jndiEnv = (Hashtable) getField.get("jndiEnv", null);
+ }
+
+ private void writeObject(ObjectOutputStream oos)
+ throws IOException
+ {
+ ObjectOutputStream.PutField putField = oos.putFields();
+ putField.put("jndiName", jndiName);
+ putField.put("jndiEnv", jndiEnv);
+ oos.writeFields();
+ }
+}
+
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/BaseRemoteProxy.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/BaseRemoteProxy.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/BaseRemoteProxy.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,79 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.remoting;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import org.jboss.aop.advice.Interceptor;
-import org.jboss.aop.metadata.SimpleMetaData;
-
-import org.jboss.ejb3.Container;
-import org.jboss.ejb3.Ejb3Registry;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public abstract class BaseRemoteProxy implements java.io.Serializable, InvocationHandler, RemoteProxy
-{
- private static final long serialVersionUID = 1126421850898582900L;
-
- protected String containerId;
- protected String containerGuid;
- protected Interceptor[] interceptors;
- protected SimpleMetaData metadata;
-
- protected BaseRemoteProxy(Container container, Interceptor[] interceptors)
- {
- this.containerId = container.getObjectName().getCanonicalName();
- this.containerGuid = Ejb3Registry.guid(container);
- this.interceptors = interceptors;
- }
-
- protected BaseRemoteProxy(String containerId, String containerGuid, Interceptor[] interceptors)
- {
- this.containerId = containerId;
- this.containerGuid = containerGuid;
- this.interceptors = interceptors;
- }
-
- protected BaseRemoteProxy()
- {
- }
-
- public SimpleMetaData getMetaData()
- {
- synchronized (this)
- {
- if (metadata == null) metadata = new SimpleMetaData();
- }
- return metadata;
- }
-
- public abstract Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable;
-
- //Force all remote proxies to override toString()
- public abstract String toString();
-}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/Proxy.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/Proxy.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/Proxy.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,37 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.remoting;
-
-/**
- * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
- * @version $Revision$
- */
-public interface Proxy
-{
- /**
- * For use in hashCode, toString() and equals() *
- */
- String toString();
-
- Object getAsynchronousProxy(Object proxy);
-}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/ProxyFactoryNotRegisteredException.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/ProxyFactoryNotRegisteredException.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/ProxyFactoryNotRegisteredException.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,51 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2007, 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.remoting;
-
-/**
- * ProxyFactoryNotRegisteredException
- *
- * Thrown when attempting to retrieve a proxy factory with
- * unrecognized name from the registry
- *
- * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
- * @version $Revision: $
- */
-public class ProxyFactoryNotRegisteredException extends Exception
-{
-
- // Class Members
- private static final long serialVersionUID = -881723607135494483L;
-
- // Constructors
-
- public ProxyFactoryNotRegisteredException()
- {
- super();
- }
-
- public ProxyFactoryNotRegisteredException(String message)
- {
- super(message);
- }
-
-}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/RemoteProxy.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/RemoteProxy.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/RemoteProxy.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,35 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.remoting;
-
-import org.jboss.aop.metadata.SimpleMetaData;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public interface RemoteProxy extends Proxy
-{
- SimpleMetaData getMetaData();
-}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/RemoteProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/RemoteProxyFactory.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/RemoteProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,37 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.remoting;
-
-import org.jboss.ejb3.ProxyFactory;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public interface RemoteProxyFactory extends ProxyFactory
-{
- public static final String DEFAULT_CLIENT_BINDING = "socket://0.0.0.0:3873";
-
-// public void setRemoteBinding(RemoteBinding binding);
-}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/RemoteProxyFactoryRegistry.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/RemoteProxyFactoryRegistry.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/RemoteProxyFactoryRegistry.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,104 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2007, 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.remoting;
-
-import org.jboss.ha.client.loadbalance.LoadBalancePolicy;
-
-import java.util.Map;
-
-/**
- * Registry for all configured Remote Proxy Factory implementations
- *
- * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
- * @version $Revision: $
- */
-public class RemoteProxyFactoryRegistry
-{
- // Instance Members
- private Map<String, Class<? extends RemoteProxyFactory>> factories;
-
- private Map<String, Class<LoadBalancePolicy>> loadBalancePolicies;
-
- // Accessors / Mutators
-
- public Map<String, Class<? extends RemoteProxyFactory>> getFactories()
- {
- return factories;
- }
-
- public void setFactories(Map<String, Class<? extends RemoteProxyFactory>> factories)
- {
- this.factories = factories;
- }
-
- public Map<String, Class<LoadBalancePolicy>> getLoadBalancePolicies()
- {
- return loadBalancePolicies;
- }
-
- public void setLoadBalancePolicies(Map<String, Class<LoadBalancePolicy>> loadBalancePolicies)
- {
- this.loadBalancePolicies = loadBalancePolicies;
- }
-
- // Functional Methods
-
- /**
- * Obtains the Proxy Factory Class with the specified registered name
- *
- * @param name The registered name of the proxy factory to retrieve
- * @return The Proxy Factory
- */
- public Class<? extends RemoteProxyFactory> getProxyFactoryClass(String name) throws ProxyFactoryNotRegisteredException
- {
- // Obtain proxy factory
- Class<? extends RemoteProxyFactory> proxyFactory = this.factories.get(name);
-
- // Ensure registered
- if (proxyFactory == null)
- {
- throw new ProxyFactoryNotRegisteredException("Remoting Proxy Factory with name " + name
- + " is not registered.");
- }
-
- // Return
- return proxyFactory;
-
- }
-
- public Class<LoadBalancePolicy> getLoadBalancePolicy(String name) throws LoadBalancePolicyNotRegisteredException
- {
- // Obtain Load Balance Policy
- Class<LoadBalancePolicy> loadBalancePolicy = this.loadBalancePolicies.get(name);
-
- // Ensure registered
- if (loadBalancePolicy == null)
- {
- throw new LoadBalancePolicyNotRegisteredException("LoadBalancePolicy with name " + name
- + " is not registered.");
- }
-
- // Return
- return loadBalancePolicy;
-
- }
-}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/BaseServiceProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/BaseServiceProxyFactory.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/BaseServiceProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,88 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.service;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationHandler;
-
-import javax.naming.NamingException;
-
-import org.jboss.ejb3.ProxyFactory;
-import org.jboss.util.naming.Util;
-
-/**
- * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
- * @version $Revision$
- */
-public abstract class BaseServiceProxyFactory implements ProxyFactory
-{
- protected Constructor<?> proxyConstructor;
- protected String jndiName;
- protected ServiceContainer container;
-
- protected BaseServiceProxyFactory(ServiceContainer container, String jndiName)
- {
- assert container != null : "container is null";
- assert jndiName != null : "jndiName is null";
-
- this.container = container;
- this.jndiName = jndiName;
- }
-
- public Object createHomeProxy()
- {
- throw new UnsupportedOperationException("service can't have a home interface");
- }
-
- public Object createProxyBusiness(Object id)
- {
- if(id != null)
- throw new IllegalArgumentException("service proxy must not have an id");
- return createProxyBusiness();
- }
-
- public void start() throws Exception
- {
- Class<?>[] interfaces = getInterfaces();
- Class<?> proxyClass = java.lang.reflect.Proxy.getProxyClass(container.getBeanClass().getClassLoader(), interfaces);
- proxyConstructor = proxyClass.getConstructor(InvocationHandler.class);
-
- try
- {
- Util.rebind(container.getInitialContext(), jndiName, createProxyBusiness());
- } catch (NamingException e)
- {
- NamingException namingException = new NamingException("Could not bind service proxy factory for EJB container with ejb name " + container.getEjbName() + " into JNDI under jndiName: " + container.getInitialContext().getNameInNamespace() + "/" + jndiName);
- namingException.setRootCause(e);
- throw namingException;
- }
- }
-
- public void stop() throws Exception
- {
- Util.unbind(container.getInitialContext(), jndiName);
- }
-
- protected abstract Class<?>[] getInterfaces();
-
- protected final void initializeJndiName() {};
-}
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/ServiceContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/ServiceContainer.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/ServiceContainer.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -51,19 +51,23 @@
import org.jboss.ejb3.BeanContext;
import org.jboss.ejb3.EJBContainerInvocation;
import org.jboss.ejb3.Ejb3Deployment;
-import org.jboss.ejb3.ProxyFactory;
import org.jboss.ejb3.annotation.LocalBinding;
import org.jboss.ejb3.annotation.Management;
import org.jboss.ejb3.annotation.RemoteBinding;
import org.jboss.ejb3.annotation.Service;
import org.jboss.ejb3.asynchronous.AsynchronousInterceptor;
-import org.jboss.ejb3.remoting.RemoteProxyFactory;
+import org.jboss.ejb3.proxy.ProxyFactory;
+import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
+import org.jboss.ejb3.proxy.factory.SessionProxyFactory;
+import org.jboss.ejb3.proxy.factory.service.ServiceLocalProxyFactory;
+import org.jboss.ejb3.proxy.factory.service.ServiceRemoteProxyFactory;
import org.jboss.ejb3.session.SessionContainer;
import org.jboss.ejb3.timerservice.TimedObjectInvoker;
import org.jboss.ejb3.timerservice.TimerServiceFactory;
import org.jboss.injection.Injector;
import org.jboss.logging.Logger;
import org.jboss.metadata.ejb.jboss.JBossServiceBeanMetaData;
+import org.jboss.util.NotImplementedException;
/**
* @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
@@ -525,7 +529,16 @@
{
throw new RuntimeException("NYI");
}
+
+ //TODO This shouldn't be required of @Service
+ @Override
+ protected Object invokeHomeCreate(SessionProxyFactory factory, Method unadvisedMethod, Object args[])
+ throws Exception
+ {
+ throw new NotImplementedException("Invalid for " + ServiceContainer.class.getName());
+ }
+
public MBeanInfo getMBeanInfo()
{
return delegate.getMBeanInfo();
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/ServiceLocalProxy.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/ServiceLocalProxy.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/ServiceLocalProxy.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,114 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.service;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.io.ObjectInput;
-import java.io.IOException;
-import java.io.ObjectOutput;
-import org.jboss.aspects.asynch.AsynchMixin;
-import org.jboss.aspects.asynch.AsynchProvider;
-import org.jboss.aspects.asynch.FutureHolder;
-import org.jboss.ejb3.Container;
-import org.jboss.ejb3.JBossProxy;
-import org.jboss.ejb3.LocalProxy;
-import org.jboss.ejb3.ProxyUtils;
-
-/**
- * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
- * @version $Revision$
- */
-public class ServiceLocalProxy extends LocalProxy
-{
- private static final long serialVersionUID = -4023671606878355605L;
-
- AsynchProvider provider;
-
- public ServiceLocalProxy()
- {
- }
-
- public ServiceLocalProxy(Container container)
- {
- super(container);
- }
-
- public ServiceLocalProxy(AsynchProvider provider, Container container)
- {
- super(container);
- this.provider = provider;
- }
-
- public Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable
- {
- if (method.getDeclaringClass() == AsynchProvider.class)
- {
- return provider.getFuture();
- }
-
- Object ret = ProxyUtils.handleCallLocally((JBossProxy) proxy, this, method, args);
- if (ret != null)
- {
- return ret;
- }
-
- ServiceContainer sc = (ServiceContainer) getContainer();
- return sc.localInvoke(method, args, (FutureHolder) provider);
- }
-
- public Object getAsynchronousProxy(Object proxy)
- {
- Class[] infs = proxy.getClass().getInterfaces();
- if (!ProxyUtils.isAsynchronous(infs))
- {
- Class[] interfaces = ProxyUtils.addAsynchProviderInterface(infs);
- AsynchMixin mixin = new AsynchMixin();
- ServiceLocalProxy handler = new ServiceLocalProxy(mixin, getContainer());
- return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, handler);
- }
-
- //I was already asynchronous
- return proxy;
- }
-
- //@Override
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- {
- super.readExternal(in);
- provider = (AsynchProvider)in.readObject();
- }
-
- //@Override
- public void writeExternal(ObjectOutput out) throws IOException
- {
- super.writeExternal(out);
- out.writeObject(provider);
- }
-
- public String toString()
- {
- return proxyName;
- }
-
-}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/ServiceLocalProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/ServiceLocalProxyFactory.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/ServiceLocalProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,85 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.service;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.jboss.ejb3.JBossProxy;
-import org.jboss.ejb3.ProxyFactoryHelper;
-import org.jboss.ejb3.annotation.LocalBinding;
-
-
-/**
- * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
- * @version $Revision$
- */
-public class ServiceLocalProxyFactory extends BaseServiceProxyFactory
-{
- protected ServiceLocalProxyFactory(ServiceContainer container, LocalBinding binding)
- {
- super(container, binding.jndiBinding());
- }
-
- protected Class<?>[] getInterfaces()
- {
- // Initialize
- Set<Class<?>> uniqueInterfaces = new HashSet<Class<?>>();
-
- // Obtain interfaces and add as unique
- uniqueInterfaces.addAll(Arrays.asList(ProxyFactoryHelper.getLocalAndBusinessLocalInterfaces(container))) ;
-
- // Add JBossProxy
- uniqueInterfaces.add(JBossProxy.class);
-
- // Return
- return uniqueInterfaces.toArray(new Class<?>[]{});
- }
-
- public Object createProxyBusiness()
- {
- try
- {
- Object[] args = {new ServiceLocalProxy(container)};
- return proxyConstructor.newInstance(args);
- }
- catch (InstantiationException e)
- {
- throw new RuntimeException(e);
- }
- catch (IllegalAccessException e)
- {
- throw new RuntimeException(e);
- }
- catch (IllegalArgumentException e)
- {
- throw new RuntimeException(e);
- }
- catch (InvocationTargetException e)
- {
- throw new RuntimeException(e.getTargetException());
- }
- }
-
-}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/ServiceRemoteProxy.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/ServiceRemoteProxy.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/ServiceRemoteProxy.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,122 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.service;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import org.jboss.aop.Dispatcher;
-import org.jboss.aop.advice.Interceptor;
-import org.jboss.aop.joinpoint.MethodInvocation;
-import org.jboss.aop.util.MethodHashing;
-import org.jboss.aop.util.PayloadKey;
-import org.jboss.aspects.asynch.AsynchMixin;
-import org.jboss.aspects.asynch.AsynchProvider;
-import org.jboss.aspects.remoting.InvokeRemoteInterceptor;
-import org.jboss.ejb3.Container;
-import org.jboss.ejb3.JBossProxy;
-import org.jboss.ejb3.ProxyUtils;
-import org.jboss.ejb3.asynchronous.AsynchronousInterceptor;
-import org.jboss.ejb3.remoting.IsLocalInterceptor;
-import org.jboss.remoting.InvokerLocator;
-
-/**
- * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
- * @version $Revision$
- */
-public class ServiceRemoteProxy extends org.jboss.ejb3.remoting.BaseRemoteProxy
-{
- private static final long serialVersionUID = 306994045720155142L;
-
- protected InvokerLocator uri;
- AsynchProvider provider;
-
- public ServiceRemoteProxy(Container container, Interceptor[] interceptors, InvokerLocator uri)
- {
- super(container, interceptors);
- this.uri = uri;
- }
-
- public ServiceRemoteProxy(AsynchProvider provider, String containerId, String containerGuid, Interceptor[] interceptors, InvokerLocator uri)
- {
- super(containerId, containerGuid, interceptors);
- this.uri = uri;
- this.provider = provider;
- }
-
- protected ServiceRemoteProxy()
- {
- }
-
-
- public Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable
- {
- if (method.getDeclaringClass() == AsynchProvider.class)
- {
- return provider.getFuture();
- }
-
- long hash = MethodHashing.calculateHash(method);
- Object ret = ProxyUtils.handleCallLocally((JBossProxy) proxy, this, method, args);
- if (ret != null)
- {
- return ret;
- }
-
- MethodInvocation sri = new MethodInvocation(interceptors, hash, method, method, null);
- sri.setArguments(args);
- sri.setInstanceResolver(metadata);
- sri.getMetaData().addMetaData(Dispatcher.DISPATCHER, Dispatcher.OID, containerId, PayloadKey.AS_IS);
- sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.INVOKER_LOCATOR, uri, PayloadKey.AS_IS);
- sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.SUBSYSTEM, "AOP", PayloadKey.AS_IS);
- sri.getMetaData().addMetaData(IsLocalInterceptor.IS_LOCAL, IsLocalInterceptor.GUID, containerGuid, PayloadKey.AS_IS);
-
-
- if (provider != null)
- {
- sri.getMetaData().addMetaData(AsynchronousInterceptor.ASYNCH, AsynchronousInterceptor.INVOKE_ASYNCH, "YES", PayloadKey.AS_IS);
- }
- return sri.invokeNext();
- }
-
- public Object getAsynchronousProxy(Object proxy)
- {
- Class[] infs = proxy.getClass().getInterfaces();
- if (!ProxyUtils.isAsynchronous(infs))
- {
- Class[] interfaces = ProxyUtils.addAsynchProviderInterface(infs);
- AsynchMixin mixin = new AsynchMixin();
- Interceptor[] newInterceptors = ProxyUtils.addAsynchProxyInterceptor(mixin, interceptors);
- ServiceRemoteProxy handler = new ServiceRemoteProxy(mixin, containerId, containerGuid, newInterceptors, uri);
- return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, handler);
- }
-
- //I was already asynchronous
- return proxy;
- }
-
-
- public String toString()
- {
- return containerId.toString();
- }
-}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/ServiceRemoteProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/ServiceRemoteProxyFactory.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/ServiceRemoteProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,112 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.service;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.aop.advice.AdviceStack;
-import org.jboss.ejb3.JBossProxy;
-import org.jboss.ejb3.ProxyFactoryHelper;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.remoting.RemoteProxyFactory;
-import org.jboss.remoting.InvokerLocator;
-
-
-/**
- * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
- * @version $Revision$
- */
-public class ServiceRemoteProxyFactory extends BaseServiceProxyFactory implements RemoteProxyFactory
-{
- private RemoteBinding binding;
- private InvokerLocator locator;
-
- protected ServiceRemoteProxyFactory(ServiceContainer container, RemoteBinding binding)
- {
- super(container, binding.jndiBinding());
-
- this.binding = binding;
- }
-
-// public void setRemoteBinding(RemoteBinding binding)
-// {
-// this.binding = binding;
-// }
-
- protected Class<?>[] getInterfaces()
- {
- // Initialize
- Set<Class<?>> uniqueInterfaces = new HashSet<Class<?>>();
-
- // Obtain interfaces and add as unique
- uniqueInterfaces.addAll(Arrays.asList(ProxyFactoryHelper.getRemoteAndBusinessRemoteInterfaces(container)));
-
- // Add JBossProxy
- uniqueInterfaces.add(JBossProxy.class);
-
- // Return
- return uniqueInterfaces.toArray(new Class<?>[]{});
- }
-
- public void start() throws Exception
- {
- String clientBindUrl = ProxyFactoryHelper.getClientBindUrl(binding);
- locator = new InvokerLocator(clientBindUrl);
- super.start();
- }
-
- public Object createProxyBusiness()
- {
- try
- {
- String stackName = "ServiceClientInterceptors";
- if (binding.interceptorStack() != null && !binding.interceptorStack().equals(""))
- {
- stackName = binding.interceptorStack();
- }
- AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
- Object[] args = {new ServiceRemoteProxy(container, stack.createInterceptors(container.getAdvisor(), null), locator)};
- return proxyConstructor.newInstance(args);
- }
- catch (InstantiationException e)
- {
- throw new RuntimeException(e);
- }
- catch (IllegalAccessException e)
- {
- throw new RuntimeException(e);
- }
- catch (IllegalArgumentException e)
- {
- throw new RuntimeException(e);
- }
- catch (InvocationTargetException e)
- {
- throw new RuntimeException(e.getTargetException());
- }
- }
-
-}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/BaseSessionProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/BaseSessionProxyFactory.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/BaseSessionProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,613 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.session;
-
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.ejb.EJBException;
-import javax.ejb.EJBHome;
-import javax.ejb.EJBLocalHome;
-import javax.ejb.EJBLocalObject;
-import javax.ejb.EJBMetaData;
-import javax.ejb.EJBObject;
-import javax.ejb.Handle;
-import javax.ejb.HomeHandle;
-import javax.ejb.RemoteHome;
-import javax.naming.NamingException;
-
-import org.jboss.ejb3.EJBContainer;
-import org.jboss.ejb3.Ejb3Registry;
-import org.jboss.ejb3.JBossProxy;
-import org.jboss.ejb3.ProxyFactory;
-import org.jboss.ejb3.ProxyFactoryHelper;
-import org.jboss.ejb3.SpecificationInterfaceType;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.proxy.EJBMetaDataImpl;
-import org.jboss.ejb3.proxy.handle.HomeHandleImpl;
-import org.jboss.logging.Logger;
-import org.jboss.util.naming.Util;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- * @version $Revision$
- */
-public abstract class BaseSessionProxyFactory implements ProxyFactory, Externalizable
-{
- @SuppressWarnings("unused")
- private static final Logger log = Logger.getLogger(BaseSessionProxyFactory.class);
-
- private SessionSpecContainer container;
- protected String containerGuid;
- protected String containerClusterUid;
- protected boolean isClustered = false;
- protected String jndiName;
-
- /**
- * Proxy Constructor for the Business Interfaces' Proxy
- */
- protected Constructor<?> businessProxyConstructor;
-
- /**
- * Proxy Constructor for the EJBObject/EJBLocalObject Proxy
- */
- protected Constructor<?> ejb21ProxyConstructor;
-
- private static final String METHOD_PREFIX_EJB21_CREATE = "create";
-
- public BaseSessionProxyFactory()
- {
- }
-
- protected BaseSessionProxyFactory(SessionSpecContainer container)
- {
- assert container != null : "container is null";
-
- setContainer(container);
- }
-
- public Object createHomeProxy()
- {
- throw new RuntimeException("NYI");
- }
-
- /**
- * Creates the Proxy constructors
- */
- protected void createProxyConstructors() throws Exception
- {
- // Obtain this bean class' CL
- ClassLoader cl = this.getContainer().getBeanClass().getClassLoader();
-
- // Create business proxy constructor
- Class<?>[] businessInterfaces = this.getInterfacesForBusinessProxy();
- this.businessProxyConstructor = ProxyFactoryHelper.createProxyConstructor(businessInterfaces, cl);
-
- // Create EJB21 proxy constructor
- Class<?>[] ejb21Interfaces = this.getInterfacesForEjb21Proxy();
- if (ejb21Interfaces != null)
- {
- this.ejb21ProxyConstructor = ProxyFactoryHelper.createProxyConstructor(ejb21Interfaces, cl);
- }
-
-
- /* plain jdk
- Class<?> proxyClass = java.lang.reflect.Proxy.getProxyClass(getContainer().getBeanClass().getClassLoader(), interfaces);
- final Class<?>[] constructorParams =
- {InvocationHandler.class};
- businessProxyConstructor = proxyClass.getConstructor(constructorParams);
-
- */
-
- /* javassist */
- /*
- proxyFactory = new javassist.util.proxy.ProxyFactory()
- {
- @Override
- protected ClassLoader getClassLoader()
- {
- return container.getBeanClass().getClassLoader();
- }
- };
- proxyFactory.setInterfaces(interfaces);
- proxyFactory.setSuperclass(JavassistProxy.class);
- proxyClass = proxyFactory.createClass();
- proxyConstructor = proxyClass.getConstructor((Class[]) null);
- */
-
- /* cglib */
- /*
- proxyClass = net.sf.cglib.proxy.Proxy.getProxyClass(container.getBeanClass().getClassLoader(), interfaces);
- final Class[] constructorParams = {net.sf.cglib.proxy.InvocationHandler.class};
- proxyConstructor = proxyClass.getConstructor(constructorParams);
- */
- }
-
- protected void bindProxy(Object proxy) throws NamingException
- {
- try
- {
- log.debug("Binding proxy for " + getContainer().getEjbName() + " in JNDI at " + this.getJndiName());
- Util.rebind(getContainer().getInitialContext(), this.getJndiName(), proxy);
- } catch (NamingException e)
- {
- NamingException namingException = new NamingException("Could not bind stateless proxy with ejb name "
- + getContainer().getEjbName() + " into JNDI under jndiName: "
- + getContainer().getInitialContext().getNameInNamespace() + "/" + this.getJndiName());
- namingException.setRootCause(e);
- throw namingException;
- }
- }
-
- /**
- * Whether or not to bind the home and business interfaces together
- *
- * @return
- */
- protected abstract boolean bindHomeAndBusinessTogether();
-
- protected Object constructProxyBusiness(InvocationHandler handler)
- {
- // Return
- return this.constructProxy(handler, SpecificationInterfaceType.EJB30_BUSINESS);
- }
-
- protected Object constructEjb21Proxy(InvocationHandler handler)
- {
- // Return
- return this.constructProxy(handler, SpecificationInterfaceType.EJB21);
- }
-
- /**
- * Construct a new Proxy of the specified type using the
- * specified handler as argument to the Constructor
- *
- * @param handler
- * @param specType
- * @return
- */
- protected Object constructProxy(final InvocationHandler handler, SpecificationInterfaceType specType)
- {
- // Initialize
- Object obj = null;
-
- try
- {
- // Business Proxy
- if (specType.equals(SpecificationInterfaceType.EJB30_BUSINESS))
- {
- obj = this.businessProxyConstructor.newInstance(handler);
- }
- // EJBObject/EJBLocalObject
- else if (specType.equals(SpecificationInterfaceType.EJB21))
- {
- // If there's no EJB21 View
- if (this.ejb21ProxyConstructor == null)
- {
- throw new IllegalStateException(
- "EJB3 Specification Violation Section 4.3.3: \""
- + "Only session beans with a remote EJBObject / local EJBLocalObject interface can call this method.");
- }
-
- obj = this.ejb21ProxyConstructor.newInstance(handler);
- }
- }
- catch (InstantiationException e)
- {
- throw new RuntimeException(e);
- }
- catch (IllegalAccessException e)
- {
- throw new RuntimeException(e);
- }
- catch (InvocationTargetException e)
- {
- Throwable t = e.getTargetException();
- if (t instanceof RuntimeException)
- throw (RuntimeException) t;
- throw new RuntimeException(t);
- }
-
- // Ensure Proxy object was created
- assert obj != null : "Proxy Object must not be null";
-
- // Return
- return obj;
- }
-
-
- protected void setContainer(SessionSpecContainer container)
- {
- this.container = container;
- this.containerGuid = Ejb3Registry.guid(container);
- this.containerClusterUid = Ejb3Registry.clusterUid(container);
- this.isClustered = container.isClustered();
- }
-
- protected SessionSpecContainer getContainer()
- {
- if (container == null)
- {
- container = (SessionSpecContainer)Ejb3Registry.findContainer(containerGuid);
-
- if (container == null && isClustered)
- container = (SessionSpecContainer)Ejb3Registry.getClusterContainer(containerClusterUid);
- }
-
- return container;
- }
-
- /**
- * Obtains interfaces to be used in the business proxy
- *
- * @return
- */
- protected Class<?>[] getInterfacesForBusinessProxy()
- {
- return this.getInterfacesForProxy(this.getProxyAccessType(), SpecificationInterfaceType.EJB30_BUSINESS);
- }
-
- /**
- * Obtains interfaces to be used in the EJB21 proxy. Returns null if none defined
- *
- * @return
- */
- protected Class<?>[] getInterfacesForEjb21Proxy()
- {
- return this.getInterfacesForProxy(this.getProxyAccessType(), SpecificationInterfaceType.EJB21);
- }
-
- /**
- * Returns an array of interfaces to be used for the proxy;
- * will return null if none are defined.
- *
- * @param accessType
- * @param specType
- * @return
- */
- private Class<?>[] getInterfacesForProxy(ProxyAccessType accessType, SpecificationInterfaceType specType)
- {
-
- // Initialize
- Set<Class<?>> interfaces = new HashSet<Class<?>>();
- SessionContainer container = this.getContainer();
-
- // Initialize array of interfaces
- Set<Class<?>> intfs = new HashSet<Class<?>>();
-
- // If Local
- if (accessType.equals(ProxyAccessType.LOCAL))
- {
-
- // If business
- if (specType.equals(SpecificationInterfaceType.EJB30_BUSINESS))
- {
- intfs.addAll(Arrays.asList(ProxyFactoryHelper.getLocalBusinessInterfaces(container)));
-
- // If binding home with local business
- if(this.bindHomeAndBusinessTogether())
- {
- Class<?> home = this.getHomeType();
- if (home != null)
- {
- intfs.add(home);
- }
- }
- }
- // If EJBLocalObject
- else
- {
- // Add local interfaces
- intfs.addAll(Arrays.asList(ProxyFactoryHelper.getLocalInterfaces(container)));
-
- // If no interfaces
- if (intfs.size() == 0)
- {
- return null;
- }
-
- // Add EJBLocalObject
- intfs.add(EJBLocalObject.class);
- }
- }
- // If remote
- else
- {
- // If business
- if (specType.equals(SpecificationInterfaceType.EJB30_BUSINESS))
- {
- intfs.addAll(Arrays.asList(ProxyFactoryHelper.getRemoteBusinessInterfaces(container)));
-
- // If binding home with remote business
- if(this.bindHomeAndBusinessTogether())
- {
- Class<?> home = this.getHomeType();
- if (home != null)
- {
- intfs.add(home);
- }
- }
-
- }
- // If EJBObject
- else
- {
- // Add remote interfaces
- intfs.addAll(Arrays.asList(ProxyFactoryHelper.getRemoteInterfaces(container)));
-
- // If no interfaces
- if (intfs.size() == 0)
- {
- return null;
- }
-
- // Add EJBObject
- intfs.add(EJBObject.class);
- }
- }
-
- // Add all interfaces
- for (Class<?> interfaze : intfs)
- {
- interfaces.add(interfaze);
- }
-
- // Add JBossProxy
- interfaces.add(JBossProxy.class);
-
- // Return
- return interfaces.toArray(new Class[]
- {});
- }
-
- /**
- * Defines the access type for this Proxies created by this Factory
- *
- * @return
- */
- protected abstract ProxyAccessType getProxyAccessType();
-
- protected void setEjb21Objects(BaseSessionRemoteProxy proxy)
- {
- proxy.setHandle(this.createHandle());
- proxy.setHomeHandle(getHomeHandle());
- proxy.setEjbMetaData(getEjbMetaData());
- }
-
- abstract protected Handle createHandle();
-
- protected HomeHandle getHomeHandle()
- {
- EJBContainer ejbContainer = (EJBContainer)container;
-
- HomeHandleImpl homeHandle = null;
-
- RemoteBinding remoteBindingAnnotation = ejbContainer.getAnnotation(RemoteBinding.class);
- if (remoteBindingAnnotation != null)
- homeHandle = new HomeHandleImpl(ProxyFactoryHelper.getHomeJndiName(container));
-
- return homeHandle;
- }
-
- /**
- * Returns the interface type for Home
- *
- * @return
- */
- protected abstract Class<?> getHomeType();
-
- protected final String getJndiName()
- {
- return this.jndiName;
- }
-
- protected EJBMetaData getEjbMetaData()
- {
- Class<?> remote = null;
- Class<?> home = null;
- Class<?> pkClass = Object.class;
- HomeHandleImpl homeHandle = null;
-
- EJBContainer ejbContainer = (EJBContainer)container;
-
- Class<?>[] remotes = ProxyFactoryHelper.getRemoteInterfaces(this.getContainer());
- if (remotes != null && remotes.length > 0)
- {
- remote = remotes[0];
- }
- RemoteHome homeAnnotation = ejbContainer.getAnnotation(RemoteHome.class);
- if (homeAnnotation != null)
- home = homeAnnotation.value();
- RemoteBinding remoteBindingAnnotation = ejbContainer.getAnnotation(RemoteBinding.class);
- if (remoteBindingAnnotation != null)
- homeHandle = new HomeHandleImpl(remoteBindingAnnotation.jndiBinding());
-
- EJBMetaDataImpl metadata = new EJBMetaDataImpl(remote, home, pkClass, true, false, homeHandle);
-
- return metadata;
- }
-
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- {
- containerGuid = in.readUTF();
- containerClusterUid = in.readUTF();
- isClustered = in.readBoolean();
-
- if (getContainer() == null)
- throw new EJBException("Invalid (i.e. remote) invocation of local interface (null container) for " + containerGuid);
- }
-
- public void writeExternal(ObjectOutput out) throws IOException
- {
- out.writeUTF(containerGuid);
- out.writeUTF(containerClusterUid);
- out.writeBoolean(isClustered);
- }
-
- /**
- * Ensures that an EJB 2.1 view is complete; the following rules apply:
- *
- * 1) If EJBHome/EJBLocalHome is defined, at least one EJBObject/EJBLocalObject is defined.
- * 2) If one EJBObject/EJBLocalObject is defined, an EJBHome/EJBLocalHome is defined.
- *
- * @param home
- * @param localOrRemoteInterfaces
- * @throws RuntimeException
- */
- protected void validateCompleteEjb21View(Class<?> home, Class<?>[] localOrRemoteInterfaces) throws RuntimeException
- {
- // Ensure specified home is EJBHome or EJBLocalHome
- assert (home == null || (EJBHome.class.isAssignableFrom(home) || EJBLocalHome.class.isAssignableFrom(home)));
-
- // Ensure all interfaces passed are either EJBObject or EJBLocalObject
- for (Class<?> localOrRemoteInterface : localOrRemoteInterfaces)
- {
- assert (EJBObject.class.isAssignableFrom(localOrRemoteInterface) || EJBLocalObject.class
- .isAssignableFrom(localOrRemoteInterface));
- }
-
- // If home is defined and there are no local/remote interfaces
- if (home != null && localOrRemoteInterfaces.length == 0)
- {
- throw new RuntimeException("EJBTHREE-1075: " + container.getBeanClassName() + " defines home"
- + " but provides no local/remote interfaces extending " + EJBLocalObject.class.getName() + "/"
- + EJBObject.class.getName() + "; EJB 2.1 view cannot be realized");
- }
-
- // If local/remote interfaces are defined, but no remote home
- if (home == null && localOrRemoteInterfaces.length != 0)
- {
- throw new RuntimeException("EJBTHREE-1075: " + container.getBeanClassName()
- + " defines local/remote interfaces" + " but provides no home; EJB 2.1 view cannot be realized");
- }
- }
-
- /**
- * Validates that the specified EJB2.1 Home interface returns only
- * valid remote/local interfaces from "create<METHOD>" methods. If no
- * home is defined, the method will return without further checks
- *
- * @param home
- */
- protected void validateHomeReturnsNoBusinessInterfaces(Class<?> home)
- {
- // Only perform if home is defined; otherwise no EJB2.1 view
- if(home==null)
- {
- return;
- }
-
- // Sanity checks
- assert EJBHome.class.isAssignableFrom(home) || EJBLocalHome.class.isAssignableFrom(home) : "Specified home interface, "
- + home.getName() + ", must be of type " + EJBHome.class.getName() + " or " + EJBLocalHome.class.getName();
- assert home.isInterface() : "Specified home interface, " + home.getName() + " is not an interface.";
-
- // Initialize
- Set<Method> creates = new HashSet<Method>();
-
- // Obtain all "create<METHOD>" methods
- Method[] all = home.getDeclaredMethods();
-
- // For each method
- for (Method method : all)
- {
- // If a "create<METHOD>" method
- if (method.getName().startsWith(BaseSessionProxyFactory.METHOD_PREFIX_EJB21_CREATE))
- {
- // Add to the Set of Creates
- creates.add(method);
- }
- }
-
- // For all "create<METHOD>" methods
- for (Method create : creates)
- {
- // Init
- boolean isLocal = true;
-
- // Set as remote if applicable
- if (EJBHome.class.isAssignableFrom(home))
- {
- isLocal = false;
- }
-
- // If local (EJBLocalHome)
- if (isLocal)
- {
- // Validate return type is local interface
- if (!EJBLocalObject.class.isAssignableFrom(create.getReturnType()))
- {
- throw new RuntimeException("EJB 3 Core Specification Section 4.6.10: "
- + "The return type for a create<METHOD> method must be"
- + " the session bean's local interface type. " + home.getName() + " has method "
- + create.getName() + " which returns " + create.getReturnType().getName() + ". [EJBTHREE-1059]");
- }
- }
- // If remote (EJBHome)
- else
- {
- // Validate return type is remote interface
- if (!EJBObject.class.isAssignableFrom(create.getReturnType()))
- {
- throw new RuntimeException("EJB 3 Core Specification Section 4.6.8: "
- + "The return type for a create<METHOD> method "
- + "must be the session bean’s remote interface type. " + home.getName() + " has method "
- + create.getName() + " which returns " + create.getReturnType().getName() + ". [EJBTHREE-1059]");
- }
- }
- }
- }
-
- /**
- * Validates that any EJB2.1 Views associated with this ProxyFactory
- * are valid
- *
- * @param home
- * @param localOrRemoteInterfaces
- * @throws RuntimeException
- */
- protected void validateEjb21Views(Class<?> home,Class<?>[] localOrRemoteInterfaces) throws RuntimeException
- {
- // Ensure EJB2.1 Views are complete (EJBTHREE-1075)
- this.validateCompleteEjb21View(home, localOrRemoteInterfaces);
-
- // Ensure EJB2.1 Home returns only local/remote interfaces
- this.validateHomeReturnsNoBusinessInterfaces(home);
- }
-
- /**
- * Validates that any EJB2.1 Views associated with this ProxyFactory
- * are valid
- */
- protected abstract void validateEjb21Views();
-}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/BaseSessionRemoteProxy.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/BaseSessionRemoteProxy.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/BaseSessionRemoteProxy.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,80 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.session;
-
-import javax.ejb.EJBMetaData;
-import javax.ejb.Handle;
-import javax.ejb.HomeHandle;
-import org.jboss.aop.advice.Interceptor;
-
-import org.jboss.ejb3.Container;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- * @version $Revision$
- */
-public abstract class BaseSessionRemoteProxy extends org.jboss.ejb3.remoting.BaseRemoteProxy
-{
- private static final long serialVersionUID = 8310915813626447181L;
-
- protected Object id;
-
- protected Handle handle;
- protected HomeHandle homeHandle;
- protected EJBMetaData ejbMetaData;
-
- public BaseSessionRemoteProxy(Container container, Interceptor[] interceptors)
- {
- super(container, interceptors);
- }
-
- public BaseSessionRemoteProxy(String containerId, String containerGuid, Interceptor[] interceptors)
- {
- super(containerId, containerGuid, interceptors);
- }
-
- protected BaseSessionRemoteProxy()
- {
- }
-
- public Handle getHandle()
- {
- return this.handle;
- }
-
- public void setHandle(Handle handle)
- {
- this.handle = handle;
- }
-
- public void setHomeHandle(HomeHandle homeHandle)
- {
- this.homeHandle = homeHandle;
- }
-
- public void setEjbMetaData(EJBMetaData ejbMetaData)
- {
- this.ejbMetaData = ejbMetaData;
- }
-}
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/ProxyDeployer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/ProxyDeployer.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/ProxyDeployer.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -28,8 +28,6 @@
import java.util.List;
import java.util.Map;
-import org.jboss.ejb3.ProxyFactory;
-import org.jboss.ejb3.ProxyFactoryHelper;
import org.jboss.ejb3.annotation.LocalBinding;
import org.jboss.ejb3.annotation.RemoteBinding;
import org.jboss.ejb3.annotation.RemoteBindings;
@@ -37,7 +35,9 @@
import org.jboss.ejb3.annotation.impl.LocalBindingImpl;
import org.jboss.ejb3.annotation.impl.RemoteBindingImpl;
import org.jboss.ejb3.annotation.impl.RemoteBindingsImpl;
-import org.jboss.ejb3.remoting.RemoteProxyFactory;
+import org.jboss.ejb3.proxy.ProxyFactory;
+import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
+import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
import org.jboss.logging.Logger;
/**
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionContainer.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionContainer.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -46,15 +46,16 @@
import org.jboss.ejb3.EJBContainerInvocation;
import org.jboss.ejb3.Ejb3Deployment;
import org.jboss.ejb3.Ejb3Module;
-import org.jboss.ejb3.ProxyFactory;
-import org.jboss.ejb3.ProxyFactoryHelper;
-import org.jboss.ejb3.ProxyUtils;
import org.jboss.ejb3.ThreadLocalStack;
import org.jboss.ejb3.annotation.LocalBinding;
import org.jboss.ejb3.annotation.RemoteBinding;
import org.jboss.ejb3.annotation.RemoteBindings;
+import org.jboss.ejb3.proxy.ProxyFactory;
+import org.jboss.ejb3.proxy.ProxyUtils;
+import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
+import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
+import org.jboss.ejb3.proxy.factory.SessionProxyFactory;
import org.jboss.ejb3.remoting.IsLocalInterceptor;
-import org.jboss.ejb3.remoting.RemoteProxyFactory;
import org.jboss.ejb3.stateful.StatefulContainerInvocation;
import org.jboss.ha.framework.server.HATarget;
import org.jboss.logging.Logger;
@@ -382,7 +383,7 @@
* @param args the arguments for the method
* @param provider for asynchronous usage
*/
- public Object invoke(ProxyFactory factory, Object id, Method method, Object args[], FutureHolder provider) throws Throwable
+ public Object invoke(SessionProxyFactory factory, Object id, Method method, Object args[], FutureHolder provider) throws Throwable
{
ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
pushEnc();
@@ -436,25 +437,15 @@
/**
* TODO: work in progress (refactor both invokeHomeMethod's, localHomeInvoke)
+ * TODO: Move this to SessionSpecContainer
*/
- private Object invokeHomeMethod(ProxyFactory factory, MethodInfo info, Object args[]) throws Exception
+ //TODO
+ private Object invokeHomeMethod(SessionProxyFactory factory, MethodInfo info, Object args[]) throws Exception
{
Method unadvisedMethod = info.getUnadvisedMethod();
if (unadvisedMethod.getName().equals("create"))
{
- Class<?>[] initParameterTypes = {};
- Object[] initParameterValues = {};
- if (unadvisedMethod.getParameterTypes().length > 0)
- {
- initParameterTypes = unadvisedMethod.getParameterTypes();
- initParameterValues = args;
- }
-
- Object id = createSession(initParameterTypes, initParameterValues);
-
- Object proxy = factory.createProxyBusiness(id);
-
- return proxy;
+ return this.invokeHomeCreate(factory, unadvisedMethod, args);
}
else if (unadvisedMethod.getName().equals("remove"))
{
@@ -472,6 +463,19 @@
}
/**
+ * Provides implementation for this bean's EJB 2.1 Home.create() method
+ *
+ * @param factory
+ * @param unadvisedMethod
+ * @param args
+ * @return
+ * @throws Exception
+ */
+ //TODO Move this to SessionSpecContainer
+ protected abstract Object invokeHomeCreate(SessionProxyFactory factory, Method unadvisedMethod, Object args[])
+ throws Exception;
+
+ /**
* Create session to an EJB bean.
*
* @param initParameterTypes the parameter types used by the home's create method
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -36,12 +36,12 @@
* @return
* @throws Exception
*/
- public Object createProxyRemoteEjb21() throws Exception
+ public Object createProxyRemoteEjb21(String businessInterfaceType) throws Exception
{
RemoteBinding binding = this.getRemoteBinding();
- return this.createProxyRemoteEjb21(binding);
+ return this.createProxyRemoteEjb21(binding, businessInterfaceType);
}
-
+
/**
* Create a remote proxy (EJBObject) for an enterprise bean identified by id on a given binding
*
@@ -50,8 +50,8 @@
* @return
* @throws Exception
*/
- public abstract Object createProxyRemoteEjb21(RemoteBinding binding) throws Exception;
-
+ public abstract Object createProxyRemoteEjb21(RemoteBinding binding, String businessInterfaceType) throws Exception;
+
/**
* Create a local proxy (EJBLocalObject) for an enterprise bean identified by id
*
@@ -59,12 +59,12 @@
* @return
* @throws Exception
*/
- public Object createProxyLocalEjb21() throws Exception
+ public Object createProxyLocalEjb21(String businessInterfaceType) throws Exception
{
LocalBinding binding = this.getAnnotation(LocalBinding.class);
- return this.createProxyLocalEjb21(binding);
+ return this.createProxyLocalEjb21(binding, businessInterfaceType);
}
-
+
/**
* Create a local proxy (EJBLocalObject) for an enterprise bean identified by id, with
* the specified LocalBinding
@@ -73,5 +73,5 @@
* @return
* @throws Exception
*/
- public abstract Object createProxyLocalEjb21(LocalBinding binding) throws Exception;
+ public abstract Object createProxyLocalEjb21(LocalBinding binding, String businessInterfaceType) throws Exception;
}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/BaseStatefulProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/BaseStatefulProxyFactory.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/BaseStatefulProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,137 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.stateful;
-
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-
-import javax.naming.Context;
-import javax.naming.Name;
-import javax.naming.NamingException;
-import javax.naming.RefAddr;
-import javax.naming.Reference;
-import javax.naming.StringRefAddr;
-
-import org.jboss.ejb3.JndiProxyFactory;
-import org.jboss.ejb3.ProxyFactory;
-import org.jboss.ejb3.session.BaseSessionProxyFactory;
-import org.jboss.ejb3.session.SessionSpecContainer;
-import org.jboss.logging.Logger;
-import org.jboss.util.naming.Util;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public abstract class BaseStatefulProxyFactory extends BaseSessionProxyFactory implements ProxyFactory
-{
- // Class Members
-
- @SuppressWarnings("unused")
- private static final Logger log = Logger.getLogger(BaseStatefulProxyFactory.class);
-
- public static final String PROXY_FACTORY_NAME = "StatefulProxyFactory";
-
- /**
- * Do not call, only for externalizable
- */
- protected BaseStatefulProxyFactory()
- {
- super();
- }
-
- public BaseStatefulProxyFactory(SessionSpecContainer container, String jndiName)
- {
- super(container);
-
- assert jndiName != null : "jndiName is null";
-
- this.jndiName = jndiName;
- }
-
- public void init() throws Exception
- {
- // Ensure EJB2.1 View is Complete
- this.validateEjb21Views();
-
- // Create the Proxy Constructors
- this.createProxyConstructors();
- }
-
- public void start() throws Exception
- {
- this.init();
-
- // Bind the Proxy Factory
- Context ctx = getContainer().getInitialContext();
- Name name = ctx.getNameParser("").parse(jndiName);
- ctx = Util.createSubcontext(ctx, name.getPrefix(name.size() - 1));
- String atom = name.get(name.size() - 1);
- RefAddr refAddr = new StringRefAddr(JndiProxyFactory.FACTORY, jndiName + PROXY_FACTORY_NAME);
- Reference ref = new Reference(Object.class.getName(), refAddr, JndiProxyFactory.class.getName(), null);
- try
- {
- log.debug("Binding reference for " + getContainer().getEjbName() + " in JNDI at " + atom);
- Util.rebind(ctx, atom, ref);
- }
- catch (NamingException e)
- {
- NamingException namingException = new NamingException("Could not bind stateful proxy with ejb name "
- + getContainer().getEjbName() + " into JNDI under jndiName: " + ctx.getNameInNamespace() + "/" + atom);
- namingException.setRootCause(e);
- throw namingException;
- }
- }
-
- public void stop() throws Exception
- {
- Util.unbind(getContainer().getInitialContext(), jndiName);
- }
-
- protected final void initializeJndiName() {};
-
- @Override
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- {
- super.readExternal(in);
- try
- {
- init();
- }
- catch(Exception e)
- {
- log.error(e.getMessage(), e);
- throw new IOException(e.getMessage());
- }
- this.jndiName = in.readUTF();
- }
-
- @Override
- public void writeExternal(ObjectOutput out) throws IOException
- {
- super.writeExternal(out);
- out.writeUTF(jndiName);
- }
-}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/BaseStatefulRemoteProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/BaseStatefulRemoteProxyFactory.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/BaseStatefulRemoteProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,196 +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.stateful;
-
-import javax.ejb.EJBObject;
-import javax.ejb.RemoteHome;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.aop.advice.AdviceStack;
-import org.jboss.ejb3.ProxyFactoryHelper;
-import org.jboss.ejb3.SpecificationInterfaceType;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.remoting.RemoteProxyFactory;
-import org.jboss.ejb3.session.ProxyAccessType;
-import org.jboss.ejb3.session.SessionContainer;
-import org.jboss.ejb3.session.SessionSpecContainer;
-import org.jboss.logging.Logger;
-import org.jboss.remoting.InvokerLocator;
-
-/**
- * BaseStatefulRemoteProxyFactory
- *
- * Common base for factories generating remoting-enabled
- * proxies (ie. remote and clustering)
- *
- * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
- * @version $Revision: $
- */
-public abstract class BaseStatefulRemoteProxyFactory extends BaseStatefulProxyFactory implements RemoteProxyFactory
-{
- // Class Members
-
- private static final Logger log = Logger.getLogger(BaseStatefulRemoteProxyFactory.class);
-
- // Instance Members
-
- private RemoteBinding binding;
-
- private InvokerLocator locator;
-
- // Constructor
- public BaseStatefulRemoteProxyFactory(SessionSpecContainer container, RemoteBinding binding)
- {
- super(container, binding.jndiBinding());
-
- this.binding = binding;
-
- try
- {
- String clientBindUrl = ProxyFactoryHelper.getClientBindUrl(this.getBinding());
- this.locator = new InvokerLocator(clientBindUrl);
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- }
-
- // Required Implementations
-
- @Override
- protected ProxyAccessType getProxyAccessType()
- {
- return ProxyAccessType.REMOTE;
- }
-
- @Override
- protected void validateEjb21Views()
- {
- // Obtain Container
- SessionContainer container = this.getContainer();
-
- // Obtain @RemoteHome
- RemoteHome remoteHome = container.getAnnotation(RemoteHome.class);
-
- // Ensure that if EJB 2.1 Components are defined, they're complete
- this.validateEjb21Views(remoteHome == null ? null : remoteHome.value(), ProxyFactoryHelper
- .getRemoteInterfaces(container));
- }
-
- public Object createProxyBusiness()
- {
- Object id = getContainer().createSession();
- return this.createProxyBusiness(id);
- }
-
- public Object createProxyBusiness(Object id)
- {
- return this.createProxy(id,SpecificationInterfaceType.EJB30_BUSINESS);
- }
-
- // Specifications
-
- abstract String getStackNameInterceptors();
-
- // Functional Methods
-
- @Override
- protected boolean bindHomeAndBusinessTogether()
- {
- SessionSpecContainer container = this.getContainer();
- String homeJndiName = ProxyFactoryHelper.getHomeJndiName(container);
- String remoteBusinessJndiName = ProxyFactoryHelper.getRemoteBusinessJndiName(container);
- return homeJndiName.equals(remoteBusinessJndiName);
- }
-
- Object createProxy(Object id,SpecificationInterfaceType type)
- {
- String stackName = this.getStackNameInterceptors();
- RemoteBinding binding = this.getBinding();
- if (binding.interceptorStack() != null && !binding.interceptorStack().trim().equals(""))
- {
- stackName = binding.interceptorStack();
- }
- AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
- if (stack == null) throw new RuntimeException("unable to find interceptor stack: " + stackName);
- StatefulRemoteProxy proxy = new StatefulRemoteProxy(getContainer(), stack.createInterceptors(getContainer()
- .getAdvisor(), null), this.getLocator(), id);
-
- if(type.equals(SpecificationInterfaceType.EJB21))
- {
- this.getContainer();
- return this.constructEjb21Proxy(proxy);
- }
- else
- {
- return this.constructProxyBusiness(proxy);
- }
- }
-
- @Override
- protected StatefulHandleRemoteImpl createHandle()
- {
- EJBObject proxy = this.createProxyEjb21();
- return this.createHandle(proxy);
- }
-
- protected StatefulHandleRemoteImpl createHandle(EJBObject proxy)
- {
- StatefulHandleRemoteImpl handle = new StatefulHandleRemoteImpl(proxy);
- return handle;
- }
-
- public EJBObject createProxyEjb21()
- {
- Object id = getContainer().createSession();
- return this.createProxyEjb21(id);
- }
-
- @SuppressWarnings("unchecked")
- public <T extends EJBObject> T createProxyEjb21(Object id)
- {
- // Cast explicitly to catch improper proxies
- return (T)this.createProxy(id,SpecificationInterfaceType.EJB21);
- }
-
- @Override
- public void start() throws Exception
- {
- super.start();
- }
-
- // Accessors / Mutators
-
- RemoteBinding getBinding()
- {
- assert this.binding!=null : "RemoteBinding has not been initialized";
- return this.binding;
- }
-
- InvokerLocator getLocator()
- {
- assert this.locator!=null : "InvokerLocator has not been initialized";
- return this.locator;
- }
-
-}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulClusterProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulClusterProxyFactory.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulClusterProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,241 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.stateful;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.ejb.RemoteHome;
-import javax.naming.NamingException;
-
-import org.jboss.aop.Dispatcher;
-import org.jboss.aspects.remoting.FamilyWrapper;
-import org.jboss.aspects.remoting.Remoting;
-import org.jboss.ejb3.ProxyFactory;
-import org.jboss.ejb3.ProxyFactoryHelper;
-import org.jboss.ejb3.annotation.Clustered;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.annotation.defaults.ClusteredDefaults;
-import org.jboss.ejb3.remoting.LoadBalancePolicyNotRegisteredException;
-import org.jboss.ejb3.remoting.RemoteProxyFactory;
-import org.jboss.ejb3.remoting.RemoteProxyFactoryRegistry;
-import org.jboss.ejb3.session.ProxyAccessType;
-import org.jboss.ejb3.session.SessionContainer;
-import org.jboss.ejb3.session.SessionSpecContainer;
-import org.jboss.ha.client.loadbalance.FirstAvailable;
-import org.jboss.ha.client.loadbalance.LoadBalancePolicy;
-import org.jboss.ha.framework.interfaces.ClusteringTargetsRepository;
-import org.jboss.ha.framework.interfaces.DistributedReplicantManager;
-import org.jboss.ha.framework.interfaces.HAPartition;
-import org.jboss.ha.framework.server.HATarget;
-import org.jboss.logging.Logger;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.util.NotImplementedException;
-import org.jboss.util.naming.Util;
-
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @author Brian Stansberry
- *
- * @version $Revision$
- */
-public class StatefulClusterProxyFactory extends BaseStatefulRemoteProxyFactory
- implements RemoteProxyFactory, DistributedReplicantManager.ReplicantListener
-{
- private static final Logger log = Logger.getLogger(StatefulClusterProxyFactory.class);
-
- private static String STACK_NAME_CLUSTERED_STATEFUL_SESSION_CLIENT_INTERCEPTORS = "ClusteredStatefulSessionClientInterceptors";
-
- private Clustered clustered;
- private DistributedReplicantManager drm;
- private HATarget hatarget;
- private String proxyFamilyName;
- private LoadBalancePolicy lbPolicy;
- private FamilyWrapper wrapper;
-
- public StatefulClusterProxyFactory(SessionSpecContainer container, RemoteBinding binding, Clustered clustered)
- {
- super(container, binding);
-
- assert clustered != null : "clustered is null";
-
- this.clustered = clustered;
- }
-
- /**
- * Returns the interface type for Home
- *
- * @return
- */
- @Override
- protected Class<?> getHomeType()
- {
- // Not Supported
- return null;
- }
-
- /**
- * Defines the access type for this Proxies created by this Factory
- *
- * @return
- */
- @Override
- protected ProxyAccessType getProxyAccessType(){
- return ProxyAccessType.REMOTE;
- }
-
- /**
- * Whether or not to bind the home and business interfaces together
- *
- * @return
- */
- @Override
- protected boolean bindHomeAndBusinessTogether()
- {
- // Not Supported
- return false;
- }
-
- protected void validateEjb21Views()
- {
- // Obtain Container
- SessionContainer container = this.getContainer();
-
- // Obtain @RemoteHome
- RemoteHome remoteHome = container.getAnnotation(RemoteHome.class);
-
- // Ensure that if EJB 2.1 Components are defined, they're complete
- this.validateEjb21Views(remoteHome == null ? null : remoteHome.value(), ProxyFactoryHelper
- .getRemoteInterfaces(container));
-
- }
-
- public void start() throws Exception
- {
- this.init();
-
- RemoteBinding binding = this.getBinding();
- InvokerLocator locator = this.getLocator();
- SessionContainer container = this.getContainer();
- String partitionName = container.getPartitionName();
- proxyFamilyName = container.getDeploymentQualifiedName() + locator.getProtocol() + partitionName;
- HAPartition partition = (HAPartition) this.getContainer().getInitialContext().lookup(
- "/HAPartition/" + partitionName);
- hatarget = new HATarget(partition, proxyFamilyName, locator, HATarget.ENABLE_INVOCATIONS);
- ClusteringTargetsRepository.initTarget(proxyFamilyName, hatarget.getReplicants());
- container.getClusterFamilies().put(proxyFamilyName, hatarget);
-
- if (clustered.loadBalancePolicy() == null || clustered.loadBalancePolicy().equals(ClusteredDefaults.LOAD_BALANCE_POLICY_DEFAULT))
- {
- lbPolicy = new FirstAvailable();
- }
- else
- {
- String policyClass = clustered.loadBalancePolicy();
- try
- {
- RemoteProxyFactoryRegistry registry = container.getDeployment().getRemoteProxyFactoryRegistry();
- Class<LoadBalancePolicy> policy = registry.getLoadBalancePolicy(policyClass);
- policyClass = policy.getName();
- }
- catch (LoadBalancePolicyNotRegisteredException e){}
-
- lbPolicy = (LoadBalancePolicy)Thread.currentThread().getContextClassLoader().loadClass(policyClass)
- .newInstance();
- }
- wrapper = new FamilyWrapper(proxyFamilyName, hatarget.getReplicants());
-
- this.drm = partition.getDistributedReplicantManager();
- drm.registerListener(proxyFamilyName, this);
-
- super.start();
-
- Class<?>[] interfaces = {ProxyFactory.class};
- String targetId = getTargetId();
- Object factoryProxy = Remoting.createPojiProxy(targetId, interfaces, ProxyFactoryHelper.getClientBindUrl(binding));
- try
- {
- Util.rebind(getContainer().getInitialContext(), jndiName + PROXY_FACTORY_NAME, factoryProxy);
- } catch (NamingException e)
- {
- NamingException namingException = new NamingException("Could not bind stateful cluster proxy with ejb name "
- + getContainer().getEjbName() + " into JNDI under jndiName: "
- + getContainer().getInitialContext().getNameInNamespace() + "/" + jndiName + PROXY_FACTORY_NAME);
- namingException.setRootCause(e);
- throw namingException;
- }
- assert !Dispatcher.singleton.isRegistered(targetId) : targetId + " is already registered";
- Dispatcher.singleton.registerTarget(targetId, this);
-
- }
-
- @Override
- String getStackNameInterceptors()
- {
- return StatefulClusterProxyFactory.STACK_NAME_CLUSTERED_STATEFUL_SESSION_CLIENT_INTERCEPTORS;
- }
-
- public Object createProxyBusiness(Object id)
- {
- throw new RuntimeException("NYI");
- }
-
- public void stop() throws Exception
- {
- Dispatcher.singleton.unregisterTarget(getTargetId());
- hatarget.destroy();
- drm.unregisterListener(proxyFamilyName, this);
- this.getContainer().getClusterFamilies().remove(proxyFamilyName);
- Util.unbind(getContainer().getInitialContext(), jndiName + PROXY_FACTORY_NAME);
- super.stop();
- }
-
- /**
- * @return unique name for this proxy factory
- */
- protected String getTargetId()
- {
- assert jndiName != null : "jndiName is null";
- String partition = ((SessionContainer) getContainer()).getPartitionName();
- return jndiName + PROXY_FACTORY_NAME + "@" + partition;
- }
-
- public synchronized void replicantsChanged (String key,
- List newReplicants,
- int newReplicantsViewId,
- boolean merge)
- {
- try
- {
- // Update the FamilyClusterInfo with the new targets
- ArrayList targets = new ArrayList(newReplicants);
- wrapper.get().updateClusterInfo(targets, newReplicantsViewId);
- }
- catch (Exception e)
- {
- log.error(e);
- }
- }
-}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulClusteredProxy.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulClusteredProxy.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulClusteredProxy.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,162 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.stateful;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import org.jboss.aop.Dispatcher;
-import org.jboss.aop.advice.Interceptor;
-import org.jboss.aop.util.MethodHashing;
-import org.jboss.aop.util.PayloadKey;
-import org.jboss.aspects.asynch.AsynchMixin;
-import org.jboss.aspects.asynch.AsynchProvider;
-import org.jboss.aspects.remoting.ClusterConstants;
-import org.jboss.aspects.remoting.FamilyWrapper;
-import org.jboss.aspects.remoting.InvokeRemoteInterceptor;
-import org.jboss.ejb3.Container;
-import org.jboss.ejb3.Ejb3Registry;
-import org.jboss.ejb3.JBossProxy;
-import org.jboss.ejb3.ProxyUtils;
-import org.jboss.ejb3.asynchronous.AsynchronousInterceptor;
-import org.jboss.ejb3.remoting.ClusteredIsLocalInterceptor;
-import org.jboss.ejb3.remoting.IsLocalInterceptor;
-import org.jboss.ha.client.loadbalance.LoadBalancePolicy;
-import org.jboss.util.id.GUID;
-
-/**
- * InvocationHandler for a clustered SFSB proxy.
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @author Brian Stansberry
- * @version $Revision$
- */
-public class StatefulClusteredProxy extends org.jboss.ejb3.remoting.BaseRemoteProxy
-{
- private static final long serialVersionUID = -1797802577940671292L;
-
- private Object id;
- protected FamilyWrapper family;
- protected LoadBalancePolicy lbPolicy;
- AsynchProvider provider;
- protected String partitionName;
-
-
- public StatefulClusteredProxy(Container container, Interceptor[] interceptors, FamilyWrapper family, LoadBalancePolicy lb, String partitionName)
- {
- super(container, interceptors);
- this.family = family;
- this.lbPolicy = lb;
- this.partitionName = partitionName;
- }
-
- public StatefulClusteredProxy(AsynchProvider provider, String containerId, String containerGuid, Interceptor[] interceptors, FamilyWrapper family, LoadBalancePolicy lb, String partitionName)
- {
- super(containerId, containerGuid, interceptors);
- this.provider = provider;
- this.family = family;
- this.lbPolicy = lb;
- this.partitionName = partitionName;
- }
-
- protected StatefulClusteredProxy()
- {
- }
-
- public Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable
- {
- if (method.getDeclaringClass() == AsynchProvider.class)
- {
- return provider.getFuture();
- }
-
- long hash = MethodHashing.calculateHash(method);
- Object ret = ProxyUtils.handleCallLocally(hash, (JBossProxy) proxy, this, method, args);
- if (ret != null)
- {
- return ret;
- }
-
- StatefulRemoteInvocation sri = new StatefulRemoteInvocation(interceptors, hash, method, method, null, id);
- sri.setArguments(args);
- sri.setInstanceResolver(metadata);
- sri.getMetaData().addMetaData(Dispatcher.DISPATCHER, Dispatcher.OID, containerId, PayloadKey.AS_IS);
- sri.getMetaData().addMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.CLUSTER_FAMILY_WRAPPER, family, PayloadKey.AS_IS);
- sri.getMetaData().addMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.LOADBALANCE_POLICY, lbPolicy, PayloadKey.AS_IS);
- sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.SUBSYSTEM, "AOP", PayloadKey.AS_IS);
- sri.getMetaData().addMetaData(ClusteredIsLocalInterceptor.PARTITION_NAME, ClusteredIsLocalInterceptor.PARTITION_NAME, partitionName, PayloadKey.TRANSIENT);
- sri.getMetaData().addMetaData(IsLocalInterceptor.IS_LOCAL, IsLocalInterceptor.GUID, containerGuid, PayloadKey.AS_IS);
-
- if (provider != null)
- {
- sri.getMetaData().addMetaData(AsynchronousInterceptor.ASYNCH, AsynchronousInterceptor.INVOKE_ASYNCH, "YES", PayloadKey.AS_IS);
- }
- try
- {
- Object rtn = sri.invokeNext();
- // if this is first invocation then container passes back actual ID
- if (id == null)
- {
- id = sri.getResponseAttachment(StatefulConstants.NEW_ID);
- }
- return rtn;
- }
- catch (ForwardId forward)
- {
- // if this is first invocation then container passes back actual ID
- // The ForwardId exception is needed if 1st operation throws an exception
- id = forward.getId();
- throw forward.getCause();
- }
- }
-
- public Object getAsynchronousProxy(Object proxy)
- {
- Class[] infs = proxy.getClass().getInterfaces();
- if (!ProxyUtils.isAsynchronous(infs))
- {
- Class[] interfaces = ProxyUtils.addAsynchProviderInterface(infs);
- AsynchMixin mixin = new AsynchMixin();
- Interceptor[] newInterceptors = ProxyUtils.addAsynchProxyInterceptor(mixin, interceptors);
- StatefulClusteredProxy handler = new StatefulClusteredProxy(mixin, containerId, containerGuid, newInterceptors, family, lbPolicy, partitionName);
- return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, handler);
- }
-
- //I was already asynchronous
- return proxy;
- }
-
- public String toString()
- {
- if (id != null)
- {
- return containerId.toString() + ":" + id.toString();
- }
- else
- {
- //If the proxy has not been used yet, create a temporary id
- GUID guid = new GUID();
- return containerId.toString() + ":" + guid.toString();
- }
- }
-
-}
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -41,7 +41,6 @@
import javax.ejb.NoSuchObjectLocalException;
import javax.ejb.PostActivate;
import javax.ejb.PrePassivate;
-import javax.ejb.Remote;
import javax.ejb.RemoteHome;
import javax.ejb.RemoveException;
import javax.ejb.TimerService;
@@ -58,9 +57,6 @@
import org.jboss.ejb3.BeanContext;
import org.jboss.ejb3.EJBContainerInvocation;
import org.jboss.ejb3.Ejb3Deployment;
-import org.jboss.ejb3.ProxyFactory;
-import org.jboss.ejb3.ProxyFactoryHelper;
-import org.jboss.ejb3.ProxyUtils;
import org.jboss.ejb3.annotation.Cache;
import org.jboss.ejb3.annotation.Clustered;
import org.jboss.ejb3.annotation.LocalBinding;
@@ -73,8 +69,16 @@
import org.jboss.ejb3.cache.StatefulObjectFactory;
import org.jboss.ejb3.interceptors.aop.InterceptorsFactory;
import org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor;
-import org.jboss.ejb3.proxy.EJBMetaDataImpl;
-import org.jboss.ejb3.proxy.handle.HomeHandleImpl;
+import org.jboss.ejb3.proxy.ProxyFactory;
+import org.jboss.ejb3.proxy.ProxyUtils;
+import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
+import org.jboss.ejb3.proxy.factory.SessionProxyFactory;
+import org.jboss.ejb3.proxy.factory.stateful.BaseStatefulRemoteProxyFactory;
+import org.jboss.ejb3.proxy.factory.stateful.StatefulClusterProxyFactory;
+import org.jboss.ejb3.proxy.factory.stateful.StatefulProxyFactory;
+import org.jboss.ejb3.proxy.factory.stateful.StatefulRemoteProxyFactory;
+import org.jboss.ejb3.proxy.impl.EJBMetaDataImpl;
+import org.jboss.ejb3.proxy.impl.HomeHandleImpl;
import org.jboss.ejb3.session.SessionContainer;
import org.jboss.ejb3.session.SessionSpecContainer;
import org.jboss.injection.Injector;
@@ -136,42 +140,42 @@
return factory;
}
- public Object createProxyLocalEjb21(Object id, LocalBinding binding) throws Exception
+ public Object createProxyLocalEjb21(Object id, LocalBinding binding, String businessInterfaceType) throws Exception
{
StatefulLocalProxyFactory proxyFactory = this.getProxyFactory(binding);
- return proxyFactory.createProxyEjb21(id);
+ return proxyFactory.createProxyEjb21(id,businessInterfaceType);
}
- public Object createProxyRemoteEjb21(Object id) throws Exception
+ public Object createProxyRemoteEjb21(Object id, String businessInterfaceType) throws Exception
{
RemoteBinding binding = this.getRemoteBinding();
- return this.createProxyRemoteEjb21(id,binding);
+ return this.createProxyRemoteEjb21(id,binding, businessInterfaceType);
}
- public Object createProxyRemoteEjb21(Object id, RemoteBinding binding) throws Exception
+ public Object createProxyRemoteEjb21(Object id, RemoteBinding binding, String businessInterfaceType) throws Exception
{
BaseStatefulRemoteProxyFactory proxyFactory = this.getProxyFactory(binding);
- return proxyFactory.createProxyEjb21(id);
+ return proxyFactory.createProxyEjb21(id, businessInterfaceType);
}
- public Object createProxyLocalEjb21(Object id) throws Exception
+ public Object createProxyLocalEjb21(Object id, String businessInterfaceType) throws Exception
{
LocalBinding binding = this.getAnnotation(LocalBinding.class);
- return this.createProxyLocalEjb21(id,binding);
+ return this.createProxyLocalEjb21(id,binding, businessInterfaceType);
}
@Override
- public Object createProxyLocalEjb21(LocalBinding binding) throws Exception
+ public Object createProxyLocalEjb21(LocalBinding binding, String businessInterfaceType) throws Exception
{
Object id = this.createSession();
- return this.createProxyLocalEjb21(id,binding);
+ return this.createProxyLocalEjb21(id,binding, businessInterfaceType);
}
@Override
- public Object createProxyRemoteEjb21(RemoteBinding binding) throws Exception
+ public Object createProxyRemoteEjb21(RemoteBinding binding, String businessInterfaceType) throws Exception
{
Object id = this.createSession();
- return this.createProxyRemoteEjb21(id, binding);
+ return this.createProxyRemoteEjb21(id, binding, businessInterfaceType);
}
@Override
@@ -796,7 +800,7 @@
factory.init();
Object proxy = factory.createProxyEjb21(initParameterTypes,
- initParameterValues);
+ initParameterValues, unadvisedMethod.getReturnType().getName());
return proxy;
}
@@ -831,7 +835,7 @@
factory.init();
if (id != null)
- return factory.createProxyBusiness(id);
+ return factory.createProxyBusiness(id,null);
else
return factory.createProxyBusiness();
}
@@ -872,10 +876,11 @@
factory.init();
Object proxy = null;
+ String businessInterfaceType = unadvisedMethod.getReturnType().getName();
if (newStatefulInvocation.getId() != null)
- proxy = factory.createProxyEjb21(newStatefulInvocation.getId());
+ proxy = factory.createProxyEjb21(newStatefulInvocation.getId(), businessInterfaceType);
else
- proxy = factory.createProxyEjb21();
+ proxy = factory.createProxyEjb21(businessInterfaceType);
InvocationResponse response = marshallResponse(statefulInvocation, proxy, newStatefulInvocation.getResponseContextInfo());
if (newStatefulInvocation.getId() != null)
@@ -935,7 +940,52 @@
return null;
}
}
+
+ /**
+ * Provides implementation for this bean's EJB 2.1 Home.create() method
+ *
+ * @param factory
+ * @param unadvisedMethod
+ * @param args
+ * @return
+ * @throws Exception
+ */
+ @Override
+ protected Object invokeHomeCreate(SessionProxyFactory factory, Method unadvisedMethod, Object args[])
+ throws Exception
+ {
+
+ // Cast
+ String errorMessage = "Specified factory " + factory.getClass().getName() + " is not of type "
+ + StatefulProxyFactory.class.getName() + " as required by " + StatefulContainer.class.getName();
+ assert factory instanceof StatefulProxyFactory : errorMessage;
+ StatefulProxyFactory statefulFactory = null;
+ try
+ {
+ statefulFactory = (StatefulProxyFactory) factory;
+ }
+ catch (ClassCastException cce)
+ {
+ throw new ClassCastException(errorMessage);
+ }
+
+ Class<?>[] initParameterTypes =
+ {};
+ Object[] initParameterValues =
+ {};
+ if (unadvisedMethod.getParameterTypes().length > 0)
+ {
+ initParameterTypes = unadvisedMethod.getParameterTypes();
+ initParameterValues = args;
+ }
+ Object id = createSession(initParameterTypes, initParameterValues);
+
+ Object proxy = statefulFactory.createProxyBusiness(id, unadvisedMethod.getReturnType().getName());
+
+ return proxy;
+ }
+
protected InvocationResponse invokeEJBObjectMethod(MethodInfo info,
StatefulRemoteInvocation statefulInvocation) throws Throwable
{
@@ -947,7 +997,7 @@
ProxyFactory proxyFactory = this.getProxyFactory(this.getAnnotation(RemoteBinding.class));
BaseStatefulRemoteProxyFactory statefulRemoteProxyFactory = (BaseStatefulRemoteProxyFactory) proxyFactory;
- EJBObject proxy = (EJBObject) statefulRemoteProxyFactory.createProxyEjb21(newStatefulInvocation.getId());
+ EJBObject proxy = (EJBObject) statefulRemoteProxyFactory.createProxyEjb21(newStatefulInvocation.getId(), null);
StatefulHandleRemoteImpl handle = new StatefulHandleRemoteImpl(proxy);
InvocationResponse response = marshallResponse(statefulInvocation, handle, null);
return response;
@@ -1093,11 +1143,11 @@
{
if (isRemote && factory instanceof StatefulRemoteProxyFactory)
{
- return ((StatefulRemoteProxyFactory) factory).createProxyBusiness(ctx.getId());
+ return ((StatefulRemoteProxyFactory) factory).createProxyBusiness(ctx.getId(),null);
}
else if (!isRemote && factory instanceof StatefulLocalProxyFactory)
{
- return ((StatefulLocalProxyFactory) factory).createProxyBusiness(ctx.getId());
+ return ((StatefulLocalProxyFactory) factory).createProxyBusiness(ctx.getId(),null);
}
}
throw new IllegalStateException("Unable to create proxy for getBusinessObject as a proxy factory was not found");
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulHomeRemoteProxy.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulHomeRemoteProxy.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulHomeRemoteProxy.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,138 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.stateful;
-
-import java.lang.reflect.Method;
-
-import javax.ejb.EJBMetaData;
-import javax.ejb.HomeHandle;
-
-import org.jboss.aop.Dispatcher;
-import org.jboss.aop.advice.Interceptor;
-import org.jboss.aop.util.MethodHashing;
-import org.jboss.aop.util.PayloadKey;
-import org.jboss.aspects.remoting.InvokeRemoteInterceptor;
-import org.jboss.ejb3.Container;
-import org.jboss.ejb3.ProxyUtils;
-import org.jboss.ejb3.remoting.IsLocalInterceptor;
-import org.jboss.logging.Logger;
-import org.jboss.remoting.InvokerLocator;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public class StatefulHomeRemoteProxy extends org.jboss.ejb3.session.BaseSessionRemoteProxy
-{
- private static final long serialVersionUID = 5509794838403316545L;
-
- private static final Logger log = Logger.getLogger(StatefulHomeRemoteProxy.class);
-
- protected InvokerLocator uri;
- private HomeHandle homeHandle;
- private EJBMetaData ejbMetaData;
-
- public StatefulHomeRemoteProxy(Container container, Interceptor[] interceptors, InvokerLocator uri)
- {
- super(container, interceptors);
- this.uri = uri;
- }
-
- public StatefulHomeRemoteProxy(Container container, Interceptor[] interceptors, InvokerLocator uri, Object id)
- {
- super(container, interceptors);
- this.uri = uri;
- this.id = id;
- }
-
- protected StatefulHomeRemoteProxy()
- {
- }
-
- public void setHandle(StatefulHandleRemoteImpl handle)
- {
- this.handle = handle;
- }
-
- public void setHomeHandle(HomeHandle homeHandle)
- {
- this.homeHandle = homeHandle;
- }
-
- public void setEjbMetaData(EJBMetaData ejbMetaData)
- {
- this.ejbMetaData = ejbMetaData;
- }
-
- public Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable
- {
- long hash = MethodHashing.calculateHash(method);
- Object ret = ProxyUtils.handleCallLocally(hash, proxy, this, method, args);
- if (ret != null)
- {
- return ret;
- }
-
- ret = handleEjb21CallLocally(method, args);
- if (ret != null)
- {
- return ret;
- }
-
- StatefulRemoteInvocation sri = new StatefulRemoteInvocation(interceptors, hash, method, method, null, null);
- sri.setArguments(args);
- sri.setInstanceResolver(metadata);
- sri.getMetaData().addMetaData(Dispatcher.DISPATCHER, Dispatcher.OID, containerId, PayloadKey.AS_IS);
- sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.INVOKER_LOCATOR, uri, PayloadKey.AS_IS);
- sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.SUBSYSTEM, "AOP", PayloadKey.AS_IS);
- sri.getMetaData().addMetaData(IsLocalInterceptor.IS_LOCAL, IsLocalInterceptor.GUID, containerGuid, PayloadKey.AS_IS);
-
- return sri.invokeNext();
- }
-
- public Object getAsynchronousProxy(Object proxy)
- {
- throw new RuntimeException("NOT IMPLEMENTED");
- }
-
- public String toString()
- {
- return containerId.toString() + ":Home";
- }
-
- private Object handleEjb21CallLocally(Method method, Object[] args)
- {
- if (method.equals(ProxyUtils.GET_HOME_HANDLE))
- {
- return homeHandle;
- }
- else if (method.equals(ProxyUtils.GET_EJB_METADATA))
- {
- return ejbMetaData;
- }
-
- return null;
- }
-}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulLocalHomeProxy.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulLocalHomeProxy.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulLocalHomeProxy.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,66 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.stateful;
-
-import java.lang.reflect.Method;
-import org.jboss.ejb3.Container;
-import org.jboss.ejb3.LocalProxy;
-import org.jboss.ejb3.session.SessionContainer;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public class StatefulLocalHomeProxy extends LocalProxy
-{
- private static final long serialVersionUID = -9026021347498876589L;
-
- public StatefulLocalHomeProxy()
- {
- super();
- }
-
- public StatefulLocalHomeProxy(Container container)
- {
- super(container);
- }
-
- public Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable
- {
- SessionContainer sfsb = (SessionContainer) getContainer();
- return sfsb.localHomeInvoke(method, args);
- }
-
- public Object getAsynchronousProxy(Object proxy)
- {
- throw new RuntimeException("NOT AVAILABLE FOR HOME PROXIES");
- }
-
- public String toString()
- {
- return proxyName + ": Home Proxy";
- }
-
-}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulLocalProxy.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulLocalProxy.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulLocalProxy.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,147 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.stateful;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.io.Externalizable;
-import java.io.ObjectInput;
-import java.io.IOException;
-import java.io.ObjectOutput;
-import java.rmi.dgc.VMID;
-
-import javax.ejb.EJBException;
-
-import org.jboss.aspects.asynch.AsynchMixin;
-import org.jboss.aspects.asynch.AsynchProvider;
-import org.jboss.aspects.asynch.FutureHolder;
-import org.jboss.ejb3.Container;
-import org.jboss.ejb3.Ejb3Registry;
-import org.jboss.ejb3.LocalProxy;
-import org.jboss.ejb3.ProxyUtils;
-import org.jboss.ejb3.session.SessionContainer;
-import org.jboss.util.id.GUID;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public class StatefulLocalProxy extends LocalProxy
-{
- private static final long serialVersionUID = 206913210970415540L;
-
- protected Object id;
- AsynchProvider provider;
-
- protected boolean isClustered = false;
-
- public StatefulLocalProxy(Container container, Object id, VMID vmid)
- {
- super(container);
- this.id = id;
- this.containerGuid = Ejb3Registry.guid(container, vmid);
- isClustered = ((SessionContainer)container).isClustered();
- }
-
- public StatefulLocalProxy(AsynchProvider provider, Container container, Object id)
- {
- super(container);
- this.provider = provider;
- this.id = id;
- this.containerGuid = Ejb3Registry.guid(container);
- isClustered = ((SessionContainer)container).isClustered();
- }
-
- public StatefulLocalProxy()
- {
- }
-
- //@Override
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- {
- super.readExternal(in);
- id = in.readObject();
- isClustered = in.readBoolean();
- }
-
- //@Override
- public void writeExternal(ObjectOutput out) throws IOException
- {
- super.writeExternal(out);
- out.writeObject(id);
- out.writeBoolean(isClustered);
- }
-
- public Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable
- {
- if (method.getDeclaringClass() == AsynchProvider.class)
- {
- return provider.getFuture();
- }
-
- // Make sure we get the cache id before getting the asynchronous interface
- Object ret = ProxyUtils.handleCallLocally(proxy, this, method, args);
- if (ret != null)
- {
- return ret;
- }
-
- Container container = Ejb3Registry.findContainer(containerGuid);
- if (isClustered && container == null && Ejb3Registry.hasClusterContainer(containerClusterUid))
- container = Ejb3Registry.getClusterContainer(containerClusterUid);
-
- if (container == null)
- throw new EJBException("Invalid (i.e. remote) invocation of local interface (null container) for " + containerGuid);
-
- SessionContainer sfsb = (SessionContainer)container;
- return sfsb.localInvoke(id, method, args, (FutureHolder) provider);
- }
-
- public Object getAsynchronousProxy(Object proxy)
- {
- Class[] infs = proxy.getClass().getInterfaces();
- if (!ProxyUtils.isAsynchronous(infs))
- {
- Class[] interfaces = ProxyUtils.addAsynchProviderInterface(infs);
- AsynchMixin mixin = new AsynchMixin();
- StatefulLocalProxy handler = new StatefulLocalProxy(mixin, getContainer(), id);
- return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, handler);
- }
-
- //I was already asynchronous
- return proxy;
- }
-
- public String toString()
- {
- if (getContainer() != null && id != null)
- {
- return getContainer().getEjbName().toString() + ":" + id.toString();
- }
-
- return proxyName;
- }
-
-}
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulLocalProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulLocalProxyFactory.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulLocalProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -31,9 +31,12 @@
import javax.naming.NamingException;
import org.jboss.ejb3.Ejb3Registry;
-import org.jboss.ejb3.ProxyFactoryHelper;
import org.jboss.ejb3.SpecificationInterfaceType;
import org.jboss.ejb3.annotation.LocalBinding;
+import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
+import org.jboss.ejb3.proxy.factory.stateful.BaseStatefulProxyFactory;
+import org.jboss.ejb3.proxy.handler.stateful.StatefulLocalHomeProxyInvocationHandler;
+import org.jboss.ejb3.proxy.handler.stateful.StatefulLocalProxyInvocationHandler;
import org.jboss.ejb3.session.ProxyAccessType;
import org.jboss.ejb3.session.SessionContainer;
import org.jboss.ejb3.session.SessionSpecContainer;
@@ -135,7 +138,7 @@
Class<?>[] interfaces =
{localHome.value()};
Object homeProxy = java.lang.reflect.Proxy.newProxyInstance(statefulContainer.getBeanClass().getClassLoader(),
- interfaces, new StatefulLocalHomeProxy(statefulContainer));
+ interfaces, new StatefulLocalHomeProxyInvocationHandler(statefulContainer));
Util.rebind(statefulContainer.getInitialContext(), ProxyFactoryHelper.getLocalHomeJndiName(statefulContainer),
homeProxy);
}
@@ -159,42 +162,54 @@
Object id = sfsb.createSession();
return this.createProxyBusiness(id);
}
-
- public EJBLocalObject createProxyEjb21()
+
+ public EJBLocalObject createProxyEjb21(String businessInterfaceType)
{
Object id = getContainer().createSession();
- return this.createProxyEjb21(id);
+ return this.createProxyEjb21(id, businessInterfaceType);
}
+
+ public Object createProxyBusiness(String businessInterfaceType)
+ {
+ return this.createProxyBusiness(null, businessInterfaceType);
+ }
public Object createProxyBusiness(Object id)
{
- return this.createProxy(id, SpecificationInterfaceType.EJB30_BUSINESS);
+ return this.createProxyBusiness(id, null);
}
+ public Object createProxyBusiness(Object id, String businessInterfaceType)
+ {
+ return this.createProxy(id, SpecificationInterfaceType.EJB30_BUSINESS, businessInterfaceType);
+ }
+
@SuppressWarnings("unchecked")
- public <T extends EJBLocalObject> T createProxyEjb21(Object id)
+ public <T extends EJBLocalObject> T createProxyEjb21(Object id, String businessInterfaceType)
{
- return (T)this.createProxy(id, SpecificationInterfaceType.EJB21);
+ return (T) this.createProxy(id, SpecificationInterfaceType.EJB21, null);
}
- private Object createProxy(Object id, SpecificationInterfaceType type)
+ private Object createProxy(Object id, SpecificationInterfaceType type, String businessInterfaceType)
{
- StatefulLocalProxy proxy = new StatefulLocalProxy(this.getContainer(), id, vmid);
+ StatefulLocalProxyInvocationHandler proxy = new StatefulLocalProxyInvocationHandler(this.getContainer(), id,
+ vmid, businessInterfaceType);
return type.equals(SpecificationInterfaceType.EJB30_BUSINESS) ? this.constructProxyBusiness(proxy) : this
.constructEjb21Proxy(proxy);
}
-
+
public Object createProxy(Class<?>[] initTypes, Object[] initValues)
{
SessionContainer sfsb = (SessionContainer) getContainer();
Object id = sfsb.createSession(initTypes, initValues);
- return this.createProxy(id, SpecificationInterfaceType.EJB30_BUSINESS);
+ return this.createProxy(id, SpecificationInterfaceType.EJB30_BUSINESS, null);
}
-
- public Object createProxyEjb21(Class<?>[] initTypes, Object[] initValues){
+
+ public Object createProxyEjb21(Class<?>[] initTypes, Object[] initValues, String businessInterfaceType)
+ {
SessionContainer sfsb = (SessionContainer) getContainer();
Object id = sfsb.createSession(initTypes, initValues);
- return this.createProxy(id, SpecificationInterfaceType.EJB21);
+ return this.createProxyEjb21(id, businessInterfaceType);
}
protected StatefulHandleImpl createHandle()
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulRemoteProxy.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulRemoteProxy.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulRemoteProxy.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,195 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.stateful;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-
-import javax.ejb.EJBMetaData;
-import javax.ejb.Handle;
-import javax.ejb.HomeHandle;
-
-import org.jboss.aop.Dispatcher;
-import org.jboss.aop.advice.Interceptor;
-import org.jboss.aop.util.MethodHashing;
-import org.jboss.aop.util.PayloadKey;
-import org.jboss.aspects.asynch.AsynchMixin;
-import org.jboss.aspects.asynch.AsynchProvider;
-import org.jboss.aspects.remoting.InvokeRemoteInterceptor;
-import org.jboss.ejb3.Container;
-import org.jboss.ejb3.ProxyUtils;
-import org.jboss.ejb3.asynchronous.AsynchronousInterceptor;
-import org.jboss.ejb3.remoting.IsLocalInterceptor;
-import org.jboss.logging.Logger;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.util.id.GUID;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public class StatefulRemoteProxy extends org.jboss.ejb3.session.BaseSessionRemoteProxy
-{
- private static final long serialVersionUID = -2164496320326661428L;
-
- private static final Logger log = Logger.getLogger(StatefulRemoteProxy.class);
-
- protected InvokerLocator uri;
- AsynchProvider provider;
-
- private Handle handle;
- private HomeHandle homeHandle;
- private EJBMetaData ejbMetaData;
-
- public StatefulRemoteProxy(Container container, Interceptor[] interceptors, InvokerLocator uri, Object id)
- {
- super(container, interceptors);
- this.uri = uri;
- this.id = id;
- }
-
- public StatefulRemoteProxy(AsynchProvider provider, String containerId, String containerGuid, Interceptor[] interceptors, InvokerLocator uri)
- {
- super(containerId, containerGuid, interceptors);
- this.uri = uri;
- this.provider = provider;
- }
-
- protected StatefulRemoteProxy()
- {
- }
-
- public void setHandle(StatefulHandleRemoteImpl handle)
- {
- this.handle = handle;
- }
-
- public void setHomeHandle(HomeHandle homeHandle)
- {
- this.homeHandle = homeHandle;
- }
-
- public void setEjbMetaData(EJBMetaData ejbMetaData)
- {
- this.ejbMetaData = ejbMetaData;
- }
-
- public Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable
- {
- if (method.getDeclaringClass() == AsynchProvider.class)
- {
- return provider.getFuture();
- }
-
- long hash = MethodHashing.calculateHash(method);
- Object ret = ProxyUtils.handleCallLocally(hash, proxy, this, method, args);
- if (ret != null)
- {
- return ret;
- }
-
- ret = handleEjb21CallLocally(method, args);
- if (ret != null)
- {
- return ret;
- }
-
- StatefulRemoteInvocation sri = new StatefulRemoteInvocation(interceptors, hash, method, method, null, id);
- sri.setArguments(args);
- sri.setInstanceResolver(metadata);
- sri.getMetaData().addMetaData(Dispatcher.DISPATCHER, Dispatcher.OID, containerId, PayloadKey.AS_IS);
- sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.INVOKER_LOCATOR, uri, PayloadKey.AS_IS);
- sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.SUBSYSTEM, "AOP", PayloadKey.AS_IS);
- sri.getMetaData().addMetaData(IsLocalInterceptor.IS_LOCAL, IsLocalInterceptor.GUID, containerGuid, PayloadKey.AS_IS);
-
- if (provider != null)
- {
- sri.getMetaData().addMetaData(AsynchronousInterceptor.ASYNCH, AsynchronousInterceptor.INVOKE_ASYNCH, "YES", PayloadKey.AS_IS);
- }
- try
- {
- Object rtn = sri.invokeNext();
- // if this is first invocation then container passes back actual ID
- if (id == null)
- {
- id = sri.getResponseAttachment(StatefulConstants.NEW_ID);
- }
- return rtn;
- }
- catch (ForwardId forward)
- {
- // if this is first invocation then container passes back actual ID
- // The ForwardId exception is needed if 1st operation throws an exception
- id = forward.getId();
- throw forward.getCause();
- }
- }
-
- public Object getAsynchronousProxy(Object proxy)
- {
- Class<?>[] infs = proxy.getClass().getInterfaces();
- if (!ProxyUtils.isAsynchronous(infs))
- {
- Class<?>[] interfaces = ProxyUtils.addAsynchProviderInterface(infs);
- AsynchMixin mixin = new AsynchMixin();
- Interceptor[] newInterceptors = ProxyUtils.addAsynchProxyInterceptor(mixin, interceptors);
- StatefulRemoteProxy handler = new StatefulRemoteProxy(mixin, containerId, containerGuid, newInterceptors, uri);
- return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, handler);
- }
-
- //I was already asynchronous
- return proxy;
- }
-
- public String toString()
- {
- if (id != null)
- {
- return containerId.toString() + ":" + id.toString();
- }
- else
- {
- //If the proxy has not been used yet, create a temporary id
- GUID guid = new GUID();
- return containerId.toString() + ":" + guid.toString();
- }
- }
-
- private Object handleEjb21CallLocally(Method method, Object[] args)
- {
- if (method.equals(ProxyUtils.GET_HOME_HANDLE))
- {
- return homeHandle;
- } else if (method.equals(ProxyUtils.GET_EJB_METADATA))
- {
- return ejbMetaData;
- } else if (method.equals(ProxyUtils.GET_HANDLE))
- {
- return handle;
- }
-
- return null;
- }
-}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulRemoteProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulRemoteProxyFactory.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulRemoteProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,183 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.stateful;
-
-import java.lang.reflect.Proxy;
-
-import javax.ejb.RemoteHome;
-import javax.naming.NamingException;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.aop.Dispatcher;
-import org.jboss.aop.advice.AdviceStack;
-import org.jboss.aop.advice.Interceptor;
-import org.jboss.aspects.remoting.InvokeRemoteInterceptor;
-import org.jboss.aspects.remoting.PojiProxy;
-import org.jboss.ejb3.ProxyFactory;
-import org.jboss.ejb3.ProxyFactoryHelper;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.remoting.IsLocalProxyFactoryInterceptor;
-import org.jboss.ejb3.remoting.RemoteProxyFactory;
-import org.jboss.ejb3.session.BaseSessionRemoteProxy;
-import org.jboss.ejb3.session.SessionContainer;
-import org.jboss.ejb3.session.SessionSpecContainer;
-import org.jboss.logging.Logger;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.util.naming.Util;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @author Brian Stansberry
- *
- * @version $Revision$
- */
-public class StatefulRemoteProxyFactory extends BaseStatefulRemoteProxyFactory implements RemoteProxyFactory
-{
- private static final Logger log = Logger.getLogger(StatefulRemoteProxyFactory.class);
-
- private static final String STACK_NAME_STATEFUL_SESSION_CLIENT_INTERCEPTORS = "StatefulSessionClientInterceptors";
-
- public StatefulRemoteProxyFactory(SessionSpecContainer container, RemoteBinding binding)
- {
- super(container, binding);
- }
-
- @Override
- public void start() throws Exception
- {
- super.start();
- Class<?>[] interfaces = {ProxyFactory.class};
- String targetId = getTargetId();
- String clientBindUrl = ProxyFactoryHelper.getClientBindUrl(this.getBinding());
- Object factoryProxy = createPojiProxy(targetId, interfaces, clientBindUrl);
- log.debug("Binding proxy factory for " + getContainer().getEjbName() + " in JNDI at " + jndiName + PROXY_FACTORY_NAME + " with client bind url " + clientBindUrl);
- try
- {
- Util.rebind(getContainer().getInitialContext(), jndiName + PROXY_FACTORY_NAME, factoryProxy);
- }
- catch (NamingException e)
- {
- NamingException namingException = new NamingException("Could not bind stateful remote proxy with ejb name " + getContainer().getEjbName() + " into JNDI under jndiName: " + getContainer().getInitialContext().getNameInNamespace() + "/" + jndiName + PROXY_FACTORY_NAME);
- namingException.setRootCause(e);
- throw namingException;
- }
- assert !Dispatcher.singleton.isRegistered(targetId) : targetId + " is already registered";
- Dispatcher.singleton.registerTarget(targetId, this);
-
- SessionSpecContainer statefulContainer = this.getContainer();
- RemoteHome remoteHome = statefulContainer.getAnnotation(RemoteHome.class);
- if (remoteHome != null && !bindHomeAndBusinessTogether())
- {
- Object homeProxy = createHomeProxy(remoteHome.value());
- String homeJndiName = ProxyFactoryHelper.getHomeJndiName(statefulContainer);
- log.debug("Binding home proxy at " + homeJndiName);
- Util.rebind(this.getContainer().getInitialContext(), homeJndiName, homeProxy);
- }
- }
-
- @Override
- public void stop() throws Exception
- {
- Util.unbind(getContainer().getInitialContext(), jndiName + PROXY_FACTORY_NAME);
- Dispatcher.singleton.unregisterTarget(getTargetId());
-
- SessionContainer statefulContainer = this.getContainer();
- RemoteHome remoteHome = statefulContainer.getAnnotation(RemoteHome.class);
- if (remoteHome != null && !bindHomeAndBusinessTogether())
- {
- Util.unbind(this.getContainer().getInitialContext(), ProxyFactoryHelper.getHomeJndiName(getContainer()));
- }
- super.stop();
- }
-
- public Object createHomeProxy(Class<?> homeInterface)
- {
- try
- {
- String stackName = StatefulRemoteProxyFactory.STACK_NAME_STATEFUL_SESSION_CLIENT_INTERCEPTORS;
- RemoteBinding binding = this.getBinding();
- if (binding.interceptorStack() != null && !binding.interceptorStack().trim().equals(""))
- {
- stackName = binding.interceptorStack();
- }
- AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
- if (stack == null) throw new RuntimeException("unable to find interceptor stack: " + stackName);
- StatefulHomeRemoteProxy proxy = new StatefulHomeRemoteProxy(getContainer(), stack.createInterceptors(
- getContainer().getAdvisor(), null), this.getLocator());
-
- setEjb21Objects(proxy);
- Class<?>[] intfs = {homeInterface};
- return java.lang.reflect.Proxy.newProxyInstance(getContainer().getBeanClass().getClassLoader(), intfs, proxy);
- }
- catch (IllegalArgumentException e)
- {
- throw new RuntimeException(e);
- }
- }
-
- @Override
- protected void setEjb21Objects(BaseSessionRemoteProxy proxy)
- {
- proxy.setHandle(this.createHandle());
- proxy.setHomeHandle(getHomeHandle());
- proxy.setEjbMetaData(getEjbMetaData());
- }
-
- /**
- * Returns the interface type for Home
- *
- * @return
- */
- @Override
- protected Class<?> getHomeType()
- {
- return ProxyFactoryHelper.getRemoteHomeInterface(this.getContainer());
- }
-
- @Override
- String getStackNameInterceptors()
- {
- return StatefulRemoteProxyFactory.STACK_NAME_STATEFUL_SESSION_CLIENT_INTERCEPTORS;
- }
-
- /**
- * @return unique name for this proxy factory
- */
- protected String getTargetId()
- {
- assert jndiName != null : "jndiName is null";
- return jndiName + PROXY_FACTORY_NAME;
- }
-
- protected Object createPojiProxy(Object oid, Class<?>[] interfaces, String uri) throws Exception
- {
- InvokerLocator locator = new InvokerLocator(uri);
- Interceptor[] interceptors = {IsLocalProxyFactoryInterceptor.singleton, InvokeRemoteInterceptor.singleton};
- PojiProxy proxy = new PojiProxy(oid, locator, interceptors);
- return Proxy.newProxyInstance(interfaces[0].getClassLoader(), interfaces, proxy);
-
- }
-
-
-}
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulSessionContextDelegate.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulSessionContextDelegate.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulSessionContextDelegate.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -41,7 +41,7 @@
{
super(beanContext);
}
-
+
@Override
public EJBLocalObject getEJBLocalObject() throws IllegalStateException
{
@@ -51,7 +51,7 @@
EJBLocalObject proxy = null;
try
{
- proxy = (EJBLocalObject) container.createProxyLocalEjb21(id);
+ proxy = (EJBLocalObject) container.createProxyLocalEjb21(id, null);
}
// Proxy does not implement EJBLocalObject
catch (ClassCastException cce)
@@ -70,7 +70,7 @@
throw new IllegalStateException(e);
}
}
-
+
@Override
public EJBObject getEJBObject() throws IllegalStateException
{
@@ -80,7 +80,7 @@
EJBObject proxy = null;
try
{
- proxy = (EJBObject) container.createProxyRemoteEjb21(id);
+ proxy = (EJBObject) container.createProxyRemoteEjb21(id, null);
}
// Proxy does not implement EJBObject
catch (ClassCastException cce)
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/BaseStatelessProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/BaseStatelessProxyFactory.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/BaseStatelessProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,146 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.stateless;
-
-import org.jboss.ejb3.ProxyFactory;
-import org.jboss.ejb3.session.ProxyAccessType;
-import org.jboss.ejb3.session.SessionSpecContainer;
-import org.jboss.logging.Logger;
-import org.jboss.util.naming.Util;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public abstract class BaseStatelessProxyFactory extends org.jboss.ejb3.session.BaseSessionProxyFactory implements ProxyFactory
-{
- private static final Logger log = Logger.getLogger(BaseStatelessProxyFactory.class);
-
- public BaseStatelessProxyFactory(SessionSpecContainer container, String jndiName)
- {
- super(container);
-
- assert jndiName != null : "jndiName is null";
-
- this.jndiName = jndiName;
- }
-
- /**
- * Adapt the JDK to cglib.
- *
- * This is a named class because it implements both InvocationHandler and Serializable.
- */
- /* TODO: fix EJBTHREE-485 without cglib
- private static class CGLibInvocationHandlerAdapter implements net.sf.cglib.proxy.InvocationHandler, Serializable
- {
- private static final long serialVersionUID = 1L;
-
- private InvocationHandler delegate;
-
- private CGLibInvocationHandlerAdapter(InvocationHandler delegate)
- {
- if(delegate == null)
- throw new IllegalArgumentException("delegate must not be null");
- this.delegate = delegate;
- }
-
- public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
- {
- return delegate.invoke(proxy, method, args);
- }
-
- }
- */
-
-// /**
-// * Adapt the InvocationHandler to MethodHandler.
-// *
-// * This is a named class because it implements both MethodHandler and Serializable.
-// */
-// private static class MethodHandlerAdapter implements MethodHandler, Serializable
-// {
-// private static final long serialVersionUID = 1L;
-//
-// private InvocationHandler delegate;
-//
-// private MethodHandlerAdapter(InvocationHandler delegate)
-// {
-// if(delegate == null)
-// throw new IllegalArgumentException("delegate must not be null");
-// this.delegate = delegate;
-// }
-//
-// public Object invoke(Object self, Method thisMethod, Method process, Object[] args) throws Throwable
-// {
-// return delegate.invoke(self, thisMethod, args);
-// }
-// }
-
-
- public final Object createProxyBusiness(Object id)
- {
- assert id == null : "stateless bean must not have an id";
- return createProxyBusiness();
- }
-
- public void init() throws Exception
- {
- this.createProxyConstructors();
- this.validateEjb21Views();
- }
-
- /* for debugging purposes * /
- private static void describeClass(Class cls) {
- System.err.println("class " + cls + " has the following:");
- for(Class i : cls.getInterfaces()) {
- System.err.println(" interface: " + i);
- }
- for(Method m : cls.getDeclaredMethods()) {
- System.err.println(" method: " + m);
- }
- System.err.println(" classloader = " + cls.getClassLoader());
- if(cls.getSuperclass() != null)
- describeClass(cls.getSuperclass());
- }
- */
-
- public void start() throws Exception
- {
- init();
-
- Object proxy = createProxyBusiness();
- //describeClass(proxy.getClass());
- bindProxy(proxy);
- }
-
- public void stop() throws Exception
- {
- Util.unbind(getContainer().getInitialContext(), jndiName);
- }
-
- protected abstract void validateEjb21Views();
-
- protected abstract ProxyAccessType getProxyAccessType();
-
-}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/BaseStatelessRemoteProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/BaseStatelessRemoteProxyFactory.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/BaseStatelessRemoteProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,134 +0,0 @@
-package org.jboss.ejb3.stateless;
-
-import javax.ejb.EJBObject;
-import javax.ejb.RemoteHome;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.aop.advice.AdviceStack;
-import org.jboss.ejb3.ProxyFactoryHelper;
-import org.jboss.ejb3.SpecificationInterfaceType;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.remoting.RemoteProxyFactory;
-import org.jboss.ejb3.session.ProxyAccessType;
-import org.jboss.ejb3.session.SessionContainer;
-import org.jboss.ejb3.session.SessionSpecContainer;
-import org.jboss.remoting.InvokerLocator;
-
-public abstract class BaseStatelessRemoteProxyFactory extends BaseStatelessProxyFactory implements RemoteProxyFactory
-{
-
- // Instance Members
-
- private RemoteBinding binding;
-
- private InvokerLocator locator;
-
- // Constructor
- public BaseStatelessRemoteProxyFactory(SessionSpecContainer container, RemoteBinding binding)
- {
- super(container, binding.jndiBinding());
-
- this.binding = binding;
-
- try
- {
- String clientBindUrl = ProxyFactoryHelper.getClientBindUrl(this.getBinding());
- this.locator = new InvokerLocator(clientBindUrl);
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- }
-
- // Required Implementations
-
- @Override
- protected final ProxyAccessType getProxyAccessType()
- {
- return ProxyAccessType.REMOTE;
- }
-
- @Override
- protected final void validateEjb21Views()
- {
- // Obtain Container
- SessionContainer container = this.getContainer();
-
- // Obtain @RemoteHome
- RemoteHome remoteHome = container.getAnnotation(RemoteHome.class);
-
- // Ensure that if EJB 2.1 Components are defined, they're complete
- this.validateEjb21Views(remoteHome == null ? null : remoteHome.value(), ProxyFactoryHelper
- .getRemoteInterfaces(container));
- }
-
- // Specifications
-
- abstract String getStackNameInterceptors();
-
- // Functional Methods
-
- protected boolean bindHomeAndEjb21ViewTogether(SessionContainer container)
- {
- String homeJndiName = ProxyFactoryHelper.getHomeJndiName(container);
- String remoteBusinessJndiName = ProxyFactoryHelper.getRemoteBusinessJndiName(container);
- return homeJndiName.equals(remoteBusinessJndiName);
- }
-
- public Object createProxyBusiness()
- {
- return this.createProxy(SpecificationInterfaceType.EJB30_BUSINESS);
- }
-
- public Object createProxy(SpecificationInterfaceType type)
- {
- String stackName = this.getStackNameInterceptors();
- if (binding.interceptorStack() != null && !binding.interceptorStack().equals(""))
- {
- stackName = binding.interceptorStack();
- }
- AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
- StatelessRemoteProxy proxy = new StatelessRemoteProxy(getContainer(),
- stack.createInterceptors(getContainer().getAdvisor(), null), locator);
-
- if(type.equals(SpecificationInterfaceType.EJB21))
- {
- return this.constructEjb21Proxy(proxy);
- }
- else
- {
- return this.constructProxyBusiness(proxy);
- }
- }
-
- @Override
- protected final StatelessHandleRemoteImpl createHandle()
- {
- EJBObject proxy = this.createProxyEjb21();
- StatelessHandleRemoteImpl handle = new StatelessHandleRemoteImpl(proxy);
- return handle;
- }
-
- @SuppressWarnings("unchecked")
- public <T extends EJBObject> T createProxyEjb21()
- {
- // Cast explicitly to catch improper proxies
- return (T)this.createProxy(SpecificationInterfaceType.EJB21);
- }
-
- // Accessors / Mutators
-
- RemoteBinding getBinding()
- {
- assert this.binding!=null : "RemoteBinding has not been initialized";
- return this.binding;
- }
-
- InvokerLocator getLocator()
- {
- assert this.locator!=null : "InvokerLocator has not been initialized";
- return this.locator;
- }
-
-}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessClusterProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessClusterProxyFactory.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessClusterProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,201 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.stateless;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.aop.advice.AdviceStack;
-import org.jboss.aspects.remoting.FamilyWrapper;
-import org.jboss.ejb3.ProxyFactoryHelper;
-import org.jboss.ejb3.SpecificationInterfaceType;
-import org.jboss.ejb3.annotation.Clustered;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.annotation.defaults.ClusteredDefaults;
-import org.jboss.ejb3.remoting.LoadBalancePolicyNotRegisteredException;
-import org.jboss.ejb3.remoting.RemoteProxyFactory;
-import org.jboss.ejb3.remoting.RemoteProxyFactoryRegistry;
-import org.jboss.ejb3.session.SessionSpecContainer;
-import org.jboss.ha.client.loadbalance.LoadBalancePolicy;
-import org.jboss.ha.client.loadbalance.RandomRobin;
-import org.jboss.ha.framework.interfaces.ClusteringTargetsRepository;
-import org.jboss.ha.framework.interfaces.DistributedReplicantManager;
-import org.jboss.ha.framework.interfaces.HAPartition;
-import org.jboss.ha.framework.server.HATarget;
-import org.jboss.logging.Logger;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.util.NotImplementedException;
-
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public class StatelessClusterProxyFactory extends BaseStatelessRemoteProxyFactory
- implements RemoteProxyFactory, DistributedReplicantManager.ReplicantListener
-{
- private static final Logger log = Logger.getLogger(StatelessClusterProxyFactory.class);
-
- private static final String STACK_NAME_CLUSTERED_STATELESS_SESSION_CLIENT_INTERCEPTORS = "ClusteredStatelessSessionClientInterceptors";
-
- private RemoteBinding binding;
- private Clustered clustered;
- private InvokerLocator locator;
- private DistributedReplicantManager drm;
- private HATarget hatarget;
- private String proxyFamilyName;
- private LoadBalancePolicy lbPolicy;
- private FamilyWrapper wrapper;
- private Object proxy;
-
- public StatelessClusterProxyFactory(SessionSpecContainer container, RemoteBinding binding, Clustered clustered)
- {
- super(container, binding);
-
- assert clustered != null : "clustered is null";
-
- this.binding = binding;
- this.clustered = clustered;
- }
-
- public void start() throws Exception
- {
- String clientBindUrl = ProxyFactoryHelper.getClientBindUrl(binding);
- locator = new InvokerLocator(clientBindUrl);
- String partitionName = ((StatelessContainer) getContainer()).getPartitionName();
- proxyFamilyName = ((StatelessContainer) getContainer()).getDeploymentQualifiedName() + locator.getProtocol() + partitionName;
- HAPartition partition = (HAPartition) getContainer().getInitialContext().lookup("/HAPartition/" + partitionName);
- hatarget = new HATarget(partition, proxyFamilyName, locator, HATarget.ENABLE_INVOCATIONS);
- ClusteringTargetsRepository.initTarget(proxyFamilyName, hatarget.getReplicants());
- StatelessContainer container = (StatelessContainer) getContainer();
-
- container.getClusterFamilies().put(proxyFamilyName, hatarget);
-
- if (clustered.loadBalancePolicy() == null || clustered.loadBalancePolicy().equals(ClusteredDefaults.LOAD_BALANCE_POLICY_DEFAULT))
- {
- lbPolicy = new RandomRobin();
- }
- else
- {
- String policyClass = clustered.loadBalancePolicy();
- try
- {
- RemoteProxyFactoryRegistry registry = container.getDeployment().getRemoteProxyFactoryRegistry();
- Class<LoadBalancePolicy> policy = registry.getLoadBalancePolicy(policyClass);
- policyClass = policy.getName();
- }
- catch (LoadBalancePolicyNotRegisteredException e){}
-
- lbPolicy = (LoadBalancePolicy)Thread.currentThread().getContextClassLoader().loadClass(policyClass)
- .newInstance();
- }
- wrapper = new FamilyWrapper(proxyFamilyName, hatarget.getReplicants());
-
- this.drm = partition.getDistributedReplicantManager();
- drm.registerListener(proxyFamilyName, this);
-
- super.start();
- }
-
- public void stop() throws Exception
- {
- super.stop();
- proxy = null;
- hatarget.destroy();
- drm.unregisterListener(proxyFamilyName, this);
- ((StatelessContainer) getContainer()).getClusterFamilies().remove(proxyFamilyName);
- }
-
- public Object createProxyBusiness()
- {
- Object containerId = getContainer().getObjectName().getCanonicalName();
- String stackName = this.getStackNameInterceptors();
- if (binding.interceptorStack() != null && !binding.interceptorStack().equals(""))
- {
- stackName = binding.interceptorStack();
- }
- AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
- /*
- Object[] args = {new StatelessClusteredProxy(containerId, stack.createInterceptors((Advisor) container, null), wrapper, lbPolicy)};
- return proxyConstructor.newInstance(args);
- */
- String partitionName = ((StatelessContainer) getContainer()).getPartitionName();
-
- proxy = constructProxy(new StatelessClusteredProxy(getContainer(), stack.createInterceptors(getContainer()
- .getAdvisor(), null), wrapper, lbPolicy, partitionName), SpecificationInterfaceType.EJB30_BUSINESS);
- return proxy;
- }
-
- /**
- * Whether or not to bind the home and business interfaces together
- *
- * @return
- */
- @Override
- protected boolean bindHomeAndBusinessTogether(){
- // Not Supported
- return false;
- }
-
- public synchronized void replicantsChanged (String key,
- List newReplicants,
- int newReplicantsViewId,
- boolean merge)
- {
- try
- {
- // Update the FamilyClusterInfo with the new targets
- ArrayList targets = new ArrayList(newReplicants);
- wrapper.get().updateClusterInfo(targets, newReplicantsViewId);
-
- // Rebind the proxy as the old one has been serialized
- if (proxy != null)
- bindProxy(proxy);
- }
- catch (Exception e)
- {
- log.error(e);
- }
- }
-
- /**
- * Returns the interface type for Home
- *
- * @param container
- * @return
- */
- @Override
- protected Class<?> getHomeType()
- {
- // Not Supported
- return null;
- }
-
- @Override
- String getStackNameInterceptors()
- {
- return StatelessClusterProxyFactory.STACK_NAME_CLUSTERED_STATELESS_SESSION_CLIENT_INTERCEPTORS;
- }
-}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessClusteredProxy.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessClusteredProxy.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessClusteredProxy.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,136 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.stateless;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import org.jboss.aop.Dispatcher;
-import org.jboss.aop.advice.Interceptor;
-import org.jboss.aop.joinpoint.MethodInvocation;
-import org.jboss.aop.util.MethodHashing;
-import org.jboss.aop.util.PayloadKey;
-import org.jboss.aspects.asynch.AsynchMixin;
-import org.jboss.aspects.asynch.AsynchProvider;
-import org.jboss.aspects.remoting.ClusterConstants;
-import org.jboss.aspects.remoting.FamilyWrapper;
-import org.jboss.aspects.remoting.InvokeRemoteInterceptor;
-import org.jboss.ejb3.Container;
-import org.jboss.ejb3.Ejb3Registry;
-import org.jboss.ejb3.JBossProxy;
-import org.jboss.ejb3.ProxyUtils;
-import org.jboss.ejb3.asynchronous.AsynchronousInterceptor;
-import org.jboss.ejb3.remoting.BaseRemoteProxy;
-import org.jboss.ejb3.remoting.ClusteredIsLocalInterceptor;
-import org.jboss.ejb3.remoting.IsLocalInterceptor;
-import org.jboss.ha.client.loadbalance.LoadBalancePolicy;
-
-/**
- * InvocationHandler for a clustered SLSB proxy.
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @author Brian Stansberry
- * @version $Revision$
- */
-public class StatelessClusteredProxy extends BaseRemoteProxy
-{
- private static final long serialVersionUID = -4100015258079818357L;
-
- protected FamilyWrapper family;
- protected LoadBalancePolicy lbPolicy;
- AsynchProvider provider;
- protected String partitionName;
-
- public StatelessClusteredProxy(Container container, Interceptor[] interceptors, FamilyWrapper family, LoadBalancePolicy lbPolicy, String partitionName)
- {
- super(container, interceptors);
- this.family = family;
- this.lbPolicy = lbPolicy;
- this.partitionName = partitionName;
- }
-
- public StatelessClusteredProxy(AsynchProvider provider, String containerId, String containerGuid, Interceptor[] interceptors, FamilyWrapper family, LoadBalancePolicy lbPolicy, String partitionName)
- {
- super(containerId, containerGuid, interceptors);
- this.provider = provider;
- this.family = family;
- this.lbPolicy = lbPolicy;
- this.partitionName = partitionName;
- }
-
- public StatelessClusteredProxy()
- {
- }
-
- public Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable
- {
- if (method.getDeclaringClass() == AsynchProvider.class)
- {
- return provider.getFuture();
- }
-
- long hash = MethodHashing.calculateHash(method);
- Object ret = ProxyUtils.handleCallLocally(hash, (JBossProxy) proxy, this, method, args);
- if (ret != null)
- {
- return ret;
- }
-
- MethodInvocation sri = new MethodInvocation(interceptors, hash, method, method, null);
- sri.setArguments(args);
- sri.setInstanceResolver(metadata);
- sri.getMetaData().addMetaData(Dispatcher.DISPATCHER, Dispatcher.OID, containerId, PayloadKey.AS_IS);
- sri.getMetaData().addMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.CLUSTER_FAMILY_WRAPPER, family, PayloadKey.AS_IS);
- sri.getMetaData().addMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.LOADBALANCE_POLICY, lbPolicy, PayloadKey.AS_IS);
- sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.SUBSYSTEM, "AOP", PayloadKey.AS_IS);
- sri.getMetaData().addMetaData(ClusteredIsLocalInterceptor.PARTITION_NAME, ClusteredIsLocalInterceptor.PARTITION_NAME, partitionName, PayloadKey.TRANSIENT);
- sri.getMetaData().addMetaData(IsLocalInterceptor.IS_LOCAL, IsLocalInterceptor.GUID, containerGuid, PayloadKey.AS_IS);
-
- if (provider != null)
- {
- sri.getMetaData().addMetaData(AsynchronousInterceptor.ASYNCH, AsynchronousInterceptor.INVOKE_ASYNCH, "YES", PayloadKey.AS_IS);
- }
- return sri.invokeNext();
- }
-
- public Object getAsynchronousProxy(Object proxy)
- {
- Class[] infs = proxy.getClass().getInterfaces();
- if (!ProxyUtils.isAsynchronous(infs))
- {
- Class[] interfaces = ProxyUtils.addAsynchProviderInterface(infs);
- AsynchMixin mixin = new AsynchMixin();
- Interceptor[] newInterceptors = ProxyUtils.addAsynchProxyInterceptor(mixin, interceptors);
- StatelessClusteredProxy handler = new StatelessClusteredProxy(mixin, containerId, containerGuid, newInterceptors, family, lbPolicy, partitionName);
- return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, handler);
- }
-
- //I was already asynchronous
- return proxy;
- }
-
- public String toString()
- {
- return containerId.toString();
- }
-
-}
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -45,12 +45,19 @@
import org.jboss.ejb3.BeanContextLifecycleCallback;
import org.jboss.ejb3.EJBContainerInvocation;
import org.jboss.ejb3.Ejb3Deployment;
-import org.jboss.ejb3.ProxyFactoryHelper;
-import org.jboss.ejb3.ProxyUtils;
import org.jboss.ejb3.annotation.Clustered;
import org.jboss.ejb3.annotation.LocalBinding;
import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.proxy.ProxyUtils;
+import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
+import org.jboss.ejb3.proxy.factory.SessionProxyFactory;
+import org.jboss.ejb3.proxy.factory.stateful.StatefulProxyFactory;
+import org.jboss.ejb3.proxy.factory.stateless.BaseStatelessRemoteProxyFactory;
+import org.jboss.ejb3.proxy.factory.stateless.StatelessClusterProxyFactory;
+import org.jboss.ejb3.proxy.factory.stateless.StatelessLocalProxyFactory;
+import org.jboss.ejb3.proxy.factory.stateless.StatelessRemoteProxyFactory;
import org.jboss.ejb3.session.SessionSpecContainer;
+import org.jboss.ejb3.stateful.StatefulContainer;
import org.jboss.ejb3.timerservice.TimedObjectInvoker;
import org.jboss.ejb3.timerservice.TimerServiceFactory;
import org.jboss.injection.lang.reflect.BeanProperty;
@@ -153,17 +160,17 @@
* @throws Exception
*/
@Override
- public Object createProxyLocalEjb21(LocalBinding binding) throws Exception
+ public Object createProxyLocalEjb21(LocalBinding binding, String businessInterfaceType) throws Exception
{
StatelessLocalProxyFactory proxyFactory = this.getProxyFactory(binding);
- return proxyFactory.createProxyEjb21();
+ return proxyFactory.createProxyEjb21(businessInterfaceType);
}
@Override
- public Object createProxyRemoteEjb21(RemoteBinding binding) throws Exception
+ public Object createProxyRemoteEjb21(RemoteBinding binding, String businessInterfaceType) throws Exception
{
BaseStatelessRemoteProxyFactory proxyFactory = this.getProxyFactory(binding);
- return proxyFactory.createProxyEjb21();
+ return proxyFactory.createProxyEjb21(businessInterfaceType);
}
public Object createSession(Class<?> initTypes[], Object initArgs[])
@@ -455,22 +462,42 @@
return null;
}
}
+
+ /**
+ * Provides implementation for this bean's EJB 2.1 Home.create() method
+ *
+ * @param factory
+ * @param unadvisedMethod
+ * @param args
+ * @return
+ * @throws Exception
+ */
+ @Override
+ protected Object invokeHomeCreate(SessionProxyFactory factory, Method unadvisedMethod, Object args[])
+ throws Exception
+ {
+ Object proxy = factory.createProxyBusiness(unadvisedMethod.getReturnType().getName());
+
+ return proxy;
+ }
+
public Object localHomeInvoke(Method method, Object[] args) throws Throwable
{
if (method.getName().equals("create"))
{
LocalBinding binding = this.getAnnotation(LocalBinding.class);
-
+
// FIXME: why this binding? Could be another one. (there is only one local binding, but that's another bug)
-
+
StatelessLocalProxyFactory factory = this.getProxyFactory(binding);
- Object proxy = factory.createProxyEjb21();
+ Object proxy = factory.createProxyEjb21(method.getReturnType().getName());
return proxy;
}
- else // remove
+ else
+ // remove
{
return null;
}
@@ -482,12 +509,13 @@
if (unadvisedMethod.getName().equals("create"))
{
RemoteBinding binding = this.getRemoteBinding();
-
+
BaseStatelessRemoteProxyFactory factory = this.getProxyFactory(binding);
-
- return factory.createProxyEjb21();
+
+ return factory.createProxyEjb21(unadvisedMethod.getReturnType().getName());
}
- else // remove
+ else
+ // remove
{
return null;
}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessLocalProxy.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessLocalProxy.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessLocalProxy.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,126 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.stateless;
-
-import javax.ejb.EJBException;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import org.jboss.aspects.asynch.AsynchMixin;
-import org.jboss.aspects.asynch.AsynchProvider;
-import org.jboss.aspects.asynch.FutureHolder;
-import org.jboss.ejb3.Container;
-import org.jboss.ejb3.LocalProxy;
-import org.jboss.ejb3.ProxyUtils;
-import org.jboss.logging.Logger;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public class StatelessLocalProxy extends LocalProxy
-{
- private static final long serialVersionUID = -3241008127518089831L;
-
- private static final Logger log = Logger.getLogger(StatelessLocalProxy.class);
-
- AsynchProvider provider;
-
- public StatelessLocalProxy()
- {
- }
-
- public StatelessLocalProxy(Container container)
- {
- super(container);
- }
-
- public StatelessLocalProxy(AsynchProvider provider, Container container)
- {
- super(container);
- this.provider = provider;
- }
-
- public Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable
- {
- if (method.getDeclaringClass() == AsynchProvider.class)
- {
- return provider.getFuture();
- }
-
- Object ret = ProxyUtils.handleCallLocally(proxy, this, method, args);
- if (ret != null)
- {
- return ret;
- }
-
- StatelessContainer container = (StatelessContainer) getContainer();
-
- if (container == null)
- {
- throw new EJBException("Invalid invocation of local interface (null container)");
- }
-
- return container.localInvoke(method, args, (FutureHolder) provider);
- }
-
- public Object getAsynchronousProxy(Object proxy)
- {
- Class[] infs = proxy.getClass().getInterfaces();
- if (!ProxyUtils.isAsynchronous(infs))
- {
- Class[] interfaces = ProxyUtils.addAsynchProviderInterface(infs);
- AsynchMixin mixin = new AsynchMixin();
- StatelessLocalProxy handler = new StatelessLocalProxy(mixin, getContainer());
- return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, handler);
- }
-
- //I was already asynchronous
- return proxy;
- }
-/*
- @Override
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- {
- super.readExternal(in);
- provider = (AsynchProvider)in.readObject();
- }
-
- @Override
- public void writeExternal(ObjectOutput out) throws IOException
- {
- super.writeExternal(out);
- out.writeObject(provider);
- }
-*/
-
- public String toString()
- {
- if (getContainer() == null)
- return proxyName;
- else
- return getContainer().getEjbName();
- }
-}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessLocalProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessLocalProxyFactory.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessLocalProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,147 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.stateless;
-
-import javax.ejb.EJBLocalObject;
-import javax.ejb.LocalHome;
-
-import org.jboss.ejb3.EJBContainer;
-import org.jboss.ejb3.ProxyFactoryHelper;
-import org.jboss.ejb3.SpecificationInterfaceType;
-import org.jboss.ejb3.annotation.LocalBinding;
-import org.jboss.ejb3.session.ProxyAccessType;
-import org.jboss.ejb3.session.SessionSpecContainer;
-import org.jboss.logging.Logger;
-import org.jboss.util.naming.Util;
-
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public class StatelessLocalProxyFactory extends BaseStatelessProxyFactory
-{
- private static final Logger log = Logger.getLogger(StatelessLocalProxyFactory.class);
-
- public StatelessLocalProxyFactory(SessionSpecContainer container, LocalBinding binding)
- {
- super(container, binding.jndiBinding());
- }
-
- /**
- * Returns the interface type for Home
- *
- * @param container
- * @return
- */
- @Override
- protected Class<?> getHomeType()
- {
- return ProxyFactoryHelper.getLocalHomeInterface(this.getContainer());
- }
-
- @Override
- protected ProxyAccessType getProxyAccessType()
- {
- return ProxyAccessType.LOCAL;
- }
-
-
- protected void validateEjb21Views(){
-
- EJBContainer container = this.getContainer();
-
- LocalHome localHome = container.getAnnotation(LocalHome.class);
-
- // Ensure that if EJB 2.1 Components are defined, they're complete
- this.validateEjb21Views(localHome == null ? null : localHome.value(), ProxyFactoryHelper
- .getLocalInterfaces(container));
- }
-
- /**
- * Whether or not to bind the home and business interfaces together
- *
- * @return
- */
- @Override
- protected boolean bindHomeAndBusinessTogether()
- {
- return ProxyFactoryHelper.getLocalHomeJndiName(this.getContainer()).equals(jndiName);
- }
-
- @Override
- public void start() throws Exception
- {
- super.start();
- SessionSpecContainer statelessContainer = getContainer();
- LocalHome localHome = statelessContainer.getAnnotation(LocalHome.class);
- if (localHome != null && !bindHomeAndBusinessTogether())
- {
- Class<?>[] interfaces = {localHome.value()};
- Object homeProxy = java.lang.reflect.Proxy.newProxyInstance(getContainer().getBeanClass().getClassLoader(),
- interfaces, new StatelessLocalProxy(getContainer()));
- Util.rebind(getContainer().getInitialContext(), ProxyFactoryHelper.getLocalHomeJndiName(getContainer()), homeProxy);
- }
- }
-
- @Override
- public void stop() throws Exception
- {
- super.stop();
- SessionSpecContainer statelessContainer = this.getContainer();
- LocalHome localHome = statelessContainer.getAnnotation(LocalHome.class);
- if (localHome != null && !bindHomeAndBusinessTogether())
- {
- Util.unbind(getContainer().getInitialContext(), ProxyFactoryHelper.getLocalHomeJndiName(getContainer()));
- }
- }
-
-
- public Object createProxyBusiness()
- {
- return this.constructProxyBusiness(new StatelessLocalProxy(getContainer()));
- }
-
- @SuppressWarnings("unchecked")
- public <T extends EJBLocalObject> T createProxyEjb21()
- {
- return (T)this.createProxy(SpecificationInterfaceType.EJB21);
- }
-
- private Object createProxy(SpecificationInterfaceType type)
- {
- StatelessLocalProxy proxy = new StatelessLocalProxy(this.getContainer());
- return type.equals(SpecificationInterfaceType.EJB30_BUSINESS) ? this.constructProxyBusiness(proxy) : this
- .constructEjb21Proxy(proxy);
- }
-
- @Override
- protected StatelessHandleRemoteImpl createHandle()
- {
- // Local beans have no Handle
- //TODO Rework the contract such that this method does not need to be
- // defined for local proxy factories
- return null;
- }
-}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessRemoteProxy.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessRemoteProxy.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessRemoteProxy.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,147 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.stateless;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import org.jboss.aop.Dispatcher;
-import org.jboss.aop.advice.Interceptor;
-import org.jboss.aop.joinpoint.MethodInvocation;
-import org.jboss.aop.util.MethodHashing;
-import org.jboss.aop.util.PayloadKey;
-import org.jboss.aspects.asynch.AsynchMixin;
-import org.jboss.aspects.asynch.AsynchProvider;
-import org.jboss.aspects.remoting.InvokeRemoteInterceptor;
-import org.jboss.ejb3.Container;
-import org.jboss.ejb3.ProxyUtils;
-import org.jboss.ejb3.asynchronous.AsynchronousInterceptor;
-import org.jboss.ejb3.remoting.IsLocalInterceptor;
-import org.jboss.logging.Logger;
-import org.jboss.remoting.InvokerLocator;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public class StatelessRemoteProxy extends org.jboss.ejb3.session.BaseSessionRemoteProxy
-{
- private static final long serialVersionUID = 2583299153931800023L;
- private static final Logger log = Logger.getLogger(StatelessRemoteProxy.class);
-
- protected InvokerLocator uri;
- AsynchProvider provider;
-
- public StatelessRemoteProxy(Container container, Interceptor[] interceptors, InvokerLocator uri)
- {
- super(container, interceptors);
- this.uri = uri;
- }
-
- public StatelessRemoteProxy(AsynchProvider provider, String containerId, String containerGuid, Interceptor[] interceptors, InvokerLocator uri)
- {
- super(containerId, containerGuid, interceptors);
- this.uri = uri;
- this.provider = provider;
- }
-
-
- protected StatelessRemoteProxy()
- {
- }
-
-
- public Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable
- {
- if (method.getDeclaringClass() == AsynchProvider.class)
- {
- return provider.getFuture();
- }
-
- long hash = MethodHashing.calculateHash(method);
- Object ret = ProxyUtils.handleCallLocally(hash, proxy, this, method, args);
- if (ret != null)
- {
- return ret;
- }
-
- ret = handleEjb21CallLocally(method, args);
- if (ret != null)
- {
- return ret;
- }
-
- MethodInvocation sri = new MethodInvocation(interceptors, hash, method, method, null);
- sri.setArguments(args);
- sri.setInstanceResolver(metadata);
- sri.getMetaData().addMetaData(Dispatcher.DISPATCHER, Dispatcher.OID, containerId, PayloadKey.AS_IS);
- sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.INVOKER_LOCATOR, uri, PayloadKey.AS_IS);
- sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.SUBSYSTEM, "AOP", PayloadKey.AS_IS);
- sri.getMetaData().addMetaData(IsLocalInterceptor.IS_LOCAL, IsLocalInterceptor.GUID, containerGuid, PayloadKey.AS_IS);
-
-
- if (provider != null)
- {
- sri.getMetaData().addMetaData(AsynchronousInterceptor.ASYNCH, AsynchronousInterceptor.INVOKE_ASYNCH, "YES", PayloadKey.AS_IS);
- }
- return sri.invokeNext();
- }
-
- public Object getAsynchronousProxy(Object proxy)
- {
- Class[] infs = proxy.getClass().getInterfaces();
- if (!ProxyUtils.isAsynchronous(infs))
- {
- Class[] interfaces = ProxyUtils.addAsynchProviderInterface(infs);
- AsynchMixin mixin = new AsynchMixin();
- Interceptor[] newInterceptors = ProxyUtils.addAsynchProxyInterceptor(mixin, interceptors);
- StatelessRemoteProxy handler = new StatelessRemoteProxy(mixin, containerId, containerGuid, newInterceptors, uri);
- return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, handler);
- }
-
- //I was already asynchronous
- return proxy;
- }
-
- public String toString()
- {
- return containerId.toString();
- }
-
- private Object handleEjb21CallLocally(Method method, Object[] args)
- {
- if (method.equals(ProxyUtils.GET_HOME_HANDLE))
- {
- return homeHandle;
- } else if (method.equals(ProxyUtils.GET_EJB_METADATA))
- {
- return ejbMetaData;
- } else if (method.equals(ProxyUtils.GET_HANDLE))
- {
- return handle;
- }
-
- return null;
- }
-}
Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessRemoteProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessRemoteProxyFactory.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessRemoteProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -1,147 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.stateless;
-
-import javax.ejb.RemoteHome;
-import javax.naming.NamingException;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.aop.advice.AdviceStack;
-import org.jboss.ejb3.ProxyFactoryHelper;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.remoting.RemoteProxyFactory;
-import org.jboss.ejb3.session.SessionSpecContainer;
-import org.jboss.logging.Logger;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.util.naming.Util;
-
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public class StatelessRemoteProxyFactory extends BaseStatelessRemoteProxyFactory implements RemoteProxyFactory
-{
- private static final Logger log = Logger.getLogger(StatelessRemoteProxyFactory.class);
-
- private static final String STACK_NAME_STATELESS_SESSION_CLIENT_INTERCEPTORS = "StatelessSessionClientInterceptors";
-
- public StatelessRemoteProxyFactory(SessionSpecContainer container, RemoteBinding binding)
- {
- super(container, binding);
- }
-
- /**
- * Whether or not to bind the home and business interfaces together
- *
- * @return
- */
- @Override
- protected boolean bindHomeAndBusinessTogether()
- {
- SessionSpecContainer container = this.getContainer();
- return ProxyFactoryHelper.getHomeJndiName(container).equals(ProxyFactoryHelper.getRemoteBusinessJndiName(container));
- }
-
- public void init() throws Exception
- {
- super.init();
- }
-
- public void start() throws Exception
- {
- super.start();
- RemoteHome remoteHome = this.getContainer().getAnnotation(RemoteHome.class);
- if (remoteHome != null && !bindHomeAndEjb21ViewTogether(this.getContainer()))
- {
- Object homeProxy = createHomeProxy(remoteHome.value());
- String jndiName = ProxyFactoryHelper.getHomeJndiName(getContainer());
- try
- {
- log.debug("Binding proxy for " + getContainer().getEjbName() + " in JNDI at " + jndiName);
- Util.rebind(getContainer().getInitialContext(), jndiName, homeProxy);
- }
- catch (NamingException e)
- {
- NamingException namingException = new NamingException("Could not bind stateless home proxy with ejb name " + getContainer().getEjbName() + " into JNDI under jndiName: " + getContainer().getInitialContext().getNameInNamespace() + "/" + jndiName);
- namingException.setRootCause(e);
- throw namingException;
- }
-
- }
- }
-
- public void stop() throws Exception
- {
- super.stop();
- SessionSpecContainer statelessContainer = this.getContainer();
- RemoteHome remoteHome = this.getContainer().getAnnotation(RemoteHome.class);
- if (remoteHome != null && !bindHomeAndEjb21ViewTogether(statelessContainer))
- {
- Util.unbind(getContainer().getInitialContext(), ProxyFactoryHelper.getHomeJndiName(getContainer()));
- }
- }
-
- public Object createHomeProxy(Class<?> homeInterface)
- {
- try
- {
- String stackName = this.getStackNameInterceptors();
- RemoteBinding binding = this.getBinding();
- InvokerLocator locator = this.getLocator();
- if (binding.interceptorStack() != null && !binding.interceptorStack().equals(""))
- {
- stackName = binding.interceptorStack();
- }
- AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
- StatelessRemoteProxy proxy = new StatelessRemoteProxy(getContainer(),
- stack.createInterceptors(getContainer().getAdvisor(), null), locator);
- setEjb21Objects(proxy);
- Class<?>[] interfaces = {homeInterface};
- return java.lang.reflect.Proxy.newProxyInstance(getContainer().getBeanClass().getClassLoader(), interfaces, proxy);
- }
- catch (IllegalArgumentException e)
- {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * Returns the interface type for Home
- *
- * @return
- */
- @Override
- protected Class<?> getHomeType()
- {
- return ProxyFactoryHelper.getRemoteHomeInterface(this.getContainer());
- }
-
- @Override
- String getStackNameInterceptors()
- {
- return StatelessRemoteProxyFactory.STACK_NAME_STATELESS_SESSION_CLIENT_INTERCEPTORS;
- }
-
-}
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessSessionContextImpl.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessSessionContextImpl.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessSessionContextImpl.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -51,7 +51,7 @@
{
try
{
- EJBLocalObject proxy = (EJBLocalObject) container.createProxyLocalEjb21();
+ EJBLocalObject proxy = (EJBLocalObject) container.createProxyLocalEjb21(null);
return proxy;
}
catch (Exception e)
@@ -65,7 +65,7 @@
{
try
{
- EJBObject proxy = (EJBObject) container.createProxyRemoteEjb21();
+ EJBObject proxy = (EJBObject) container.createProxyRemoteEjb21(null);
return proxy;
}
catch (Exception e)
Modified: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/asynchronous/Tester.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/asynchronous/Tester.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/asynchronous/Tester.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -23,7 +23,7 @@
import org.jboss.aspects.asynch.AsynchProvider;
import org.jboss.aspects.asynch.Future;
-import org.jboss.ejb3.JBossProxy;
+import org.jboss.ejb3.proxy.JBossProxy;
import org.jboss.tm.TransactionManagerLocator;
import javax.naming.InitialContext;
Modified: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/asynchronous/TesterMBean.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/asynchronous/TesterMBean.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/asynchronous/TesterMBean.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -21,7 +21,7 @@
*/
package org.jboss.ejb3.test.asynchronous;
-import org.jboss.ejb3.JBossProxy;
+import org.jboss.ejb3.proxy.JBossProxy;
import org.jboss.aspects.asynch.AsynchProvider;
import org.jboss.aspects.asynch.Future;
Modified: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/asynchronous/unit/AsynchronousTestCase.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/asynchronous/unit/AsynchronousTestCase.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/asynchronous/unit/AsynchronousTestCase.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -34,8 +34,8 @@
import org.jboss.aspects.asynch.AsynchProvider;
import org.jboss.aspects.asynch.Future;
-import org.jboss.ejb3.JBossProxy;
import org.jboss.ejb3.asynchronous.Asynch;
+import org.jboss.ejb3.proxy.JBossProxy;
import org.jboss.ejb3.test.asynchronous.SecuredStatelessRemote;
import org.jboss.ejb3.test.asynchronous.ServiceRemote;
import org.jboss.ejb3.test.asynchronous.StatefulClusteredRemote;
Modified: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/bank/TellerRemoteProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/bank/TellerRemoteProxyFactory.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/bank/TellerRemoteProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -31,7 +31,7 @@
* @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
* @version $Revision$
*/
-public class TellerRemoteProxyFactory extends org.jboss.ejb3.stateless.StatelessRemoteProxyFactory
+public class TellerRemoteProxyFactory extends org.jboss.ejb3.proxy.factory.stateless.StatelessRemoteProxyFactory
{
private static final Logger log = Logger.getLogger(TellerRemoteProxyFactory.class);
Modified: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/stateful/StatefulRemoteProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/stateful/StatefulRemoteProxyFactory.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/stateful/StatefulRemoteProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -31,7 +31,7 @@
* @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
* @version $Revision$
*/
-public class StatefulRemoteProxyFactory extends org.jboss.ejb3.stateful.StatefulRemoteProxyFactory
+public class StatefulRemoteProxyFactory extends org.jboss.ejb3.proxy.factory.stateful.StatefulRemoteProxyFactory
{
@SuppressWarnings("unused")
private static final Logger log = Logger.getLogger(StatefulRemoteProxyFactory.class);
Modified: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/statefulproxyfactoryoverride/StatefulRemoteProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/statefulproxyfactoryoverride/StatefulRemoteProxyFactory.java 2008-04-23 21:24:05 UTC (rev 72637)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/statefulproxyfactoryoverride/StatefulRemoteProxyFactory.java 2008-04-23 21:35:39 UTC (rev 72638)
@@ -31,7 +31,7 @@
* @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
* @version $Revision: 67628 $
*/
-public class StatefulRemoteProxyFactory extends org.jboss.ejb3.stateful.StatefulRemoteProxyFactory
+public class StatefulRemoteProxyFactory extends org.jboss.ejb3.proxy.factory.stateful.StatefulRemoteProxyFactory
{
@SuppressWarnings("unused")
private static final Logger log = Logger.getLogger(StatefulRemoteProxyFactory.class);
More information about the jboss-cvs-commits
mailing list