[jboss-cvs] JBossAS SVN: r71803 - in projects/ejb3: dev and 93 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Apr 8 14:59:51 EDT 2008
Author: ALRubinger
Date: 2008-04-08 14:59:49 -0400 (Tue, 08 Apr 2008)
New Revision: 71803
Added:
projects/ejb3/dev/ejbthree1253/
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/JndiProxyFactory.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/ProxyFactory.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/ProxyFactoryHelper.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/iiop/IORFactory.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/mdb/LocalProducerFactory.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/mdb/ProducerFactory.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/mdb/RemoteProducerFactory.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/service/BaseServiceProxyFactory.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/service/ServiceContainer.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/service/ServiceLocalProxyFactory.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/service/ServiceRemoteProxyFactory.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/BaseSessionProxyFactory.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/ProxyAccessType.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/ProxyDeployer.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionBeanContext.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionContainer.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionContextImpl.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionSpecBeanContext.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/BaseStatefulProxyFactory.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/BaseStatefulRemoteProxyFactory.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/NestedStatefulBeanContext.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/ProxiedStatefulBeanContext.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulBeanContext.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulClusterProxyFactory.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulHandleRemoteImpl.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulHomeRemoteProxy.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulLocalProxyFactory.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulRemoteProxy.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulRemoteProxyFactory.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/BaseStatelessProxyFactory.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/BaseStatelessRemoteProxyFactory.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessBeanContext.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessClusterProxyFactory.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessHandleRemoteImpl.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessLocalProxyFactory.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessRemoteProxyFactory.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/bank/TellerRemoteProxyFactory.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1122/unit/MultipleDefinitionsOfSameBusinessInterfaceUnitTestCase.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/reference21_30/HomedStatefulSession30Bean.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/reference21_30/Session21Bean.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/reference21_30/Session30Bean.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/reference21_30/unit/ReferenceTestCase.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/stateful/StatefulRemoteProxyFactory.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/statefulproxyfactoryoverride/StatefulRemoteProxyFactory.java
Removed:
projects/ejb3/branches/ejbthree1253/
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/JndiProxyFactory.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/ProxyFactory.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/ProxyFactoryHelper.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/iiop/IORFactory.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/mdb/LocalProducerFactory.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/mdb/ProducerFactory.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/mdb/RemoteProducerFactory.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/service/BaseServiceProxyFactory.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/service/ServiceContainer.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/service/ServiceLocalProxyFactory.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/service/ServiceRemoteProxyFactory.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/BaseSessionProxyFactory.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/ProxyDeployer.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionBeanContext.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionContainer.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionContextImpl.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/BaseStatefulProxyFactory.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/BaseStatefulRemoteProxyFactory.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/NestedStatefulBeanContext.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/ProxiedStatefulBeanContext.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulBeanContext.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulClusterProxyFactory.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulHomeRemoteProxy.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulLocalProxyFactory.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulRemoteHandleImpl.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulRemoteProxy.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulRemoteProxyFactory.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/BaseStatelessProxyFactory.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessBeanContext.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessClusterProxyFactory.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessHandleImpl.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessLocalProxyFactory.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessRemoteProxyFactory.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/bank/TellerRemoteProxyFactory.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1122/unit/MultipleDefinitionsOfSameBusinessInterfaceUnitTestCase.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/reference21_30/HomedStatefulSession30Bean.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/reference21_30/Session21Bean.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/reference21_30/Session30Bean.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/reference21_30/unit/ReferenceTestCase.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/stateful/StatefulRemoteProxyFactory.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/statefulproxyfactoryoverride/StatefulRemoteProxyFactory.java
Modified:
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/ContainerDelegateWrapper.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/ContainerDelegateWrapperMBean.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/dependency/EjbLinkDemandMetaData.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/javaee/AbstractJavaEEComponent.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/javaee/JavaEEApplication.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/javaee/JavaEEComponent.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/javaee/JavaEEComponentHelper.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/javaee/JavaEEModule.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/javaee/SimpleJavaEEApplication.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/kernel/JNDIKernelRegistryPlugin.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/mdb/MessageDrivenContextImpl.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/mdb/MessagingDelegateWrapper.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/metadata/JBossMessageDrivenBeanGenericWrapper.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/metadata/jpa/spec/PersistenceUnitMetaData.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/metadata/jpa/spec/PersistenceUnitsMetaData.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/protocol/jarjar/Handler.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/protocol/jarjar/JarJarInputStream.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/protocol/jarjar/JarJarURLConnection.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/service/ServiceDelegateWrapper.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/util/Debugger.java
projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/injection/InjectorFactory.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1025/OrderService.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1025/OrderServiceBean.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1060/CommonRemote.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1060/InvokedBusinessInterfaceBean.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1060/Remote1.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1060/Remote2.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1060/TestFailedException.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1060/Tester.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1060/TesterBean.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1060/unit/InvokedBusinessInterfaceUnitTestCase.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1062/Calculator.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1062/CalculatorBean.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1062/CommonBase.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1062/CommonInterface.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1062/MyStatelessBean.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1062/MyStatelessLocal.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1062/SuperBean.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1062/SuperInterface.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1066/Adder.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1066/CalculatorBean.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1066/Subtractor.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree471/A.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree471/ABean.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree471/B.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree471/BBean.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree471/Client.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree471/Intercept.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree471/unit/SuperInterceptUnitTestCase.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree786/Remove.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree959/Status.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree959/StatusBean.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree973/SpyMe.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree973/WhoAmI.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree985/OptionalEnvEntry.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree985/OptionalEnvEntryBean.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree986/Foo.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree986/FooBean.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree989/ResUrlChecker.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree989/ResUrlCheckerBean.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/interceptormetadata/MockDependencyPolicy.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/stateful/Stateful21.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/strictpool/unit/MDBCallable.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/threadlocal/MockBean.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/threadlocal/MockBeanContext.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/xpcalt/Inspector.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/xpcalt/InspectorBean.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/xpcalt/Keeper.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/xpcalt/LowEnd.java
projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/xpcalt/Master.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/InterceptorFactory.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/InterceptorFactoryRef.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/ManagedObject.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/annotation/AnnotationAdvisor.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/annotation/AnnotationAdvisorHelper.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/annotation/AnnotationAdvisorSupport.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/annotation/AnnotationAdvisorWrapper.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/annotation/impl/InterceptorsImpl.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/AbstractInterceptorFactory.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/AroundInvokeInterceptor.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/BootstrapInterceptor.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/BusinessMethodBeanMethodInterceptor.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/BusinessMethodInterceptorMethodInterceptor.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/ClassContainer.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/DefaultInterceptorFactory.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/Destructable.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/DomainClassLoader.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/ExtendedAdvisor.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/ExtendedAdvisorHelper.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/ExtendedAdvisorWrapper.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/InjectInterceptorsFactory.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/InterceptorSequencer.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/InterceptorsInterceptor.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/InvocationContextInterceptor.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/InvokeSpecInterceptorInterceptor.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/NopInterceptor.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/PostConstructInterceptor.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/annotation/DefaultInterceptors.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/annotation/DefaultInterceptorsImpl.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/annotation/InterceptorOrder.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/container/ContainerInterceptorFactory.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/container/DestructionInvocation.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/container/InterceptorFactoryRefImpl.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/container/ManagedObjectAdvisor.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/direct/DirectContainer.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/direct/IndirectContainer.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/lang/BootstrapClassLoader.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/lang/ClassHelper.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/lang/ScopedClassLoader.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/metadata/AdditiveBeanInterceptorMetaDataBridge.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/metadata/BeanInterceptorMetaDataBridge.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/metadata/EnvironmentInterceptorMetaDataBridge.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/metadata/InterceptorComponentMetaDataLoaderFactory.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/metadata/InterceptorMetaDataBridge.java
projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/proxy/ProxyContainer.java
projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/additive/MyInterceptor.java
projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/additive/MySessionBean.java
projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/additive/XMLInterceptor.java
projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/basic/BasicBean.java
projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/basic/BasicInterceptor.java
projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/basic/BasicMethodInterceptor.java
projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/basic/unit/BasicTestRunner.java
projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/common/CommonInterceptor.java
projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/common/aop/LoggingInterceptor.java
projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/direct/DirectInterceptor.java
projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/direct/DirectMethodInterceptor.java
projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/direct/TestInterceptorFactory.java
projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/ejbthree1215/GetMethodInterceptor.java
projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/ejbthree1215/Hello.java
projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/ejbthree1215/HelloBean.java
projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/ejbthree1215/unit/ContextGetMethodTestCase.java
projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/lifecycle/SessionBeanCallbackBean.java
projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/metadata/MetadataBean.java
projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/proxy/MyInterface.java
projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/proxy/ProxiedBean.java
projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/proxy/ProxiedInterceptor.java
projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/proxy/unit/ProxyTestCase.java
projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/signature/PackageProtectedInterceptor.java
projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/signature/SignatureTestBean.java
projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/signature/unit/SignatureTestCase.java
projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/supermethod/AroundInvokeBase.java
projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/supermethod/AroundInvokeBean.java
projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/supermethod/AroundInvokeIF.java
projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/supermethod/SessionSynchronizationInterceptor.java
projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/supermethod/unit/SuperMethodTestCase.java
projects/ejb3/dev/ejbthree1253/metadata/src/main/java/org/jboss/ejb3/metadata/ComponentMetaDataLoaderFactory.java
projects/ejb3/dev/ejbthree1253/metadata/src/main/java/org/jboss/ejb3/metadata/MetaDataBridge.java
projects/ejb3/dev/ejbthree1253/metadata/src/main/java/org/jboss/ejb3/metadata/annotation/ExtendedAnnotationRepository.java
projects/ejb3/dev/ejbthree1253/metadata/src/main/java/org/jboss/ejb3/metadata/plugins/loader/AbstractMetaDataLoader.java
projects/ejb3/dev/ejbthree1253/metadata/src/main/java/org/jboss/ejb3/metadata/plugins/loader/AbstractMethodMetaDataLoader.java
projects/ejb3/dev/ejbthree1253/metadata/src/main/java/org/jboss/ejb3/metadata/plugins/loader/BridgedMetaDataLoader.java
projects/ejb3/dev/ejbthree1253/metadata/src/main/java/org/jboss/ejb3/metadata/spi/signature/ClassSignature.java
projects/ejb3/dev/ejbthree1253/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/BeanInterceptorMetaDataBridge.java
projects/ejb3/dev/ejbthree1253/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/DummyInterceptor.java
projects/ejb3/dev/ejbthree1253/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/EnvironmentInterceptorMetaDataBridge.java
projects/ejb3/dev/ejbthree1253/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/InterceptedBean.java
projects/ejb3/dev/ejbthree1253/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/InterceptorComponentMetaDataLoaderFactory.java
projects/ejb3/dev/ejbthree1253/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/InterceptorMetaDataBridge.java
projects/ejb3/dev/ejbthree1253/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/unit/InterceptorTestCase.java
projects/ejb3/dev/ejbthree1253/metadata/src/test/java/org/jboss/ejb3/test/metadata/securitydomain/SecurityDomainBean.java
projects/ejb3/dev/ejbthree1253/metadata/src/test/java/org/jboss/ejb3/test/metadata/securitydomain/SecurityDomainMetaDataBridge.java
projects/ejb3/dev/ejbthree1253/metadata/src/test/java/org/jboss/ejb3/test/metadata/securitydomain/unit/SecurityDomainTestCase.java
projects/ejb3/dev/ejbthree1253/pool/src/main/java/org/jboss/ejb3/pool/Pool.java
projects/ejb3/dev/ejbthree1253/pool/src/main/java/org/jboss/ejb3/pool/StatelessObjectFactory.java
projects/ejb3/dev/ejbthree1253/pool/src/main/java/org/jboss/ejb3/pool/inifinite/InfinitePool.java
projects/ejb3/dev/ejbthree1253/pool/src/main/java/org/jboss/ejb3/pool/strictmax/StrictMaxPool.java
projects/ejb3/dev/ejbthree1253/pool/src/main/java/org/jboss/ejb3/pool/threadlocal/ThreadLocalPool.java
projects/ejb3/dev/ejbthree1253/pool/src/main/java/org/jboss/ejb3/pool/threadlocal/WeakThreadLocal.java
projects/ejb3/dev/ejbthree1253/pool/src/test/java/org/jboss/ejb3/test/pool/common/MockBean.java
projects/ejb3/dev/ejbthree1253/pool/src/test/java/org/jboss/ejb3/test/pool/common/MockFactory.java
projects/ejb3/dev/ejbthree1253/pool/src/test/java/org/jboss/ejb3/test/pool/infinite/InfinitePoolUnitTestCase.java
projects/ejb3/dev/ejbthree1253/pool/src/test/java/org/jboss/ejb3/test/pool/strictmax/StrictMaxUnitTestCase.java
projects/ejb3/dev/ejbthree1253/pool/src/test/java/org/jboss/ejb3/test/pool/threadlocal/ThreadLocalPoolUnitTestCase.java
projects/ejb3/dev/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/interceptorcontainer/ContainerInterceptors.java
projects/ejb3/dev/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/interceptorcontainer/InterceptorContainer.java
projects/ejb3/dev/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/interceptorcontainer/impl/BusinessMethodInterceptorMethodInterceptor.java
projects/ejb3/dev/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/interceptorcontainer/impl/ContainerInterceptorsExecutor.java
projects/ejb3/dev/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/interceptorcontainer/impl/ContainersInterceptorsInterceptor.java
projects/ejb3/dev/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/interceptorcontainer/impl/InterceptorInvoker.java
projects/ejb3/dev/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/interceptorcontainer/impl/LifecycleCallbackInterceptorMethodInterceptor.java
projects/ejb3/dev/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/local/LocalBusinessInterfaceInterceptor.java
projects/ejb3/dev/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/local/LocalProxy.java
projects/ejb3/dev/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/mc/MC.java
projects/ejb3/dev/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/stateless/StatelessBeanContext.java
projects/ejb3/dev/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/stateless/StatelessContainer.java
projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/interceptorinterceptor/InterceptedInterceptor.java
projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/interceptorinterceptor/InterceptorInterceptor.java
projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/interceptorinterceptor/InterceptorInterceptorBean.java
projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/interceptorinterceptor/InterceptorInterceptors.java
projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/interceptorinterceptor/unit/InterceptorInterceptorUnitTestCase.java
projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/performance/Calculator.java
projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/performance/CalculatorBean.java
projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/performance/unit/EJBUnitTestCase.java
projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/performance/unit/MCUnitTestCase.java
projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/stateless/SimpleStatelessBean.java
projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/stateless/SimpleStatelessLocal.java
projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/stateless/unit/SimpleStatelessUnitTestCase.java
projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/tx/TxInterceptor.java
projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/tx/TxStatelessBean.java
projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/tx/TxStatelessLocal.java
projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/tx/unit/TxStatelessUnitTestCase.java
Log:
[EJBTHREE-1253] Moved from branches to dev
Copied: projects/ejb3/dev/ejbthree1253 (from rev 71778, projects/ejb3/branches/ejbthree1253)
Modified: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/ContainerDelegateWrapper.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/ContainerDelegateWrapper.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/ContainerDelegateWrapper.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -29,7 +29,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class ContainerDelegateWrapper<CONTAINER_TYPE extends Container> implements ContainerDelegateWrapperMBean
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/ContainerDelegateWrapperMBean.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/ContainerDelegateWrapperMBean.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/ContainerDelegateWrapperMBean.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -29,7 +29,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public interface ContainerDelegateWrapperMBean
{
Deleted: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/JndiProxyFactory.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/JndiProxyFactory.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/JndiProxyFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -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.createProxy();
- 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);
- }
- }
-}
Copied: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/JndiProxyFactory.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/JndiProxyFactory.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/JndiProxyFactory.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/JndiProxyFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,68 @@
+/*
+ * 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/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/ProxyFactory.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/ProxyFactory.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/ProxyFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -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 createProxy();
-
- public Object createProxy(Object id);
-
- public void start() throws Exception;
-
- public void stop() throws Exception;
-}
Copied: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/ProxyFactory.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/ProxyFactory.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/ProxyFactory.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/ProxyFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,41 @@
+/*
+ * 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/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/ProxyFactoryHelper.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/ProxyFactoryHelper.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/ProxyFactoryHelper.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -1,1037 +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.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;
- }
-
- 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/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/ProxyFactoryHelper.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/ProxyFactoryHelper.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/ProxyFactoryHelper.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/ProxyFactoryHelper.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,1053 @@
+/*
+ * 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
Modified: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/dependency/EjbLinkDemandMetaData.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/dependency/EjbLinkDemandMetaData.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/dependency/EjbLinkDemandMetaData.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -45,7 +45,7 @@
* specified.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class EjbLinkDemandMetaData extends JBossObject
implements DemandMetaData, Serializable
Deleted: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/iiop/IORFactory.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/iiop/IORFactory.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/iiop/IORFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -1,435 +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.iiop;
-
-import java.lang.annotation.Annotation;
-import java.net.URL;
-
-import javax.ejb.EJBHome;
-import javax.ejb.EJBObject;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-import javax.naming.Context;
-import javax.naming.NamingException;
-import javax.rmi.PortableRemoteObject;
-
-import org.jboss.classloading.spi.RealClassLoader;
-import org.jboss.ejb3.InitialContextFactory;
-import org.jboss.ejb3.NonSerializableFactory;
-import org.jboss.ejb3.ProxyFactoryHelper;
-import org.jboss.ejb3.annotation.IIOP;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.remoting.RemoteProxyFactory;
-import org.jboss.ejb3.session.SessionContainer;
-import org.jboss.iiop.CorbaORBService;
-import org.jboss.iiop.codebase.CodebasePolicy;
-import org.jboss.iiop.csiv2.CSIv2Policy;
-import org.jboss.iiop.rmi.InterfaceAnalysis;
-import org.jboss.iiop.rmi.ir.InterfaceRepository;
-import org.jboss.invocation.iiop.ReferenceFactory;
-import org.jboss.invocation.iiop.ServantRegistries;
-import org.jboss.invocation.iiop.ServantRegistry;
-import org.jboss.invocation.iiop.ServantRegistryKind;
-import org.jboss.logging.Logger;
-import org.jboss.metadata.IorSecurityConfigMetaData;
-import org.jboss.mx.util.MBeanProxyExt;
-import org.jboss.proxy.ejb.handle.HandleDelegateImpl;
-import org.jboss.system.Registry;
-import org.jboss.web.WebClassLoader;
-import org.jboss.web.WebServiceMBean;
-import org.omg.CORBA.Any;
-import org.omg.CORBA.InterfaceDef;
-import org.omg.CORBA.InterfaceDefHelper;
-import org.omg.CORBA.ORB;
-import org.omg.CORBA.Policy;
-import org.omg.CORBA.Repository;
-import org.omg.CosNaming.NameComponent;
-import org.omg.CosNaming.NamingContext;
-import org.omg.CosNaming.NamingContextExt;
-import org.omg.CosNaming.NamingContextExtHelper;
-import org.omg.CosNaming.NamingContextHelper;
-import org.omg.CosNaming.NamingContextPackage.NotFound;
-import org.omg.PortableServer.Current;
-import org.omg.PortableServer.CurrentHelper;
-import org.omg.PortableServer.POA;
-import org.omg.PortableServer.Servant;
-
-/**
- * Comment
- *
- * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision$
- */
-public class IORFactory
- implements RemoteProxyFactory
-{
- private static final Logger log = Logger.getLogger(IORFactory.class);
-
- private SessionContainer container;
- private RemoteBinding binding;
- private String webServiceName = "jboss:service=WebService"; // TODO: make webServiceName configurable
-
- // after start available
- private String beanRepositoryIds[];
- private String homeRepositoryIds[];
-// private InterfaceAnalysis interfaceAnalysis;
- private ORB orb;
-// private POA poa;
- private POA irPoa;
- private InterfaceRepository iri;
- private ServantRegistry servantRegistry;
- private ServantRegistry homeServantRegistry;
- private WebClassLoader wcl;
- private ReferenceFactory referenceFactory;
- private ReferenceFactory homeReferenceFactory;
-
- public IORFactory(SessionContainer container, RemoteBinding binding)
- {
- assert container != null : "container is null";
- assert binding != null : "binding is null";
-
- this.container = container;
- this.binding = binding;
- }
-
- // TODO: create a default IIOP annotation
- private static final IIOP defaultIIOP = new IIOP()
- {
- public boolean interfaceRepositorySupported()
- {
- return false;
- }
-
- public String poa()
- {
- return POA_PER_SERVANT;
- }
-
- public Class<? extends Annotation> annotationType()
- {
- return IIOP.class;
- }
- };
-
- // TODO: do I really need this method
- public Object createHomeProxy()
- {
- try
- {
- org.omg.CORBA.Object corbaRef = homeReferenceFactory.createReference(homeRepositoryIds[0]);
-
- EJBHome corbaObj = (EJBHome) PortableRemoteObject.narrow(corbaRef, EJBHome.class);
-
- return corbaObj;
- }
- catch(Exception e)
- {
- throw new RuntimeException(e);
- }
- }
-
- public Object createProxy()
- {
- try
- {
- org.omg.CORBA.Object corbaRef = referenceFactory.createReference(beanRepositoryIds[0]);
-
- EJBObject corbaObj = (EJBObject) PortableRemoteObject.narrow(corbaRef, EJBObject.class);
-
- return corbaObj;
- }
- catch(Exception e)
- {
- throw new RuntimeException(e);
- }
- }
-
- public Object createProxy(Object id)
- {
- try
- {
- org.omg.CORBA.Object corbaRef = referenceFactory.createReferenceWithId(id, beanRepositoryIds[0]);
-
- EJBObject corbaObj = (EJBObject) PortableRemoteObject.narrow(corbaRef, EJBObject.class);
-
- return corbaObj;
- }
- catch(Exception e)
- {
- throw new RuntimeException(e);
- }
- }
-
- private IIOP getIIOP()
- {
- IIOP iiop = container.getAnnotation(IIOP.class);
- if(iiop != null)
- return iiop;
-
- return defaultIIOP;
- }
-
- private String getJndiName()
- {
- return ProxyFactoryHelper.getDefaultRemoteBusinessJndiName(container);
- }
-
- private String getServantName()
- {
- // TODO: is "Servant/" a good prefix for servant name
- return "Servant/" + getJndiName();
- }
-
- private WebServiceMBean getWebServer() throws MalformedObjectNameException
- {
- if(webServiceName == null)
- throw new IllegalStateException("iiop is not going to work without a web service");
-
- return (WebServiceMBean) MBeanProxyExt.create(WebServiceMBean.class, webServiceName);
- }
-
- /**
- * Literal copy from org.jboss.proxy.ejb.IORFactory
- */
- private void rebind(NamingContextExt ctx, String strName, org.omg.CORBA.Object obj) throws Exception
- {
- NameComponent[] name = ctx.to_name(strName);
- NamingContext intermediateCtx = ctx;
-
- for (int i = 0; i < name.length - 1; i++ ) {
- NameComponent[] relativeName = new NameComponent[] { name[i] };
- try {
- intermediateCtx = NamingContextHelper.narrow(
- intermediateCtx.resolve(relativeName));
- }
- catch (NotFound e) {
- intermediateCtx = intermediateCtx.bind_new_context(relativeName);
- }
- }
- intermediateCtx.rebind(new NameComponent[] { name[name.length - 1] }, obj);
- }
-
- private void removeWebClassLoader() throws MalformedObjectNameException
- {
- getWebServer().removeClassLoader(wcl);
- }
-
- public void setWebServiceName(String name)
- {
- this.webServiceName = name;
- }
-
- public void start() throws Exception
- {
- // TODO: IORFactory only supports 1 remote interface
- Class remoteInterfaces[] = ProxyFactoryHelper.getRemoteAndBusinessRemoteInterfaces(container);
- if(remoteInterfaces.length > 1)
- log.warn("IIOP binding only works on 1 interface, using: " + remoteInterfaces[0].getName());
- InterfaceAnalysis interfaceAnalysis = InterfaceAnalysis.getInterfaceAnalysis(remoteInterfaces[0]);
- this.beanRepositoryIds = interfaceAnalysis.getAllTypeIds();
-
- InterfaceAnalysis homeInterfaceAnalysis = null;
- Class homeInterface = ProxyFactoryHelper.getRemoteHomeInterface(container);
- if(homeInterface != null)
- {
- if(!EJBHome.class.isAssignableFrom(homeInterface))
- throw new IllegalArgumentException("home interface " + homeInterface.getName() + " must extend javax.ejb.EJBHome (EJB3 4.6.8)");
- homeInterfaceAnalysis = InterfaceAnalysis.getInterfaceAnalysis(homeInterface);
- this.homeRepositoryIds = homeInterfaceAnalysis.getAllTypeIds();
- }
- // To allow EJB3 Stateless beans to operate we can function without a home interface.
-
- // Get orb and irPoa references
- try {
- orb = (ORB)InitialContextFactory.getInitialContext().lookup("java:/" + CorbaORBService.ORB_NAME);
- }
- catch (NamingException e) {
- throw new Exception("Cannot lookup java:/" + CorbaORBService.ORB_NAME + ": " + e);
- }
- try {
- irPoa = (POA)InitialContextFactory.getInitialContext().lookup("java:/" + CorbaORBService.IR_POA_NAME);
- }
- catch (NamingException e) {
- throw new Exception("Cannot lookup java:/" + CorbaORBService.IR_POA_NAME + ": " + e);
- }
-
- IIOP iiop = getIIOP();
- if(iiop.interfaceRepositorySupported())
- {
- this.iri = new InterfaceRepository(orb, irPoa, getJndiName());
- iri.mapClass(remoteInterfaces[0]);
- if(homeInterface != null)
- iri.mapClass(homeInterface);
- iri.finishBuild();
- }
-
- // TODO: obtain the iiop invoker name properly
- ObjectName invokerName = new ObjectName("jboss:service=invoker,type=iiop");
- ServantRegistries servantRegistries = (ServantRegistries) Registry.lookup(invokerName);
- if(servantRegistries == null)
- throw new Exception("can't find iiop invoker");
- ServantRegistryKind registryWithTransientPOA;
- ServantRegistryKind registryWithPersistentPOA;
- if(iiop.poa().equals(IIOP.POA_PER_SERVANT))
- {
- registryWithTransientPOA = ServantRegistryKind.TRANSIENT_POA_PER_SERVANT;
- registryWithPersistentPOA = ServantRegistryKind.PERSISTENT_POA_PER_SERVANT;
- }
- else if(iiop.poa().equals(IIOP.POA_SHARED))
- {
- registryWithTransientPOA = ServantRegistryKind.SHARED_TRANSIENT_POA;
- registryWithPersistentPOA = ServantRegistryKind.SHARED_PERSISTENT_POA;
- }
- else
- throw new IllegalArgumentException("@IIOP.poa can only be 'per-servant' or 'shared'");
- // Only works for session container
- this.servantRegistry = servantRegistries.getServantRegistry(registryWithTransientPOA);
- this.homeServantRegistry = servantRegistries.getServantRegistry(registryWithPersistentPOA); // TODO: why is home interface in persistent poa?
-
- // Hack in a WebCL (from org.jboss.ejb.EjbModule.initializeContainer)
- // TODO: seting up a WebClassLoader needs to be done somewhere where
- ObjectName on = container.getObjectName();
- this.wcl = new EJB3IIOPWebClassLoader(on, (RealClassLoader) ((SessionContainer) container).getClassloader(), getJndiName());
- WebServiceMBean webServer = getWebServer();
- URL[] codebaseURLs = {webServer.addClassLoader(wcl)};
- wcl.setWebURLs(codebaseURLs);
-
- // setup a codebase policy, the CodebaseInterceptor will translate this to a TAG_JAVA_CODEBASE
- String codebaseString = wcl.getCodebaseString();
- log.debug("codebase = " + codebaseString);
- Any codebase = orb.create_any();
- codebase.insert_string(codebaseString);
- Policy codebasePolicy;
- codebasePolicy = orb.create_policy(CodebasePolicy.TYPE, codebase);
-
- // Create csiv2Policy for both home and remote containing
- // IorSecurityConfigMetadata
- Any secPolicy = orb.create_any();
-// IorSecurityConfigMetaData iorSecurityConfigMetaData =
-// container.getBeanMetaData().getIorSecurityConfigMetaData();
- IorSecurityConfigMetaData iorSecurityConfigMetaData = new IorSecurityConfigMetaData(); // TODO: make ior security configurable
- secPolicy.insert_Value(iorSecurityConfigMetaData);
- Policy csiv2Policy = orb.create_policy(CSIv2Policy.TYPE, secPolicy);
-
- Policy policies[] = { codebasePolicy, csiv2Policy };
-
- InterfaceDef interfaceDef = null;
- if(iri != null)
- {
- Repository ir = iri.getReference();
- interfaceDef = InterfaceDefHelper.narrow(ir.lookup_id(beanRepositoryIds[0]));
- }
-
- Current poaCurrent = CurrentHelper.narrow(orb.resolve_initial_references("POACurrent"));
-
- NamingContextExt ctx = getNamingContextExt();
-
- log.debug("binding servant name " + getServantName());
-
- Servant servant = new BeanCorbaServant(this, poaCurrent, container, interfaceDef, interfaceAnalysis);
- this.referenceFactory = servantRegistry.bind(getServantName(), servant, policies);
-
- EJBObject corbaObj = (EJBObject) createProxy();
-
- rebind(ctx, getJndiName(), (org.omg.CORBA.Object) corbaObj);
-
- // TODO: use iri
- if(homeInterfaceAnalysis != null)
- {
- servant = new BeanCorbaServant(this, poaCurrent, container, null, homeInterfaceAnalysis);
- this.homeReferenceFactory = homeServantRegistry.bind(getServantName() + "Home", servant, policies);
-
- Object homeObject = createHomeProxy();
-
- rebind(ctx, ProxyFactoryHelper.getHomeJndiName(container), (org.omg.CORBA.Object) homeObject);
- }
-
- // bind HandleDelegate stuff
- Context compCtx = (Context) InitialContextFactory.getInitialContext().lookup("java:comp");
- NonSerializableFactory.rebind(compCtx, "ORB", orb);
- NonSerializableFactory.rebind(compCtx, "HandleDelegate", new HandleDelegateImpl());
- }
-
- public void stop() throws Exception
- {
- if(homeReferenceFactory != null)
- {
- unbind(ProxyFactoryHelper.getHomeJndiName(container));
- unbindHomeServant();
- }
- unbind(getJndiName());
-
- unbindServant();
-
- removeWebClassLoader();
- }
-
- /**
- * Unbind the bean from CosNaming
- */
- private void unbind(String strName)
- {
- try
- {
- NamingContextExt corbaContext = getNamingContextExt();
- NameComponent n[] = corbaContext.to_name(strName);
- getNamingContextExt().unbind(n);
- }
- catch(Exception e)
- {
- log.warn("unable to unbind '" + strName + "'", e);
- }
- }
-
- private void unbindHomeServant()
- {
- try
- {
- homeServantRegistry.unbind(getServantName() + "Home");
- }
- catch(Exception e)
- {
- log.warn("unable to unbind home servant", e);
- }
- }
-
- private void unbindServant()
- {
- try
- {
- servantRegistry.unbind(getServantName());
- }
- catch(Exception e)
- {
- log.warn("unable to unbind servant", e);
- }
- }
-
- private NamingContextExt getNamingContextExt() throws NamingException
- {
- Context initialContext = InitialContextFactory.getInitialContext();
-
- // NOTE: eclipse editor parser crashes silently on this line (because of org.jboss.iiop.CorbaNamingService) with unknown reason
- // that's why this method is at the end
- return NamingContextExtHelper.narrow((org.omg.CORBA.Object) initialContext.lookup("java:/" + org.jboss.iiop.CorbaNamingService.NAMING_NAME));
- }
-}
\ No newline at end of file
Copied: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/iiop/IORFactory.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/iiop/IORFactory.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/iiop/IORFactory.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/iiop/IORFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,435 @@
+/*
+ * 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.iiop;
+
+import java.lang.annotation.Annotation;
+import java.net.URL;
+
+import javax.ejb.EJBHome;
+import javax.ejb.EJBObject;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.rmi.PortableRemoteObject;
+
+import org.jboss.classloading.spi.RealClassLoader;
+import org.jboss.ejb3.InitialContextFactory;
+import org.jboss.ejb3.NonSerializableFactory;
+import org.jboss.ejb3.ProxyFactoryHelper;
+import org.jboss.ejb3.annotation.IIOP;
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.remoting.RemoteProxyFactory;
+import org.jboss.ejb3.session.SessionContainer;
+import org.jboss.iiop.CorbaORBService;
+import org.jboss.iiop.codebase.CodebasePolicy;
+import org.jboss.iiop.csiv2.CSIv2Policy;
+import org.jboss.iiop.rmi.InterfaceAnalysis;
+import org.jboss.iiop.rmi.ir.InterfaceRepository;
+import org.jboss.invocation.iiop.ReferenceFactory;
+import org.jboss.invocation.iiop.ServantRegistries;
+import org.jboss.invocation.iiop.ServantRegistry;
+import org.jboss.invocation.iiop.ServantRegistryKind;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.IorSecurityConfigMetaData;
+import org.jboss.mx.util.MBeanProxyExt;
+import org.jboss.proxy.ejb.handle.HandleDelegateImpl;
+import org.jboss.system.Registry;
+import org.jboss.web.WebClassLoader;
+import org.jboss.web.WebServiceMBean;
+import org.omg.CORBA.Any;
+import org.omg.CORBA.InterfaceDef;
+import org.omg.CORBA.InterfaceDefHelper;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.Policy;
+import org.omg.CORBA.Repository;
+import org.omg.CosNaming.NameComponent;
+import org.omg.CosNaming.NamingContext;
+import org.omg.CosNaming.NamingContextExt;
+import org.omg.CosNaming.NamingContextExtHelper;
+import org.omg.CosNaming.NamingContextHelper;
+import org.omg.CosNaming.NamingContextPackage.NotFound;
+import org.omg.PortableServer.Current;
+import org.omg.PortableServer.CurrentHelper;
+import org.omg.PortableServer.POA;
+import org.omg.PortableServer.Servant;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision$
+ */
+public class IORFactory
+ implements RemoteProxyFactory
+{
+ private static final Logger log = Logger.getLogger(IORFactory.class);
+
+ private SessionContainer container;
+ private RemoteBinding binding;
+ private String webServiceName = "jboss:service=WebService"; // TODO: make webServiceName configurable
+
+ // after start available
+ private String beanRepositoryIds[];
+ private String homeRepositoryIds[];
+// private InterfaceAnalysis interfaceAnalysis;
+ private ORB orb;
+// private POA poa;
+ private POA irPoa;
+ private InterfaceRepository iri;
+ private ServantRegistry servantRegistry;
+ private ServantRegistry homeServantRegistry;
+ private WebClassLoader wcl;
+ private ReferenceFactory referenceFactory;
+ private ReferenceFactory homeReferenceFactory;
+
+ public IORFactory(SessionContainer container, RemoteBinding binding)
+ {
+ assert container != null : "container is null";
+ assert binding != null : "binding is null";
+
+ this.container = container;
+ this.binding = binding;
+ }
+
+ // TODO: create a default IIOP annotation
+ private static final IIOP defaultIIOP = new IIOP()
+ {
+ public boolean interfaceRepositorySupported()
+ {
+ return false;
+ }
+
+ public String poa()
+ {
+ return POA_PER_SERVANT;
+ }
+
+ public Class<? extends Annotation> annotationType()
+ {
+ return IIOP.class;
+ }
+ };
+
+ // TODO: do I really need this method
+ public Object createHomeProxy()
+ {
+ try
+ {
+ org.omg.CORBA.Object corbaRef = homeReferenceFactory.createReference(homeRepositoryIds[0]);
+
+ EJBHome corbaObj = (EJBHome) PortableRemoteObject.narrow(corbaRef, EJBHome.class);
+
+ return corbaObj;
+ }
+ catch(Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public Object createProxyBusiness()
+ {
+ try
+ {
+ org.omg.CORBA.Object corbaRef = referenceFactory.createReference(beanRepositoryIds[0]);
+
+ EJBObject corbaObj = (EJBObject) PortableRemoteObject.narrow(corbaRef, EJBObject.class);
+
+ return corbaObj;
+ }
+ catch(Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public Object createProxyBusiness(Object id)
+ {
+ try
+ {
+ org.omg.CORBA.Object corbaRef = referenceFactory.createReferenceWithId(id, beanRepositoryIds[0]);
+
+ EJBObject corbaObj = (EJBObject) PortableRemoteObject.narrow(corbaRef, EJBObject.class);
+
+ return corbaObj;
+ }
+ catch(Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private IIOP getIIOP()
+ {
+ IIOP iiop = container.getAnnotation(IIOP.class);
+ if(iiop != null)
+ return iiop;
+
+ return defaultIIOP;
+ }
+
+ private String getJndiName()
+ {
+ return ProxyFactoryHelper.getDefaultRemoteBusinessJndiName(container);
+ }
+
+ private String getServantName()
+ {
+ // TODO: is "Servant/" a good prefix for servant name
+ return "Servant/" + getJndiName();
+ }
+
+ private WebServiceMBean getWebServer() throws MalformedObjectNameException
+ {
+ if(webServiceName == null)
+ throw new IllegalStateException("iiop is not going to work without a web service");
+
+ return (WebServiceMBean) MBeanProxyExt.create(WebServiceMBean.class, webServiceName);
+ }
+
+ /**
+ * Literal copy from org.jboss.proxy.ejb.IORFactory
+ */
+ private void rebind(NamingContextExt ctx, String strName, org.omg.CORBA.Object obj) throws Exception
+ {
+ NameComponent[] name = ctx.to_name(strName);
+ NamingContext intermediateCtx = ctx;
+
+ for (int i = 0; i < name.length - 1; i++ ) {
+ NameComponent[] relativeName = new NameComponent[] { name[i] };
+ try {
+ intermediateCtx = NamingContextHelper.narrow(
+ intermediateCtx.resolve(relativeName));
+ }
+ catch (NotFound e) {
+ intermediateCtx = intermediateCtx.bind_new_context(relativeName);
+ }
+ }
+ intermediateCtx.rebind(new NameComponent[] { name[name.length - 1] }, obj);
+ }
+
+ private void removeWebClassLoader() throws MalformedObjectNameException
+ {
+ getWebServer().removeClassLoader(wcl);
+ }
+
+ public void setWebServiceName(String name)
+ {
+ this.webServiceName = name;
+ }
+
+ public void start() throws Exception
+ {
+ // TODO: IORFactory only supports 1 remote interface
+ Class remoteInterfaces[] = ProxyFactoryHelper.getRemoteAndBusinessRemoteInterfaces(container);
+ if(remoteInterfaces.length > 1)
+ log.warn("IIOP binding only works on 1 interface, using: " + remoteInterfaces[0].getName());
+ InterfaceAnalysis interfaceAnalysis = InterfaceAnalysis.getInterfaceAnalysis(remoteInterfaces[0]);
+ this.beanRepositoryIds = interfaceAnalysis.getAllTypeIds();
+
+ InterfaceAnalysis homeInterfaceAnalysis = null;
+ Class homeInterface = ProxyFactoryHelper.getRemoteHomeInterface(container);
+ if(homeInterface != null)
+ {
+ if(!EJBHome.class.isAssignableFrom(homeInterface))
+ throw new IllegalArgumentException("home interface " + homeInterface.getName() + " must extend javax.ejb.EJBHome (EJB3 4.6.8)");
+ homeInterfaceAnalysis = InterfaceAnalysis.getInterfaceAnalysis(homeInterface);
+ this.homeRepositoryIds = homeInterfaceAnalysis.getAllTypeIds();
+ }
+ // To allow EJB3 Stateless beans to operate we can function without a home interface.
+
+ // Get orb and irPoa references
+ try {
+ orb = (ORB)InitialContextFactory.getInitialContext().lookup("java:/" + CorbaORBService.ORB_NAME);
+ }
+ catch (NamingException e) {
+ throw new Exception("Cannot lookup java:/" + CorbaORBService.ORB_NAME + ": " + e);
+ }
+ try {
+ irPoa = (POA)InitialContextFactory.getInitialContext().lookup("java:/" + CorbaORBService.IR_POA_NAME);
+ }
+ catch (NamingException e) {
+ throw new Exception("Cannot lookup java:/" + CorbaORBService.IR_POA_NAME + ": " + e);
+ }
+
+ IIOP iiop = getIIOP();
+ if(iiop.interfaceRepositorySupported())
+ {
+ this.iri = new InterfaceRepository(orb, irPoa, getJndiName());
+ iri.mapClass(remoteInterfaces[0]);
+ if(homeInterface != null)
+ iri.mapClass(homeInterface);
+ iri.finishBuild();
+ }
+
+ // TODO: obtain the iiop invoker name properly
+ ObjectName invokerName = new ObjectName("jboss:service=invoker,type=iiop");
+ ServantRegistries servantRegistries = (ServantRegistries) Registry.lookup(invokerName);
+ if(servantRegistries == null)
+ throw new Exception("can't find iiop invoker");
+ ServantRegistryKind registryWithTransientPOA;
+ ServantRegistryKind registryWithPersistentPOA;
+ if(iiop.poa().equals(IIOP.POA_PER_SERVANT))
+ {
+ registryWithTransientPOA = ServantRegistryKind.TRANSIENT_POA_PER_SERVANT;
+ registryWithPersistentPOA = ServantRegistryKind.PERSISTENT_POA_PER_SERVANT;
+ }
+ else if(iiop.poa().equals(IIOP.POA_SHARED))
+ {
+ registryWithTransientPOA = ServantRegistryKind.SHARED_TRANSIENT_POA;
+ registryWithPersistentPOA = ServantRegistryKind.SHARED_PERSISTENT_POA;
+ }
+ else
+ throw new IllegalArgumentException("@IIOP.poa can only be 'per-servant' or 'shared'");
+ // Only works for session container
+ this.servantRegistry = servantRegistries.getServantRegistry(registryWithTransientPOA);
+ this.homeServantRegistry = servantRegistries.getServantRegistry(registryWithPersistentPOA); // TODO: why is home interface in persistent poa?
+
+ // Hack in a WebCL (from org.jboss.ejb.EjbModule.initializeContainer)
+ // TODO: seting up a WebClassLoader needs to be done somewhere where
+ ObjectName on = container.getObjectName();
+ this.wcl = new EJB3IIOPWebClassLoader(on, (RealClassLoader) ((SessionContainer) container).getClassloader(), getJndiName());
+ WebServiceMBean webServer = getWebServer();
+ URL[] codebaseURLs = {webServer.addClassLoader(wcl)};
+ wcl.setWebURLs(codebaseURLs);
+
+ // setup a codebase policy, the CodebaseInterceptor will translate this to a TAG_JAVA_CODEBASE
+ String codebaseString = wcl.getCodebaseString();
+ log.debug("codebase = " + codebaseString);
+ Any codebase = orb.create_any();
+ codebase.insert_string(codebaseString);
+ Policy codebasePolicy;
+ codebasePolicy = orb.create_policy(CodebasePolicy.TYPE, codebase);
+
+ // Create csiv2Policy for both home and remote containing
+ // IorSecurityConfigMetadata
+ Any secPolicy = orb.create_any();
+// IorSecurityConfigMetaData iorSecurityConfigMetaData =
+// container.getBeanMetaData().getIorSecurityConfigMetaData();
+ IorSecurityConfigMetaData iorSecurityConfigMetaData = new IorSecurityConfigMetaData(); // TODO: make ior security configurable
+ secPolicy.insert_Value(iorSecurityConfigMetaData);
+ Policy csiv2Policy = orb.create_policy(CSIv2Policy.TYPE, secPolicy);
+
+ Policy policies[] = { codebasePolicy, csiv2Policy };
+
+ InterfaceDef interfaceDef = null;
+ if(iri != null)
+ {
+ Repository ir = iri.getReference();
+ interfaceDef = InterfaceDefHelper.narrow(ir.lookup_id(beanRepositoryIds[0]));
+ }
+
+ Current poaCurrent = CurrentHelper.narrow(orb.resolve_initial_references("POACurrent"));
+
+ NamingContextExt ctx = getNamingContextExt();
+
+ log.debug("binding servant name " + getServantName());
+
+ Servant servant = new BeanCorbaServant(this, poaCurrent, container, interfaceDef, interfaceAnalysis);
+ this.referenceFactory = servantRegistry.bind(getServantName(), servant, policies);
+
+ EJBObject corbaObj = (EJBObject) createProxyBusiness();
+
+ rebind(ctx, getJndiName(), (org.omg.CORBA.Object) corbaObj);
+
+ // TODO: use iri
+ if(homeInterfaceAnalysis != null)
+ {
+ servant = new BeanCorbaServant(this, poaCurrent, container, null, homeInterfaceAnalysis);
+ this.homeReferenceFactory = homeServantRegistry.bind(getServantName() + "Home", servant, policies);
+
+ Object homeObject = createHomeProxy();
+
+ rebind(ctx, ProxyFactoryHelper.getHomeJndiName(container), (org.omg.CORBA.Object) homeObject);
+ }
+
+ // bind HandleDelegate stuff
+ Context compCtx = (Context) InitialContextFactory.getInitialContext().lookup("java:comp");
+ NonSerializableFactory.rebind(compCtx, "ORB", orb);
+ NonSerializableFactory.rebind(compCtx, "HandleDelegate", new HandleDelegateImpl());
+ }
+
+ public void stop() throws Exception
+ {
+ if(homeReferenceFactory != null)
+ {
+ unbind(ProxyFactoryHelper.getHomeJndiName(container));
+ unbindHomeServant();
+ }
+ unbind(getJndiName());
+
+ unbindServant();
+
+ removeWebClassLoader();
+ }
+
+ /**
+ * Unbind the bean from CosNaming
+ */
+ private void unbind(String strName)
+ {
+ try
+ {
+ NamingContextExt corbaContext = getNamingContextExt();
+ NameComponent n[] = corbaContext.to_name(strName);
+ getNamingContextExt().unbind(n);
+ }
+ catch(Exception e)
+ {
+ log.warn("unable to unbind '" + strName + "'", e);
+ }
+ }
+
+ private void unbindHomeServant()
+ {
+ try
+ {
+ homeServantRegistry.unbind(getServantName() + "Home");
+ }
+ catch(Exception e)
+ {
+ log.warn("unable to unbind home servant", e);
+ }
+ }
+
+ private void unbindServant()
+ {
+ try
+ {
+ servantRegistry.unbind(getServantName());
+ }
+ catch(Exception e)
+ {
+ log.warn("unable to unbind servant", e);
+ }
+ }
+
+ private NamingContextExt getNamingContextExt() throws NamingException
+ {
+ Context initialContext = InitialContextFactory.getInitialContext();
+
+ // NOTE: eclipse editor parser crashes silently on this line (because of org.jboss.iiop.CorbaNamingService) with unknown reason
+ // that's why this method is at the end
+ return NamingContextExtHelper.narrow((org.omg.CORBA.Object) initialContext.lookup("java:/" + org.jboss.iiop.CorbaNamingService.NAMING_NAME));
+ }
+}
\ No newline at end of file
Modified: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/javaee/AbstractJavaEEComponent.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/javaee/AbstractJavaEEComponent.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/javaee/AbstractJavaEEComponent.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -25,7 +25,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public abstract class AbstractJavaEEComponent implements JavaEEComponent
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/javaee/JavaEEApplication.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/javaee/JavaEEApplication.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/javaee/JavaEEApplication.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -25,7 +25,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public interface JavaEEApplication
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/javaee/JavaEEComponent.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/javaee/JavaEEComponent.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/javaee/JavaEEComponent.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -27,7 +27,7 @@
* EE 2.2
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public interface JavaEEComponent
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/javaee/JavaEEComponentHelper.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/javaee/JavaEEComponentHelper.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/javaee/JavaEEComponentHelper.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -30,7 +30,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class JavaEEComponentHelper
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/javaee/JavaEEModule.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/javaee/JavaEEModule.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/javaee/JavaEEModule.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -27,7 +27,7 @@
* Java EE components and an optional module level deployment descriptor.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public interface JavaEEModule
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/javaee/SimpleJavaEEApplication.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/javaee/SimpleJavaEEApplication.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/javaee/SimpleJavaEEApplication.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -25,7 +25,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class SimpleJavaEEApplication implements JavaEEApplication
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/kernel/JNDIKernelRegistryPlugin.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/kernel/JNDIKernelRegistryPlugin.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/kernel/JNDIKernelRegistryPlugin.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -38,7 +38,7 @@
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
* @author <a href="mailto:ajustin at redhat.com">Ales Justin</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class JNDIKernelRegistryPlugin implements KernelRegistryPlugin
{
Deleted: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/mdb/LocalProducerFactory.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/mdb/LocalProducerFactory.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/mdb/LocalProducerFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -1,90 +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.mdb;
-
-import java.util.Hashtable;
-
-import javax.jms.Destination;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-import org.jboss.aop.advice.Interceptor;
-import org.jboss.ejb3.NonSerializableFactory;
-import org.jboss.ejb3.annotation.MessageProperties;
-
-/**
- * comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- */
-public class LocalProducerFactory extends ProducerFactory
-{
- protected String factoryName;
-
- public LocalProducerFactory(ConsumerContainer container, Class producer, MessageProperties props, Destination dest, InitialContext ctx, Hashtable icProperties)
- {
- super(container, producer, props, dest, ctx, icProperties);
-
- try
- {
- factoryName = pImpl.connectionFactory();
- if (factoryName.equals("")) factoryName = "java:/ConnectionFactory";
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- }
-
- public Object createProxy()
- {
- Class[] interfaces = {producer, ProducerObject.class};
-
- ProducerManagerImpl mImpl = null;
-
- mImpl = new ProducerManagerImpl(dest, factoryName, props.delivery(), props.timeToLive(), props.priority(),
- methodMap, initialContextProperties, pImpl.transacted(), pImpl.acknowledgeMode());
-
- Interceptor[] interceptors = {mImpl};
- ProducerProxy ih = new ProducerProxy(mImpl, interceptors);
- return java.lang.reflect.Proxy.newProxyInstance(producer.getClassLoader(), interfaces, ih);
- }
-
- public void start() throws Exception
- {
- super.start();
- try{
- NonSerializableFactory.rebind(ctx, jndiName + PROXY_FACTORY_NAME, this);
- } catch (NamingException e)
- {
- NamingException namingException = new NamingException("Could not bind local producer factory with name " + factoryName + " into JNDI under jndiName: " + ctx.getNameInNamespace() + "/" + jndiName + PROXY_FACTORY_NAME);
- namingException.setRootCause(e);
- throw namingException;
- }
- }
-
- public void stop() throws Exception
- {
- super.stop();
- NonSerializableFactory.unbind(ctx, jndiName + PROXY_FACTORY_NAME);
- }
-}
Copied: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/mdb/LocalProducerFactory.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/mdb/LocalProducerFactory.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/mdb/LocalProducerFactory.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/mdb/LocalProducerFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -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.mdb;
+
+import java.util.Hashtable;
+
+import javax.jms.Destination;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.ejb3.NonSerializableFactory;
+import org.jboss.ejb3.annotation.MessageProperties;
+
+/**
+ * comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ */
+public class LocalProducerFactory extends ProducerFactory
+{
+ protected String factoryName;
+
+ public LocalProducerFactory(ConsumerContainer container, Class producer, MessageProperties props, Destination dest, InitialContext ctx, Hashtable icProperties)
+ {
+ super(container, producer, props, dest, ctx, icProperties);
+
+ try
+ {
+ factoryName = pImpl.connectionFactory();
+ if (factoryName.equals("")) factoryName = "java:/ConnectionFactory";
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public Object createProxyBusiness()
+ {
+ Class[] interfaces = {producer, ProducerObject.class};
+
+ ProducerManagerImpl mImpl = null;
+
+ mImpl = new ProducerManagerImpl(dest, factoryName, props.delivery(), props.timeToLive(), props.priority(),
+ methodMap, initialContextProperties, pImpl.transacted(), pImpl.acknowledgeMode());
+
+ Interceptor[] interceptors = {mImpl};
+ ProducerProxy ih = new ProducerProxy(mImpl, interceptors);
+ return java.lang.reflect.Proxy.newProxyInstance(producer.getClassLoader(), interfaces, ih);
+ }
+
+ public void start() throws Exception
+ {
+ super.start();
+ try{
+ NonSerializableFactory.rebind(ctx, jndiName + PROXY_FACTORY_NAME, this);
+ } catch (NamingException e)
+ {
+ NamingException namingException = new NamingException("Could not bind local producer factory with name " + factoryName + " into JNDI under jndiName: " + ctx.getNameInNamespace() + "/" + jndiName + PROXY_FACTORY_NAME);
+ namingException.setRootCause(e);
+ throw namingException;
+ }
+ }
+
+ public void stop() throws Exception
+ {
+ super.stop();
+ NonSerializableFactory.unbind(ctx, jndiName + PROXY_FACTORY_NAME);
+ }
+}
Modified: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/mdb/MessageDrivenContextImpl.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/mdb/MessageDrivenContextImpl.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/mdb/MessageDrivenContextImpl.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -29,7 +29,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class MessageDrivenContextImpl extends EJBContextImpl<MessagingContainer, MDBContext> implements MessageDrivenContext
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/mdb/MessagingDelegateWrapper.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/mdb/MessagingDelegateWrapper.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/mdb/MessagingDelegateWrapper.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -27,7 +27,7 @@
* TODO: implement proper mdb stats
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class MessagingDelegateWrapper extends ContainerDelegateWrapper<MessagingContainer>
implements MessagingDelegateWrapperMBean
Deleted: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/mdb/ProducerFactory.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/mdb/ProducerFactory.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/mdb/ProducerFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -1,155 +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.mdb;
-
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Hashtable;
-
-import javax.jms.Destination;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.Name;
-import javax.naming.NamingException;
-import javax.naming.RefAddr;
-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.logging.Logger;
-import org.jboss.util.naming.Util;
-
-/**
- * comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- */
-public abstract class ProducerFactory implements ProxyFactory
-{
- private static final Logger log = Logger.getLogger(ProducerFactory.class);
-
- protected Class producer;
- protected MessageProperties props;
- protected Destination dest;
- protected HashMap methodMap;
- protected ProducerImpl pImpl;
- protected String jndiName;
- protected InitialContext ctx;
- 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)
- {
- this.producer = producer;
- this.props = props;
- this.dest = dest;
- this.ctx = ctx;
- this.initialContextProperties = ctxProperties;
-
-
- methodMap = new HashMap();
-// Method[] methods = producer.getMethods();
-// for (int i = 0 ; i < methods.length ; ++i)
-// {
-// MessageProperties mProps = (MessageProperties)methods[i].getAnnotation(MessageProperties.class);
-// if (mProps != null)
-// {
-// try
-// {
-// methodMap.put(new Long(MethodHashing.methodHash(methods[i])), new MessagePropertiesImpl(mProps));
-// }
-// catch (Exception e)
-// {
-// throw new RuntimeException(e);
-// }
-// }
-// }
-
- Producer p = (Producer) producer.getAnnotation(Producer.class);
- if (p == null)
- p = (Producer)container.resolveAnnotation(Producer.class);
- if (p == null)
- {
- Producers annotation = (Producers)container.resolveAnnotation(Producers.class);
- Producer[] producers = annotation.value();
- for (int i = 0 ; i < producers.length ; ++i)
- {
- if (producers[i].producer() != null && producers[i].producer().equals(producer))
- p = producers[i];
- }
- }
-
- pImpl = new ProducerImpl(p);
- jndiName = producer.getName();
- }
-
- public Object createHomeProxy()
- {
- throw new UnsupportedOperationException("producer can't have a home interface");
- }
-
- public Object createProxy(Object id)
- {
- if(id != null)
- throw new IllegalArgumentException("producer proxy must not have an id");
- return createProxy();
- }
-
- public void setContainer(Container container)
- {
- }
-
- public void start() throws Exception
- {
- Context baseCtx = ctx;
- 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);
-
- try
- {
- Util.rebind(baseCtx, atom, ref);
- } catch (NamingException e)
- {
- NamingException namingException = new NamingException("Could not bind producer factory into JNDI under jndiName: " + baseCtx.getNameInNamespace() + "/" + atom);
- namingException.setRootCause(e);
- throw namingException;
- }
- }
-
- public void stop() throws Exception
- {
- Util.unbind(ctx, jndiName);
- }
-}
Copied: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/mdb/ProducerFactory.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/mdb/ProducerFactory.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/mdb/ProducerFactory.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/mdb/ProducerFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,155 @@
+/*
+ * 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.mdb;
+
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Hashtable;
+
+import javax.jms.Destination;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.Name;
+import javax.naming.NamingException;
+import javax.naming.RefAddr;
+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.logging.Logger;
+import org.jboss.util.naming.Util;
+
+/**
+ * comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ */
+public abstract class ProducerFactory implements ProxyFactory
+{
+ private static final Logger log = Logger.getLogger(ProducerFactory.class);
+
+ protected Class producer;
+ protected MessageProperties props;
+ protected Destination dest;
+ protected HashMap methodMap;
+ protected ProducerImpl pImpl;
+ protected String jndiName;
+ protected InitialContext ctx;
+ 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)
+ {
+ this.producer = producer;
+ this.props = props;
+ this.dest = dest;
+ this.ctx = ctx;
+ this.initialContextProperties = ctxProperties;
+
+
+ methodMap = new HashMap();
+// Method[] methods = producer.getMethods();
+// for (int i = 0 ; i < methods.length ; ++i)
+// {
+// MessageProperties mProps = (MessageProperties)methods[i].getAnnotation(MessageProperties.class);
+// if (mProps != null)
+// {
+// try
+// {
+// methodMap.put(new Long(MethodHashing.methodHash(methods[i])), new MessagePropertiesImpl(mProps));
+// }
+// catch (Exception e)
+// {
+// throw new RuntimeException(e);
+// }
+// }
+// }
+
+ Producer p = (Producer) producer.getAnnotation(Producer.class);
+ if (p == null)
+ p = (Producer)container.resolveAnnotation(Producer.class);
+ if (p == null)
+ {
+ Producers annotation = (Producers)container.resolveAnnotation(Producers.class);
+ Producer[] producers = annotation.value();
+ for (int i = 0 ; i < producers.length ; ++i)
+ {
+ if (producers[i].producer() != null && producers[i].producer().equals(producer))
+ p = producers[i];
+ }
+ }
+
+ pImpl = new ProducerImpl(p);
+ jndiName = producer.getName();
+ }
+
+ public Object createHomeProxy()
+ {
+ throw new UnsupportedOperationException("producer can't have a home interface");
+ }
+
+ public Object createProxyBusiness(Object id)
+ {
+ if(id != null)
+ throw new IllegalArgumentException("producer proxy must not have an id");
+ return createProxyBusiness();
+ }
+
+ public void setContainer(Container container)
+ {
+ }
+
+ public void start() throws Exception
+ {
+ Context baseCtx = ctx;
+ 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);
+
+ try
+ {
+ Util.rebind(baseCtx, atom, ref);
+ } catch (NamingException e)
+ {
+ NamingException namingException = new NamingException("Could not bind producer factory into JNDI under jndiName: " + baseCtx.getNameInNamespace() + "/" + atom);
+ namingException.setRootCause(e);
+ throw namingException;
+ }
+ }
+
+ public void stop() throws Exception
+ {
+ Util.unbind(ctx, jndiName);
+ }
+}
Deleted: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/mdb/RemoteProducerFactory.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/mdb/RemoteProducerFactory.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/mdb/RemoteProducerFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -1,105 +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.mdb;
-
-import java.util.Hashtable;
-
-import javax.jms.ConnectionFactory;
-import javax.jms.Destination;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-import org.jboss.aop.Dispatcher;
-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.util.naming.Util;
-
-/**
- * comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- */
-public class RemoteProducerFactory extends ProducerFactory
-{
- protected ConnectionFactory factory;
-
- public RemoteProducerFactory(ConsumerContainer container, Class producer, MessageProperties props, Destination dest, InitialContext ctx, Hashtable initialContextProperties)
- {
- super(container, producer, props, dest, ctx, initialContextProperties);
- try
- {
- String factoryName = pImpl.connectionFactory();
- if (factoryName.equals("")) factoryName = "ConnectionFactory";
- factory = (ConnectionFactory) ctx.lookup(factoryName);
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- }
-
- public void setContainer(Container container)
- {
- }
-
- public Object createProxy()
- {
- Class[] interfaces = {producer, ProducerObject.class};
-
- ProducerManagerImpl mImpl = null;
-
- mImpl = new ProducerManagerImpl(dest, factory, props.delivery(), props.timeToLive(), props.priority(), methodMap,
- initialContextProperties, pImpl.transacted(), pImpl.acknowledgeMode());
-
- Interceptor[] interceptors = {mImpl};
- ProducerProxy ih = new ProducerProxy(mImpl, interceptors);
- return java.lang.reflect.Proxy.newProxyInstance(producer.getClassLoader(), interfaces, ih);
- }
-
- public void start() throws Exception
- {
- super.start();
- Class[] interfaces = {ProxyFactory.class};
- Object factoryProxy = Remoting.createPojiProxy(jndiName + PROXY_FACTORY_NAME, interfaces, RemoteProxyFactory.DEFAULT_CLIENT_BINDING);
- try
- {
- Util.rebind(ctx, jndiName + PROXY_FACTORY_NAME, factoryProxy);
- } catch (NamingException e)
- {
- NamingException namingException = new NamingException("Could not bind remote producer factory into JNDI under jndiName: " + ctx.getNameInNamespace() + "/" + jndiName + PROXY_FACTORY_NAME);
- namingException.setRootCause(e);
- throw namingException;
- }
- Dispatcher.singleton.registerTarget(jndiName + PROXY_FACTORY_NAME, this);
- }
-
- public void stop() throws Exception
- {
- super.stop();
- Util.unbind(ctx, jndiName + PROXY_FACTORY_NAME);
- Dispatcher.singleton.unregisterTarget(jndiName + PROXY_FACTORY_NAME);
- }
-}
Copied: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/mdb/RemoteProducerFactory.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/mdb/RemoteProducerFactory.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/mdb/RemoteProducerFactory.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/mdb/RemoteProducerFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,105 @@
+/*
+ * 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.mdb;
+
+import java.util.Hashtable;
+
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.aop.Dispatcher;
+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.util.naming.Util;
+
+/**
+ * comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ */
+public class RemoteProducerFactory extends ProducerFactory
+{
+ protected ConnectionFactory factory;
+
+ public RemoteProducerFactory(ConsumerContainer container, Class producer, MessageProperties props, Destination dest, InitialContext ctx, Hashtable initialContextProperties)
+ {
+ super(container, producer, props, dest, ctx, initialContextProperties);
+ try
+ {
+ String factoryName = pImpl.connectionFactory();
+ if (factoryName.equals("")) factoryName = "ConnectionFactory";
+ factory = (ConnectionFactory) ctx.lookup(factoryName);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public void setContainer(Container container)
+ {
+ }
+
+ public Object createProxyBusiness()
+ {
+ Class[] interfaces = {producer, ProducerObject.class};
+
+ ProducerManagerImpl mImpl = null;
+
+ mImpl = new ProducerManagerImpl(dest, factory, props.delivery(), props.timeToLive(), props.priority(), methodMap,
+ initialContextProperties, pImpl.transacted(), pImpl.acknowledgeMode());
+
+ Interceptor[] interceptors = {mImpl};
+ ProducerProxy ih = new ProducerProxy(mImpl, interceptors);
+ return java.lang.reflect.Proxy.newProxyInstance(producer.getClassLoader(), interfaces, ih);
+ }
+
+ public void start() throws Exception
+ {
+ super.start();
+ Class[] interfaces = {ProxyFactory.class};
+ Object factoryProxy = Remoting.createPojiProxy(jndiName + PROXY_FACTORY_NAME, interfaces, RemoteProxyFactory.DEFAULT_CLIENT_BINDING);
+ try
+ {
+ Util.rebind(ctx, jndiName + PROXY_FACTORY_NAME, factoryProxy);
+ } catch (NamingException e)
+ {
+ NamingException namingException = new NamingException("Could not bind remote producer factory into JNDI under jndiName: " + ctx.getNameInNamespace() + "/" + jndiName + PROXY_FACTORY_NAME);
+ namingException.setRootCause(e);
+ throw namingException;
+ }
+ Dispatcher.singleton.registerTarget(jndiName + PROXY_FACTORY_NAME, this);
+ }
+
+ public void stop() throws Exception
+ {
+ super.stop();
+ Util.unbind(ctx, jndiName + PROXY_FACTORY_NAME);
+ Dispatcher.singleton.unregisterTarget(jndiName + PROXY_FACTORY_NAME);
+ }
+}
Modified: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/metadata/JBossMessageDrivenBeanGenericWrapper.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/metadata/JBossMessageDrivenBeanGenericWrapper.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/metadata/JBossMessageDrivenBeanGenericWrapper.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -80,7 +80,7 @@
* Create a wrapper around a JBossGenericBeanMetaData for MDB meta data.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@Deprecated
public class JBossMessageDrivenBeanGenericWrapper extends JBossMessageDrivenBeanMetaData
Modified: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/metadata/jpa/spec/PersistenceUnitMetaData.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/metadata/jpa/spec/PersistenceUnitMetaData.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/metadata/jpa/spec/PersistenceUnitMetaData.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -31,7 +31,7 @@
* A wrapper around Hibernate's PersistenceMetadata.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class PersistenceUnitMetaData implements MappableMetaData, Serializable
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/metadata/jpa/spec/PersistenceUnitsMetaData.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/metadata/jpa/spec/PersistenceUnitsMetaData.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/metadata/jpa/spec/PersistenceUnitsMetaData.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -33,7 +33,7 @@
* Currently a wrapper around the Hibernate metadata.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class PersistenceUnitsMetaData extends AbstractMappedMetaData<PersistenceUnitMetaData>
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/protocol/jarjar/Handler.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/protocol/jarjar/Handler.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/protocol/jarjar/Handler.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -37,7 +37,7 @@
*
* @see javax.persistence.spi.PersistenceUnitInfo#getPersistenceUnitRootUrl()
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class Handler extends URLStreamHandler
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/protocol/jarjar/JarJarInputStream.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/protocol/jarjar/JarJarInputStream.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/protocol/jarjar/JarJarInputStream.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -40,7 +40,7 @@
* using a subset of a jar file.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class JarJarInputStream extends InputStream
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/protocol/jarjar/JarJarURLConnection.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/protocol/jarjar/JarJarURLConnection.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/protocol/jarjar/JarJarURLConnection.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -35,7 +35,7 @@
* Connect to a jarjar.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class JarJarURLConnection extends URLConnection
{
Deleted: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/service/BaseServiceProxyFactory.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/service/BaseServiceProxyFactory.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/service/BaseServiceProxyFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -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.service;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationHandler;
-
-import javax.naming.Context;
-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 createProxy(Object id)
- {
- if(id != null)
- throw new IllegalArgumentException("service proxy must not have an id");
- return createProxy();
- }
-
- 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, createProxy());
- } 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/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/service/BaseServiceProxyFactory.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/service/BaseServiceProxyFactory.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/service/BaseServiceProxyFactory.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/service/BaseServiceProxyFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -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.service;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationHandler;
+
+import javax.naming.Context;
+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() {};
+}
Deleted: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/service/ServiceContainer.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/service/ServiceContainer.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/service/ServiceContainer.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -1,629 +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.util.Hashtable;
-import java.util.List;
-
-import javax.ejb.Handle;
-import javax.ejb.Timer;
-import javax.ejb.TimerService;
-import javax.management.Attribute;
-import javax.management.AttributeList;
-import javax.management.AttributeNotFoundException;
-import javax.management.InstanceNotFoundException;
-import javax.management.InvalidAttributeValueException;
-import javax.management.MBeanException;
-import javax.management.MBeanInfo;
-import javax.management.MBeanRegistrationException;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-import javax.management.ReflectionException;
-
-import org.jboss.aop.Domain;
-import org.jboss.aop.MethodInfo;
-import org.jboss.aop.joinpoint.Invocation;
-import org.jboss.aop.joinpoint.InvocationResponse;
-import org.jboss.aop.joinpoint.MethodInvocation;
-import org.jboss.aop.util.MethodHashing;
-import org.jboss.aop.util.PayloadKey;
-import org.jboss.aspects.asynch.FutureHolder;
-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.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;
-
-/**
- * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
- * @version $Revision$
- */
-public class ServiceContainer extends SessionContainer implements TimedObjectInvoker
-{
- ServiceMBeanDelegate delegate;
- Object singleton;
- BeanContext beanContext;
- MBeanServer mbeanServer;
- ObjectName delegateObjectName;
- private TimerService timerService;
- private Object mbean = new ServiceDelegateWrapper(this);
-
- @SuppressWarnings("unused")
- private static final Logger log = Logger.getLogger(ServiceContainer.class);
-
- public ServiceContainer(MBeanServer server, ClassLoader cl, String beanClassName, String ejbName,
- Domain domain, Hashtable ctxProperties,
- Ejb3Deployment deployment, JBossServiceBeanMetaData beanMetaData) throws ClassNotFoundException
- {
- super(cl, beanClassName, ejbName, domain, ctxProperties, deployment, beanMetaData);
- this.mbeanServer = server;
- }
-
- public void callTimeout(Timer timer) throws Exception
- {
- /*
- Method timeout = callbackHandler.getTimeoutCallback();
- if (timeout == null) throw new EJBException("No method has been annotated with @Timeout");
- Object[] args = {timer};
- AllowedOperationsAssociation.pushInMethodFlag(AllowedOperationsFlags.IN_EJB_TIMEOUT);
- try
- {
- localInvoke(timeout, args);
- }
- catch(Throwable throwable)
- {
- if (throwable instanceof Exception) throw (Exception) throwable;
- if(throwable instanceof Error) throw (Error) throwable;
- throw new RuntimeException(throwable);
- }
- finally
- {
- AllowedOperationsAssociation.popInMethodFlag();
- }
- */
- // FIXME: interceptors
- throw new RuntimeException("NYI");
- }
-
- @Override
- public BeanContext<?> createBeanContext()
- {
- return new ServiceBeanContext(this, singleton);
- }
-
- @Override
- protected ProxyFactory createProxyFactory(LocalBinding binding)
- {
- return new ServiceLocalProxyFactory(this, binding);
- }
-
- @Override
- protected RemoteProxyFactory createProxyFactory(RemoteBinding binding)
- {
- // TODO Implement clustering
- return new ServiceRemoteProxyFactory(this, binding);
- }
-
- public Object createSession(Class initTypes[], Object initArgs[])
- {
-// if((initTypes != null && initTypes.length > 0) || (initArgs != null && initArgs.length > 0))
-// throw new IllegalArgumentException("service bean create method must take no arguments");
- throw new RuntimeException("NYI");
- }
-
- public Object getMBean()
- {
- return mbean;
- }
-
- public Object getSingleton()
- {
- return singleton;
- }
-
- public void create() throws Exception
- {
- super.create();
-
- // EJBTHREE-655: fire up an instance for use as MBean delegate
- singleton = super.construct();
-
- // won't work, before starting the management interface MBean injection must have been done.
- //registerManagementInterface();
-
- invokeOptionalMethod("create");
- }
-
- @Override
- protected List<Class<?>> resolveBusinessInterfaces()
- {
- List<Class<?>> interfaces = super.resolveBusinessInterfaces();
- Management man = (Management) resolveAnnotation(Management.class);
- if (man != null)
- {
- Class iface = man.value();
- if (iface != null)
- {
- interfaces.add(iface);
- }
- }
-
- Class[] implIfaces = getBeanClass().getInterfaces();
- for (Class<?> iface : implIfaces)
- {
- if (iface.getAnnotation(Management.class) != null)
- {
- interfaces.add(iface);
- }
- }
- return interfaces;
- }
-
- protected void reinitialize()
- {
- super.reinitialize();
-
- singleton = super.construct();
-
- invokeOptionalMethod("create");
- }
-
- public void start() throws Exception
- {
- super.start();
-
- try
- {
- initBeanContext();
-
- // make sure the timer service is there before injection takes place
- timerService = TimerServiceFactory.getInstance().createTimerService(this, this);
-
- injectDependencies(beanContext);
-
- // TODO: EJBTHREE-655: shouldn't happen here, but in create
- registerManagementInterface();
-
- TimerServiceFactory.getInstance().restoreTimerService(timerService);
-
- invokeOptionalMethod("start");
- }
- catch (Exception e)
- {
- e.printStackTrace();
- stop();
- }
- }
-
- public void stop() throws Exception
- {
- invokeOptionalMethod("stop");
-
- if (timerService != null)
- {
- TimerServiceFactory.getInstance().removeTimerService(timerService);
- timerService = null;
- }
-
- // TODO: EJBTHREE-655: shouldn't happen here, but in destroy
- unregisterManagementInterface();
-
- singleton = null;
- beanContext = null;
-
- super.stop();
- }
-
- public void destroy() throws Exception
- {
- invokeOptionalMethod("destroy");
-
- //unregisterManagementInterface();
-
- super.destroy();
- }
-
- public void initializePool() throws Exception
- {
- resolveInjectors();
- }
-
- public TimerService getTimerService()
- {
- return timerService;
- }
-
- public TimerService getTimerService(Object pKey)
- {
- assert timerService != null : "Timer Service not yet initialized";
- return timerService;
- }
-
- /**
- * Invoke a method on the singleton without a specific security or transaction context.
- *
- * @param methodName
- */
- private void invokeOptionalMethod(String methodName)
- {
- /* EJBTHREE-655 has been postponed
- ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
- try
- {
- Thread.currentThread().setContextClassLoader(classloader);
- Class parameterTypes[] = { };
- Method method = clazz.getMethod(methodName, parameterTypes);
- Object args[] = { };
- method.invoke(singleton, args);
- }
- catch(NoSuchMethodException e)
- {
- // ignore
- }
- catch (IllegalArgumentException e)
- {
- throw new RuntimeException(e);
- }
- catch (IllegalAccessException e)
- {
- throw new RuntimeException(e);
- }
- catch (InvocationTargetException e)
- {
- throw new RuntimeException(e.getCause());
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(oldLoader);
- }
- */
- }
-
- public void invokePostConstruct(BeanContext beanContext, Object[] params)
- {
- //Ignore
- }
-
- public void invokePreDestroy(BeanContext beanContext)
- {
- //Ignore
- }
-
- public Object localInvoke(Object id, Method method, Object[] args, FutureHolder provider) throws Throwable
- {
- return localInvoke(method, args, provider);
- }
-
- public Object localHomeInvoke(Method method, Object[] args) throws Throwable
- {
- // no home interface for Service beans
- return null;
- }
-
- /**
- * Performs a synchronous local invocation
- */
- public Object localInvoke(Method method, Object[] args) throws Throwable
- {
- return localInvoke(method, args, null);
- }
-
- /**
- * Performs a synchronous or asynchronous local invocation
- *
- * @param provider If null a synchronous invocation, otherwise an asynchronous
- */
- public Object localInvoke(Method method, Object[] args, FutureHolder provider) throws Throwable
- {
- long start = System.currentTimeMillis();
-
- ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
- try
- {
- invokeStats.callIn();
-
- Thread.currentThread().setContextClassLoader(classloader);
- long hash = MethodHashing.calculateHash(method);
- MethodInfo info = getAdvisor().getMethodInfo(hash);
- if (info == null)
- {
- throw new RuntimeException("Could not resolve beanClass method from proxy call: " + method.toString());
- }
- EJBContainerInvocation nextInvocation = new EJBContainerInvocation(info);
- nextInvocation.setAdvisor(getAdvisor());
- nextInvocation.setArguments(args);
-
- nextInvocation = populateInvocation(nextInvocation);
-
- if (provider != null)
- {
- nextInvocation.getMetaData().addMetaData(AsynchronousInterceptor.ASYNCH, AsynchronousInterceptor.INVOKE_ASYNCH, "YES", PayloadKey.AS_IS);
- nextInvocation.getMetaData().addMetaData(AsynchronousInterceptor.ASYNCH, AsynchronousInterceptor.FUTURE_HOLDER, provider, PayloadKey.AS_IS);
- }
- return nextInvocation.invokeNext();
- }
- finally
- {
- if (method != null)
- {
- long end = System.currentTimeMillis();
- long elapsed = end - start;
- invokeStats.updateStats(method, elapsed);
- }
-
- invokeStats.callOut();
-
- Thread.currentThread().setContextClassLoader(oldLoader);
- }
- }
-
- public InvocationResponse dynamicInvoke(Object target, Invocation invocation) throws Throwable
- {
- long start = System.currentTimeMillis();
-
- ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
- EJBContainerInvocation newSi = null;
-
- MethodInvocation si = (MethodInvocation) invocation;
- MethodInfo info = getAdvisor().getMethodInfo(si.getMethodHash());
- Method method = info.getUnadvisedMethod();
- try
- {
- invokeStats.callIn();
-
- Thread.currentThread().setContextClassLoader(classloader);
-
- if (info == null)
- {
- throw new RuntimeException("Could not resolve beanClass method from proxy call");
- }
- newSi = new EJBContainerInvocation(info);
- newSi.setArguments(si.getArguments());
- newSi.setMetaData(si.getMetaData());
- newSi.setAdvisor(getAdvisor());
-
- newSi = populateInvocation(newSi);
-
- Object rtn = null;
- try
- {
- rtn = newSi.invokeNext();
- }
- catch (Throwable throwable)
- {
- return marshallException(invocation, throwable, newSi.getResponseContextInfo());
- }
- InvocationResponse response = SessionContainer.marshallResponse(invocation, rtn, newSi.getResponseContextInfo());
-
- return response;
- }
- finally
- {
- if (method != null)
- {
- long end = System.currentTimeMillis();
- long elapsed = end - start;
- invokeStats.updateStats(method, elapsed);
- }
-
- invokeStats.callOut();
-
- Thread.currentThread().setContextClassLoader(oldLoader);
- }
- }
-
- protected void initBeanContext() throws RuntimeException
- {
- if (beanContext == null)
- {
- synchronized(singleton)
- {
- if (beanContext == null)
- {
- beanContext = createBeanContext();
- beanContext.initialiseInterceptorInstances();
- }
- }
- }
- }
-
- public BeanContext<?> peekContext()
- {
- return beanContext;
- }
-
- @Override
- protected EJBContainerInvocation populateInvocation(EJBContainerInvocation invocation)
- {
- invocation.setTargetObject(singleton);
- invocation.setBeanContext(beanContext);
- return invocation;
- }
-
- protected synchronized void injectDependencies(BeanContext ctx)
- {
- if (injectors != null)
- {
- try
- {
- pushEnc();
- for (Injector injector : injectors)
- {
- injector.inject(ctx);
- }
- }
- finally
- {
- popEnc();
- }
- }
- }
-
- // Dynamic MBean implementation --------------------------------------------------
-
- public Object getAttribute(String attribute) throws AttributeNotFoundException,
- MBeanException, ReflectionException
- {
- return delegate.getAttribute(attribute);
- }
-
- public void setAttribute(Attribute attribute) throws AttributeNotFoundException,
- InvalidAttributeValueException, MBeanException, ReflectionException
- {
- delegate.setAttribute(attribute);
- }
-
- public AttributeList getAttributes(String[] attributes)
- {
- return delegate.getAttributes(attributes);
- }
-
- public AttributeList setAttributes(AttributeList attributes)
- {
- return delegate.setAttributes(attributes);
- }
-
- public Object invoke(String actionName, Object params[], String signature[])
- throws MBeanException, ReflectionException
- {
- return delegate.invoke(actionName, params, signature);
- }
-
- @Override
- protected Object invokeEJBObjectMethod(ProxyFactory factory, Object id, MethodInfo info, Object[] args) throws Exception
- {
- throw new RuntimeException("NYI");
- }
-
- public MBeanInfo getMBeanInfo()
- {
- return delegate.getMBeanInfo();
- }
-
- public Object createLocalProxy(Object id, LocalBinding binding) throws Exception
- {
- ServiceLocalProxyFactory factory = new ServiceLocalProxyFactory(this, binding);
-
- return factory.createProxy(id);
- }
-
- public Object createRemoteProxy(Object id, RemoteBinding binding) throws Exception
- {
- ServiceRemoteProxyFactory factory = new ServiceRemoteProxyFactory(this, binding);
-
- return factory.createProxy(id);
- }
-
- private void registerManagementInterface()
- {
- try
- {
- Management annotation = (Management)resolveAnnotation(Management.class);
-
- Class intf = null;
- if (annotation != null)
- intf = annotation.value();
-
- if (intf ==null)
- {
- Class[] interfaces = this.getBeanClass().getInterfaces();
- int interfaceIndex = 0;
- while (intf == null && interfaceIndex < interfaces.length)
- {
- if (interfaces[interfaceIndex].getAnnotation(Management.class) != null)
- intf = interfaces[interfaceIndex];
- else
- ++interfaceIndex;
- }
- }
-
- if (intf != null)
- {
- if (mbeanServer == null)
- mbeanServer = org.jboss.mx.util.MBeanServerLocator.locateJBoss();
-
- if (mbeanServer == null)
- throw new RuntimeException("There is a @Management interface on " + ejbName + " but the MBeanServer has not been initialized for it");
-
- Service service = (Service)resolveAnnotation(Service.class);
-
- String objname = service.objectName();
- delegateObjectName = (objname == null || objname.equals("")) ?
- new ObjectName(getObjectName().getCanonicalName() + ",type=ManagementInterface") : new ObjectName(service.objectName());
-
- delegate = new ServiceMBeanDelegate(mbeanServer, this, intf, delegateObjectName);
-
- getDeployment().getKernelAbstraction().installMBean(delegateObjectName, getDependencyPolicy(), delegate);
- }
- else
- {
- Service service = (Service)resolveAnnotation(Service.class);
- if (service.xmbean().length() > 0)
- {
- if (mbeanServer == null)
- mbeanServer = org.jboss.mx.util.MBeanServerLocator.locateJBoss();
-
- if (mbeanServer == null)
- throw new RuntimeException(ejbName + "is defined as an XMBean, but the MBeanServer has not been initialized for it");
-
- String objname = service.objectName();
- delegateObjectName = (objname == null || objname.equals("")) ?
- new ObjectName(getObjectName().getCanonicalName() + ",type=ManagementInterface") : new ObjectName(service.objectName());
-
- delegate = new ServiceMBeanDelegate(mbeanServer, this, service.xmbean(), delegateObjectName);
-
- getDeployment().getKernelAbstraction().installMBean(delegateObjectName, getDependencyPolicy(), delegate);
- }
- }
-
- }
- catch (Exception e)
- {
- throw new RuntimeException("Problem registering @Management interface for @Service " + getBeanClass(), e);
- }
- }
-
- private void unregisterManagementInterface() throws InstanceNotFoundException, MBeanRegistrationException
- {
- if (delegate != null)
- {
- getDeployment().getKernelAbstraction().uninstallMBean(delegateObjectName);
- }
- }
-
- protected void removeHandle(Handle handle)
- {
- throw new RuntimeException("Don't do this");
- }
-}
Copied: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/service/ServiceContainer.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/service/ServiceContainer.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/service/ServiceContainer.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/service/ServiceContainer.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,629 @@
+/*
+ * 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.util.Hashtable;
+import java.util.List;
+
+import javax.ejb.Handle;
+import javax.ejb.Timer;
+import javax.ejb.TimerService;
+import javax.management.Attribute;
+import javax.management.AttributeList;
+import javax.management.AttributeNotFoundException;
+import javax.management.InstanceNotFoundException;
+import javax.management.InvalidAttributeValueException;
+import javax.management.MBeanException;
+import javax.management.MBeanInfo;
+import javax.management.MBeanRegistrationException;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.management.ReflectionException;
+
+import org.jboss.aop.Domain;
+import org.jboss.aop.MethodInfo;
+import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.aop.joinpoint.InvocationResponse;
+import org.jboss.aop.joinpoint.MethodInvocation;
+import org.jboss.aop.util.MethodHashing;
+import org.jboss.aop.util.PayloadKey;
+import org.jboss.aspects.asynch.FutureHolder;
+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.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;
+
+/**
+ * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
+ * @version $Revision$
+ */
+public class ServiceContainer extends SessionContainer implements TimedObjectInvoker
+{
+ ServiceMBeanDelegate delegate;
+ Object singleton;
+ BeanContext beanContext;
+ MBeanServer mbeanServer;
+ ObjectName delegateObjectName;
+ private TimerService timerService;
+ private Object mbean = new ServiceDelegateWrapper(this);
+
+ @SuppressWarnings("unused")
+ private static final Logger log = Logger.getLogger(ServiceContainer.class);
+
+ public ServiceContainer(MBeanServer server, ClassLoader cl, String beanClassName, String ejbName,
+ Domain domain, Hashtable ctxProperties,
+ Ejb3Deployment deployment, JBossServiceBeanMetaData beanMetaData) throws ClassNotFoundException
+ {
+ super(cl, beanClassName, ejbName, domain, ctxProperties, deployment, beanMetaData);
+ this.mbeanServer = server;
+ }
+
+ public void callTimeout(Timer timer) throws Exception
+ {
+ /*
+ Method timeout = callbackHandler.getTimeoutCallback();
+ if (timeout == null) throw new EJBException("No method has been annotated with @Timeout");
+ Object[] args = {timer};
+ AllowedOperationsAssociation.pushInMethodFlag(AllowedOperationsFlags.IN_EJB_TIMEOUT);
+ try
+ {
+ localInvoke(timeout, args);
+ }
+ catch(Throwable throwable)
+ {
+ if (throwable instanceof Exception) throw (Exception) throwable;
+ if(throwable instanceof Error) throw (Error) throwable;
+ throw new RuntimeException(throwable);
+ }
+ finally
+ {
+ AllowedOperationsAssociation.popInMethodFlag();
+ }
+ */
+ // FIXME: interceptors
+ throw new RuntimeException("NYI");
+ }
+
+ @Override
+ public BeanContext<?> createBeanContext()
+ {
+ return new ServiceBeanContext(this, singleton);
+ }
+
+ @Override
+ protected ProxyFactory getProxyFactory(LocalBinding binding)
+ {
+ return new ServiceLocalProxyFactory(this, binding);
+ }
+
+ @Override
+ protected RemoteProxyFactory getProxyFactory(RemoteBinding binding)
+ {
+ // TODO Implement clustering
+ return new ServiceRemoteProxyFactory(this, binding);
+ }
+
+ public Object createSession(Class initTypes[], Object initArgs[])
+ {
+// if((initTypes != null && initTypes.length > 0) || (initArgs != null && initArgs.length > 0))
+// throw new IllegalArgumentException("service bean create method must take no arguments");
+ throw new RuntimeException("NYI");
+ }
+
+ public Object getMBean()
+ {
+ return mbean;
+ }
+
+ public Object getSingleton()
+ {
+ return singleton;
+ }
+
+ public void create() throws Exception
+ {
+ super.create();
+
+ // EJBTHREE-655: fire up an instance for use as MBean delegate
+ singleton = super.construct();
+
+ // won't work, before starting the management interface MBean injection must have been done.
+ //registerManagementInterface();
+
+ invokeOptionalMethod("create");
+ }
+
+ @Override
+ protected List<Class<?>> resolveBusinessInterfaces()
+ {
+ List<Class<?>> interfaces = super.resolveBusinessInterfaces();
+ Management man = (Management) resolveAnnotation(Management.class);
+ if (man != null)
+ {
+ Class iface = man.value();
+ if (iface != null)
+ {
+ interfaces.add(iface);
+ }
+ }
+
+ Class[] implIfaces = getBeanClass().getInterfaces();
+ for (Class<?> iface : implIfaces)
+ {
+ if (iface.getAnnotation(Management.class) != null)
+ {
+ interfaces.add(iface);
+ }
+ }
+ return interfaces;
+ }
+
+ protected void reinitialize()
+ {
+ super.reinitialize();
+
+ singleton = super.construct();
+
+ invokeOptionalMethod("create");
+ }
+
+ public void start() throws Exception
+ {
+ super.start();
+
+ try
+ {
+ initBeanContext();
+
+ // make sure the timer service is there before injection takes place
+ timerService = TimerServiceFactory.getInstance().createTimerService(this, this);
+
+ injectDependencies(beanContext);
+
+ // TODO: EJBTHREE-655: shouldn't happen here, but in create
+ registerManagementInterface();
+
+ TimerServiceFactory.getInstance().restoreTimerService(timerService);
+
+ invokeOptionalMethod("start");
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ stop();
+ }
+ }
+
+ public void stop() throws Exception
+ {
+ invokeOptionalMethod("stop");
+
+ if (timerService != null)
+ {
+ TimerServiceFactory.getInstance().removeTimerService(timerService);
+ timerService = null;
+ }
+
+ // TODO: EJBTHREE-655: shouldn't happen here, but in destroy
+ unregisterManagementInterface();
+
+ singleton = null;
+ beanContext = null;
+
+ super.stop();
+ }
+
+ public void destroy() throws Exception
+ {
+ invokeOptionalMethod("destroy");
+
+ //unregisterManagementInterface();
+
+ super.destroy();
+ }
+
+ public void initializePool() throws Exception
+ {
+ resolveInjectors();
+ }
+
+ public TimerService getTimerService()
+ {
+ return timerService;
+ }
+
+ public TimerService getTimerService(Object pKey)
+ {
+ assert timerService != null : "Timer Service not yet initialized";
+ return timerService;
+ }
+
+ /**
+ * Invoke a method on the singleton without a specific security or transaction context.
+ *
+ * @param methodName
+ */
+ private void invokeOptionalMethod(String methodName)
+ {
+ /* EJBTHREE-655 has been postponed
+ ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ Thread.currentThread().setContextClassLoader(classloader);
+ Class parameterTypes[] = { };
+ Method method = clazz.getMethod(methodName, parameterTypes);
+ Object args[] = { };
+ method.invoke(singleton, args);
+ }
+ catch(NoSuchMethodException e)
+ {
+ // ignore
+ }
+ catch (IllegalArgumentException e)
+ {
+ throw new RuntimeException(e);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new RuntimeException(e);
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new RuntimeException(e.getCause());
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(oldLoader);
+ }
+ */
+ }
+
+ public void invokePostConstruct(BeanContext beanContext, Object[] params)
+ {
+ //Ignore
+ }
+
+ public void invokePreDestroy(BeanContext beanContext)
+ {
+ //Ignore
+ }
+
+ public Object localInvoke(Object id, Method method, Object[] args, FutureHolder provider) throws Throwable
+ {
+ return localInvoke(method, args, provider);
+ }
+
+ public Object localHomeInvoke(Method method, Object[] args) throws Throwable
+ {
+ // no home interface for Service beans
+ return null;
+ }
+
+ /**
+ * Performs a synchronous local invocation
+ */
+ public Object localInvoke(Method method, Object[] args) throws Throwable
+ {
+ return localInvoke(method, args, null);
+ }
+
+ /**
+ * Performs a synchronous or asynchronous local invocation
+ *
+ * @param provider If null a synchronous invocation, otherwise an asynchronous
+ */
+ public Object localInvoke(Method method, Object[] args, FutureHolder provider) throws Throwable
+ {
+ long start = System.currentTimeMillis();
+
+ ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ invokeStats.callIn();
+
+ Thread.currentThread().setContextClassLoader(classloader);
+ long hash = MethodHashing.calculateHash(method);
+ MethodInfo info = getAdvisor().getMethodInfo(hash);
+ if (info == null)
+ {
+ throw new RuntimeException("Could not resolve beanClass method from proxy call: " + method.toString());
+ }
+ EJBContainerInvocation nextInvocation = new EJBContainerInvocation(info);
+ nextInvocation.setAdvisor(getAdvisor());
+ nextInvocation.setArguments(args);
+
+ nextInvocation = populateInvocation(nextInvocation);
+
+ if (provider != null)
+ {
+ nextInvocation.getMetaData().addMetaData(AsynchronousInterceptor.ASYNCH, AsynchronousInterceptor.INVOKE_ASYNCH, "YES", PayloadKey.AS_IS);
+ nextInvocation.getMetaData().addMetaData(AsynchronousInterceptor.ASYNCH, AsynchronousInterceptor.FUTURE_HOLDER, provider, PayloadKey.AS_IS);
+ }
+ return nextInvocation.invokeNext();
+ }
+ finally
+ {
+ if (method != null)
+ {
+ long end = System.currentTimeMillis();
+ long elapsed = end - start;
+ invokeStats.updateStats(method, elapsed);
+ }
+
+ invokeStats.callOut();
+
+ Thread.currentThread().setContextClassLoader(oldLoader);
+ }
+ }
+
+ public InvocationResponse dynamicInvoke(Object target, Invocation invocation) throws Throwable
+ {
+ long start = System.currentTimeMillis();
+
+ ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
+ EJBContainerInvocation newSi = null;
+
+ MethodInvocation si = (MethodInvocation) invocation;
+ MethodInfo info = getAdvisor().getMethodInfo(si.getMethodHash());
+ Method method = info.getUnadvisedMethod();
+ try
+ {
+ invokeStats.callIn();
+
+ Thread.currentThread().setContextClassLoader(classloader);
+
+ if (info == null)
+ {
+ throw new RuntimeException("Could not resolve beanClass method from proxy call");
+ }
+ newSi = new EJBContainerInvocation(info);
+ newSi.setArguments(si.getArguments());
+ newSi.setMetaData(si.getMetaData());
+ newSi.setAdvisor(getAdvisor());
+
+ newSi = populateInvocation(newSi);
+
+ Object rtn = null;
+ try
+ {
+ rtn = newSi.invokeNext();
+ }
+ catch (Throwable throwable)
+ {
+ return marshallException(invocation, throwable, newSi.getResponseContextInfo());
+ }
+ InvocationResponse response = SessionContainer.marshallResponse(invocation, rtn, newSi.getResponseContextInfo());
+
+ return response;
+ }
+ finally
+ {
+ if (method != null)
+ {
+ long end = System.currentTimeMillis();
+ long elapsed = end - start;
+ invokeStats.updateStats(method, elapsed);
+ }
+
+ invokeStats.callOut();
+
+ Thread.currentThread().setContextClassLoader(oldLoader);
+ }
+ }
+
+ protected void initBeanContext() throws RuntimeException
+ {
+ if (beanContext == null)
+ {
+ synchronized(singleton)
+ {
+ if (beanContext == null)
+ {
+ beanContext = createBeanContext();
+ beanContext.initialiseInterceptorInstances();
+ }
+ }
+ }
+ }
+
+ public BeanContext<?> peekContext()
+ {
+ return beanContext;
+ }
+
+ @Override
+ protected EJBContainerInvocation populateInvocation(EJBContainerInvocation invocation)
+ {
+ invocation.setTargetObject(singleton);
+ invocation.setBeanContext(beanContext);
+ return invocation;
+ }
+
+ protected synchronized void injectDependencies(BeanContext ctx)
+ {
+ if (injectors != null)
+ {
+ try
+ {
+ pushEnc();
+ for (Injector injector : injectors)
+ {
+ injector.inject(ctx);
+ }
+ }
+ finally
+ {
+ popEnc();
+ }
+ }
+ }
+
+ // Dynamic MBean implementation --------------------------------------------------
+
+ public Object getAttribute(String attribute) throws AttributeNotFoundException,
+ MBeanException, ReflectionException
+ {
+ return delegate.getAttribute(attribute);
+ }
+
+ public void setAttribute(Attribute attribute) throws AttributeNotFoundException,
+ InvalidAttributeValueException, MBeanException, ReflectionException
+ {
+ delegate.setAttribute(attribute);
+ }
+
+ public AttributeList getAttributes(String[] attributes)
+ {
+ return delegate.getAttributes(attributes);
+ }
+
+ public AttributeList setAttributes(AttributeList attributes)
+ {
+ return delegate.setAttributes(attributes);
+ }
+
+ public Object invoke(String actionName, Object params[], String signature[])
+ throws MBeanException, ReflectionException
+ {
+ return delegate.invoke(actionName, params, signature);
+ }
+
+ @Override
+ protected Object invokeEJBObjectMethod(ProxyFactory factory, Object id, MethodInfo info, Object[] args) throws Exception
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public MBeanInfo getMBeanInfo()
+ {
+ return delegate.getMBeanInfo();
+ }
+
+ public Object createLocalProxy(Object id, LocalBinding binding) throws Exception
+ {
+ ServiceLocalProxyFactory factory = new ServiceLocalProxyFactory(this, binding);
+
+ return factory.createProxyBusiness(id);
+ }
+
+ public Object createRemoteProxy(Object id, RemoteBinding binding) throws Exception
+ {
+ ServiceRemoteProxyFactory factory = new ServiceRemoteProxyFactory(this, binding);
+
+ return factory.createProxyBusiness(id);
+ }
+
+ private void registerManagementInterface()
+ {
+ try
+ {
+ Management annotation = (Management)resolveAnnotation(Management.class);
+
+ Class intf = null;
+ if (annotation != null)
+ intf = annotation.value();
+
+ if (intf ==null)
+ {
+ Class[] interfaces = this.getBeanClass().getInterfaces();
+ int interfaceIndex = 0;
+ while (intf == null && interfaceIndex < interfaces.length)
+ {
+ if (interfaces[interfaceIndex].getAnnotation(Management.class) != null)
+ intf = interfaces[interfaceIndex];
+ else
+ ++interfaceIndex;
+ }
+ }
+
+ if (intf != null)
+ {
+ if (mbeanServer == null)
+ mbeanServer = org.jboss.mx.util.MBeanServerLocator.locateJBoss();
+
+ if (mbeanServer == null)
+ throw new RuntimeException("There is a @Management interface on " + ejbName + " but the MBeanServer has not been initialized for it");
+
+ Service service = (Service)resolveAnnotation(Service.class);
+
+ String objname = service.objectName();
+ delegateObjectName = (objname == null || objname.equals("")) ?
+ new ObjectName(getObjectName().getCanonicalName() + ",type=ManagementInterface") : new ObjectName(service.objectName());
+
+ delegate = new ServiceMBeanDelegate(mbeanServer, this, intf, delegateObjectName);
+
+ getDeployment().getKernelAbstraction().installMBean(delegateObjectName, getDependencyPolicy(), delegate);
+ }
+ else
+ {
+ Service service = (Service)resolveAnnotation(Service.class);
+ if (service.xmbean().length() > 0)
+ {
+ if (mbeanServer == null)
+ mbeanServer = org.jboss.mx.util.MBeanServerLocator.locateJBoss();
+
+ if (mbeanServer == null)
+ throw new RuntimeException(ejbName + "is defined as an XMBean, but the MBeanServer has not been initialized for it");
+
+ String objname = service.objectName();
+ delegateObjectName = (objname == null || objname.equals("")) ?
+ new ObjectName(getObjectName().getCanonicalName() + ",type=ManagementInterface") : new ObjectName(service.objectName());
+
+ delegate = new ServiceMBeanDelegate(mbeanServer, this, service.xmbean(), delegateObjectName);
+
+ getDeployment().getKernelAbstraction().installMBean(delegateObjectName, getDependencyPolicy(), delegate);
+ }
+ }
+
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Problem registering @Management interface for @Service " + getBeanClass(), e);
+ }
+ }
+
+ private void unregisterManagementInterface() throws InstanceNotFoundException, MBeanRegistrationException
+ {
+ if (delegate != null)
+ {
+ getDeployment().getKernelAbstraction().uninstallMBean(delegateObjectName);
+ }
+ }
+
+ protected void removeHandle(Handle handle)
+ {
+ throw new RuntimeException("Don't do this");
+ }
+}
Modified: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/service/ServiceDelegateWrapper.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/service/ServiceDelegateWrapper.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/service/ServiceDelegateWrapper.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -27,7 +27,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class ServiceDelegateWrapper extends ContainerDelegateWrapper<ServiceContainer>
{
Deleted: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/service/ServiceLocalProxyFactory.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/service/ServiceLocalProxyFactory.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/service/ServiceLocalProxyFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -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 createProxy()
- {
- 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());
- }
- }
-
-}
Copied: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/service/ServiceLocalProxyFactory.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/service/ServiceLocalProxyFactory.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/service/ServiceLocalProxyFactory.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/service/ServiceLocalProxyFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,85 @@
+/*
+ * 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/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/service/ServiceRemoteProxyFactory.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/service/ServiceRemoteProxyFactory.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/service/ServiceRemoteProxyFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -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 createProxy()
- {
- 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());
- }
- }
-
-}
Copied: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/service/ServiceRemoteProxyFactory.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/service/ServiceRemoteProxyFactory.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/service/ServiceRemoteProxyFactory.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/service/ServiceRemoteProxyFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,112 @@
+/*
+ * 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/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/BaseSessionProxyFactory.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/BaseSessionProxyFactory.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/BaseSessionProxyFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -1,308 +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.Method;
-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.Remote;
-import javax.ejb.RemoteHome;
-
-import org.jboss.ejb3.EJBContainer;
-import org.jboss.ejb3.Ejb3Registry;
-import org.jboss.ejb3.ProxyFactory;
-import org.jboss.ejb3.ProxyFactoryHelper;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.proxy.EJBMetaDataImpl;
-import org.jboss.ejb3.proxy.handle.HomeHandleImpl;
-import org.jboss.logging.Logger;
-
-/**
- * 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 SessionContainer container;
- protected String containerGuid;
- protected String containerClusterUid;
- protected boolean isClustered = false;
-
- private static final String METHOD_PREFIX_EJB21_CREATE = "create";
-
- public BaseSessionProxyFactory()
- {
- }
-
- protected BaseSessionProxyFactory(SessionContainer container)
- {
- assert container != null : "container is null";
-
- setContainer(container);
- }
-
- public Object createHomeProxy()
- {
- throw new RuntimeException("NYI");
- }
-
- protected void setContainer(SessionContainer container)
- {
- this.container = container;
- this.containerGuid = Ejb3Registry.guid(container);
- this.containerClusterUid = Ejb3Registry.clusterUid(container);
- this.isClustered = container.isClustered();
- }
-
- protected SessionContainer getContainer()
- {
- if (container == null)
- {
- container = (SessionContainer)Ejb3Registry.findContainer(containerGuid);
-
- if (container == null && isClustered)
- container = (SessionContainer)Ejb3Registry.getClusterContainer(containerClusterUid);
- }
-
- return container;
- }
-
- 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;
- }
-
- protected EJBMetaData getEjbMetaData()
- {
- Class<?> remote = null;
- Class<?> home = null;
- Class<?> pkClass = Object.class;
- HomeHandleImpl homeHandle = null;
-
- EJBContainer ejbContainer = (EJBContainer)container;
-
- Remote remoteAnnotation = ejbContainer.getAnnotation(Remote.class);
- if (remoteAnnotation != null)
- remote = remoteAnnotation.value()[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/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/BaseSessionProxyFactory.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/BaseSessionProxyFactory.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/BaseSessionProxyFactory.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/BaseSessionProxyFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,545 @@
+/*
+ * 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.List;
+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.Remote;
+import javax.ejb.RemoteHome;
+
+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;
+
+/**
+ * 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;
+
+ /**
+ * 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 interfaces to be used in the proxies
+ Class<?>[] businessInterfaces = this.getInterfacesForBusinessProxy();
+ Class<?>[] ejb21Interfaces = this.getInterfacesForEjb21Proxy();
+
+ // Obtain this bean class' CL
+ ClassLoader cl = this.getContainer().getBeanClass().getClassLoader();
+
+ // Obtain and set the proxy constructors
+ this.businessProxyConstructor = ProxyFactoryHelper.createProxyConstructor(businessInterfaces, cl);
+ 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 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))
+ {
+ 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
+ *
+ * @return
+ */
+ protected Class<?>[] getInterfacesForEjb21Proxy()
+ {
+ return this.getInterfacesForProxy(this.getProxyAccessType(), SpecificationInterfaceType.EJB21);
+ }
+
+ /**
+ * Returns an array of interfaces to be used for the proxy;
+ * the proxy type will be dependent on
+ *
+ * @param business
+ * @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 EJBLocalObject
+ else
+ {
+ // Add local interfaces
+ intfs.addAll(Arrays.asList(ProxyFactoryHelper.getLocalInterfaces(container)));
+
+ // If no local interfaces, return
+ if (intfs.size() == 0)
+ {
+ return new Class<?>[]
+ {};
+ }
+
+ // 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 EJBObject
+ else
+ {
+ // Add remote interfaces
+ intfs.addAll(Arrays.asList(ProxyFactoryHelper.getRemoteInterfaces(container)));
+
+ // If no remote interfaces, return
+ if(intfs.size()==0)
+ {
+ return new Class<?>[]{};
+ }
+
+ // Add EJBObject
+ intfs.add(EJBObject.class);
+ }
+ }
+
+ // Add all interfaces
+ for (Class<?> interfaze : intfs)
+ {
+ interfaces.add(interfaze);
+ }
+
+ // Ensure more than interface is defined
+ assert interfaces.size() > 0 : "At least one interface must be defined";
+
+ // 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;
+ }
+
+ protected EJBMetaData getEjbMetaData()
+ {
+ Class<?> remote = null;
+ Class<?> home = null;
+ Class<?> pkClass = Object.class;
+ HomeHandleImpl homeHandle = null;
+
+ EJBContainer ejbContainer = (EJBContainer)container;
+
+ Remote remoteAnnotation = ejbContainer.getAnnotation(Remote.class);
+ if (remoteAnnotation != null)
+ remote = remoteAnnotation.value()[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/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/ProxyAccessType.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/ProxyAccessType.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/ProxyAccessType.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/ProxyAccessType.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,32 @@
+/*
+ * 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.session;
+
+/**
+ * Defines access type (remote/local) for client view
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public enum ProxyAccessType {
+ REMOTE, LOCAL
+}
Deleted: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/ProxyDeployer.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/ProxyDeployer.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/ProxyDeployer.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -1,199 +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.lang.reflect.Constructor;
-import java.util.ArrayList;
-import java.util.HashMap;
-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;
-import org.jboss.ejb3.annotation.defaults.RemoteBindingDefaults;
-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.logging.Logger;
-
-/**
- * Delegatee of a SessionContainer for managing proxy factories.
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public class ProxyDeployer
-{
- private static final Logger log = Logger.getLogger(ProxyDeployer.class);
- private SessionContainer container;
- private Map<Object, ProxyFactory> proxyFactories = new HashMap<Object, ProxyFactory>();
- private RemoteBindings remoteBindings;
- private LocalBinding localBinding;
-
- public ProxyDeployer(SessionContainer container)
- {
- assert container != null : "container is null";
-
- this.container = container;
- }
-
- public Map<Object, ProxyFactory> getProxyFactories()
- {
- return proxyFactories;
- }
-
- public ProxyFactory getProxyFactory(Object key)
- {
- return this.getProxyFactories().get(key);
- }
-
- public void start() throws Exception
- {
- if (remoteBindings != null)
- {
- RemoteBinding[] list = remoteBindings.value();
- for(RemoteBinding binding : list)
- {
- assert binding.jndiBinding().length() != 0 : "jndiBinding not set on binding " + binding;
-
- RemoteProxyFactory factory;
- String factoryImplementationRegistryKey = binding.factory();
- if (factoryImplementationRegistryKey.equals(RemoteBindingDefaults.PROXY_FACTORY_DEFAULT))
- {
- factory = container.createProxyFactory(binding);
- }
- else
- {
- Class<? extends RemoteProxyFactory> remoteFactoryClass = container.getDeployment().getRemoteProxyFactoryRegistry().getProxyFactoryClass(binding.factory());
- Constructor<? extends RemoteProxyFactory> constructor = remoteFactoryClass.getConstructor(SessionContainer.class, RemoteBinding.class);
- factory = constructor.newInstance(container, binding);
- }
- factory.start();
- proxyFactories.put(binding,factory);
- }
- }
-
- if (localBinding != null)
- {
- ProxyFactory factory = container.createProxyFactory(localBinding);
- factory.start();
- proxyFactories.put(localBinding,factory);
- }
- }
-
- protected boolean hasJNDIBinding(String jndiName)
- {
- assert jndiName != null : "jndiName is null";
-
- if(localBinding != null)
- {
- if(localBinding.jndiBinding().equals(jndiName))
- return true;
- }
-
- if(remoteBindings != null)
- {
- for(RemoteBinding binding : remoteBindings.value())
- {
- if(binding.jndiBinding().equals(jndiName))
- return true;
- }
- }
-
- return false;
- }
-
- public void initializeLocalBindingMetadata()
- {
- localBinding = (LocalBinding) container.resolveAnnotation(LocalBinding.class);
- if (localBinding == null)
- {
- if (ProxyFactoryHelper.getLocalAndBusinessLocalInterfaces(container).length > 0)
- {
- localBinding = new LocalBindingImpl(ProxyFactoryHelper.getLocalJndiName(container));
- container.getAnnotations().addClassAnnotation(LocalBinding.class, localBinding);
- }
- }
- }
-
- private RemoteBinding initializeRemoteBinding(RemoteBinding binding)
- {
- if(binding.jndiBinding().length() == 0)
- {
- return new RemoteBindingImpl(ProxyFactoryHelper.getDefaultRemoteBusinessJndiName(container), binding
- .interceptorStack(), binding.clientBindUrl(), binding.factory());
- }
- return binding;
- }
-
- public void initializeRemoteBindingMetadata()
- {
- remoteBindings = (RemoteBindings) container.resolveAnnotation(RemoteBindings.class);
- if (remoteBindings == null)
- {
- RemoteBinding binding = (RemoteBinding) container.resolveAnnotation(RemoteBinding.class);
- if (binding == null)
- {
- log.debug("no declared remote bindings for : " + container.getEjbName());
- if (ProxyFactoryHelper.getRemoteAndBusinessRemoteInterfaces(container).length > 0)
- {
- log.debug("there is remote interfaces for " + container.getEjbName());
- String jndiName = ProxyFactoryHelper.getDefaultRemoteBusinessJndiName(container);
- log.debug("default remote binding has jndiName of " + jndiName);
- String uri = ""; // use the default
- RemoteBinding[] list = {new RemoteBindingImpl(jndiName, "", uri, RemoteBindingDefaults.PROXY_FACTORY_DEFAULT)};
- remoteBindings = new RemoteBindingsImpl(list);
- container.getAnnotations().addClassAnnotation(RemoteBindings.class, remoteBindings);
- }
- }
- else
- {
- RemoteBinding[] list = {initializeRemoteBinding(binding)};
- remoteBindings = new RemoteBindingsImpl(list);
- container.getAnnotations().addClassAnnotation(RemoteBindings.class, remoteBindings);
- }
- }
- else
- {
- List<RemoteBinding> list = new ArrayList<RemoteBinding>();
- for(RemoteBinding binding : remoteBindings.value())
- {
- list.add(initializeRemoteBinding(binding));
- }
- remoteBindings = new RemoteBindingsImpl(list);
- container.getAnnotations().addClassAnnotation(RemoteBindings.class, remoteBindings);
- }
- }
-
- public void stop() throws Exception
- {
- for (int i = 0; i < proxyFactories.size(); i++)
- {
- ProxyFactory factory = (ProxyFactory) proxyFactories.get(i);
- factory.stop();
- }
- }
-}
Copied: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/ProxyDeployer.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/ProxyDeployer.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/ProxyDeployer.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/ProxyDeployer.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,200 @@
+/*
+ * 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.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+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;
+import org.jboss.ejb3.annotation.defaults.RemoteBindingDefaults;
+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.logging.Logger;
+
+/**
+ * Delegatee of a SessionContainer for managing proxy factories.
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+public class ProxyDeployer
+{
+ private static final Logger log = Logger.getLogger(ProxyDeployer.class);
+ private SessionContainer container;
+ private Map<Object, ProxyFactory> proxyFactories = new HashMap<Object, ProxyFactory>();
+ private RemoteBindings remoteBindings;
+ private LocalBinding localBinding;
+
+ public ProxyDeployer(SessionContainer container)
+ {
+ assert container != null : "container is null";
+
+ this.container = container;
+ }
+
+ public Map<Object, ProxyFactory> getProxyFactories()
+ {
+ return proxyFactories;
+ }
+
+ public ProxyFactory getProxyFactory(Object key)
+ {
+ return this.getProxyFactories().get(key);
+ }
+
+ public void start() throws Exception
+ {
+ if (remoteBindings != null)
+ {
+ RemoteBinding[] list = remoteBindings.value();
+ for(RemoteBinding binding : list)
+ {
+ assert binding.jndiBinding().length() != 0 : "jndiBinding not set on binding " + binding;
+
+ RemoteProxyFactory factory;
+ String factoryImplementationRegistryKey = binding.factory();
+ if (factoryImplementationRegistryKey.equals(RemoteBindingDefaults.PROXY_FACTORY_DEFAULT))
+ {
+ factory = container.getProxyFactory(binding);
+ }
+ else
+ {
+ Class<? extends RemoteProxyFactory> remoteFactoryClass = container.getDeployment().getRemoteProxyFactoryRegistry().getProxyFactoryClass(binding.factory());
+ Constructor<? extends RemoteProxyFactory> constructor = remoteFactoryClass.getConstructor(SessionContainer.class, RemoteBinding.class);
+ factory = constructor.newInstance(container, binding);
+ }
+ factory.start();
+ proxyFactories.put(binding,factory);
+ }
+ }
+
+ if (localBinding != null)
+ {
+ ProxyFactory factory = container.getProxyFactory(localBinding);
+ factory.start();
+ proxyFactories.put(localBinding,factory);
+ }
+ }
+
+ protected boolean hasJNDIBinding(String jndiName)
+ {
+ assert jndiName != null : "jndiName is null";
+
+ if(localBinding != null)
+ {
+ if(localBinding.jndiBinding().equals(jndiName))
+ return true;
+ }
+
+ if(remoteBindings != null)
+ {
+ for(RemoteBinding binding : remoteBindings.value())
+ {
+ if(binding.jndiBinding().equals(jndiName))
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public void initializeLocalBindingMetadata()
+ {
+ localBinding = container.getAnnotation(LocalBinding.class);
+ if (localBinding == null)
+ {
+ if (ProxyFactoryHelper.getLocalAndBusinessLocalInterfaces(container).length > 0)
+ {
+ localBinding = new LocalBindingImpl(ProxyFactoryHelper.getLocalJndiName(container));
+ container.getAnnotations().addClassAnnotation(LocalBinding.class, localBinding);
+ }
+ }
+ }
+
+ private RemoteBinding initializeRemoteBinding(RemoteBinding binding)
+ {
+ if(binding.jndiBinding().length() == 0)
+ {
+ return new RemoteBindingImpl(ProxyFactoryHelper.getDefaultRemoteBusinessJndiName(container), binding
+ .interceptorStack(), binding.clientBindUrl(), binding.factory());
+ }
+ return binding;
+ }
+
+ public void initializeRemoteBindingMetadata()
+ {
+ remoteBindings = container.getAnnotation(RemoteBindings.class);
+ if (remoteBindings == null)
+ {
+ RemoteBinding binding = container.getAnnotation(RemoteBinding.class);
+ if (binding == null)
+ {
+ log.debug("no declared remote bindings for : " + container.getEjbName());
+ if (ProxyFactoryHelper.getRemoteAndBusinessRemoteInterfaces(container).length > 0)
+ {
+ log.debug("there is remote interfaces for " + container.getEjbName());
+ String jndiName = ProxyFactoryHelper.getDefaultRemoteBusinessJndiName(container);
+ log.debug("default remote binding has jndiName of " + jndiName);
+ String uri = ""; // use the default
+ RemoteBinding[] list = {new RemoteBindingImpl(jndiName, "", uri, RemoteBindingDefaults.PROXY_FACTORY_DEFAULT)};
+ remoteBindings = new RemoteBindingsImpl(list);
+ container.getAnnotations().addClassAnnotation(RemoteBindings.class, remoteBindings);
+ }
+ }
+ else
+ {
+ RemoteBinding[] list = {initializeRemoteBinding(binding)};
+ remoteBindings = new RemoteBindingsImpl(list);
+ container.getAnnotations().addClassAnnotation(RemoteBindings.class, remoteBindings);
+ }
+ }
+ else
+ {
+ List<RemoteBinding> list = new ArrayList<RemoteBinding>();
+ for(RemoteBinding binding : remoteBindings.value())
+ {
+ list.add(initializeRemoteBinding(binding));
+ }
+ remoteBindings = new RemoteBindingsImpl(list);
+ container.getAnnotations().addClassAnnotation(RemoteBindings.class, remoteBindings);
+ }
+ }
+
+ public void stop() throws Exception
+ {
+ Collection<ProxyFactory> proxyFactories = this.getProxyFactories().values();
+ for(ProxyFactory factory : proxyFactories)
+ {
+ factory.stop();
+ }
+ }
+}
Deleted: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionBeanContext.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionBeanContext.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionBeanContext.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -1,62 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2007, Red Hat Middleware LLC, and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.EJBContext;
-
-import org.jboss.ejb3.BaseContext;
-
-/**
- * An instance of an enterprise bean link to its container.
- *
- * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
- */
-public abstract class SessionBeanContext extends BaseContext<SessionContainer>
-{
- protected EJBContext ejbContext;
-
- /**
- * Must not break getInstance post condition!
- * @param container
- */
- protected SessionBeanContext(SessionContainer container)
- {
- super(container);
- }
-
- protected SessionBeanContext(SessionContainer container, Object bean)
- {
- super(container, bean);
- }
-
- public EJBContext getEJBContext()
- {
- if (ejbContext == null)
- {
- SessionContextImpl bsc = new SessionContextImpl(this);
- ejbContext = bsc;
- }
- return ejbContext;
- }
-
-}
Copied: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionBeanContext.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionBeanContext.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionBeanContext.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionBeanContext.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.EJBContext;
+
+import org.jboss.ejb3.BaseContext;
+
+/**
+ * An instance of an enterprise bean link to its container.
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision$
+ */
+public abstract class SessionBeanContext<T extends SessionContainer> extends BaseContext<T>
+{
+ protected EJBContext ejbContext;
+
+ /**
+ * Must not break getInstance post condition!
+ * @param container
+ */
+ protected SessionBeanContext(T container)
+ {
+ super(container);
+ }
+
+ protected SessionBeanContext(T container, Object bean)
+ {
+ super(container, bean);
+ }
+
+ public EJBContext getEJBContext()
+ {
+ if (ejbContext == null)
+ {
+ SessionContextImpl<T> bsc = new SessionContextImpl<T>(this);
+ ejbContext = bsc;
+ }
+ return ejbContext;
+ }
+
+}
Deleted: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionContainer.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionContainer.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionContainer.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -1,590 +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.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-
-import javax.ejb.EJBLocalObject;
-import javax.ejb.EJBObject;
-import javax.ejb.Handle;
-import javax.ejb.LocalHome;
-import javax.ejb.RemoteHome;
-
-import org.jboss.aop.Dispatcher;
-import org.jboss.aop.Domain;
-import org.jboss.aop.MethodInfo;
-import org.jboss.aop.joinpoint.Invocation;
-import org.jboss.aop.joinpoint.InvocationResponse;
-import org.jboss.aop.util.MethodHashing;
-import org.jboss.aspects.asynch.FutureHolder;
-import org.jboss.ejb3.EJBContainer;
-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.remoting.IsLocalInterceptor;
-import org.jboss.ejb3.remoting.RemoteProxyFactory;
-import org.jboss.ejb3.stateful.BaseStatefulRemoteProxyFactory;
-import org.jboss.ejb3.stateful.StatefulContainerInvocation;
-import org.jboss.ha.framework.server.HATarget;
-import org.jboss.logging.Logger;
-import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
-import org.jboss.serial.io.MarshalledObjectForLocalCalls;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public abstract class SessionContainer extends EJBContainer
-{
- @SuppressWarnings("unused")
- private static final Logger log = Logger.getLogger(SessionContainer.class);
-
- protected ProxyDeployer proxyDeployer;
- private Map<String, HATarget> clusterFamilies;
-
- public class InvokedMethod
- {
- public InvokedMethod(boolean localInterface, Method method)
- {
- isLocalInterface = localInterface;
- this.method = method;
- }
-
- public boolean isLocalInterface;
- public Method method;
- }
-
- /**
- * @param id
- * @return
- * @throws Exception
- * @deprecated the binding on which this proxy is bound is unspecified
- */
- public Object createLocalProxy(Object id) throws Exception
- {
- LocalBinding binding = getAnnotation(LocalBinding.class);
- return createLocalProxy(id, binding);
- }
-
- /**
- * Create a local proxy for an enterprise bean identified by id on a given binding.
- *
- * @param id the identifier of the enterprise bean (null for stateless)
- * @param binding the binding of the proxy
- * @return a proxy to an enterprise bean
- * @throws Exception
- */
- public abstract Object createLocalProxy(Object id, LocalBinding binding) throws Exception;
-
- /**
- * @param id
- * @return
- * @throws Exception
- * @deprecated the binding on which this proxy is bound is unspecified
- */
- @Deprecated
- public Object createRemoteProxy(Object id) throws Exception
- {
- RemoteBinding binding = null;
- RemoteBindings bindings = getAnnotation(RemoteBindings.class);
- if (bindings != null)
- binding = bindings.value()[0];
- else
- binding = getAnnotation(RemoteBinding.class);
-
- return createRemoteProxy(id, binding);
- }
- /**
- * Create a remote proxy for an enterprise bean identified by id on a given binding.
- *
- * @param id the identifier of the enterprise bean (null for stateless)
- * @param binding the binding of the proxy
- * @return a proxy to an enterprise bean
- * @throws Exception
- */
- public abstract Object createRemoteProxy(Object id, RemoteBinding binding) throws Exception;
-
- protected ThreadLocalStack<InvokedMethod> invokedMethod = new ThreadLocalStack<InvokedMethod>();
-
- public SessionContainer(ClassLoader cl, String beanClassName, String ejbName, Domain domain,
- Hashtable ctxProperties, Ejb3Deployment deployment, JBossSessionBeanMetaData beanMetaData) throws ClassNotFoundException
- {
- super(Ejb3Module.BASE_EJB3_JMX_NAME + ",name=" + ejbName, domain, cl, beanClassName, ejbName, ctxProperties, deployment, beanMetaData);
- proxyDeployer = new ProxyDeployer(this);
- }
-
- /**
- * Create a local proxy factory.
- * @return
- */
- protected abstract ProxyFactory createProxyFactory(LocalBinding binding);
-
- /**
- * Create a remote proxy factory on the given binding.
- *
- * @param binding
- * @return
- */
- protected abstract RemoteProxyFactory createProxyFactory(RemoteBinding binding);
-
- public abstract InvocationResponse dynamicInvoke(Object target, Invocation invocation) throws Throwable;
-
- public Class<?> getInvokedBusinessInterface()
- {
- InvokedMethod method = invokedMethod.get();
- if (method == null) throw new IllegalStateException("getInvokedBusinessInterface() being invoked outside of a business invocation");
- if (method.method == null) throw new IllegalStateException("getInvokedBusinessInterface() being invoked outside of a business invocation");
- if (method.isLocalInterface) return method.method.getDeclaringClass();
- Class<?>[] remoteInterfaces = ProxyFactoryHelper.getRemoteAndBusinessRemoteInterfaces(this);
- for (Class<?> intf : remoteInterfaces)
- {
- try
- {
- intf.getMethod(method.method.getName(), method.method.getParameterTypes());
- return intf;
- }
- catch (NoSuchMethodException ignored)
- {
- // continue
- }
- }
- throw new IllegalStateException("Unable to find geInvokedBusinessInterface()");
- }
-
- protected JBossSessionBeanMetaData getMetaData()
- {
- // TODO: resolve this cast using generics on EJBContainer
- return (JBossSessionBeanMetaData) getXml();
- }
-
- @Override
- public void instantiated()
- {
- super.instantiated();
- proxyDeployer.initializeRemoteBindingMetadata();
- proxyDeployer.initializeLocalBindingMetadata();
- }
-
- @Override
- protected List<Class<?>> resolveBusinessInterfaces()
- {
- // Obtain all business interfaces
- List<Class<?>> list = new ArrayList<Class<?>>();
- list.addAll(Arrays.asList(ProxyFactoryHelper.getLocalBusinessInterfaces(this)));
- list.addAll(Arrays.asList(ProxyFactoryHelper.getRemoteBusinessInterfaces(this)));
-
- return list;
- }
-
- public void start() throws Exception
- {
- super.start();
- // So that Remoting layer can reference this container easily.
- Dispatcher.singleton.registerTarget(getObjectName().getCanonicalName(), new ClassProxyHack(this));
- proxyDeployer.start();
- }
-
- /**
- * This gets called by replicants manager interceptor factory
- * during the initialization of the bean container (during construction of EJBContainer).
- * So we have detached construction here.
- *
- * @return the cluster families, never null
- */
- public Map<String, HATarget> getClusterFamilies()
- {
- if(clusterFamilies != null)
- return clusterFamilies;
-
- synchronized (this)
- {
- if(clusterFamilies == null)
- clusterFamilies = new HashMap<String, HATarget>();
- }
- return clusterFamilies;
- }
-
- public void stop() throws Exception
- {
- try
- {
- proxyDeployer.stop();
- }
- catch (Exception ignore)
- {
- log.trace("Proxy deployer stop failed", ignore);
- }
- try
- {
- Dispatcher.singleton.unregisterTarget(getObjectName().getCanonicalName());
- }
- catch (Exception ignore)
- {
- log.trace("Dispatcher unregister target failed", ignore);
- }
- super.stop();
- }
-
- @Override
- public List<Method> getVirtualMethods()
- {
- List<Method> virtualMethods = new ArrayList<Method>();
- try
- {
- RemoteHome home = getAnnotation(RemoteHome.class);
- if (home != null)
- {
- Method[] declaredMethods = home.value().getMethods();
- for(Method declaredMethod : declaredMethods)
- virtualMethods.add(declaredMethod);
-
- declaredMethods = javax.ejb.EJBObject.class.getMethods();
- for(Method declaredMethod : declaredMethods)
- virtualMethods.add(declaredMethod);
- }
-
- LocalHome localHome = getAnnotation(LocalHome.class);
- if (localHome != null)
- {
- Method[] declaredMethods = localHome.value().getMethods();
- for(Method declaredMethod : declaredMethods)
- virtualMethods.add(declaredMethod);
-
- declaredMethods = javax.ejb.EJBLocalObject.class.getMethods();
- for(Method declaredMethod : declaredMethods)
- virtualMethods.add(declaredMethod);
- }
- }
- catch (SecurityException e)
- {
- // TODO: privileged?
- throw new RuntimeException(e);
- }
- return virtualMethods;
- }
-
- /*
- protected void createMethodMap()
- {
- super.createMethodMap();
- try
- {
- RemoteHome home = (RemoteHome) resolveAnnotation(RemoteHome.class);
- if (home != null)
- {
- Method[] declaredMethods = home.value().getMethods();
- for (int i = 0; i < declaredMethods.length; i++)
- {
- long hash = MethodHashing.methodHash(declaredMethods[i]);
- advisedMethods.put(hash, declaredMethods[i]);
- }
-
- declaredMethods = javax.ejb.EJBObject.class.getMethods();
- for (int i = 0; i < declaredMethods.length; i++)
- {
- long hash = MethodHashing.methodHash(declaredMethods[i]);
- advisedMethods.put(hash, declaredMethods[i]);
- }
- }
-
- LocalHome localHome = (LocalHome) resolveAnnotation(LocalHome.class);
- if (localHome != null)
- {
- Method[] declaredMethods = localHome.value().getMethods();
- for (int i = 0; i < declaredMethods.length; i++)
- {
- long hash = MethodHashing.methodHash(declaredMethods[i]);
- advisedMethods.put(hash, declaredMethods[i]);
- }
-
- declaredMethods = javax.ejb.EJBLocalObject.class.getMethods();
- for (int i = 0; i < declaredMethods.length; i++)
- {
- long hash = MethodHashing.methodHash(declaredMethods[i]);
- advisedMethods.put(hash, declaredMethods[i]);
- }
- }
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- }
- */
-
- protected boolean isHomeMethod(Method method)
- {
- if (javax.ejb.EJBHome.class.isAssignableFrom(method.getDeclaringClass())) return true;
- if (javax.ejb.EJBLocalHome.class.isAssignableFrom(method.getDeclaringClass())) return true;
- return false;
- }
-
- protected boolean isEJBObjectMethod(Method method)
- {
- if (method.getDeclaringClass().getName().equals(EJBObject.class.getName()))
- return true;
-
- if (method.getDeclaringClass().getName().equals(EJBLocalObject.class.getName()))
- return true;
-
- return false;
- }
-
- protected boolean isHandleMethod(Method method)
- {
- if (method.getDeclaringClass().getName().equals(Handle.class.getName()))
- return true;
-
- return false;
- }
-
- public static InvocationResponse marshallException(Invocation invocation, Throwable exception, Map responseContext) throws Throwable
- {
- if (invocation.getMetaData(IsLocalInterceptor.IS_LOCAL,IsLocalInterceptor.IS_LOCAL) == null) throw exception;
-
- InvocationResponse response = new InvocationResponse();
- response.setContextInfo(responseContext);
-
- response.addAttachment(IsLocalInterceptor.IS_LOCAL_EXCEPTION, new MarshalledObjectForLocalCalls(exception));
-
- return response;
- }
-
- public static InvocationResponse marshallResponse(Invocation invocation, Object rtn, Map responseContext)
- throws java.io.IOException
- {
- InvocationResponse response;
- // marshall return value
- if (rtn != null && invocation.getMetaData(IsLocalInterceptor.IS_LOCAL, IsLocalInterceptor.IS_LOCAL) != null)
- {
- response = new InvocationResponse(new MarshalledObjectForLocalCalls(rtn));
- }
- else
- {
- response = new InvocationResponse(rtn);
- }
- response.setContextInfo(responseContext);
- return response;
- }
-
- /**
- * Invoke a method on the virtual EJB bean. The method must be one of the methods defined in one
- * of the business interfaces (or home interface) of the bean.
- *
- * TODO: work in progress
- *
- * @param factory the originating end point
- * @param id unique identifier (primary key), can be null for stateless
- * @param method the business or home method to invoke
- * @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
- {
- ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
- pushEnc();
- try
- {
- long hash = MethodHashing.calculateHash(method);
- MethodInfo info = getAdvisor().getMethodInfo(hash);
- if (info == null)
- {
- throw new RuntimeException(
- "Could not resolve beanClass method from proxy call: "
- + method.toString());
- }
-
- Method unadvisedMethod = info.getUnadvisedMethod();
-
- if (unadvisedMethod != null && isHomeMethod(unadvisedMethod))
- {
- return invokeHomeMethod(factory, info, args);
- }
- else if (unadvisedMethod != null && isEJBObjectMethod(unadvisedMethod))
- {
- return invokeEJBObjectMethod(factory, id, info, args);
- }
-
- // FIXME: Ahem, stateful container invocation works on all.... (violating contract though)
- EJBContainerInvocation nextInvocation = new StatefulContainerInvocation(info, id);
- nextInvocation.setAdvisor(getAdvisor());
- nextInvocation.setArguments(args);
-
- // allow a container to supplement information into an invocation
- nextInvocation = populateInvocation(nextInvocation);
-
- ProxyUtils.addLocalAsynchronousInfo(nextInvocation, provider);
- try
- {
- invokedMethod.push(new InvokedMethod(true, method));
- return nextInvocation.invokeNext();
- }
- finally
- {
- invokedMethod.pop();
- }
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(oldLoader);
- popEnc();
- }
- }
-
- /**
- * TODO: work in progress (refactor both invokeHomeMethod's, localHomeInvoke)
- */
- private Object invokeHomeMethod(ProxyFactory 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.createProxy(id);
-
- return proxy;
- }
- else if (unadvisedMethod.getName().equals("remove"))
- {
- if(args[0] instanceof Handle)
- removeHandle((Handle) args[0]);
- else
- destroySession(args[0]);
-
- return null;
- }
- else
- {
- throw new IllegalArgumentException("illegal home method " + unadvisedMethod);
- }
- }
-
- /**
- * Create session to an EJB bean.
- *
- * @param initParameterTypes the parameter types used by the home's create method
- * @param initParameterValues the arguments for the home's create method
- * @return the identifier of the session
- */
- abstract public Object createSession(Class<?> initParameterTypes[], Object initParameterValues[]);
-
- abstract public Object localInvoke(Object id, Method method, Object[] args, FutureHolder provider) throws Throwable;
-
- abstract public Object localHomeInvoke(Method method, Object[] args) throws Throwable;
-
- public Object createSession()
- {
- return createSession(null, null);
- }
-
- /**
- * Destroy a created session.
- *
- * @param id the identifier of the session
- */
- protected void destroySession(Object id)
- {
- throw new RuntimeException("NYI");
- }
-
- /**
- * Checks if this session bean binds to the given JNDI name.
- */
- @Override
- public boolean hasJNDIBinding(String jndiName)
- {
- return proxyDeployer.hasJNDIBinding(jndiName);
- }
-
- protected Object invokeEJBObjectMethod(ProxyFactory factory, Object id, MethodInfo info, Object args[]) throws Exception
- {
- Method unadvisedMethod = info.getUnadvisedMethod();
- if(unadvisedMethod.getName().equals("getEJBHome"))
- {
- return factory.createHomeProxy();
- }
- if(unadvisedMethod.getName().equals("getPrimaryKey"))
- {
- return id;
- }
- if(unadvisedMethod.getName().equals("isIdentical"))
- {
- // object has no identity
- if(id == null)
- return false;
-
- EJBObject bean = (EJBObject) args[0];
-
- Object primaryKey = bean.getPrimaryKey();
- if(primaryKey == null)
- return false;
-
- boolean isIdentical = id.equals(primaryKey);
-
- return isIdentical;
- }
- if (unadvisedMethod.getName().equals("remove"))
- {
- destroySession(id);
-
- return null;
- }
- throw new RuntimeException("NYI");
- }
-
- /**
- * Allow a container sub class to supplement an invocation. Per default nothing to supplement.
- *
- * @param invocation
- * @return
- */
- protected EJBContainerInvocation populateInvocation(EJBContainerInvocation invocation)
- {
- return invocation;
- }
-
- abstract protected void removeHandle(Handle handle) throws Exception;
-}
Copied: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionContainer.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionContainer.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionContainer.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionContainer.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,559 @@
+/*
+ * 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.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+import javax.ejb.EJBLocalObject;
+import javax.ejb.EJBObject;
+import javax.ejb.Handle;
+import javax.ejb.LocalHome;
+import javax.ejb.RemoteHome;
+
+import org.jboss.aop.Dispatcher;
+import org.jboss.aop.Domain;
+import org.jboss.aop.MethodInfo;
+import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.aop.joinpoint.InvocationResponse;
+import org.jboss.aop.util.MethodHashing;
+import org.jboss.aspects.asynch.FutureHolder;
+import org.jboss.ejb3.EJBContainer;
+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.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;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+import org.jboss.serial.io.MarshalledObjectForLocalCalls;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+public abstract class SessionContainer extends EJBContainer
+{
+ @SuppressWarnings("unused")
+ private static final Logger log = Logger.getLogger(SessionContainer.class);
+
+ protected ProxyDeployer proxyDeployer;
+ private Map<String, HATarget> clusterFamilies;
+
+ public class InvokedMethod
+ {
+ public InvokedMethod(boolean localInterface, Method method)
+ {
+ isLocalInterface = localInterface;
+ this.method = method;
+ }
+
+ public boolean isLocalInterface;
+ public Method method;
+ }
+
+ /**
+ * Returns a remote binding for this container
+ *
+ * @deprecated Non-deterministic, more than one binding may be specified
+ * for this container
+ * @return
+ */
+ @Deprecated
+ protected RemoteBinding getRemoteBinding()
+ {
+ RemoteBinding binding = null;
+ RemoteBindings bindings = getAnnotation(RemoteBindings.class);
+ if (bindings != null)
+ binding = bindings.value()[0];
+ else
+ binding = getAnnotation(RemoteBinding.class);
+
+ return binding;
+ }
+
+ protected ThreadLocalStack<InvokedMethod> invokedMethod = new ThreadLocalStack<InvokedMethod>();
+
+ public SessionContainer(ClassLoader cl, String beanClassName, String ejbName, Domain domain,
+ Hashtable ctxProperties, Ejb3Deployment deployment, JBossSessionBeanMetaData beanMetaData) throws ClassNotFoundException
+ {
+ super(Ejb3Module.BASE_EJB3_JMX_NAME + ",name=" + ejbName, domain, cl, beanClassName, ejbName, ctxProperties, deployment, beanMetaData);
+ proxyDeployer = new ProxyDeployer(this);
+ }
+
+ /**
+ * Create a local proxy factory.
+ * @return
+ */
+ protected abstract ProxyFactory getProxyFactory(LocalBinding binding);
+
+ /**
+ * Create a remote proxy factory on the given binding.
+ *
+ * @param binding
+ * @return
+ */
+ protected abstract RemoteProxyFactory getProxyFactory(RemoteBinding binding);
+
+ public abstract InvocationResponse dynamicInvoke(Object target, Invocation invocation) throws Throwable;
+
+ public Class<?> getInvokedBusinessInterface()
+ {
+ InvokedMethod method = invokedMethod.get();
+ if (method == null) throw new IllegalStateException("getInvokedBusinessInterface() being invoked outside of a business invocation");
+ if (method.method == null) throw new IllegalStateException("getInvokedBusinessInterface() being invoked outside of a business invocation");
+ if (method.isLocalInterface) return method.method.getDeclaringClass();
+ Class<?>[] remoteInterfaces = ProxyFactoryHelper.getRemoteAndBusinessRemoteInterfaces(this);
+ for (Class<?> intf : remoteInterfaces)
+ {
+ try
+ {
+ intf.getMethod(method.method.getName(), method.method.getParameterTypes());
+ return intf;
+ }
+ catch (NoSuchMethodException ignored)
+ {
+ // continue
+ }
+ }
+ throw new IllegalStateException("Unable to find geInvokedBusinessInterface()");
+ }
+
+ protected JBossSessionBeanMetaData getMetaData()
+ {
+ // TODO: resolve this cast using generics on EJBContainer
+ return (JBossSessionBeanMetaData) getXml();
+ }
+
+ @Override
+ public void instantiated()
+ {
+ super.instantiated();
+ proxyDeployer.initializeRemoteBindingMetadata();
+ proxyDeployer.initializeLocalBindingMetadata();
+ }
+
+ @Override
+ protected List<Class<?>> resolveBusinessInterfaces()
+ {
+ // Obtain all business interfaces
+ List<Class<?>> list = new ArrayList<Class<?>>();
+ list.addAll(Arrays.asList(ProxyFactoryHelper.getLocalBusinessInterfaces(this)));
+ list.addAll(Arrays.asList(ProxyFactoryHelper.getRemoteBusinessInterfaces(this)));
+
+ return list;
+ }
+
+ public void start() throws Exception
+ {
+ super.start();
+ // So that Remoting layer can reference this container easily.
+ Dispatcher.singleton.registerTarget(getObjectName().getCanonicalName(), new ClassProxyHack(this));
+ proxyDeployer.start();
+ }
+
+ /**
+ * This gets called by replicants manager interceptor factory
+ * during the initialization of the bean container (during construction of EJBContainer).
+ * So we have detached construction here.
+ *
+ * @return the cluster families, never null
+ */
+ public Map<String, HATarget> getClusterFamilies()
+ {
+ if(clusterFamilies != null)
+ return clusterFamilies;
+
+ synchronized (this)
+ {
+ if(clusterFamilies == null)
+ clusterFamilies = new HashMap<String, HATarget>();
+ }
+ return clusterFamilies;
+ }
+
+ public void stop() throws Exception
+ {
+ try
+ {
+ proxyDeployer.stop();
+ }
+ catch (Exception ignore)
+ {
+ log.debug("Proxy deployer stop failed", ignore);
+ }
+ try
+ {
+ Dispatcher.singleton.unregisterTarget(getObjectName().getCanonicalName());
+ }
+ catch (Exception ignore)
+ {
+ log.debug("Dispatcher unregister target failed", ignore);
+ }
+ super.stop();
+ }
+
+ @Override
+ public List<Method> getVirtualMethods()
+ {
+ List<Method> virtualMethods = new ArrayList<Method>();
+ try
+ {
+ RemoteHome home = getAnnotation(RemoteHome.class);
+ if (home != null)
+ {
+ Method[] declaredMethods = home.value().getMethods();
+ for(Method declaredMethod : declaredMethods)
+ virtualMethods.add(declaredMethod);
+
+ declaredMethods = javax.ejb.EJBObject.class.getMethods();
+ for(Method declaredMethod : declaredMethods)
+ virtualMethods.add(declaredMethod);
+ }
+
+ LocalHome localHome = getAnnotation(LocalHome.class);
+ if (localHome != null)
+ {
+ Method[] declaredMethods = localHome.value().getMethods();
+ for(Method declaredMethod : declaredMethods)
+ virtualMethods.add(declaredMethod);
+
+ declaredMethods = javax.ejb.EJBLocalObject.class.getMethods();
+ for(Method declaredMethod : declaredMethods)
+ virtualMethods.add(declaredMethod);
+ }
+ }
+ catch (SecurityException e)
+ {
+ // TODO: privileged?
+ throw new RuntimeException(e);
+ }
+ return virtualMethods;
+ }
+
+ /*
+ protected void createMethodMap()
+ {
+ super.createMethodMap();
+ try
+ {
+ RemoteHome home = (RemoteHome) resolveAnnotation(RemoteHome.class);
+ if (home != null)
+ {
+ Method[] declaredMethods = home.value().getMethods();
+ for (int i = 0; i < declaredMethods.length; i++)
+ {
+ long hash = MethodHashing.methodHash(declaredMethods[i]);
+ advisedMethods.put(hash, declaredMethods[i]);
+ }
+
+ declaredMethods = javax.ejb.EJBObject.class.getMethods();
+ for (int i = 0; i < declaredMethods.length; i++)
+ {
+ long hash = MethodHashing.methodHash(declaredMethods[i]);
+ advisedMethods.put(hash, declaredMethods[i]);
+ }
+ }
+
+ LocalHome localHome = (LocalHome) resolveAnnotation(LocalHome.class);
+ if (localHome != null)
+ {
+ Method[] declaredMethods = localHome.value().getMethods();
+ for (int i = 0; i < declaredMethods.length; i++)
+ {
+ long hash = MethodHashing.methodHash(declaredMethods[i]);
+ advisedMethods.put(hash, declaredMethods[i]);
+ }
+
+ declaredMethods = javax.ejb.EJBLocalObject.class.getMethods();
+ for (int i = 0; i < declaredMethods.length; i++)
+ {
+ long hash = MethodHashing.methodHash(declaredMethods[i]);
+ advisedMethods.put(hash, declaredMethods[i]);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+ */
+
+ protected boolean isHomeMethod(Method method)
+ {
+ if (javax.ejb.EJBHome.class.isAssignableFrom(method.getDeclaringClass())) return true;
+ if (javax.ejb.EJBLocalHome.class.isAssignableFrom(method.getDeclaringClass())) return true;
+ return false;
+ }
+
+ protected boolean isEJBObjectMethod(Method method)
+ {
+ if (method.getDeclaringClass().getName().equals(EJBObject.class.getName()))
+ return true;
+
+ if (method.getDeclaringClass().getName().equals(EJBLocalObject.class.getName()))
+ return true;
+
+ return false;
+ }
+
+ protected boolean isHandleMethod(Method method)
+ {
+ if (method.getDeclaringClass().getName().equals(Handle.class.getName()))
+ return true;
+
+ return false;
+ }
+
+ public static InvocationResponse marshallException(Invocation invocation, Throwable exception, Map responseContext) throws Throwable
+ {
+ if (invocation.getMetaData(IsLocalInterceptor.IS_LOCAL,IsLocalInterceptor.IS_LOCAL) == null) throw exception;
+
+ InvocationResponse response = new InvocationResponse();
+ response.setContextInfo(responseContext);
+
+ response.addAttachment(IsLocalInterceptor.IS_LOCAL_EXCEPTION, new MarshalledObjectForLocalCalls(exception));
+
+ return response;
+ }
+
+ public static InvocationResponse marshallResponse(Invocation invocation, Object rtn, Map responseContext)
+ throws java.io.IOException
+ {
+ InvocationResponse response;
+ // marshall return value
+ if (rtn != null && invocation.getMetaData(IsLocalInterceptor.IS_LOCAL, IsLocalInterceptor.IS_LOCAL) != null)
+ {
+ response = new InvocationResponse(new MarshalledObjectForLocalCalls(rtn));
+ }
+ else
+ {
+ response = new InvocationResponse(rtn);
+ }
+ response.setContextInfo(responseContext);
+ return response;
+ }
+
+ /**
+ * Invoke a method on the virtual EJB bean. The method must be one of the methods defined in one
+ * of the business interfaces (or home interface) of the bean.
+ *
+ * TODO: work in progress
+ *
+ * @param factory the originating end point
+ * @param id unique identifier (primary key), can be null for stateless
+ * @param method the business or home method to invoke
+ * @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
+ {
+ ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
+ pushEnc();
+ try
+ {
+ long hash = MethodHashing.calculateHash(method);
+ MethodInfo info = getAdvisor().getMethodInfo(hash);
+ if (info == null)
+ {
+ throw new RuntimeException(
+ "Could not resolve beanClass method from proxy call: "
+ + method.toString());
+ }
+
+ Method unadvisedMethod = info.getUnadvisedMethod();
+
+ if (unadvisedMethod != null && isHomeMethod(unadvisedMethod))
+ {
+ return invokeHomeMethod(factory, info, args);
+ }
+ else if (unadvisedMethod != null && isEJBObjectMethod(unadvisedMethod))
+ {
+ return invokeEJBObjectMethod(factory, id, info, args);
+ }
+
+ // FIXME: Ahem, stateful container invocation works on all.... (violating contract though)
+ EJBContainerInvocation nextInvocation = new StatefulContainerInvocation(info, id);
+ nextInvocation.setAdvisor(getAdvisor());
+ nextInvocation.setArguments(args);
+
+ // allow a container to supplement information into an invocation
+ nextInvocation = populateInvocation(nextInvocation);
+
+ ProxyUtils.addLocalAsynchronousInfo(nextInvocation, provider);
+ try
+ {
+ invokedMethod.push(new InvokedMethod(true, method));
+ return nextInvocation.invokeNext();
+ }
+ finally
+ {
+ invokedMethod.pop();
+ }
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(oldLoader);
+ popEnc();
+ }
+ }
+
+ /**
+ * TODO: work in progress (refactor both invokeHomeMethod's, localHomeInvoke)
+ */
+ private Object invokeHomeMethod(ProxyFactory 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;
+ }
+ else if (unadvisedMethod.getName().equals("remove"))
+ {
+ if(args[0] instanceof Handle)
+ removeHandle((Handle) args[0]);
+ else
+ destroySession(args[0]);
+
+ return null;
+ }
+ else
+ {
+ throw new IllegalArgumentException("illegal home method " + unadvisedMethod);
+ }
+ }
+
+ /**
+ * Create session to an EJB bean.
+ *
+ * @param initParameterTypes the parameter types used by the home's create method
+ * @param initParameterValues the arguments for the home's create method
+ * @return the identifier of the session
+ */
+ abstract public Object createSession(Class<?> initParameterTypes[], Object initParameterValues[]);
+
+ abstract public Object localInvoke(Object id, Method method, Object[] args, FutureHolder provider) throws Throwable;
+
+ abstract public Object localHomeInvoke(Method method, Object[] args) throws Throwable;
+
+ public Object createSession()
+ {
+ return createSession(null, null);
+ }
+
+ /**
+ * Destroy a created session.
+ *
+ * @param id the identifier of the session
+ */
+ protected void destroySession(Object id)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ /**
+ * Checks if this session bean binds to the given JNDI name.
+ */
+ @Override
+ public boolean hasJNDIBinding(String jndiName)
+ {
+ return proxyDeployer.hasJNDIBinding(jndiName);
+ }
+
+ protected Object invokeEJBObjectMethod(ProxyFactory factory, Object id, MethodInfo info, Object args[]) throws Exception
+ {
+ Method unadvisedMethod = info.getUnadvisedMethod();
+ if(unadvisedMethod.getName().equals("getEJBHome"))
+ {
+ return factory.createHomeProxy();
+ }
+ if(unadvisedMethod.getName().equals("getPrimaryKey"))
+ {
+ return id;
+ }
+ if(unadvisedMethod.getName().equals("isIdentical"))
+ {
+ // object has no identity
+ if(id == null)
+ return false;
+
+ EJBObject bean = (EJBObject) args[0];
+
+ Object primaryKey = bean.getPrimaryKey();
+ if(primaryKey == null)
+ return false;
+
+ boolean isIdentical = id.equals(primaryKey);
+
+ return isIdentical;
+ }
+ if (unadvisedMethod.getName().equals("remove"))
+ {
+ destroySession(id);
+
+ return null;
+ }
+ throw new RuntimeException("NYI");
+ }
+
+ /**
+ * Allow a container sub class to supplement an invocation. Per default nothing to supplement.
+ *
+ * @param invocation
+ * @return
+ */
+ protected EJBContainerInvocation populateInvocation(EJBContainerInvocation invocation)
+ {
+ return invocation;
+ }
+
+ abstract protected void removeHandle(Handle handle) throws Exception;
+}
Deleted: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionContextImpl.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionContextImpl.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionContextImpl.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -1,129 +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.EJBLocalObject;
-import javax.ejb.EJBObject;
-import javax.ejb.SessionContext;
-import javax.xml.rpc.handler.MessageContext;
-
-import org.jboss.ejb3.EJBContextImpl;
-import org.jboss.ejb3.stateless.StatelessBeanContext;
-import org.jboss.logging.Logger;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public class SessionContextImpl extends EJBContextImpl<SessionContainer, SessionBeanContext> implements SessionContext
-{
- @SuppressWarnings("unused")
- private static final Logger log = Logger.getLogger(SessionContextImpl.class);
-
- public SessionContextImpl(SessionBeanContext beanContext)
- {
- super(beanContext);
- }
-
- public <T> T getBusinessObject(Class<T> businessInterface) throws IllegalStateException
- {
- if(businessInterface == null)
- throw new IllegalStateException("businessInterface is null");
-
- return container.getBusinessObject(beanContext, businessInterface);
- }
-
- public EJBLocalObject getEJBLocalObject() throws IllegalStateException
- {
- try
- {
- Object id = beanContext.getId();
- EJBLocalObject proxy = null;
- try
- {
- proxy = (EJBLocalObject) container.createLocalProxy(id);
- }
- // Proxy does not implement EJBLocalObject
- catch (ClassCastException cce)
- {
- // JIRA EJBTHREE-1057
- throw new IllegalStateException("EJB3 Specification Violation: " + container.getBeanClassName()
- + " does not have a local interface; "
- + "EJB3 Spec 4.3.3 Bullet 12: Only session beans with a local EJBLocalObject interface "
- + "can call this method.");
-
- }
- return proxy;
- }
- catch (Exception e)
- {
- throw new IllegalStateException(e);
- }
- }
-
- public EJBObject getEJBObject() throws IllegalStateException
- {
- try
- {
- Object id = beanContext.getId();
- EJBObject proxy = null;
- try
- {
- proxy = (EJBObject) container.createRemoteProxy(id);
- }
- // Proxy does not implement EJBObject
- catch (ClassCastException cce)
- {
- // JIRA EJBTHREE-1057
- throw new IllegalStateException("EJB3 Specification Violation: " + container.getBeanClassName()
- + " does not have a remote interface; "
- + "EJB3 Spec 4.3.3 Bullet 10: Only session beans with a remote EJBObject interface "
- + "can call this method.");
- }
- return proxy;
- }
- catch (Exception e)
- {
- throw new IllegalStateException(e);
- }
- }
-
- public Class getInvokedBusinessInterface() throws IllegalStateException
- {
- return container.getInvokedBusinessInterface();
- }
-
- public MessageContext getMessageContext() throws IllegalStateException
- {
- // disallowed for stateful session beans (EJB3 FR 4.4.1 p 81)
- if(beanContext instanceof StatelessBeanContext)
- {
- MessageContext ctx = ((StatelessBeanContext) beanContext).getMessageContextJAXRPC();
- if(ctx == null)
- throw new IllegalStateException("No message context found");
- return ctx;
- }
- throw new UnsupportedOperationException("Only stateless beans can have a message context");
- }
-}
Copied: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionContextImpl.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionContextImpl.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionContextImpl.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionContextImpl.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -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.session;
+
+import javax.ejb.EJBLocalObject;
+import javax.ejb.EJBObject;
+import javax.ejb.SessionContext;
+import javax.xml.rpc.handler.MessageContext;
+
+import org.jboss.ejb3.EJBContextImpl;
+import org.jboss.ejb3.stateful.StatefulContainer;
+import org.jboss.ejb3.stateless.StatelessBeanContext;
+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 SessionContextImpl<J extends SessionContainer> extends EJBContextImpl<J, SessionBeanContext<J>>
+ implements
+ SessionContext
+{
+ @SuppressWarnings("unused")
+ private static final Logger log = Logger.getLogger(SessionContextImpl.class);
+
+ public SessionContextImpl(SessionBeanContext<J> beanContext)
+ {
+ super(beanContext);
+ }
+
+ public <T> T getBusinessObject(Class<T> businessInterface) throws IllegalStateException
+ {
+ if(businessInterface == null)
+ throw new IllegalStateException("businessInterface is null");
+
+ return container.getBusinessObject(beanContext, businessInterface);
+ }
+
+ public EJBLocalObject getEJBLocalObject() throws IllegalStateException
+ {
+ try
+ {
+ Object id = beanContext.getId();
+ EJBLocalObject proxy = null;
+ try
+ {
+ if (container instanceof StatefulContainer)
+ {
+ proxy = (EJBLocalObject) ((StatefulContainer) container).createProxyLocalEjb21(id);
+ }
+ else
+ {
+ proxy = (EJBLocalObject) ((StatelessContainer) container).createProxyLocalEjb21();
+ }
+ }
+ // Proxy does not implement EJBLocalObject
+ catch (ClassCastException cce)
+ {
+ // JIRA EJBTHREE-1057
+ throw new IllegalStateException("EJB3 Specification Violation: " + container.getBeanClassName()
+ + " does not have a local interface; "
+ + "EJB3 Spec 4.3.3 Bullet 12: Only session beans with a local EJBLocalObject interface "
+ + "can call this method.");
+
+ }
+ return proxy;
+ }
+ catch (Exception e)
+ {
+ throw new IllegalStateException(e);
+ }
+ }
+
+ public EJBObject getEJBObject() throws IllegalStateException
+ {
+ try
+ {
+ Object id = beanContext.getId();
+ EJBObject proxy = null;
+ try
+ {
+ if (container instanceof StatefulContainer)
+ {
+ proxy = (EJBObject) ((StatefulContainer) container).createProxyRemoteEjb21(id);
+ }
+ else
+ {
+ proxy = (EJBObject) ((StatelessContainer) container).createProxyRemoteEjb21();
+ }
+ }
+ // Proxy does not implement EJBObject
+ catch (ClassCastException cce)
+ {
+ // JIRA EJBTHREE-1057
+ throw new IllegalStateException("EJB3 Specification Violation: " + container.getBeanClassName()
+ + " does not have a remote interface; "
+ + "EJB3 Spec 4.3.3 Bullet 10: Only session beans with a remote EJBObject interface "
+ + "can call this method.");
+ }
+ return proxy;
+ }
+ catch (Exception e)
+ {
+ throw new IllegalStateException(e);
+ }
+ }
+
+ public Class<?> getInvokedBusinessInterface() throws IllegalStateException
+ {
+ return container.getInvokedBusinessInterface();
+ }
+
+ public MessageContext getMessageContext() throws IllegalStateException
+ {
+ // disallowed for stateful session beans (EJB3 FR 4.4.1 p 81)
+ if(beanContext instanceof StatelessBeanContext)
+ {
+ MessageContext ctx = ((StatelessBeanContext) beanContext).getMessageContextJAXRPC();
+ if(ctx == null)
+ throw new IllegalStateException("No message context found");
+ return ctx;
+ }
+ throw new UnsupportedOperationException("Only stateless beans can have a message context");
+ }
+}
Copied: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionSpecBeanContext.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionSpecBeanContext.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionSpecBeanContext.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionSpecBeanContext.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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;
+
+/**
+ * Context for Session Beans adhering to EJB3 Specification (SFSB, SLSB)
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public abstract class SessionSpecBeanContext<T extends SessionSpecContainer>
+ extends
+ SessionBeanContext<SessionSpecContainer>
+{
+
+ protected SessionSpecBeanContext(T container)
+ {
+ super(container);
+ }
+
+ protected SessionSpecBeanContext(T container, Object bean)
+ {
+ super(container, bean);
+ }
+
+}
Copied: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,77 @@
+package org.jboss.ejb3.session;
+
+import java.util.Hashtable;
+
+import org.jboss.aop.Domain;
+import org.jboss.ejb3.Ejb3Deployment;
+import org.jboss.ejb3.annotation.LocalBinding;
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+
+/**
+ * SessionSpecContainer
+ *
+ * A SessionContainer with support for Session Beans defined
+ * specifically by the EJB3 Specification
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public abstract class SessionSpecContainer extends SessionContainer
+{
+
+ // Constructor
+
+ public SessionSpecContainer(ClassLoader cl, String beanClassName, String ejbName, Domain domain,
+ Hashtable ctxProperties, Ejb3Deployment deployment, JBossSessionBeanMetaData beanMetaData)
+ throws ClassNotFoundException
+ {
+ super(cl, beanClassName, ejbName, domain, ctxProperties, deployment, beanMetaData);
+ }
+
+ /**
+ * Create a remote proxy (EJBObject) for an enterprise bean identified by id
+ *
+ * @param id
+ * @return
+ * @throws Exception
+ */
+ public Object createProxyRemoteEjb21() throws Exception
+ {
+ RemoteBinding binding = this.getRemoteBinding();
+ return this.createProxyRemoteEjb21(binding);
+ }
+
+ /**
+ * Create a remote proxy (EJBObject) for an enterprise bean identified by id on a given binding
+ *
+ * @param id
+ * @param binding
+ * @return
+ * @throws Exception
+ */
+ public abstract Object createProxyRemoteEjb21(RemoteBinding binding) throws Exception;
+
+ /**
+ * Create a local proxy (EJBLocalObject) for an enterprise bean identified by id
+ *
+ * @param id
+ * @return
+ * @throws Exception
+ */
+ public Object createProxyLocalEjb21() throws Exception
+ {
+ LocalBinding binding = this.getAnnotation(LocalBinding.class);
+ return this.createProxyLocalEjb21(binding);
+ }
+
+ /**
+ * Create a local proxy (EJBLocalObject) for an enterprise bean identified by id, with
+ * the specified LocalBinding
+ *
+ * @param id
+ * @return
+ * @throws Exception
+ */
+ public abstract Object createProxyLocalEjb21(LocalBinding binding) throws Exception;
+}
Deleted: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/BaseStatefulProxyFactory.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/BaseStatefulProxyFactory.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/BaseStatefulProxyFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -1,350 +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 java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.ejb.EJBLocalObject;
-import javax.ejb.EJBObject;
-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.JBossProxy;
-import org.jboss.ejb3.JndiProxyFactory;
-import org.jboss.ejb3.ProxyFactory;
-import org.jboss.ejb3.ProxyFactoryHelper;
-import org.jboss.ejb3.SpecificationInterfaceType;
-import org.jboss.ejb3.session.BaseSessionProxyFactory;
-import org.jboss.ejb3.session.BaseSessionRemoteProxy;
-import org.jboss.ejb3.session.SessionContainer;
-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 org.jboss.ejb3.session.BaseSessionProxyFactory implements ProxyFactory
-{
- // Class Members
-
- @SuppressWarnings("unused")
- private static final Logger log = Logger.getLogger(BaseStatefulProxyFactory.class);
-
- protected static enum ProxyAccessType{
- REMOTE,LOCAL;
- }
-
-// protected Class proxyClass;
-
- /**
- * Proxy Constructor for the Business Interfaces' Proxy
- */
- private Constructor<?> businessProxyConstructor;
-
- /**
- * Proxy Constructor for the EJBObject/EJBLocalObject Proxy
- */
- private Constructor<?> ejb21ProxyConstructor;
-
-// protected Context proxyFactoryContext;
- protected String jndiName;
-
- public static final String PROXY_FACTORY_NAME = "StatefulProxyFactory";
-
- /**
- * Do not call, only for externalizable
- */
- protected BaseStatefulProxyFactory()
- {
- super();
- }
-
- public BaseStatefulProxyFactory(SessionContainer container, String jndiName)
- {
- super(container);
-
- assert jndiName != null : "jndiName is null";
-
- this.jndiName = jndiName;
- }
-
- protected Object constructBusinessProxy(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
- */
- private Object constructProxy(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))
- {
- 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;
- }
-
-
- public void init() throws Exception
- {
- // Ensure EJB2.1 View is Complete
- this.validateEjb21Views();
-
- // Create the Proxy Constructors
- this.createProxyConstructors();
- }
-
- /**
- * Creates the Proxy constructors
- */
- protected void createProxyConstructors() throws Exception
- {
- // Obtain interfaces to be used in the proxies
- Class<?>[] businessInterfaces = this.getInterfacesForBusinessProxy();
- Class<?>[] ejb21Interfaces = this.getInterfacesForEjb21Proxy();
-
- // Obtain this bean class' CL
- ClassLoader cl = this.getContainer().getBeanClass().getClassLoader();
-
- // Create proxy classes
- Class<?> businessProxyClass = java.lang.reflect.Proxy.getProxyClass(cl, businessInterfaces);
- Class<?> ejb21ProxyClass = java.lang.reflect.Proxy.getProxyClass(cl, ejb21Interfaces);
-
- // Obtain and set the proxy constructors
- this.businessProxyConstructor = businessProxyClass.getConstructor(InvocationHandler.class);
- this.ejb21ProxyConstructor = ejb21ProxyClass.getConstructor(InvocationHandler.class);
- }
-
- public void start() throws Exception
- {
- this.init();
-
- 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("java.lang.Object", 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;
- }
- }
-
- /**
- * 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
- *
- * @return
- */
- protected Class<?>[] getInterfacesForEjb21Proxy()
- {
- return this.getInterfacesForProxy(this.getProxyAccessType(), SpecificationInterfaceType.EJB21);
- }
-
- /**
- * Returns an array of interfaces to be used for the proxy;
- * the proxy type will be dependent on
- *
- * @param business
- * @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 EJBLocalObject
- else
- {
- // Add local interfaces
- intfs.addAll(Arrays.asList(ProxyFactoryHelper.getLocalInterfaces(container)));
-
- // 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 EJBObject
- else
- {
- // Add remote interfaces
- intfs.addAll(Arrays.asList(ProxyFactoryHelper.getRemoteInterfaces(container)));
-
- // 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[]
- {});
- }
-
- public void stop() throws Exception
- {
- Util.unbind(getContainer().getInitialContext(), jndiName);
- }
-
- /**
- * Defines the access type for this Proxies created by this Factory
- *
- * @return
- */
- protected abstract ProxyAccessType getProxyAccessType();
-
- protected final void initializeJndiName() {};
-
- public String getJndiName()
- {
- return this.jndiName;
- }
-
- @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/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/BaseStatefulProxyFactory.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/BaseStatefulProxyFactory.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/BaseStatefulProxyFactory.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/BaseStatefulProxyFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,142 @@
+/*
+ * 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.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 org.jboss.ejb3.session.BaseSessionProxyFactory implements ProxyFactory
+{
+ // Class Members
+
+ @SuppressWarnings("unused")
+ private static final Logger log = Logger.getLogger(BaseStatefulProxyFactory.class);
+
+// protected Context proxyFactoryContext;
+ protected String jndiName;
+
+ 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();
+
+ 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("java.lang.Object", 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() {};
+
+ public String getJndiName()
+ {
+ return this.jndiName;
+ }
+
+ @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/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/BaseStatefulRemoteProxyFactory.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/BaseStatefulRemoteProxyFactory.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/BaseStatefulRemoteProxyFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -1,142 +0,0 @@
-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.SessionContainer;
-import org.jboss.remoting.InvokerLocator;
-
-public abstract class BaseStatefulRemoteProxyFactory extends BaseStatefulProxyFactory implements RemoteProxyFactory
-{
-
- // Instance Members
-
- private RemoteBinding binding;
-
- private InvokerLocator locator;
-
- // Constructor
- public BaseStatefulRemoteProxyFactory(SessionContainer 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 createProxy()
- {
- Object id = getContainer().createSession();
- return this.createProxy(id);
- }
-
- public Object createProxy(Object id)
- {
- return this.createProxy(id,SpecificationInterfaceType.EJB30_BUSINESS);
- }
-
- // Specifications
-
- abstract String getStackNameInterceptors();
-
- // Functional Methods
-
- 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))
- {
- return this.constructEjb21Proxy(proxy);
- }
- else
- {
- return this.constructBusinessProxy(proxy);
- }
- }
-
- @Override
- protected StatefulRemoteHandleImpl createHandle()
- {
- Object proxy = this.createProxyEjb21();
- return this.createHandle(proxy);
- }
-
- protected StatefulRemoteHandleImpl createHandle(Object proxy)
- {
- StatefulRemoteHandleImpl handle = new StatefulRemoteHandleImpl((EJBObject)proxy);
- return handle;
- }
-
- public Object createProxyEjb21()
- {
- Object id = getContainer().createSession();
- return this.createProxyEjb21(id);
- }
-
- public Object createProxyEjb21(Object id)
- {
- return this.createProxy(id,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;
- }
-
-}
Copied: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/BaseStatefulRemoteProxyFactory.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/BaseStatefulRemoteProxyFactory.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/BaseStatefulRemoteProxyFactory.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/BaseStatefulRemoteProxyFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,153 @@
+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.remoting.InvokerLocator;
+
+public abstract class BaseStatefulRemoteProxyFactory extends BaseStatefulProxyFactory implements RemoteProxyFactory
+{
+
+ // 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
+
+ protected boolean bindHomeAndBusinessTogether(SessionContainer container)
+ {
+ 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))
+ {
+ 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);
+ }
+
+ // 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/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/NestedStatefulBeanContext.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/NestedStatefulBeanContext.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/NestedStatefulBeanContext.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -1,103 +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.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.util.HashMap;
-import java.util.List;
-
-import javax.persistence.EntityManager;
-import org.jboss.aop.metadata.SimpleMetaData;
-import org.jboss.ejb3.session.SessionContainer;
-
-import org.jboss.ejb3.Ejb3Registry;
-
-/**
- * Overrides superclass to not use MarshalledValue in externalization,
- * as a nested context is meant to be serialized as part of its parent
- * context and to share with it object references to any XPC or managed
- * entities. Serializing with a MarshalledValue would result in separate
- * deserializations of the XPCs and managed entities.
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public class NestedStatefulBeanContext extends StatefulBeanContext implements Externalizable
-{
- /** The serialVersionUID */
- private static final long serialVersionUID = 7835719320529968045L;
-
-
- public NestedStatefulBeanContext(SessionContainer container, Object bean)
- {
- super(container, bean);
- }
-
- public void writeExternal(ObjectOutput out) throws IOException
- {
- out.writeUTF(Ejb3Registry.clusterUid(getContainer()));
- out.writeUTF(Ejb3Registry.guid(getContainer()));
- out.writeObject(id);
- out.writeBoolean(isClustered);
- out.writeObject(metadata);
- out.writeObject(bean);
- out.writeObject(persistenceContexts);
- out.writeObject(interceptorInstances);
- out.writeObject(contains);
- // Cannot write a ref to our parent as that seems to blow up serialization
- //out.writeObject(containedIn);
- out.writeBoolean(removed);
- out.writeBoolean(replicationIsPassivation);
- }
-
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- {
- containerClusterUid = in.readUTF();
- containerGuid = in.readUTF();
- id = in.readObject();
- isClustered = in.readBoolean();
- metadata = (SimpleMetaData) in.readObject();
- bean = in.readObject();
- persistenceContexts = (HashMap<String, EntityManager>) in.readObject();
- interceptorInstances = (HashMap<Class, Object>)in.readObject();
- contains = (List<StatefulBeanContext>) in.readObject();
- removed = in.readBoolean();
- replicationIsPassivation = in.readBoolean();
-
- // Since we can't write a ref to our parent, our children also
- // don't have a ref to use. So reestablish it.
- if (contains != null)
- {
- for (StatefulBeanContext contained : contains)
- {
- contained.containedIn = this;
- }
- }
-
- // If we've just been deserialized, we are passivated
- passivated = true;
- }
-
-}
Copied: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/NestedStatefulBeanContext.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/NestedStatefulBeanContext.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/NestedStatefulBeanContext.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/NestedStatefulBeanContext.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,103 @@
+/*
+ * 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.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.HashMap;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+
+import org.jboss.aop.metadata.SimpleMetaData;
+import org.jboss.ejb3.Ejb3Registry;
+import org.jboss.ejb3.session.SessionSpecContainer;
+
+/**
+ * Overrides superclass to not use MarshalledValue in externalization,
+ * as a nested context is meant to be serialized as part of its parent
+ * context and to share with it object references to any XPC or managed
+ * entities. Serializing with a MarshalledValue would result in separate
+ * deserializations of the XPCs and managed entities.
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+public class NestedStatefulBeanContext extends StatefulBeanContext implements Externalizable
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 7835719320529968045L;
+
+
+ public NestedStatefulBeanContext(SessionSpecContainer container, Object bean)
+ {
+ super(container, bean);
+ }
+
+ public void writeExternal(ObjectOutput out) throws IOException
+ {
+ out.writeUTF(Ejb3Registry.clusterUid(getContainer()));
+ out.writeUTF(Ejb3Registry.guid(getContainer()));
+ out.writeObject(id);
+ out.writeBoolean(isClustered);
+ out.writeObject(metadata);
+ out.writeObject(bean);
+ out.writeObject(persistenceContexts);
+ out.writeObject(interceptorInstances);
+ out.writeObject(contains);
+ // Cannot write a ref to our parent as that seems to blow up serialization
+ //out.writeObject(containedIn);
+ out.writeBoolean(removed);
+ out.writeBoolean(replicationIsPassivation);
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
+ {
+ containerClusterUid = in.readUTF();
+ containerGuid = in.readUTF();
+ id = in.readObject();
+ isClustered = in.readBoolean();
+ metadata = (SimpleMetaData) in.readObject();
+ bean = in.readObject();
+ persistenceContexts = (HashMap<String, EntityManager>) in.readObject();
+ interceptorInstances = (HashMap<Class, Object>)in.readObject();
+ contains = (List<StatefulBeanContext>) in.readObject();
+ removed = in.readBoolean();
+ replicationIsPassivation = in.readBoolean();
+
+ // Since we can't write a ref to our parent, our children also
+ // don't have a ref to use. So reestablish it.
+ if (contains != null)
+ {
+ for (StatefulBeanContext contained : contains)
+ {
+ contained.containedIn = this;
+ }
+ }
+
+ // If we've just been deserialized, we are passivated
+ passivated = true;
+ }
+
+}
Deleted: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/ProxiedStatefulBeanContext.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/ProxiedStatefulBeanContext.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/ProxiedStatefulBeanContext.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -1,423 +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.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.locks.ReentrantLock;
-
-import javax.ejb.EJBContext;
-import javax.persistence.EntityManager;
-
-import org.jboss.aop.metadata.SimpleMetaData;
-import org.jboss.ejb3.interceptor.InterceptorInfo;
-import org.jboss.ejb3.session.SessionContainer;
-
-/**
- * Proxy to a NestedStatefulBeanContext that can be independently passivated,
- * activated and replicated without disturbing the object it is proxying.
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @author Brian Stansberry
- *
- * @version $Revision$
- */
-public class ProxiedStatefulBeanContext extends StatefulBeanContext implements Externalizable
-{
- /** The serialVersionUID */
- private static final long serialVersionUID = -5156610459343035743L;
-
- private transient StatefulBeanContext delegate;
-
- private Object oid;
-
- private String containerId;
-
- private StatefulBeanContextReference parentRef;
-
- public ProxiedStatefulBeanContext(StatefulBeanContext delegate)
- {
- super(delegate.getContainer(), delegate.getInstance());
-
- this.delegate = delegate;
- oid = delegate.getId();
- containerId = container.getObjectName().getCanonicalName();
- parentRef = new StatefulBeanContextReference(delegate.getContainedIn());
- }
-
- protected StatefulBeanContext getDelegate()
- {
- if (delegate == null)
- {
- for (StatefulBeanContext ctx : parentRef.getBeanContext().getContains())
- {
- Object matchingOid = ctx.getId();
- if (oid.equals(matchingOid)
- && ctx.getContainer().getObjectName().getCanonicalName()
- .equals(containerId))
- {
- delegate = ctx;
- break;
- }
- }
- if (delegate == null)
- throw new RuntimeException("Failed to read delegate");
-
- // If we just read our delegate, it's possible there's been a
- // failover and a remote node still has a ref to a stale delegate.
- // So, we should be replicated to invalidate the remote node.
- this.markedForReplication = true;
- }
- return delegate;
- }
-
- public void writeExternal(ObjectOutput out) throws IOException
- {
- out.writeObject(oid);
- out.writeUTF(containerId);
- out.writeObject(parentRef);
- }
-
- public void readExternal(ObjectInput in) throws IOException,
- ClassNotFoundException
- {
- oid = in.readObject();
- containerId = in.readUTF();
- parentRef = (StatefulBeanContextReference) in.readObject();
-
- assert parentRef != null : "parentRef is null";
- }
-
- @Override
- public List<StatefulBeanContext> getContains()
- {
- return getDelegate().getContains();
- }
-
- @Override
- public EntityManager getExtendedPersistenceContext(String id)
- {
- return getDelegate().getExtendedPersistenceContext(id);
- }
-
- @Override
- public void addExtendedPersistenceContext(String id, EntityManager pc)
- {
- getDelegate().addExtendedPersistenceContext(id, pc);
- }
-
- @Override
- public Map<String, EntityManager> getExtendedPersistenceContexts()
- {
- return getDelegate().getExtendedPersistenceContexts();
- }
-
- @Override
- public void removeExtendedPersistenceContext(String id)
- {
- getDelegate().removeExtendedPersistenceContext(id);
- }
-
- @Override
- public boolean scanForExtendedPersistenceContext(String id, StatefulBeanContext ignore)
- {
- return getDelegate().scanForExtendedPersistenceContext(id, ignore);
- }
-
- @Override
- public StatefulBeanContext getContainedIn()
- {
- return getDelegate().getContainedIn();
- }
-
- @Override
- public void addContains(StatefulBeanContext ctx)
- {
- getDelegate().addContains(ctx);
- }
-
- @Override
- public void removeContains(StatefulBeanContext ctx)
- {
- getDelegate().removeContains(ctx);
- }
-
- @Override
- public StatefulBeanContext pushContainedIn()
- {
- return getDelegate().pushContainedIn();
- }
-
- @Override
- public void popContainedIn()
- {
- getDelegate().popContainedIn();
- }
-
- @Override
- public StatefulBeanContext getUltimateContainedIn()
- {
- return getDelegate().getUltimateContainedIn();
- }
-
- @Override
- public boolean isInUse()
- {
- // Don't call delegate
- return super.isInUse();
- }
-
- @Override
- public void setInUse(boolean inUse)
- {
- super.setInUse(inUse);
- // delegate needs to know this for getCanPassivate()
- getDelegate().setInUse(inUse);
-
- if (!inUse)
- {
- // drop ref to delegate, as the delegate can be passivated/activated
- // without our knowledge, and if that happens we have a ref to a
- // stale delegate.
- delegate = null;
- }
- }
-
- @Override
- public boolean isDiscarded()
- {
- return getDelegate().isDiscarded();
- }
-
- @Override
- public void setDiscarded(boolean discarded)
- {
- getDelegate().setDiscarded(discarded);
- }
-
- @Override
- public boolean isRemoved()
- {
- return getDelegate().isRemoved();
- }
-
- @Override
- public ReentrantLock getLock()
- {
- return getDelegate().getLock();
- }
-
- @Override
- public boolean isInInvocation()
- {
- return getDelegate().isInInvocation();
- }
-
- @Override
- public void setInInvocation(boolean inInvocation)
- {
- getDelegate().setInInvocation(inInvocation);
- }
-
- @Override
- public Object getId()
- {
- return getDelegate().getId();
- }
-
-// @Override
-// public void setId(Object id)
-// {
-// this.oid = id;
-// getDelegate().setId(id);
-// }
-
- @Override
- public boolean isTxSynchronized()
- {
- return getDelegate().isTxSynchronized();
- }
-
- @Override
- public void setTxSynchronized(boolean txSynchronized)
- {
- getDelegate().setTxSynchronized(txSynchronized);
- }
-
- @Override
- public void remove()
- {
- getDelegate().remove();
- }
-
-// @Override
-// public void setContainer(Container container)
-// {
-// getDelegate().setContainer(container);
-// }
-//
- @Override
- public SessionContainer getContainer()
- {
- return getDelegate().getContainer();
- }
-
- @Override
- public Object getInstance()
- {
- return getDelegate().getInstance();
- }
-
- @Override
- public SimpleMetaData getMetaData()
- {
- return getDelegate().getMetaData();
- }
-
- @Override
- public Object[] getInterceptorInstances(InterceptorInfo[] interceptorInfos)
- {
- return getDelegate().getInterceptorInstances(interceptorInfos);
- }
-
- @Override
- public void extractBeanAndInterceptors()
- {
- getDelegate().extractBeanAndInterceptors();
- }
-
- /*
- @Override
- public void initialiseInterceptorInstances()
- {
- getDelegate().initialiseInterceptorInstances();
- }
- */
-
- @Override
- public EJBContext getEJBContext()
- {
- return getDelegate().getEJBContext();
- }
-
- /**
- * Ignores the call, as passivation of this proxy context
- * does not affect the underlying bean (which is passivated
- * along with its parent context).
- */
- @Override
- public void prePassivate()
- {
- }
-
- /**
- * Ignores the call, as activation of this proxy context
- * does not affect the underlying bean (which is activated
- * along with its parent context).
- */
- @Override
- public void postActivate()
- {
- }
-
- /**
- * Ignores the call, as passivation of this proxy context
- * does not affect the underlying bean (which is passivated
- * along with its parent context).
- */
- @Override
- public void passivateAfterReplication()
- {
- // ignore
- }
-
- /**
- * Ignores the call, as activation of this proxy context
- * does not affect the underlying bean (which is activated
- * along with its parent context).
- */
- @Override
- public void activateAfterReplication()
- {
- // ignore
- }
-
- @Override
- public boolean getCanPassivate()
- {
- if (delegate == null)
- {
- // If we haven't deserialized our delegate, we're not in use
- // on this node
- return true;
- }
- // Just check if *we* are in use; whether any children are
- // in use doesn't matter, since passivating this proxy
- // doesn't affect children
- return (isInUse() == false);
- }
-
- @Override
- public boolean getCanRemoveFromCache()
- {
- return getDelegate().getCanRemoveFromCache();
- }
-
- @Override
- public boolean getReplicationIsPassivation()
- {
- return getDelegate().getReplicationIsPassivation();
- }
-
- @Override
- public void setReplicationIsPassivation(boolean replicationIsPassivation)
- {
- getDelegate().setReplicationIsPassivation(replicationIsPassivation);
- }
-
- /**
- * Ignores the call, as replication of this proxy context
- * does not affect the underlying bean (which is replicated
- * along with its parent context).
- */
- @Override
- public void preReplicate()
- {
- // ignore
- }
-
- /**
- * Ignores the call, as replication of this proxy context
- * does not affect the underlying bean (which is replicated
- * along with its parent context).
- */
- @Override
- public void postReplicate()
- {
- // ignore
- }
-
-}
Copied: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/ProxiedStatefulBeanContext.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/ProxiedStatefulBeanContext.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/ProxiedStatefulBeanContext.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/ProxiedStatefulBeanContext.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,423 @@
+/*
+ * 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.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.locks.ReentrantLock;
+
+import javax.ejb.EJBContext;
+import javax.persistence.EntityManager;
+
+import org.jboss.aop.metadata.SimpleMetaData;
+import org.jboss.ejb3.interceptor.InterceptorInfo;
+import org.jboss.ejb3.session.SessionSpecContainer;
+
+/**
+ * Proxy to a NestedStatefulBeanContext that can be independently passivated,
+ * activated and replicated without disturbing the object it is proxying.
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @author Brian Stansberry
+ *
+ * @version $Revision$
+ */
+public class ProxiedStatefulBeanContext extends StatefulBeanContext implements Externalizable
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = -5156610459343035743L;
+
+ private transient StatefulBeanContext delegate;
+
+ private Object oid;
+
+ private String containerId;
+
+ private StatefulBeanContextReference parentRef;
+
+ public ProxiedStatefulBeanContext(StatefulBeanContext delegate)
+ {
+ super(delegate.getContainer(), delegate.getInstance());
+
+ this.delegate = delegate;
+ oid = delegate.getId();
+ containerId = container.getObjectName().getCanonicalName();
+ parentRef = new StatefulBeanContextReference(delegate.getContainedIn());
+ }
+
+ protected StatefulBeanContext getDelegate()
+ {
+ if (delegate == null)
+ {
+ for (StatefulBeanContext ctx : parentRef.getBeanContext().getContains())
+ {
+ Object matchingOid = ctx.getId();
+ if (oid.equals(matchingOid)
+ && ctx.getContainer().getObjectName().getCanonicalName()
+ .equals(containerId))
+ {
+ delegate = ctx;
+ break;
+ }
+ }
+ if (delegate == null)
+ throw new RuntimeException("Failed to read delegate");
+
+ // If we just read our delegate, it's possible there's been a
+ // failover and a remote node still has a ref to a stale delegate.
+ // So, we should be replicated to invalidate the remote node.
+ this.markedForReplication = true;
+ }
+ return delegate;
+ }
+
+ public void writeExternal(ObjectOutput out) throws IOException
+ {
+ out.writeObject(oid);
+ out.writeUTF(containerId);
+ out.writeObject(parentRef);
+ }
+
+ public void readExternal(ObjectInput in) throws IOException,
+ ClassNotFoundException
+ {
+ oid = in.readObject();
+ containerId = in.readUTF();
+ parentRef = (StatefulBeanContextReference) in.readObject();
+
+ assert parentRef != null : "parentRef is null";
+ }
+
+ @Override
+ public List<StatefulBeanContext> getContains()
+ {
+ return getDelegate().getContains();
+ }
+
+ @Override
+ public EntityManager getExtendedPersistenceContext(String id)
+ {
+ return getDelegate().getExtendedPersistenceContext(id);
+ }
+
+ @Override
+ public void addExtendedPersistenceContext(String id, EntityManager pc)
+ {
+ getDelegate().addExtendedPersistenceContext(id, pc);
+ }
+
+ @Override
+ public Map<String, EntityManager> getExtendedPersistenceContexts()
+ {
+ return getDelegate().getExtendedPersistenceContexts();
+ }
+
+ @Override
+ public void removeExtendedPersistenceContext(String id)
+ {
+ getDelegate().removeExtendedPersistenceContext(id);
+ }
+
+ @Override
+ public boolean scanForExtendedPersistenceContext(String id, StatefulBeanContext ignore)
+ {
+ return getDelegate().scanForExtendedPersistenceContext(id, ignore);
+ }
+
+ @Override
+ public StatefulBeanContext getContainedIn()
+ {
+ return getDelegate().getContainedIn();
+ }
+
+ @Override
+ public void addContains(StatefulBeanContext ctx)
+ {
+ getDelegate().addContains(ctx);
+ }
+
+ @Override
+ public void removeContains(StatefulBeanContext ctx)
+ {
+ getDelegate().removeContains(ctx);
+ }
+
+ @Override
+ public StatefulBeanContext pushContainedIn()
+ {
+ return getDelegate().pushContainedIn();
+ }
+
+ @Override
+ public void popContainedIn()
+ {
+ getDelegate().popContainedIn();
+ }
+
+ @Override
+ public StatefulBeanContext getUltimateContainedIn()
+ {
+ return getDelegate().getUltimateContainedIn();
+ }
+
+ @Override
+ public boolean isInUse()
+ {
+ // Don't call delegate
+ return super.isInUse();
+ }
+
+ @Override
+ public void setInUse(boolean inUse)
+ {
+ super.setInUse(inUse);
+ // delegate needs to know this for getCanPassivate()
+ getDelegate().setInUse(inUse);
+
+ if (!inUse)
+ {
+ // drop ref to delegate, as the delegate can be passivated/activated
+ // without our knowledge, and if that happens we have a ref to a
+ // stale delegate.
+ delegate = null;
+ }
+ }
+
+ @Override
+ public boolean isDiscarded()
+ {
+ return getDelegate().isDiscarded();
+ }
+
+ @Override
+ public void setDiscarded(boolean discarded)
+ {
+ getDelegate().setDiscarded(discarded);
+ }
+
+ @Override
+ public boolean isRemoved()
+ {
+ return getDelegate().isRemoved();
+ }
+
+ @Override
+ public ReentrantLock getLock()
+ {
+ return getDelegate().getLock();
+ }
+
+ @Override
+ public boolean isInInvocation()
+ {
+ return getDelegate().isInInvocation();
+ }
+
+ @Override
+ public void setInInvocation(boolean inInvocation)
+ {
+ getDelegate().setInInvocation(inInvocation);
+ }
+
+ @Override
+ public Object getId()
+ {
+ return getDelegate().getId();
+ }
+
+// @Override
+// public void setId(Object id)
+// {
+// this.oid = id;
+// getDelegate().setId(id);
+// }
+
+ @Override
+ public boolean isTxSynchronized()
+ {
+ return getDelegate().isTxSynchronized();
+ }
+
+ @Override
+ public void setTxSynchronized(boolean txSynchronized)
+ {
+ getDelegate().setTxSynchronized(txSynchronized);
+ }
+
+ @Override
+ public void remove()
+ {
+ getDelegate().remove();
+ }
+
+// @Override
+// public void setContainer(Container container)
+// {
+// getDelegate().setContainer(container);
+// }
+//
+ @Override
+ public SessionSpecContainer getContainer()
+ {
+ return getDelegate().getContainer();
+ }
+
+ @Override
+ public Object getInstance()
+ {
+ return getDelegate().getInstance();
+ }
+
+ @Override
+ public SimpleMetaData getMetaData()
+ {
+ return getDelegate().getMetaData();
+ }
+
+ @Override
+ public Object[] getInterceptorInstances(InterceptorInfo[] interceptorInfos)
+ {
+ return getDelegate().getInterceptorInstances(interceptorInfos);
+ }
+
+ @Override
+ public void extractBeanAndInterceptors()
+ {
+ getDelegate().extractBeanAndInterceptors();
+ }
+
+ /*
+ @Override
+ public void initialiseInterceptorInstances()
+ {
+ getDelegate().initialiseInterceptorInstances();
+ }
+ */
+
+ @Override
+ public EJBContext getEJBContext()
+ {
+ return getDelegate().getEJBContext();
+ }
+
+ /**
+ * Ignores the call, as passivation of this proxy context
+ * does not affect the underlying bean (which is passivated
+ * along with its parent context).
+ */
+ @Override
+ public void prePassivate()
+ {
+ }
+
+ /**
+ * Ignores the call, as activation of this proxy context
+ * does not affect the underlying bean (which is activated
+ * along with its parent context).
+ */
+ @Override
+ public void postActivate()
+ {
+ }
+
+ /**
+ * Ignores the call, as passivation of this proxy context
+ * does not affect the underlying bean (which is passivated
+ * along with its parent context).
+ */
+ @Override
+ public void passivateAfterReplication()
+ {
+ // ignore
+ }
+
+ /**
+ * Ignores the call, as activation of this proxy context
+ * does not affect the underlying bean (which is activated
+ * along with its parent context).
+ */
+ @Override
+ public void activateAfterReplication()
+ {
+ // ignore
+ }
+
+ @Override
+ public boolean getCanPassivate()
+ {
+ if (delegate == null)
+ {
+ // If we haven't deserialized our delegate, we're not in use
+ // on this node
+ return true;
+ }
+ // Just check if *we* are in use; whether any children are
+ // in use doesn't matter, since passivating this proxy
+ // doesn't affect children
+ return (isInUse() == false);
+ }
+
+ @Override
+ public boolean getCanRemoveFromCache()
+ {
+ return getDelegate().getCanRemoveFromCache();
+ }
+
+ @Override
+ public boolean getReplicationIsPassivation()
+ {
+ return getDelegate().getReplicationIsPassivation();
+ }
+
+ @Override
+ public void setReplicationIsPassivation(boolean replicationIsPassivation)
+ {
+ getDelegate().setReplicationIsPassivation(replicationIsPassivation);
+ }
+
+ /**
+ * Ignores the call, as replication of this proxy context
+ * does not affect the underlying bean (which is replicated
+ * along with its parent context).
+ */
+ @Override
+ public void preReplicate()
+ {
+ // ignore
+ }
+
+ /**
+ * Ignores the call, as replication of this proxy context
+ * does not affect the underlying bean (which is replicated
+ * along with its parent context).
+ */
+ @Override
+ public void postReplicate()
+ {
+ // ignore
+ }
+
+}
Deleted: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulBeanContext.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulBeanContext.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulBeanContext.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -1,1024 +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.ObjectStreamException;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.locks.ReentrantLock;
-
-import javax.ejb.EJBContext;
-import javax.persistence.EntityManager;
-import javax.transaction.Synchronization;
-import javax.transaction.Transaction;
-
-import org.jboss.aop.metadata.SimpleMetaData;
-import org.jboss.ejb3.Ejb3Registry;
-import org.jboss.ejb3.ThreadLocalStack;
-import org.jboss.ejb3.cache.Identifiable;
-import org.jboss.ejb3.cache.StatefulCache;
-import org.jboss.ejb3.interceptor.InterceptorInfo;
-import org.jboss.ejb3.session.SessionBeanContext;
-import org.jboss.ejb3.session.SessionContainer;
-import org.jboss.ejb3.tx.TxUtil;
-import org.jboss.serial.io.MarshalledObject;
-import org.jboss.tm.TxUtils;
-import org.jboss.util.id.GUID;
-
-/**
- * BeanContext for a stateful session bean.
- *
- * Either bean or beanMO are always filled.
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @author Brian Stansberry
- *
- * @version $Revision$
- */
-public class StatefulBeanContext extends SessionBeanContext implements Identifiable, Serializable
-{
- /** The serialVersionUID */
- private static final long serialVersionUID = -102470788178912606L;
-
- private static class Serialized implements Serializable
- {
- private static final long serialVersionUID = 1L;
-
- private String containerClusterUid;
- private String containerGuid;
- private boolean isClustered = false;
- private Object id;
- private SimpleMetaData metadata;
- private long lastUsed;
- private MarshalledObject beanMO;
- private boolean removed;
- private boolean replicationIsPassivation;
-
- private Object readResolve() throws ObjectStreamException
- {
- StatefulContainer container = (StatefulContainer)Ejb3Registry.findContainer(containerGuid);
-
- if (isClustered && container == null)
- container = (StatefulContainer)Ejb3Registry.getClusterContainer(containerClusterUid);
-
- if(container == null)
- throw new IllegalStateException("Can't find container " + containerGuid);
-
- StatefulBeanContext context = new StatefulBeanContext(container, beanMO);
- context.id = this.id;
- context.metadata = this.metadata;
- context.lastUsed = this.lastUsed;
- context.removed = this.removed;
- context.replicationIsPassivation = this.replicationIsPassivation;
- // I'm deserializing, so I was passivated
- context.passivated = true;
- return context;
- }
- }
-
- protected Object id;
-
- protected boolean txSynchronized = false;
-
- protected boolean inInvocation = false;
-
- protected MarshalledObject beanMO;
-
- protected ReentrantLock lock = new ReentrantLock();
-
- protected boolean discarded;
-
- // these two are needed for propagated extended persistence contexts when one
- // SFSB injects another.
- public static ThreadLocalStack<StatefulBeanContext> propagatedContainedIn = new ThreadLocalStack<StatefulBeanContext>();
-
- public static ThreadLocalStack<StatefulBeanContext> currentBean = new ThreadLocalStack<StatefulBeanContext>();
-
- protected StatefulBeanContext containedIn;
-
- protected List<StatefulBeanContext> contains;
-
- protected HashMap<String, EntityManager> persistenceContexts;
-
- protected boolean removed;
-
- protected String containerClusterUid;
- protected String containerGuid;
- protected boolean isClustered = false;
-
- protected boolean replicationIsPassivation = true;
-
- protected transient boolean passivated = false;
-
- /**
- * An incoming context from serialization.
- *
- * @param container
- * @param beanMO
- */
- protected StatefulBeanContext(SessionContainer container, MarshalledObject beanMO)
- {
- super(container);
-
- assert beanMO != null : "beanMO is null";
-
- this.containerClusterUid = Ejb3Registry.clusterUid(container);
- this.containerGuid = Ejb3Registry.guid(container);
- this.isClustered = container.isClustered();
- this.beanMO = beanMO;
- }
-
- /**
- * A brand new stateful session bean.
- *
- * @param container
- * @param bean
- */
- protected StatefulBeanContext(SessionContainer container, Object bean)
- {
- super(container, bean);
-
- this.containerClusterUid = Ejb3Registry.clusterUid(container);
- this.containerGuid = Ejb3Registry.guid(container);
- this.isClustered = container.isClustered();
- this.id = new GUID();
- }
-
- public List<StatefulBeanContext> getContains()
- {
- if (bean == null)
- extractBeanAndInterceptors();
- return contains;
- }
-
- /**
- * Makes a copy of the contains list so nested callback iterators
- * can iterate over it without concern that another thread will
- * remove the context.
- *
- * TODO replace contains list with a concurrent collection
- */
- private List<StatefulBeanContext> getThreadSafeContains()
- {
- // Call getContains() to ensure unmarshalling
- List<StatefulBeanContext> orig = getContains();
- List<StatefulBeanContext> copy = null;
- if (orig != null)
- {
- synchronized (orig)
- {
- copy = new ArrayList<StatefulBeanContext>(orig);
- }
- }
- return copy;
- }
-
- @Override
- public EJBContext getEJBContext()
- {
- if(ejbContext == null)
- ejbContext = new StatefulSessionContextImpl(this);
- return ejbContext;
- }
-
- public EntityManager getExtendedPersistenceContext(String id)
- {
- EntityManager found = null;
- Map<String, EntityManager> extendedPCS = getExtendedPersistenceContexts();
- if (extendedPCS != null)
- {
- found = extendedPCS.get(id);
- }
- if (found != null)
- return found;
- if (containedIn != null)
- {
- found = containedIn.getExtendedPersistenceContext(id);
- }
- return found;
- }
-
- public void addExtendedPersistenceContext(String id, EntityManager pc)
- {
- Map<String, EntityManager> extendedPCS = getExtendedPersistenceContexts();
- if (extendedPCS == null)
- {
- extendedPCS = persistenceContexts = new HashMap<String, EntityManager>();
- }
- extendedPCS.put(id, pc);
- }
-
- public boolean scanForExtendedPersistenceContext(String id, StatefulBeanContext ignore)
- {
- if (this.equals(ignore))
- return false;
-
- if (!removed)
- {
- Map<String, EntityManager> extendedPCS = getExtendedPersistenceContexts();
- if (extendedPCS != null && extendedPCS.containsKey(id))
- return true;
- }
-
- if (getContains() != null)
- {
- synchronized (contains)
- {
- for (StatefulBeanContext contained : contains)
- {
- if (!contained.equals(ignore))
- {
- if (contained.scanForExtendedPersistenceContext(id, ignore))
- return true;
- }
- }
- }
- }
-
- return false;
- }
-
- public void removeExtendedPersistenceContext(String id)
- {
- Map<String, EntityManager> extendedPCS = getExtendedPersistenceContexts();
- if (extendedPCS != null)
- {
- extendedPCS.remove(id);
- }
-
- if (getContains() != null)
- {
- synchronized (contains)
- {
- for (StatefulBeanContext contained: contains)
- {
- contained.removeExtendedPersistenceContext(id);
- }
- }
- }
- }
-
- public Map<String, EntityManager> getExtendedPersistenceContexts()
- {
- if (persistenceContexts == null)
- {
- if (bean == null)
- extractBeanAndInterceptors(); // unmarshall
- }
- return persistenceContexts;
- }
-
- public StatefulBeanContext getContainedIn()
- {
- return containedIn;
- }
-
- public StatefulBeanContext getUltimateContainedIn()
- {
- StatefulBeanContext child = this;
- StatefulBeanContext parent = containedIn;
-
- while (parent != null)
- {
- child = parent;
- parent = parent.getContainedIn();
- }
-
- if (parent == null && this != child)
- {
- // Don't hand out a ref to our parent obtained by walking the
- // tree. Rather, get it from its cache. This gives the cache
- // a chance to activate it if it hasn't been. We don't want
- // to mark the parent as in use though.
- StatefulCache ultimateCache = ((StatefulContainer)child.getContainer()).getCache();
- child = ultimateCache.get(child.getId(), false);
- }
-
- return child;
- }
-
- public void addContains(StatefulBeanContext ctx)
- {
- if (getContains() == null)
- contains = new ArrayList<StatefulBeanContext>();
-
- synchronized (contains)
- {
- contains.add(ctx);
- ctx.containedIn = this;
- }
- }
-
- public void removeContains(StatefulBeanContext ctx)
- {
- if (getContains() != null) // call getContains() to ensure unmarshalling
- {
- // Need to be thread safe
- synchronized (contains)
- {
- if (contains.remove(ctx))
- {
- ctx.containedIn = null;
- }
- }
-
- if (removed)
- {
- // Close out any XPCs that are no longer referenced
- cleanExtendedPCs();
- }
-
- if (getCanRemoveFromCache())
- {
- if (containedIn != null)
- {
- containedIn.removeContains(this);
- }
-
- // Notify our cache to remove us as we no longer have children
- ((StatefulContainer) getContainer()).getCache().remove(getId());
- }
- }
- }
-
- public StatefulBeanContext pushContainedIn()
- {
- StatefulBeanContext thisPtr = this;
- if (propagatedContainedIn.getList() != null)
- {
- // This is a nested stateful bean, within another stateful bean.
- // We need to create a nested bean context. The nested one will
- // be put in the parent's list and owned by it. It is a special
- // class because we do not want to put its state in a separate
- // marshalled object as we want to maintain object references
- // between it and its parent.
-
- // We also do not want to put the nested context within its container's
- // cache. If placed in the cache, it could be independently passivated,
- // activated and replicated, again breaking object references due to
- // independent marshalling. Instead, we return a proxy to it that will
- // be stored in its container's cache
- containedIn = propagatedContainedIn.get();
- NestedStatefulBeanContext nested = new NestedStatefulBeanContext(getContainer(), bean);
- nested.id = id;
- nested.container = getContainer();
- nested.containerClusterUid = containerClusterUid;
- nested.containerGuid = containerGuid;
- nested.isClustered = isClustered;
- nested.replicationIsPassivation = replicationIsPassivation;
- containedIn.addContains(nested);
- thisPtr = new ProxiedStatefulBeanContext(nested);
- }
- propagatedContainedIn.push(thisPtr);
- return thisPtr;
- }
-
- /**
- * Checks whether this context or any of its children are in use.
- */
- public boolean getCanPassivate()
- {
- boolean canPassivate = (removed || !inUse);
-
- // Just check contains directly; don't call getContains() since
- // getContains() will deserialize the beanMO. If the beanMO isn't
- // deserialized it's safe to assume the children aren't in use
- if (canPassivate && contains != null)
- {
- synchronized (contains)
- {
- for (StatefulBeanContext contained : contains)
- {
- if (!contained.getCanPassivate())
- {
- canPassivate = false;
- break;
- }
- }
- }
- }
-
- return canPassivate;
- }
-
- /**
- * Notification from a non-clustered StatefulCache to inform
- * that we are about to be passivated.
- */
- public void prePassivate()
- {
- if (!removed && !passivated)
- {
- getContainer().invokePrePassivate(this);
- passivated = true;
- }
-
- // Pass the call on to any nested children
- List<StatefulBeanContext> children = getThreadSafeContains();
- if (children != null)
- {
- for (StatefulBeanContext contained : children)
- {
- contained.prePassivate();
- }
- }
- }
-
- /**
- * Notification from a non-clustered StatefulCache to inform
- * that we have been activated.
- */
- public void postActivate()
- {
- if (!removed && passivated)
- {
- getContainer().invokePostActivate(this);
- passivated = false;
- }
-
- // Pass the call on to any nested children
- List<StatefulBeanContext> children = getThreadSafeContains();
- if (children != null)
- {
- for (StatefulBeanContext contained : children)
- {
- contained.postActivate();
- }
- }
- }
-
- /**
- * Notification from a ClusteredStatefulCache to inform
- * that a bean that is stored in the distributed cache is now
- * being passivated as well. Something of a misnomer
- * as it is possible the bean wasn't replicated (if it implements
- * Optimized it may have been activated and then a reference left
- * in the cache without the bean ever being replicated).
- */
- public void passivateAfterReplication()
- {
- if (!removed && !passivated)
- {
- getInstance(); // make sure we're unmarshalled
- getContainer().invokePrePassivate(this);
- passivated = true;
- }
-
- // Only bother informing children if we aren't already serialized.
- // If we're serialized, so are they and there's no point.
- // Notifying them would cause us to deserialize a beanMO to no purpose.
- if (contains != null)
- {
- // Pass the call on to any nested children
- List<StatefulBeanContext> children = getThreadSafeContains();
- if (children != null)
- {
- for (StatefulBeanContext contained : children)
- {
- contained.passivateAfterReplication();
- }
- }
- }
- }
-
- public void activateAfterReplication()
- {
- if (!removed && passivated)
- {
- getInstance(); // make sure we're unmarshalled
- getContainer().invokePostActivate(this);
- passivated = false;
- }
-
- // Pass the call on to any nested children
- List<StatefulBeanContext> children = getThreadSafeContains();
- if (children != null)
- {
- for (StatefulBeanContext contained : children)
- {
- contained.activateAfterReplication();
- }
- }
- }
-
- public boolean getReplicationIsPassivation()
- {
- return replicationIsPassivation;
- }
-
- public void setReplicationIsPassivation(boolean replicationIsPassivation)
- {
- this.replicationIsPassivation = replicationIsPassivation;
- }
-
- /**
- * Notification from a ClusteredStatefulCache before a bean is
- * replicated.
- */
- public void preReplicate()
- {
- if (!removed && replicationIsPassivation && !passivated)
- {
- getContainer().invokePrePassivate(this);
- passivated = true;
- }
-
- // Pass the call on to any nested children
- List<StatefulBeanContext> children = getThreadSafeContains();
- if (children != null)
- {
- for (StatefulBeanContext contained : children)
- {
- contained.preReplicate();
- }
- }
- }
-
- /**
- * Notification from a ClusteredStatefulCache after the bean
- * is fetched from the distributed cache. Something of a misnomer
- * as it is possible the bean wasn't replicated (if it implements
- * Optimized it can be fetched from the cache twice without ever
- * being replicated).
- */
- public void postReplicate()
- {
- // We may not have been replicated, so only invoke @PostActivate
- // if we are marked as passivated
- if (!removed && passivated)
- {
- getContainer().invokePostActivate(this);
- passivated = false;
- }
-
- // Pass the call on to any nested children
- List<StatefulBeanContext> children = getThreadSafeContains();
- if (children != null)
- {
- for (StatefulBeanContext contained : children)
- {
- contained.postReplicate();
- }
- }
- }
-
- public void popContainedIn()
- {
- propagatedContainedIn.pop();
- }
-
- public boolean isInUse()
- {
- return inUse;
- }
-
- public void setInUse(boolean inUse)
- {
- this.inUse = inUse;
- }
-
- public boolean isDiscarded()
- {
- return discarded;
- }
-
- public void setDiscarded(boolean discarded)
- {
- this.discarded = discarded;
- }
-
- public ReentrantLock getLock()
- {
- return lock;
- }
-
- public boolean isInInvocation()
- {
- return inInvocation;
- }
-
- public void setInInvocation(boolean inInvocation)
- {
- this.inInvocation = inInvocation;
- }
-
- public Object getId()
- {
- return id;
- }
-
- public boolean isTxSynchronized()
- {
- return txSynchronized;
- }
-
- public void setTxSynchronized(boolean txSynchronized)
- {
- this.txSynchronized = txSynchronized;
- }
-
- public boolean isRemoved()
- {
- return removed;
- }
-
- public void remove()
- {
- if (removed)
- return;
- removed = true;
- RuntimeException exceptionThrown = null;
-
- // Close any XPCs that haven't been injected into live
- // beans in our family
- try
- {
- cleanExtendedPCs();
- }
- catch (RuntimeException e)
- {
- // we still need to remove ourself from any parent, so save
- // the thrown exception and rethrow it after we have cleaned up.
- if (exceptionThrown == null)
- exceptionThrown = e;
- }
-
- if (containedIn != null && getCanRemoveFromCache())
- {
- try
- {
- containedIn.removeContains(this);
- }
- catch (RuntimeException e)
- {
- // we still need to clean internal state, so save the
- // thrown exception and rethrow it after we have cleaned up.
- if (exceptionThrown == null)
- exceptionThrown = e;
- }
- }
-
- // Clear out refs to our bean and interceptors, to reduce our footprint
- // in case we are still cached for our refs to any XPCs
- bean = null;
- interceptorInstances = null;
-
- if (exceptionThrown != null) throw new RuntimeException("exception thrown while removing SFSB", exceptionThrown);
- }
-
- public boolean getCanRemoveFromCache()
- {
- boolean canRemove = removed;
-
- if (canRemove && getContains() != null) // call getContains() to ensure unmarshalling
- {
- synchronized (contains)
- {
- canRemove = (contains.size() == 0);
- }
- }
-
- return canRemove;
- }
-
- private void cleanExtendedPCs()
- {
- try
- {
- Transaction tx = TxUtil.getTransactionManager().getTransaction();
- if (tx != null && TxUtils.isActive(tx))
- {
- tx.registerSynchronization(new XPCCloseSynchronization(this));
- }
- else
- {
- closeExtendedPCs();
- }
- }
- catch (RuntimeException e)
- {
- throw e;
- }
- catch (Exception e)
- {
- throw new RuntimeException("Error cleaning PersistenceContexts in SFSB removal", e);
- }
- }
-
- private void closeExtendedPCs()
- {
- Map<String, EntityManager> extendedPCS = getExtendedPersistenceContexts();
- if (extendedPCS != null)
- {
- RuntimeException exceptionThrown = null;
-
- List<String> closedXPCs = new ArrayList<String>();
- StatefulBeanContext topCtx = getUltimateContainedIn();
-
- for (Iterator<Map.Entry<String,EntityManager>> iter = extendedPCS.entrySet().iterator();
- iter.hasNext();)
- {
- Map.Entry<String,EntityManager> entry = iter.next();
- String id = entry.getKey();
- EntityManager xpc = entry.getValue();
-
- // Only close the XPC if our live parent(s) or cousins
- // don't also have a ref to it
- boolean canClose = topCtx.scanForExtendedPersistenceContext(id, this);
-
- if (canClose && getContains() != null)
- {
- // Only close the XPC if our live childrenScan don't have a ref
- synchronized (contains)
- {
- for (StatefulBeanContext contained : contains)
- {
- if (contained.scanForExtendedPersistenceContext(id, null))
- {
- canClose = false;
- break;
- }
- }
- }
- }
-
- if (canClose)
- {
- try
- {
- xpc.close();
- closedXPCs.add(id);
- }
- catch (RuntimeException e)
- {
- exceptionThrown = e;
- }
- }
- }
-
- // Clean all refs to the closed XPCs from the tree
- for (String id : closedXPCs)
- {
- topCtx.removeExtendedPersistenceContext(id);
- }
-
- if (exceptionThrown != null) throw new RuntimeException("Error closing PersistenceContexts in SFSB removal", exceptionThrown);
- }
- }
-
- @Override
- public SessionContainer getContainer()
- {
- if (container == null)
- {
- container = (SessionContainer)Ejb3Registry.findContainer(containerGuid);
-
- if (isClustered && container == null)
- container = (SessionContainer)Ejb3Registry.getClusterContainer(containerClusterUid);
- }
-
- return container;
- }
-
- @Override
- public Object getInstance()
- {
- if (bean == null)
- {
- extractBeanAndInterceptors();
- }
- assert bean != null : "bean is null";
- return bean;
- }
-
- @Override
- public SimpleMetaData getMetaData()
- {
- return super.getMetaData();
- }
-
- // these are public for fast concurrent access/update
- public volatile boolean markedForPassivation = false;
-
- public volatile boolean markedForReplication = false;
-
- // BES 2007/02/16 make private and use a getter/setter as
- // ProxiedStatefulBeanContext needs to pass the value on
- // to its NestedStatefulBeanContext
- private volatile boolean inUse = false;
-
- public long lastUsed = System.currentTimeMillis();
-
- @Override
- public Object[] getInterceptorInstances(InterceptorInfo[] interceptorInfos)
- {
- if (bean == null)
- {
- extractBeanAndInterceptors();
- }
- return super.getInterceptorInstances(interceptorInfos);
- }
-
- protected synchronized void extractBeanAndInterceptors()
- {
- if (beanMO == null)
- return;
-
- try
- {
- Object[] beanAndInterceptors = (Object[]) beanMO.get();
- bean = beanAndInterceptors[0];
- persistenceContexts = (HashMap<String, EntityManager>) beanAndInterceptors[1];
- ArrayList list = (ArrayList) beanAndInterceptors[2];
- interceptorInstances = new HashMap<Class, Object>();
- if (list != null)
- {
- for (Object o : list)
- {
- interceptorInstances.put(o.getClass(), o);
- }
- }
- contains = (List<StatefulBeanContext>) beanAndInterceptors[3];
- // Reestablish links to our children; if they serialize a link
- // to us for some reason serialization blows up
- if (contains != null)
- {
- for (StatefulBeanContext contained : contains)
- {
- contained.containedIn = this;
- }
- }
-
- // Don't hold onto the beanMo, as its contents are mutable
- // and we don't want to serialize a stale version of them
- beanMO = null;
- }
- catch (IOException e)
- {
- throw new RuntimeException(e);
- }
- catch (ClassNotFoundException e)
- {
- throw new RuntimeException(e);
- }
- }
-
- private Object writeReplace() throws ObjectStreamException
- {
- Serialized state = new Serialized();
- if (this.beanMO == null)
- {
- Object[] beanAndInterceptors = new Object[4];
- beanAndInterceptors[0] = bean;
- beanAndInterceptors[1] = persistenceContexts;
- if (interceptorInstances != null && interceptorInstances.size() > 0)
- {
- ArrayList list = new ArrayList();
- list.addAll(interceptorInstances.values());
- beanAndInterceptors[2] = list;
- }
- beanAndInterceptors[3] = contains;
-
- // BES 2007/02/12 Previously we were trying to hold a ref to
- // beanMO after we created it, but that exposes the risk of
- // two different versions of the constituent state that
- // can fall out of sync. So now we just write a local variable.
-
- try
- {
- MarshalledObject mo = new MarshalledObject(beanAndInterceptors);
- state.beanMO = mo;
- }
- catch(IOException e)
- {
- throw new RuntimeException("Marshalling of bean " + bean + " failed", e);
- }
- }
- else
- {
- // We've been deserialized and are now being re-serialized, but
- // extractBeanAndInterceptors hasn't been called in between.
- // This can happen if a passivated session is involved in a
- // JBoss Cache state transfer to a newly deployed node.
- state.beanMO = this.beanMO;
- }
-
- state.containerClusterUid = this.containerClusterUid;
- state.containerGuid = this.containerGuid;
- state.isClustered = this.isClustered;
- state.id = this.id;
- state.lastUsed = this.lastUsed;
- state.metadata = this.metadata;
- state.removed = this.removed;
- state.replicationIsPassivation = this.replicationIsPassivation;
- return state;
- }
-
-// public void writeExternal(ObjectOutput out) throws IOException
-// {
-// out.writeUTF(containerName);
-// out.writeObject(id);
-// out.writeObject(metadata);
-// out.writeLong(lastUsed);
-//
-// if (beanMO == null)
-// {
-// Object[] beanAndInterceptors = new Object[4];
-// beanAndInterceptors[0] = bean;
-// beanAndInterceptors[1] = persistenceContexts;
-// if (interceptorInstances != null && interceptorInstances.size() > 0)
-// {
-// ArrayList list = new ArrayList();
-// list.addAll(interceptorInstances.values());
-// beanAndInterceptors[2] = list;
-// }
-// beanAndInterceptors[3] = contains;
-//
-// // BES 2007/02/12 Previously we were trying to hold a ref to
-// // beanMO after we created it, but that exposes the risk of
-// // two different versions of the constituent state that
-// // can fall out of sync. So now we just write a local variable.
-//
-// MarshalledObject mo = new MarshalledObject(beanAndInterceptors);
-// out.writeObject(mo);
-// }
-// else
-// {
-// // We've been deserialized and are now being re-serialized, but
-// // extractBeanAndInterceptors hasn't been called in between.
-// // This can happen if a passivated session is involved in a
-// // JBoss Cache state transfer to a newly deployed node.
-// out.writeObject(beanMO);
-// }
-//
-//
-// out.writeBoolean(removed);
-// out.writeBoolean(replicationIsPassivation);
-// }
-//
-// public void readExternal(ObjectInput in) throws IOException,
-// ClassNotFoundException
-// {
-// containerName = in.readUTF();
-// id = in.readObject();
-// metadata = (SimpleMetaData) in.readObject();
-// lastUsed = in.readLong();
-//
-// beanMO = (MarshalledObject) in.readObject();
-// removed = in.readBoolean();
-// replicationIsPassivation = in.readBoolean();
-//
-// // If we've just been deserialized, we are passivated
-// passivated = true;
-// }
-
- public Object getInvokedMethodKey()
- {
- return this.getId();
- }
-
- private static class XPCCloseSynchronization implements Synchronization
- {
- private StatefulBeanContext ctx;
-
- private XPCCloseSynchronization(StatefulBeanContext context)
- {
- ctx = context;
- }
-
- public void beforeCompletion()
- {
- }
-
- public void afterCompletion(int status)
- {
- ctx.closeExtendedPCs();
- // Clean ref to ctx, as some TMs leak Synchronization refs
- ctx = null;
- }
- }
-}
Copied: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulBeanContext.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulBeanContext.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulBeanContext.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulBeanContext.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,1025 @@
+/*
+ * 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.ObjectStreamException;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.locks.ReentrantLock;
+
+import javax.ejb.EJBContext;
+import javax.persistence.EntityManager;
+import javax.transaction.Synchronization;
+import javax.transaction.Transaction;
+
+import org.jboss.aop.metadata.SimpleMetaData;
+import org.jboss.ejb3.Ejb3Registry;
+import org.jboss.ejb3.ThreadLocalStack;
+import org.jboss.ejb3.cache.Identifiable;
+import org.jboss.ejb3.cache.StatefulCache;
+import org.jboss.ejb3.interceptor.InterceptorInfo;
+import org.jboss.ejb3.session.SessionContainer;
+import org.jboss.ejb3.session.SessionSpecBeanContext;
+import org.jboss.ejb3.session.SessionSpecContainer;
+import org.jboss.ejb3.tx.TxUtil;
+import org.jboss.serial.io.MarshalledObject;
+import org.jboss.tm.TxUtils;
+import org.jboss.util.id.GUID;
+
+/**
+ * BeanContext for a stateful session bean.
+ *
+ * Either bean or beanMO are always filled.
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @author Brian Stansberry
+ *
+ * @version $Revision$
+ */
+public class StatefulBeanContext extends SessionSpecBeanContext<SessionSpecContainer> implements Identifiable, Serializable
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = -102470788178912606L;
+
+ private static class Serialized implements Serializable
+ {
+ private static final long serialVersionUID = 1L;
+
+ private String containerClusterUid;
+ private String containerGuid;
+ private boolean isClustered = false;
+ private Object id;
+ private SimpleMetaData metadata;
+ private long lastUsed;
+ private MarshalledObject beanMO;
+ private boolean removed;
+ private boolean replicationIsPassivation;
+
+ private Object readResolve() throws ObjectStreamException
+ {
+ StatefulContainer container = (StatefulContainer)Ejb3Registry.findContainer(containerGuid);
+
+ if (isClustered && container == null)
+ container = (StatefulContainer)Ejb3Registry.getClusterContainer(containerClusterUid);
+
+ if(container == null)
+ throw new IllegalStateException("Can't find container " + containerGuid);
+
+ StatefulBeanContext context = new StatefulBeanContext(container, beanMO);
+ context.id = this.id;
+ context.metadata = this.metadata;
+ context.lastUsed = this.lastUsed;
+ context.removed = this.removed;
+ context.replicationIsPassivation = this.replicationIsPassivation;
+ // I'm deserializing, so I was passivated
+ context.passivated = true;
+ return context;
+ }
+ }
+
+ protected Object id;
+
+ protected boolean txSynchronized = false;
+
+ protected boolean inInvocation = false;
+
+ protected MarshalledObject beanMO;
+
+ protected ReentrantLock lock = new ReentrantLock();
+
+ protected boolean discarded;
+
+ // these two are needed for propagated extended persistence contexts when one
+ // SFSB injects another.
+ public static ThreadLocalStack<StatefulBeanContext> propagatedContainedIn = new ThreadLocalStack<StatefulBeanContext>();
+
+ public static ThreadLocalStack<StatefulBeanContext> currentBean = new ThreadLocalStack<StatefulBeanContext>();
+
+ protected StatefulBeanContext containedIn;
+
+ protected List<StatefulBeanContext> contains;
+
+ protected HashMap<String, EntityManager> persistenceContexts;
+
+ protected boolean removed;
+
+ protected String containerClusterUid;
+ protected String containerGuid;
+ protected boolean isClustered = false;
+
+ protected boolean replicationIsPassivation = true;
+
+ protected transient boolean passivated = false;
+
+ /**
+ * An incoming context from serialization.
+ *
+ * @param container
+ * @param beanMO
+ */
+ protected StatefulBeanContext(SessionSpecContainer container, MarshalledObject beanMO)
+ {
+ super(container);
+
+ assert beanMO != null : "beanMO is null";
+
+ this.containerClusterUid = Ejb3Registry.clusterUid(container);
+ this.containerGuid = Ejb3Registry.guid(container);
+ this.isClustered = container.isClustered();
+ this.beanMO = beanMO;
+ }
+
+ /**
+ * A brand new stateful session bean.
+ *
+ * @param container
+ * @param bean
+ */
+ protected StatefulBeanContext(SessionSpecContainer container, Object bean)
+ {
+ super(container, bean);
+
+ this.containerClusterUid = Ejb3Registry.clusterUid(container);
+ this.containerGuid = Ejb3Registry.guid(container);
+ this.isClustered = container.isClustered();
+ this.id = new GUID();
+ }
+
+ public List<StatefulBeanContext> getContains()
+ {
+ if (bean == null)
+ extractBeanAndInterceptors();
+ return contains;
+ }
+
+ /**
+ * Makes a copy of the contains list so nested callback iterators
+ * can iterate over it without concern that another thread will
+ * remove the context.
+ *
+ * TODO replace contains list with a concurrent collection
+ */
+ private List<StatefulBeanContext> getThreadSafeContains()
+ {
+ // Call getContains() to ensure unmarshalling
+ List<StatefulBeanContext> orig = getContains();
+ List<StatefulBeanContext> copy = null;
+ if (orig != null)
+ {
+ synchronized (orig)
+ {
+ copy = new ArrayList<StatefulBeanContext>(orig);
+ }
+ }
+ return copy;
+ }
+
+ @Override
+ public EJBContext getEJBContext()
+ {
+ if(ejbContext == null)
+ ejbContext = new StatefulSessionContextImpl(this);
+ return ejbContext;
+ }
+
+ public EntityManager getExtendedPersistenceContext(String id)
+ {
+ EntityManager found = null;
+ Map<String, EntityManager> extendedPCS = getExtendedPersistenceContexts();
+ if (extendedPCS != null)
+ {
+ found = extendedPCS.get(id);
+ }
+ if (found != null)
+ return found;
+ if (containedIn != null)
+ {
+ found = containedIn.getExtendedPersistenceContext(id);
+ }
+ return found;
+ }
+
+ public void addExtendedPersistenceContext(String id, EntityManager pc)
+ {
+ Map<String, EntityManager> extendedPCS = getExtendedPersistenceContexts();
+ if (extendedPCS == null)
+ {
+ extendedPCS = persistenceContexts = new HashMap<String, EntityManager>();
+ }
+ extendedPCS.put(id, pc);
+ }
+
+ public boolean scanForExtendedPersistenceContext(String id, StatefulBeanContext ignore)
+ {
+ if (this.equals(ignore))
+ return false;
+
+ if (!removed)
+ {
+ Map<String, EntityManager> extendedPCS = getExtendedPersistenceContexts();
+ if (extendedPCS != null && extendedPCS.containsKey(id))
+ return true;
+ }
+
+ if (getContains() != null)
+ {
+ synchronized (contains)
+ {
+ for (StatefulBeanContext contained : contains)
+ {
+ if (!contained.equals(ignore))
+ {
+ if (contained.scanForExtendedPersistenceContext(id, ignore))
+ return true;
+ }
+ }
+ }
+ }
+
+ return false;
+ }
+
+ public void removeExtendedPersistenceContext(String id)
+ {
+ Map<String, EntityManager> extendedPCS = getExtendedPersistenceContexts();
+ if (extendedPCS != null)
+ {
+ extendedPCS.remove(id);
+ }
+
+ if (getContains() != null)
+ {
+ synchronized (contains)
+ {
+ for (StatefulBeanContext contained: contains)
+ {
+ contained.removeExtendedPersistenceContext(id);
+ }
+ }
+ }
+ }
+
+ public Map<String, EntityManager> getExtendedPersistenceContexts()
+ {
+ if (persistenceContexts == null)
+ {
+ if (bean == null)
+ extractBeanAndInterceptors(); // unmarshall
+ }
+ return persistenceContexts;
+ }
+
+ public StatefulBeanContext getContainedIn()
+ {
+ return containedIn;
+ }
+
+ public StatefulBeanContext getUltimateContainedIn()
+ {
+ StatefulBeanContext child = this;
+ StatefulBeanContext parent = containedIn;
+
+ while (parent != null)
+ {
+ child = parent;
+ parent = parent.getContainedIn();
+ }
+
+ if (parent == null && this != child)
+ {
+ // Don't hand out a ref to our parent obtained by walking the
+ // tree. Rather, get it from its cache. This gives the cache
+ // a chance to activate it if it hasn't been. We don't want
+ // to mark the parent as in use though.
+ StatefulCache ultimateCache = ((StatefulContainer)child.getContainer()).getCache();
+ child = ultimateCache.get(child.getId(), false);
+ }
+
+ return child;
+ }
+
+ public void addContains(StatefulBeanContext ctx)
+ {
+ if (getContains() == null)
+ contains = new ArrayList<StatefulBeanContext>();
+
+ synchronized (contains)
+ {
+ contains.add(ctx);
+ ctx.containedIn = this;
+ }
+ }
+
+ public void removeContains(StatefulBeanContext ctx)
+ {
+ if (getContains() != null) // call getContains() to ensure unmarshalling
+ {
+ // Need to be thread safe
+ synchronized (contains)
+ {
+ if (contains.remove(ctx))
+ {
+ ctx.containedIn = null;
+ }
+ }
+
+ if (removed)
+ {
+ // Close out any XPCs that are no longer referenced
+ cleanExtendedPCs();
+ }
+
+ if (getCanRemoveFromCache())
+ {
+ if (containedIn != null)
+ {
+ containedIn.removeContains(this);
+ }
+
+ // Notify our cache to remove us as we no longer have children
+ ((StatefulContainer) getContainer()).getCache().remove(getId());
+ }
+ }
+ }
+
+ public StatefulBeanContext pushContainedIn()
+ {
+ StatefulBeanContext thisPtr = this;
+ if (propagatedContainedIn.getList() != null)
+ {
+ // This is a nested stateful bean, within another stateful bean.
+ // We need to create a nested bean context. The nested one will
+ // be put in the parent's list and owned by it. It is a special
+ // class because we do not want to put its state in a separate
+ // marshalled object as we want to maintain object references
+ // between it and its parent.
+
+ // We also do not want to put the nested context within its container's
+ // cache. If placed in the cache, it could be independently passivated,
+ // activated and replicated, again breaking object references due to
+ // independent marshalling. Instead, we return a proxy to it that will
+ // be stored in its container's cache
+ containedIn = propagatedContainedIn.get();
+ NestedStatefulBeanContext nested = new NestedStatefulBeanContext(getContainer(), bean);
+ nested.id = id;
+ nested.container = getContainer();
+ nested.containerClusterUid = containerClusterUid;
+ nested.containerGuid = containerGuid;
+ nested.isClustered = isClustered;
+ nested.replicationIsPassivation = replicationIsPassivation;
+ containedIn.addContains(nested);
+ thisPtr = new ProxiedStatefulBeanContext(nested);
+ }
+ propagatedContainedIn.push(thisPtr);
+ return thisPtr;
+ }
+
+ /**
+ * Checks whether this context or any of its children are in use.
+ */
+ public boolean getCanPassivate()
+ {
+ boolean canPassivate = (removed || !inUse);
+
+ // Just check contains directly; don't call getContains() since
+ // getContains() will deserialize the beanMO. If the beanMO isn't
+ // deserialized it's safe to assume the children aren't in use
+ if (canPassivate && contains != null)
+ {
+ synchronized (contains)
+ {
+ for (StatefulBeanContext contained : contains)
+ {
+ if (!contained.getCanPassivate())
+ {
+ canPassivate = false;
+ break;
+ }
+ }
+ }
+ }
+
+ return canPassivate;
+ }
+
+ /**
+ * Notification from a non-clustered StatefulCache to inform
+ * that we are about to be passivated.
+ */
+ public void prePassivate()
+ {
+ if (!removed && !passivated)
+ {
+ getContainer().invokePrePassivate(this);
+ passivated = true;
+ }
+
+ // Pass the call on to any nested children
+ List<StatefulBeanContext> children = getThreadSafeContains();
+ if (children != null)
+ {
+ for (StatefulBeanContext contained : children)
+ {
+ contained.prePassivate();
+ }
+ }
+ }
+
+ /**
+ * Notification from a non-clustered StatefulCache to inform
+ * that we have been activated.
+ */
+ public void postActivate()
+ {
+ if (!removed && passivated)
+ {
+ getContainer().invokePostActivate(this);
+ passivated = false;
+ }
+
+ // Pass the call on to any nested children
+ List<StatefulBeanContext> children = getThreadSafeContains();
+ if (children != null)
+ {
+ for (StatefulBeanContext contained : children)
+ {
+ contained.postActivate();
+ }
+ }
+ }
+
+ /**
+ * Notification from a ClusteredStatefulCache to inform
+ * that a bean that is stored in the distributed cache is now
+ * being passivated as well. Something of a misnomer
+ * as it is possible the bean wasn't replicated (if it implements
+ * Optimized it may have been activated and then a reference left
+ * in the cache without the bean ever being replicated).
+ */
+ public void passivateAfterReplication()
+ {
+ if (!removed && !passivated)
+ {
+ getInstance(); // make sure we're unmarshalled
+ getContainer().invokePrePassivate(this);
+ passivated = true;
+ }
+
+ // Only bother informing children if we aren't already serialized.
+ // If we're serialized, so are they and there's no point.
+ // Notifying them would cause us to deserialize a beanMO to no purpose.
+ if (contains != null)
+ {
+ // Pass the call on to any nested children
+ List<StatefulBeanContext> children = getThreadSafeContains();
+ if (children != null)
+ {
+ for (StatefulBeanContext contained : children)
+ {
+ contained.passivateAfterReplication();
+ }
+ }
+ }
+ }
+
+ public void activateAfterReplication()
+ {
+ if (!removed && passivated)
+ {
+ getInstance(); // make sure we're unmarshalled
+ getContainer().invokePostActivate(this);
+ passivated = false;
+ }
+
+ // Pass the call on to any nested children
+ List<StatefulBeanContext> children = getThreadSafeContains();
+ if (children != null)
+ {
+ for (StatefulBeanContext contained : children)
+ {
+ contained.activateAfterReplication();
+ }
+ }
+ }
+
+ public boolean getReplicationIsPassivation()
+ {
+ return replicationIsPassivation;
+ }
+
+ public void setReplicationIsPassivation(boolean replicationIsPassivation)
+ {
+ this.replicationIsPassivation = replicationIsPassivation;
+ }
+
+ /**
+ * Notification from a ClusteredStatefulCache before a bean is
+ * replicated.
+ */
+ public void preReplicate()
+ {
+ if (!removed && replicationIsPassivation && !passivated)
+ {
+ getContainer().invokePrePassivate(this);
+ passivated = true;
+ }
+
+ // Pass the call on to any nested children
+ List<StatefulBeanContext> children = getThreadSafeContains();
+ if (children != null)
+ {
+ for (StatefulBeanContext contained : children)
+ {
+ contained.preReplicate();
+ }
+ }
+ }
+
+ /**
+ * Notification from a ClusteredStatefulCache after the bean
+ * is fetched from the distributed cache. Something of a misnomer
+ * as it is possible the bean wasn't replicated (if it implements
+ * Optimized it can be fetched from the cache twice without ever
+ * being replicated).
+ */
+ public void postReplicate()
+ {
+ // We may not have been replicated, so only invoke @PostActivate
+ // if we are marked as passivated
+ if (!removed && passivated)
+ {
+ getContainer().invokePostActivate(this);
+ passivated = false;
+ }
+
+ // Pass the call on to any nested children
+ List<StatefulBeanContext> children = getThreadSafeContains();
+ if (children != null)
+ {
+ for (StatefulBeanContext contained : children)
+ {
+ contained.postReplicate();
+ }
+ }
+ }
+
+ public void popContainedIn()
+ {
+ propagatedContainedIn.pop();
+ }
+
+ public boolean isInUse()
+ {
+ return inUse;
+ }
+
+ public void setInUse(boolean inUse)
+ {
+ this.inUse = inUse;
+ }
+
+ public boolean isDiscarded()
+ {
+ return discarded;
+ }
+
+ public void setDiscarded(boolean discarded)
+ {
+ this.discarded = discarded;
+ }
+
+ public ReentrantLock getLock()
+ {
+ return lock;
+ }
+
+ public boolean isInInvocation()
+ {
+ return inInvocation;
+ }
+
+ public void setInInvocation(boolean inInvocation)
+ {
+ this.inInvocation = inInvocation;
+ }
+
+ public Object getId()
+ {
+ return id;
+ }
+
+ public boolean isTxSynchronized()
+ {
+ return txSynchronized;
+ }
+
+ public void setTxSynchronized(boolean txSynchronized)
+ {
+ this.txSynchronized = txSynchronized;
+ }
+
+ public boolean isRemoved()
+ {
+ return removed;
+ }
+
+ public void remove()
+ {
+ if (removed)
+ return;
+ removed = true;
+ RuntimeException exceptionThrown = null;
+
+ // Close any XPCs that haven't been injected into live
+ // beans in our family
+ try
+ {
+ cleanExtendedPCs();
+ }
+ catch (RuntimeException e)
+ {
+ // we still need to remove ourself from any parent, so save
+ // the thrown exception and rethrow it after we have cleaned up.
+ if (exceptionThrown == null)
+ exceptionThrown = e;
+ }
+
+ if (containedIn != null && getCanRemoveFromCache())
+ {
+ try
+ {
+ containedIn.removeContains(this);
+ }
+ catch (RuntimeException e)
+ {
+ // we still need to clean internal state, so save the
+ // thrown exception and rethrow it after we have cleaned up.
+ if (exceptionThrown == null)
+ exceptionThrown = e;
+ }
+ }
+
+ // Clear out refs to our bean and interceptors, to reduce our footprint
+ // in case we are still cached for our refs to any XPCs
+ bean = null;
+ interceptorInstances = null;
+
+ if (exceptionThrown != null) throw new RuntimeException("exception thrown while removing SFSB", exceptionThrown);
+ }
+
+ public boolean getCanRemoveFromCache()
+ {
+ boolean canRemove = removed;
+
+ if (canRemove && getContains() != null) // call getContains() to ensure unmarshalling
+ {
+ synchronized (contains)
+ {
+ canRemove = (contains.size() == 0);
+ }
+ }
+
+ return canRemove;
+ }
+
+ private void cleanExtendedPCs()
+ {
+ try
+ {
+ Transaction tx = TxUtil.getTransactionManager().getTransaction();
+ if (tx != null && TxUtils.isActive(tx))
+ {
+ tx.registerSynchronization(new XPCCloseSynchronization(this));
+ }
+ else
+ {
+ closeExtendedPCs();
+ }
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Error cleaning PersistenceContexts in SFSB removal", e);
+ }
+ }
+
+ private void closeExtendedPCs()
+ {
+ Map<String, EntityManager> extendedPCS = getExtendedPersistenceContexts();
+ if (extendedPCS != null)
+ {
+ RuntimeException exceptionThrown = null;
+
+ List<String> closedXPCs = new ArrayList<String>();
+ StatefulBeanContext topCtx = getUltimateContainedIn();
+
+ for (Iterator<Map.Entry<String,EntityManager>> iter = extendedPCS.entrySet().iterator();
+ iter.hasNext();)
+ {
+ Map.Entry<String,EntityManager> entry = iter.next();
+ String id = entry.getKey();
+ EntityManager xpc = entry.getValue();
+
+ // Only close the XPC if our live parent(s) or cousins
+ // don't also have a ref to it
+ boolean canClose = topCtx.scanForExtendedPersistenceContext(id, this);
+
+ if (canClose && getContains() != null)
+ {
+ // Only close the XPC if our live childrenScan don't have a ref
+ synchronized (contains)
+ {
+ for (StatefulBeanContext contained : contains)
+ {
+ if (contained.scanForExtendedPersistenceContext(id, null))
+ {
+ canClose = false;
+ break;
+ }
+ }
+ }
+ }
+
+ if (canClose)
+ {
+ try
+ {
+ xpc.close();
+ closedXPCs.add(id);
+ }
+ catch (RuntimeException e)
+ {
+ exceptionThrown = e;
+ }
+ }
+ }
+
+ // Clean all refs to the closed XPCs from the tree
+ for (String id : closedXPCs)
+ {
+ topCtx.removeExtendedPersistenceContext(id);
+ }
+
+ if (exceptionThrown != null) throw new RuntimeException("Error closing PersistenceContexts in SFSB removal", exceptionThrown);
+ }
+ }
+
+ @Override
+ public SessionSpecContainer getContainer()
+ {
+ if (container == null)
+ {
+ container = (SessionSpecContainer) Ejb3Registry.findContainer(containerGuid);
+
+ if (isClustered && container == null)
+ container = (SessionSpecContainer) Ejb3Registry.getClusterContainer(containerClusterUid);
+ }
+
+ return container;
+ }
+
+ @Override
+ public Object getInstance()
+ {
+ if (bean == null)
+ {
+ extractBeanAndInterceptors();
+ }
+ assert bean != null : "bean is null";
+ return bean;
+ }
+
+ @Override
+ public SimpleMetaData getMetaData()
+ {
+ return super.getMetaData();
+ }
+
+ // these are public for fast concurrent access/update
+ public volatile boolean markedForPassivation = false;
+
+ public volatile boolean markedForReplication = false;
+
+ // BES 2007/02/16 make private and use a getter/setter as
+ // ProxiedStatefulBeanContext needs to pass the value on
+ // to its NestedStatefulBeanContext
+ private volatile boolean inUse = false;
+
+ public long lastUsed = System.currentTimeMillis();
+
+ @Override
+ public Object[] getInterceptorInstances(InterceptorInfo[] interceptorInfos)
+ {
+ if (bean == null)
+ {
+ extractBeanAndInterceptors();
+ }
+ return super.getInterceptorInstances(interceptorInfos);
+ }
+
+ protected synchronized void extractBeanAndInterceptors()
+ {
+ if (beanMO == null)
+ return;
+
+ try
+ {
+ Object[] beanAndInterceptors = (Object[]) beanMO.get();
+ bean = beanAndInterceptors[0];
+ persistenceContexts = (HashMap<String, EntityManager>) beanAndInterceptors[1];
+ ArrayList list = (ArrayList) beanAndInterceptors[2];
+ interceptorInstances = new HashMap<Class, Object>();
+ if (list != null)
+ {
+ for (Object o : list)
+ {
+ interceptorInstances.put(o.getClass(), o);
+ }
+ }
+ contains = (List<StatefulBeanContext>) beanAndInterceptors[3];
+ // Reestablish links to our children; if they serialize a link
+ // to us for some reason serialization blows up
+ if (contains != null)
+ {
+ for (StatefulBeanContext contained : contains)
+ {
+ contained.containedIn = this;
+ }
+ }
+
+ // Don't hold onto the beanMo, as its contents are mutable
+ // and we don't want to serialize a stale version of them
+ beanMO = null;
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e);
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private Object writeReplace() throws ObjectStreamException
+ {
+ Serialized state = new Serialized();
+ if (this.beanMO == null)
+ {
+ Object[] beanAndInterceptors = new Object[4];
+ beanAndInterceptors[0] = bean;
+ beanAndInterceptors[1] = persistenceContexts;
+ if (interceptorInstances != null && interceptorInstances.size() > 0)
+ {
+ ArrayList list = new ArrayList();
+ list.addAll(interceptorInstances.values());
+ beanAndInterceptors[2] = list;
+ }
+ beanAndInterceptors[3] = contains;
+
+ // BES 2007/02/12 Previously we were trying to hold a ref to
+ // beanMO after we created it, but that exposes the risk of
+ // two different versions of the constituent state that
+ // can fall out of sync. So now we just write a local variable.
+
+ try
+ {
+ MarshalledObject mo = new MarshalledObject(beanAndInterceptors);
+ state.beanMO = mo;
+ }
+ catch(IOException e)
+ {
+ throw new RuntimeException("Marshalling of bean " + bean + " failed", e);
+ }
+ }
+ else
+ {
+ // We've been deserialized and are now being re-serialized, but
+ // extractBeanAndInterceptors hasn't been called in between.
+ // This can happen if a passivated session is involved in a
+ // JBoss Cache state transfer to a newly deployed node.
+ state.beanMO = this.beanMO;
+ }
+
+ state.containerClusterUid = this.containerClusterUid;
+ state.containerGuid = this.containerGuid;
+ state.isClustered = this.isClustered;
+ state.id = this.id;
+ state.lastUsed = this.lastUsed;
+ state.metadata = this.metadata;
+ state.removed = this.removed;
+ state.replicationIsPassivation = this.replicationIsPassivation;
+ return state;
+ }
+
+// public void writeExternal(ObjectOutput out) throws IOException
+// {
+// out.writeUTF(containerName);
+// out.writeObject(id);
+// out.writeObject(metadata);
+// out.writeLong(lastUsed);
+//
+// if (beanMO == null)
+// {
+// Object[] beanAndInterceptors = new Object[4];
+// beanAndInterceptors[0] = bean;
+// beanAndInterceptors[1] = persistenceContexts;
+// if (interceptorInstances != null && interceptorInstances.size() > 0)
+// {
+// ArrayList list = new ArrayList();
+// list.addAll(interceptorInstances.values());
+// beanAndInterceptors[2] = list;
+// }
+// beanAndInterceptors[3] = contains;
+//
+// // BES 2007/02/12 Previously we were trying to hold a ref to
+// // beanMO after we created it, but that exposes the risk of
+// // two different versions of the constituent state that
+// // can fall out of sync. So now we just write a local variable.
+//
+// MarshalledObject mo = new MarshalledObject(beanAndInterceptors);
+// out.writeObject(mo);
+// }
+// else
+// {
+// // We've been deserialized and are now being re-serialized, but
+// // extractBeanAndInterceptors hasn't been called in between.
+// // This can happen if a passivated session is involved in a
+// // JBoss Cache state transfer to a newly deployed node.
+// out.writeObject(beanMO);
+// }
+//
+//
+// out.writeBoolean(removed);
+// out.writeBoolean(replicationIsPassivation);
+// }
+//
+// public void readExternal(ObjectInput in) throws IOException,
+// ClassNotFoundException
+// {
+// containerName = in.readUTF();
+// id = in.readObject();
+// metadata = (SimpleMetaData) in.readObject();
+// lastUsed = in.readLong();
+//
+// beanMO = (MarshalledObject) in.readObject();
+// removed = in.readBoolean();
+// replicationIsPassivation = in.readBoolean();
+//
+// // If we've just been deserialized, we are passivated
+// passivated = true;
+// }
+
+ public Object getInvokedMethodKey()
+ {
+ return this.getId();
+ }
+
+ private static class XPCCloseSynchronization implements Synchronization
+ {
+ private StatefulBeanContext ctx;
+
+ private XPCCloseSynchronization(StatefulBeanContext context)
+ {
+ ctx = context;
+ }
+
+ public void beforeCompletion()
+ {
+ }
+
+ public void afterCompletion(int status)
+ {
+ ctx.closeExtendedPCs();
+ // Clean ref to ctx, as some TMs leak Synchronization refs
+ ctx = null;
+ }
+ }
+}
Deleted: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulClusterProxyFactory.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulClusterProxyFactory.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulClusterProxyFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -1,214 +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.SessionContainer;
-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.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(SessionContainer container, RemoteBinding binding, Clustered clustered)
- {
- super(container, binding);
-
- assert clustered != null : "clustered is null";
-
- this.clustered = clustered;
- }
-
- /**
- * Defines the access type for this Proxies created by this Factory
- *
- * @return
- */
- @Override
- protected ProxyAccessType getProxyAccessType(){
- return ProxyAccessType.REMOTE;
- }
-
- 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 createProxy(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/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulClusterProxyFactory.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulClusterProxyFactory.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulClusterProxyFactory.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulClusterProxyFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,216 @@
+/*
+ * 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.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;
+ }
+
+ /**
+ * Defines the access type for this Proxies created by this Factory
+ *
+ * @return
+ */
+ @Override
+ protected ProxyAccessType getProxyAccessType(){
+ return ProxyAccessType.REMOTE;
+ }
+
+ 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/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -1,1071 +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.AccessibleObject;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.rmi.NoSuchObjectException;
-import java.rmi.RemoteException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-
-import javax.ejb.EJBHome;
-import javax.ejb.EJBObject;
-import javax.ejb.Handle;
-import javax.ejb.Init;
-import javax.ejb.NoSuchEJBException;
-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;
-
-import org.jboss.aop.Dispatcher;
-import org.jboss.aop.Domain;
-import org.jboss.aop.InstanceAdvisor;
-import org.jboss.aop.MethodInfo;
-import org.jboss.aop.advice.Interceptor;
-import org.jboss.aop.advice.PerVmAdvice;
-import org.jboss.aop.joinpoint.Invocation;
-import org.jboss.aop.joinpoint.InvocationResponse;
-import org.jboss.aop.util.MethodHashing;
-import org.jboss.aspects.asynch.FutureHolder;
-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;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.annotation.RemoteBindings;
-import org.jboss.ejb3.aop.LifeCycleInvocation;
-import org.jboss.ejb3.cache.CacheFactoryRegistry;
-import org.jboss.ejb3.cache.Ejb3CacheFactory;
-import org.jboss.ejb3.cache.StatefulCache;
-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.session.SessionContainer;
-import org.jboss.injection.Injector;
-import org.jboss.injection.JndiPropertyInjector;
-import org.jboss.logging.Logger;
-import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public class StatefulContainer extends SessionContainer implements StatefulObjectFactory<StatefulBeanContext>
-{
- private static final Logger log = Logger.getLogger(StatefulContainer.class);
-
- protected StatefulCache cache;
- private StatefulDelegateWrapper mbean = new StatefulDelegateWrapper(this);
-
- public StatefulContainer(ClassLoader cl, String beanClassName, String ejbName, Domain domain,
- Hashtable ctxProperties, Ejb3Deployment deployment, JBossSessionBeanMetaData beanMetaData) throws ClassNotFoundException
- {
- super(cl, beanClassName, ejbName, domain, ctxProperties, deployment, beanMetaData);
- }
-
- public StatefulBeanContext create(Class<?>[] initTypes, Object[] initValues)
- {
- // FIXME: this method is not finished. In the old setup the call would go
- // through Pool which would call the init method.
- return (StatefulBeanContext) createBeanContext();
- }
-
- @Override
- public BeanContext<?> createBeanContext()
- {
- return new StatefulBeanContext(this, construct());
- }
-
- @Override
- protected ProxyFactory createProxyFactory(LocalBinding binding)
- {
- return new StatefulLocalProxyFactory(this, binding);
- }
-
- @Override
- protected BaseStatefulRemoteProxyFactory createProxyFactory(RemoteBinding binding)
- {
- Clustered clustered = getAnnotation(Clustered.class);
- if (clustered != null)
- {
- return new StatefulClusterProxyFactory(this, binding, clustered);
- }
- else
- {
- return new StatefulRemoteProxyFactory(this, binding);
- }
- }
-
- public void destroy(StatefulBeanContext obj)
- {
- invokePreDestroy(obj);
- }
-
- public Object getMBean()
- {
- return mbean;
- }
-
- /**
- * Creates and starts the configured cache, if not
- * started already
- *
- * @throws Exception
- */
- protected void createAndStartCache() throws Exception {
-
- // If Cache is initialized, exit
- if(this.cache!=null && this.cache.isStarted())
- {
- return;
- }
-
- Cache cacheConfig = getAnnotation(Cache.class);
- CacheFactoryRegistry registry = getCacheFactoryRegistry();
- Ejb3CacheFactory factory = registry.getCacheFactory(cacheConfig.value());
- this.cache = factory.createCache();
- this.cache.initialize(this);
- this.cache.start();
- }
-
- public void start() throws Exception
- {
- try
- {
- super.start();
- this.createAndStartCache();
- }
- catch (Exception e)
- {
- try
- {
- stop();
- }
- catch (Exception ignore)
- {
- log.debug("Failed to cleanup after start() failure", ignore);
- }
- throw e;
- }
-
- }
-
- public void stop() throws Exception
- {
- if (cache != null) cache.stop();
- super.stop();
- }
-
- public StatefulCache getCache()
- {
- // Ensure initialized
- try{
- this.createAndStartCache();
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
-
- // Return
- return cache;
- }
-
- public CacheFactoryRegistry getCacheFactoryRegistry()
- {
- return this.getDeployment().getCacheFactoryRegistry();
- }
-
- /**
- * Performs a synchronous local invocation
- */
- public Object localInvoke(Object id, Method method, Object[] args)
- throws Throwable
- {
- return localInvoke(id, method, args, null);
- }
-
- /**
- * Performs a synchronous or asynchronous local invocation
- *
- */
- public Object localHomeInvoke(Method method, Object[] args) throws Throwable
- {
- ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
- pushEnc();
- try
- {
- long hash = MethodHashing.calculateHash(method);
- MethodInfo info = getAdvisor().getMethodInfo(hash);
- if (info == null)
- {
- throw new RuntimeException(
- "Could not resolve beanClass method from proxy call: "
- + method.toString());
- }
- return invokeLocalHomeMethod(info, args);
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(oldLoader);
- popEnc();
- }
- }
-
- /**
- * Performs a synchronous or asynchronous local invocation
- *
- * @param provider If null a synchronous invocation, otherwise an asynchronous
- */
- public Object localInvoke(Object id, Method method, Object[] args,
- FutureHolder provider) throws Throwable
- {
- long start = System.currentTimeMillis();
-
- ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
- pushEnc();
- try
- {
- long hash = MethodHashing.calculateHash(method);
- MethodInfo info = getAdvisor().getMethodInfo(hash);
- if (info == null)
- {
- throw new RuntimeException(
- "Could not resolve beanClass method from proxy call: "
- + method.toString());
- }
-
- Method unadvisedMethod = info.getUnadvisedMethod();
-
- try
- {
- invokeStats.callIn();
-
- if (unadvisedMethod != null && isHomeMethod(unadvisedMethod))
- {
- return invokeLocalHomeMethod(info, args);
- }
- else if (unadvisedMethod != null
- && isEJBObjectMethod(unadvisedMethod))
- {
- return invokeEJBLocalObjectMethod(id, info, args);
- }
-
- StatefulContainerInvocation nextInvocation = new StatefulContainerInvocation(info, id);
- nextInvocation.setAdvisor(getAdvisor());
- nextInvocation.setArguments(args);
-
- ProxyUtils.addLocalAsynchronousInfo(nextInvocation, provider);
-
- invokedMethod.push(new InvokedMethod(true, method));
- return nextInvocation.invokeNext();
- }
- finally
- {
- if (unadvisedMethod != null)
- {
- long end = System.currentTimeMillis();
- long elapsed = end - start;
- invokeStats.updateStats(unadvisedMethod, elapsed);
- }
-
- invokeStats.callOut();
-
- invokedMethod.pop();
- }
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(oldLoader);
- popEnc();
- }
- }
-
- /**
- * Create a stateful bean and return its oid.
- *
- * @return
- */
- public Object createSession(Class<?>[] initTypes, Object[] initValues)
- {
- ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
- pushEnc();
- try
- {
- Thread.currentThread().setContextClassLoader(classloader);
- StatefulCache cache = this.getCache();
- StatefulBeanContext ctx = cache.create(initTypes, initValues);
- // Since we return the key here, the context is not in use.
- cache.release(ctx);
- return ctx.getId();
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(oldLoader);
- popEnc();
- }
- }
-
- protected void destroySession(Object id)
- {
- getCache().remove(id);
- }
-
- /**
- * This should be a remote invocation call
- *
- * @param invocation
- * @return
- * @throws Throwable
- */
- public InvocationResponse dynamicInvoke(Object target, Invocation invocation) throws Throwable
- {
- long start = System.currentTimeMillis();
-
- ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
- EJBContainerInvocation newSi = null;
- pushEnc();
- try
- {
- Thread.currentThread().setContextClassLoader(classloader);
- StatefulRemoteInvocation si = (StatefulRemoteInvocation) invocation;
- MethodInfo info = getAdvisor().getMethodInfo(si.getMethodHash());
- if (info == null)
- {
- throw new RuntimeException("Could not resolve beanClass method from proxy call " + invocation);
- }
-
- InvocationResponse response = null;
- Method unadvisedMethod = info.getUnadvisedMethod();
- Object newId = null;
-
- try
- {
- invokeStats.callIn();
-
- if (info != null && unadvisedMethod != null && isHomeMethod(unadvisedMethod))
- {
- response = invokeHomeMethod(info, si);
- }
- else if (info != null && unadvisedMethod != null && isEJBObjectMethod(unadvisedMethod))
- {
- response = invokeEJBObjectMethod(info, si);
- }
- else
- {
- if (unadvisedMethod.isBridge())
- {
- unadvisedMethod = this.getNonBridgeMethod(unadvisedMethod);
- info = super.getMethodInfo(unadvisedMethod);
- }
-
- if (si.getId() == null)
- {
- StatefulBeanContext ctx = getCache().create(null, null);
- newId = ctx.getId();
- }
- else
- {
- newId = si.getId();
- }
- newSi = new StatefulContainerInvocation(info, newId);
- newSi.setArguments(si.getArguments());
- newSi.setMetaData(si.getMetaData());
- newSi.setAdvisor(getAdvisor());
-
- Object rtn = null;
-
- invokedMethod.push(new InvokedMethod(false, unadvisedMethod));
- rtn = newSi.invokeNext();
-
- response = marshallResponse(invocation, rtn, newSi.getResponseContextInfo());
- if (newId != null) response.addAttachment(StatefulConstants.NEW_ID, newId);
- }
- }
- catch (Throwable throwable)
- {
- Throwable exception = throwable;
- if (newId != null)
- {
- exception = new ForwardId(throwable, newId);
- }
- Map responseContext = null;
- if (newSi != null) newSi.getResponseContextInfo();
- response = marshallException(invocation, exception, responseContext);
- return response;
- }
- finally
- {
- if (unadvisedMethod != null)
- {
- long end = System.currentTimeMillis();
- long elapsed = end - start;
- invokeStats.updateStats(unadvisedMethod, elapsed);
- }
-
- invokeStats.callOut();
-
- invokedMethod.pop();
- }
-
- return response;
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(oldLoader);
- popEnc();
- }
- }
-
-
- public TimerService getTimerService()
- {
- throw new UnsupportedOperationException("stateful bean doesn't support TimerService (EJB3 18.2#2)");
- }
-
- public TimerService getTimerService(Object pKey)
- {
- return getTimerService();
- }
-
- @Override
- public void invokePostActivate(BeanContext beanContext)
- {
- for (Injector injector : injectors)
- {
- if (injector instanceof JndiPropertyInjector)
- {
- AccessibleObject field = ((JndiPropertyInjector) injector).getAccessibleObject();
-
- if (field.isAnnotationPresent(javax.ejb.EJB.class))
- {
- continue; // skip nested EJB injection since the local proxy will be (de)serialized correctly
- }
-
- if (field instanceof Field)
- {
- // reinject transient fields
- if ((((Field)field).getModifiers() & Modifier.TRANSIENT) > 0)
- injector.inject(beanContext);
- }
- }
- }
- // FIXME: this is just a hack, use an interceptor stack
- try
- {
- List<Interceptor> interceptors = new ArrayList<Interceptor>(InterceptorsFactory.getLifeCycleInterceptors((InstanceAdvisor) getAdvisor(), PostActivate.class));
- interceptors.add(0, PerVmAdvice.generateInterceptor(null, new InvocationContextInterceptor(), "setup"));
-
- LifeCycleInvocation invocation = new LifeCycleInvocation(interceptors.toArray(new Interceptor[0]));
- invocation.setAdvisor(getAdvisor());
- invocation.setTargetObject(beanContext.getInstance());
- invocation.invokeNext();
- }
- catch(Throwable t)
- {
- throw new RuntimeException(t);
- }
- }
-
- @Override
- public void invokePrePassivate(BeanContext beanContext)
- {
- // FIXME: this is just a hack, use an interceptor stack
- try
- {
- List<Interceptor> interceptors = new ArrayList<Interceptor>(InterceptorsFactory.getLifeCycleInterceptors((InstanceAdvisor) getAdvisor(), PrePassivate.class));
- interceptors.add(0, PerVmAdvice.generateInterceptor(null, new InvocationContextInterceptor(), "setup"));
-
- LifeCycleInvocation invocation = new LifeCycleInvocation(interceptors.toArray(new Interceptor[0]));
- invocation.setAdvisor(getAdvisor());
- invocation.setTargetObject(beanContext.getInstance());
- invocation.invokeNext();
- }
- catch(Throwable t)
- {
- throw new RuntimeException(t);
- }
- }
-
- /*
- @Override
- protected Class[] getHandledCallbacks()
- {
- return new Class[]
- {PostConstruct.class, PreDestroy.class, PostActivate.class,
- PrePassivate.class};
- }
- */
-
- public void invokeInit(Object bean, Class[] initParameterTypes,
- Object[] initParameterValues)
- {
- int numParameters = 0;
- if(initParameterTypes != null)
- numParameters = initParameterTypes.length;
- try
- {
- for(Method method : bean.getClass().getDeclaredMethods())
- {
- if(numParameters != method.getParameterTypes().length)
- continue;
-
- if ((method.getAnnotation(Init.class) != null)
- || (resolveAnnotation(method, Init.class) != null))
- {
- if(initParameterTypes != null)
- {
- Object[] parameters = getInitParameters(method,
- initParameterTypes, initParameterValues);
-
- if (parameters != null)
- method.invoke(bean, parameters);
- }
- else
- {
- method.invoke(bean);
- }
- }
- }
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- }
-
- protected Object[] getInitParameters(Method method,
- Class[] initParameterTypes, Object[] initParameterValues)
- {
- if (method.getParameterTypes().length == initParameterTypes.length)
- {
- for (int i = 0; i < initParameterTypes.length; ++i)
- {
- Class formal = method.getParameterTypes()[i];
- Class actual = initParameterTypes[i];
- if (!isMethodInvocationConvertible(formal, actual == null ? null
- : actual))
- return null;
- }
- return initParameterValues;
- }
- return null;
- }
-
- /**
- * Determines whether a type represented by a class object is convertible to
- * another type represented by a class object using a method invocation
- * conversion, treating object types of primitive types as if they were
- * primitive types (that is, a Boolean actual parameter type matches boolean
- * primitive formal type). This behavior is because this method is used to
- * determine applicable methods for an actual parameter list, and primitive
- * types are represented by their object duals in reflective method calls.
- *
- * @param formal the formal parameter type to which the actual parameter type
- * should be convertible
- * @param actual the actual parameter type.
- * @return true if either formal type is assignable from actual type, or
- * formal is a primitive type and actual is its corresponding object
- * type or an object type of a primitive type that can be converted
- * to the formal type.
- */
- private static boolean isMethodInvocationConvertible(Class formal,
- Class actual)
- {
- /*
- * if it's a null, it means the arg was null
- */
- if (actual == null && !formal.isPrimitive())
- {
- return true;
- }
- /*
- * Check for identity or widening reference conversion
- */
- if (actual != null && formal.isAssignableFrom(actual))
- {
- return true;
- }
- /*
- * Check for boxing with widening primitive conversion. Note that actual
- * parameters are never primitives.
- */
- if (formal.isPrimitive())
- {
- if (formal == Boolean.TYPE && actual == Boolean.class)
- return true;
- if (formal == Character.TYPE && actual == Character.class)
- return true;
- if (formal == Byte.TYPE && actual == Byte.class)
- return true;
- if (formal == Short.TYPE
- && (actual == Short.class || actual == Byte.class))
- return true;
- if (formal == Integer.TYPE
- && (actual == Integer.class || actual == Short.class || actual == Byte.class))
- return true;
- if (formal == Long.TYPE
- && (actual == Long.class || actual == Integer.class
- || actual == Short.class || actual == Byte.class))
- return true;
- if (formal == Float.TYPE
- && (actual == Float.class || actual == Long.class
- || actual == Integer.class || actual == Short.class || actual == Byte.class))
- return true;
- if (formal == Double.TYPE
- && (actual == Double.class || actual == Float.class
- || actual == Long.class || actual == Integer.class
- || actual == Short.class || actual == Byte.class))
- return true;
- }
- return false;
- }
-
- private Object invokeEJBLocalObjectMethod(Object id, MethodInfo info,
- Object[] args) throws Exception
- {
- Method unadvisedMethod = info.getUnadvisedMethod();
- if (unadvisedMethod.getName().equals("remove"))
- {
- try
- {
- destroySession(id);
- }
- catch(NoSuchEJBException e)
- {
- throw new NoSuchObjectLocalException(e.getMessage(), e);
- }
-
- return null;
- }
- else if (unadvisedMethod.getName().equals("getEJBLocalHome"))
- {
- Object bean = getCache().get(id).getInstance();
-
- return bean;
- }
- else if (unadvisedMethod.getName().equals("getPrimaryKey"))
- {
- return id;
- }
- else if (unadvisedMethod.getName().equals("isIdentical"))
- {
- EJBObject bean = (EJBObject) args[0];
-
- Object primaryKey = bean.getPrimaryKey();
-
- boolean isIdentical = id.equals(primaryKey);
-
- return isIdentical;
- }
- else
- {
- return null;
- }
- }
-
- private Object invokeLocalHomeMethod(MethodInfo info, Object[] args)
- throws Exception
- {
- Method unadvisedMethod = info.getUnadvisedMethod();
- if (unadvisedMethod.getName().startsWith("create"))
- {
- Class<?>[] initParameterTypes =
- {};
- Object[] initParameterValues =
- {};
- if (unadvisedMethod.getParameterTypes().length > 0)
- {
- initParameterTypes = unadvisedMethod.getParameterTypes();
- initParameterValues = args;
- }
-
- LocalBinding binding = this.getAnnotation(LocalBinding.class);
-
- StatefulLocalProxyFactory factory = new StatefulLocalProxyFactory(this, binding);
- factory.init();
-
- Object proxy = factory.createEjb21Proxy(initParameterTypes,
- initParameterValues);
-
- return proxy;
- }
- else if (unadvisedMethod.getName().equals("remove"))
- {
- remove(args[0]);
-
- return null;
- }
- else
- {
- return null;
- }
- }
-
- public Object createLocalProxy(Object id, LocalBinding binding) throws Exception
- {
- StatefulLocalProxyFactory factory = new StatefulLocalProxyFactory(this, binding);
- factory.init();
-
- return factory.createProxy(id);
- }
-
- public Object createRemoteProxy(Object id, RemoteBinding binding) throws Exception
- {
- // RemoteBinding binding = null;
- // RemoteBindings bindings = (RemoteBindings) resolveAnnotation(RemoteBindings.class);
- // if (bindings != null)
- // binding = bindings.value()[0];
- // else
- // binding = (RemoteBinding) resolveAnnotation(RemoteBinding.class);
-
- StatefulRemoteProxyFactory factory = new StatefulRemoteProxyFactory(this, binding);
- factory.init();
-
- if (id != null)
- return factory.createProxy(id);
- else
- return factory.createProxy();
- }
-
- public boolean isClustered()
- {
- return isAnnotationPresent(Clustered.class);
- }
-
- protected InvocationResponse invokeHomeMethod(MethodInfo info,
- StatefulRemoteInvocation statefulInvocation) throws Throwable
- {
- Method unadvisedMethod = info.getUnadvisedMethod();
- if (unadvisedMethod.getName().startsWith("create"))
- {
- Class<?>[] initParameterTypes =
- {};
- Object[] initParameterValues =
- {};
- if (unadvisedMethod.getParameterTypes().length > 0)
- {
- initParameterTypes = unadvisedMethod.getParameterTypes();
- initParameterValues = statefulInvocation.getArguments();
- }
-
- RemoteBinding binding = null;
- RemoteBindings bindings = this.getAnnotation(RemoteBindings.class);
- if (bindings != null)
- binding = bindings.value()[0];
- else
- binding = this.getAnnotation(RemoteBinding.class);
-
- StatefulContainerInvocation newStatefulInvocation = buildNewInvocation(
- info, statefulInvocation, initParameterTypes,
- initParameterValues);
-
- StatefulRemoteProxyFactory factory = new StatefulRemoteProxyFactory(this, binding);
- factory.init();
-
- Object proxy = null;
- if (newStatefulInvocation.getId() != null)
- proxy = factory.createProxyEjb21(newStatefulInvocation.getId());
- else
- proxy = factory.createProxyEjb21();
-
- InvocationResponse response = marshallResponse(statefulInvocation, proxy, newStatefulInvocation.getResponseContextInfo());
- if (newStatefulInvocation.getId() != null)
- response.addAttachment(StatefulConstants.NEW_ID,
- newStatefulInvocation.getId());
- return response;
- }
- else if (unadvisedMethod.getName().equals("remove"))
- {
- remove(statefulInvocation.getArguments()[0]);
-
- InvocationResponse response = new InvocationResponse(null);
- response.setContextInfo(statefulInvocation.getResponseContextInfo());
- return response;
- }
- else if (unadvisedMethod.getName().equals("getEJBMetaData"))
- {
- Class<?> remote = null;
- Class<?> home = null;
- Class<?> pkClass = Object.class;
- HomeHandleImpl homeHandle = null;
-
- Remote remoteAnnotation = this.getAnnotation(Remote.class);
- if (remoteAnnotation != null)
- remote = remoteAnnotation.value()[0];
- RemoteHome homeAnnotation = this.getAnnotation(RemoteHome.class);
- if (homeAnnotation != null)
- home = homeAnnotation.value();
- RemoteBinding remoteBindingAnnotation = this.getAnnotation(RemoteBinding.class);
- if (remoteBindingAnnotation != null)
- homeHandle = new HomeHandleImpl(remoteBindingAnnotation
- .jndiBinding());
-
- EJBMetaDataImpl metadata = new EJBMetaDataImpl(remote, home, pkClass,
- true, false, homeHandle);
-
- InvocationResponse response = marshallResponse(statefulInvocation, metadata, null);
- return response;
- }
- else if (unadvisedMethod.getName().equals("getHomeHandle"))
- {
- HomeHandleImpl homeHandle = null;
-
- RemoteBinding remoteBindingAnnotation = this.getAnnotation(RemoteBinding.class);
- if (remoteBindingAnnotation != null)
- homeHandle = new HomeHandleImpl(remoteBindingAnnotation
- .jndiBinding());
-
-
- InvocationResponse response = marshallResponse(statefulInvocation, homeHandle, null);
- return response;
- }
- else
- {
- return null;
- }
- }
-
- protected InvocationResponse invokeEJBObjectMethod(MethodInfo info,
- StatefulRemoteInvocation statefulInvocation) throws Throwable
- {
- Method unadvisedMethod = info.getUnadvisedMethod();
- if (unadvisedMethod.getName().equals("getHandle"))
- {
- StatefulContainerInvocation newStatefulInvocation = buildInvocation(
- info, statefulInvocation);
-
- ProxyFactory proxyFactory = this.proxyDeployer.getProxyFactory(this.getAnnotation(RemoteBinding.class));;
- if (proxyFactory == null)
- {
- proxyFactory = this.createProxyFactory(this.getAnnotation(RemoteBinding.class));
- }
- BaseStatefulRemoteProxyFactory statefulRemoteProxyFactory = (BaseStatefulRemoteProxyFactory) proxyFactory;
- EJBObject proxy = (EJBObject) statefulRemoteProxyFactory.createProxyEjb21(newStatefulInvocation.getId());
- StatefulRemoteHandleImpl handle = new StatefulRemoteHandleImpl(proxy);
- InvocationResponse response = marshallResponse(statefulInvocation, handle, null);
- return response;
- }
- else if (unadvisedMethod.getName().equals("remove"))
- {
- try
- {
- destroySession(statefulInvocation.getId());
- }
- catch(NoSuchEJBException e)
- {
- if(log.isTraceEnabled())
- log.trace("Throwing " + e.getClass().getName(), e);
- throw new NoSuchObjectException(e.getMessage());
- }
-
- InvocationResponse response = new InvocationResponse(null);
- return response;
- }
- else if (unadvisedMethod.getName().equals("getEJBHome"))
- {
- HomeHandleImpl homeHandle = null;
-
- RemoteBinding remoteBindingAnnotation = this.getAnnotation(RemoteBinding.class);
- if (remoteBindingAnnotation != null)
- homeHandle = new HomeHandleImpl(ProxyFactoryHelper.getHomeJndiName(this));
-
- EJBHome ejbHome = homeHandle.getEJBHome();
-
- InvocationResponse response = marshallResponse(statefulInvocation, ejbHome, null);
- return response;
- }
- else if (unadvisedMethod.getName().equals("getPrimaryKey"))
- {
- Object id = statefulInvocation.getId();
-
- InvocationResponse response = marshallResponse(statefulInvocation, id, null);
- return response;
- }
- else if (unadvisedMethod.getName().equals("isIdentical"))
- {
- Object id = statefulInvocation.getId();
- EJBObject bean = (EJBObject) statefulInvocation.getArguments()[0];
-
- Object primaryKey = bean.getPrimaryKey();
-
- boolean isIdentical = id.equals(primaryKey);
-
- InvocationResponse response = marshallResponse(statefulInvocation, isIdentical, null);
- return response;
- }
- else
- {
- return null;
- }
- }
-
- private StatefulContainerInvocation buildNewInvocation(MethodInfo info,
- StatefulRemoteInvocation statefulInvocation,
- Class[] initParameterTypes, Object[] initParameterValues)
- {
- StatefulContainerInvocation newStatefulInvocation = null;
-
- StatefulBeanContext ctx = null;
- if (initParameterTypes.length > 0)
- ctx = getCache().create(initParameterTypes, initParameterValues);
- else
- ctx = getCache().create(null, null);
-
- Object newId = ctx.getId();
- newStatefulInvocation = new StatefulContainerInvocation(info, newId);
-
- newStatefulInvocation.setArguments(statefulInvocation.getArguments());
- newStatefulInvocation.setMetaData(statefulInvocation.getMetaData());
- newStatefulInvocation.setAdvisor(getAdvisor());
-
- return newStatefulInvocation;
- }
-
- private StatefulContainerInvocation buildInvocation(MethodInfo info,
- StatefulRemoteInvocation statefulInvocation)
- {
- StatefulContainerInvocation newStatefulInvocation = null;
- Object newId = null;
- if (statefulInvocation.getId() == null)
- {
- StatefulBeanContext ctx = getCache().create(null, null);
- newId = ctx.getId();
- newStatefulInvocation = new StatefulContainerInvocation(info, newId);
- }
- else
- {
- newStatefulInvocation = new StatefulContainerInvocation(info, statefulInvocation.getId());
- }
-
- newStatefulInvocation.setArguments(statefulInvocation.getArguments());
- newStatefulInvocation.setMetaData(statefulInvocation.getMetaData());
- newStatefulInvocation.setAdvisor(getAdvisor());
-
- return newStatefulInvocation;
- }
-
- @Override
- public Object getBusinessObject(BeanContext beanContext, Class businessInterface) throws IllegalStateException
- {
- assert beanContext != null : "beanContext is null";
- assert businessInterface != null : "businessInterface is null";
-
- StatefulBeanContext ctx = (StatefulBeanContext) beanContext;
-
- SessionContainer container = ctx.getContainer();
- assert container == this : "beanContext not of this container (" + container + " != " + this + ")";
-
- boolean isRemote = false;
- boolean found = false;
- Class[] remoteInterfaces = ProxyFactoryHelper.getRemoteAndBusinessRemoteInterfaces(this);
- for (Class intf : remoteInterfaces)
- {
- if (intf.getName().equals(businessInterface.getName()))
- {
- isRemote = true;
- found = true;
- break;
- }
- }
- if (found == false)
- {
- Class[] localInterfaces = ProxyFactoryHelper.getLocalAndBusinessLocalInterfaces(this);
- for (Class intf : localInterfaces)
- {
- if (intf.getName().equals(businessInterface.getName()))
- {
- found = true;
- break;
- }
- }
- }
- if (found == false) throw new IllegalStateException(businessInterface.getName() + " is not a business interface for container " + this);
-
- Collection<ProxyFactory> proxyFactories = this.proxyDeployer.getProxyFactories().values();
- for (ProxyFactory factory : proxyFactories)
- {
- if (isRemote && factory instanceof StatefulRemoteProxyFactory)
- {
- return ((StatefulRemoteProxyFactory) factory).createProxy(ctx.getId());
- }
- else if (!isRemote && factory instanceof StatefulLocalProxyFactory)
- {
- return ((StatefulLocalProxyFactory) factory).createProxy(ctx.getId());
- }
- }
- throw new IllegalStateException("Unable to create proxy for getBusinessObject as a proxy factory was not found");
- }
-
- /**
- * Remove the given object. Called when remove on Home is invoked.
- *
- * @param target either a Handle or a primaryKey
- * @throws RemoveException if it's not allowed to be removed
- */
- private void remove(Object target) throws RemoveException
- {
- // EJBTHREE-1217: EJBHome.remove(Object primaryKey) must throw RemoveException
- if(!(target instanceof Handle))
- throw new RemoveException("EJB 3 3.6.2.2: Session beans do not have a primary key");
-
- StatefulRemoteHandleImpl handle = (StatefulRemoteHandleImpl) target;
-
- try
- {
- handle.getEJBObject().remove();
- }
- catch(RemoteException re)
- {
- throw new RemoveException(re.getMessage());
- }
- }
-
- protected void removeHandle(Handle arg) throws Exception
- {
- /*
- StatefulHandleImpl handle = (StatefulHandleImpl) arg;
-
- destroySession(handle.id);
- */
- arg.getEJBObject().remove();
- }
-}
Copied: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,1141 @@
+/*
+ * 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.AccessibleObject;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.rmi.NoSuchObjectException;
+import java.rmi.RemoteException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+import javax.ejb.EJBHome;
+import javax.ejb.EJBObject;
+import javax.ejb.Handle;
+import javax.ejb.Init;
+import javax.ejb.NoSuchEJBException;
+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;
+
+import org.jboss.aop.Domain;
+import org.jboss.aop.InstanceAdvisor;
+import org.jboss.aop.MethodInfo;
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.advice.PerVmAdvice;
+import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.aop.joinpoint.InvocationResponse;
+import org.jboss.aop.util.MethodHashing;
+import org.jboss.aspects.asynch.FutureHolder;
+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;
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.annotation.RemoteBindings;
+import org.jboss.ejb3.aop.LifeCycleInvocation;
+import org.jboss.ejb3.cache.CacheFactoryRegistry;
+import org.jboss.ejb3.cache.Ejb3CacheFactory;
+import org.jboss.ejb3.cache.StatefulCache;
+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.session.SessionContainer;
+import org.jboss.ejb3.session.SessionSpecContainer;
+import org.jboss.injection.Injector;
+import org.jboss.injection.JndiPropertyInjector;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+public class StatefulContainer extends SessionSpecContainer implements StatefulObjectFactory<StatefulBeanContext>
+{
+ private static final Logger log = Logger.getLogger(StatefulContainer.class);
+
+ protected StatefulCache cache;
+ private StatefulDelegateWrapper mbean = new StatefulDelegateWrapper(this);
+
+ public StatefulContainer(ClassLoader cl, String beanClassName, String ejbName, Domain domain,
+ Hashtable ctxProperties, Ejb3Deployment deployment, JBossSessionBeanMetaData beanMetaData) throws ClassNotFoundException
+ {
+ super(cl, beanClassName, ejbName, domain, ctxProperties, deployment, beanMetaData);
+ }
+
+ public StatefulBeanContext create(Class<?>[] initTypes, Object[] initValues)
+ {
+ // FIXME: this method is not finished. In the old setup the call would go
+ // through Pool which would call the init method.
+ return (StatefulBeanContext) createBeanContext();
+ }
+
+ @Override
+ public BeanContext<?> createBeanContext()
+ {
+ return new StatefulBeanContext(this, construct());
+ }
+
+ @Override
+ protected StatefulLocalProxyFactory getProxyFactory(LocalBinding binding)
+ {
+ StatefulLocalProxyFactory factory = (StatefulLocalProxyFactory) this.proxyDeployer.getProxyFactory(binding);
+
+ if (factory == null)
+ {
+ factory = new StatefulLocalProxyFactory(this, binding);
+
+ try
+ {
+ factory.init();
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ return factory;
+ }
+
+ public Object createProxyLocalEjb21(Object id, LocalBinding binding) throws Exception
+ {
+ StatefulLocalProxyFactory proxyFactory = this.getProxyFactory(binding);
+ return proxyFactory.createProxyEjb21(id);
+ }
+
+ public Object createProxyRemoteEjb21(Object id) throws Exception
+ {
+ RemoteBinding binding = this.getRemoteBinding();
+ return this.createProxyRemoteEjb21(id,binding);
+ }
+
+ public Object createProxyRemoteEjb21(Object id, RemoteBinding binding) throws Exception
+ {
+ BaseStatefulRemoteProxyFactory proxyFactory = this.getProxyFactory(binding);
+ return proxyFactory.createProxyEjb21(id);
+ }
+
+ public Object createProxyLocalEjb21(Object id) throws Exception
+ {
+ LocalBinding binding = this.getAnnotation(LocalBinding.class);
+ return this.createProxyLocalEjb21(id,binding);
+ }
+
+ @Override
+ public Object createProxyLocalEjb21(LocalBinding binding) throws Exception
+ {
+ Object id = this.createSession();
+ return this.createProxyLocalEjb21(id,binding);
+ }
+
+ @Override
+ public Object createProxyRemoteEjb21(RemoteBinding binding) throws Exception
+ {
+ Object id = this.createSession();
+ return this.createProxyRemoteEjb21(id, binding);
+ }
+
+ @Override
+ protected BaseStatefulRemoteProxyFactory getProxyFactory(RemoteBinding binding)
+ {
+ BaseStatefulRemoteProxyFactory factory = (BaseStatefulRemoteProxyFactory) this.proxyDeployer
+ .getProxyFactory(binding);
+
+ if (factory == null)
+ {
+
+ Clustered clustered = getAnnotation(Clustered.class);
+ if (clustered != null)
+ {
+ factory = new StatefulClusterProxyFactory(this, binding, clustered);
+ }
+ else
+ {
+ factory = new StatefulRemoteProxyFactory(this, binding);
+ }
+
+ try
+ {
+ factory.init();
+ }
+ catch(Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ return factory;
+ }
+
+ public void destroy(StatefulBeanContext obj)
+ {
+ invokePreDestroy(obj);
+ }
+
+ public Object getMBean()
+ {
+ return mbean;
+ }
+
+ /**
+ * Creates and starts the configured cache, if not
+ * started already
+ *
+ * @throws Exception
+ */
+ protected void createAndStartCache() throws Exception {
+
+ // If Cache is initialized, exit
+ if(this.cache!=null && this.cache.isStarted())
+ {
+ return;
+ }
+
+ Cache cacheConfig = getAnnotation(Cache.class);
+ CacheFactoryRegistry registry = getCacheFactoryRegistry();
+ Ejb3CacheFactory factory = registry.getCacheFactory(cacheConfig.value());
+ this.cache = factory.createCache();
+ this.cache.initialize(this);
+ this.cache.start();
+ }
+
+ public void start() throws Exception
+ {
+ try
+ {
+ super.start();
+ this.createAndStartCache();
+ }
+ catch (Exception e)
+ {
+ try
+ {
+ stop();
+ }
+ catch (Exception ignore)
+ {
+ log.debug("Failed to cleanup after start() failure", ignore);
+ }
+ throw e;
+ }
+
+ }
+
+ public void stop() throws Exception
+ {
+ if (cache != null) cache.stop();
+ super.stop();
+ }
+
+ public StatefulCache getCache()
+ {
+ // Ensure initialized
+ try{
+ this.createAndStartCache();
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+
+ // Return
+ return cache;
+ }
+
+ public CacheFactoryRegistry getCacheFactoryRegistry()
+ {
+ return this.getDeployment().getCacheFactoryRegistry();
+ }
+
+ /**
+ * Performs a synchronous local invocation
+ */
+ public Object localInvoke(Object id, Method method, Object[] args)
+ throws Throwable
+ {
+ return localInvoke(id, method, args, null);
+ }
+
+ /**
+ * Performs a synchronous or asynchronous local invocation
+ *
+ */
+ public Object localHomeInvoke(Method method, Object[] args) throws Throwable
+ {
+ ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
+ pushEnc();
+ try
+ {
+ long hash = MethodHashing.calculateHash(method);
+ MethodInfo info = getAdvisor().getMethodInfo(hash);
+ if (info == null)
+ {
+ throw new RuntimeException(
+ "Could not resolve beanClass method from proxy call: "
+ + method.toString());
+ }
+ return invokeLocalHomeMethod(info, args);
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(oldLoader);
+ popEnc();
+ }
+ }
+
+ /**
+ * Performs a synchronous or asynchronous local invocation
+ *
+ * @param provider If null a synchronous invocation, otherwise an asynchronous
+ */
+ public Object localInvoke(Object id, Method method, Object[] args,
+ FutureHolder provider) throws Throwable
+ {
+ long start = System.currentTimeMillis();
+
+ ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
+ pushEnc();
+ try
+ {
+ long hash = MethodHashing.calculateHash(method);
+ MethodInfo info = getAdvisor().getMethodInfo(hash);
+ if (info == null)
+ {
+ throw new RuntimeException(
+ "Could not resolve beanClass method from proxy call: "
+ + method.toString());
+ }
+
+ Method unadvisedMethod = info.getUnadvisedMethod();
+
+ try
+ {
+ invokeStats.callIn();
+
+ if (unadvisedMethod != null && isHomeMethod(unadvisedMethod))
+ {
+ return invokeLocalHomeMethod(info, args);
+ }
+ else if (unadvisedMethod != null
+ && isEJBObjectMethod(unadvisedMethod))
+ {
+ return invokeEJBLocalObjectMethod(id, info, args);
+ }
+
+ StatefulContainerInvocation nextInvocation = new StatefulContainerInvocation(info, id);
+ nextInvocation.setAdvisor(getAdvisor());
+ nextInvocation.setArguments(args);
+
+ ProxyUtils.addLocalAsynchronousInfo(nextInvocation, provider);
+
+ invokedMethod.push(new InvokedMethod(true, method));
+ return nextInvocation.invokeNext();
+ }
+ finally
+ {
+ if (unadvisedMethod != null)
+ {
+ long end = System.currentTimeMillis();
+ long elapsed = end - start;
+ invokeStats.updateStats(unadvisedMethod, elapsed);
+ }
+
+ invokeStats.callOut();
+
+ invokedMethod.pop();
+ }
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(oldLoader);
+ popEnc();
+ }
+ }
+
+ /**
+ * Create a stateful bean and return its oid.
+ *
+ * @return
+ */
+ public Object createSession(Class<?>[] initTypes, Object[] initValues)
+ {
+ ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
+ pushEnc();
+ try
+ {
+ Thread.currentThread().setContextClassLoader(classloader);
+ StatefulCache cache = this.getCache();
+ StatefulBeanContext ctx = cache.create(initTypes, initValues);
+ // Since we return the key here, the context is not in use.
+ cache.release(ctx);
+ return ctx.getId();
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(oldLoader);
+ popEnc();
+ }
+ }
+
+ protected void destroySession(Object id)
+ {
+ getCache().remove(id);
+ }
+
+ /**
+ * This should be a remote invocation call
+ *
+ * @param invocation
+ * @return
+ * @throws Throwable
+ */
+ public InvocationResponse dynamicInvoke(Object target, Invocation invocation) throws Throwable
+ {
+ long start = System.currentTimeMillis();
+
+ ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
+ EJBContainerInvocation newSi = null;
+ pushEnc();
+ try
+ {
+ Thread.currentThread().setContextClassLoader(classloader);
+ StatefulRemoteInvocation si = (StatefulRemoteInvocation) invocation;
+ MethodInfo info = getAdvisor().getMethodInfo(si.getMethodHash());
+ if (info == null)
+ {
+ throw new RuntimeException("Could not resolve beanClass method from proxy call " + invocation);
+ }
+
+ InvocationResponse response = null;
+ Method unadvisedMethod = info.getUnadvisedMethod();
+ Object newId = null;
+
+ try
+ {
+ invokeStats.callIn();
+
+ if (info != null && unadvisedMethod != null && isHomeMethod(unadvisedMethod))
+ {
+ response = invokeHomeMethod(info, si);
+ }
+ else if (info != null && unadvisedMethod != null && isEJBObjectMethod(unadvisedMethod))
+ {
+ response = invokeEJBObjectMethod(info, si);
+ }
+ else
+ {
+ if (unadvisedMethod.isBridge())
+ {
+ unadvisedMethod = this.getNonBridgeMethod(unadvisedMethod);
+ info = super.getMethodInfo(unadvisedMethod);
+ }
+
+ if (si.getId() == null)
+ {
+ StatefulBeanContext ctx = getCache().create(null, null);
+ newId = ctx.getId();
+ }
+ else
+ {
+ newId = si.getId();
+ }
+ newSi = new StatefulContainerInvocation(info, newId);
+ newSi.setArguments(si.getArguments());
+ newSi.setMetaData(si.getMetaData());
+ newSi.setAdvisor(getAdvisor());
+
+ Object rtn = null;
+
+ invokedMethod.push(new InvokedMethod(false, unadvisedMethod));
+ rtn = newSi.invokeNext();
+
+ response = marshallResponse(invocation, rtn, newSi.getResponseContextInfo());
+ if (newId != null) response.addAttachment(StatefulConstants.NEW_ID, newId);
+ }
+ }
+ catch (Throwable throwable)
+ {
+ Throwable exception = throwable;
+ if (newId != null)
+ {
+ exception = new ForwardId(throwable, newId);
+ }
+ Map responseContext = null;
+ if (newSi != null) newSi.getResponseContextInfo();
+ response = marshallException(invocation, exception, responseContext);
+ return response;
+ }
+ finally
+ {
+ if (unadvisedMethod != null)
+ {
+ long end = System.currentTimeMillis();
+ long elapsed = end - start;
+ invokeStats.updateStats(unadvisedMethod, elapsed);
+ }
+
+ invokeStats.callOut();
+
+ invokedMethod.pop();
+ }
+
+ return response;
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(oldLoader);
+ popEnc();
+ }
+ }
+
+
+ public TimerService getTimerService()
+ {
+ throw new UnsupportedOperationException("stateful bean doesn't support TimerService (EJB3 18.2#2)");
+ }
+
+ public TimerService getTimerService(Object pKey)
+ {
+ return getTimerService();
+ }
+
+ @Override
+ public void invokePostActivate(BeanContext beanContext)
+ {
+ for (Injector injector : injectors)
+ {
+ if (injector instanceof JndiPropertyInjector)
+ {
+ AccessibleObject field = ((JndiPropertyInjector) injector).getAccessibleObject();
+
+ if (field.isAnnotationPresent(javax.ejb.EJB.class))
+ {
+ continue; // skip nested EJB injection since the local proxy will be (de)serialized correctly
+ }
+
+ if (field instanceof Field)
+ {
+ // reinject transient fields
+ if ((((Field)field).getModifiers() & Modifier.TRANSIENT) > 0)
+ injector.inject(beanContext);
+ }
+ }
+ }
+ // FIXME: this is just a hack, use an interceptor stack
+ try
+ {
+ List<Interceptor> interceptors = new ArrayList<Interceptor>(InterceptorsFactory.getLifeCycleInterceptors((InstanceAdvisor) getAdvisor(), PostActivate.class));
+ interceptors.add(0, PerVmAdvice.generateInterceptor(null, new InvocationContextInterceptor(), "setup"));
+
+ LifeCycleInvocation invocation = new LifeCycleInvocation(interceptors.toArray(new Interceptor[0]));
+ invocation.setAdvisor(getAdvisor());
+ invocation.setTargetObject(beanContext.getInstance());
+ invocation.invokeNext();
+ }
+ catch(Throwable t)
+ {
+ throw new RuntimeException(t);
+ }
+ }
+
+ @Override
+ public void invokePrePassivate(BeanContext beanContext)
+ {
+ // FIXME: this is just a hack, use an interceptor stack
+ try
+ {
+ List<Interceptor> interceptors = new ArrayList<Interceptor>(InterceptorsFactory.getLifeCycleInterceptors((InstanceAdvisor) getAdvisor(), PrePassivate.class));
+ interceptors.add(0, PerVmAdvice.generateInterceptor(null, new InvocationContextInterceptor(), "setup"));
+
+ LifeCycleInvocation invocation = new LifeCycleInvocation(interceptors.toArray(new Interceptor[0]));
+ invocation.setAdvisor(getAdvisor());
+ invocation.setTargetObject(beanContext.getInstance());
+ invocation.invokeNext();
+ }
+ catch(Throwable t)
+ {
+ throw new RuntimeException(t);
+ }
+ }
+
+ /*
+ @Override
+ protected Class[] getHandledCallbacks()
+ {
+ return new Class[]
+ {PostConstruct.class, PreDestroy.class, PostActivate.class,
+ PrePassivate.class};
+ }
+ */
+
+ public void invokeInit(Object bean, Class[] initParameterTypes,
+ Object[] initParameterValues)
+ {
+ int numParameters = 0;
+ if(initParameterTypes != null)
+ numParameters = initParameterTypes.length;
+ try
+ {
+ for(Method method : bean.getClass().getDeclaredMethods())
+ {
+ if(numParameters != method.getParameterTypes().length)
+ continue;
+
+ if ((method.getAnnotation(Init.class) != null)
+ || (resolveAnnotation(method, Init.class) != null))
+ {
+ if(initParameterTypes != null)
+ {
+ Object[] parameters = getInitParameters(method,
+ initParameterTypes, initParameterValues);
+
+ if (parameters != null)
+ method.invoke(bean, parameters);
+ }
+ else
+ {
+ method.invoke(bean);
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ protected Object[] getInitParameters(Method method,
+ Class[] initParameterTypes, Object[] initParameterValues)
+ {
+ if (method.getParameterTypes().length == initParameterTypes.length)
+ {
+ for (int i = 0; i < initParameterTypes.length; ++i)
+ {
+ Class formal = method.getParameterTypes()[i];
+ Class actual = initParameterTypes[i];
+ if (!isMethodInvocationConvertible(formal, actual == null ? null
+ : actual))
+ return null;
+ }
+ return initParameterValues;
+ }
+ return null;
+ }
+
+ /**
+ * Determines whether a type represented by a class object is convertible to
+ * another type represented by a class object using a method invocation
+ * conversion, treating object types of primitive types as if they were
+ * primitive types (that is, a Boolean actual parameter type matches boolean
+ * primitive formal type). This behavior is because this method is used to
+ * determine applicable methods for an actual parameter list, and primitive
+ * types are represented by their object duals in reflective method calls.
+ *
+ * @param formal the formal parameter type to which the actual parameter type
+ * should be convertible
+ * @param actual the actual parameter type.
+ * @return true if either formal type is assignable from actual type, or
+ * formal is a primitive type and actual is its corresponding object
+ * type or an object type of a primitive type that can be converted
+ * to the formal type.
+ */
+ private static boolean isMethodInvocationConvertible(Class formal,
+ Class actual)
+ {
+ /*
+ * if it's a null, it means the arg was null
+ */
+ if (actual == null && !formal.isPrimitive())
+ {
+ return true;
+ }
+ /*
+ * Check for identity or widening reference conversion
+ */
+ if (actual != null && formal.isAssignableFrom(actual))
+ {
+ return true;
+ }
+ /*
+ * Check for boxing with widening primitive conversion. Note that actual
+ * parameters are never primitives.
+ */
+ if (formal.isPrimitive())
+ {
+ if (formal == Boolean.TYPE && actual == Boolean.class)
+ return true;
+ if (formal == Character.TYPE && actual == Character.class)
+ return true;
+ if (formal == Byte.TYPE && actual == Byte.class)
+ return true;
+ if (formal == Short.TYPE
+ && (actual == Short.class || actual == Byte.class))
+ return true;
+ if (formal == Integer.TYPE
+ && (actual == Integer.class || actual == Short.class || actual == Byte.class))
+ return true;
+ if (formal == Long.TYPE
+ && (actual == Long.class || actual == Integer.class
+ || actual == Short.class || actual == Byte.class))
+ return true;
+ if (formal == Float.TYPE
+ && (actual == Float.class || actual == Long.class
+ || actual == Integer.class || actual == Short.class || actual == Byte.class))
+ return true;
+ if (formal == Double.TYPE
+ && (actual == Double.class || actual == Float.class
+ || actual == Long.class || actual == Integer.class
+ || actual == Short.class || actual == Byte.class))
+ return true;
+ }
+ return false;
+ }
+
+ private Object invokeEJBLocalObjectMethod(Object id, MethodInfo info,
+ Object[] args) throws Exception
+ {
+ Method unadvisedMethod = info.getUnadvisedMethod();
+ if (unadvisedMethod.getName().equals("remove"))
+ {
+ try
+ {
+ destroySession(id);
+ }
+ catch(NoSuchEJBException e)
+ {
+ throw new NoSuchObjectLocalException(e.getMessage(), e);
+ }
+
+ return null;
+ }
+ else if (unadvisedMethod.getName().equals("getEJBLocalHome"))
+ {
+ Object bean = getCache().get(id).getInstance();
+
+ return bean;
+ }
+ else if (unadvisedMethod.getName().equals("getPrimaryKey"))
+ {
+ return id;
+ }
+ else if (unadvisedMethod.getName().equals("isIdentical"))
+ {
+ EJBObject bean = (EJBObject) args[0];
+
+ Object primaryKey = bean.getPrimaryKey();
+
+ boolean isIdentical = id.equals(primaryKey);
+
+ return isIdentical;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ private Object invokeLocalHomeMethod(MethodInfo info, Object[] args)
+ throws Exception
+ {
+ Method unadvisedMethod = info.getUnadvisedMethod();
+ if (unadvisedMethod.getName().startsWith("create"))
+ {
+ Class<?>[] initParameterTypes =
+ {};
+ Object[] initParameterValues =
+ {};
+ if (unadvisedMethod.getParameterTypes().length > 0)
+ {
+ initParameterTypes = unadvisedMethod.getParameterTypes();
+ initParameterValues = args;
+ }
+
+ LocalBinding binding = this.getAnnotation(LocalBinding.class);
+
+ StatefulLocalProxyFactory factory = new StatefulLocalProxyFactory(this, binding);
+ factory.init();
+
+ Object proxy = factory.createProxyEjb21(initParameterTypes,
+ initParameterValues);
+
+ return proxy;
+ }
+ else if (unadvisedMethod.getName().equals("remove"))
+ {
+ remove(args[0]);
+
+ return null;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public Object createLocalProxy(Object id) throws Exception
+ {
+ return this.createLocalProxy(id, this.getAnnotation(LocalBinding.class));
+ }
+
+ public Object createLocalProxy(Object id, LocalBinding binding) throws Exception
+ {
+ StatefulLocalProxyFactory factory = new StatefulLocalProxyFactory(this, binding);
+ factory.init();
+
+ return factory.createProxyBusiness(id);
+ }
+
+ public Object createRemoteProxy(Object id, RemoteBinding binding) throws Exception
+ {
+ StatefulRemoteProxyFactory factory = new StatefulRemoteProxyFactory(this, binding);
+ factory.init();
+
+ if (id != null)
+ return factory.createProxyBusiness(id);
+ else
+ return factory.createProxyBusiness();
+ }
+
+ public boolean isClustered()
+ {
+ return isAnnotationPresent(Clustered.class);
+ }
+
+ protected InvocationResponse invokeHomeMethod(MethodInfo info,
+ StatefulRemoteInvocation statefulInvocation) throws Throwable
+ {
+ Method unadvisedMethod = info.getUnadvisedMethod();
+ if (unadvisedMethod.getName().startsWith("create"))
+ {
+ Class<?>[] initParameterTypes =
+ {};
+ Object[] initParameterValues =
+ {};
+ if (unadvisedMethod.getParameterTypes().length > 0)
+ {
+ initParameterTypes = unadvisedMethod.getParameterTypes();
+ initParameterValues = statefulInvocation.getArguments();
+ }
+
+ RemoteBinding binding = null;
+ RemoteBindings bindings = this.getAnnotation(RemoteBindings.class);
+ if (bindings != null)
+ binding = bindings.value()[0];
+ else
+ binding = this.getAnnotation(RemoteBinding.class);
+
+ StatefulContainerInvocation newStatefulInvocation = buildNewInvocation(
+ info, statefulInvocation, initParameterTypes,
+ initParameterValues);
+
+ StatefulRemoteProxyFactory factory = new StatefulRemoteProxyFactory(this, binding);
+ factory.init();
+
+ Object proxy = null;
+ if (newStatefulInvocation.getId() != null)
+ proxy = factory.createProxyEjb21(newStatefulInvocation.getId());
+ else
+ proxy = factory.createProxyEjb21();
+
+ InvocationResponse response = marshallResponse(statefulInvocation, proxy, newStatefulInvocation.getResponseContextInfo());
+ if (newStatefulInvocation.getId() != null)
+ response.addAttachment(StatefulConstants.NEW_ID,
+ newStatefulInvocation.getId());
+ return response;
+ }
+ else if (unadvisedMethod.getName().equals("remove"))
+ {
+ remove(statefulInvocation.getArguments()[0]);
+
+ InvocationResponse response = new InvocationResponse(null);
+ response.setContextInfo(statefulInvocation.getResponseContextInfo());
+ return response;
+ }
+ else if (unadvisedMethod.getName().equals("getEJBMetaData"))
+ {
+ Class<?> remote = null;
+ Class<?> home = null;
+ Class<?> pkClass = Object.class;
+ HomeHandleImpl homeHandle = null;
+
+ Remote remoteAnnotation = this.getAnnotation(Remote.class);
+ if (remoteAnnotation != null)
+ remote = remoteAnnotation.value()[0];
+ RemoteHome homeAnnotation = this.getAnnotation(RemoteHome.class);
+ if (homeAnnotation != null)
+ home = homeAnnotation.value();
+ RemoteBinding remoteBindingAnnotation = this.getAnnotation(RemoteBinding.class);
+ if (remoteBindingAnnotation != null)
+ homeHandle = new HomeHandleImpl(remoteBindingAnnotation
+ .jndiBinding());
+
+ EJBMetaDataImpl metadata = new EJBMetaDataImpl(remote, home, pkClass,
+ true, false, homeHandle);
+
+ InvocationResponse response = marshallResponse(statefulInvocation, metadata, null);
+ return response;
+ }
+ else if (unadvisedMethod.getName().equals("getHomeHandle"))
+ {
+ HomeHandleImpl homeHandle = null;
+
+ RemoteBinding remoteBindingAnnotation = this.getAnnotation(RemoteBinding.class);
+ if (remoteBindingAnnotation != null)
+ homeHandle = new HomeHandleImpl(remoteBindingAnnotation
+ .jndiBinding());
+
+
+ InvocationResponse response = marshallResponse(statefulInvocation, homeHandle, null);
+ return response;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ protected InvocationResponse invokeEJBObjectMethod(MethodInfo info,
+ StatefulRemoteInvocation statefulInvocation) throws Throwable
+ {
+ Method unadvisedMethod = info.getUnadvisedMethod();
+ if (unadvisedMethod.getName().equals("getHandle"))
+ {
+ StatefulContainerInvocation newStatefulInvocation = buildInvocation(
+ info, statefulInvocation);
+
+ ProxyFactory proxyFactory = this.proxyDeployer.getProxyFactory(this.getAnnotation(RemoteBinding.class));;
+ if (proxyFactory == null)
+ {
+ proxyFactory = this.getProxyFactory(this.getAnnotation(RemoteBinding.class));
+ }
+ BaseStatefulRemoteProxyFactory statefulRemoteProxyFactory = (BaseStatefulRemoteProxyFactory) proxyFactory;
+ EJBObject proxy = (EJBObject) statefulRemoteProxyFactory.createProxyEjb21(newStatefulInvocation.getId());
+ StatefulHandleRemoteImpl handle = new StatefulHandleRemoteImpl(proxy);
+ InvocationResponse response = marshallResponse(statefulInvocation, handle, null);
+ return response;
+ }
+ else if (unadvisedMethod.getName().equals("remove"))
+ {
+ try
+ {
+ destroySession(statefulInvocation.getId());
+ }
+ catch(NoSuchEJBException e)
+ {
+ if(log.isTraceEnabled())
+ log.trace("Throwing " + e.getClass().getName(), e);
+ throw new NoSuchObjectException(e.getMessage());
+ }
+
+ InvocationResponse response = new InvocationResponse(null);
+ return response;
+ }
+ else if (unadvisedMethod.getName().equals("getEJBHome"))
+ {
+ HomeHandleImpl homeHandle = null;
+
+ RemoteBinding remoteBindingAnnotation = this.getAnnotation(RemoteBinding.class);
+ if (remoteBindingAnnotation != null)
+ homeHandle = new HomeHandleImpl(ProxyFactoryHelper.getHomeJndiName(this));
+
+ EJBHome ejbHome = homeHandle.getEJBHome();
+
+ InvocationResponse response = marshallResponse(statefulInvocation, ejbHome, null);
+ return response;
+ }
+ else if (unadvisedMethod.getName().equals("getPrimaryKey"))
+ {
+ Object id = statefulInvocation.getId();
+
+ InvocationResponse response = marshallResponse(statefulInvocation, id, null);
+ return response;
+ }
+ else if (unadvisedMethod.getName().equals("isIdentical"))
+ {
+ Object id = statefulInvocation.getId();
+ EJBObject bean = (EJBObject) statefulInvocation.getArguments()[0];
+
+ Object primaryKey = bean.getPrimaryKey();
+
+ boolean isIdentical = id.equals(primaryKey);
+
+ InvocationResponse response = marshallResponse(statefulInvocation, isIdentical, null);
+ return response;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ private StatefulContainerInvocation buildNewInvocation(MethodInfo info,
+ StatefulRemoteInvocation statefulInvocation,
+ Class[] initParameterTypes, Object[] initParameterValues)
+ {
+ StatefulContainerInvocation newStatefulInvocation = null;
+
+ StatefulBeanContext ctx = null;
+ if (initParameterTypes.length > 0)
+ ctx = getCache().create(initParameterTypes, initParameterValues);
+ else
+ ctx = getCache().create(null, null);
+
+ Object newId = ctx.getId();
+ newStatefulInvocation = new StatefulContainerInvocation(info, newId);
+
+ newStatefulInvocation.setArguments(statefulInvocation.getArguments());
+ newStatefulInvocation.setMetaData(statefulInvocation.getMetaData());
+ newStatefulInvocation.setAdvisor(getAdvisor());
+
+ return newStatefulInvocation;
+ }
+
+ private StatefulContainerInvocation buildInvocation(MethodInfo info,
+ StatefulRemoteInvocation statefulInvocation)
+ {
+ StatefulContainerInvocation newStatefulInvocation = null;
+ Object newId = null;
+ if (statefulInvocation.getId() == null)
+ {
+ StatefulBeanContext ctx = getCache().create(null, null);
+ newId = ctx.getId();
+ newStatefulInvocation = new StatefulContainerInvocation(info, newId);
+ }
+ else
+ {
+ newStatefulInvocation = new StatefulContainerInvocation(info, statefulInvocation.getId());
+ }
+
+ newStatefulInvocation.setArguments(statefulInvocation.getArguments());
+ newStatefulInvocation.setMetaData(statefulInvocation.getMetaData());
+ newStatefulInvocation.setAdvisor(getAdvisor());
+
+ return newStatefulInvocation;
+ }
+
+ @Override
+ public Object getBusinessObject(BeanContext beanContext, Class businessInterface) throws IllegalStateException
+ {
+ assert beanContext != null : "beanContext is null";
+ assert businessInterface != null : "businessInterface is null";
+
+ StatefulBeanContext ctx = (StatefulBeanContext) beanContext;
+
+ SessionContainer container = ctx.getContainer();
+ assert container == this : "beanContext not of this container (" + container + " != " + this + ")";
+
+ boolean isRemote = false;
+ boolean found = false;
+ Class[] remoteInterfaces = ProxyFactoryHelper.getRemoteAndBusinessRemoteInterfaces(this);
+ for (Class intf : remoteInterfaces)
+ {
+ if (intf.getName().equals(businessInterface.getName()))
+ {
+ isRemote = true;
+ found = true;
+ break;
+ }
+ }
+ if (found == false)
+ {
+ Class[] localInterfaces = ProxyFactoryHelper.getLocalAndBusinessLocalInterfaces(this);
+ for (Class intf : localInterfaces)
+ {
+ if (intf.getName().equals(businessInterface.getName()))
+ {
+ found = true;
+ break;
+ }
+ }
+ }
+ if (found == false) throw new IllegalStateException(businessInterface.getName() + " is not a business interface for container " + this);
+
+ Collection<ProxyFactory> proxyFactories = this.proxyDeployer.getProxyFactories().values();
+ for (ProxyFactory factory : proxyFactories)
+ {
+ if (isRemote && factory instanceof StatefulRemoteProxyFactory)
+ {
+ return ((StatefulRemoteProxyFactory) factory).createProxyBusiness(ctx.getId());
+ }
+ else if (!isRemote && factory instanceof StatefulLocalProxyFactory)
+ {
+ return ((StatefulLocalProxyFactory) factory).createProxyBusiness(ctx.getId());
+ }
+ }
+ throw new IllegalStateException("Unable to create proxy for getBusinessObject as a proxy factory was not found");
+ }
+
+ /**
+ * Remove the given object. Called when remove on Home is invoked.
+ *
+ * @param target either a Handle or a primaryKey
+ * @throws RemoveException if it's not allowed to be removed
+ */
+ private void remove(Object target) throws RemoveException
+ {
+ // EJBTHREE-1217: EJBHome.remove(Object primaryKey) must throw RemoveException
+ if(!(target instanceof Handle))
+ throw new RemoveException("EJB 3 3.6.2.2: Session beans do not have a primary key");
+
+ StatefulHandleRemoteImpl handle = (StatefulHandleRemoteImpl) target;
+
+ try
+ {
+ handle.getEJBObject().remove();
+ }
+ catch(RemoteException re)
+ {
+ throw new RemoveException(re.getMessage());
+ }
+ }
+
+ protected void removeHandle(Handle arg) throws Exception
+ {
+ /*
+ StatefulHandleImpl handle = (StatefulHandleImpl) arg;
+
+ destroySession(handle.id);
+ */
+ arg.getEJBObject().remove();
+ }
+}
Copied: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulHandleRemoteImpl.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulHandleRemoteImpl.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulHandleRemoteImpl.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulHandleRemoteImpl.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,72 @@
+/*
+ * 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.rmi.RemoteException;
+
+import javax.ejb.EJBObject;
+import javax.ejb.Handle;
+
+import org.jboss.logging.Logger;
+
+/**
+ * An EJB stateful session bean handle.
+ *
+ * @author <a href="mailto:marc.fleury at jboss.org">Marc Fleury</a>
+ * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
+ * @author <a href="bill at burkecentral.com">Bill Burke</a>
+ * @author <a href="bdecoste at jboss.com">William DeCoste</a>
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision$
+ */
+public class StatefulHandleRemoteImpl implements Handle
+{
+ private static final Logger log = Logger.getLogger(StatefulHandleRemoteImpl.class);
+
+ /** Serial Version Identifier. */
+ static final long serialVersionUID = -6324520755180597156L;
+
+ // Instance Members
+
+ private EJBObject proxy;
+
+ // Constructor
+
+ public StatefulHandleRemoteImpl(EJBObject proxy)
+ {
+ this.proxy = proxy;
+ }
+
+ // Required Implementations
+
+ /**
+ * Handle implementation.
+ *
+ * Returns the proxy
+ *
+ * @throws RemoteException
+ */
+ public EJBObject getEJBObject() throws RemoteException
+ {
+ return this.proxy;
+ }
+}
Deleted: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulHomeRemoteProxy.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulHomeRemoteProxy.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulHomeRemoteProxy.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -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(StatefulRemoteHandleImpl 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/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulHomeRemoteProxy.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulHomeRemoteProxy.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulHomeRemoteProxy.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulHomeRemoteProxy.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -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.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/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulLocalProxyFactory.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulLocalProxyFactory.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulLocalProxyFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -1,199 +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 java.rmi.dgc.VMID;
-
-import javax.ejb.EJBLocalObject;
-import javax.ejb.LocalHome;
-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.session.SessionContainer;
-import org.jboss.proxy.ejb.handle.StatefulHandleImpl;
-import org.jboss.util.NotImplementedException;
-import org.jboss.util.naming.Util;
-
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public class StatefulLocalProxyFactory extends BaseStatefulProxyFactory
-{
- private VMID vmid = Ejb3Registry.getVMID();
-
- /**
- * Do not call, only for externalizable
- */
- public StatefulLocalProxyFactory()
- {
- super();
- }
-
- public StatefulLocalProxyFactory(SessionContainer container, LocalBinding binding)
- {
- super(container, binding.jndiBinding());
- }
-
- /**
- * Defines the access type for this Proxies created by this Factory
- *
- * @return
- */
- @Override
- protected ProxyAccessType getProxyAccessType(){
- return ProxyAccessType.LOCAL;
- }
-
- protected void validateEjb21Views()
- {
- // Obtain Container
- SessionContainer container = this.getContainer();
-
- // Obtain @LocalHome
- 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));
-
- }
-
- protected boolean bindHomeAndBusinessTogether(SessionContainer container)
- {
- return ProxyFactoryHelper.getLocalHomeJndiName(container).equals(jndiName);
- }
-
- public void start() throws Exception
- {
- super.start();
-
- try
- {
- Util.rebind(getContainer().getInitialContext(), jndiName + PROXY_FACTORY_NAME, this);
- }
- catch (NamingException e)
- {
- NamingException namingException = new NamingException("Could not bind stateful local proxy with ejb name "
- + getContainer().getEjbName() + " into JNDI under jndiName: "
- + getContainer().getInitialContext().getNameInNamespace() + "/" + jndiName + PROXY_FACTORY_NAME);
- namingException.setRootCause(e);
- throw namingException;
- }
-
- SessionContainer statefulContainer = (SessionContainer) getContainer();
- LocalHome localHome = this.getContainer().getAnnotation(LocalHome.class);
- if (localHome != null && !bindHomeAndBusinessTogether(statefulContainer))
- {
- Class<?>[] interfaces =
- {localHome.value()};
- Object homeProxy = java.lang.reflect.Proxy.newProxyInstance(getContainer().getBeanClass().getClassLoader(),
- interfaces, new StatefulLocalHomeProxy(getContainer()));
- Util.rebind(getContainer().getInitialContext(), ProxyFactoryHelper.getLocalHomeJndiName(getContainer()),
- homeProxy);
- }
- }
-
- public void stop() throws Exception
- {
- super.stop();
- Util.unbind(getContainer().getInitialContext(), jndiName + PROXY_FACTORY_NAME);
- SessionContainer statefulContainer = (SessionContainer) getContainer();
- LocalHome localHome = this.getContainer().getAnnotation(LocalHome.class);
- if (localHome != null && !bindHomeAndBusinessTogether(statefulContainer))
- {
- Util.unbind(getContainer().getInitialContext(), ProxyFactoryHelper.getLocalHomeJndiName(getContainer()));
- }
- }
-
- public Object createProxy()
- {
- SessionContainer sfsb = (SessionContainer) getContainer();
- Object id = sfsb.createSession();
- return this.createProxy(id);
- }
-
- public EJBLocalObject createProxyEjb21()
- {
- Object id = getContainer().createSession();
- return this.createProxyEjb21(id);
- }
-
- public Object createProxy(Object id)
- {
- return this.createProxy(id, SpecificationInterfaceType.EJB30_BUSINESS);
- }
-
- @SuppressWarnings("unchecked")
- public <T extends EJBLocalObject> T createProxyEjb21(Object id)
- {
- return (T)this.createProxy(id, SpecificationInterfaceType.EJB21);
- }
-
- private Object createProxy(Object id, SpecificationInterfaceType type)
- {
- StatefulLocalProxy proxy = new StatefulLocalProxy(this.getContainer(), id, vmid);
- return type.equals(SpecificationInterfaceType.EJB30_BUSINESS) ? this.constructBusinessProxy(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);
- }
-
- public Object createEjb21Proxy(Class<?>[] initTypes, Object[] initValues){
- SessionContainer sfsb = (SessionContainer) getContainer();
- Object id = sfsb.createSession(initTypes, initValues);
- return this.createProxy(id, SpecificationInterfaceType.EJB21);
- }
-
- protected StatefulHandleImpl createHandle()
- {
- throw new NotImplementedException("NYI");
- }
-
- @Override
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- {
- super.readExternal(in);
- vmid = (VMID)in.readObject();
- }
-
- @Override
- public void writeExternal(ObjectOutput out) throws IOException
- {
- super.writeExternal(out);
- out.writeObject(vmid);
- }
-}
Copied: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulLocalProxyFactory.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulLocalProxyFactory.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulLocalProxyFactory.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulLocalProxyFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,201 @@
+/*
+ * 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 java.rmi.dgc.VMID;
+
+import javax.ejb.EJBLocalObject;
+import javax.ejb.LocalHome;
+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.session.ProxyAccessType;
+import org.jboss.ejb3.session.SessionContainer;
+import org.jboss.ejb3.session.SessionSpecContainer;
+import org.jboss.proxy.ejb.handle.StatefulHandleImpl;
+import org.jboss.util.NotImplementedException;
+import org.jboss.util.naming.Util;
+
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+public class StatefulLocalProxyFactory extends BaseStatefulProxyFactory
+{
+ private VMID vmid = Ejb3Registry.getVMID();
+
+ /**
+ * Do not call, only for externalizable
+ */
+ public StatefulLocalProxyFactory()
+ {
+ super();
+ }
+
+ public StatefulLocalProxyFactory(SessionSpecContainer container, LocalBinding binding)
+ {
+ super(container, binding.jndiBinding());
+ }
+
+ /**
+ * Defines the access type for this Proxies created by this Factory
+ *
+ * @return
+ */
+ @Override
+ protected ProxyAccessType getProxyAccessType(){
+ return ProxyAccessType.LOCAL;
+ }
+
+ protected void validateEjb21Views()
+ {
+ // Obtain Container
+ SessionContainer container = this.getContainer();
+
+ // Obtain @LocalHome
+ 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));
+
+ }
+
+ protected boolean bindHomeAndBusinessTogether(SessionContainer container)
+ {
+ return ProxyFactoryHelper.getLocalHomeJndiName(container).equals(jndiName);
+ }
+
+ public void start() throws Exception
+ {
+ super.start();
+
+ try
+ {
+ Util.rebind(getContainer().getInitialContext(), jndiName + PROXY_FACTORY_NAME, this);
+ }
+ catch (NamingException e)
+ {
+ NamingException namingException = new NamingException("Could not bind stateful local proxy with ejb name "
+ + getContainer().getEjbName() + " into JNDI under jndiName: "
+ + getContainer().getInitialContext().getNameInNamespace() + "/" + jndiName + PROXY_FACTORY_NAME);
+ namingException.setRootCause(e);
+ throw namingException;
+ }
+
+ SessionContainer statefulContainer = (SessionContainer) getContainer();
+ LocalHome localHome = this.getContainer().getAnnotation(LocalHome.class);
+ if (localHome != null && !bindHomeAndBusinessTogether(statefulContainer))
+ {
+ Class<?>[] interfaces =
+ {localHome.value()};
+ Object homeProxy = java.lang.reflect.Proxy.newProxyInstance(getContainer().getBeanClass().getClassLoader(),
+ interfaces, new StatefulLocalHomeProxy(getContainer()));
+ Util.rebind(getContainer().getInitialContext(), ProxyFactoryHelper.getLocalHomeJndiName(getContainer()),
+ homeProxy);
+ }
+ }
+
+ public void stop() throws Exception
+ {
+ super.stop();
+ Util.unbind(getContainer().getInitialContext(), jndiName + PROXY_FACTORY_NAME);
+ SessionContainer statefulContainer = (SessionContainer) getContainer();
+ LocalHome localHome = this.getContainer().getAnnotation(LocalHome.class);
+ if (localHome != null && !bindHomeAndBusinessTogether(statefulContainer))
+ {
+ Util.unbind(getContainer().getInitialContext(), ProxyFactoryHelper.getLocalHomeJndiName(getContainer()));
+ }
+ }
+
+ public Object createProxyBusiness()
+ {
+ SessionContainer sfsb = (SessionContainer) getContainer();
+ Object id = sfsb.createSession();
+ return this.createProxyBusiness(id);
+ }
+
+ public EJBLocalObject createProxyEjb21()
+ {
+ Object id = getContainer().createSession();
+ return this.createProxyEjb21(id);
+ }
+
+ public Object createProxyBusiness(Object id)
+ {
+ return this.createProxy(id, SpecificationInterfaceType.EJB30_BUSINESS);
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T extends EJBLocalObject> T createProxyEjb21(Object id)
+ {
+ return (T)this.createProxy(id, SpecificationInterfaceType.EJB21);
+ }
+
+ private Object createProxy(Object id, SpecificationInterfaceType type)
+ {
+ StatefulLocalProxy proxy = new StatefulLocalProxy(this.getContainer(), id, vmid);
+ 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);
+ }
+
+ public Object createProxyEjb21(Class<?>[] initTypes, Object[] initValues){
+ SessionContainer sfsb = (SessionContainer) getContainer();
+ Object id = sfsb.createSession(initTypes, initValues);
+ return this.createProxy(id, SpecificationInterfaceType.EJB21);
+ }
+
+ protected StatefulHandleImpl createHandle()
+ {
+ throw new NotImplementedException("NYI");
+ }
+
+ @Override
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
+ {
+ super.readExternal(in);
+ vmid = (VMID)in.readObject();
+ }
+
+ @Override
+ public void writeExternal(ObjectOutput out) throws IOException
+ {
+ super.writeExternal(out);
+ out.writeObject(vmid);
+ }
+}
Deleted: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulRemoteHandleImpl.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulRemoteHandleImpl.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulRemoteHandleImpl.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -1,72 +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.rmi.RemoteException;
-
-import javax.ejb.EJBObject;
-import javax.ejb.Handle;
-
-import org.jboss.logging.Logger;
-
-/**
- * An EJB stateful session bean handle.
- *
- * @author <a href="mailto:marc.fleury at jboss.org">Marc Fleury</a>
- * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
- * @author <a href="bill at burkecentral.com">Bill Burke</a>
- * @author <a href="bdecoste at jboss.com">William DeCoste</a>
- * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
- * @version $Revision$
- */
-public class StatefulRemoteHandleImpl implements Handle
-{
- private static final Logger log = Logger.getLogger(StatefulRemoteHandleImpl.class);
-
- /** Serial Version Identifier. */
- static final long serialVersionUID = -6324520755180597156L;
-
- // Instance Members
-
- private EJBObject proxy;
-
- // Constructor
-
- public StatefulRemoteHandleImpl(EJBObject proxy)
- {
- this.proxy = proxy;
- }
-
- // Required Implementations
-
- /**
- * Handle implementation.
- *
- * Returns the proxy
- *
- * @throws RemoteException
- */
- public EJBObject getEJBObject() throws RemoteException
- {
- return this.proxy;
- }
-}
Deleted: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulRemoteProxy.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulRemoteProxy.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulRemoteProxy.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -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(StatefulRemoteHandleImpl 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;
- }
-}
Copied: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulRemoteProxy.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulRemoteProxy.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulRemoteProxy.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulRemoteProxy.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,195 @@
+/*
+ * 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/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulRemoteProxyFactory.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulRemoteProxyFactory.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulRemoteProxyFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -1,181 +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.EJBObject;
-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.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);
-
-// public static final String FACTORY_ATTRIBUTE = ",element=ProxyFactory";
-
- private static final String STACK_NAME_STATEFUL_SESSION_CLIENT_INTERCEPTORS = "StatefulSessionClientInterceptors";
-
- public StatefulRemoteProxyFactory(SessionContainer container, RemoteBinding binding)
- {
- super(container, binding);
- }
-
- protected boolean bindHomeAndBusinessTogether(SessionContainer container)
- {
- String homeJndiName = ProxyFactoryHelper.getHomeJndiName(container);
- String remoteBusinessJndiName = ProxyFactoryHelper.getRemoteBusinessJndiName(container);
- return homeJndiName.equals(remoteBusinessJndiName);
- }
-
- @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);
-
- SessionContainer statefulContainer = this.getContainer();
- RemoteHome remoteHome = statefulContainer.getAnnotation(RemoteHome.class);
- if (remoteHome != null && !bindHomeAndBusinessTogether(statefulContainer))
- {
- Object homeProxy = createHomeProxy(remoteHome.value());
- String homeJndiName = ProxyFactoryHelper.getHomeJndiName(this.getContainer());
- 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(statefulContainer))
- {
- 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());
- }
-
- @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/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulRemoteProxyFactory.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulRemoteProxyFactory.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulRemoteProxyFactory.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/StatefulRemoteProxyFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,174 @@
+/*
+ * 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);
+
+// public static final String FACTORY_ATTRIBUTE = ",element=ProxyFactory";
+
+ 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);
+
+ SessionContainer statefulContainer = this.getContainer();
+ RemoteHome remoteHome = statefulContainer.getAnnotation(RemoteHome.class);
+ if (remoteHome != null && !bindHomeAndBusinessTogether(statefulContainer))
+ {
+ Object homeProxy = createHomeProxy(remoteHome.value());
+ String homeJndiName = ProxyFactoryHelper.getHomeJndiName(this.getContainer());
+ 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(statefulContainer))
+ {
+ 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());
+ }
+
+ @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);
+
+ }
+
+
+}
Deleted: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/BaseStatelessProxyFactory.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/BaseStatelessProxyFactory.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/BaseStatelessProxyFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -1,261 +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.io.Serializable;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-
-import javassist.util.proxy.MethodHandler;
-import javassist.util.proxy.ProxyObject;
-
-import javax.naming.Context;
-import javax.naming.NamingException;
-
-import org.jboss.aop.Advisor;
-import org.jboss.ejb3.Container;
-import org.jboss.ejb3.ProxyFactory;
-import org.jboss.ejb3.session.SessionContainer;
-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);
-
-// protected Class proxyClass;
-// protected Context proxyFactoryContext;
- protected String jndiName;
-
- private Constructor proxyConstructor;
-
- public BaseStatelessProxyFactory(SessionContainer 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);
- }
- }
-
- /**
- * Hide the fact that I'm now using javassist.
- *
- * @param handler a JDK proxy InvocationHandler
- * @return a true proxy
- */
- protected Object constructProxy(final InvocationHandler handler)
- {
- try
- {
- /* plain jdk */
- Object args[] = { handler };
- Object proxy = proxyConstructor.newInstance(args);
-
- /* javassist */
- /*
- MethodHandler realHandler = new MethodHandlerAdapter(handler);
-// ProxyObject proxy = (ProxyObject) proxyConstructor.newInstance((Object[]) null);
-// proxy.setHandler(realHandler);
- JavassistProxy proxy = (JavassistProxy) proxyConstructor.newInstance((Object[]) null);
- proxy.setMethodHandler(realHandler);
- JavassistProxy.pokeInterfaces(proxy, getInterfaces());
- */
-
- /* cglib */
- /*
- Object args[] = { new CGLibInvocationHandlerAdapter(handler) };
- Object proxy = proxyConstructor.newInstance(args);
- */
-
- return proxy;
- }
- catch (IllegalArgumentException e)
- {
- throw new RuntimeException(e);
- }
- catch (InstantiationException e)
- {
- throw new RuntimeException(e);
- }
- catch (IllegalAccessException e)
- {
- throw new RuntimeException(e);
- }
- catch (InvocationTargetException e)
- {
- throw new RuntimeException(e.getTargetException());
- }
- }
-
- public final Object createProxy(Object id)
- {
- assert id == null : "stateless bean must not have an id";
- return createProxy();
- }
-
- public void init() throws Exception
- {
- initializeJndiName();
- Class<?>[] interfaces = getInterfaces();
- this.validateEjb21Views();
-
-
- /* plain jdk */
- Class<?> proxyClass = java.lang.reflect.Proxy.getProxyClass(getContainer().getBeanClass().getClassLoader(), interfaces);
- final Class<?>[] constructorParams =
- {InvocationHandler.class};
- proxyConstructor = 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);
- */
- }
-
- /* 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 = createProxy();
- //describeClass(proxy.getClass());
- bindProxy(proxy);
- }
-
- public void stop() throws Exception
- {
- Util.unbind(getContainer().getInitialContext(), jndiName);
- }
-
- protected abstract Class<?>[] getInterfaces();
-
- protected abstract void validateEjb21Views();
-
- protected final void initializeJndiName() {};
-
- protected void bindProxy(Object proxy) throws NamingException
- {
- try
- {
- log.debug("Binding proxy for " + getContainer().getEjbName() + " in JNDI at " + jndiName);
- Util.rebind(getContainer().getInitialContext(), jndiName, 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() + "/" + jndiName);
- namingException.setRootCause(e);
- throw namingException;
- }
- }
-}
Copied: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/BaseStatelessProxyFactory.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/BaseStatelessProxyFactory.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/BaseStatelessProxyFactory.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/BaseStatelessProxyFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,165 @@
+/*
+ * 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.naming.NamingException;
+
+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);
+
+ protected String jndiName;
+
+ 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();
+
+ protected void bindProxy(Object proxy) throws NamingException
+ {
+ try
+ {
+ log.debug("Binding proxy for " + getContainer().getEjbName() + " in JNDI at " + jndiName);
+ Util.rebind(getContainer().getInitialContext(), jndiName, 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() + "/" + jndiName);
+ namingException.setRootCause(e);
+ throw namingException;
+ }
+ }
+}
Copied: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/BaseStatelessRemoteProxyFactory.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/BaseStatelessRemoteProxyFactory.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/BaseStatelessRemoteProxyFactory.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/BaseStatelessRemoteProxyFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,134 @@
+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 bindHomeAndBusinessTogether(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/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessBeanContext.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessBeanContext.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessBeanContext.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -1,71 +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.xml.ws.WebServiceContext;
-
-import org.jboss.ejb3.BaseContext;
-import org.jboss.ejb3.session.SessionBeanContext;
-import org.jboss.ejb3.session.SessionContainer;
-import org.jboss.injection.lang.reflect.BeanProperty;
-
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public class StatelessBeanContext extends SessionBeanContext
-{
- private javax.xml.rpc.handler.MessageContext jaxrpcMessageContext;
- private BeanProperty webServiceContextProperty;
-
- protected StatelessBeanContext(SessionContainer container, Object bean)
- {
- super(container, bean);
- }
-
- public javax.xml.rpc.handler.MessageContext getMessageContextJAXRPC()
- {
- return jaxrpcMessageContext;
- }
-
- public void setMessageContextJAXRPC(javax.xml.rpc.handler.MessageContext rpcMessageContext)
- {
- this.jaxrpcMessageContext = rpcMessageContext;
- }
-
- public BeanProperty getWebServiceContextProperty()
- {
- return webServiceContextProperty;
- }
-
- public void setWebServiceContextProperty(BeanProperty webServiceContextProperty)
- {
- this.webServiceContextProperty = webServiceContextProperty;
- }
-
- public void remove()
- {
- }
-}
Copied: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessBeanContext.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessBeanContext.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessBeanContext.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessBeanContext.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,68 @@
+/*
+ * 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.session.SessionSpecBeanContext;
+import org.jboss.ejb3.session.SessionSpecContainer;
+import org.jboss.injection.lang.reflect.BeanProperty;
+
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+public class StatelessBeanContext extends SessionSpecBeanContext<SessionSpecContainer>
+{
+ private javax.xml.rpc.handler.MessageContext jaxrpcMessageContext;
+ private BeanProperty webServiceContextProperty;
+
+ protected StatelessBeanContext(SessionSpecContainer container, Object bean)
+ {
+ super(container, bean);
+ }
+
+ public javax.xml.rpc.handler.MessageContext getMessageContextJAXRPC()
+ {
+ return jaxrpcMessageContext;
+ }
+
+ public void setMessageContextJAXRPC(javax.xml.rpc.handler.MessageContext rpcMessageContext)
+ {
+ this.jaxrpcMessageContext = rpcMessageContext;
+ }
+
+ public BeanProperty getWebServiceContextProperty()
+ {
+ return webServiceContextProperty;
+ }
+
+ public void setWebServiceContextProperty(BeanProperty webServiceContextProperty)
+ {
+ this.webServiceContextProperty = webServiceContextProperty;
+ }
+
+ public void remove()
+ {
+ }
+}
Deleted: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessClusterProxyFactory.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessClusterProxyFactory.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessClusterProxyFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -1,216 +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.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.ejb.RemoteHome;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.aop.advice.AdviceStack;
-import org.jboss.aspects.remoting.FamilyWrapper;
-import org.jboss.ejb3.JBossProxy;
-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.SessionContainer;
-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;
-
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public class StatelessClusterProxyFactory extends BaseStatelessProxyFactory
- implements RemoteProxyFactory, DistributedReplicantManager.ReplicantListener
-{
- private static final Logger log = Logger.getLogger(StatelessClusterProxyFactory.class);
-
- 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(SessionContainer container, RemoteBinding binding, Clustered clustered)
- {
- super(container, binding.jndiBinding());
-
- assert clustered != null : "clustered is null";
-
- this.binding = binding;
- this.clustered = clustered;
- }
-
- protected Class<?>[] getInterfaces()
- {
- // Initialize
- Set<Class<?>> interfaces = new HashSet<Class<?>>();
-
- // Obtain remote and business remote interfaces
- Class<?>[] remoteAndBusinessRemoteInterfaces = ProxyFactoryHelper
- .getRemoteAndBusinessRemoteInterfaces(getContainer());
-
- // Add all remote and business remotes
- for(Class<?> interfaze : remoteAndBusinessRemoteInterfaces)
- {
- interfaces.add(interfaze);
- }
-
- // Add JBossProxy
- interfaces.add( JBossProxy.class);
-
- // Return
- return interfaces.toArray(new Class[]{});
- }
-
- 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
- {
- 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 createProxy()
- {
- Object containerId = getContainer().getObjectName().getCanonicalName();
- String stackName = "ClusteredStatelessSessionClientInterceptors";
- 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));
- return proxy;
- }
-
- protected StatelessHandleImpl createHandle()
- {
- StatelessHandleImpl handle = new StatelessHandleImpl();
- handle.jndiName = binding.jndiBinding();
-
- return handle;
- }
-
- 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);
- }
- }
-}
Copied: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessClusterProxyFactory.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessClusterProxyFactory.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessClusterProxyFactory.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessClusterProxyFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,182 @@
+/*
+ * 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.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.ejb.RemoteHome;
+
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.advice.AdviceStack;
+import org.jboss.aspects.remoting.FamilyWrapper;
+import org.jboss.ejb3.JBossProxy;
+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.SessionContainer;
+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;
+
+
+/**
+ * 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;
+ }
+
+ 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);
+ }
+ }
+
+ @Override
+ String getStackNameInterceptors()
+ {
+ return StatelessClusterProxyFactory.STACK_NAME_CLUSTERED_STATELESS_SESSION_CLIENT_INTERCEPTORS;
+ }
+}
Deleted: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -1,560 +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.util.Hashtable;
-import java.util.Map;
-
-import javax.ejb.*;
-import javax.naming.NamingException;
-
-import org.jboss.aop.Domain;
-import org.jboss.aop.MethodInfo;
-import org.jboss.aop.joinpoint.Invocation;
-import org.jboss.aop.joinpoint.InvocationResponse;
-import org.jboss.aop.joinpoint.MethodInvocation;
-import org.jboss.aspects.asynch.FutureHolder;
-import org.jboss.ejb.AllowedOperationsAssociation;
-import org.jboss.ejb.AllowedOperationsFlags;
-import org.jboss.ejb3.BeanContext;
-import org.jboss.ejb3.BeanContextLifecycleCallback;
-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.Clustered;
-import org.jboss.ejb3.annotation.LocalBinding;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.annotation.RemoteBindings;
-import org.jboss.ejb3.remoting.RemoteProxyFactory;
-import org.jboss.ejb3.session.SessionContainer;
-import org.jboss.ejb3.stateful.BaseStatefulRemoteProxyFactory;
-import org.jboss.ejb3.timerservice.TimedObjectInvoker;
-import org.jboss.ejb3.timerservice.TimerServiceFactory;
-import org.jboss.logging.Logger;
-import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
-import org.jboss.metadata.ejb.spec.NamedMethodMetaData;
-import org.jboss.proxy.ejb.handle.HomeHandleImpl;
-import org.jboss.proxy.ejb.handle.StatelessHandleImpl;
-import org.jboss.wsf.spi.invocation.integration.ServiceEndpointContainer;
-import org.jboss.wsf.spi.invocation.integration.InvocationContextCallback;
-import org.jboss.wsf.spi.invocation.ExtensibleWebServiceContext;
-import org.jboss.wsf.spi.invocation.WebServiceContextFactory;
-import org.jboss.wsf.spi.invocation.InvocationType;
-import org.jboss.wsf.spi.SPIProvider;
-import org.jboss.wsf.spi.SPIProviderResolver;
-import org.jboss.injection.lang.reflect.BeanProperty;
-
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public class StatelessContainer extends SessionContainer
- implements TimedObjectInvoker, ServiceEndpointContainer
-{
- private static final Logger log = Logger.getLogger(StatelessContainer.class);
-
- protected TimerService timerService;
- private Method timeout;
- private StatelessDelegateWrapper mbean = new StatelessDelegateWrapper(this);
-
- public StatelessContainer(ClassLoader cl, String beanClassName, String ejbName, Domain domain,
- Hashtable ctxProperties, Ejb3Deployment deployment, JBossSessionBeanMetaData beanMetaData) throws ClassNotFoundException
- {
- super(cl, beanClassName, ejbName, domain, ctxProperties, deployment, beanMetaData);
-
- initializeTimeout();
- }
-
- @Override
- public BeanContext<?> createBeanContext()
- {
- return new StatelessBeanContext(this, construct());
- }
-
- @Override
- protected ProxyFactory createProxyFactory(LocalBinding binding)
- {
- return new StatelessLocalProxyFactory(this, binding);
- }
-
- @Override
- protected RemoteProxyFactory createProxyFactory(RemoteBinding binding)
- {
- Clustered clustered = getAnnotation(Clustered.class);
- if(clustered != null)
- return new StatelessClusterProxyFactory(this, binding, clustered);
- else
- return new StatelessRemoteProxyFactory(this, binding);
- }
-
- public Object createSession(Class initTypes[], Object initArgs[])
- {
- if((initTypes != null && initTypes.length > 0) || (initArgs != null && initArgs.length > 0))
- throw new IllegalArgumentException("stateless bean create method must take no arguments (EJB3 4.5)");
- // a stateless bean has no sessions
- // TODO: pool stuff
- return null;
- }
-
- public Object getMBean()
- {
- return mbean;
- }
-
- private void initializeTimeout()
- {
- JBossSessionBeanMetaData metaData = getMetaData();
- NamedMethodMetaData timeoutMethodMetaData = null;
- if(metaData != null)
- timeoutMethodMetaData = metaData.getTimeoutMethod();
- this.timeout = getTimeoutCallback(timeoutMethodMetaData, getBeanClass());
- }
-
- public void start() throws Exception
- {
- try
- {
- super.start();
-
- timerService = TimerServiceFactory.getInstance().createTimerService(this, this);
-
- TimerServiceFactory.getInstance().restoreTimerService(timerService);
- }
- catch (Exception e)
- {
- try
- {
- stop();
- }
- catch (Exception ignore)
- {
- log.debug("Failed to cleanup after start() failure", ignore);
- }
- throw e;
- }
- }
-
- public void stop() throws Exception
- {
- if (timerService != null)
- {
- TimerServiceFactory.getInstance().removeTimerService(timerService);
- timerService = null;
- }
-
- super.stop();
- }
-
- public TimerService getTimerService()
- {
- return timerService;
- }
-
- public TimerService getTimerService(Object pKey)
- {
- assert timerService != null : "Timer Service not yet initialized";
- return timerService;
- }
-
- public void callTimeout(Timer timer) throws Exception
- {
- if (timeout == null) throw new EJBException("No method has been annotated with @Timeout");
- Object[] args = {timer};
- ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
- try
- {
- AllowedOperationsAssociation.pushInMethodFlag(AllowedOperationsFlags.IN_EJB_TIMEOUT);
- try
- {
- MethodInfo info = super.getMethodInfo(timeout);
- EJBContainerInvocation nextInvocation = new EJBContainerInvocation(info);
- nextInvocation.setAdvisor(getAdvisor());
- nextInvocation.setArguments(args);
- nextInvocation.invokeNext();
- }
- catch (Throwable throwable)
- {
- if (throwable instanceof Exception) throw (Exception) throwable;
- throw new RuntimeException(throwable);
- }
- finally
- {
- AllowedOperationsAssociation.popInMethodFlag();
- }
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(oldLoader);
- }
- }
-
- /**
- * Performs a synchronous local invocation
- */
- public Object localInvoke(Method method, Object[] args) throws Throwable
- {
- return localInvoke(method, args, null);
- }
-
- /**
- * Performs a synchronous or asynchronous local invocation
- *
- * @param provider If null a synchronous invocation, otherwise an asynchronous
- */
- public Object localInvoke(Method method, Object[] args, FutureHolder provider) throws Throwable
- {
- return localInvoke(method, args, provider, null);
- }
-
- public Object localInvoke(Object id, Method method, Object[] args, FutureHolder provider) throws Throwable
- {
- return localInvoke(method, args, provider);
- }
-
- public Object localInvoke(Method method, Object[] args, FutureHolder provider, BeanContextLifecycleCallback<StatelessBeanContext> callback) throws Throwable
- {
- long start = System.currentTimeMillis();
-
- ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
- try
- {
- MethodInfo info = getMethodInfo(method);
- Method unadvisedMethod = info.getUnadvisedMethod();
-
- try
- {
- invokeStats.callIn();
-
- invokedMethod.push(new InvokedMethod(true, unadvisedMethod));
-
- if (unadvisedMethod != null && isHomeMethod(unadvisedMethod))
- {
- return localHomeInvoke(unadvisedMethod, args);
- }
-
- EJBContainerInvocation<StatelessContainer, StatelessBeanContext> nextInvocation = new EJBContainerInvocation<StatelessContainer, StatelessBeanContext>(info);
- nextInvocation.setAdvisor(getAdvisor());
- nextInvocation.setArguments(args);
- nextInvocation.setContextCallback(callback);
-
- ProxyUtils.addLocalAsynchronousInfo(nextInvocation, provider);
- return nextInvocation.invokeNext();
- }
- finally
- {
- if (unadvisedMethod != null)
- {
- long end = System.currentTimeMillis();
- long elapsed = end - start;
- invokeStats.updateStats(unadvisedMethod, elapsed);
- }
-
- invokeStats.callOut();
-
- invokedMethod.pop();
- }
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(oldLoader);
- }
- }
-
- public InvocationResponse dynamicInvoke(Object target, Invocation invocation) throws Throwable
- {
- long start = System.currentTimeMillis();
-
- ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
- try
- {
- Thread.currentThread().setContextClassLoader(classloader);
- MethodInvocation si = (MethodInvocation) invocation;
- MethodInfo info = getAdvisor().getMethodInfo(si.getMethodHash());
- if (info == null)
- {
- throw new RuntimeException("Could not resolve beanClass method from proxy call " + invocation);
- }
-
- Method unadvisedMethod = info.getUnadvisedMethod();
- try
- {
- invokeStats.callIn();
-
- invokedMethod.push(new InvokedMethod(false, unadvisedMethod));
- Map responseContext = null;
- Object rtn = null;
- if (unadvisedMethod != null && isHomeMethod(unadvisedMethod))
- {
- rtn = invokeHomeMethod(info, si);
- }
- else if (info != null && unadvisedMethod != null && isEJBObjectMethod(unadvisedMethod))
- {
- rtn = invokeEJBObjectMethod(info, si);
- }
- else
- {
-
- EJBContainerInvocation newSi = null;
-
- newSi = new EJBContainerInvocation(info);
- newSi.setArguments(si.getArguments());
- newSi.setMetaData(si.getMetaData());
- newSi.setAdvisor(getAdvisor());
- try
- {
- rtn = newSi.invokeNext();
- responseContext = newSi.getResponseContextInfo();
- }
- catch (Throwable throwable)
- {
- responseContext = newSi.getResponseContextInfo();
- return marshallException(invocation, throwable, responseContext);
- }
- }
-
- InvocationResponse response = marshallResponse(invocation, rtn, responseContext);
- return response;
- }
- finally
- {
- if (unadvisedMethod != null)
- {
- long end = System.currentTimeMillis();
- long elapsed = end - start;
- invokeStats.updateStats(unadvisedMethod, elapsed);
- }
-
- invokeStats.callOut();
-
- invokedMethod.pop();
- }
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(oldLoader);
- }
- }
-
-
- protected Object invokeEJBObjectMethod(MethodInfo info, MethodInvocation invocation) throws Throwable
- {
- Method unadvisedMethod = info.getUnadvisedMethod();
- if (unadvisedMethod.getName().equals("getHandle"))
- {
- StatelessHandleImpl handle = null;
- RemoteBinding remoteBindingAnnotation = (RemoteBinding) resolveAnnotation(RemoteBinding.class);
- if (remoteBindingAnnotation != null)
- handle = new StatelessHandleImpl(remoteBindingAnnotation.jndiBinding());
-
- return handle;
- }
- else if (unadvisedMethod.getName().equals("remove"))
- {
- return null;
- }
- else if (unadvisedMethod.getName().equals("getEJBHome"))
- {
- HomeHandleImpl homeHandle = null;
-
- RemoteBinding remoteBindingAnnotation = (RemoteBinding) resolveAnnotation(RemoteBinding.class);
- if (remoteBindingAnnotation != null)
- homeHandle = new HomeHandleImpl(ProxyFactoryHelper.getHomeJndiName(this));
-
- return homeHandle.getEJBHome();
- }
- else if (unadvisedMethod.getName().equals("getPrimaryKey"))
- {
- return null;
- }
- else if (unadvisedMethod.getName().equals("isIdentical"))
- {
- return false;
- }
- else
- {
- return null;
- }
- }
-
- public Object localHomeInvoke(Method method, Object[] args) throws Throwable
- {
- if (method.getName().equals("create"))
- {
- LocalBinding binding = (LocalBinding) resolveAnnotation(LocalBinding.class);
-
- // FIXME: why this binding? Could be another one. (there is only one local binding, but that's another bug)
-
- StatelessLocalProxyFactory factory = new StatelessLocalProxyFactory(this, binding);
- factory.init();
-
- Object proxy = factory.createProxy();
-
- return proxy;
- }
- else // remove
- {
- return null;
- }
- }
-
- public Object createLocalProxy(Object id, LocalBinding binding) throws Exception
- {
- StatelessLocalProxyFactory factory = new StatelessLocalProxyFactory(this, binding);
- factory.init();
-
- Object proxy = factory.createProxy();
-
- return proxy;
- }
-
- public Object createRemoteProxy(Object id, RemoteBinding binding) throws Exception
- {
-// RemoteBinding binding = null;
-//
-// RemoteBindings bindings = (RemoteBindings) resolveAnnotation(RemoteBindings.class);
-// if (bindings != null)
-// binding = bindings.value()[0];
-// else
-// binding = (RemoteBinding) resolveAnnotation(RemoteBinding.class);
-
- StatelessRemoteProxyFactory factory = new StatelessRemoteProxyFactory(this, binding);
- factory.init();
-
- return factory.createProxy();
- }
-
- protected Object invokeHomeMethod(MethodInfo info, MethodInvocation invocation) throws Throwable
- {
- Method unadvisedMethod = info.getUnadvisedMethod();
- if (unadvisedMethod.getName().equals("create"))
- {
- RemoteBinding binding = null;
-
- RemoteBindings bindings = (RemoteBindings) resolveAnnotation(RemoteBindings.class);
- if (bindings != null)
- binding = bindings.value()[0];
- else
- binding = (RemoteBinding) resolveAnnotation(RemoteBinding.class);
-
- // FIXME: why this binding? Better select the proper one.
-
- StatelessRemoteProxyFactory factory = new StatelessRemoteProxyFactory(this, binding);
- factory.init();
-
- return factory.createProxy();
- }
- else // remove
- {
- return null;
- }
- }
-
- @Override
- public Object getBusinessObject(BeanContext ctx, Class intf)
- {
- assert intf != null : "intf is null";
-
- try
- {
- String jndiName = ProxyFactoryHelper.getJndiName(this, intf);
- if (jndiName == null) throw new IllegalStateException("Cannot find BusinessObject for interface: " + intf.getName());
- return getInitialContext().lookup(ProxyFactoryHelper.getJndiName(this, intf));
- }
- catch (NamingException e)
- {
- throw new RuntimeException("failed to invoke getBusinessObject", e);
- }
- }
-
- protected void removeHandle(Handle handle)
- {
- throw new RuntimeException("NYI");
- }
-
- /**
- * WS integration
- * @return
- */
- public Class getServiceImplementationClass()
- {
- return this.getBeanClass();
- }
-
- /**
- * WS Integration
- * @param method
- * @param args
- * @param invocationContextCallback
- * @return
- * @throws Throwable
- */
- public Object invokeEndpoint(Method method, Object[] args, InvocationContextCallback invocationContextCallback) throws Throwable
- {
- WSCallbackImpl callback = new WSCallbackImpl(invocationContextCallback);
- return this.localInvoke(method, args, null, callback);
- }
-
- static class WSCallbackImpl implements BeanContextLifecycleCallback
- {
- private javax.xml.ws.handler.MessageContext jaxwsMessageContext;
- private javax.xml.rpc.handler.MessageContext jaxrpcMessageContext;
-
- public WSCallbackImpl(InvocationContextCallback epInv)
- {
- jaxrpcMessageContext = epInv.get( javax.xml.rpc.handler.MessageContext.class );
- jaxwsMessageContext = epInv.get( javax.xml.ws.handler.MessageContext.class );
- }
-
- public void attached(BeanContext beanCtx)
- {
- StatelessBeanContext sbc = (StatelessBeanContext)beanCtx;
- sbc.setMessageContextJAXRPC(jaxrpcMessageContext);
-
- BeanProperty beanProp = sbc.getWebServiceContextProperty();
- if (beanProp != null)
- {
- EJBContext ejbCtx = beanCtx.getEJBContext();
- SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
- ExtensibleWebServiceContext wsContext = spiProvider.getSPI(WebServiceContextFactory.class).newWebServiceContext(InvocationType.JAXWS_EJB3, jaxwsMessageContext);
- wsContext.addAttachment(EJBContext.class, ejbCtx);
- beanProp.set(beanCtx.getInstance(), wsContext);
- }
- }
-
- public void released(BeanContext beanCtx)
- {
- StatelessBeanContext sbc = (StatelessBeanContext)beanCtx;
- sbc.setMessageContextJAXRPC(null);
-
- BeanProperty beanProp = sbc.getWebServiceContextProperty();
- if (beanProp != null)
- beanProp.set(beanCtx.getInstance(), null);
- }
- }
-}
Copied: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,578 @@
+/*
+ * 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.util.Hashtable;
+import java.util.Map;
+
+import javax.ejb.EJBContext;
+import javax.ejb.EJBException;
+import javax.ejb.Handle;
+import javax.ejb.Timer;
+import javax.ejb.TimerService;
+import javax.naming.NamingException;
+
+import org.jboss.aop.Domain;
+import org.jboss.aop.MethodInfo;
+import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.aop.joinpoint.InvocationResponse;
+import org.jboss.aop.joinpoint.MethodInvocation;
+import org.jboss.aspects.asynch.FutureHolder;
+import org.jboss.ejb.AllowedOperationsAssociation;
+import org.jboss.ejb.AllowedOperationsFlags;
+import org.jboss.ejb3.BeanContext;
+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.session.SessionSpecContainer;
+import org.jboss.ejb3.timerservice.TimedObjectInvoker;
+import org.jboss.ejb3.timerservice.TimerServiceFactory;
+import org.jboss.injection.lang.reflect.BeanProperty;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+import org.jboss.metadata.ejb.spec.NamedMethodMetaData;
+import org.jboss.proxy.ejb.handle.HomeHandleImpl;
+import org.jboss.proxy.ejb.handle.StatelessHandleImpl;
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.invocation.ExtensibleWebServiceContext;
+import org.jboss.wsf.spi.invocation.InvocationType;
+import org.jboss.wsf.spi.invocation.WebServiceContextFactory;
+import org.jboss.wsf.spi.invocation.integration.InvocationContextCallback;
+import org.jboss.wsf.spi.invocation.integration.ServiceEndpointContainer;
+
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+public class StatelessContainer extends SessionSpecContainer
+ implements TimedObjectInvoker, ServiceEndpointContainer
+{
+ private static final Logger log = Logger.getLogger(StatelessContainer.class);
+
+ protected TimerService timerService;
+ private Method timeout;
+ private StatelessDelegateWrapper mbean = new StatelessDelegateWrapper(this);
+
+ public StatelessContainer(ClassLoader cl, String beanClassName, String ejbName, Domain domain,
+ Hashtable ctxProperties, Ejb3Deployment deployment, JBossSessionBeanMetaData beanMetaData) throws ClassNotFoundException
+ {
+ super(cl, beanClassName, ejbName, domain, ctxProperties, deployment, beanMetaData);
+
+ initializeTimeout();
+ }
+
+ @Override
+ public BeanContext<?> createBeanContext()
+ {
+ return new StatelessBeanContext(this, construct());
+ }
+
+ @Override
+ protected StatelessLocalProxyFactory getProxyFactory(LocalBinding binding)
+ {
+ StatelessLocalProxyFactory factory = (StatelessLocalProxyFactory) this.proxyDeployer.getProxyFactory(binding);
+
+ if (factory == null)
+ {
+ factory = new StatelessLocalProxyFactory(this, binding);
+ try
+ {
+ factory.init();
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ return factory;
+ }
+
+ @Override
+ protected BaseStatelessRemoteProxyFactory getProxyFactory(RemoteBinding binding)
+ {
+ BaseStatelessRemoteProxyFactory factory = (BaseStatelessRemoteProxyFactory) this.proxyDeployer
+ .getProxyFactory(binding);
+
+ if (factory == null)
+ {
+ Clustered clustered = getAnnotation(Clustered.class);
+ if (clustered != null)
+ factory = new StatelessClusterProxyFactory(this, binding, clustered);
+ else
+ factory = new StatelessRemoteProxyFactory(this, binding);
+
+ try
+ {
+ factory.init();
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ return factory;
+ }
+
+ /**
+ * Create a local proxy (EJBLocalObject) for an enterprise bean identified by id, with
+ * the specified LocalBinding
+ *
+ * @param id
+ * @return
+ * @throws Exception
+ */
+ @Override
+ public Object createProxyLocalEjb21(LocalBinding binding) throws Exception
+ {
+ StatelessLocalProxyFactory proxyFactory = this.getProxyFactory(binding);
+ return proxyFactory.createProxyEjb21();
+ }
+
+ @Override
+ public Object createProxyRemoteEjb21(RemoteBinding binding) throws Exception
+ {
+ BaseStatelessRemoteProxyFactory proxyFactory = this.getProxyFactory(binding);
+ return proxyFactory.createProxyEjb21();
+ }
+
+ public Object createSession(Class<?> initTypes[], Object initArgs[])
+ {
+ if((initTypes != null && initTypes.length > 0) || (initArgs != null && initArgs.length > 0))
+ throw new IllegalArgumentException("stateless bean create method must take no arguments (EJB3 4.5)");
+ // a stateless bean has no sessions
+ // TODO: pool stuff
+ return null;
+ }
+
+ public Object getMBean()
+ {
+ return mbean;
+ }
+
+ private void initializeTimeout()
+ {
+ JBossSessionBeanMetaData metaData = getMetaData();
+ NamedMethodMetaData timeoutMethodMetaData = null;
+ if(metaData != null)
+ timeoutMethodMetaData = metaData.getTimeoutMethod();
+ this.timeout = getTimeoutCallback(timeoutMethodMetaData, getBeanClass());
+ }
+
+ public void start() throws Exception
+ {
+ try
+ {
+ super.start();
+
+ timerService = TimerServiceFactory.getInstance().createTimerService(this, this);
+
+ TimerServiceFactory.getInstance().restoreTimerService(timerService);
+ }
+ catch (Exception e)
+ {
+ try
+ {
+ stop();
+ }
+ catch (Exception ignore)
+ {
+ log.debug("Failed to cleanup after start() failure", ignore);
+ }
+ throw e;
+ }
+ }
+
+ public void stop() throws Exception
+ {
+ if (timerService != null)
+ {
+ TimerServiceFactory.getInstance().removeTimerService(timerService);
+ timerService = null;
+ }
+
+ super.stop();
+ }
+
+ public TimerService getTimerService()
+ {
+ return timerService;
+ }
+
+ public TimerService getTimerService(Object pKey)
+ {
+ assert timerService != null : "Timer Service not yet initialized";
+ return timerService;
+ }
+
+ public void callTimeout(Timer timer) throws Exception
+ {
+ if (timeout == null) throw new EJBException("No method has been annotated with @Timeout");
+ Object[] args = {timer};
+ ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ AllowedOperationsAssociation.pushInMethodFlag(AllowedOperationsFlags.IN_EJB_TIMEOUT);
+ try
+ {
+ MethodInfo info = super.getMethodInfo(timeout);
+ EJBContainerInvocation nextInvocation = new EJBContainerInvocation(info);
+ nextInvocation.setAdvisor(getAdvisor());
+ nextInvocation.setArguments(args);
+ nextInvocation.invokeNext();
+ }
+ catch (Throwable throwable)
+ {
+ if (throwable instanceof Exception) throw (Exception) throwable;
+ throw new RuntimeException(throwable);
+ }
+ finally
+ {
+ AllowedOperationsAssociation.popInMethodFlag();
+ }
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(oldLoader);
+ }
+ }
+
+ /**
+ * Performs a synchronous local invocation
+ */
+ public Object localInvoke(Method method, Object[] args) throws Throwable
+ {
+ return localInvoke(method, args, null);
+ }
+
+ /**
+ * Performs a synchronous or asynchronous local invocation
+ *
+ * @param provider If null a synchronous invocation, otherwise an asynchronous
+ */
+ public Object localInvoke(Method method, Object[] args, FutureHolder provider) throws Throwable
+ {
+ return localInvoke(method, args, provider, null);
+ }
+
+ public Object localInvoke(Object id, Method method, Object[] args, FutureHolder provider) throws Throwable
+ {
+ return localInvoke(method, args, provider);
+ }
+
+ public Object localInvoke(Method method, Object[] args, FutureHolder provider, BeanContextLifecycleCallback<StatelessBeanContext> callback) throws Throwable
+ {
+ long start = System.currentTimeMillis();
+
+ ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ MethodInfo info = getMethodInfo(method);
+ Method unadvisedMethod = info.getUnadvisedMethod();
+
+ try
+ {
+ invokeStats.callIn();
+
+ invokedMethod.push(new InvokedMethod(true, unadvisedMethod));
+
+ if (unadvisedMethod != null && isHomeMethod(unadvisedMethod))
+ {
+ return localHomeInvoke(unadvisedMethod, args);
+ }
+
+ EJBContainerInvocation<StatelessContainer, StatelessBeanContext> nextInvocation = new EJBContainerInvocation<StatelessContainer, StatelessBeanContext>(info);
+ nextInvocation.setAdvisor(getAdvisor());
+ nextInvocation.setArguments(args);
+ nextInvocation.setContextCallback(callback);
+
+ ProxyUtils.addLocalAsynchronousInfo(nextInvocation, provider);
+ return nextInvocation.invokeNext();
+ }
+ finally
+ {
+ if (unadvisedMethod != null)
+ {
+ long end = System.currentTimeMillis();
+ long elapsed = end - start;
+ invokeStats.updateStats(unadvisedMethod, elapsed);
+ }
+
+ invokeStats.callOut();
+
+ invokedMethod.pop();
+ }
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(oldLoader);
+ }
+ }
+
+ public InvocationResponse dynamicInvoke(Object target, Invocation invocation) throws Throwable
+ {
+ long start = System.currentTimeMillis();
+
+ ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ Thread.currentThread().setContextClassLoader(classloader);
+ MethodInvocation si = (MethodInvocation) invocation;
+ MethodInfo info = getAdvisor().getMethodInfo(si.getMethodHash());
+ if (info == null)
+ {
+ throw new RuntimeException("Could not resolve beanClass method from proxy call " + invocation);
+ }
+
+ Method unadvisedMethod = info.getUnadvisedMethod();
+ try
+ {
+ invokeStats.callIn();
+
+ invokedMethod.push(new InvokedMethod(false, unadvisedMethod));
+ Map responseContext = null;
+ Object rtn = null;
+ if (unadvisedMethod != null && isHomeMethod(unadvisedMethod))
+ {
+ rtn = invokeHomeMethod(info, si);
+ }
+ else if (info != null && unadvisedMethod != null && isEJBObjectMethod(unadvisedMethod))
+ {
+ rtn = invokeEJBObjectMethod(info, si);
+ }
+ else
+ {
+
+ EJBContainerInvocation newSi = null;
+
+ newSi = new EJBContainerInvocation(info);
+ newSi.setArguments(si.getArguments());
+ newSi.setMetaData(si.getMetaData());
+ newSi.setAdvisor(getAdvisor());
+ try
+ {
+ rtn = newSi.invokeNext();
+ responseContext = newSi.getResponseContextInfo();
+ }
+ catch (Throwable throwable)
+ {
+ responseContext = newSi.getResponseContextInfo();
+ return marshallException(invocation, throwable, responseContext);
+ }
+ }
+
+ InvocationResponse response = marshallResponse(invocation, rtn, responseContext);
+ return response;
+ }
+ finally
+ {
+ if (unadvisedMethod != null)
+ {
+ long end = System.currentTimeMillis();
+ long elapsed = end - start;
+ invokeStats.updateStats(unadvisedMethod, elapsed);
+ }
+
+ invokeStats.callOut();
+
+ invokedMethod.pop();
+ }
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(oldLoader);
+ }
+ }
+
+
+ protected Object invokeEJBObjectMethod(MethodInfo info, MethodInvocation invocation) throws Throwable
+ {
+ Method unadvisedMethod = info.getUnadvisedMethod();
+ if (unadvisedMethod.getName().equals("getHandle"))
+ {
+ StatelessHandleImpl handle = null;
+ RemoteBinding remoteBindingAnnotation = this.getAnnotation(RemoteBinding.class);
+ if (remoteBindingAnnotation != null)
+ handle = new StatelessHandleImpl(remoteBindingAnnotation.jndiBinding());
+
+ return handle;
+ }
+ else if (unadvisedMethod.getName().equals("remove"))
+ {
+ return null;
+ }
+ else if (unadvisedMethod.getName().equals("getEJBHome"))
+ {
+ HomeHandleImpl homeHandle = null;
+
+ RemoteBinding remoteBindingAnnotation = this.getAnnotation(RemoteBinding.class);
+ if (remoteBindingAnnotation != null)
+ homeHandle = new HomeHandleImpl(ProxyFactoryHelper.getHomeJndiName(this));
+
+ return homeHandle.getEJBHome();
+ }
+ else if (unadvisedMethod.getName().equals("getPrimaryKey"))
+ {
+ return null;
+ }
+ else if (unadvisedMethod.getName().equals("isIdentical"))
+ {
+ return false;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ 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();
+
+ return proxy;
+ }
+ else // remove
+ {
+ return null;
+ }
+ }
+
+ protected Object invokeHomeMethod(MethodInfo info, MethodInvocation invocation) throws Throwable
+ {
+ Method unadvisedMethod = info.getUnadvisedMethod();
+ if (unadvisedMethod.getName().equals("create"))
+ {
+ RemoteBinding binding = this.getRemoteBinding();
+
+ BaseStatelessRemoteProxyFactory factory = this.getProxyFactory(binding);
+
+ return factory.createProxyEjb21();
+ }
+ else // remove
+ {
+ return null;
+ }
+ }
+
+ @Override
+ public Object getBusinessObject(BeanContext ctx, Class intf)
+ {
+ assert intf != null : "intf is null";
+
+ try
+ {
+ String jndiName = ProxyFactoryHelper.getJndiName(this, intf);
+ if (jndiName == null) throw new IllegalStateException("Cannot find BusinessObject for interface: " + intf.getName());
+ return getInitialContext().lookup(ProxyFactoryHelper.getJndiName(this, intf));
+ }
+ catch (NamingException e)
+ {
+ throw new RuntimeException("failed to invoke getBusinessObject", e);
+ }
+ }
+
+ protected void removeHandle(Handle handle)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ /**
+ * WS integration
+ * @return
+ */
+ public Class getServiceImplementationClass()
+ {
+ return this.getBeanClass();
+ }
+
+ /**
+ * WS Integration
+ * @param method
+ * @param args
+ * @param invocationContextCallback
+ * @return
+ * @throws Throwable
+ */
+ public Object invokeEndpoint(Method method, Object[] args, InvocationContextCallback invocationContextCallback) throws Throwable
+ {
+ WSCallbackImpl callback = new WSCallbackImpl(invocationContextCallback);
+ return this.localInvoke(method, args, null, callback);
+ }
+
+ static class WSCallbackImpl implements BeanContextLifecycleCallback
+ {
+ private javax.xml.ws.handler.MessageContext jaxwsMessageContext;
+ private javax.xml.rpc.handler.MessageContext jaxrpcMessageContext;
+
+ public WSCallbackImpl(InvocationContextCallback epInv)
+ {
+ jaxrpcMessageContext = epInv.get( javax.xml.rpc.handler.MessageContext.class );
+ jaxwsMessageContext = epInv.get( javax.xml.ws.handler.MessageContext.class );
+ }
+
+ public void attached(BeanContext beanCtx)
+ {
+ StatelessBeanContext sbc = (StatelessBeanContext)beanCtx;
+ sbc.setMessageContextJAXRPC(jaxrpcMessageContext);
+
+ BeanProperty beanProp = sbc.getWebServiceContextProperty();
+ if (beanProp != null)
+ {
+ EJBContext ejbCtx = beanCtx.getEJBContext();
+ SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
+ ExtensibleWebServiceContext wsContext = spiProvider.getSPI(WebServiceContextFactory.class).newWebServiceContext(InvocationType.JAXWS_EJB3, jaxwsMessageContext);
+ wsContext.addAttachment(EJBContext.class, ejbCtx);
+ beanProp.set(beanCtx.getInstance(), wsContext);
+ }
+ }
+
+ public void released(BeanContext beanCtx)
+ {
+ StatelessBeanContext sbc = (StatelessBeanContext)beanCtx;
+ sbc.setMessageContextJAXRPC(null);
+
+ BeanProperty beanProp = sbc.getWebServiceContextProperty();
+ if (beanProp != null)
+ beanProp.set(beanCtx.getInstance(), null);
+ }
+ }
+}
Deleted: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessHandleImpl.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessHandleImpl.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessHandleImpl.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -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.stateless;
-
-import java.rmi.RemoteException;
-import java.rmi.ServerException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.io.ObjectStreamField;
-import java.io.ObjectInputStream;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-import java.util.Hashtable;
-
-import javax.naming.InitialContext;
-import javax.ejb.Handle;
-import javax.ejb.EJBObject;
-import javax.ejb.EJBHome;
-
-import org.jboss.ejb3.InitialContextFactory;
-import org.jboss.naming.NamingContextFactory;
-
-/**
- * An EJB stateless session bean handle.
- *
- * @author <a href="mailto:marc.fleury at jboss.org">Marc Fleury</a>
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class StatelessHandleImpl
- implements Handle
-{
- /** Serial Version Identifier. */
- static final long serialVersionUID = 3811452873535097661L;
- 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 */
- public String jndiName;
- /** The JNDI env in effect when the home handle was created */
- private Hashtable jndiEnv;
-
- // Constructors --------------------------------------------------
-
- public StatelessHandleImpl()
- {
-
- }
-
- /**
- * Construct a <tt>StatelessHandleImpl</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 StatelessHandleImpl(String jndiName)
- {
- this.jndiName = jndiName;
- this.jndiEnv = (Hashtable) NamingContextFactory.lastInitialContextEnv.get();
- }
-
- // Public --------------------------------------------------------
-
- public EJBObject getEJBObject() throws RemoteException
- {
- try
- {
- InitialContext ic = InitialContextFactory.getInitialContext(jndiEnv);
-
- Proxy proxy = (Proxy) ic.lookup(jndiName);
-
- return (EJBObject) proxy;
- }
- catch (Throwable t)
- {
- t.printStackTrace();
- throw new RemoteException("Error during getEJBObject", t);
- }
- }
-
- /**
- * @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/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessHandleRemoteImpl.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessHandleRemoteImpl.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessHandleRemoteImpl.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessHandleRemoteImpl.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,70 @@
+/*
+ * 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.rmi.RemoteException;
+
+import javax.ejb.EJBObject;
+import javax.ejb.Handle;
+
+/**
+ * An EJB stateless session bean handle.
+ *
+ * @author <a href="mailto:marc.fleury at jboss.org">Marc Fleury</a>
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class StatelessHandleRemoteImpl
+ implements Handle
+{
+ /** Serial Version Identifier. */
+ static final long serialVersionUID = 3811452873535097661L;
+
+ private EJBObject proxy;
+
+ // Constructors --------------------------------------------------
+
+ public StatelessHandleRemoteImpl()
+ {
+
+ }
+
+ /**
+ * Construct a <tt>StatelessHandleImpl</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 StatelessHandleRemoteImpl(EJBObject proxy)
+ {
+ this.proxy = proxy;
+ }
+
+ // Public --------------------------------------------------------
+
+ public EJBObject getEJBObject() throws RemoteException
+ {
+ return this.proxy;
+ }
+}
Deleted: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessLocalProxyFactory.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessLocalProxyFactory.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessLocalProxyFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -1,173 +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.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.ejb.LocalHome;
-
-import org.jboss.ejb3.EJBContainer;
-import org.jboss.ejb3.JBossProxy;
-import org.jboss.ejb3.ProxyFactoryHelper;
-import org.jboss.ejb3.annotation.LocalBinding;
-import org.jboss.ejb3.session.SessionContainer;
-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(SessionContainer container, LocalBinding binding)
- {
- super(container, binding.jndiBinding());
- }
-
- protected Class<?>[] getInterfaces()
- {
- EJBContainer statelessContainer = this.getContainer();
- LocalHome localHome = statelessContainer.getAnnotation(LocalHome.class);
-
- boolean bindTogether = false;
-
- if (localHome != null && bindHomeAndBusinessTogether(statelessContainer))
- bindTogether = true;
-
- // Obtain all local interfaces
- Set<Class<?>> localInterfaces = new HashSet<Class<?>>();
- localInterfaces.addAll(Arrays.asList(ProxyFactoryHelper.getLocalAndBusinessLocalInterfaces(getContainer())));
-
- // Ensure local interfaces defined
- if (localInterfaces.size() > 0)
- {
- // Add JBossProxy
- localInterfaces.add(JBossProxy.class);
-
- // If binding along w/ home, add home
- if (bindTogether)
- {
- localInterfaces.add(localHome.value());
- }
- }
- else
- {
- // No remote interfaces defined, log warning
- log.warn("[EJBTHREE-933] NPE when deploying web service beans");
- }
-
- // Return
- return localInterfaces.toArray(new Class<?>[]
- {});
- }
-
- 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));
- }
-
- protected boolean bindHomeAndBusinessTogether(EJBContainer container)
- {
- return ProxyFactoryHelper.getLocalHomeJndiName(container).equals(jndiName);
- }
-
- @Override
- public void start() throws Exception
- {
- super.start();
- EJBContainer statelessContainer = (EJBContainer) getContainer();
- LocalHome localHome = (LocalHome) statelessContainer.resolveAnnotation(LocalHome.class);
- if (localHome != null && !bindHomeAndBusinessTogether(statelessContainer))
- {
- 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();
- EJBContainer statelessContainer = (EJBContainer) getContainer();
- LocalHome localHome = (LocalHome) statelessContainer.resolveAnnotation(LocalHome.class);
- if (localHome != null && !bindHomeAndBusinessTogether(statelessContainer))
- {
- Util.unbind(getContainer().getInitialContext(), ProxyFactoryHelper.getLocalHomeJndiName(getContainer()));
- }
- }
-
-
- public Object createProxy()
- {
- /*
- try
- {
- Object[] args = {new StatelessLocalProxy(container)};
- return proxyConstructor.newInstance(args);
- }
- catch (InstantiationException e)
- {
- throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
- }
- catch (IllegalAccessException e)
- {
- throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
- }
- catch (IllegalArgumentException e)
- {
- throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
- }
- catch (InvocationTargetException e)
- {
- throw new RuntimeException(e.getTargetException()); //To change body of catch statement use Options | File Templates.
- }
- */
- return constructProxy(new StatelessLocalProxy(getContainer()));
- }
-
- protected StatelessHandleImpl createHandle()
- {
- StatelessHandleImpl handle = new StatelessHandleImpl();
- LocalBinding remoteBinding = (LocalBinding) getContainer().resolveAnnotation(LocalBinding.class);
- if (remoteBinding != null)
- handle.jndiName = remoteBinding.jndiBinding();
-
- return handle;
- }
-
-}
Copied: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessLocalProxyFactory.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessLocalProxyFactory.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessLocalProxyFactory.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessLocalProxyFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,129 @@
+/*
+ * 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());
+ }
+
+ @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));
+ }
+
+ protected boolean bindHomeAndBusinessTogether(EJBContainer container)
+ {
+ return ProxyFactoryHelper.getLocalHomeJndiName(container).equals(jndiName);
+ }
+
+ @Override
+ public void start() throws Exception
+ {
+ super.start();
+ EJBContainer statelessContainer = (EJBContainer) getContainer();
+ LocalHome localHome = statelessContainer.getAnnotation(LocalHome.class);
+ if (localHome != null && !bindHomeAndBusinessTogether(statelessContainer))
+ {
+ 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(statelessContainer))
+ {
+ 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/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessRemoteProxyFactory.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessRemoteProxyFactory.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessRemoteProxyFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -1,207 +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.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.ejb.RemoteHome;
-import javax.naming.NamingException;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.aop.advice.AdviceStack;
-import org.jboss.ejb3.EJBContainer;
-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.ejb3.session.SessionContainer;
-import org.jboss.logging.Logger;
-import org.jboss.util.naming.Util;
-import org.jboss.remoting.InvokerLocator;
-
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public class StatelessRemoteProxyFactory extends BaseStatelessProxyFactory implements RemoteProxyFactory
-{
- private static final Logger log = Logger.getLogger(StatelessRemoteProxyFactory.class);
-
- protected RemoteBinding binding;
- protected InvokerLocator locator;
-
- public StatelessRemoteProxyFactory(SessionContainer container, RemoteBinding binding)
- {
- super(container, binding.jndiBinding());
-
- this.binding = binding;
- }
-
- protected Class<?>[] getInterfaces()
- {
- SessionContainer container = this.getContainer();
- RemoteHome remoteHome = container.getAnnotation(RemoteHome.class);
-
- boolean bindTogether = false;
-
- if (remoteHome != null && bindHomeAndBusinessTogether(container))
- bindTogether = true;
-
- // Obtain all remote interfaces
- Set<Class<?>> remoteInterfaces = new HashSet<Class<?>>();
- remoteInterfaces.addAll(Arrays.asList(ProxyFactoryHelper.getRemoteAndBusinessRemoteInterfaces(getContainer())));
-
- // Ensure remote interfaces defined
- if (remoteInterfaces.size() > 0)
- {
- // Add JBossProxy
- remoteInterfaces.add(JBossProxy.class);
-
- // If binding along w/ home, add home
- if (bindTogether)
- {
- remoteInterfaces.add(remoteHome.value());
- }
- }
- else
- {
- // No remote interfaces defined, log warning
- log.warn("[EJBTHREE-933] NPE when deploying web service beans");
- }
-
- // Return
- return remoteInterfaces.toArray(new Class<?>[]
- {});
- }
-
- protected void validateEjb21Views()
- {
- // Obtain Container
- EJBContainer 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));
- }
-
- protected boolean bindHomeAndBusinessTogether(EJBContainer container)
- {
- return ProxyFactoryHelper.getHomeJndiName(container).equals(ProxyFactoryHelper.getRemoteBusinessJndiName(container));
- }
-
- public void init() throws Exception
- {
- super.init();
- String clientBindUrl = ProxyFactoryHelper.getClientBindUrl(binding);
- locator = new InvokerLocator(clientBindUrl);
- }
-
- public void start() throws Exception
- {
- super.start();
- EJBContainer statelessContainer = (EJBContainer) getContainer();
- RemoteHome remoteHome = (RemoteHome) statelessContainer.resolveAnnotation(RemoteHome.class);
- if (remoteHome != null && !bindHomeAndBusinessTogether(statelessContainer))
- {
- 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();
- EJBContainer statelessContainer = (EJBContainer) getContainer();
- RemoteHome remoteHome = (RemoteHome) statelessContainer.resolveAnnotation(RemoteHome.class);
- if (remoteHome != null && !bindHomeAndBusinessTogether(statelessContainer))
- {
- Util.unbind(getContainer().getInitialContext(), ProxyFactoryHelper.getHomeJndiName(getContainer()));
- }
- }
-
- protected StatelessHandleImpl createHandle()
- {
- StatelessHandleImpl handle = new StatelessHandleImpl();
- RemoteBinding remoteBinding = (RemoteBinding) getContainer().resolveAnnotation(RemoteBinding.class);
- if (remoteBinding != null)
- handle.jndiName = remoteBinding.jndiBinding() ;
-
- return handle;
- }
-
- public Object createHomeProxy(Class homeInterface)
- {
- try
- {
- String stackName = "StatelessSessionClientInterceptors";
- 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); //To change body of catch statement use Options | File Templates.
- }
- }
-
- public Object createProxy()
- {
- String stackName = "StatelessSessionClientInterceptors";
- 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);
- return constructProxy(proxy);
- }
-
-}
Copied: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessRemoteProxyFactory.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessRemoteProxyFactory.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessRemoteProxyFactory.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateless/StatelessRemoteProxyFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,129 @@
+/*
+ * 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);
+ }
+
+ protected boolean bindHomeAndBusinessTogether(SessionSpecContainer container)
+ {
+ 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 && !bindHomeAndBusinessTogether(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 && !bindHomeAndBusinessTogether(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);
+ }
+ }
+
+ @Override
+ String getStackNameInterceptors()
+ {
+ return StatelessRemoteProxyFactory.STACK_NAME_STATELESS_SESSION_CLIENT_INTERCEPTORS;
+ }
+
+}
Modified: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/util/Debugger.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/ejb3/util/Debugger.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/util/Debugger.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -25,7 +25,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class Debugger
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/injection/InjectorFactory.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/main/java/org/jboss/injection/InjectorFactory.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/injection/InjectorFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -27,7 +27,7 @@
* Allows the creation of injectors.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public interface InjectorFactory<I extends Injector>
{
Deleted: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/bank/TellerRemoteProxyFactory.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/bank/TellerRemoteProxyFactory.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/bank/TellerRemoteProxyFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -1,54 +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.test.bank;
-
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.session.SessionContainer;
-import org.jboss.logging.Logger;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- * @version $Revision$
- */
-public class TellerRemoteProxyFactory extends org.jboss.ejb3.stateless.StatelessRemoteProxyFactory
-{
- private static final Logger log = Logger.getLogger(TellerRemoteProxyFactory.class);
-
- public TellerRemoteProxyFactory(SessionContainer container, RemoteBinding binding)
- {
- super(container, binding);
- }
-
- protected Class[] getInterfaces()
- {
- Class[] remoteInterfaces = super.getInterfaces();
-
- Class[] interfaces = new Class[remoteInterfaces.length + 1];
-
- System.arraycopy(remoteInterfaces, 0, interfaces, 0, remoteInterfaces.length);
- interfaces[remoteInterfaces.length] = org.jboss.ejb3.test.bank.ProxyFactoryInterface.class;
-
- return interfaces;
- }
-}
Copied: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/bank/TellerRemoteProxyFactory.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/bank/TellerRemoteProxyFactory.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/bank/TellerRemoteProxyFactory.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/bank/TellerRemoteProxyFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,42 @@
+/*
+ * 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.test.bank;
+
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.session.SessionSpecContainer;
+import org.jboss.logging.Logger;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ * @version $Revision$
+ */
+public class TellerRemoteProxyFactory extends org.jboss.ejb3.stateless.StatelessRemoteProxyFactory
+{
+ private static final Logger log = Logger.getLogger(TellerRemoteProxyFactory.class);
+
+ public TellerRemoteProxyFactory(SessionSpecContainer container, RemoteBinding binding)
+ {
+ super(container, binding);
+ }
+}
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1025/OrderService.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1025/OrderService.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1025/OrderService.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -25,7 +25,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public interface OrderService
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1025/OrderServiceBean.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1025/OrderServiceBean.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1025/OrderServiceBean.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -29,7 +29,7 @@
* This is an illegal construct.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@Stateless
@Local
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1060/CommonRemote.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1060/CommonRemote.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1060/CommonRemote.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -25,7 +25,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public interface CommonRemote
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1060/InvokedBusinessInterfaceBean.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1060/InvokedBusinessInterfaceBean.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1060/InvokedBusinessInterfaceBean.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -30,7 +30,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@Stateless
@Remote({Remote1.class, Remote2.class})
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1060/Remote1.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1060/Remote1.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1060/Remote1.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -25,7 +25,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public interface Remote1 extends CommonRemote
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1060/Remote2.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1060/Remote2.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1060/Remote2.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -25,7 +25,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public interface Remote2 extends CommonRemote
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1060/TestFailedException.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1060/TestFailedException.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1060/TestFailedException.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -25,7 +25,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class TestFailedException extends Exception
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1060/Tester.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1060/Tester.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1060/Tester.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -27,7 +27,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@Remote
public interface Tester
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1060/TesterBean.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1060/TesterBean.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1060/TesterBean.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -30,7 +30,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@Stateless
public class TesterBean implements Tester
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1060/unit/InvokedBusinessInterfaceUnitTestCase.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1060/unit/InvokedBusinessInterfaceUnitTestCase.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1060/unit/InvokedBusinessInterfaceUnitTestCase.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -31,7 +31,7 @@
* Test to see if the proper invoked business interface is returned.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class InvokedBusinessInterfaceUnitTestCase extends JBossTestCase
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1062/Calculator.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1062/Calculator.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1062/Calculator.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -25,7 +25,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public interface Calculator extends SuperInterface
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1062/CalculatorBean.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1062/CalculatorBean.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1062/CalculatorBean.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -30,7 +30,7 @@
* in effect the calculator bean only implements the calculator interface.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@Stateless
@Local
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1062/CommonBase.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1062/CommonBase.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1062/CommonBase.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -25,7 +25,7 @@
* A common base for beans that implements an interface.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public abstract class CommonBase implements CommonInterface
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1062/CommonInterface.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1062/CommonInterface.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1062/CommonInterface.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -25,7 +25,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public interface CommonInterface
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1062/MyStatelessBean.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1062/MyStatelessBean.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1062/MyStatelessBean.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -30,7 +30,7 @@
* But it extends a common base which also implements an interface.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@Stateless
public class MyStatelessBean extends CommonBase implements MyStatelessLocal
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1062/MyStatelessLocal.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1062/MyStatelessLocal.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1062/MyStatelessLocal.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -25,7 +25,7 @@
* This business interface should not be annotated.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public interface MyStatelessLocal
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1062/SuperBean.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1062/SuperBean.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1062/SuperBean.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -25,7 +25,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public abstract class SuperBean implements SuperInterface
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1062/SuperInterface.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1062/SuperInterface.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1062/SuperInterface.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -25,7 +25,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public interface SuperInterface
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1066/Adder.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1066/Adder.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1066/Adder.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -25,7 +25,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public interface Adder
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1066/CalculatorBean.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1066/CalculatorBean.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1066/CalculatorBean.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -28,7 +28,7 @@
* - Subtractor
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class CalculatorBean implements Adder, Subtractor
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1066/Subtractor.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1066/Subtractor.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1066/Subtractor.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -25,7 +25,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public interface Subtractor
{
Deleted: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1122/unit/MultipleDefinitionsOfSameBusinessInterfaceUnitTestCase.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1122/unit/MultipleDefinitionsOfSameBusinessInterfaceUnitTestCase.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1122/unit/MultipleDefinitionsOfSameBusinessInterfaceUnitTestCase.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -1,164 +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.test.ejbthree1122.unit;
-
-import junit.framework.Test;
-
-import org.jboss.ejb3.test.ejbthree1122.TestRemoteBusinessInterface;
-import org.jboss.test.JBossTestCase;
-
-/**
- * Tests to ensure that a bean with the same @Remote business interface
- * defined multiple times (both explicitly and via inheritance)
- * deploys successfully
- *
- * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
- * @version $Revision: $
- */
-public class MultipleDefinitionsOfSameBusinessInterfaceUnitTestCase extends JBossTestCase
-{
- // Constructor
- public MultipleDefinitionsOfSameBusinessInterfaceUnitTestCase(String name)
- {
- super(name);
- }
-
- // Suite
- public static Test suite() throws Exception
- {
- return getDeploySetup(MultipleDefinitionsOfSameBusinessInterfaceUnitTestCase.class, "ejbthree1122.jar");
- }
-
- // Tests
-
- /**
- * Test the Stateless Remote EJB
- */
- public void testTestStatelessRemoteEjb() throws Exception
- {
- this.internalTestRemoteView(TestRemoteBusinessInterface.JNDI_NAME_STATELESS_REMOTE);
- }
-
- /**
- * Test the Stateless Local EJB
- */
- public void testTestStatelessLocalEjb() throws Exception
- {
- this.internalTestLocalView(TestRemoteBusinessInterface.JNDI_NAME_STATELESS_REMOTE);
- }
-
- /**
- * Test the Service Remote EJB
- */
- public void testTestServiceRemoteEjb() throws Exception
- {
- this.internalTestRemoteView(TestRemoteBusinessInterface.JNDI_NAME_SERVICE_REMOTE);
- }
-
- /**
- * Test the Service Local EJB
- */
- public void testTestServiceLocalEjb() throws Exception
- {
- this.internalTestLocalView(TestRemoteBusinessInterface.JNDI_NAME_SERVICE_REMOTE);
- }
-
- /**
- * Test the Stateful Remote EJB
- */
- public void testTestStatefulRemoteEjb() throws Exception
- {
- this.internalTestRemoteView(TestRemoteBusinessInterface.JNDI_NAME_STATEFUL_REMOTE);
- }
-
- /**
- * Test the Stateful Local EJB
- */
- public void testTestStatefulLocalEjb() throws Exception
- {
- this.internalTestLocalView(TestRemoteBusinessInterface.JNDI_NAME_STATEFUL_REMOTE);
- }
-
- // Internal Helper Methods
-
- private void internalTestRemoteView(String jndiName)
- {
- // Initialize
- TestRemoteBusinessInterface test = null;
-
- // Lookup
- try
- {
- test = (TestRemoteBusinessInterface) this.getInitialContext().lookup(
- jndiName);
- }
- catch (Throwable t)
- {
- log.error(t);
- JBossTestCase.fail(t.getMessage());
- }
- // Ensure lookup succeeds; bean is deployed
- JBossTestCase.assertNotNull(test);
-
- // Invoke
- try
- {
- test.test();
- }
- catch (Throwable t)
- {
- log.error(t);
- JBossTestCase.fail("Invocation failed: " + t.getMessage());
- }
- }
-
- private void internalTestLocalView(String remoteDelegateJndiName)
- {
- // Initialize
- TestRemoteBusinessInterface test = null;
-
- // Lookup
- try
- {
- test = (TestRemoteBusinessInterface) this.getInitialContext().lookup(remoteDelegateJndiName);
- }
- catch (Throwable t)
- {
- log.error(t);
- JBossTestCase.fail(t.getMessage());
- }
- // Ensure lookup succeeds; bean is deployed
- JBossTestCase.assertNotNull(test);
-
- // Invoke on local
- try
- {
- test.testLocal();
- }
- catch (Throwable t)
- {
- log.error(t);
- JBossTestCase.fail("Invocation failed: " + t.getMessage());
- }
- }
-
-}
Copied: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1122/unit/MultipleDefinitionsOfSameBusinessInterfaceUnitTestCase.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1122/unit/MultipleDefinitionsOfSameBusinessInterfaceUnitTestCase.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1122/unit/MultipleDefinitionsOfSameBusinessInterfaceUnitTestCase.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree1122/unit/MultipleDefinitionsOfSameBusinessInterfaceUnitTestCase.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,149 @@
+/*
+ * 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.test.ejbthree1122.unit;
+
+import junit.framework.Test;
+
+import org.jboss.ejb3.test.ejbthree1122.TestRemoteBusinessInterface;
+import org.jboss.test.JBossTestCase;
+
+/**
+ * Tests to ensure that a bean with the same @Remote business interface
+ * defined multiple times (both explicitly and via inheritance)
+ * deploys successfully
+ *
+ * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
+ * @version $Revision: $
+ */
+public class MultipleDefinitionsOfSameBusinessInterfaceUnitTestCase extends JBossTestCase
+{
+ // Constructor
+ public MultipleDefinitionsOfSameBusinessInterfaceUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ // Suite
+ public static Test suite() throws Exception
+ {
+ return getDeploySetup(MultipleDefinitionsOfSameBusinessInterfaceUnitTestCase.class, "ejbthree1122.jar");
+ }
+
+ // Tests
+
+ /**
+ * Test the Stateless Remote EJB
+ */
+ public void testTestStatelessRemoteEjb() throws Exception
+ {
+ this.internalTestRemoteView(TestRemoteBusinessInterface.JNDI_NAME_STATELESS_REMOTE);
+ }
+
+ /**
+ * Test the Stateless Local EJB
+ */
+ public void testTestStatelessLocalEjb() throws Exception
+ {
+ this.internalTestLocalView(TestRemoteBusinessInterface.JNDI_NAME_STATELESS_REMOTE);
+ }
+
+ /**
+ * Test the Service Remote EJB
+ */
+ public void testTestServiceRemoteEjb() throws Exception
+ {
+ this.internalTestRemoteView(TestRemoteBusinessInterface.JNDI_NAME_SERVICE_REMOTE);
+ }
+
+ /**
+ * Test the Service Local EJB
+ */
+ public void testTestServiceLocalEjb() throws Exception
+ {
+ this.internalTestLocalView(TestRemoteBusinessInterface.JNDI_NAME_SERVICE_REMOTE);
+ }
+
+ /**
+ * Test the Stateful Remote EJB
+ */
+ public void testTestStatefulRemoteEjb() throws Exception
+ {
+ this.internalTestRemoteView(TestRemoteBusinessInterface.JNDI_NAME_STATEFUL_REMOTE);
+ }
+
+ /**
+ * Test the Stateful Local EJB
+ */
+ public void testTestStatefulLocalEjb() throws Exception
+ {
+ this.internalTestLocalView(TestRemoteBusinessInterface.JNDI_NAME_STATEFUL_REMOTE);
+ }
+
+ // Internal Helper Methods
+
+ private void internalTestRemoteView(String jndiName) throws Exception
+ {
+ // Initialize
+ TestRemoteBusinessInterface test = null;
+
+ // Lookup
+ test = (TestRemoteBusinessInterface) this.getInitialContext().lookup(jndiName);
+
+ // Ensure lookup succeeds; bean is deployed
+ JBossTestCase.assertNotNull(test);
+
+ // Invoke
+ try
+ {
+ test.test();
+ }
+ catch (Throwable t)
+ {
+ log.error(t);
+ JBossTestCase.fail("Invocation failed: " + t.getMessage());
+ }
+ }
+
+ private void internalTestLocalView(String remoteDelegateJndiName) throws Exception
+ {
+ // Initialize
+ TestRemoteBusinessInterface test = null;
+
+ // Lookup
+ test = (TestRemoteBusinessInterface) this.getInitialContext().lookup(remoteDelegateJndiName);
+
+ // Ensure lookup succeeds; bean is deployed
+ JBossTestCase.assertNotNull(test);
+
+ // Invoke on local
+ try
+ {
+ test.testLocal();
+ }
+ catch (Throwable t)
+ {
+ log.error(t);
+ JBossTestCase.fail("Invocation failed: " + t.getMessage());
+ }
+ }
+
+}
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree471/A.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree471/A.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree471/A.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -23,7 +23,7 @@
/**
* @author <a href="mailto:amay at ingenta.com">Andrew May</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public interface A
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree471/ABean.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree471/ABean.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree471/ABean.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -23,7 +23,7 @@
/**
* @author <a href="mailto:amay at ingenta.com">Andrew May</a>
- * @version $Revision: $
+ * @version $Revision$
*/
abstract public class ABean implements A
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree471/B.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree471/B.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree471/B.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -23,7 +23,7 @@
/**
* @author <a href="mailto:amay at ingenta.com">Andrew May</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public interface B extends A
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree471/BBean.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree471/BBean.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree471/BBean.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -27,7 +27,7 @@
/**
* @author <a href="mailto:amay at ingenta.com">Andrew May</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@Stateless
@Remote(B.class)
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree471/Client.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree471/Client.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree471/Client.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -28,7 +28,7 @@
/**
* @author <a href="mailto:amay at ingenta.com">Andrew May</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class Client
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree471/Intercept.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree471/Intercept.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree471/Intercept.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -26,7 +26,7 @@
/**
* @author <a href="mailto:amay at ingenta.com">Andrew May</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class Intercept
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree471/unit/SuperInterceptUnitTestCase.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree471/unit/SuperInterceptUnitTestCase.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree471/unit/SuperInterceptUnitTestCase.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -30,7 +30,7 @@
* Interceptor must also apply to super-methods.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class SuperInterceptUnitTestCase extends JBossTestCase
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree786/Remove.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree786/Remove.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree786/Remove.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -26,7 +26,7 @@
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
* @author <a href="mailto:arubinge at redhat.com">ALR</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public interface Remove
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree959/Status.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree959/Status.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree959/Status.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -27,7 +27,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@Remote
public interface Status
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree959/StatusBean.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree959/StatusBean.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree959/StatusBean.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -27,7 +27,7 @@
* Dirty bean to check status of MyStatefulBean
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@Stateless
public class StatusBean implements Status
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree973/SpyMe.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree973/SpyMe.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree973/SpyMe.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -25,7 +25,7 @@
* Allows for some security checks.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public interface SpyMe extends WhoAmI
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree973/WhoAmI.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree973/WhoAmI.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree973/WhoAmI.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -25,7 +25,7 @@
* Report the caller principal.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public interface WhoAmI
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree985/OptionalEnvEntry.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree985/OptionalEnvEntry.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree985/OptionalEnvEntry.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -25,7 +25,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public interface OptionalEnvEntry
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree985/OptionalEnvEntryBean.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree985/OptionalEnvEntryBean.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree985/OptionalEnvEntryBean.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -31,7 +31,7 @@
* Return the value of a burried env entry.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@Stateless
@Remote(OptionalEnvEntry.class)
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree986/Foo.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree986/Foo.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree986/Foo.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -28,7 +28,7 @@
*
* @author <a href="mailto:yvan.borgne at lapeyre.fr">Yvan Borgne</a>
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@Remote
public interface Foo
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree986/FooBean.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree986/FooBean.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree986/FooBean.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -28,7 +28,7 @@
*
* @author <a href="mailto:yvan.borgne at lapeyre.fr">Yvan Borgne</a>
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@Stateless
public class FooBean implements Foo
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree989/ResUrlChecker.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree989/ResUrlChecker.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree989/ResUrlChecker.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -27,7 +27,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public interface ResUrlChecker
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree989/ResUrlCheckerBean.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree989/ResUrlCheckerBean.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/ejbthree989/ResUrlCheckerBean.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -34,7 +34,7 @@
* Let's see what we can do with resources of the URL breed.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@Stateless
@Remote(ResUrlChecker.class)
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/interceptormetadata/MockDependencyPolicy.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/interceptormetadata/MockDependencyPolicy.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/interceptormetadata/MockDependencyPolicy.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -27,7 +27,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class MockDependencyPolicy implements DependencyPolicy
{
Deleted: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/reference21_30/HomedStatefulSession30Bean.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/reference21_30/HomedStatefulSession30Bean.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/reference21_30/HomedStatefulSession30Bean.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -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.test.reference21_30;
-
-import javax.annotation.PreDestroy;
-import javax.ejb.Init;
-import javax.ejb.Local;
-import javax.ejb.LocalHome;
-import javax.ejb.Remote;
-import javax.ejb.RemoteHome;
-import javax.ejb.Stateful;
-import javax.naming.InitialContext;
-
-import org.jboss.ejb3.annotation.LocalBinding;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.logging.Logger;
-
-/**
- * @version <tt>$Revision$</tt>
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- */
- at Stateful(name="HomedStatefulSession30")
- at RemoteHome(StatefulSession30Home.class)
- at LocalHome(StatefulSession30LocalHome.class)
- at Local({LocalStatefulSession30Business.class,LocalStatefulSession30.class})
- at Remote(StatefulSession30.class)
- at RemoteBinding(jndiBinding = "HomedStatefulSession30Remote")
- at LocalBinding(jndiBinding = "HomedLocalStatefulSession30")
-public class HomedStatefulSession30Bean implements java.io.Serializable
-{
-
- private static final long serialVersionUID = -1013103935052726415L;
-
- private static final Logger log = Logger.getLogger(HomedStatefulSession30Bean.class);
-
- private String value = null;
-
- public void setValue(String value)
- {
- this.value = value;
- }
-
- public String getValue()
- {
- return value;
- }
-
- public void setLocalValue(String value)
- {
- this.value = value;
- }
-
- public String getLocalValue()
- {
- return value;
- }
-
- public String accessLocalStateless()
- {
- try {
- InitialContext jndiContext = new InitialContext();
- Session30LocalHome localHome = (Session30LocalHome)jndiContext.lookup("LocalSession30");
- LocalSession30 localSession = localHome.create();
- return localSession.access();
- } catch (Exception e)
- {
- e.printStackTrace();
- return null;
- }
- }
-
- @Init
- public void ejbCreate()
- {
- value="default";
- }
-
- @Init
- public void ejbCreate(String value)
- {
- this.value=value;
- }
-
- @Init
- public void ejbCreate(String value, Integer suffix)
- {
- this.value=value + suffix;
- }
-
- @PreDestroy
- public void preDestroy()
- {
- log.info("Invoking PreDestroy");
- }
-}
Copied: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/reference21_30/HomedStatefulSession30Bean.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/reference21_30/HomedStatefulSession30Bean.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/reference21_30/HomedStatefulSession30Bean.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/reference21_30/HomedStatefulSession30Bean.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,110 @@
+/*
+ * 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.test.reference21_30;
+
+import javax.annotation.PreDestroy;
+import javax.ejb.Init;
+import javax.ejb.Local;
+import javax.ejb.LocalHome;
+import javax.ejb.Remote;
+import javax.ejb.RemoteHome;
+import javax.ejb.Stateful;
+import javax.naming.InitialContext;
+
+import org.jboss.logging.Logger;
+
+/**
+ * @version <tt>$Revision$</tt>
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+ at Stateful(name="HomedStatefulSession30")
+ at RemoteHome(StatefulSession30Home.class)
+ at LocalHome(StatefulSession30LocalHome.class)
+ at Local({LocalStatefulSession30Business.class,LocalStatefulSession30.class})
+ at Remote(StatefulSession30.class)
+public class HomedStatefulSession30Bean implements java.io.Serializable
+{
+
+ private static final long serialVersionUID = -1013103935052726415L;
+
+ private static final Logger log = Logger.getLogger(HomedStatefulSession30Bean.class);
+
+ private String value = null;
+
+ public void setValue(String value)
+ {
+ this.value = value;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public void setLocalValue(String value)
+ {
+ this.value = value;
+ }
+
+ public String getLocalValue()
+ {
+ return value;
+ }
+
+ public String accessLocalStateless()
+ {
+ try {
+ InitialContext jndiContext = new InitialContext();
+ Session30LocalHome localHome = (Session30LocalHome)jndiContext.lookup("LocalSession30");
+ LocalSession30 localSession = localHome.create();
+ return localSession.access();
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ @Init
+ public void ejbCreate()
+ {
+ value="default";
+ }
+
+ @Init
+ public void ejbCreate(String value)
+ {
+ this.value=value;
+ }
+
+ @Init
+ public void ejbCreate(String value, Integer suffix)
+ {
+ this.value=value + suffix;
+ }
+
+ @PreDestroy
+ public void preDestroy()
+ {
+ log.info("Invoking PreDestroy");
+ }
+}
Deleted: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/reference21_30/Session21Bean.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/reference21_30/Session21Bean.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/reference21_30/Session21Bean.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -1,96 +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.test.reference21_30;
-
-import javax.ejb.SessionContext;
-import javax.naming.InitialContext;
-import javax.naming.NamingEnumeration;
-
-import org.jboss.ejb3.Container;
-import org.jboss.logging.Logger;
-
-/**
- * @version <tt>$Revision$</tt>
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- */
-public class Session21Bean implements javax.ejb.SessionBean
-{
- private static final Logger log = Logger.getLogger(Session21Bean.class);
-
- public String access()
- {
- return "Session21";
- }
-
- public String access30()
- {
- try {
- InitialContext jndiContext = new InitialContext();
-
- Session30 session = (Session30)jndiContext.lookup(Container.ENC_CTX_NAME + "/env/Session30");
- return session.access();
- } catch (Exception e)
- {
- e.printStackTrace();
- return null;
- }
- }
-
- public String globalAccess30()
- {
- try {
- InitialContext jndiContext = new InitialContext();
- Session30RemoteBusiness session = (Session30RemoteBusiness)jndiContext.lookup("GlobalSession30Remote");
- return session.access();
- } catch (Exception e)
- {
- e.printStackTrace();
- return null;
- }
- }
-
- public void ejbCreate()
- {
-
- }
-
- public void ejbActivate()
- {
-
- }
-
- public void ejbPassivate()
- {
-
- }
-
- public void ejbRemove()
- {
-
- }
-
- public void setSessionContext(SessionContext context)
- {
-
- }
-
-}
Copied: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/reference21_30/Session21Bean.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/reference21_30/Session21Bean.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/reference21_30/Session21Bean.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/reference21_30/Session21Bean.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,94 @@
+/*
+ * 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.test.reference21_30;
+
+import javax.ejb.SessionContext;
+import javax.naming.InitialContext;
+
+import org.jboss.ejb3.Container;
+import org.jboss.logging.Logger;
+
+/**
+ * @version <tt>$Revision$</tt>
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+public class Session21Bean implements javax.ejb.SessionBean
+{
+ private static final Logger log = Logger.getLogger(Session21Bean.class);
+
+ public String access()
+ {
+ return "Session21";
+ }
+
+ public String access30()
+ {
+ try {
+ InitialContext jndiContext = new InitialContext();
+ Session30 session = (Session30)jndiContext.lookup(Container.ENC_CTX_NAME + "/env/Session30");
+ return session.access();
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ public String globalAccess30()
+ {
+ try {
+ InitialContext jndiContext = new InitialContext();
+ Session30RemoteBusiness session = (Session30RemoteBusiness)jndiContext.lookup("GlobalSession30Remote");
+ return session.access();
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ public void ejbCreate()
+ {
+
+ }
+
+ public void ejbActivate()
+ {
+
+ }
+
+ public void ejbPassivate()
+ {
+
+ }
+
+ public void ejbRemove()
+ {
+
+ }
+
+ public void setSessionContext(SessionContext context)
+ {
+
+ }
+
+}
Deleted: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/reference21_30/Session30Bean.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/reference21_30/Session30Bean.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/reference21_30/Session30Bean.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -1,127 +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.test.reference21_30;
-
-import javax.ejb.EJB;
-import javax.ejb.EJBs;
-import javax.ejb.Local;
-import javax.ejb.LocalHome;
-import javax.ejb.Remote;
-import javax.ejb.RemoteHome;
-import javax.ejb.Stateless;
-import javax.naming.InitialContext;
-
-import org.jboss.ejb3.Container;
-import org.jboss.ejb3.annotation.LocalBinding;
-import org.jboss.ejb3.annotation.LocalHomeBinding;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.logging.Logger;
-
-/**
- * @version <tt>$Revision$</tt>
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- */
- at Stateless(name="Session30")
- at Remote({Session30.class, Session30RemoteBusiness.class})
- at Local({LocalSession30.class, LocalSession30Business.class})
- at RemoteBinding(jndiBinding = "Session30Remote")
- at LocalBinding(jndiBinding = "LocalSession30")
- at RemoteHome(Session30Home.class)
- at LocalHome(Session30LocalHome.class)
- at LocalHomeBinding(jndiBinding = Session30LocalHome.JNDI_NAME_SESSION_30)
- at EJBs({@EJB(name="injected", beanInterface=org.jboss.ejb3.test.reference21_30.Session21.class, beanName="Session21")})
-
-public class Session30Bean implements Session30RemoteBusiness, LocalSession30Business
-{
- private static final Logger log = Logger.getLogger(Session30Bean.class);
-
- public String access()
- {
- return "Session30";
- }
-
- public String access21()
- {
- try {
- InitialContext jndiContext = new InitialContext();
- Session21 session = (Session21)jndiContext.lookup(Container.ENC_CTX_NAME + "/env/injected");
- return session.access();
- } catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- }
-
- public String globalAccess21()
- {
- try {
- InitialContext jndiContext = new InitialContext();
- Session21Home home = (Session21Home)jndiContext.lookup("Session21");
- Session21 session = (Session21)home.create();
- return session.access();
- } catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- }
-
- public String accessLocalStateful()
- {
- try {
- InitialContext jndiContext = new InitialContext();
- StatefulSession30LocalHome localHome = (StatefulSession30LocalHome)jndiContext.lookup("StatefulSession30/localHome");
- LocalStatefulSession30 localSession = localHome.create();
- return localSession.getLocalValue();
- } catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- }
-
- public String accessLocalStateful(String value)
- {
- try {
- InitialContext jndiContext = new InitialContext();
- StatefulSession30LocalHome localHome = (StatefulSession30LocalHome)jndiContext.lookup("StatefulSession30/localHome");
- LocalStatefulSession30 localSession = localHome.create(value);
- return localSession.getLocalValue();
- } catch (Exception e)
- {
- e.printStackTrace();
- return null;
- }
- }
-
- public String accessLocalStateful(String value, Integer suffix)
- {
- try {
- InitialContext jndiContext = new InitialContext();
- StatefulSession30LocalHome localHome = (StatefulSession30LocalHome)jndiContext.lookup("StatefulSession30/localHome");
- LocalStatefulSession30 localSession = localHome.create(value, suffix);
- return localSession.getLocalValue();
- } catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- }
-
-}
Copied: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/reference21_30/Session30Bean.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/reference21_30/Session30Bean.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/reference21_30/Session30Bean.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/reference21_30/Session30Bean.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,128 @@
+/*
+ * 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.test.reference21_30;
+
+import javax.ejb.EJB;
+import javax.ejb.EJBs;
+import javax.ejb.Local;
+import javax.ejb.LocalHome;
+import javax.ejb.Remote;
+import javax.ejb.RemoteHome;
+import javax.ejb.Stateless;
+import javax.naming.InitialContext;
+
+import org.jboss.ejb3.Container;
+import org.jboss.ejb3.annotation.LocalBinding;
+import org.jboss.ejb3.annotation.LocalHomeBinding;
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.logging.Logger;
+
+/**
+ * @version <tt>$Revision$</tt>
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+ at Stateless(name="Session30")
+ at Remote({Session30.class, Session30RemoteBusiness.class})
+ at Local({LocalSession30.class, LocalSession30Business.class})
+ at RemoteBinding(jndiBinding = "Session30Remote")
+ at LocalBinding(jndiBinding = "LocalSession30")
+ at RemoteHome(Session30Home.class)
+ at LocalHome(Session30LocalHome.class)
+ at LocalHomeBinding(jndiBinding = Session30LocalHome.JNDI_NAME_SESSION_30)
+ at EJBs({@EJB(name="injected", beanInterface=org.jboss.ejb3.test.reference21_30.Session21Home.class, beanName="Session21")})
+
+public class Session30Bean implements Session30RemoteBusiness, LocalSession30Business
+{
+ private static final Logger log = Logger.getLogger(Session30Bean.class);
+
+ public String access()
+ {
+ return "Session30";
+ }
+
+ public String access21()
+ {
+ try {
+ InitialContext jndiContext = new InitialContext();
+ Session21Home sessionHome = (Session21Home) jndiContext.lookup(Container.ENC_CTX_NAME + "/env/injected");
+ Session21 session = sessionHome.create();
+ return session.access();
+ } catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public String globalAccess21()
+ {
+ try {
+ InitialContext jndiContext = new InitialContext();
+ Session21Home home = (Session21Home)jndiContext.lookup("Session21");
+ Session21 session = (Session21)home.create();
+ return session.access();
+ } catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public String accessLocalStateful()
+ {
+ try {
+ InitialContext jndiContext = new InitialContext();
+ StatefulSession30LocalHome localHome = (StatefulSession30LocalHome)jndiContext.lookup("StatefulSession30/localHome");
+ LocalStatefulSession30 localSession = localHome.create();
+ return localSession.getLocalValue();
+ } catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public String accessLocalStateful(String value)
+ {
+ try {
+ InitialContext jndiContext = new InitialContext();
+ StatefulSession30LocalHome localHome = (StatefulSession30LocalHome)jndiContext.lookup("StatefulSession30/localHome");
+ LocalStatefulSession30 localSession = localHome.create(value);
+ return localSession.getLocalValue();
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ public String accessLocalStateful(String value, Integer suffix)
+ {
+ try {
+ InitialContext jndiContext = new InitialContext();
+ StatefulSession30LocalHome localHome = (StatefulSession30LocalHome)jndiContext.lookup("StatefulSession30/localHome");
+ LocalStatefulSession30 localSession = localHome.create(value, suffix);
+ return localSession.getLocalValue();
+ } catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+}
Deleted: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/reference21_30/unit/ReferenceTestCase.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/reference21_30/unit/ReferenceTestCase.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/reference21_30/unit/ReferenceTestCase.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -1,375 +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.test.reference21_30.unit;
-
-import javax.ejb.EJBException;
-import javax.ejb.EJBHome;
-import javax.ejb.EJBMetaData;
-import javax.ejb.EJBObject;
-import javax.ejb.Handle;
-import javax.ejb.HomeHandle;
-import javax.naming.InitialContext;
-
-import junit.framework.Test;
-
-import org.jboss.ejb3.test.reference21_30.Session21;
-import org.jboss.ejb3.test.reference21_30.Session30;
-import org.jboss.ejb3.test.reference21_30.Session30Home;
-import org.jboss.ejb3.test.reference21_30.Session30RemoteBusiness;
-import org.jboss.ejb3.test.reference21_30.StatefulSession30;
-import org.jboss.ejb3.test.reference21_30.StatefulSession30Home;
-import org.jboss.ejb3.test.reference21_30.StatefulSession30RemoteBusiness;
-import org.jboss.logging.Logger;
-import org.jboss.test.JBossTestCase;
-
-/**
- * Test for EJB3.0/EJB2.1 references
- *
- * @version <tt>$Revision$</tt>
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- */
-public class ReferenceTestCase
- extends JBossTestCase {
-
- private static final Logger log = Logger
- .getLogger(ReferenceTestCase.class);
-
- public ReferenceTestCase(String name)
- {
- super(name);
- }
-
- public void testSession21() throws Exception
- {
- InitialContext jndiContext = new InitialContext();
-
- Session21 session = (Session21)jndiContext.lookup("Session21Remote");
- String access = session.access();
- assertEquals("Session21", access);
- access = session.access30();
- assertEquals("Session30", access);
- }
-
- public void testSession30() throws Exception
- {
- InitialContext jndiContext = new InitialContext();
-
- Session30 session = (Session30) jndiContext.lookup("Session30Remote");
- String access = session.access();
- assertEquals("Session30", access);
- access = session.access21();
- assertEquals("Session21", access);
- }
-
- public void testSessionHome30() throws Exception
- {
- InitialContext jndiContext = new InitialContext();
-
- Session30RemoteBusiness session = (Session30RemoteBusiness) jndiContext.lookup("Session30Remote");
- assertNotNull(session);
- String access = session.access();
- assertEquals("Session30", access);
-
- Session30Home home = (Session30Home) jndiContext.lookup("Session30/home");
- assertNotNull(home);
- Session30 sessionRemote = (Session30)home.create();
- assertNotNull(sessionRemote);
- access = sessionRemote.access();
- assertEquals("Session30", access);
- }
-
- public void testStatefulRemove() throws Exception
- {
- InitialContext jndiContext = new InitialContext();
-
- StatefulSession30Home home = (StatefulSession30Home) jndiContext.lookup("StatefulSession30/home");
- assertNotNull(home);
- StatefulSession30 session = (StatefulSession30)home.create();
- assertNotNull(session);
- session.setValue("123");
- String value = session.getValue();
- assertEquals("123", value);
-
- EJBObject ejbObject = (EJBObject)session;
-
- Handle handle = session.getHandle();
- assertNotNull(handle);
-
- home.remove(handle);
-
- try {
- session.getValue();
- assertTrue(false);
- } catch (EJBException e)
- {
- assertTrue(e instanceof EJBException);
- }
-
- session = (StatefulSession30)home.create();
- assertNotNull(session);
- session.setValue("123");
- value = session.getValue();
- assertEquals("123", value);
-
- session.remove();
-
- try {
- session.getValue();
- assertTrue(false);
- } catch (EJBException e)
- {
- assertTrue(e instanceof EJBException);
- }
- }
-
- public void testStatefulSessionHome30() throws Exception
- {
- InitialContext jndiContext = new InitialContext();
-
- StatefulSession30RemoteBusiness session = (StatefulSession30RemoteBusiness) jndiContext.lookup("StatefulSession30Remote");
- assertNotNull(session);
- session.setValue("testing");
- String value = session.getValue();
- assertEquals("testing", value);
-
- StatefulSession30Home home = (StatefulSession30Home) jndiContext.lookup("StatefulSession30/home");
- assertNotNull(home);
- session = (StatefulSession30)home.create();
- assertNotNull(session);
- session.setValue("123");
- value = session.getValue();
- assertEquals("123", value);
-
- session = (StatefulSession30)home.create("456");
- assertNotNull(session);
- value = session.getValue();
- assertEquals("456", value);
-
- session = (StatefulSession30)home.create("combined", new Integer("789"));
- assertNotNull(session);
- value = session.getValue();
- assertEquals("combined789", value);
- }
-
- public void testRemoteHomeAnnotation() throws Exception
- {
- InitialContext jndiContext = new InitialContext();
-
- StatefulSession30Home home = (StatefulSession30Home) jndiContext.lookup("HomedStatefulSession30/home");
- assertNotNull(home);
- StatefulSession30 session = (StatefulSession30)home.create();
- assertNotNull(session);
- session.setValue("123");
- String value = session.getValue();
- assertEquals("123", value);
-
- session = (StatefulSession30)home.create("456");
- assertNotNull(session);
- value = session.getValue();
- assertEquals("456", value);
-
- session = (StatefulSession30)home.create("combined", new Integer("789"));
- assertNotNull(session);
- value = session.getValue();
- assertEquals("combined789", value);
- }
-
- public void testLocalHomeAnnotation() throws Exception
- {
- InitialContext jndiContext = new InitialContext();
-
- StatefulSession30RemoteBusiness session = (StatefulSession30RemoteBusiness) jndiContext.lookup("StatefulSession30Remote");
-
- String access = session.accessLocalHome();
- assertEquals("LocalHome", access);
- }
-
- public void testLocalHome() throws Exception
- {
- InitialContext jndiContext = new InitialContext();
-
- StatefulSession30RemoteBusiness statefulSession = (StatefulSession30RemoteBusiness) jndiContext
- .lookup("StatefulSession30Remote");
- assertNotNull(statefulSession);
- String access = statefulSession.accessLocalStateless();
- assertEquals("Session30", access);
-
- Session30RemoteBusiness session = (Session30RemoteBusiness) jndiContext.lookup("Session30Remote");
- assertNotNull(session);
- access = session.accessLocalStateful();
- assertEquals("default", access);
-
- access = session.accessLocalStateful("testing");
- assertEquals("testing", access);
-
- access = session.accessLocalStateful("testing", new Integer(123));
- assertEquals("testing123", access);
- }
-
- public void testStatefulState() throws Exception
- {
- InitialContext jndiContext = new InitialContext();
-
- StatefulSession30RemoteBusiness session1 = (StatefulSession30RemoteBusiness) jndiContext
- .lookup("StatefulSession30Remote"); assertNotNull(session1);
- session1.setValue("testing");
- assertEquals("testing", session1.getValue());
-
- StatefulSession30RemoteBusiness session2 = (StatefulSession30RemoteBusiness) jndiContext
- .lookup("StatefulSession30Remote");
- assertNotNull(session2);
- assertEquals("default", session2.getValue());
-
- StatefulSession30Home home = (StatefulSession30Home) jndiContext.lookup("StatefulSession30/home");
- assertNotNull(home);
- StatefulSession30 session3 = (StatefulSession30)home.create();
- assertNotNull(session3);
- session3.setValue("123");
- assertEquals("123", session3.getValue());
-
- StatefulSession30 session4 = (StatefulSession30)home.create();
- assertNotNull(session4);
- assertEquals("default", session4.getValue());
- assertEquals("default", session4.getValue());
-
- StatefulSession30 session5 = (StatefulSession30)home.create("init");
- assertNotNull(session5);
- assertEquals("init", session5.getValue());
-
- StatefulSession30 session6 = (StatefulSession30)home.create("init", new Integer(123));
- assertNotNull(session6);
- assertEquals("init123", session6.getValue());
-
- StatefulSession30 session7 = (StatefulSession30)home.create("secondinit");
- assertNotNull(session7);
- assertEquals("secondinit", session7.getValue());
-
- StatefulSession30RemoteBusiness session8 = (StatefulSession30RemoteBusiness) jndiContext
- .lookup("StatefulSession30Remote");
- assertNotNull(session8);
- assertEquals("default", session8.getValue());
-
- assertEquals("testing", session1.getValue());
- assertEquals("default", session2.getValue());
- assertEquals("123", session3.getValue());
- assertEquals("default", session4.getValue());
- assertEquals("init", session5.getValue());
- assertEquals("init123", session6.getValue());
- assertEquals("secondinit", session7.getValue());
- }
-
- public void testStateful21Interfaces() throws Exception
- {
- InitialContext jndiContext = new InitialContext();
-
- StatefulSession30Home home = (StatefulSession30Home) jndiContext.lookup("StatefulSession30/home");
- assertNotNull(home);
-
- EJBMetaData metadata = home.getEJBMetaData();
- assertNotNull(metadata);
- assertEquals(StatefulSession30.class,metadata.getRemoteInterfaceClass());
-
- HomeHandle homeHandle = home.getHomeHandle();
- assertNotNull(homeHandle);
-
- EJBHome ejbHome = homeHandle.getEJBHome();
- assertNotNull(ejbHome);
- metadata = ejbHome.getEJBMetaData();
- assertNotNull(metadata);
- assertEquals(StatefulSession30.class,metadata.getRemoteInterfaceClass());
-
- StatefulSession30 session = (StatefulSession30)home.create();
- assertNotNull(session);
- ejbHome = session.getEJBHome();
- assertNotNull(ejbHome);
- Object primaryKey = session.getPrimaryKey();
- assertNotNull(primaryKey);
-
- Handle handle = session.getHandle();
- assertNotNull(handle);
-
- EJBObject ejbObject = handle.getEJBObject();
- assertNotNull(ejbObject);
-
- ejbHome = ejbObject.getEJBHome();
- assertNotNull(ejbHome);
-
- Handle handle1 = ejbObject.getHandle();
- assertNotNull(handle1);
-
- StatefulSession30 session1 = (StatefulSession30)home.create();
- assertFalse(session.isIdentical(session1));
- assertTrue(session.isIdentical(session));
- }
-
- public void testStateless21Interfaces() throws Exception
- {
- InitialContext jndiContext = new InitialContext();
-
- Session30Home home = (Session30Home) jndiContext.lookup("Session30/home");
- assertNotNull(home);
-
- EJBMetaData metadata = home.getEJBMetaData();
- assertNotNull(metadata);
- assertEquals("org.jboss.ejb3.test.reference21_30.Session30",metadata.getRemoteInterfaceClass().getName());
-
- HomeHandle homeHandle = home.getHomeHandle();
- assertNotNull(homeHandle);
-
- EJBHome ejbHome = homeHandle.getEJBHome();
- assertNotNull(ejbHome);
- metadata = ejbHome.getEJBMetaData();
- assertNotNull(metadata);
- assertEquals("org.jboss.ejb3.test.reference21_30.Session30",metadata.getRemoteInterfaceClass().getName());
-
- Session30 session = (Session30)home.create();
- assertNotNull(session);
- ejbHome = session.getEJBHome();
- assertNotNull(ejbHome);
- Object primaryKey = session.getPrimaryKey();
- assertNull(primaryKey);
-
- Handle handle = session.getHandle();
- assertNotNull(handle);
-
- EJBObject ejbObject = handle.getEJBObject();
- assertNotNull(ejbObject);
-
- ejbHome = ejbObject.getEJBHome();
- assertNotNull(ejbHome);
-
- Handle handle1 = ejbObject.getHandle();
- assertNotNull(handle1);
-
- Session30 session1 = (Session30)home.create();
- assertFalse(session.isIdentical(session1));
- }
-
- protected void setUp() throws Exception
- {
- }
-
- public static Test suite() throws Exception
- {
- return getDeploySetup(ReferenceTestCase.class, "reference.jar");
- }
-}
Copied: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/reference21_30/unit/ReferenceTestCase.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/reference21_30/unit/ReferenceTestCase.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/reference21_30/unit/ReferenceTestCase.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/reference21_30/unit/ReferenceTestCase.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,378 @@
+/*
+ * 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.test.reference21_30.unit;
+
+import javax.ejb.EJBException;
+import javax.ejb.EJBHome;
+import javax.ejb.EJBMetaData;
+import javax.ejb.EJBObject;
+import javax.ejb.Handle;
+import javax.ejb.HomeHandle;
+import javax.naming.InitialContext;
+
+import junit.framework.Test;
+
+import org.jboss.ejb3.test.reference21_30.Session21;
+import org.jboss.ejb3.test.reference21_30.Session21Home;
+import org.jboss.ejb3.test.reference21_30.Session30;
+import org.jboss.ejb3.test.reference21_30.Session30Home;
+import org.jboss.ejb3.test.reference21_30.Session30RemoteBusiness;
+import org.jboss.ejb3.test.reference21_30.StatefulSession30;
+import org.jboss.ejb3.test.reference21_30.StatefulSession30Home;
+import org.jboss.ejb3.test.reference21_30.StatefulSession30RemoteBusiness;
+import org.jboss.logging.Logger;
+import org.jboss.test.JBossTestCase;
+
+/**
+ * Test for EJB3.0/EJB2.1 references
+ *
+ * @version <tt>$Revision$</tt>
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+public class ReferenceTestCase
+ extends JBossTestCase {
+
+ private static final Logger log = Logger
+ .getLogger(ReferenceTestCase.class);
+
+ public ReferenceTestCase(String name)
+ {
+ super(name);
+ }
+
+ public void testSession21() throws Exception
+ {
+ InitialContext jndiContext = new InitialContext();
+
+ Session21Home home = (Session21Home)jndiContext.lookup("Session21/home");
+ Session21 session = home.create();
+ String access = session.access();
+ assertEquals("Session21", access);
+ access = session.access30();
+ assertEquals("Session30", access);
+ }
+
+ public void testSession30() throws Exception
+ {
+ InitialContext jndiContext = new InitialContext();
+
+ Session30Home sessionHome = (Session30Home) jndiContext.lookup("Session30/home");
+ Session30 session = sessionHome.create();
+ String access = session.access();
+ assertEquals("Session30", access);
+ access = session.access21();
+ assertEquals("Session21", access);
+ }
+
+ public void testSessionHome30() throws Exception
+ {
+ InitialContext jndiContext = new InitialContext();
+
+ Session30RemoteBusiness session = (Session30RemoteBusiness) jndiContext.lookup("Session30Remote");
+ assertNotNull(session);
+ String access = session.access();
+ assertEquals("Session30", access);
+
+ Session30Home home = (Session30Home) jndiContext.lookup("Session30/home");
+ assertNotNull(home);
+ Session30 sessionRemote = (Session30)home.create();
+ assertNotNull(sessionRemote);
+ access = sessionRemote.access();
+ assertEquals("Session30", access);
+ }
+
+ public void testStatefulRemove() throws Exception
+ {
+ InitialContext jndiContext = new InitialContext();
+
+ StatefulSession30Home home = (StatefulSession30Home) jndiContext.lookup("StatefulSession30/home");
+ assertNotNull(home);
+ StatefulSession30 session = (StatefulSession30)home.create();
+ assertNotNull(session);
+ session.setValue("123");
+ String value = session.getValue();
+ assertEquals("123", value);
+
+ EJBObject ejbObject = (EJBObject)session;
+
+ Handle handle = session.getHandle();
+ assertNotNull(handle);
+
+ home.remove(handle);
+
+ try {
+ session.getValue();
+ assertTrue(false);
+ } catch (EJBException e)
+ {
+ assertTrue(e instanceof EJBException);
+ }
+
+ session = (StatefulSession30)home.create();
+ assertNotNull(session);
+ session.setValue("123");
+ value = session.getValue();
+ assertEquals("123", value);
+
+ session.remove();
+
+ try {
+ session.getValue();
+ assertTrue(false);
+ } catch (EJBException e)
+ {
+ assertTrue(e instanceof EJBException);
+ }
+ }
+
+ public void testStatefulSessionHome30() throws Exception
+ {
+ InitialContext jndiContext = new InitialContext();
+
+ StatefulSession30RemoteBusiness session = (StatefulSession30RemoteBusiness) jndiContext.lookup("StatefulSession30Remote");
+ assertNotNull(session);
+ session.setValue("testing");
+ String value = session.getValue();
+ assertEquals("testing", value);
+
+ StatefulSession30Home home = (StatefulSession30Home) jndiContext.lookup("StatefulSession30/home");
+ assertNotNull(home);
+ session = (StatefulSession30)home.create();
+ assertNotNull(session);
+ session.setValue("123");
+ value = session.getValue();
+ assertEquals("123", value);
+
+ session = (StatefulSession30)home.create("456");
+ assertNotNull(session);
+ value = session.getValue();
+ assertEquals("456", value);
+
+ session = (StatefulSession30)home.create("combined", new Integer("789"));
+ assertNotNull(session);
+ value = session.getValue();
+ assertEquals("combined789", value);
+ }
+
+ public void testRemoteHomeAnnotation() throws Exception
+ {
+ InitialContext jndiContext = new InitialContext();
+
+ StatefulSession30Home home = (StatefulSession30Home) jndiContext.lookup("HomedStatefulSession30/home");
+ assertNotNull(home);
+ StatefulSession30 session = (StatefulSession30)home.create();
+ assertNotNull(session);
+ session.setValue("123");
+ String value = session.getValue();
+ assertEquals("123", value);
+
+ session = (StatefulSession30)home.create("456");
+ assertNotNull(session);
+ value = session.getValue();
+ assertEquals("456", value);
+
+ session = (StatefulSession30)home.create("combined", new Integer("789"));
+ assertNotNull(session);
+ value = session.getValue();
+ assertEquals("combined789", value);
+ }
+
+ public void testLocalHomeAnnotation() throws Exception
+ {
+ InitialContext jndiContext = new InitialContext();
+
+ StatefulSession30RemoteBusiness session = (StatefulSession30RemoteBusiness) jndiContext.lookup("StatefulSession30Remote");
+
+ String access = session.accessLocalHome();
+ assertEquals("LocalHome", access);
+ }
+
+ public void testLocalHome() throws Exception
+ {
+ InitialContext jndiContext = new InitialContext();
+
+ StatefulSession30RemoteBusiness statefulSession = (StatefulSession30RemoteBusiness) jndiContext
+ .lookup("StatefulSession30Remote");
+ assertNotNull(statefulSession);
+ String access = statefulSession.accessLocalStateless();
+ assertEquals("Session30", access);
+
+ Session30RemoteBusiness session = (Session30RemoteBusiness) jndiContext.lookup("Session30Remote");
+ assertNotNull(session);
+ access = session.accessLocalStateful();
+ assertEquals("default", access);
+
+ access = session.accessLocalStateful("testing");
+ assertEquals("testing", access);
+
+ access = session.accessLocalStateful("testing", new Integer(123));
+ assertEquals("testing123", access);
+ }
+
+ public void testStatefulState() throws Exception
+ {
+ InitialContext jndiContext = new InitialContext();
+
+ StatefulSession30RemoteBusiness session1 = (StatefulSession30RemoteBusiness) jndiContext
+ .lookup("StatefulSession30Remote"); assertNotNull(session1);
+ session1.setValue("testing");
+ assertEquals("testing", session1.getValue());
+
+ StatefulSession30RemoteBusiness session2 = (StatefulSession30RemoteBusiness) jndiContext
+ .lookup("StatefulSession30Remote");
+ assertNotNull(session2);
+ assertEquals("default", session2.getValue());
+
+ StatefulSession30Home home = (StatefulSession30Home) jndiContext.lookup("StatefulSession30/home");
+ assertNotNull(home);
+ StatefulSession30 session3 = (StatefulSession30)home.create();
+ assertNotNull(session3);
+ session3.setValue("123");
+ assertEquals("123", session3.getValue());
+
+ StatefulSession30 session4 = (StatefulSession30)home.create();
+ assertNotNull(session4);
+ assertEquals("default", session4.getValue());
+ assertEquals("default", session4.getValue());
+
+ StatefulSession30 session5 = (StatefulSession30)home.create("init");
+ assertNotNull(session5);
+ assertEquals("init", session5.getValue());
+
+ StatefulSession30 session6 = (StatefulSession30)home.create("init", new Integer(123));
+ assertNotNull(session6);
+ assertEquals("init123", session6.getValue());
+
+ StatefulSession30 session7 = (StatefulSession30)home.create("secondinit");
+ assertNotNull(session7);
+ assertEquals("secondinit", session7.getValue());
+
+ StatefulSession30RemoteBusiness session8 = (StatefulSession30RemoteBusiness) jndiContext
+ .lookup("StatefulSession30Remote");
+ assertNotNull(session8);
+ assertEquals("default", session8.getValue());
+
+ assertEquals("testing", session1.getValue());
+ assertEquals("default", session2.getValue());
+ assertEquals("123", session3.getValue());
+ assertEquals("default", session4.getValue());
+ assertEquals("init", session5.getValue());
+ assertEquals("init123", session6.getValue());
+ assertEquals("secondinit", session7.getValue());
+ }
+
+ public void testStateful21Interfaces() throws Exception
+ {
+ InitialContext jndiContext = new InitialContext();
+
+ StatefulSession30Home home = (StatefulSession30Home) jndiContext.lookup("StatefulSession30/home");
+ assertNotNull(home);
+
+ EJBMetaData metadata = home.getEJBMetaData();
+ assertNotNull(metadata);
+ assertEquals(StatefulSession30.class,metadata.getRemoteInterfaceClass());
+
+ HomeHandle homeHandle = home.getHomeHandle();
+ assertNotNull(homeHandle);
+
+ EJBHome ejbHome = homeHandle.getEJBHome();
+ assertNotNull(ejbHome);
+ metadata = ejbHome.getEJBMetaData();
+ assertNotNull(metadata);
+ assertEquals(StatefulSession30.class,metadata.getRemoteInterfaceClass());
+
+ StatefulSession30 session = (StatefulSession30)home.create();
+ assertNotNull(session);
+ ejbHome = session.getEJBHome();
+ assertNotNull(ejbHome);
+ Object primaryKey = session.getPrimaryKey();
+ assertNotNull(primaryKey);
+
+ Handle handle = session.getHandle();
+ assertNotNull(handle);
+
+ EJBObject ejbObject = handle.getEJBObject();
+ assertNotNull(ejbObject);
+
+ ejbHome = ejbObject.getEJBHome();
+ assertNotNull(ejbHome);
+
+ Handle handle1 = ejbObject.getHandle();
+ assertNotNull(handle1);
+
+ StatefulSession30 session1 = (StatefulSession30)home.create();
+ assertFalse(session.isIdentical(session1));
+ assertTrue(session.isIdentical(session));
+ }
+
+ public void testStateless21Interfaces() throws Exception
+ {
+ InitialContext jndiContext = new InitialContext();
+
+ Session30Home home = (Session30Home) jndiContext.lookup("Session30/home");
+ assertNotNull(home);
+
+ EJBMetaData metadata = home.getEJBMetaData();
+ assertNotNull(metadata);
+ assertEquals("org.jboss.ejb3.test.reference21_30.Session30",metadata.getRemoteInterfaceClass().getName());
+
+ HomeHandle homeHandle = home.getHomeHandle();
+ assertNotNull(homeHandle);
+
+ EJBHome ejbHome = homeHandle.getEJBHome();
+ assertNotNull(ejbHome);
+ metadata = ejbHome.getEJBMetaData();
+ assertNotNull(metadata);
+ assertEquals("org.jboss.ejb3.test.reference21_30.Session30",metadata.getRemoteInterfaceClass().getName());
+
+ Session30 session = (Session30)home.create();
+ assertNotNull(session);
+ ejbHome = session.getEJBHome();
+ assertNotNull(ejbHome);
+ Object primaryKey = session.getPrimaryKey();
+ assertNull(primaryKey);
+
+ Handle handle = session.getHandle();
+ assertNotNull(handle);
+
+ EJBObject ejbObject = handle.getEJBObject();
+ assertNotNull(ejbObject);
+
+ ejbHome = ejbObject.getEJBHome();
+ assertNotNull(ejbHome);
+
+ Handle handle1 = ejbObject.getHandle();
+ assertNotNull(handle1);
+
+ Session30 session1 = (Session30)home.create();
+ assertFalse(session.isIdentical(session1));
+ }
+
+ protected void setUp() throws Exception
+ {
+ }
+
+ public static Test suite() throws Exception
+ {
+ return getDeploySetup(ReferenceTestCase.class, "reference.jar");
+ }
+}
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/stateful/Stateful21.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/stateful/Stateful21.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/stateful/Stateful21.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -27,7 +27,7 @@
* A remote interface for a stateful bean.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public interface Stateful21 extends Stateful, EJBObject
{
Deleted: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/stateful/StatefulRemoteProxyFactory.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/stateful/StatefulRemoteProxyFactory.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/stateful/StatefulRemoteProxyFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -1,56 +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.test.stateful;
-
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.session.SessionContainer;
-import org.jboss.logging.Logger;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- * @version $Revision$
- */
-public class StatefulRemoteProxyFactory extends org.jboss.ejb3.stateful.StatefulRemoteProxyFactory
-{
- @SuppressWarnings("unused")
- private static final Logger log = Logger.getLogger(StatefulRemoteProxyFactory.class);
-
- public StatefulRemoteProxyFactory(SessionContainer container, RemoteBinding binding)
- {
- super(container, binding);
- }
-
- @Override
- protected Class<?>[] getInterfacesForBusinessProxy()
- {
- Class<?>[] remoteInterfaces = super.getInterfacesForBusinessProxy();
-
- Class<?>[] interfaces = new Class[remoteInterfaces.length + 1];
-
- System.arraycopy(remoteInterfaces, 0, interfaces, 0, remoteInterfaces.length);
- interfaces[remoteInterfaces.length] = org.jboss.ejb3.test.stateful.ProxyFactoryInterface.class;
-
- return interfaces;
- }
-}
Copied: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/stateful/StatefulRemoteProxyFactory.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/stateful/StatefulRemoteProxyFactory.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/stateful/StatefulRemoteProxyFactory.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/stateful/StatefulRemoteProxyFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,43 @@
+/*
+ * 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.test.stateful;
+
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.session.SessionSpecContainer;
+import org.jboss.logging.Logger;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ * @version $Revision$
+ */
+public class StatefulRemoteProxyFactory extends org.jboss.ejb3.stateful.StatefulRemoteProxyFactory
+{
+ @SuppressWarnings("unused")
+ private static final Logger log = Logger.getLogger(StatefulRemoteProxyFactory.class);
+
+ public StatefulRemoteProxyFactory(SessionSpecContainer container, RemoteBinding binding)
+ {
+ super(container, binding);
+ }
+}
Deleted: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/statefulproxyfactoryoverride/StatefulRemoteProxyFactory.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/statefulproxyfactoryoverride/StatefulRemoteProxyFactory.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/statefulproxyfactoryoverride/StatefulRemoteProxyFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -1,56 +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.test.statefulproxyfactoryoverride;
-
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.session.SessionContainer;
-import org.jboss.logging.Logger;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- * @version $Revision: 67628 $
- */
-public class StatefulRemoteProxyFactory extends org.jboss.ejb3.stateful.StatefulRemoteProxyFactory
-{
- @SuppressWarnings("unused")
- private static final Logger log = Logger.getLogger(StatefulRemoteProxyFactory.class);
-
- public StatefulRemoteProxyFactory(SessionContainer container, RemoteBinding binding)
- {
- super(container, binding);
- }
-
- @Override
- protected Class<?>[] getInterfacesForBusinessProxy()
- {
- Class<?>[] remoteInterfaces = super.getInterfacesForBusinessProxy();
-
- Class<?>[] interfaces = new Class[remoteInterfaces.length + 1];
-
- System.arraycopy(remoteInterfaces, 0, interfaces, 0, remoteInterfaces.length);
- interfaces[remoteInterfaces.length] = org.jboss.ejb3.test.statefulproxyfactoryoverride.ProxyFactoryInterface.class;
-
- return interfaces;
- }
-}
Copied: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/statefulproxyfactoryoverride/StatefulRemoteProxyFactory.java (from rev 71799, projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/statefulproxyfactoryoverride/StatefulRemoteProxyFactory.java)
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/statefulproxyfactoryoverride/StatefulRemoteProxyFactory.java (rev 0)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/statefulproxyfactoryoverride/StatefulRemoteProxyFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -0,0 +1,43 @@
+/*
+ * 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.test.statefulproxyfactoryoverride;
+
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.session.SessionSpecContainer;
+import org.jboss.logging.Logger;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ * @version $Revision: 67628 $
+ */
+public class StatefulRemoteProxyFactory extends org.jboss.ejb3.stateful.StatefulRemoteProxyFactory
+{
+ @SuppressWarnings("unused")
+ private static final Logger log = Logger.getLogger(StatefulRemoteProxyFactory.class);
+
+ public StatefulRemoteProxyFactory(SessionSpecContainer container, RemoteBinding binding)
+ {
+ super(container, binding);
+ }
+}
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/strictpool/unit/MDBCallable.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/strictpool/unit/MDBCallable.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/strictpool/unit/MDBCallable.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -40,7 +40,7 @@
* Send a JMS text message and expect a reply.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class MDBCallable implements Callable<String>
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/threadlocal/MockBean.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/threadlocal/MockBean.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/threadlocal/MockBean.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -27,7 +27,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class MockBean
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/threadlocal/MockBeanContext.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/threadlocal/MockBeanContext.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/threadlocal/MockBeanContext.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -33,7 +33,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class MockBeanContext implements BeanContext
{
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/xpcalt/Inspector.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/xpcalt/Inspector.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/xpcalt/Inspector.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -27,7 +27,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@Remote
public interface Inspector
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/xpcalt/InspectorBean.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/xpcalt/InspectorBean.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/xpcalt/InspectorBean.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -29,7 +29,7 @@
* A stateless bean to check on the persistence unit
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@Stateless
public class InspectorBean implements Inspector
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/xpcalt/Keeper.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/xpcalt/Keeper.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/xpcalt/Keeper.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -27,7 +27,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@Remote
public interface Keeper extends Master
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/xpcalt/LowEnd.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/xpcalt/LowEnd.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/xpcalt/LowEnd.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -28,7 +28,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@Local
public interface LowEnd
Modified: projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/xpcalt/Master.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/xpcalt/Master.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/core/src/test/java/org/jboss/ejb3/test/xpcalt/Master.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -27,7 +27,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@Remote
public interface Master
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/InterceptorFactory.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/InterceptorFactory.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/InterceptorFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -34,7 +34,7 @@
* To counter this you can use an interceptor factory.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public interface InterceptorFactory
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/InterceptorFactoryRef.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/InterceptorFactoryRef.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/InterceptorFactoryRef.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -38,7 +38,7 @@
* To counter this you can specify an interceptor factory to use.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/ManagedObject.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/ManagedObject.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/ManagedObject.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -37,7 +37,7 @@
* it does not have to be explicitly added.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@Inherited
@Documented
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/annotation/AnnotationAdvisor.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/annotation/AnnotationAdvisor.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/annotation/AnnotationAdvisor.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -31,7 +31,7 @@
* (An AOP Advisor can only do one.)
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public interface AnnotationAdvisor
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/annotation/AnnotationAdvisorHelper.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/annotation/AnnotationAdvisorHelper.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/annotation/AnnotationAdvisorHelper.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -30,7 +30,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class AnnotationAdvisorHelper
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/annotation/AnnotationAdvisorSupport.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/annotation/AnnotationAdvisorSupport.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/annotation/AnnotationAdvisorSupport.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -31,7 +31,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class AnnotationAdvisorSupport implements AnnotationAdvisor
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/annotation/AnnotationAdvisorWrapper.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/annotation/AnnotationAdvisorWrapper.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/annotation/AnnotationAdvisorWrapper.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -32,7 +32,7 @@
* Wraps an AOP Advisor to become an AnnotationAdvisor.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
class AnnotationAdvisorWrapper implements AnnotationAdvisor
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/annotation/impl/InterceptorsImpl.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/annotation/impl/InterceptorsImpl.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/annotation/impl/InterceptorsImpl.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -37,7 +37,7 @@
* be made after it is in use.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class InterceptorsImpl implements Interceptors
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/AbstractInterceptorFactory.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/AbstractInterceptorFactory.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/AbstractInterceptorFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -30,7 +30,7 @@
* An aspect factory that can do nothing.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public abstract class AbstractInterceptorFactory implements AspectFactory
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/AroundInvokeInterceptor.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/AroundInvokeInterceptor.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/AroundInvokeInterceptor.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -29,7 +29,7 @@
* Invoke around invoke
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class AroundInvokeInterceptor implements Interceptor
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/BootstrapInterceptor.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/BootstrapInterceptor.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/BootstrapInterceptor.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -31,7 +31,7 @@
* The mother of interceptors
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class BootstrapInterceptor implements Interceptor
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/BusinessMethodBeanMethodInterceptor.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/BusinessMethodBeanMethodInterceptor.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/BusinessMethodBeanMethodInterceptor.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -34,7 +34,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class BusinessMethodBeanMethodInterceptor implements Interceptor
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/BusinessMethodInterceptorMethodInterceptor.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/BusinessMethodInterceptorMethodInterceptor.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/BusinessMethodInterceptorMethodInterceptor.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -37,7 +37,7 @@
* Object <METHOD>(InvocationContext) throws Exception
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class BusinessMethodInterceptorMethodInterceptor implements Interceptor
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/ClassContainer.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/ClassContainer.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/ClassContainer.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -36,7 +36,7 @@
* @deprecated use DomainClassLoader
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@Deprecated
public class ClassContainer extends ClassAdvisor
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/DefaultInterceptorFactory.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/DefaultInterceptorFactory.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/DefaultInterceptorFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -30,7 +30,7 @@
* of the interceptor class.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class DefaultInterceptorFactory implements InterceptorFactory
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/Destructable.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/Destructable.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/Destructable.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -25,7 +25,7 @@
* So we can call _preDestroy
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public interface Destructable
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/DomainClassLoader.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/DomainClassLoader.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/DomainClassLoader.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -41,7 +41,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class DomainClassLoader extends ClassLoader
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/ExtendedAdvisor.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/ExtendedAdvisor.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/ExtendedAdvisor.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -30,7 +30,7 @@
* (Basically it has the same methods as the extended annotation repository)
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public interface ExtendedAdvisor
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/ExtendedAdvisorHelper.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/ExtendedAdvisorHelper.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/ExtendedAdvisorHelper.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -29,7 +29,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class ExtendedAdvisorHelper
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/ExtendedAdvisorWrapper.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/ExtendedAdvisorWrapper.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/ExtendedAdvisorWrapper.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -34,7 +34,7 @@
* Wraps an AOP Advisor to become an extended advisor of itself.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class ExtendedAdvisorWrapper implements ExtendedAdvisor
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/InjectInterceptorsFactory.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/InjectInterceptorsFactory.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/InjectInterceptorsFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -42,7 +42,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class InjectInterceptorsFactory extends AbstractInterceptorFactory
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/InterceptorSequencer.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/InterceptorSequencer.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/InterceptorSequencer.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -32,7 +32,7 @@
* Invokes some interceptors in sequence.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class InterceptorSequencer implements Interceptor
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/InterceptorsInterceptor.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/InterceptorsInterceptor.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/InterceptorsInterceptor.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -32,7 +32,7 @@
* See EJB 3 12.3.1.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class InterceptorsInterceptor
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/InvocationContextInterceptor.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/InvocationContextInterceptor.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/InvocationContextInterceptor.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -35,7 +35,7 @@
* is available.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class InvocationContextInterceptor
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/InvokeSpecInterceptorInterceptor.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/InvokeSpecInterceptorInterceptor.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/InvokeSpecInterceptorInterceptor.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -29,7 +29,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@Deprecated
public class InvokeSpecInterceptorInterceptor implements Interceptor
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/NopInterceptor.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/NopInterceptor.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/NopInterceptor.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -29,7 +29,7 @@
* Does nothing.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class NopInterceptor implements Interceptor
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/PostConstructInterceptor.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/PostConstructInterceptor.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/PostConstructInterceptor.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -29,7 +29,7 @@
* Invoke post constructs
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class PostConstructInterceptor implements Interceptor
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/annotation/DefaultInterceptors.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/annotation/DefaultInterceptors.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/annotation/DefaultInterceptors.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -31,7 +31,7 @@
* Used internally to specify default interceptors on a managed object.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@Target(TYPE)
@Retention(RUNTIME)
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/annotation/DefaultInterceptorsImpl.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/annotation/DefaultInterceptorsImpl.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/annotation/DefaultInterceptorsImpl.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -28,7 +28,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class DefaultInterceptorsImpl implements DefaultInterceptors
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/annotation/InterceptorOrder.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/annotation/InterceptorOrder.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/annotation/InterceptorOrder.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -32,7 +32,7 @@
* Used internally to specify the order of interceptors.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@Target({ TYPE, METHOD })
@Retention(RUNTIME)
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/container/ContainerInterceptorFactory.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/container/ContainerInterceptorFactory.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/container/ContainerInterceptorFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -28,7 +28,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class ContainerInterceptorFactory implements InterceptorFactory
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/container/DestructionInvocation.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/container/DestructionInvocation.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/container/DestructionInvocation.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -30,7 +30,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class DestructionInvocation extends InvocationBase
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/container/InterceptorFactoryRefImpl.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/container/InterceptorFactoryRefImpl.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/container/InterceptorFactoryRefImpl.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -30,7 +30,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class InterceptorFactoryRefImpl implements InterceptorFactoryRef
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/container/ManagedObjectAdvisor.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/container/ManagedObjectAdvisor.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/container/ManagedObjectAdvisor.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -52,7 +52,7 @@
* - there is always an instance advisor delegate
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class ManagedObjectAdvisor<T, C extends AbstractContainer<T, C>> extends ClassAdvisor implements ExtendedAdvisor, InstanceAdvisor
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/direct/DirectContainer.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/direct/DirectContainer.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/direct/DirectContainer.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -31,7 +31,7 @@
* classloader and still have control on how instances are called.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class DirectContainer<T> extends AbstractDirectContainer<T, DirectContainer<T>>
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/direct/IndirectContainer.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/direct/IndirectContainer.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/direct/IndirectContainer.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -25,7 +25,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public interface IndirectContainer<T, C extends AbstractDirectContainer<T, C>>
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/lang/BootstrapClassLoader.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/lang/BootstrapClassLoader.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/lang/BootstrapClassLoader.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -26,7 +26,7 @@
* Only loads classes from the JDK bootstrap.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class BootstrapClassLoader extends ClassLoader
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/lang/ClassHelper.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/lang/ClassHelper.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/lang/ClassHelper.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -29,7 +29,7 @@
* Methods which should have been in Class.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class ClassHelper
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/lang/ScopedClassLoader.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/lang/ScopedClassLoader.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/lang/ScopedClassLoader.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -28,7 +28,7 @@
* Only load classes and resources from the given urls.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class ScopedClassLoader extends URLClassLoader
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/metadata/AdditiveBeanInterceptorMetaDataBridge.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/metadata/AdditiveBeanInterceptorMetaDataBridge.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/metadata/AdditiveBeanInterceptorMetaDataBridge.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -37,7 +37,7 @@
* TODO: additivity is probably also a cross component function
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class AdditiveBeanInterceptorMetaDataBridge extends BeanInterceptorMetaDataBridge
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/metadata/BeanInterceptorMetaDataBridge.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/metadata/BeanInterceptorMetaDataBridge.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/metadata/BeanInterceptorMetaDataBridge.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -52,7 +52,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class BeanInterceptorMetaDataBridge extends EnvironmentInterceptorMetaDataBridge<JBossEnterpriseBeanMetaData> implements MetaDataBridge<JBossEnterpriseBeanMetaData>
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/metadata/EnvironmentInterceptorMetaDataBridge.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/metadata/EnvironmentInterceptorMetaDataBridge.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/metadata/EnvironmentInterceptorMetaDataBridge.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -43,7 +43,7 @@
* Does only interceptor stuff.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class EnvironmentInterceptorMetaDataBridge<M extends Environment> implements MetaDataBridge<M>
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/metadata/InterceptorComponentMetaDataLoaderFactory.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/metadata/InterceptorComponentMetaDataLoaderFactory.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/metadata/InterceptorComponentMetaDataLoaderFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -39,7 +39,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class InterceptorComponentMetaDataLoaderFactory implements ComponentMetaDataLoaderFactory<JBossEnterpriseBeanMetaData>
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/metadata/InterceptorMetaDataBridge.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/metadata/InterceptorMetaDataBridge.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/metadata/InterceptorMetaDataBridge.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -37,7 +37,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class InterceptorMetaDataBridge extends EnvironmentInterceptorMetaDataBridge<InterceptorMetaData> implements MetaDataBridge<InterceptorMetaData>
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/proxy/ProxyContainer.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/proxy/ProxyContainer.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/main/java/org/jboss/ejb3/interceptors/proxy/ProxyContainer.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -37,7 +37,7 @@
* Advisor life-cycle is controlled.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class ProxyContainer<T> extends AbstractContainer<T, ProxyContainer<T>>
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/additive/MyInterceptor.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/additive/MyInterceptor.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/additive/MyInterceptor.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -32,7 +32,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class MyInterceptor
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/additive/MySessionBean.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/additive/MySessionBean.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/additive/MySessionBean.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -32,7 +32,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@ManagedObject
@Interceptors(MyInterceptor.class)
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/additive/XMLInterceptor.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/additive/XMLInterceptor.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/additive/XMLInterceptor.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -31,7 +31,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class XMLInterceptor
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/basic/BasicBean.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/basic/BasicBean.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/basic/BasicBean.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -35,7 +35,7 @@
* And it has bean method interceptors: aroundInvoke
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@Interceptors(BasicInterceptor.class)
public class BasicBean
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/basic/BasicInterceptor.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/basic/BasicInterceptor.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/basic/BasicInterceptor.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -32,7 +32,7 @@
* A basic interceptor, does nothing useful.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class BasicInterceptor
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/basic/BasicMethodInterceptor.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/basic/BasicMethodInterceptor.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/basic/BasicMethodInterceptor.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -31,7 +31,7 @@
* To be put on a method.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class BasicMethodInterceptor
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/basic/unit/BasicTestRunner.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/basic/unit/BasicTestRunner.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/basic/unit/BasicTestRunner.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -36,7 +36,7 @@
* Named TestRunner, so surefire does not pick it up.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class BasicTestRunner extends TestCase
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/common/CommonInterceptor.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/common/CommonInterceptor.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/common/CommonInterceptor.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -31,7 +31,7 @@
* Can be used by an annotated interceptor, or one from metadata.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class CommonInterceptor
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/common/aop/LoggingInterceptor.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/common/aop/LoggingInterceptor.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/common/aop/LoggingInterceptor.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -29,7 +29,7 @@
* Log as much as we can about the invocation, then proceed.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class LoggingInterceptor implements Interceptor
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/direct/DirectInterceptor.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/direct/DirectInterceptor.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/direct/DirectInterceptor.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -32,7 +32,7 @@
* A basic interceptor, does nothing useful.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class DirectInterceptor
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/direct/DirectMethodInterceptor.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/direct/DirectMethodInterceptor.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/direct/DirectMethodInterceptor.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -31,7 +31,7 @@
* To be put on a method.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class DirectMethodInterceptor
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/direct/TestInterceptorFactory.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/direct/TestInterceptorFactory.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/direct/TestInterceptorFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -32,7 +32,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class TestInterceptorFactory extends AbstractInterceptorFactory
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/ejbthree1215/GetMethodInterceptor.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/ejbthree1215/GetMethodInterceptor.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/ejbthree1215/GetMethodInterceptor.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -30,7 +30,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class GetMethodInterceptor
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/ejbthree1215/Hello.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/ejbthree1215/Hello.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/ejbthree1215/Hello.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -26,7 +26,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public interface Hello
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/ejbthree1215/HelloBean.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/ejbthree1215/HelloBean.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/ejbthree1215/HelloBean.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -30,7 +30,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@ManagedObject
@Interceptors(GetMethodInterceptor.class)
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/ejbthree1215/unit/ContextGetMethodTestCase.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/ejbthree1215/unit/ContextGetMethodTestCase.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/ejbthree1215/unit/ContextGetMethodTestCase.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -37,7 +37,7 @@
* EJBTHREE-1215: InvocationContext.getMethod must return null in lifecycle callback.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class ContextGetMethodTestCase extends TestCase
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/lifecycle/SessionBeanCallbackBean.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/lifecycle/SessionBeanCallbackBean.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/lifecycle/SessionBeanCallbackBean.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -28,7 +28,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@ManagedObject
public class SessionBeanCallbackBean
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/metadata/MetadataBean.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/metadata/MetadataBean.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/metadata/MetadataBean.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -30,7 +30,7 @@
* All interceptors defined in metadata.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@ManagedObject
public class MetadataBean
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/proxy/MyInterface.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/proxy/MyInterface.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/proxy/MyInterface.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -25,7 +25,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public interface MyInterface
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/proxy/ProxiedBean.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/proxy/ProxiedBean.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/proxy/ProxiedBean.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -32,7 +32,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@Interceptors(ProxiedInterceptor.class)
@ManagedObject
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/proxy/ProxiedInterceptor.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/proxy/ProxiedInterceptor.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/proxy/ProxiedInterceptor.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -32,7 +32,7 @@
* A basic interceptor, does nothing useful.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class ProxiedInterceptor
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/proxy/unit/ProxyTestCase.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/proxy/unit/ProxyTestCase.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/proxy/unit/ProxyTestCase.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -36,7 +36,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class ProxyTestCase extends TestCase
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/signature/PackageProtectedInterceptor.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/signature/PackageProtectedInterceptor.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/signature/PackageProtectedInterceptor.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -35,7 +35,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class PackageProtectedInterceptor
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/signature/SignatureTestBean.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/signature/SignatureTestBean.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/signature/SignatureTestBean.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -34,7 +34,7 @@
* Access private bean method interceptor.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@Interceptors(PackageProtectedInterceptor.class)
@ManagedObject
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/signature/unit/SignatureTestCase.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/signature/unit/SignatureTestCase.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/signature/unit/SignatureTestCase.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -39,7 +39,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class SignatureTestCase extends TestCase
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/supermethod/AroundInvokeBase.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/supermethod/AroundInvokeBase.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/supermethod/AroundInvokeBase.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -27,7 +27,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class AroundInvokeBase implements AroundInvokeIF
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/supermethod/AroundInvokeBean.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/supermethod/AroundInvokeBean.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/supermethod/AroundInvokeBean.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -35,7 +35,7 @@
* The real implementation of the methods is on the super class.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@ManagedObject
//@Stateful(name="AroundInvokeBean")
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/supermethod/AroundInvokeIF.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/supermethod/AroundInvokeIF.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/supermethod/AroundInvokeIF.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -26,7 +26,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public interface AroundInvokeIF
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/supermethod/SessionSynchronizationInterceptor.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/supermethod/SessionSynchronizationInterceptor.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/supermethod/SessionSynchronizationInterceptor.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -31,7 +31,7 @@
* A dummy session synchronization AOP interceptor.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class SessionSynchronizationInterceptor implements Interceptor
{
Modified: projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/supermethod/unit/SuperMethodTestCase.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/supermethod/unit/SuperMethodTestCase.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/supermethod/unit/SuperMethodTestCase.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -40,7 +40,7 @@
* the afterBegintTest defined in AroundInvokeBase must contain SessionSynchronizationInterceptor.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class SuperMethodTestCase extends TestCase
{
Modified: projects/ejb3/dev/ejbthree1253/metadata/src/main/java/org/jboss/ejb3/metadata/ComponentMetaDataLoaderFactory.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/metadata/src/main/java/org/jboss/ejb3/metadata/ComponentMetaDataLoaderFactory.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/metadata/src/main/java/org/jboss/ejb3/metadata/ComponentMetaDataLoaderFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -35,7 +35,7 @@
* be instantiated using the interceptor meta data from the bean meta data.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public interface ComponentMetaDataLoaderFactory<M>
{
Modified: projects/ejb3/dev/ejbthree1253/metadata/src/main/java/org/jboss/ejb3/metadata/MetaDataBridge.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/metadata/src/main/java/org/jboss/ejb3/metadata/MetaDataBridge.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/metadata/src/main/java/org/jboss/ejb3/metadata/MetaDataBridge.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -27,7 +27,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public interface MetaDataBridge<M>
{
Modified: projects/ejb3/dev/ejbthree1253/metadata/src/main/java/org/jboss/ejb3/metadata/annotation/ExtendedAnnotationRepository.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/metadata/src/main/java/org/jboss/ejb3/metadata/annotation/ExtendedAnnotationRepository.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/metadata/src/main/java/org/jboss/ejb3/metadata/annotation/ExtendedAnnotationRepository.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -35,7 +35,7 @@
* Note: this is not a full repository, but only an interrogator.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public interface ExtendedAnnotationRepository
{
Modified: projects/ejb3/dev/ejbthree1253/metadata/src/main/java/org/jboss/ejb3/metadata/plugins/loader/AbstractMetaDataLoader.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/metadata/src/main/java/org/jboss/ejb3/metadata/plugins/loader/AbstractMetaDataLoader.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/metadata/src/main/java/org/jboss/ejb3/metadata/plugins/loader/AbstractMetaDataLoader.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -30,7 +30,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public abstract class AbstractMetaDataLoader extends BasicMetaDataLoader
{
Modified: projects/ejb3/dev/ejbthree1253/metadata/src/main/java/org/jboss/ejb3/metadata/plugins/loader/AbstractMethodMetaDataLoader.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/metadata/src/main/java/org/jboss/ejb3/metadata/plugins/loader/AbstractMethodMetaDataLoader.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/metadata/src/main/java/org/jboss/ejb3/metadata/plugins/loader/AbstractMethodMetaDataLoader.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -31,7 +31,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class AbstractMethodMetaDataLoader extends BasicMetaDataLoader
{
Modified: projects/ejb3/dev/ejbthree1253/metadata/src/main/java/org/jboss/ejb3/metadata/plugins/loader/BridgedMetaDataLoader.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/metadata/src/main/java/org/jboss/ejb3/metadata/plugins/loader/BridgedMetaDataLoader.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/metadata/src/main/java/org/jboss/ejb3/metadata/plugins/loader/BridgedMetaDataLoader.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -39,7 +39,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class BridgedMetaDataLoader<M> extends AbstractMetaDataLoader
{
Modified: projects/ejb3/dev/ejbthree1253/metadata/src/main/java/org/jboss/ejb3/metadata/spi/signature/ClassSignature.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/metadata/src/main/java/org/jboss/ejb3/metadata/spi/signature/ClassSignature.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/metadata/src/main/java/org/jboss/ejb3/metadata/spi/signature/ClassSignature.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -29,7 +29,7 @@
* (In EJB 3 you have the bean class and its interceptor classes.)
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class ClassSignature extends Signature
{
Modified: projects/ejb3/dev/ejbthree1253/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/BeanInterceptorMetaDataBridge.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/BeanInterceptorMetaDataBridge.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/BeanInterceptorMetaDataBridge.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -41,7 +41,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class BeanInterceptorMetaDataBridge extends EnvironmentInterceptorMetaDataBridge<JBossEnterpriseBeanMetaData> implements MetaDataBridge<JBossEnterpriseBeanMetaData>
{
Modified: projects/ejb3/dev/ejbthree1253/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/DummyInterceptor.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/DummyInterceptor.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/DummyInterceptor.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -31,7 +31,7 @@
* Note that in ejb3-metadata interceptors can't actually run.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class DummyInterceptor
{
Modified: projects/ejb3/dev/ejbthree1253/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/EnvironmentInterceptorMetaDataBridge.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/EnvironmentInterceptorMetaDataBridge.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/EnvironmentInterceptorMetaDataBridge.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -40,7 +40,7 @@
* Does only interceptor stuff.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class EnvironmentInterceptorMetaDataBridge<M extends Environment> implements MetaDataBridge<M>
{
Modified: projects/ejb3/dev/ejbthree1253/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/InterceptedBean.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/InterceptedBean.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/InterceptedBean.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -27,7 +27,7 @@
* Nothing to see, move along.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class InterceptedBean
{
Modified: projects/ejb3/dev/ejbthree1253/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/InterceptorComponentMetaDataLoaderFactory.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/InterceptorComponentMetaDataLoaderFactory.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/InterceptorComponentMetaDataLoaderFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -39,7 +39,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class InterceptorComponentMetaDataLoaderFactory implements ComponentMetaDataLoaderFactory<JBossEnterpriseBeanMetaData>
{
Modified: projects/ejb3/dev/ejbthree1253/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/InterceptorMetaDataBridge.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/InterceptorMetaDataBridge.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/InterceptorMetaDataBridge.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -33,7 +33,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class InterceptorMetaDataBridge extends EnvironmentInterceptorMetaDataBridge<InterceptorMetaData> implements MetaDataBridge<InterceptorMetaData>
{
Modified: projects/ejb3/dev/ejbthree1253/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/unit/InterceptorTestCase.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/unit/InterceptorTestCase.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/unit/InterceptorTestCase.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -58,7 +58,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class InterceptorTestCase extends TestCase
{
Modified: projects/ejb3/dev/ejbthree1253/metadata/src/test/java/org/jboss/ejb3/test/metadata/securitydomain/SecurityDomainBean.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/metadata/src/test/java/org/jboss/ejb3/test/metadata/securitydomain/SecurityDomainBean.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/metadata/src/test/java/org/jboss/ejb3/test/metadata/securitydomain/SecurityDomainBean.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -26,7 +26,7 @@
* Nothing to see, move along.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class SecurityDomainBean
{
Modified: projects/ejb3/dev/ejbthree1253/metadata/src/test/java/org/jboss/ejb3/test/metadata/securitydomain/SecurityDomainMetaDataBridge.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/metadata/src/test/java/org/jboss/ejb3/test/metadata/securitydomain/SecurityDomainMetaDataBridge.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/metadata/src/test/java/org/jboss/ejb3/test/metadata/securitydomain/SecurityDomainMetaDataBridge.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -33,7 +33,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class SecurityDomainMetaDataBridge implements MetaDataBridge<JBossEnterpriseBeanMetaData>
{
Modified: projects/ejb3/dev/ejbthree1253/metadata/src/test/java/org/jboss/ejb3/test/metadata/securitydomain/unit/SecurityDomainTestCase.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/metadata/src/test/java/org/jboss/ejb3/test/metadata/securitydomain/unit/SecurityDomainTestCase.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/metadata/src/test/java/org/jboss/ejb3/test/metadata/securitydomain/unit/SecurityDomainTestCase.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -43,7 +43,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class SecurityDomainTestCase extends TestCase
{
Modified: projects/ejb3/dev/ejbthree1253/pool/src/main/java/org/jboss/ejb3/pool/Pool.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/pool/src/main/java/org/jboss/ejb3/pool/Pool.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/pool/src/main/java/org/jboss/ejb3/pool/Pool.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -28,7 +28,7 @@
* is left beyond scope.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public interface Pool<T>
{
Modified: projects/ejb3/dev/ejbthree1253/pool/src/main/java/org/jboss/ejb3/pool/StatelessObjectFactory.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/pool/src/main/java/org/jboss/ejb3/pool/StatelessObjectFactory.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/pool/src/main/java/org/jboss/ejb3/pool/StatelessObjectFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -28,7 +28,7 @@
* callback, if defined, has been called.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public interface StatelessObjectFactory<T>
{
Modified: projects/ejb3/dev/ejbthree1253/pool/src/main/java/org/jboss/ejb3/pool/inifinite/InfinitePool.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/pool/src/main/java/org/jboss/ejb3/pool/inifinite/InfinitePool.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/pool/src/main/java/org/jboss/ejb3/pool/inifinite/InfinitePool.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -31,7 +31,7 @@
* A pool that has no constraints.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class InfinitePool<T> implements Pool<T>
{
Modified: projects/ejb3/dev/ejbthree1253/pool/src/main/java/org/jboss/ejb3/pool/strictmax/StrictMaxPool.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/pool/src/main/java/org/jboss/ejb3/pool/strictmax/StrictMaxPool.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/pool/src/main/java/org/jboss/ejb3/pool/strictmax/StrictMaxPool.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -33,7 +33,7 @@
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
* @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class StrictMaxPool<T> implements Pool<T>
{
Modified: projects/ejb3/dev/ejbthree1253/pool/src/main/java/org/jboss/ejb3/pool/threadlocal/ThreadLocalPool.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/pool/src/main/java/org/jboss/ejb3/pool/threadlocal/ThreadLocalPool.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/pool/src/main/java/org/jboss/ejb3/pool/threadlocal/ThreadLocalPool.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -30,7 +30,7 @@
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
* @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class ThreadLocalPool<T> implements Pool<T>
{
Modified: projects/ejb3/dev/ejbthree1253/pool/src/main/java/org/jboss/ejb3/pool/threadlocal/WeakThreadLocal.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/pool/src/main/java/org/jboss/ejb3/pool/threadlocal/WeakThreadLocal.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/pool/src/main/java/org/jboss/ejb3/pool/threadlocal/WeakThreadLocal.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -29,7 +29,7 @@
* This class will only keep a weak reference so garbage collections works.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class WeakThreadLocal<T>
{
Modified: projects/ejb3/dev/ejbthree1253/pool/src/test/java/org/jboss/ejb3/test/pool/common/MockBean.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/pool/src/test/java/org/jboss/ejb3/test/pool/common/MockBean.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/pool/src/test/java/org/jboss/ejb3/test/pool/common/MockBean.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -25,7 +25,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class MockBean
{
Modified: projects/ejb3/dev/ejbthree1253/pool/src/test/java/org/jboss/ejb3/test/pool/common/MockFactory.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/pool/src/test/java/org/jboss/ejb3/test/pool/common/MockFactory.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/pool/src/test/java/org/jboss/ejb3/test/pool/common/MockFactory.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -27,7 +27,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class MockFactory implements StatelessObjectFactory<MockBean>
{
Modified: projects/ejb3/dev/ejbthree1253/pool/src/test/java/org/jboss/ejb3/test/pool/infinite/InfinitePoolUnitTestCase.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/pool/src/test/java/org/jboss/ejb3/test/pool/infinite/InfinitePoolUnitTestCase.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/pool/src/test/java/org/jboss/ejb3/test/pool/infinite/InfinitePoolUnitTestCase.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -33,7 +33,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class InfinitePoolUnitTestCase extends TestCase
{
Modified: projects/ejb3/dev/ejbthree1253/pool/src/test/java/org/jboss/ejb3/test/pool/strictmax/StrictMaxUnitTestCase.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/pool/src/test/java/org/jboss/ejb3/test/pool/strictmax/StrictMaxUnitTestCase.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/pool/src/test/java/org/jboss/ejb3/test/pool/strictmax/StrictMaxUnitTestCase.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -39,7 +39,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class StrictMaxUnitTestCase extends TestCase
{
Modified: projects/ejb3/dev/ejbthree1253/pool/src/test/java/org/jboss/ejb3/test/pool/threadlocal/ThreadLocalPoolUnitTestCase.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/pool/src/test/java/org/jboss/ejb3/test/pool/threadlocal/ThreadLocalPoolUnitTestCase.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/pool/src/test/java/org/jboss/ejb3/test/pool/threadlocal/ThreadLocalPoolUnitTestCase.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -39,7 +39,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class ThreadLocalPoolUnitTestCase extends TestCase
{
Modified: projects/ejb3/dev/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/interceptorcontainer/ContainerInterceptors.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/interceptorcontainer/ContainerInterceptors.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/interceptorcontainer/ContainerInterceptors.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -32,7 +32,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@Inherited
@Retention(RetentionPolicy.RUNTIME)
Modified: projects/ejb3/dev/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/interceptorcontainer/InterceptorContainer.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/interceptorcontainer/InterceptorContainer.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/interceptorcontainer/InterceptorContainer.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -38,7 +38,7 @@
* on a class.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@Interceptors(ContainersInterceptorsInterceptor.class)
@ManagedObject
Modified: projects/ejb3/dev/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/interceptorcontainer/impl/BusinessMethodInterceptorMethodInterceptor.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/interceptorcontainer/impl/BusinessMethodInterceptorMethodInterceptor.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/interceptorcontainer/impl/BusinessMethodInterceptorMethodInterceptor.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -36,7 +36,7 @@
* FIXME: merge with org.jboss.ejb3.interceptors.aop.BusinessMethodInterceptorMethodInterceptor
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class BusinessMethodInterceptorMethodInterceptor implements InterceptorInvoker
{
Modified: projects/ejb3/dev/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/interceptorcontainer/impl/ContainerInterceptorsExecutor.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/interceptorcontainer/impl/ContainerInterceptorsExecutor.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/interceptorcontainer/impl/ContainerInterceptorsExecutor.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -40,7 +40,7 @@
* This is the runtime representation of ContainerInterceptors
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class ContainerInterceptorsExecutor
{
Modified: projects/ejb3/dev/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/interceptorcontainer/impl/ContainersInterceptorsInterceptor.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/interceptorcontainer/impl/ContainersInterceptorsInterceptor.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/interceptorcontainer/impl/ContainersInterceptorsInterceptor.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -36,7 +36,7 @@
* and executes them.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class ContainersInterceptorsInterceptor
{
Modified: projects/ejb3/dev/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/interceptorcontainer/impl/InterceptorInvoker.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/interceptorcontainer/impl/InterceptorInvoker.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/interceptorcontainer/impl/InterceptorInvoker.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -27,7 +27,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public interface InterceptorInvoker
{
Modified: projects/ejb3/dev/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/interceptorcontainer/impl/LifecycleCallbackInterceptorMethodInterceptor.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/interceptorcontainer/impl/LifecycleCallbackInterceptorMethodInterceptor.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/interceptorcontainer/impl/LifecycleCallbackInterceptorMethodInterceptor.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -36,7 +36,7 @@
* FIXME: merge with org.jboss.ejb3.interceptors.aop.LifecycleCallbackInterceptorMethodInterceptor
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class LifecycleCallbackInterceptorMethodInterceptor implements InterceptorInvoker
{
Modified: projects/ejb3/dev/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/local/LocalBusinessInterfaceInterceptor.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/local/LocalBusinessInterfaceInterceptor.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/local/LocalBusinessInterfaceInterceptor.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -38,7 +38,7 @@
* Creates and binds a proxy for invoking beans over a local interface.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class LocalBusinessInterfaceInterceptor
{
Modified: projects/ejb3/dev/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/local/LocalProxy.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/local/LocalProxy.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/local/LocalProxy.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -30,7 +30,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class LocalProxy implements InvocationHandler
{
Modified: projects/ejb3/dev/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/mc/MC.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/mc/MC.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/mc/MC.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -34,7 +34,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class MC
{
Modified: projects/ejb3/dev/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/stateless/StatelessBeanContext.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/stateless/StatelessBeanContext.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/stateless/StatelessBeanContext.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -25,7 +25,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public interface StatelessBeanContext
{
Modified: projects/ejb3/dev/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/stateless/StatelessContainer.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/stateless/StatelessContainer.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/sandbox/src/main/java/org/jboss/ejb3/sandbox/stateless/StatelessContainer.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -30,7 +30,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class StatelessContainer extends InterceptorContainer
{
Modified: projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/interceptorinterceptor/InterceptedInterceptor.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/interceptorinterceptor/InterceptedInterceptor.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/interceptorinterceptor/InterceptedInterceptor.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -30,7 +30,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class InterceptedInterceptor
{
Modified: projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/interceptorinterceptor/InterceptorInterceptor.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/interceptorinterceptor/InterceptorInterceptor.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/interceptorinterceptor/InterceptorInterceptor.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -30,7 +30,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class InterceptorInterceptor
{
Modified: projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/interceptorinterceptor/InterceptorInterceptorBean.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/interceptorinterceptor/InterceptorInterceptorBean.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/interceptorinterceptor/InterceptorInterceptorBean.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -30,7 +30,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@ManagedObject
@Interceptors(InterceptedInterceptor.class)
Modified: projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/interceptorinterceptor/InterceptorInterceptors.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/interceptorinterceptor/InterceptorInterceptors.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/interceptorinterceptor/InterceptorInterceptors.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -31,7 +31,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
//@Inherited
@Documented
Modified: projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/interceptorinterceptor/unit/InterceptorInterceptorUnitTestCase.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/interceptorinterceptor/unit/InterceptorInterceptorUnitTestCase.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/interceptorinterceptor/unit/InterceptorInterceptorUnitTestCase.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -34,7 +34,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class InterceptorInterceptorUnitTestCase extends TestCase
{
Modified: projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/performance/Calculator.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/performance/Calculator.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/performance/Calculator.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -27,7 +27,7 @@
* This one can only calculate PI
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public interface Calculator
{
Modified: projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/performance/CalculatorBean.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/performance/CalculatorBean.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/performance/CalculatorBean.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -34,7 +34,7 @@
* The calculator bean just delegates to Pi.
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@ContainerInterceptors({ LocalBusinessInterfaceInterceptor.class, StatelessInterceptor.class })
@Stateless
Modified: projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/performance/unit/EJBUnitTestCase.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/performance/unit/EJBUnitTestCase.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/performance/unit/EJBUnitTestCase.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -41,7 +41,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class EJBUnitTestCase extends TestCase
{
Modified: projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/performance/unit/MCUnitTestCase.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/performance/unit/MCUnitTestCase.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/performance/unit/MCUnitTestCase.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -33,7 +33,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class MCUnitTestCase extends TestCase
{
Modified: projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/stateless/SimpleStatelessBean.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/stateless/SimpleStatelessBean.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/stateless/SimpleStatelessBean.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -32,7 +32,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@ContainerInterceptors({ LocalBusinessInterfaceInterceptor.class, StatelessInterceptor.class })
@Stateless
Modified: projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/stateless/SimpleStatelessLocal.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/stateless/SimpleStatelessLocal.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/stateless/SimpleStatelessLocal.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -27,7 +27,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@Local
public interface SimpleStatelessLocal
Modified: projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/stateless/unit/SimpleStatelessUnitTestCase.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/stateless/unit/SimpleStatelessUnitTestCase.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/stateless/unit/SimpleStatelessUnitTestCase.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -39,7 +39,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class SimpleStatelessUnitTestCase extends TestCase
{
Modified: projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/tx/TxInterceptor.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/tx/TxInterceptor.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/tx/TxInterceptor.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -37,7 +37,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class TxInterceptor
{
Modified: projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/tx/TxStatelessBean.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/tx/TxStatelessBean.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/tx/TxStatelessBean.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -34,7 +34,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@ContainerInterceptors({ LocalBusinessInterfaceInterceptor.class, TxInterceptor.class, StatelessInterceptor.class })
@Stateless
Modified: projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/tx/TxStatelessLocal.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/tx/TxStatelessLocal.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/tx/TxStatelessLocal.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -27,7 +27,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
@Local
public interface TxStatelessLocal
Modified: projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/tx/unit/TxStatelessUnitTestCase.java
===================================================================
--- projects/ejb3/branches/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/tx/unit/TxStatelessUnitTestCase.java 2008-04-08 08:34:43 UTC (rev 71778)
+++ projects/ejb3/dev/ejbthree1253/sandbox/src/test/java/org/jboss/ejb3/test/sandbox/tx/unit/TxStatelessUnitTestCase.java 2008-04-08 18:59:49 UTC (rev 71803)
@@ -41,7 +41,7 @@
* Comment
*
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
+ * @version $Revision$
*/
public class TxStatelessUnitTestCase extends TestCase
{
More information about the jboss-cvs-commits
mailing list