Index: src/test/java/org/jboss/ejb3/core/test/regression/ejbthree1253/unit/OverriddenProxyFactoryTestCase.java =================================================================== --- src/test/java/org/jboss/ejb3/core/test/regression/ejbthree1253/unit/OverriddenProxyFactoryTestCase.java (revision 83932) +++ src/test/java/org/jboss/ejb3/core/test/regression/ejbthree1253/unit/OverriddenProxyFactoryTestCase.java (working copy) @@ -36,7 +36,6 @@ import org.jboss.ejb3.core.test.common.MockEjb3Deployment; import org.jboss.ejb3.core.test.regression.ejbthree1253.MyStateful; import org.jboss.ejb3.core.test.regression.ejbthree1253.MyStatefulBean; -import org.jboss.ejb3.proxy.factory.RemoteProxyFactoryRegistry; import org.jboss.ejb3.stateful.StatefulContainer; import org.jboss.ejb3.test.cachepassivation.MockDeploymentUnit; import org.jboss.ejb3.test.common.MetaDataHelper; @@ -62,7 +61,6 @@ Hashtable ctxProperties = null; Ejb3Deployment deployment = new MockEjb3Deployment(new MockDeploymentUnit()); deployment.setPersistenceManagerFactoryRegistry(getBootstrap().lookup("EJB3PersistenceManagerFactoryRegistry", PersistenceManagerFactoryRegistry.class)); - deployment.setRemoteProxyFactoryRegistry(getBootstrap().lookup("EJB3RemoteProxyFactoryRegistry", RemoteProxyFactoryRegistry.class)); JBossSessionBeanMetaData beanMetaData = MetaDataHelper.getMetadataFromBeanImplClass(MyStatefulBean.class); StatefulContainer container = new StatefulContainer(cl, beanClassname, ejbName, domain, ctxProperties, deployment, beanMetaData); Index: src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java =================================================================== --- src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java (revision 83932) +++ src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java (working copy) @@ -11,10 +11,8 @@ import javax.ejb.RemoveException; import javax.ejb.SessionContext; -import org.jboss.aop.Dispatcher; import org.jboss.aop.Domain; import org.jboss.aop.MethodInfo; -import org.jboss.aop.proxy.ClassProxy; import org.jboss.aop.util.MethodHashing; import org.jboss.ejb3.Ejb3Deployment; import org.jboss.ejb3.ThreadLocalStack; @@ -71,53 +69,53 @@ 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(String businessInterfaceType) throws Exception - { - RemoteBinding binding = this.getRemoteBinding(); - return this.createProxyRemoteEjb21(binding, businessInterfaceType); - } +// /** +// * 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; /** - * 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, String businessInterfaceType) throws Exception; - - /** - * Create a local proxy (EJBLocalObject) for an enterprise bean identified by id - * - * @param id - * @return - * @throws Exception - */ - public Object createProxyLocalEjb21(String businessInterfaceType) throws Exception - { - LocalBinding binding = this.getAnnotation(LocalBinding.class); - return this.createProxyLocalEjb21(binding, businessInterfaceType); - } - - /** - * 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, String businessInterfaceType) throws Exception; - - /** * Invokes the method described by the specified serializable method * as called from the specified proxy, using the specified arguments * Index: src/main/java/org/jboss/ejb3/session/ProxyDeployer.java =================================================================== --- src/main/java/org/jboss/ejb3/session/ProxyDeployer.java (revision 83932) +++ src/main/java/org/jboss/ejb3/session/ProxyDeployer.java (working copy) @@ -24,10 +24,7 @@ import java.lang.reflect.Constructor; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; import java.util.List; -import java.util.Map; import org.jboss.ejb3.annotation.LocalBinding; import org.jboss.ejb3.annotation.RemoteBinding; @@ -36,10 +33,7 @@ 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.proxy.ProxyFactory; import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper; -import org.jboss.ejb3.proxy.factory.RemoteProxyFactory; -import org.jboss.ejb3.service.ServiceContainer; import org.jboss.logging.Logger; import org.jboss.metadata.ejb.spec.BusinessRemotesMetaData; @@ -54,7 +48,6 @@ { private static final Logger log = Logger.getLogger(ProxyDeployer.class); private SessionContainer container; - private Map proxyFactories = new HashMap(); private RemoteBindings remoteBindings; private LocalBinding localBinding; @@ -96,51 +89,6 @@ } } - public Map 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)) - { - //TODO Only used in @Service now, this whole class is @Deprecated - factory = ((ServiceContainer)container).getProxyFactoryForService(binding); - } - else - { - Class remoteFactoryClass = container.getDeployment().getRemoteProxyFactoryRegistry().getProxyFactoryClass(binding.factory()); - Constructor constructor = getConstructor(remoteFactoryClass, container.getClass(), 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"; @@ -226,13 +174,4 @@ } } - public void stop() throws Exception - { - // Stop all proxy factories - Collection proxyFactories = this.getProxyFactories().values(); - for(ProxyFactory factory : proxyFactories) - { - factory.stop(); - } - } } Index: src/main/java/org/jboss/ejb3/session/SessionContainer.java =================================================================== --- src/main/java/org/jboss/ejb3/session/SessionContainer.java (revision 83932) +++ src/main/java/org/jboss/ejb3/session/SessionContainer.java (working copy) @@ -48,7 +48,6 @@ import org.jboss.aop.joinpoint.InvocationResponse; import org.jboss.aop.proxy.ClassProxy; import org.jboss.aop.util.MethodHashing; -import org.jboss.aspects.asynch.FutureHolder; import org.jboss.ejb3.EJBContainer; import org.jboss.ejb3.Ejb3Deployment; import org.jboss.ejb3.Ejb3Module; @@ -59,12 +58,11 @@ import org.jboss.ejb3.common.registrar.spi.Ejb3Registrar; import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator; import org.jboss.ejb3.common.registrar.spi.NotBoundException; -import org.jboss.ejb3.proxy.ProxyUtils; import org.jboss.ejb3.proxy.clustered.objectstore.ClusteredObjectStoreBindings; import org.jboss.ejb3.proxy.clustered.registry.ProxyClusteringRegistry; import org.jboss.ejb3.proxy.container.InvokableContext; import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper; -import org.jboss.ejb3.proxy.factory.SessionProxyFactory; +import org.jboss.ejb3.proxy.factory.session.SessionProxyFactory; import org.jboss.ejb3.proxy.jndiregistrar.JndiSessionRegistrarBase; import org.jboss.ejb3.remoting.IsLocalInterceptor; import org.jboss.ejb3.stateful.StatefulContainerInvocation; @@ -120,19 +118,43 @@ proxyDeployer = new ProxyDeployer(this); } - /** - * Create a local proxy factory. - * @return - */ - protected abstract SessionProxyFactory getProxyFactory(LocalBinding binding); + protected SessionProxyFactory getProxyFactory(LocalBinding binding) + { + assert binding!=null : LocalBinding.class.getSimpleName() + " must be specified"; + + // Get the Registry name + String proxyFactoryRegistryBindName = this.getJndiRegistrar().getProxyFactoryRegistryKey(binding.jndiBinding(), this.getMetaData(), true); + + // Return + return this.getProxyFactory(proxyFactoryRegistryBindName); + } + protected SessionProxyFactory getProxyFactory(RemoteBinding binding) + { + assert binding!=null : RemoteBinding.class.getSimpleName() + " must be specified"; + + // Get the Registry name + String proxyFactoryRegistryBindName = this.getJndiRegistrar().getProxyFactoryRegistryKey(binding.jndiBinding(), this.getMetaData(), true); + + // Return + return this.getProxyFactory(proxyFactoryRegistryBindName); + } + /** - * Create a remote proxy factory on the given binding. + * Obtains the proxy factory bound at the specified registry name * - * @param binding + * @param proxyFactoryRegistryBindName * @return */ - protected abstract org.jboss.ejb3.proxy.factory.session.SessionProxyFactory getProxyFactory(RemoteBinding binding); + protected SessionProxyFactory getProxyFactory(String proxyFactoryRegistryBindName) + { + // Lookup + SessionProxyFactory factory = Ejb3RegistrarLocator.locateRegistrar().lookup(proxyFactoryRegistryBindName, + SessionProxyFactory.class); + + // Return + return factory; + } /** * Entry point for remoting-based invocations via InvokableContextClassProxyHack @@ -584,7 +606,7 @@ * @deprecated Use "invoke" as defined by InvokableContext */ @Deprecated - public Object invoke(SessionProxyFactory factory, Object id, Method method, Object args[], FutureHolder provider) throws Throwable + public Object invoke(SessionProxyFactory factory, Object id, Method method, Object args[]) throws Throwable { ClassLoader oldLoader = Thread.currentThread().getContextClassLoader(); pushEnc(); @@ -621,7 +643,6 @@ // allow a container to supplement information into an invocation nextInvocation = populateInvocation(nextInvocation); - ProxyUtils.addLocalAsynchronousInfo(nextInvocation, provider); return nextInvocation.invokeNext(); } finally @@ -640,7 +661,7 @@ */ abstract public Serializable createSession(Class initParameterTypes[], Object initParameterValues[]); - abstract public Object localInvoke(Object id, Method method, Object[] args, FutureHolder provider) throws Throwable; + abstract public Object localInvoke(Object id, Method method, Object[] args) throws Throwable; abstract public Object localHomeInvoke(Method method, Object[] args) throws Throwable; Index: src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java =================================================================== --- src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java (revision 83932) +++ src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java (working copy) @@ -50,10 +50,8 @@ import org.jboss.aop.joinpoint.InvocationResponse; 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.Ejb3Deployment; -import org.jboss.ejb3.Ejb3Registry; import org.jboss.ejb3.annotation.Cache; import org.jboss.ejb3.annotation.CacheConfig; import org.jboss.ejb3.annotation.Clustered; @@ -65,19 +63,12 @@ import org.jboss.ejb3.cache.StatefulCache; import org.jboss.ejb3.cache.StatefulObjectFactory; import org.jboss.ejb3.common.lang.SerializableMethod; -import org.jboss.ejb3.common.registrar.spi.Ejb3Registrar; import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator; import org.jboss.ejb3.interceptors.container.StatefulSessionContainerMethodInvocation; -import org.jboss.ejb3.proxy.ProxyUtils; -import org.jboss.ejb3.proxy.clustered.factory.session.stateful.StatefulSessionClusteredProxyFactory; import org.jboss.ejb3.proxy.clustered.objectstore.ClusteredObjectStoreBindings; -import org.jboss.ejb3.proxy.clustered.registry.ProxyClusteringRegistry; import org.jboss.ejb3.proxy.container.StatefulSessionInvokableContext; import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper; import org.jboss.ejb3.proxy.factory.session.stateful.StatefulSessionProxyFactory; -import org.jboss.ejb3.proxy.factory.session.stateful.StatefulSessionRemoteProxyFactory; -import org.jboss.ejb3.proxy.factory.stateful.StatefulLocalProxyFactory; -import org.jboss.ejb3.proxy.factory.stateful.StatefulRemoteProxyFactory; import org.jboss.ejb3.proxy.impl.EJBMetaDataImpl; import org.jboss.ejb3.proxy.impl.HomeHandleImpl; import org.jboss.ejb3.proxy.jndiregistrar.JndiSessionRegistrarBase; @@ -92,6 +83,7 @@ import org.jboss.injection.JndiPropertyInjector; import org.jboss.logging.Logger; import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData; +import org.jboss.util.NotImplementedException; /** @@ -158,110 +150,30 @@ return new StatefulBeanContext(this, construct()); } - @Override - protected StatefulLocalProxyFactory getProxyFactory(LocalBinding binding) + public Object createProxyLocalEjb21(Object id, LocalBinding binding) throws Exception { - 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; + StatefulSessionProxyFactory proxyFactory = (StatefulSessionProxyFactory)this.getProxyFactory(binding); + return proxyFactory.createProxyEjb2x((Serializable)id); } - public Object createProxyLocalEjb21(Object id, LocalBinding binding, String businessInterfaceType) throws Exception + public Object createProxyRemoteEjb21(Object id) throws Exception { - StatefulLocalProxyFactory proxyFactory = this.getProxyFactory(binding); - return proxyFactory.createProxyEjb21(id,businessInterfaceType); - } - - public Object createProxyRemoteEjb21(Object id, String businessInterfaceType) throws Exception - { RemoteBinding binding = this.getRemoteBinding(); - return this.createProxyRemoteEjb21(id,binding, businessInterfaceType); + return this.createProxyRemoteEjb21(id,binding); } - public Object createProxyRemoteEjb21(Object id, RemoteBinding binding, String businessInterfaceType) throws Exception + public Object createProxyRemoteEjb21(Object id, RemoteBinding binding) throws Exception { - StatefulSessionProxyFactory proxyFactory = this.getProxyFactory(binding); + StatefulSessionProxyFactory proxyFactory = (StatefulSessionProxyFactory)this.getProxyFactory(binding); return proxyFactory.createProxyEjb2x((Serializable)id); } - public Object createProxyLocalEjb21(Object id, String businessInterfaceType) throws Exception + public Object createProxyLocalEjb21(Object id) throws Exception { LocalBinding binding = this.getAnnotation(LocalBinding.class); - return this.createProxyLocalEjb21(id,binding, businessInterfaceType); + return this.createProxyLocalEjb21(id,binding); } - @Override - public Object createProxyLocalEjb21(LocalBinding binding, String businessInterfaceType) throws Exception - { - Object id = this.createSession(); - return this.createProxyLocalEjb21(id,binding, businessInterfaceType); - } - - @Override - public Object createProxyRemoteEjb21(RemoteBinding binding, String businessInterfaceType) throws Exception - { - Object id = this.createSession(); - return this.createProxyRemoteEjb21(id, binding, businessInterfaceType); - } - - @Override - protected StatefulSessionProxyFactory getProxyFactory(RemoteBinding binding) - { - //TODO Should be obtained from JNDI Registrar, needs to be looked up by a @RemoteBinding key - - /* - * In this implementation we just make a new Proxy Factory, for now - */ - - // Initialize - StatefulSessionProxyFactory factory = null; - - // If Clustered - if (this.isAnnotationPresent(Clustered.class)) - { - // Get the Proxy Clustering Registry - Ejb3Registrar registrar = Ejb3RegistrarLocator.locateRegistrar(); - String mcName = ClusteredObjectStoreBindings.CLUSTERED_OBJECTSTORE_BEAN_NAME_PROXY_CLUSTERING_REGISTRY; - ProxyClusteringRegistry registry = (ProxyClusteringRegistry) registrar.lookup(mcName); - assert registry != null : "Could not find " + ProxyClusteringRegistry.class.getSimpleName() + " in the " - + Ejb3Registrar.class.getSimpleName() + " under name " + mcName; - factory = new StatefulSessionClusteredProxyFactory(this.getName(), this.getName(), Ejb3Registry.guid(this), - this.getMetaData(), this.getClassloader(), binding.clientBindUrl(), this.getAdvisor(), registry, null); - } - else - { - factory = new StatefulSessionRemoteProxyFactory(this.getName(), this.getName(), Ejb3Registry.guid(this), this - .getMetaData(), this.getClassloader(), binding.clientBindUrl(), this.getAdvisor(), null); - } - - // Start the Factory - try - { - factory.start(); - } - catch (Exception e) - { - throw new RuntimeException("Could not start " + factory, e); - } - - // Return - return factory; - } - public void destroy(StatefulBeanContext ctx) { try @@ -364,15 +276,6 @@ } /** - * 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 * */ @@ -404,8 +307,7 @@ * * @param provider If null a synchronous invocation, otherwise an asynchronous */ - public Object localInvoke(Object id, Method method, Object[] args, - FutureHolder provider) throws Throwable + public Object localInvoke(Object id, Method method, Object[] args) throws Throwable { long start = System.currentTimeMillis(); @@ -446,8 +348,6 @@ nextInvocation.setAdvisor(getAdvisor()); nextInvocation.setArguments(args); - ProxyUtils.addLocalAsynchronousInfo(nextInvocation, provider); - //invokedMethod.push(invoked); return nextInvocation.invokeNext(); } @@ -957,39 +857,40 @@ 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, unadvisedMethod.getReturnType().getName()); - - return proxy; - } - else if (unadvisedMethod.getName().equals("remove")) - { - remove(args[0]); - - return null; - } - else - { - return null; - } + throw new NotImplementedException("EJBTHREE-1641"); +// 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, unadvisedMethod.getReturnType().getName()); +// +// return proxy; +// } +// else if (unadvisedMethod.getName().equals("remove")) +// { +// remove(args[0]); +// +// return null; +// } +// else +// { +// return null; +// } } public Object createLocalProxy(Object id) throws Exception @@ -999,21 +900,23 @@ public Object createLocalProxy(Object id, LocalBinding binding) throws Exception { - StatefulLocalProxyFactory factory = new StatefulLocalProxyFactory(this, binding); - factory.init(); - - return factory.createProxyBusiness(id); + throw new NotImplementedException("EJBTHREE-1641"); +// 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,null); - else - return factory.createProxyBusiness(); + throw new NotImplementedException("EJBTHREE-1641"); +// StatefulRemoteProxyFactory factory = new StatefulRemoteProxyFactory(this, binding); +// factory.init(); +// +// if (id != null) +// return factory.createProxyBusiness(id,null); +// else +// return factory.createProxyBusiness(); } public boolean isClustered() Index: src/main/java/org/jboss/ejb3/service/ServiceContainer.java =================================================================== --- src/main/java/org/jboss/ejb3/service/ServiceContainer.java (revision 83932) +++ src/main/java/org/jboss/ejb3/service/ServiceContainer.java (working copy) @@ -51,26 +51,19 @@ 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.beans.metadata.api.annotations.Inject; import org.jboss.ejb.AllowedOperationsAssociation; import org.jboss.ejb.AllowedOperationsFlags; import org.jboss.ejb3.BeanContext; import org.jboss.ejb3.DependencyPolicy; import org.jboss.ejb3.Ejb3Deployment; -import org.jboss.ejb3.Ejb3Registry; 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.common.lang.SerializableMethod; import org.jboss.ejb3.proxy.clustered.objectstore.ClusteredObjectStoreBindings; import org.jboss.ejb3.proxy.container.InvokableContext; -import org.jboss.ejb3.proxy.factory.RemoteProxyFactory; -import org.jboss.ejb3.proxy.factory.session.SessionProxyFactory; -import org.jboss.ejb3.proxy.factory.session.service.ServiceRemoteProxyFactory; import org.jboss.ejb3.proxy.objectstore.ObjectStoreBindings; import org.jboss.ejb3.session.SessionContainer; import org.jboss.ejb3.stateful.StatefulContainerInvocation; @@ -160,52 +153,6 @@ return new ServiceBeanContext(this, singleton); } - @Override - @Deprecated - protected org.jboss.ejb3.proxy.factory.SessionProxyFactory getProxyFactory(LocalBinding binding) - { - throw new NotImplementedException("@Service container is using old Proxy mechanism"); - } - - @Override - protected SessionProxyFactory getProxyFactory(RemoteBinding binding) - { - //TODO Should be obtained from JNDI Registrar, needs to be looked up by a @RemoteBinding key - - /* - * In this implementation we just make a new Proxy Factory, for now - */ - - // Create - SessionProxyFactory factory = new ServiceRemoteProxyFactory(this.getName(), this.getName(), Ejb3Registry - .guid(this), (JBossServiceBeanMetaData) this.getMetaData(), this.getClassloader(), binding.clientBindUrl(), - this.getAdvisor(), binding.interceptorStack()); - - // Start the factory - try - { - factory.start(); - } - catch (Exception e) - { - throw new RuntimeException("Error in starting " + factory, e); - } - - // Return - return factory; - } - - /** - * @param binding - * @return - * @deprecated Until @Service uses EJB3 Proxy - */ - @Deprecated - public RemoteProxyFactory getProxyFactoryForService(RemoteBinding binding) - { - throw new NotImplementedException(this + " is no longer using unsupported (legacy) proxy impl from ejb3-core"); - } - // TODO: integrate with StatelessContainer.initializeTimeout private void initializeTimeoutMethod() { @@ -459,9 +406,9 @@ //Ignore } - public Object localInvoke(Object id, Method method, Object[] args, FutureHolder provider) throws Throwable + public Object localInvoke(Object id, Method method, Object[] args) throws Throwable { - return localInvoke(method, args, provider); + return localInvoke(method, args); } public Object localHomeInvoke(Method method, Object[] args) throws Throwable @@ -471,19 +418,11 @@ } /** - * 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 + public Object localInvoke(Method method, Object[] args) throws Throwable { long start = System.currentTimeMillis(); @@ -505,13 +444,6 @@ 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 Index: src/main/java/org/jboss/ejb3/LocalProxyInvocationHandler.java =================================================================== --- src/main/java/org/jboss/ejb3/LocalProxyInvocationHandler.java (revision 83932) +++ src/main/java/org/jboss/ejb3/LocalProxyInvocationHandler.java (working copy) @@ -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; - -import java.io.Externalizable; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.lang.reflect.InvocationHandler; - -import org.jboss.ejb3.proxy.handler.BaseProxyInvocationHandler; -import org.jboss.ejb3.proxy.handler.ProxyInvocationHandlerDeprecated; -import org.jboss.logging.Logger; - -/** - * Comment - * - * @author Bill Burke - * @version $Revision$ - */ -public abstract class LocalProxyInvocationHandler extends BaseProxyInvocationHandler implements InvocationHandler, Externalizable, ProxyInvocationHandlerDeprecated -{ - private static Logger log = Logger.getLogger(LocalProxyInvocationHandler.class); - - private transient Container container = null; - - protected String containerClusterUid; - - protected String containerGuid; - - protected String proxyName; - - protected LocalProxyInvocationHandler() - { - } - - protected LocalProxyInvocationHandler(Container container, String businessInterfaceType) - { - this.setBusinessInterfaceType(businessInterfaceType); - this.container = container; - this.containerGuid = Ejb3Registry.guid(container); - this.containerClusterUid = Ejb3Registry.clusterUid(container); - proxyName = container.getEjbName(); - } - - protected Container getContainer() - { - if (container == null) - container = Ejb3Registry.findContainer(containerGuid); - if (container == null) - log.warn("Container " + containerGuid + " is not yet available"); - return container; - } - - public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException - { - this.containerGuid = in.readUTF(); - this.containerClusterUid = in.readUTF(); - this.proxyName = in.readUTF(); - } - - public void writeExternal(ObjectOutput out) throws IOException - { - out.writeUTF(containerGuid); - out.writeUTF(containerClusterUid); - out.writeUTF(proxyName); - } - - public abstract String toString(); - -} Index: src/main/java/org/jboss/ejb3/stateless/StatelessSessionContextImpl.java =================================================================== --- src/main/java/org/jboss/ejb3/stateless/StatelessSessionContextImpl.java (revision 83932) +++ src/main/java/org/jboss/ejb3/stateless/StatelessSessionContextImpl.java (working copy) @@ -51,7 +51,7 @@ { try { - EJBLocalObject proxy = (EJBLocalObject) container.createProxyLocalEjb21(null); + EJBLocalObject proxy = (EJBLocalObject) (StatelessContainer) container.createProxyLocalEjb21(); return proxy; } catch (Exception e) @@ -65,7 +65,7 @@ { try { - EJBObject proxy = (EJBObject) container.createProxyRemoteEjb21(null); + EJBObject proxy = (EJBObject) container.createProxyRemoteEjb21(); return proxy; } catch (Exception e) Index: src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java =================================================================== --- src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java (revision 83932) +++ src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java (working copy) @@ -45,7 +45,6 @@ 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.beans.metadata.api.annotations.Inject; import org.jboss.ejb.AllowedOperationsAssociation; import org.jboss.ejb.AllowedOperationsFlags; @@ -53,25 +52,17 @@ import org.jboss.ejb3.BeanContextLifecycleCallback; import org.jboss.ejb3.EJBContainerInvocation; import org.jboss.ejb3.Ejb3Deployment; -import org.jboss.ejb3.Ejb3Registry; import org.jboss.ejb3.annotation.Clustered; import org.jboss.ejb3.annotation.LocalBinding; import org.jboss.ejb3.annotation.RemoteBinding; import org.jboss.ejb3.annotation.RemoteHomeBinding; import org.jboss.ejb3.common.lang.SerializableMethod; -import org.jboss.ejb3.common.registrar.spi.Ejb3Registrar; import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator; -import org.jboss.ejb3.proxy.ProxyUtils; -import org.jboss.ejb3.proxy.clustered.factory.session.stateless.StatelessSessionClusteredProxyFactory; import org.jboss.ejb3.proxy.clustered.objectstore.ClusteredObjectStoreBindings; -import org.jboss.ejb3.proxy.clustered.registry.ProxyClusteringRegistry; import org.jboss.ejb3.proxy.container.InvokableContext; import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper; -import org.jboss.ejb3.proxy.factory.session.SessionProxyFactory; import org.jboss.ejb3.proxy.factory.session.SessionSpecProxyFactory; import org.jboss.ejb3.proxy.factory.session.stateless.StatelessSessionProxyFactoryBase; -import org.jboss.ejb3.proxy.factory.session.stateless.StatelessSessionRemoteProxyFactory; -import org.jboss.ejb3.proxy.factory.stateless.StatelessLocalProxyFactory; import org.jboss.ejb3.proxy.impl.EJBMetaDataImpl; import org.jboss.ejb3.proxy.jndiregistrar.JndiSessionRegistrarBase; import org.jboss.ejb3.proxy.objectstore.ObjectStoreBindings; @@ -87,6 +78,7 @@ import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData; import org.jboss.metadata.ejb.spec.NamedMethodMetaData; import org.jboss.proxy.ejb.handle.HomeHandleImpl; +import org.jboss.util.NotImplementedException; import org.jboss.wsf.spi.SPIProvider; import org.jboss.wsf.spi.SPIProviderResolver; import org.jboss.wsf.spi.invocation.ExtensibleWebServiceContext; @@ -127,89 +119,33 @@ return new StatelessBeanContext(this, construct()); } - @Override - protected StatelessLocalProxyFactory getProxyFactory(LocalBinding binding) + public Object createProxyLocalEjb21() throws Exception { - 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; + return this.createProxyLocalEjb21(this.getAnnotation(LocalBinding.class)); } - @Override - protected SessionProxyFactory getProxyFactory(RemoteBinding binding) - { - //TODO Should be obtained from JNDI Registrar, needs to be looked up by a @RemoteBinding key - - /* - * In this implementation we just make a new Proxy Factory, for now - */ - - // Initialize - SessionProxyFactory factory = null; - - // If Clustered - if (this.isAnnotationPresent(Clustered.class)) - { - // Get the Proxy Clustering Registry - Ejb3Registrar registrar = Ejb3RegistrarLocator.locateRegistrar(); - String mcName = ClusteredObjectStoreBindings.CLUSTERED_OBJECTSTORE_BEAN_NAME_PROXY_CLUSTERING_REGISTRY; - ProxyClusteringRegistry registry = (ProxyClusteringRegistry) registrar.lookup(mcName); - assert registry != null : "Could not find " + ProxyClusteringRegistry.class.getSimpleName() + " in the " - + Ejb3Registrar.class.getSimpleName() + " under name " + mcName; - factory = new StatelessSessionClusteredProxyFactory(this.getName(), this.getName(), Ejb3Registry.guid(this), - this.getMetaData(), this.getClassloader(), binding.clientBindUrl(), this.getAdvisor(), registry, null); - } - else - { - factory = new StatelessSessionRemoteProxyFactory(this.getName(), this.getName(), Ejb3Registry.guid(this), this - .getMetaData(), this.getClassloader(), binding.clientBindUrl(), this.getAdvisor(), null); - } - - // Start the factory - try - { - factory.start(); - } - catch (Exception e) - { - throw new RuntimeException("Error in starting " + factory, e); - } - - // Return - return factory; - } - /** - * Create a local proxy (EJBLocalObject) for an enterprise bean identified by id, with + * Create a local proxy (EJBLocalObject) for an enterprise bean with * the specified LocalBinding * * @param id * @return * @throws Exception */ - @Override - public Object createProxyLocalEjb21(LocalBinding binding, String businessInterfaceType) throws Exception + public Object createProxyLocalEjb21(LocalBinding binding) throws Exception { - StatelessLocalProxyFactory proxyFactory = this.getProxyFactory(binding); - return proxyFactory.createProxyEjb21(businessInterfaceType); + + SessionSpecProxyFactory proxyFactory = (SessionSpecProxyFactory) this.getProxyFactory(binding); + return proxyFactory.createProxyEjb2x(); } - @Override - public Object createProxyRemoteEjb21(RemoteBinding binding, String businessInterfaceType) throws Exception + public Object createProxyRemoteEjb21() throws Exception { + return this.createProxyRemoteEjb21(this.getRemoteBinding()); + } + + public Object createProxyRemoteEjb21(RemoteBinding binding) throws Exception + { SessionSpecProxyFactory proxyFactory = (SessionSpecProxyFactory) this.getProxyFactory(binding); return proxyFactory.createProxyEjb2x(); } @@ -330,23 +266,13 @@ 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 + public Object localInvoke(Object id, Method method, Object[] args) throws Throwable { - return localInvoke(method, args, provider, null); + return localInvoke(method, args); } - public Object localInvoke(Object id, Method method, Object[] args, FutureHolder provider) throws Throwable + public Object localInvoke(Method method, Object[] args, BeanContextLifecycleCallback callback) throws Throwable { - return localInvoke(method, args, provider); - } - - public Object localInvoke(Method method, Object[] args, FutureHolder provider, BeanContextLifecycleCallback callback) throws Throwable - { long start = System.currentTimeMillis(); ClassLoader oldLoader = Thread.currentThread().getContextClassLoader(); @@ -371,7 +297,6 @@ nextInvocation.setArguments(args); nextInvocation.setContextCallback(callback); - ProxyUtils.addLocalAsynchronousInfo(nextInvocation, provider); return nextInvocation.invokeNext(); } finally @@ -585,23 +510,24 @@ 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(method.getReturnType().getName()); - - return proxy; - } - else - // remove - { - return null; - } + throw new NotImplementedException("EJBTHREE-1641"); +// 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(method.getReturnType().getName()); +// +// return proxy; +// } +// else +// // remove +// { +// return null; +// } } protected Object invokeHomeMethod(MethodInfo info, MethodInvocation invocation) throws Throwable @@ -727,7 +653,7 @@ WSCallbackImpl ejb3Callback = new WSCallbackImpl( jaxrpcContext, jaxwsContext ); // Actual invocation - return this.localInvoke(method, args, null, ejb3Callback); + return this.localInvoke(method, args, ejb3Callback); } public String getContainerName() Index: src/main/java/org/jboss/ejb3/proxy/JBossProxy.java =================================================================== --- src/main/java/org/jboss/ejb3/proxy/JBossProxy.java (revision 83932) +++ src/main/java/org/jboss/ejb3/proxy/JBossProxy.java (working copy) @@ -1,34 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2006, Red Hat Middleware LLC, and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.ejb3.proxy; - -/** - * - * - * @author Kabir Khan - * @author ALR - * @version $Revision$ - */ -public interface JBossProxy -{ - Object getAsynchronousProxy(); -} \ No newline at end of file Index: src/main/java/org/jboss/ejb3/proxy/ProxyUtils.java =================================================================== --- src/main/java/org/jboss/ejb3/proxy/ProxyUtils.java (revision 83932) +++ src/main/java/org/jboss/ejb3/proxy/ProxyUtils.java (working copy) @@ -1,162 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2006, Red Hat Middleware LLC, and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.ejb3.proxy; - -import java.lang.reflect.Method; -import java.util.ArrayList; - -import javax.ejb.EJBHome; -import javax.ejb.EJBObject; - -import org.jboss.aop.advice.Interceptor; -import org.jboss.aop.joinpoint.MethodInvocation; -import org.jboss.aop.util.MethodHashing; -import org.jboss.aop.util.PayloadKey; -import org.jboss.aspects.asynch.AsynchMixin; -import org.jboss.aspects.asynch.AsynchProvider; -import org.jboss.aspects.asynch.AsynchProxyInterceptor; -import org.jboss.aspects.asynch.FutureHolder; -import org.jboss.ejb3.asynchronous.AsynchronousInterceptor; -import org.jboss.ejb3.proxy.handler.ProxyInvocationHandlerDeprecated; - -/** - * @author Kabir Khan - * @version $Revision$ - */ -public class ProxyUtils -{ - public final static Class ASYNCH_PROVIDER_CLASS = AsynchProvider.class; - public final static long GET_ASYNCHRONOUS; - public static final long TO_STRING; - public static final long EQUALS; - public static final long HASHCODE; - public static final Method GET_PRIMARY_KEY; - public static final Method GET_HANDLE; - public static final Method GET_EJB_HOME; - public static final Method IS_IDENTICAL; - public static final Method GET_HOME_HANDLE; - public static final Method GET_EJB_METADATA; - public static final Method REMOVE; - - static - { - try - { - Class[] empty = {}; - - Method method = JBossProxy.class.getMethod("getAsynchronousProxy", empty); - GET_ASYNCHRONOUS = MethodHashing.calculateHash(method); - TO_STRING = MethodHashing.calculateHash(Object.class.getDeclaredMethod("toString", empty)); - EQUALS = MethodHashing.calculateHash(Object.class.getDeclaredMethod("equals", new Class[]{Object.class})); - HASHCODE = MethodHashing.calculateHash(Object.class.getDeclaredMethod("hashCode", empty)); - - GET_PRIMARY_KEY = EJBObject.class.getMethod("getPrimaryKey", empty); - GET_HANDLE = EJBObject.class.getMethod("getHandle", empty); - GET_EJB_HOME = EJBObject.class.getMethod("getEJBHome", empty); - IS_IDENTICAL = EJBObject.class.getMethod("isIdentical", new Class[] { EJBObject.class }); - REMOVE = EJBObject.class.getMethod("remove", empty); - - GET_HOME_HANDLE = EJBHome.class.getMethod("getHomeHandle", empty); - GET_EJB_METADATA = EJBHome.class.getMethod("getEJBMetaData", empty); - } - catch (NoSuchMethodException e) - { - throw new RuntimeException(e); - } - } - - public static boolean isAsynchronous(Class[] infs) - { - for (int i = 0; i < infs.length; i++) - { - if (infs[i] == ASYNCH_PROVIDER_CLASS) - { - return true; - } - } - return false; - } - - public static Class[] addAsynchProviderInterface(Class[] infs) - { - ArrayList> interfaces = new ArrayList>(); - - for (int i = 0; i < infs.length; i++) - { - if (infs[i] == ASYNCH_PROVIDER_CLASS) - { - //This should not happen - continue; - } - interfaces.add(infs[i]); - } - - interfaces.add(ASYNCH_PROVIDER_CLASS); - return (Class[]) interfaces.toArray(new Class[interfaces.size()]); - } - - public static Interceptor[] addAsynchProxyInterceptor(AsynchMixin mixin, Interceptor[] interceptors) - { - AsynchProxyInterceptor interceptor = new AsynchProxyInterceptor(mixin); - Interceptor[] newInterceptors = null; - newInterceptors = new Interceptor[interceptors.length + 1]; - newInterceptors[0] = interceptor; - System.arraycopy(interceptors, 0, newInterceptors, 1, interceptors.length); - return newInterceptors; - } - - public static void addLocalAsynchronousInfo(MethodInvocation invocation, FutureHolder provider) - { - if (provider != null) - { - invocation.getMetaData().addMetaData(AsynchronousInterceptor.ASYNCH, AsynchronousInterceptor.INVOKE_ASYNCH, "YES", PayloadKey.AS_IS); - invocation.getMetaData().addMetaData(AsynchronousInterceptor.ASYNCH, AsynchronousInterceptor.FUTURE_HOLDER, provider, PayloadKey.AS_IS); - } - } - - public static Object handleCallLocally(Object jbproxy, ProxyInvocationHandlerDeprecated ih, Method m, Object[] args) - { - long hash = MethodHashing.calculateHash(m); - return handleCallLocally(hash, jbproxy, ih, m, args); - } - - public static Object handleCallLocally(long hash, Object jbproxy, ProxyInvocationHandlerDeprecated ih, Method m, Object[] args) - { - if (hash == ProxyUtils.GET_ASYNCHRONOUS) - { - return ih.getAsynchronousProxy((JBossProxy)jbproxy); - } - else if (hash == TO_STRING) - { - return ih.toString(); - } - else if (hash == HASHCODE) - { - return new Integer(ih.toString().hashCode()); - } - else if (hash == EQUALS) - { - return new Boolean(ih.toString().equals(args[0].toString())); - } - return null; - } -} Index: src/main/java/org/jboss/ejb3/proxy/factory/RemoteProxyFactory.java =================================================================== --- src/main/java/org/jboss/ejb3/proxy/factory/RemoteProxyFactory.java (revision 83932) +++ src/main/java/org/jboss/ejb3/proxy/factory/RemoteProxyFactory.java (working copy) @@ -1,37 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2006, Red Hat Middleware LLC, and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.ejb3.proxy.factory; - -import org.jboss.ejb3.proxy.ProxyFactory; - -/** - * Comment - * - * @author Bill Burke - * @version $Revision$ - */ -public interface RemoteProxyFactory extends ProxyFactory -{ - public static final String DEFAULT_CLIENT_BINDING = "socket://0.0.0.0:3873"; - -// public void setRemoteBinding(RemoteBinding binding); -} Index: src/main/java/org/jboss/ejb3/proxy/factory/ProxyFactoryNotRegisteredException.java =================================================================== --- src/main/java/org/jboss/ejb3/proxy/factory/ProxyFactoryNotRegisteredException.java (revision 83932) +++ src/main/java/org/jboss/ejb3/proxy/factory/ProxyFactoryNotRegisteredException.java (working copy) @@ -1,51 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2007, Red Hat Middleware LLC, and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.ejb3.proxy.factory; - -/** - * ProxyFactoryNotRegisteredException - * - * Thrown when attempting to retrieve a proxy factory with - * unrecognized name from the registry - * - * @author ALR - * @version $Revision: $ - */ -public class ProxyFactoryNotRegisteredException extends Exception -{ - - // Class Members - private static final long serialVersionUID = -881723607135494483L; - - // Constructors - - public ProxyFactoryNotRegisteredException() - { - super(); - } - - public ProxyFactoryNotRegisteredException(String message) - { - super(message); - } - -} Index: src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulProxyFactory.java =================================================================== --- src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulProxyFactory.java (revision 83932) +++ src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulProxyFactory.java (working copy) @@ -1,48 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2008, Red Hat Middleware LLC, and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.ejb3.proxy.factory.stateful; - -import org.jboss.ejb3.proxy.factory.SessionProxyFactory; - -/** - * StatefulProxyFactory - * - * Contract for a Proxy Factory specific to - * operations required by a SFSB implementation - * - * @author ALR - * @version $Revision: $ - */ -public interface StatefulProxyFactory extends SessionProxyFactory -{ - /** - * Create a SFSB Business Proxy with the specified - * Session ID and - * target business interface name (should be expressed as - * a fully-qualified class name) - * - * @param id - * @param businessInterfaceName - * @return - */ - public Object createProxyBusiness(Object id, String businessInterfaceName); -} Index: src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulClusterProxyFactory.java =================================================================== --- src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulClusterProxyFactory.java (revision 83932) +++ src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulClusterProxyFactory.java (working copy) @@ -1,304 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2006, Red Hat Middleware LLC, and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.ejb3.proxy.factory.stateful; - -import java.lang.reflect.Proxy; -import java.util.ArrayList; -import java.util.List; - -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.ClusterChooserInterceptor; -import org.jboss.aspects.remoting.ClusteredPojiProxy; -import org.jboss.aspects.remoting.FamilyWrapper; -import org.jboss.aspects.remoting.InvokeRemoteInterceptor; -import org.jboss.ejb3.SpecificationInterfaceType; -import org.jboss.ejb3.annotation.Clustered; -import org.jboss.ejb3.annotation.RemoteBinding; -import org.jboss.ejb3.annotation.defaults.ClusteredDefaults; -import org.jboss.ejb3.proxy.ProxyFactory; -import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper; -import org.jboss.ejb3.proxy.factory.RemoteProxyFactory; -import org.jboss.ejb3.proxy.factory.RemoteProxyFactoryRegistry; -import org.jboss.ejb3.proxy.handler.stateful.StatefulClusteredInvocationHandler; -import org.jboss.ejb3.remoting.ClusteredIsLocalInterceptor; -import org.jboss.ejb3.remoting.LoadBalancePolicyNotRegisteredException; -import org.jboss.ejb3.session.ProxyAccessType; -import org.jboss.ejb3.session.SessionContainer; -import org.jboss.ejb3.session.SessionSpecContainer; -import org.jboss.ha.client.loadbalance.LoadBalancePolicy; -import org.jboss.ha.client.loadbalance.RoundRobin; -import org.jboss.ha.client.loadbalance.aop.FirstAvailable; -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.HAPartitionLocator; -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 Bill Burke - * @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 String partitionName; - private HAPartition partition; - private LoadBalancePolicy lbPolicy; - private FamilyWrapper wrapper; - - public StatefulClusterProxyFactory(SessionSpecContainer container, RemoteBinding binding, Clustered clustered) - { - super(container, binding); - - assert clustered != null : "clustered is null"; - - this.clustered = clustered; - } - - /** - * Returns the interface type for Home - * - * @return - */ - @Override - protected Class getHomeType() - { - // Not Supported - return null; - } - - /** - * Defines the access type for this Proxies created by this Factory - * - * @return - */ - @Override - protected ProxyAccessType getProxyAccessType(){ - return ProxyAccessType.REMOTE; - } - - /** - * Whether or not to bind the home and business interfaces together - * - * @return - */ - @Override - protected boolean bindHomeAndBusinessTogether() - { - // Not Supported - return false; - } - - protected void validateEjb21Views() - { - // Obtain Container - SessionContainer container = this.getContainer(); - - // Obtain @RemoteHome - RemoteHome remoteHome = container.getAnnotation(RemoteHome.class); - - // Ensure that if EJB 2.1 Components are defined, they're complete - this.validateEjb21Views(remoteHome == null ? null : remoteHome.value(), ProxyFactoryHelper - .getRemoteInterfaces(container)); - - } - - public void start() throws Exception - { - this.init(); - - InvokerLocator locator = this.getLocator(); - SessionContainer container = this.getContainer(); - partitionName = container.getPartitionName(); - proxyFamilyName = container.getDeploymentQualifiedName() + locator.getProtocol() + partitionName; - partition = HAPartitionLocator.getHAPartitionLocator().getHAPartition(partitionName, container.getInitialContextProperties()); - drm = partition.getDistributedReplicantManager(); - 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 policy = registry.getLoadBalancePolicy(policyClass); - policyClass = policy.getName(); - } - catch (LoadBalancePolicyNotRegisteredException e){} - - lbPolicy = (LoadBalancePolicy)Thread.currentThread().getContextClassLoader().loadClass(policyClass) - .newInstance(); - } - wrapper = new FamilyWrapper(proxyFamilyName, hatarget.getReplicants()); - - drm.registerListener(proxyFamilyName, this); - - super.start(); - - // Set up the proxy to ourself. Needs to be clustered so it can load - // balance requests (EJBTHREE-1375). We use the home load balance policy. - - LoadBalancePolicy factoryLBP = null; - if (clustered.homeLoadBalancePolicy() == null || clustered.homeLoadBalancePolicy().equals(ClusteredDefaults.LOAD_BALANCE_POLICY_DEFAULT)) - { - factoryLBP = new RoundRobin(); - } - else - { - String policyClass = clustered.homeLoadBalancePolicy(); - try - { - RemoteProxyFactoryRegistry registry = container.getDeployment().getRemoteProxyFactoryRegistry(); - Class policy = registry.getLoadBalancePolicy(policyClass); - policyClass = policy.getName(); - } - catch (LoadBalancePolicyNotRegisteredException e){} - - factoryLBP = (LoadBalancePolicy)Thread.currentThread().getContextClassLoader().loadClass(policyClass) - .newInstance(); - } - - Class[] interfaces = {ProxyFactory.class}; - String targetId = getTargetId(); - Interceptor[] interceptors = { new ClusteredIsLocalInterceptor(), - new ClusterChooserInterceptor(), - InvokeRemoteInterceptor.singleton - }; - - // We can use the same FamilyWrapper as we use for the bean - ClusteredPojiProxy proxy = new ClusteredPojiProxy(targetId, locator, interceptors, wrapper, - factoryLBP, partitionName, null); - Object factoryProxy = Proxy.newProxyInstance(interfaces[0].getClassLoader(), interfaces, proxy); - String jndiName = this.getJndiName(); - 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; - } - - @Override - protected Object createProxy(Object id,SpecificationInterfaceType type, String businessInterfaceType) - { - String stackName = this.getStackNameInterceptors(); - RemoteBinding binding = this.getBinding(); - if (binding.interceptorStack() != null && !binding.interceptorStack().trim().equals("")) - { - stackName = binding.interceptorStack(); - } - AdviceStack stack = AspectManager.instance().getAdviceStack(stackName); - if (stack == null) throw new RuntimeException("unable to find interceptor stack: " + stackName); - StatefulClusteredInvocationHandler handler = new StatefulClusteredInvocationHandler(getContainer(), stack.createInterceptors(getContainer() - .getAdvisor(), null), this.wrapper, this.lbPolicy, partitionName, getLocator(), id, businessInterfaceType); - - if(type.equals(SpecificationInterfaceType.EJB21)) - { - return this.constructEjb21Proxy(handler); - } - else - { - return this.constructProxyBusiness(handler); - } - } - - public void stop() throws Exception - { - Dispatcher.singleton.unregisterTarget(getTargetId()); - hatarget.destroy(); - drm.unregisterListener(proxyFamilyName, this); - this.getContainer().getClusterFamilies().remove(proxyFamilyName); - String jndiName = this.getJndiName(); - Util.unbind(getContainer().getInitialContext(), jndiName + PROXY_FACTORY_NAME); - super.stop(); - } - - /** - * @return unique name for this proxy factory - */ - protected String getTargetId() - { - String jndiName = this.getJndiName(); - 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); - } - } -} Index: src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulRemoteProxyFactory.java =================================================================== --- src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulRemoteProxyFactory.java (revision 83932) +++ src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulRemoteProxyFactory.java (working copy) @@ -1,203 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2008, Red Hat Middleware LLC, and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.ejb3.proxy.factory.stateful; - -import javax.ejb.EJBObject; -import javax.ejb.RemoteHome; - -import org.jboss.aop.AspectManager; -import org.jboss.aop.advice.AdviceStack; -import org.jboss.ejb3.SpecificationInterfaceType; -import org.jboss.ejb3.annotation.RemoteBinding; -import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper; -import org.jboss.ejb3.proxy.factory.RemoteProxyFactory; -import org.jboss.ejb3.proxy.handler.stateful.StatefulRemoteProxyInvocationHandler; -import org.jboss.ejb3.session.ProxyAccessType; -import org.jboss.ejb3.session.SessionContainer; -import org.jboss.ejb3.session.SessionSpecContainer; -import org.jboss.ejb3.stateful.StatefulHandleRemoteImpl; -import org.jboss.logging.Logger; -import org.jboss.remoting.InvokerLocator; - -/** - * BaseStatefulRemoteProxyFactory - * - * Common base for factories generating remoting-enabled - * proxies (ie. remote and clustering) - * - * @author ALR - * @version $Revision: $ - */ -public abstract class BaseStatefulRemoteProxyFactory extends BaseStatefulProxyFactory implements RemoteProxyFactory -{ - // Class Members - - private static final Logger log = Logger.getLogger(BaseStatefulRemoteProxyFactory.class); - - // Instance Members - - private RemoteBinding binding; - - private InvokerLocator locator; - - // Constructor - public BaseStatefulRemoteProxyFactory(SessionSpecContainer container, RemoteBinding binding) - { - super(container, ProxyFactoryHelper.getRemoteBusinessJndiName(container)); - - this.binding = binding; - - try - { - String clientBindUrl = ProxyFactoryHelper.getClientBindUrl(this.getBinding()); - this.locator = new InvokerLocator(clientBindUrl); - } - catch (Exception e) - { - throw new RuntimeException(e); - } - } - - // Required Implementations - - @Override - protected ProxyAccessType getProxyAccessType() - { - return ProxyAccessType.REMOTE; - } - - @Override - protected void validateEjb21Views() - { - // Obtain Container - SessionContainer container = this.getContainer(); - - // Obtain @RemoteHome - RemoteHome remoteHome = container.getAnnotation(RemoteHome.class); - - // Ensure that if EJB 2.1 Components are defined, they're complete - this.validateEjb21Views(remoteHome == null ? null : remoteHome.value(), ProxyFactoryHelper - .getRemoteInterfaces(container)); - } - - public Object createProxyBusiness() - { - return this.createProxyBusiness(null); - } - - public Object createProxyBusiness(String businessInterfaceType) - { - Object id = getContainer().createSession(); - return this.createProxyBusiness(id, businessInterfaceType); - } - - public Object createProxyBusiness(Object id, String businessInterfaceType) - { - return this.createProxy(id,SpecificationInterfaceType.EJB30_BUSINESS, businessInterfaceType); - } - - // Specifications - - abstract String getStackNameInterceptors(); - - // Functional Methods - - @Override - protected boolean bindHomeAndBusinessTogether() - { - SessionSpecContainer container = this.getContainer(); - String homeJndiName = ProxyFactoryHelper.getHomeJndiName(container); - String remoteBusinessJndiName = ProxyFactoryHelper.getRemoteBusinessJndiName(container); - return homeJndiName.equals(remoteBusinessJndiName); - } - - protected Object createProxy(Object id,SpecificationInterfaceType type, String businessInterfaceType) - { - String stackName = this.getStackNameInterceptors(); - RemoteBinding binding = this.getBinding(); - if (binding.interceptorStack() != null && !binding.interceptorStack().trim().equals("")) - { - stackName = binding.interceptorStack(); - } - AdviceStack stack = AspectManager.instance().getAdviceStack(stackName); - if (stack == null) throw new RuntimeException("unable to find interceptor stack: " + stackName); - StatefulRemoteProxyInvocationHandler proxy = new StatefulRemoteProxyInvocationHandler(getContainer(), stack.createInterceptors(getContainer() - .getAdvisor(), null), this.getLocator(), id, businessInterfaceType); - - if(type.equals(SpecificationInterfaceType.EJB21)) - { - this.getContainer(); - return this.constructEjb21Proxy(proxy); - } - else - { - return this.constructProxyBusiness(proxy); - } - } - - @Override - protected StatefulHandleRemoteImpl createHandle() - { - EJBObject proxy = this.createProxyEjb21(null); - return this.createHandle(proxy); - } - - protected StatefulHandleRemoteImpl createHandle(EJBObject proxy) - { - StatefulHandleRemoteImpl handle = new StatefulHandleRemoteImpl(proxy); - return handle; - } - - public EJBObject createProxyEjb21(String businessInterfaceType) - { - Object id = getContainer().createSession(); - return this.createProxyEjb21(id, businessInterfaceType); - } - - @SuppressWarnings("unchecked") - public T createProxyEjb21(Object id, String businessInterfaceType) - { - // Cast explicitly to catch improper proxies - return (T) this.createProxy(id, SpecificationInterfaceType.EJB21, businessInterfaceType); - } - - @Override - public void start() throws Exception - { - super.start(); - } - - // Accessors / Mutators - - RemoteBinding getBinding() - { - assert this.binding!=null : "RemoteBinding has not been initialized"; - return this.binding; - } - - InvokerLocator getLocator() - { - assert this.locator!=null : "InvokerLocator has not been initialized"; - return this.locator; - } - -} Index: src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulProxyFactory.java =================================================================== --- src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulProxyFactory.java (revision 83932) +++ src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulProxyFactory.java (working copy) @@ -1,142 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2006, Red Hat Middleware LLC, and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.ejb3.proxy.factory.stateful; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; - -import javax.naming.Context; -import javax.naming.RefAddr; -import javax.naming.Reference; -import javax.naming.StringRefAddr; - -import org.jboss.ejb3.proxy.JndiSessionProxyObjectFactory; -import org.jboss.ejb3.proxy.ProxyFactory; -import org.jboss.ejb3.proxy.factory.BaseSessionProxyFactory; -import org.jboss.ejb3.session.SessionSpecContainer; -import org.jboss.logging.Logger; -import org.jboss.util.naming.Util; - -/** - * Comment - * - * @author Bill Burke - * @version $Revision$ - */ -public abstract class BaseStatefulProxyFactory extends BaseSessionProxyFactory implements ProxyFactory -{ - // Class Members - - @SuppressWarnings("unused") - private static final Logger log = Logger.getLogger(BaseStatefulProxyFactory.class); - - public static final String PROXY_FACTORY_NAME = "StatefulProxyFactory"; - - /** - * Do not call, only for externalizable - */ - protected BaseStatefulProxyFactory() - { - super(); - } - - public BaseStatefulProxyFactory(SessionSpecContainer container, String jndiName) - { - super(container); - - assert jndiName != null : "jndiName is null"; - - this.jndiName = jndiName; - } - - public void init() throws Exception - { - // Ensure EJB2.1 View is Complete - this.validateEjb21Views(); - - // Create the Proxy Constructors - this.createProxyConstructors(); - } - - public void start() throws Exception - { - this.init(); - - // Bind the Proxy Factory - //Context ctx = getContainer().getInitialContext(); - //Name name = ctx.getNameParser("").parse(jndiName); - //ctx = Util.createSubcontext(ctx, name.getPrefix(name.size() - 1)); - //String atom = name.get(name.size() - 1); - Context ctx = getContainer().getInitialContext(); - String jndiName = this.getJndiName(); -// Name name = ctx.getNameParser("").parse(jndiName); - //ctx = Util.createSubcontext(ctx, name.getPrefix(name.size() - 1)); - //String atom = name.get(name.size() - 1); - RefAddr refAddr = new StringRefAddr(JndiSessionProxyObjectFactory.REF_ADDR_NAME_JNDI_BINDING_DELEGATE_PROXY_FACTORY, jndiName + PROXY_FACTORY_NAME); - Reference ref = new Reference(Object.class.getName(), refAddr, JndiSessionProxyObjectFactory.class.getName(), null); -// try -// { -// log.debug("Binding reference for " + getContainer().getEjbName() + " in JNDI at " + jndiName); -// 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; -// } - - this.bindProxy(ref); - - } - - public void stop() throws Exception - { - String jndiName = this.getJndiName(); - Util.unbind(getContainer().getInitialContext(), jndiName); - } - - protected final void initializeJndiName() {}; - - @Override - public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException - { - super.readExternal(in); - try - { - init(); - } - catch(Exception e) - { - log.error(e.getMessage(), e); - throw new IOException(e.getMessage()); - } - } - - @Override - public void writeExternal(ObjectOutput out) throws IOException - { - super.writeExternal(out); - } -} Index: src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulLocalProxyFactory.java =================================================================== --- src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulLocalProxyFactory.java (revision 83932) +++ src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulLocalProxyFactory.java (working copy) @@ -1,250 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2006, Red Hat Middleware LLC, and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.ejb3.proxy.factory.stateful; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import 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.SpecificationInterfaceType; -import org.jboss.ejb3.annotation.LocalBinding; -import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper; -import org.jboss.ejb3.proxy.handler.stateful.StatefulLocalHomeProxyInvocationHandler; -import org.jboss.ejb3.proxy.handler.stateful.StatefulLocalProxyInvocationHandler; -import org.jboss.ejb3.session.ProxyAccessType; -import org.jboss.ejb3.session.SessionContainer; -import org.jboss.ejb3.session.SessionSpecContainer; -import org.jboss.proxy.ejb.handle.StatefulHandleImpl; -import org.jboss.util.NotImplementedException; -import org.jboss.util.naming.Util; - - -/** - * Comment - * - * @author Bill Burke - * @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, ProxyFactoryHelper.getLocalJndiName(container)); - } - - /** - * Returns the interface type for Home - * - * @return - */ - @Override - protected Class getHomeType() - { - return ProxyFactoryHelper.getLocalHomeInterface(this.getContainer()); - } - - /** - * 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)); - - } - - /** - * Whether or not to bind the home and business interfaces together - * - * @return - */ - @Override - protected boolean bindHomeAndBusinessTogether() - { - String localHomeJndiName = ProxyFactoryHelper.getLocalHomeJndiName(this.getContainer()); - if(localHomeJndiName!=null) - { - return localHomeJndiName.equals(this.jndiName); - } - return false; - } - - /** - * Returns whether this Proxy Factory is local. A Hack until EJB3 Proxy - * is in place, but this keeps us moving forward easily. - * - * @deprecated Hack - * @return - */ - @Deprecated - protected boolean isLocal() - { - return true; - } - - 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()) - { - Class[] interfaces = - {localHome.value()}; - Object homeProxy = java.lang.reflect.Proxy.newProxyInstance(statefulContainer.getBeanClass().getClassLoader(), - interfaces, new StatefulLocalHomeProxyInvocationHandler(statefulContainer)); - Util.rebind(statefulContainer.getInitialContext(), ProxyFactoryHelper.getLocalHomeJndiName(statefulContainer), - homeProxy); - } - } - - public void stop() throws Exception - { - super.stop(); - Util.unbind(getContainer().getInitialContext(), jndiName + PROXY_FACTORY_NAME); - SessionContainer statefulContainer = this.getContainer(); - LocalHome localHome = this.getContainer().getAnnotation(LocalHome.class); - if (localHome != null && !bindHomeAndBusinessTogether()) - { - Util.unbind(statefulContainer.getInitialContext(), ProxyFactoryHelper.getLocalHomeJndiName(statefulContainer)); - } - } - - public Object createProxyBusiness() - { - SessionContainer sfsb = (SessionContainer) getContainer(); - Object id = sfsb.createSession(); - return this.createProxyBusiness(id); - } - - public EJBLocalObject createProxyEjb21(String businessInterfaceType) - { - Object id = getContainer().createSession(); - return this.createProxyEjb21(id, businessInterfaceType); - } - - public Object createProxyBusiness(String businessInterfaceType) - { - return this.createProxyBusiness(null, businessInterfaceType); - } - - public Object createProxyBusiness(Object id) - { - return this.createProxyBusiness(id, null); - } - - public Object createProxyBusiness(Object id, String businessInterfaceType) - { - return this.createProxy(id, SpecificationInterfaceType.EJB30_BUSINESS, businessInterfaceType); - } - - @SuppressWarnings("unchecked") - public T createProxyEjb21(Object id, String businessInterfaceType) - { - return (T) this.createProxy(id, SpecificationInterfaceType.EJB21, null); - } - - private Object createProxy(Object id, SpecificationInterfaceType type, String businessInterfaceType) - { - StatefulLocalProxyInvocationHandler proxy = new StatefulLocalProxyInvocationHandler(this.getContainer(), id, - vmid, businessInterfaceType); - return type.equals(SpecificationInterfaceType.EJB30_BUSINESS) ? this.constructProxyBusiness(proxy) : this - .constructEjb21Proxy(proxy); - } - - public Object createProxy(Class[] initTypes, Object[] initValues) - { - SessionContainer sfsb = (SessionContainer) getContainer(); - Object id = sfsb.createSession(initTypes, initValues); - return this.createProxy(id, SpecificationInterfaceType.EJB30_BUSINESS, null); - } - - public Object createProxyEjb21(Class[] initTypes, Object[] initValues, String businessInterfaceType) - { - SessionContainer sfsb = (SessionContainer) getContainer(); - Object id = sfsb.createSession(initTypes, initValues); - return this.createProxyEjb21(id, businessInterfaceType); - } - - 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); - } -} Index: src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulRemoteProxyFactory.java =================================================================== --- src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulRemoteProxyFactory.java (revision 83932) +++ src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulRemoteProxyFactory.java (working copy) @@ -1,187 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2006, Red Hat Middleware LLC, and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.ejb3.proxy.factory.stateful; - -import java.lang.reflect.Proxy; - -import javax.ejb.RemoteHome; -import javax.naming.NamingException; - -import org.jboss.aop.AspectManager; -import org.jboss.aop.Dispatcher; -import org.jboss.aop.advice.AdviceStack; -import org.jboss.aop.advice.Interceptor; -import org.jboss.aspects.remoting.InvokeRemoteInterceptor; -import org.jboss.aspects.remoting.PojiProxy; -import org.jboss.ejb3.annotation.RemoteBinding; -import org.jboss.ejb3.proxy.ProxyFactory; -import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper; -import org.jboss.ejb3.proxy.factory.RemoteProxyFactory; -import org.jboss.ejb3.proxy.handler.BaseSessionRemoteProxyInvocationHandler; -import org.jboss.ejb3.proxy.handler.stateful.StatefulHomeRemoteProxyInvocationHandler; -import org.jboss.ejb3.remoting.IsLocalProxyFactoryInterceptor; -import org.jboss.ejb3.session.SessionContainer; -import org.jboss.ejb3.session.SessionSpecContainer; -import org.jboss.logging.Logger; -import org.jboss.remoting.InvokerLocator; -import org.jboss.util.naming.Util; - -/** - * Comment - * - * @author Bill Burke - * @author Brian Stansberry - * - * @version $Revision$ - */ -public class StatefulRemoteProxyFactory extends BaseStatefulRemoteProxyFactory implements RemoteProxyFactory -{ - private static final Logger log = Logger.getLogger(StatefulRemoteProxyFactory.class); - - private static final String STACK_NAME_STATEFUL_SESSION_CLIENT_INTERCEPTORS = "StatefulSessionClientInterceptors"; - - public StatefulRemoteProxyFactory(SessionSpecContainer container, RemoteBinding binding) - { - super(container, binding); - } - - @Override - public void start() throws Exception - { - super.start(); - Class[] interfaces = {ProxyFactory.class}; - String targetId = getTargetId(); - String clientBindUrl = ProxyFactoryHelper.getClientBindUrl(this.getBinding()); - Object factoryProxy = createPojiProxy(targetId, interfaces, clientBindUrl); - String jndiName = this.getJndiName(); - log.debug("Binding proxy factory for " + getContainer().getEjbName() + " in JNDI at " + jndiName + PROXY_FACTORY_NAME + " with client bind url " + clientBindUrl); - try - { - Util.rebind(getContainer().getInitialContext(), jndiName + PROXY_FACTORY_NAME, factoryProxy); - } - catch (NamingException e) - { - NamingException namingException = new NamingException("Could not bind stateful remote proxy with ejb name " + getContainer().getEjbName() + " into JNDI under jndiName: " + getContainer().getInitialContext().getNameInNamespace() + "/" + jndiName + PROXY_FACTORY_NAME); - namingException.setRootCause(e); - throw namingException; - } - assert !Dispatcher.singleton.isRegistered(targetId) : targetId + " is already registered"; - Dispatcher.singleton.registerTarget(targetId, this); - - SessionSpecContainer statefulContainer = this.getContainer(); - RemoteHome remoteHome = statefulContainer.getAnnotation(RemoteHome.class); - if (remoteHome != null && !bindHomeAndBusinessTogether()) - { - Object homeProxy = createHomeProxy(remoteHome.value()); - String homeJndiName = ProxyFactoryHelper.getHomeJndiName(statefulContainer); - log.debug("Binding home proxy at " + homeJndiName); - Util.rebind(this.getContainer().getInitialContext(), homeJndiName, homeProxy); - } - } - - @Override - public void stop() throws Exception - { - String jndiName = this.getJndiName(); - Util.unbind(getContainer().getInitialContext(), jndiName + PROXY_FACTORY_NAME); - Dispatcher.singleton.unregisterTarget(getTargetId()); - - SessionContainer statefulContainer = this.getContainer(); - RemoteHome remoteHome = statefulContainer.getAnnotation(RemoteHome.class); - if (remoteHome != null && !bindHomeAndBusinessTogether()) - { - Util.unbind(this.getContainer().getInitialContext(), ProxyFactoryHelper.getHomeJndiName(getContainer())); - } - super.stop(); - } - - public Object createHomeProxy(Class homeInterface) - { - try - { - String stackName = StatefulRemoteProxyFactory.STACK_NAME_STATEFUL_SESSION_CLIENT_INTERCEPTORS; - RemoteBinding binding = this.getBinding(); - if (binding.interceptorStack() != null && !binding.interceptorStack().trim().equals("")) - { - stackName = binding.interceptorStack(); - } - AdviceStack stack = AspectManager.instance().getAdviceStack(stackName); - if (stack == null) throw new RuntimeException("unable to find interceptor stack: " + stackName); - StatefulHomeRemoteProxyInvocationHandler proxy = new StatefulHomeRemoteProxyInvocationHandler(getContainer(), stack.createInterceptors( - getContainer().getAdvisor(), null), this.getLocator()); - - setEjb21Objects(proxy); - Class[] intfs = {homeInterface}; - return java.lang.reflect.Proxy.newProxyInstance(getContainer().getBeanClass().getClassLoader(), intfs, proxy); - } - catch (IllegalArgumentException e) - { - throw new RuntimeException(e); - } - } - - @Override - protected void setEjb21Objects(BaseSessionRemoteProxyInvocationHandler proxy) - { - proxy.setHandle(this.createHandle()); - proxy.setHomeHandle(getHomeHandle()); - proxy.setEjbMetaData(getEjbMetaData()); - } - - /** - * Returns the interface type for Home - * - * @return - */ - @Override - protected Class getHomeType() - { - return ProxyFactoryHelper.getRemoteHomeInterface(this.getContainer()); - } - - @Override - String getStackNameInterceptors() - { - return StatefulRemoteProxyFactory.STACK_NAME_STATEFUL_SESSION_CLIENT_INTERCEPTORS; - } - - /** - * @return unique name for this proxy factory - */ - protected String getTargetId() - { - String jndiName = this.getJndiName(); - 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); - - } - - -} Index: src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessClusterProxyFactory.java =================================================================== --- src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessClusterProxyFactory.java (revision 83932) +++ src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessClusterProxyFactory.java (working copy) @@ -1,204 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2006, Red Hat Middleware LLC, and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.ejb3.proxy.factory.stateless; - -import java.util.ArrayList; -import java.util.List; - -import org.jboss.aop.AspectManager; -import org.jboss.aop.advice.AdviceStack; -import org.jboss.aspects.remoting.FamilyWrapper; -import org.jboss.ejb3.SpecificationInterfaceType; -import org.jboss.ejb3.annotation.Clustered; -import org.jboss.ejb3.annotation.RemoteBinding; -import org.jboss.ejb3.annotation.defaults.ClusteredDefaults; -import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper; -import org.jboss.ejb3.proxy.factory.RemoteProxyFactory; -import org.jboss.ejb3.proxy.factory.RemoteProxyFactoryRegistry; -import org.jboss.ejb3.proxy.handler.stateless.StatelessClusteredInvocationHandler; -import org.jboss.ejb3.remoting.LoadBalancePolicyNotRegisteredException; -import org.jboss.ejb3.session.SessionSpecContainer; -import org.jboss.ejb3.stateless.StatelessContainer; -import org.jboss.ha.client.loadbalance.LoadBalancePolicy; -import org.jboss.ha.client.loadbalance.RandomRobin; -import org.jboss.ha.framework.interfaces.ClusteringTargetsRepository; -import org.jboss.ha.framework.interfaces.DistributedReplicantManager; -import org.jboss.ha.framework.interfaces.HAPartition; -import org.jboss.ha.framework.server.HAPartitionLocator; -import org.jboss.ha.framework.server.HATarget; -import org.jboss.logging.Logger; -import org.jboss.remoting.InvokerLocator; - - -/** - * Comment - * - * @author Bill Burke - * @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); - StatelessContainer container = (StatelessContainer) getContainer(); - String partitionName = container.getPartitionName(); - proxyFamilyName = container.getDeploymentQualifiedName() + locator.getProtocol() + partitionName; - HAPartition partition = HAPartitionLocator.getHAPartitionLocator().getHAPartition(partitionName, container.getInitialContextProperties()); - drm = partition.getDistributedReplicantManager(); - 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 RandomRobin(); - } - else - { - String policyClass = clustered.loadBalancePolicy(); - try - { - RemoteProxyFactoryRegistry registry = container.getDeployment().getRemoteProxyFactoryRegistry(); - Class policy = registry.getLoadBalancePolicy(policyClass); - policyClass = policy.getName(); - } - catch (LoadBalancePolicyNotRegisteredException e){} - - lbPolicy = (LoadBalancePolicy)Thread.currentThread().getContextClassLoader().loadClass(policyClass) - .newInstance(); - } - wrapper = new FamilyWrapper(proxyFamilyName, hatarget.getReplicants()); - - drm.registerListener(proxyFamilyName, this); - - super.start(); - } - - public void stop() throws Exception - { - super.stop(); - proxy = null; - hatarget.destroy(); - drm.unregisterListener(proxyFamilyName, this); - ((StatelessContainer) getContainer()).getClusterFamilies().remove(proxyFamilyName); - } - - public Object createProxyBusiness(String businessInterfaceClassName) - { - String stackName = this.getStackNameInterceptors(); - if (binding.interceptorStack() != null && !binding.interceptorStack().equals("")) - { - stackName = binding.interceptorStack(); - } - AdviceStack stack = AspectManager.instance().getAdviceStack(stackName); - /* - Object[] args = {new StatelessClusteredProxy(containerId, stack.createInterceptors((Advisor) container, null), wrapper, lbPolicy)}; - return proxyConstructor.newInstance(args); - */ - String partitionName = ((StatelessContainer) getContainer()).getPartitionName(); - - proxy = constructProxy(new StatelessClusteredInvocationHandler(getContainer(), stack.createInterceptors( - getContainer().getAdvisor(), null), wrapper, lbPolicy, partitionName, getLocator(), businessInterfaceClassName), - SpecificationInterfaceType.EJB30_BUSINESS); - return proxy; - } - - /** - * Whether or not to bind the home and business interfaces together - * - * @return - */ - @Override - protected boolean bindHomeAndBusinessTogether(){ - // Not Supported - return false; - } - - @SuppressWarnings("unchecked") - public synchronized void replicantsChanged (String key, - List newReplicants, - int newReplicantsViewId, - boolean merge) - { - try - { - // Update the FamilyClusterInfo with the new targets - ArrayList targets = new ArrayList(newReplicants); - wrapper.get().updateClusterInfo(targets, newReplicantsViewId); - - // Rebind the proxy as the old one has been serialized - if (proxy != null) - bindProxy(proxy); - } - catch (Exception e) - { - log.error(e); - } - } - - /** - * Returns the interface type for Home - * - * @param container - * @return - */ - @Override - protected Class getHomeType() - { - // Not Supported - return null; - } - - @Override - String getStackNameInterceptors() - { - return StatelessClusterProxyFactory.STACK_NAME_CLUSTERED_STATELESS_SESSION_CLIENT_INTERCEPTORS; - } -} Index: src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessRemoteProxyFactory.java =================================================================== --- src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessRemoteProxyFactory.java (revision 83932) +++ src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessRemoteProxyFactory.java (working copy) @@ -1,141 +0,0 @@ -package org.jboss.ejb3.proxy.factory.stateless; - -import javax.ejb.EJBObject; -import javax.ejb.RemoteHome; - -import org.jboss.aop.AspectManager; -import org.jboss.aop.advice.AdviceStack; -import org.jboss.ejb3.SpecificationInterfaceType; -import org.jboss.ejb3.annotation.RemoteBinding; -import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper; -import org.jboss.ejb3.proxy.factory.RemoteProxyFactory; -import org.jboss.ejb3.proxy.handler.stateless.StatelessRemoteProxyInvocationHandler; -import org.jboss.ejb3.session.ProxyAccessType; -import org.jboss.ejb3.session.SessionContainer; -import org.jboss.ejb3.session.SessionSpecContainer; -import org.jboss.ejb3.stateless.StatelessHandleRemoteImpl; -import org.jboss.remoting.InvokerLocator; - -public abstract class BaseStatelessRemoteProxyFactory extends BaseStatelessProxyFactory implements RemoteProxyFactory -{ - - // Instance Members - - private RemoteBinding binding; - - private InvokerLocator locator; - - // Constructor - public BaseStatelessRemoteProxyFactory(SessionSpecContainer container, RemoteBinding binding) - { - super(container, ProxyFactoryHelper.getRemoteBusinessJndiName(container)); - - this.binding = binding; - - try - { - String clientBindUrl = ProxyFactoryHelper.getClientBindUrl(this.getBinding()); - this.locator = new InvokerLocator(clientBindUrl); - } - catch (Exception e) - { - throw new RuntimeException(e); - } - } - - // Required Implementations - - @Override - protected final ProxyAccessType getProxyAccessType() - { - return ProxyAccessType.REMOTE; - } - - @Override - protected final void validateEjb21Views() - { - // Obtain Container - SessionContainer container = this.getContainer(); - - // Obtain @RemoteHome - RemoteHome remoteHome = container.getAnnotation(RemoteHome.class); - - // Ensure that if EJB 2.1 Components are defined, they're complete - this.validateEjb21Views(remoteHome == null ? null : remoteHome.value(), ProxyFactoryHelper - .getRemoteInterfaces(container)); - } - - // Specifications - - abstract String getStackNameInterceptors(); - - // Functional Methods - - protected boolean bindHomeAndEjb21ViewTogether(SessionContainer container) - { - String homeJndiName = ProxyFactoryHelper.getHomeJndiName(container); - String remoteBusinessJndiName = ProxyFactoryHelper.getRemoteBusinessJndiName(container); - return homeJndiName.equals(remoteBusinessJndiName); - } - - public Object createProxyBusiness() - { - return this.createProxyBusiness(null); - } - - public Object createProxyBusiness(String businessInterfaceType) - { - return this.createProxy(SpecificationInterfaceType.EJB30_BUSINESS, businessInterfaceType); - } - - public Object createProxy(SpecificationInterfaceType type, String businessInterfaceType) - { - String stackName = this.getStackNameInterceptors(); - if (binding.interceptorStack() != null && !binding.interceptorStack().equals("")) - { - stackName = binding.interceptorStack(); - } - AdviceStack stack = AspectManager.instance().getAdviceStack(stackName); - StatelessRemoteProxyInvocationHandler proxy = new StatelessRemoteProxyInvocationHandler(getContainer(), - stack.createInterceptors(getContainer().getAdvisor(), null), locator, businessInterfaceType); - - if(type.equals(SpecificationInterfaceType.EJB21)) - { - return this.constructEjb21Proxy(proxy); - } - else - { - return this.constructProxyBusiness(proxy); - } - } - - @Override - public final StatelessHandleRemoteImpl createHandle() - { - EJBObject proxy = this.createProxyEjb21(null); - StatelessHandleRemoteImpl handle = new StatelessHandleRemoteImpl(proxy); - return handle; - } - - @SuppressWarnings("unchecked") - public T createProxyEjb21(String businessInterfaceType) - { - // Cast explicitly to catch improper proxies - return (T) this.createProxy(SpecificationInterfaceType.EJB21, businessInterfaceType); - } - - // Accessors / Mutators - - RemoteBinding getBinding() - { - assert this.binding!=null : "RemoteBinding has not been initialized"; - return this.binding; - } - - InvokerLocator getLocator() - { - assert this.locator!=null : "InvokerLocator has not been initialized"; - return this.locator; - } - -} Index: src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessProxyFactory.java =================================================================== --- src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessProxyFactory.java (revision 83932) +++ src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessProxyFactory.java (working copy) @@ -1,139 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2006, Red Hat Middleware LLC, and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.ejb3.proxy.factory.stateless; - -import org.jboss.ejb3.proxy.factory.SessionProxyFactory; -import org.jboss.ejb3.session.ProxyAccessType; -import org.jboss.ejb3.session.SessionSpecContainer; -import org.jboss.logging.Logger; -import org.jboss.util.naming.Util; - -/** - * Comment - * - * @author Bill Burke - * @version $Revision$ - */ -public abstract class BaseStatelessProxyFactory extends org.jboss.ejb3.proxy.factory.BaseSessionProxyFactory implements SessionProxyFactory -{ - private static final Logger log = Logger.getLogger(BaseStatelessProxyFactory.class); - - public BaseStatelessProxyFactory(SessionSpecContainer container, String jndiName) - { - super(container); - - assert jndiName != null : "jndiName is null"; - - this.jndiName = jndiName; - } - - /** - * Adapt the JDK to cglib. - * - * This is a named class because it implements both InvocationHandler and Serializable. - */ - /* TODO: fix EJBTHREE-485 without cglib - private static class CGLibInvocationHandlerAdapter implements net.sf.cglib.proxy.InvocationHandler, Serializable - { - private static final long serialVersionUID = 1L; - - private InvocationHandler delegate; - - private CGLibInvocationHandlerAdapter(InvocationHandler delegate) - { - if(delegate == null) - throw new IllegalArgumentException("delegate must not be null"); - this.delegate = delegate; - } - - public Object invoke(Object proxy, Method method, Object[] args) throws Throwable - { - return delegate.invoke(proxy, method, args); - } - - } - */ - -// /** -// * Adapt the InvocationHandler to MethodHandler. -// * -// * This is a named class because it implements both MethodHandler and Serializable. -// */ -// private static class MethodHandlerAdapter implements MethodHandler, Serializable -// { -// private static final long serialVersionUID = 1L; -// -// private InvocationHandler delegate; -// -// private MethodHandlerAdapter(InvocationHandler delegate) -// { -// if(delegate == null) -// throw new IllegalArgumentException("delegate must not be null"); -// this.delegate = delegate; -// } -// -// public Object invoke(Object self, Method thisMethod, Method process, Object[] args) throws Throwable -// { -// return delegate.invoke(self, thisMethod, args); -// } -// } - - public void init() throws Exception - { - this.createProxyConstructors(); - this.validateEjb21Views(); - } - - /* for debugging purposes * / - private static void describeClass(Class cls) { - System.err.println("class " + cls + " has the following:"); - for(Class i : cls.getInterfaces()) { - System.err.println(" interface: " + i); - } - for(Method m : cls.getDeclaredMethods()) { - System.err.println(" method: " + m); - } - System.err.println(" classloader = " + cls.getClassLoader()); - if(cls.getSuperclass() != null) - describeClass(cls.getSuperclass()); - } - */ - - public void start() throws Exception - { - init(); - - Object proxy = createProxyBusiness(); - //describeClass(proxy.getClass()); - bindProxy(proxy); - } - - public void stop() throws Exception - { - Util.unbind(getContainer().getInitialContext(), this.getJndiName()); - } - - protected abstract void validateEjb21Views(); - - protected abstract ProxyAccessType getProxyAccessType(); - -} Index: src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessLocalProxyFactory.java =================================================================== --- src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessLocalProxyFactory.java (revision 83932) +++ src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessLocalProxyFactory.java (working copy) @@ -1,185 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2006, Red Hat Middleware LLC, and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.ejb3.proxy.factory.stateless; - -import javax.ejb.EJBLocalObject; -import javax.ejb.LocalHome; - -import org.jboss.ejb3.EJBContainer; -import org.jboss.ejb3.SpecificationInterfaceType; -import org.jboss.ejb3.annotation.LocalBinding; -import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper; -import org.jboss.ejb3.proxy.handler.stateless.StatelessLocalProxyInvocationHandler; -import org.jboss.ejb3.session.ProxyAccessType; -import org.jboss.ejb3.session.SessionSpecContainer; -import org.jboss.ejb3.stateless.StatelessHandleRemoteImpl; -import org.jboss.logging.Logger; -import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData; -import org.jboss.util.naming.Util; - - -/** - * Comment - * - * @author Bill Burke - * @version $Revision$ - */ -public class StatelessLocalProxyFactory extends BaseStatelessProxyFactory -{ - private static final Logger log = Logger.getLogger(StatelessLocalProxyFactory.class); - - public StatelessLocalProxyFactory(SessionSpecContainer container, LocalBinding binding) - { - super(container, ProxyFactoryHelper.getLocalJndiName(container)); - } - - /** - * Returns the interface type for Home - * - * @param container - * @return - */ - @Override - protected Class getHomeType() - { - return ProxyFactoryHelper.getLocalHomeInterface(this.getContainer()); - } - - @Override - protected ProxyAccessType getProxyAccessType() - { - return ProxyAccessType.LOCAL; - } - - - protected void validateEjb21Views(){ - - EJBContainer container = this.getContainer(); - - LocalHome localHome = container.getAnnotation(LocalHome.class); - - // Ensure that if EJB 2.1 Components are defined, they're complete - this.validateEjb21Views(localHome == null ? null : localHome.value(), ProxyFactoryHelper - .getLocalInterfaces(container)); - } - - /** - * Returns whether this Proxy Factory is local. A Hack until EJB3 Proxy - * is in place, but this keeps us moving forward easily. - * - * @deprecated Hack - * @return - */ - @Deprecated - @Override - protected boolean isLocal() - { - return true; - } - - /** - * Whether or not to bind the home and business interfaces together - * - * @return - */ - @Override - protected boolean bindHomeAndBusinessTogether() - { - String localHomeJndiName = ProxyFactoryHelper.getLocalHomeJndiName(this.getContainer()); - if(localHomeJndiName!=null) - { - return localHomeJndiName.equals(jndiName); - } - return false; - } - - @Override - public void start() throws Exception - { - super.start(); - SessionSpecContainer statelessContainer = getContainer(); - LocalHome localHome = statelessContainer.getAnnotation(LocalHome.class); - if (localHome != null && !bindHomeAndBusinessTogether()) - { - Class[] interfaces = - {localHome.value()}; - Object homeProxy = java.lang.reflect.Proxy.newProxyInstance(getContainer().getBeanClass().getClassLoader(), - interfaces, new StatelessLocalProxyInvocationHandler(getContainer(), null)); - Util.rebind(getContainer().getInitialContext(), ProxyFactoryHelper.getLocalHomeJndiName(getContainer()), homeProxy); - } - } - - @Override - public void stop() throws Exception - { - super.stop(); - SessionSpecContainer statelessContainer = this.getContainer(); - LocalHome localHome = statelessContainer.getAnnotation(LocalHome.class); - if (localHome != null && !bindHomeAndBusinessTogether()) - { - Util.unbind(getContainer().getInitialContext(), ProxyFactoryHelper.getLocalHomeJndiName(getContainer())); - } - } - - public Object createProxyBusiness() - { - return this.createProxyBusiness(null); - } - - public Object createProxyBusiness(String businessInterfaceType) - { - return this - .constructProxyBusiness(new StatelessLocalProxyInvocationHandler(getContainer(), businessInterfaceType)); - } - - @SuppressWarnings("unchecked") - public T createProxyEjb21(String businessInterfaceType) - { - return (T) this.createProxy(SpecificationInterfaceType.EJB21, businessInterfaceType); - } - - private Object createProxy(SpecificationInterfaceType type, String businessInterfaceType) - { - StatelessLocalProxyInvocationHandler proxy = new StatelessLocalProxyInvocationHandler(this.getContainer(), - businessInterfaceType); - return type.equals(SpecificationInterfaceType.EJB30_BUSINESS) ? this.constructProxyBusiness(proxy) : this - .constructEjb21Proxy(proxy); - } - - @Override - protected StatelessHandleRemoteImpl createHandle() - { - // Local beans have no Handle - //TODO Rework the contract such that this method does not need to be - // defined for local proxy factories - return null; - } - - @Override - protected String getJndiName() - { - SessionSpecContainer container = this.getContainer(); - JBossSessionBeanMetaData md = container.getMetaData(); - String jndiName = md.determineLocalJndiName(); - return jndiName; - } -} Index: src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessRemoteProxyFactory.java =================================================================== --- src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessRemoteProxyFactory.java (revision 83932) +++ src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessRemoteProxyFactory.java (working copy) @@ -1,156 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2006, Red Hat Middleware LLC, and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.ejb3.proxy.factory.stateless; - -import javax.ejb.RemoteHome; -import javax.naming.NamingException; - -import org.jboss.aop.AspectManager; -import org.jboss.aop.advice.AdviceStack; -import org.jboss.ejb3.annotation.RemoteBinding; -import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper; -import org.jboss.ejb3.proxy.factory.RemoteProxyFactory; -import org.jboss.ejb3.proxy.handler.stateless.StatelessRemoteProxyInvocationHandler; -import org.jboss.ejb3.session.SessionSpecContainer; -import org.jboss.logging.Logger; -import org.jboss.remoting.InvokerLocator; -import org.jboss.util.naming.Util; - - -/** - * Comment - * - * @author Bill Burke - * @version $Revision$ - */ -public class StatelessRemoteProxyFactory extends BaseStatelessRemoteProxyFactory implements RemoteProxyFactory -{ - private static final Logger log = Logger.getLogger(StatelessRemoteProxyFactory.class); - - private static final String STACK_NAME_STATELESS_SESSION_CLIENT_INTERCEPTORS = "StatelessSessionClientInterceptors"; - - public StatelessRemoteProxyFactory(SessionSpecContainer container, RemoteBinding binding) - { - super(container, binding); - } - - /** - * Whether or not to bind the home and business interfaces together - * - * @return - */ - @Override - protected boolean bindHomeAndBusinessTogether() - { - SessionSpecContainer container = this.getContainer(); - String homeJndiName = ProxyFactoryHelper.getHomeJndiName(container); - if(homeJndiName!=null) - { - return homeJndiName.equals(ProxyFactoryHelper.getRemoteBusinessJndiName(container)); - } - else - { - return false; - } - } - - public void init() throws Exception - { - super.init(); - } - - public void start() throws Exception - { - super.start(); - RemoteHome remoteHome = this.getContainer().getAnnotation(RemoteHome.class); - if (remoteHome != null && !bindHomeAndEjb21ViewTogether(this.getContainer())) - { - Object homeProxy = createHomeProxy(remoteHome.value()); - String jndiName = ProxyFactoryHelper.getHomeJndiName(getContainer()); - try - { - log.debug("Binding proxy for " + getContainer().getEjbName() + " in JNDI at " + jndiName); - Util.rebind(getContainer().getInitialContext(), jndiName, homeProxy); - } - catch (NamingException e) - { - NamingException namingException = new NamingException("Could not bind stateless home proxy with ejb name " + getContainer().getEjbName() + " into JNDI under jndiName: " + getContainer().getInitialContext().getNameInNamespace() + "/" + jndiName); - namingException.setRootCause(e); - throw namingException; - } - - } - } - - public void stop() throws Exception - { - super.stop(); - SessionSpecContainer statelessContainer = this.getContainer(); - RemoteHome remoteHome = this.getContainer().getAnnotation(RemoteHome.class); - if (remoteHome != null && !bindHomeAndEjb21ViewTogether(statelessContainer)) - { - Util.unbind(getContainer().getInitialContext(), ProxyFactoryHelper.getHomeJndiName(getContainer())); - } - } - - public Object createHomeProxy(Class homeInterface) - { - try - { - String stackName = this.getStackNameInterceptors(); - RemoteBinding binding = this.getBinding(); - InvokerLocator locator = this.getLocator(); - if (binding.interceptorStack() != null && !binding.interceptorStack().equals("")) - { - stackName = binding.interceptorStack(); - } - AdviceStack stack = AspectManager.instance().getAdviceStack(stackName); - StatelessRemoteProxyInvocationHandler proxy = new StatelessRemoteProxyInvocationHandler(getContainer(), stack - .createInterceptors(getContainer().getAdvisor(), null), locator, null); - setEjb21Objects(proxy); - Class[] interfaces = {homeInterface}; - return java.lang.reflect.Proxy.newProxyInstance(getContainer().getBeanClass().getClassLoader(), interfaces, proxy); - } - catch (IllegalArgumentException e) - { - throw new RuntimeException(e); - } - } - - /** - * Returns the interface type for Home - * - * @return - */ - @Override - protected Class getHomeType() - { - return ProxyFactoryHelper.getRemoteHomeInterface(this.getContainer()); - } - - @Override - String getStackNameInterceptors() - { - return StatelessRemoteProxyFactory.STACK_NAME_STATELESS_SESSION_CLIENT_INTERCEPTORS; - } - -} Index: src/main/java/org/jboss/ejb3/proxy/factory/BaseSessionProxyFactory.java =================================================================== --- src/main/java/org/jboss/ejb3/proxy/factory/BaseSessionProxyFactory.java (revision 83932) +++ src/main/java/org/jboss/ejb3/proxy/factory/BaseSessionProxyFactory.java (working copy) @@ -1,714 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2006, Red Hat Middleware LLC, and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.ejb3.proxy.factory; - -import java.io.Externalizable; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -import javax.ejb.EJBException; -import javax.ejb.EJBHome; -import javax.ejb.EJBLocalHome; -import javax.ejb.EJBLocalObject; -import javax.ejb.EJBMetaData; -import javax.ejb.EJBObject; -import javax.ejb.Handle; -import javax.ejb.HomeHandle; -import javax.ejb.RemoteHome; -import javax.naming.NamingException; - -import org.jboss.ejb3.EJBContainer; -import org.jboss.ejb3.Ejb3Registry; -import org.jboss.ejb3.SpecificationInterfaceType; -import org.jboss.ejb3.annotation.RemoteBinding; -import org.jboss.ejb3.proxy.JBossProxy; -import org.jboss.ejb3.proxy.handler.BaseSessionRemoteProxyInvocationHandler; -import org.jboss.ejb3.proxy.impl.EJBMetaDataImpl; -import org.jboss.ejb3.proxy.impl.HomeHandleImpl; -import org.jboss.ejb3.session.ProxyAccessType; -import org.jboss.ejb3.session.SessionContainer; -import org.jboss.ejb3.session.SessionSpecContainer; -import org.jboss.logging.Logger; -import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData; -import org.jboss.metadata.ejb.jboss.jndipolicy.spi.JbossSessionBeanJndiNameResolver; -import org.jboss.metadata.ejb.spec.BusinessLocalsMetaData; -import org.jboss.metadata.ejb.spec.BusinessRemotesMetaData; -import org.jboss.util.naming.Util; - -/** - * Comment - * - * @author William DeCoste - * @version $Revision$ - */ -public abstract class BaseSessionProxyFactory implements SessionProxyFactory, Externalizable -{ - @SuppressWarnings("unused") - private static final Logger log = Logger.getLogger(BaseSessionProxyFactory.class); - - private static final String JNDI_NAME_SUFFIX_PROXY_FACTORY = "/ProxyFactory"; - - private SessionSpecContainer container; - protected String containerGuid; - protected String containerClusterUid; - protected boolean isClustered = false; - protected String jndiName; - - /** - * Proxy Constructor for the Business Interfaces' Proxy - */ - protected Constructor businessProxyConstructor; - - /** - * Proxy Constructor for the EJBObject/EJBLocalObject Proxy - */ - protected Constructor ejb21ProxyConstructor; - - private static final String METHOD_PREFIX_EJB21_CREATE = "create"; - - public BaseSessionProxyFactory() - { - } - - protected BaseSessionProxyFactory(SessionSpecContainer container) - { - assert container != null : "container is null"; - - setContainer(container); - } - - public Object createHomeProxy() - { - throw new RuntimeException("NYI"); - } - - /** - * Creates the Proxy constructors - */ - protected void createProxyConstructors() throws Exception - { - // Obtain this bean class' CL - ClassLoader cl = this.getContainer().getBeanClass().getClassLoader(); - - // Create business proxy constructor - Class[] businessInterfaces = this.getInterfacesForBusinessProxy(); - this.businessProxyConstructor = ProxyFactoryHelper.createProxyConstructor(businessInterfaces, cl); - - // Create EJB21 proxy constructor - Class[] ejb21Interfaces = this.getInterfacesForEjb21Proxy(); - if (ejb21Interfaces != null) - { - this.ejb21ProxyConstructor = ProxyFactoryHelper.createProxyConstructor(ejb21Interfaces, cl); - } - - - /* plain jdk - Class proxyClass = java.lang.reflect.Proxy.getProxyClass(getContainer().getBeanClass().getClassLoader(), interfaces); - final Class[] constructorParams = - {InvocationHandler.class}; - businessProxyConstructor = proxyClass.getConstructor(constructorParams); - - */ - - /* javassist */ - /* - proxyFactory = new javassist.util.proxy.ProxyFactory() - { - @Override - protected ClassLoader getClassLoader() - { - return container.getBeanClass().getClassLoader(); - } - }; - proxyFactory.setInterfaces(interfaces); - proxyFactory.setSuperclass(JavassistProxy.class); - proxyClass = proxyFactory.createClass(); - proxyConstructor = proxyClass.getConstructor((Class[]) null); - */ - - /* cglib */ - /* - proxyClass = net.sf.cglib.proxy.Proxy.getProxyClass(container.getBeanClass().getClassLoader(), interfaces); - final Class[] constructorParams = {net.sf.cglib.proxy.InvocationHandler.class}; - proxyConstructor = proxyClass.getConstructor(constructorParams); - */ - } - - protected void bindProxy(Object proxy) throws NamingException - { - try - { - //TODO Dev -// // Bind the Proxy Factory if not yet bound -// try -// { -// // Check if bound yet -// Util.lookup(this.getJndiNameProxyFactory(), this.getClass()); -// } -// // Proxy factory is not yet bound -// catch(NameNotFoundException nnfe) -// { -// // Bind Proxy Factory -// log.debug("Binding proxy factory " + this.toString() + " for " + this.getContainer().getEjbName() -// + " in JNDI at " + this.getJndiNameProxyFactory()); -// Util.rebind(this.getContainer().getInitialContext(), this.getJndiNameProxyFactory(), this); -// } -// // Unexpected Exception -// catch (Exception e) -// { -// throw new RuntimeException(e); -// } - - // Bind the proxy itself - log.debug("Binding proxy for " + getContainer().getEjbName() + " in JNDI at " + this.getJndiName()); - Util.rebind(getContainer().getInitialContext(), this.getJndiName(), proxy); - - // Bind a proxy per business interface - //TODO This ugly block should be using polymorphism, but I'll allow it as the proxy mechanism - // is going to be replaced entirely by EJB3 Proxy soon - JBossSessionBeanMetaData smd = (JBossSessionBeanMetaData) container.getXml(); - BusinessRemotesMetaData remotes = smd.getBusinessRemotes(); - BusinessLocalsMetaData locals = smd.getBusinessLocals(); - Set businessInterfaces = new HashSet(); - boolean isLocal = this.isLocal(); - if (!isLocal) - { - if (remotes != null) - { - businessInterfaces.addAll(remotes); - } - } - else - { - if (locals != null) - { - businessInterfaces.addAll(locals); - } - } - for (String businessInterface : businessInterfaces) - { - String jndiName = JbossSessionBeanJndiNameResolver.resolveJndiName(smd, businessInterface); - log.debug("Binding proxy for " + getContainer().getEjbName() + ", interface " + businessInterface - + " in JNDI at " + jndiName); - if (Proxy.isProxyClass(proxy.getClass())) - { - for (Class in : proxy.getClass().getInterfaces()) - { - log.debug("Proxy Interface for JNDI Name " + jndiName + ": " + in); - } - } - Util.rebind(this.getContainer().getInitialContext(), jndiName, proxy); - } - - - } catch (NamingException e) - { - NamingException namingException = new NamingException("Could not bind session proxy with ejb name " - + getContainer().getEjbName() + " into JNDI under jndiName: " - + getContainer().getInitialContext().getNameInNamespace() + "/" + this.getJndiName()); - namingException.setRootCause(e); - throw namingException; - } - } - - - /** - * Returns whether this Proxy Factory is local. A Hack until EJB3 Proxy - * is in place, but this keeps us moving forward easily. - * - * @deprecated Hack - * @return - */ - @Deprecated - protected boolean isLocal() - { - return false; - } - - /** - * Whether or not to bind the home and business interfaces together - * - * @return - */ - protected abstract boolean bindHomeAndBusinessTogether(); - - protected Object constructProxyBusiness(InvocationHandler handler) - { - // Return - return this.constructProxy(handler, SpecificationInterfaceType.EJB30_BUSINESS); - } - - protected Object constructEjb21Proxy(InvocationHandler handler) - { - // Return - return this.constructProxy(handler, SpecificationInterfaceType.EJB21); - } - - /** - * Construct a new Proxy of the specified type using the - * specified handler as argument to the Constructor - * - * @param handler - * @param specType - * @return - */ - protected Object constructProxy(final InvocationHandler handler, SpecificationInterfaceType specType) - { - // Initialize - Object obj = null; - - try - { - // Business Proxy - if (specType.equals(SpecificationInterfaceType.EJB30_BUSINESS)) - { - obj = this.businessProxyConstructor.newInstance(handler); - } - // EJBObject/EJBLocalObject - else if (specType.equals(SpecificationInterfaceType.EJB21)) - { - // If there's no EJB21 View - if (this.ejb21ProxyConstructor == null) - { - throw new IllegalStateException( - "EJB3 Specification Violation Section 4.3.3: \"" - + "Only session beans with a remote EJBObject / local EJBLocalObject interface can call this method."); - } - - obj = this.ejb21ProxyConstructor.newInstance(handler); - } - } - catch (InstantiationException e) - { - throw new RuntimeException(e); - } - catch (IllegalAccessException e) - { - throw new RuntimeException(e); - } - catch (InvocationTargetException e) - { - Throwable t = e.getTargetException(); - if (t instanceof RuntimeException) - throw (RuntimeException) t; - throw new RuntimeException(t); - } - - // Ensure Proxy object was created - assert obj != null : "Proxy Object must not be null"; - - // Return - return obj; - } - - - protected void setContainer(SessionSpecContainer container) - { - this.container = container; - this.containerGuid = Ejb3Registry.guid(container); - this.containerClusterUid = Ejb3Registry.clusterUid(container); - this.isClustered = container.isClustered(); - } - - protected SessionSpecContainer getContainer() - { - if (container == null) - { - container = (SessionSpecContainer)Ejb3Registry.findContainer(containerGuid); - - if (container == null && isClustered) - container = (SessionSpecContainer)Ejb3Registry.getClusterContainer(containerClusterUid); - } - - return container; - } - - /** - * Obtains interfaces to be used in the business proxy - * - * @return - */ - protected Class[] getInterfacesForBusinessProxy() - { - return this.getInterfacesForProxy(this.getProxyAccessType(), SpecificationInterfaceType.EJB30_BUSINESS); - } - - /** - * Obtains interfaces to be used in the EJB21 proxy. Returns null if none defined - * - * @return - */ - protected Class[] getInterfacesForEjb21Proxy() - { - return this.getInterfacesForProxy(this.getProxyAccessType(), SpecificationInterfaceType.EJB21); - } - - /** - * Returns an array of interfaces to be used for the proxy; - * will return null if none are defined. - * - * @param accessType - * @param specType - * @return - */ - private Class[] getInterfacesForProxy(ProxyAccessType accessType, SpecificationInterfaceType specType) - { - - // Initialize - Set> interfaces = new HashSet>(); - SessionContainer container = this.getContainer(); - - // Initialize array of interfaces - Set> intfs = new HashSet>(); - - // If Local - if (accessType.equals(ProxyAccessType.LOCAL)) - { - - // If business - if (specType.equals(SpecificationInterfaceType.EJB30_BUSINESS)) - { - intfs.addAll(Arrays.asList(ProxyFactoryHelper.getLocalBusinessInterfaces(container))); - - // If binding home with local business - if(this.bindHomeAndBusinessTogether()) - { - Class home = this.getHomeType(); - if (home != null) - { - intfs.add(home); - } - } - } - // If EJBLocalObject - else - { - // Add local interfaces - intfs.addAll(Arrays.asList(ProxyFactoryHelper.getLocalInterfaces(container))); - - // If no interfaces - if (intfs.size() == 0) - { - return null; - } - - // Add EJBLocalObject - intfs.add(EJBLocalObject.class); - } - } - // If remote - else - { - // If business - if (specType.equals(SpecificationInterfaceType.EJB30_BUSINESS)) - { - intfs.addAll(Arrays.asList(ProxyFactoryHelper.getRemoteBusinessInterfaces(container))); - - // If binding home with remote business - if(this.bindHomeAndBusinessTogether()) - { - Class home = this.getHomeType(); - if (home != null) - { - intfs.add(home); - } - } - - } - // If EJBObject - else - { - // Add remote interfaces - intfs.addAll(Arrays.asList(ProxyFactoryHelper.getRemoteInterfaces(container))); - - // If no interfaces - if (intfs.size() == 0) - { - return null; - } - - // Add EJBObject - intfs.add(EJBObject.class); - } - } - - // Add all interfaces - for (Class interfaze : intfs) - { - interfaces.add(interfaze); - } - - // Add JBossProxy - interfaces.add(JBossProxy.class); - - // Return - return interfaces.toArray(new Class[] - {}); - } - - /** - * Defines the access type for this Proxies created by this Factory - * - * @return - */ - protected abstract ProxyAccessType getProxyAccessType(); - - protected void setEjb21Objects(BaseSessionRemoteProxyInvocationHandler proxy) - { - proxy.setHandle(this.createHandle()); - proxy.setHomeHandle(getHomeHandle()); - proxy.setEjbMetaData(getEjbMetaData()); - } - - abstract protected Handle createHandle(); - - protected HomeHandle getHomeHandle() - { - EJBContainer ejbContainer = (EJBContainer)container; - - HomeHandleImpl homeHandle = null; - - RemoteBinding remoteBindingAnnotation = ejbContainer.getAnnotation(RemoteBinding.class); - if (remoteBindingAnnotation != null) - homeHandle = new HomeHandleImpl(ProxyFactoryHelper.getHomeJndiName(container)); - - return homeHandle; - } - - /** - * Returns the interface type for Home - * - * @return - */ - protected abstract Class getHomeType(); - - protected String getJndiName() - { - SessionSpecContainer container = this.getContainer(); - JBossSessionBeanMetaData md = container.getMetaData(); - String jndiName = md.determineResolvedJndiName(null); - return jndiName; - } - - protected String getHomeJndiName() - { - SessionSpecContainer container = this.getContainer(); - JBossSessionBeanMetaData md = container.getMetaData(); - String home = md.getHome(); - String jndiName = md.determineResolvedJndiName(home); - return jndiName; - } - - public final String getJndiNameProxyFactory() - { - return this.getJndiName() + BaseSessionProxyFactory.JNDI_NAME_SUFFIX_PROXY_FACTORY; - } - - protected EJBMetaData getEjbMetaData() - { - Class remote = null; - Class home = null; - Class pkClass = Object.class; - HomeHandleImpl homeHandle = null; - - EJBContainer ejbContainer = (EJBContainer)container; - - Class[] remotes = ProxyFactoryHelper.getRemoteInterfaces(this.getContainer()); - if (remotes != null && remotes.length > 0) - { - remote = remotes[0]; - } - RemoteHome homeAnnotation = ejbContainer.getAnnotation(RemoteHome.class); - if (homeAnnotation != null) - home = homeAnnotation.value(); - RemoteBinding remoteBindingAnnotation = ejbContainer.getAnnotation(RemoteBinding.class); - if (remoteBindingAnnotation != null) - homeHandle = new HomeHandleImpl(remoteBindingAnnotation.jndiBinding()); - - EJBMetaDataImpl metadata = new EJBMetaDataImpl(remote, home, pkClass, true, false, homeHandle); - - return metadata; - } - - public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException - { - containerGuid = in.readUTF(); - containerClusterUid = in.readUTF(); - isClustered = in.readBoolean(); - - if (getContainer() == null) - throw new EJBException("Invalid (i.e. remote) invocation of local interface (null container) for " + containerGuid); - } - - public void writeExternal(ObjectOutput out) throws IOException - { - out.writeUTF(containerGuid); - out.writeUTF(containerClusterUid); - out.writeBoolean(isClustered); - } - - /** - * Ensures that an EJB 2.1 view is complete; the following rules apply: - * - * 1) If EJBHome/EJBLocalHome is defined, at least one EJBObject/EJBLocalObject is defined. - * 2) If one EJBObject/EJBLocalObject is defined, an EJBHome/EJBLocalHome is defined. - * - * @param home - * @param localOrRemoteInterfaces - * @throws RuntimeException - */ - protected void validateCompleteEjb21View(Class home, Class[] localOrRemoteInterfaces) throws RuntimeException - { - // Ensure specified home is EJBHome or EJBLocalHome - assert (home == null || (EJBHome.class.isAssignableFrom(home) || EJBLocalHome.class.isAssignableFrom(home))); - - // Ensure all interfaces passed are either EJBObject or EJBLocalObject - for (Class localOrRemoteInterface : localOrRemoteInterfaces) - { - assert (EJBObject.class.isAssignableFrom(localOrRemoteInterface) || EJBLocalObject.class - .isAssignableFrom(localOrRemoteInterface)); - } - - // If home is defined and there are no local/remote interfaces - if (home != null && localOrRemoteInterfaces.length == 0) - { - throw new RuntimeException("EJBTHREE-1075: " + container.getBeanClassName() + " defines home" - + " but provides no local/remote interfaces extending " + EJBLocalObject.class.getName() + "/" - + EJBObject.class.getName() + "; EJB 2.1 view cannot be realized"); - } - - // If local/remote interfaces are defined, but no remote home - if (home == null && localOrRemoteInterfaces.length != 0) - { - throw new RuntimeException("EJBTHREE-1075: " + container.getBeanClassName() - + " defines local/remote interfaces" + " but provides no home; EJB 2.1 view cannot be realized"); - } - } - - /** - * Validates that the specified EJB2.1 Home interface returns only - * valid remote/local interfaces from "create" 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 creates = new HashSet(); - - // Obtain all "create" methods - Method[] all = home.getDeclaredMethods(); - - // For each method - for (Method method : all) - { - // If a "create" method - if (method.getName().startsWith(BaseSessionProxyFactory.METHOD_PREFIX_EJB21_CREATE)) - { - // Add to the Set of Creates - creates.add(method); - } - } - - // For all "create" 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 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 " - + "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(); -} Index: src/main/java/org/jboss/ejb3/proxy/factory/ProxyFactoryHelper.java =================================================================== --- src/main/java/org/jboss/ejb3/proxy/factory/ProxyFactoryHelper.java (revision 83932) +++ src/main/java/org/jboss/ejb3/proxy/factory/ProxyFactoryHelper.java (working copy) @@ -774,67 +774,67 @@ 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 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 Index: src/main/java/org/jboss/ejb3/proxy/factory/SessionProxyFactory.java =================================================================== --- src/main/java/org/jboss/ejb3/proxy/factory/SessionProxyFactory.java (revision 83932) +++ src/main/java/org/jboss/ejb3/proxy/factory/SessionProxyFactory.java (working copy) @@ -1,49 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2008, Red Hat Middleware LLC, and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.ejb3.proxy.factory; - -import org.jboss.ejb3.proxy.ProxyFactory; - -/** - * SessionProxyFactory - * - * Contract for a Proxy Factory specific to - * operations required by Session implementations - * - * @author ALR - * @version $Revision: $ - * @deprecated In favor of EJB3 Proxy - */ -@Deprecated -public interface SessionProxyFactory extends ProxyFactory -{ - /** - * Create an EJB3 Business Proxy with the specified - * target business interface name (should be expressed as - * a fully-qualified class name) - * - * @param id - * @param businessInterfaceName - * @return - */ - public Object createProxyBusiness(String businessInterfaceName); -} Index: src/main/java/org/jboss/ejb3/proxy/factory/RemoteProxyFactoryRegistry.java =================================================================== --- src/main/java/org/jboss/ejb3/proxy/factory/RemoteProxyFactoryRegistry.java (revision 83932) +++ src/main/java/org/jboss/ejb3/proxy/factory/RemoteProxyFactoryRegistry.java (working copy) @@ -21,85 +21,25 @@ */ package org.jboss.ejb3.proxy.factory; -import org.jboss.ejb3.remoting.LoadBalancePolicyNotRegisteredException; -import org.jboss.ha.client.loadbalance.LoadBalancePolicy; -import java.util.Map; - /** * Registry for all configured Remote Proxy Factory implementations * * @author ALR * @version $Revision: $ */ +@Deprecated public class RemoteProxyFactoryRegistry { - // Instance Members - private Map> factories; - private Map> loadBalancePolicies; - - // Accessors / Mutators - - public Map> getFactories() - { - return factories; - } - - public void setFactories(Map> factories) - { - this.factories = factories; - } - - public Map> getLoadBalancePolicies() - { - return loadBalancePolicies; - } - - public void setLoadBalancePolicies(Map> loadBalancePolicies) - { - this.loadBalancePolicies = loadBalancePolicies; - } - - // Functional Methods - - /** - * Obtains the Proxy Factory Class with the specified registered name + /* + * EJBTHREE-1641 * - * @param name The registered name of the proxy factory to retrieve - * @return The Proxy Factory + * This is in place as a dummy class until this reference may be removed + * safely from AS Ejb3Deployer. + * + * ejb3-plugin must always be compatible with the last release of AS, + * at time of this writing this is AS 5.0.0.GA. */ - public Class getProxyFactoryClass(String name) throws ProxyFactoryNotRegisteredException - { - // Obtain proxy factory - Class proxyFactory = this.factories.get(name); - - // Ensure registered - if (proxyFactory == null) - { - throw new ProxyFactoryNotRegisteredException("Remoting Proxy Factory with name " + name - + " is not registered."); - } - - // Return - return proxyFactory; - - } - public Class getLoadBalancePolicy(String name) throws LoadBalancePolicyNotRegisteredException - { - // Obtain Load Balance Policy - Class loadBalancePolicy = this.loadBalancePolicies.get(name); - - // Ensure registered - if (loadBalancePolicy == null) - { - throw new LoadBalancePolicyNotRegisteredException("LoadBalancePolicy with name " + name - + " is not registered."); - } - - // Return - return loadBalancePolicy; - - } } Index: src/main/java/org/jboss/ejb3/proxy/handler/BaseProxyInvocationHandlerRemote.java =================================================================== --- src/main/java/org/jboss/ejb3/proxy/handler/BaseProxyInvocationHandlerRemote.java (revision 83932) +++ src/main/java/org/jboss/ejb3/proxy/handler/BaseProxyInvocationHandlerRemote.java (working copy) @@ -1,81 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2006, Red Hat Middleware LLC, and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.ejb3.proxy.handler; - -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; - -import org.jboss.aop.advice.Interceptor; -import org.jboss.aop.metadata.SimpleMetaData; -import org.jboss.ejb3.Container; -import org.jboss.ejb3.Ejb3Registry; - -/** - * Comment - * - * @author Bill Burke - * @version $Revision$ - */ -public abstract class BaseProxyInvocationHandlerRemote extends BaseProxyInvocationHandler implements java.io.Serializable, InvocationHandler, RemoteProxyInvocationHandler -{ - private static final long serialVersionUID = 1126421850898582900L; - - protected String containerId; - protected String containerGuid; - protected Interceptor[] interceptors; - protected SimpleMetaData metadata; - - protected BaseProxyInvocationHandlerRemote(Container container, Interceptor[] interceptors, String businessInterfaceType) - { - this.containerId = container.getObjectName().getCanonicalName(); - this.containerGuid = Ejb3Registry.guid(container); - this.interceptors = interceptors; - this.setBusinessInterfaceType(businessInterfaceType); - } - - protected BaseProxyInvocationHandlerRemote(String containerId, String containerGuid, Interceptor[] interceptors, String businessInterfaceType) - { - this.containerId = containerId; - this.containerGuid = containerGuid; - this.interceptors = interceptors; - this.setBusinessInterfaceType(businessInterfaceType); - } - - protected BaseProxyInvocationHandlerRemote() - { - } - - public SimpleMetaData getMetaData() - { - synchronized (this) - { - if (metadata == null) metadata = new SimpleMetaData(); - } - return metadata; - } - - public abstract Object invoke(Object proxy, Method method, Object[] args) - throws Throwable; - - //Force all remote proxies to override toString() - public abstract String toString(); -} Index: src/main/java/org/jboss/ejb3/proxy/handler/BaseProxyInvocationHandler.java =================================================================== --- src/main/java/org/jboss/ejb3/proxy/handler/BaseProxyInvocationHandler.java (revision 83932) +++ src/main/java/org/jboss/ejb3/proxy/handler/BaseProxyInvocationHandler.java (working copy) @@ -1,60 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2008, Red Hat Middleware LLC, and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.ejb3.proxy.handler; - -/** - * BaseProxyInvocationHandler - * - * Abstract base upon which all Proxy InvocationHandlers - * may extend - * - * @author ALR - * @version $Revision: $ - * @deprecated Has moved to EJB3 Proxy Component as ProxyInvocationHandlerBase - */ -@Deprecated -public abstract class BaseProxyInvocationHandler implements ProxyInvocationHandlerDeprecated -{ - // ------------------------------------------------------------------------------|| - // Instance Members -------------------------------------------------------------|| - // ------------------------------------------------------------------------------|| - - /** - * Fully-qualified name of the class targeted either for injection - * or casting to support getInvokedBusinessInterface - */ - private String businessInterfaceType; - - // ------------------------------------------------------------------------------|| - // Accessors / Mutators ---------------------------------------------------------|| - // ------------------------------------------------------------------------------|| - - public String getBusinessInterfaceType() - { - return businessInterfaceType; - } - - protected void setBusinessInterfaceType(String businessInterfaceType) - { - this.businessInterfaceType = businessInterfaceType; - } -} Index: src/main/java/org/jboss/ejb3/proxy/handler/BaseSessionRemoteProxyInvocationHandler.java =================================================================== --- src/main/java/org/jboss/ejb3/proxy/handler/BaseSessionRemoteProxyInvocationHandler.java (revision 83932) +++ src/main/java/org/jboss/ejb3/proxy/handler/BaseSessionRemoteProxyInvocationHandler.java (working copy) @@ -1,81 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2006, Red Hat Middleware LLC, and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.ejb3.proxy.handler; - -import javax.ejb.EJBMetaData; -import javax.ejb.Handle; -import javax.ejb.HomeHandle; - -import org.jboss.aop.advice.Interceptor; -import org.jboss.ejb3.Container; - -/** - * Comment - * - * @author William DeCoste - * @version $Revision$ - */ -public abstract class BaseSessionRemoteProxyInvocationHandler extends org.jboss.ejb3.proxy.handler.BaseProxyInvocationHandlerRemote -{ - private static final long serialVersionUID = 8310915813626447181L; - - protected Object id; - - protected Handle handle; - protected HomeHandle homeHandle; - protected EJBMetaData ejbMetaData; - - public BaseSessionRemoteProxyInvocationHandler(Container container, Interceptor[] interceptors, String businessInterfaceType) - { - super(container, interceptors, businessInterfaceType); - } - - public BaseSessionRemoteProxyInvocationHandler(String containerId, String containerGuid, Interceptor[] interceptors, - String businessInterfaceType) - { - super(containerId, containerGuid, interceptors, businessInterfaceType); - } - - protected BaseSessionRemoteProxyInvocationHandler() - { - } - - public Handle getHandle() - { - return this.handle; - } - - public void setHandle(Handle handle) - { - this.handle = handle; - } - - public void setHomeHandle(HomeHandle homeHandle) - { - this.homeHandle = homeHandle; - } - - public void setEjbMetaData(EJBMetaData ejbMetaData) - { - this.ejbMetaData = ejbMetaData; - } -} Index: src/main/java/org/jboss/ejb3/proxy/handler/RemoteProxyInvocationHandler.java =================================================================== --- src/main/java/org/jboss/ejb3/proxy/handler/RemoteProxyInvocationHandler.java (revision 83932) +++ src/main/java/org/jboss/ejb3/proxy/handler/RemoteProxyInvocationHandler.java (working copy) @@ -1,35 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2006, Red Hat Middleware LLC, and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.ejb3.proxy.handler; - -import org.jboss.aop.metadata.SimpleMetaData; - -/** - * Comment - * - * @author Bill Burke - * @version $Revision$ - */ -public interface RemoteProxyInvocationHandler extends ProxyInvocationHandlerDeprecated -{ - SimpleMetaData getMetaData(); -} Index: src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulLocalHomeProxyInvocationHandler.java =================================================================== --- src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulLocalHomeProxyInvocationHandler.java (revision 83932) +++ src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulLocalHomeProxyInvocationHandler.java (working copy) @@ -1,79 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2006, Red Hat Middleware LLC, and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.ejb3.proxy.handler.stateful; - -import java.lang.reflect.Method; - -import org.jboss.aop.util.MethodHashing; -import org.jboss.ejb3.Container; -import org.jboss.ejb3.LocalProxyInvocationHandler; -import org.jboss.ejb3.proxy.ProxyUtils; -import org.jboss.ejb3.session.SessionContainer; - -/** - * StatefulLocalHomeProxyInvocationHandler - * - * @author Bill Burke - * @version $Revision: 68194 $ - */ -public class StatefulLocalHomeProxyInvocationHandler extends LocalProxyInvocationHandler -{ - private static final long serialVersionUID = -9026021347498876589L; - - public StatefulLocalHomeProxyInvocationHandler() - { - super(); - } - - public StatefulLocalHomeProxyInvocationHandler(Container container) - { - super(container, null); - } - - public Object invoke(Object proxy, Method method, Object[] args) - throws Throwable - { - // Attempt to handle locally - long hash = MethodHashing.calculateHash(method); - Object ret = ProxyUtils.handleCallLocally(hash, proxy, this, method, args); - if (ret != null) - { - // Was handled locally, return - return ret; - } - - // Invoke upon container - SessionContainer sfsb = (SessionContainer) getContainer(); - return sfsb.localHomeInvoke(method, args); - } - - public Object getAsynchronousProxy(Object proxy) - { - throw new RuntimeException("NOT AVAILABLE FOR HOME PROXIES"); - } - - public String toString() - { - return proxyName + ": Home Proxy"; - } - -} Index: src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulHomeRemoteProxyInvocationHandler.java =================================================================== --- src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulHomeRemoteProxyInvocationHandler.java (revision 83932) +++ src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulHomeRemoteProxyInvocationHandler.java (working copy) @@ -1,140 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2006, Red Hat Middleware LLC, and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.ejb3.proxy.handler.stateful; - -import java.lang.reflect.Method; - -import javax.ejb.EJBMetaData; -import javax.ejb.HomeHandle; - -import org.jboss.aop.Dispatcher; -import org.jboss.aop.advice.Interceptor; -import org.jboss.aop.util.MethodHashing; -import org.jboss.aop.util.PayloadKey; -import org.jboss.aspects.remoting.InvokeRemoteInterceptor; -import org.jboss.ejb3.Container; -import org.jboss.ejb3.proxy.ProxyUtils; -import org.jboss.ejb3.remoting.IsLocalInterceptor; -import org.jboss.ejb3.stateful.StatefulHandleRemoteImpl; -import org.jboss.ejb3.stateful.StatefulRemoteInvocation; -import org.jboss.logging.Logger; -import org.jboss.remoting.InvokerLocator; - -/** - * StatefulHomeRemoteProxyInvocationHandler - * - * @author Bill Burke - * @version $Revision: 72001 $ - */ -public class StatefulHomeRemoteProxyInvocationHandler extends org.jboss.ejb3.proxy.handler.BaseSessionRemoteProxyInvocationHandler -{ - private static final long serialVersionUID = 5509794838403316545L; - - private static final Logger log = Logger.getLogger(StatefulHomeRemoteProxyInvocationHandler.class); - - protected InvokerLocator uri; - private HomeHandle homeHandle; - private EJBMetaData ejbMetaData; - - public StatefulHomeRemoteProxyInvocationHandler(Container container, Interceptor[] interceptors, InvokerLocator uri) - { - super(container, interceptors, null); - this.uri = uri; - } - - public StatefulHomeRemoteProxyInvocationHandler(Container container, Interceptor[] interceptors, InvokerLocator uri, Object id) - { - super(container, interceptors, null); - this.uri = uri; - this.id = id; - } - - protected StatefulHomeRemoteProxyInvocationHandler() - { - } - - public void setHandle(StatefulHandleRemoteImpl handle) - { - this.handle = handle; - } - - public void setHomeHandle(HomeHandle homeHandle) - { - this.homeHandle = homeHandle; - } - - public void setEjbMetaData(EJBMetaData ejbMetaData) - { - this.ejbMetaData = ejbMetaData; - } - - public Object invoke(Object proxy, Method method, Object[] args) - throws Throwable - { - long hash = MethodHashing.calculateHash(method); - Object ret = ProxyUtils.handleCallLocally(hash, proxy, this, method, args); - if (ret != null) - { - return ret; - } - - ret = handleEjb21CallLocally(method, args); - if (ret != null) - { - return ret; - } - - StatefulRemoteInvocation sri = new StatefulRemoteInvocation(interceptors, hash, method, method, null, null); - sri.setArguments(args); - sri.setInstanceResolver(metadata); - sri.getMetaData().addMetaData(Dispatcher.DISPATCHER, Dispatcher.OID, containerId, PayloadKey.AS_IS); - sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.INVOKER_LOCATOR, uri, PayloadKey.AS_IS); - sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.SUBSYSTEM, "AOP", PayloadKey.AS_IS); - sri.getMetaData().addMetaData(IsLocalInterceptor.IS_LOCAL, IsLocalInterceptor.GUID, containerGuid, PayloadKey.AS_IS); - - return sri.invokeNext(); - } - - public Object getAsynchronousProxy(Object proxy) - { - throw new RuntimeException("NOT IMPLEMENTED"); - } - - public String toString() - { - return containerId.toString() + ":Home"; - } - - private Object handleEjb21CallLocally(Method method, Object[] args) - { - if (method.equals(ProxyUtils.GET_HOME_HANDLE)) - { - return homeHandle; - } - else if (method.equals(ProxyUtils.GET_EJB_METADATA)) - { - return ejbMetaData; - } - - return null; - } -} Index: src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulClusteredInvocationHandler.java =================================================================== --- src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulClusteredInvocationHandler.java (revision 83932) +++ src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulClusteredInvocationHandler.java (working copy) @@ -1,176 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2006, Red Hat Middleware LLC, and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.ejb3.proxy.handler.stateful; - -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; - -import org.jboss.aop.Dispatcher; -import org.jboss.aop.advice.Interceptor; -import org.jboss.aop.util.MethodHashing; -import org.jboss.aop.util.PayloadKey; -import org.jboss.aspects.asynch.AsynchMixin; -import org.jboss.aspects.asynch.AsynchProvider; -import org.jboss.aspects.remoting.ClusterConstants; -import org.jboss.aspects.remoting.FamilyWrapper; -import org.jboss.aspects.remoting.InvokeRemoteInterceptor; -import org.jboss.ejb3.Container; -import org.jboss.ejb3.asynchronous.AsynchronousInterceptor; -import org.jboss.ejb3.proxy.JBossProxy; -import org.jboss.ejb3.proxy.ProxyUtils; -import org.jboss.ejb3.remoting.ClusteredIsLocalInterceptor; -import org.jboss.ejb3.remoting.IsLocalInterceptor; -import org.jboss.ejb3.stateful.ForwardId; -import org.jboss.ejb3.stateful.StatefulConstants; -import org.jboss.ejb3.stateful.StatefulRemoteInvocation; -import org.jboss.ha.client.loadbalance.LoadBalancePolicy; -import org.jboss.util.id.GUID; - -/** - * InvocationHandler for a clustered SFSB proxy. - * - * @author Bill Burke - * @author Brian Stansberry - * @version $Revision: 68144 $ - */ -public class StatefulClusteredInvocationHandler extends org.jboss.ejb3.proxy.handler.BaseProxyInvocationHandlerRemote -{ - private static final long serialVersionUID = -1797802577940671292L; - - private Object id; - protected FamilyWrapper family; - protected LoadBalancePolicy lbPolicy; - protected AsynchProvider provider; - protected String partitionName; - protected Object originTarget; - - - public StatefulClusteredInvocationHandler(Container container, Interceptor[] interceptors, FamilyWrapper family, - LoadBalancePolicy lb, String partitionName, Object originTarget, Object id, String businessInterfaceType) - { - super(container, interceptors, businessInterfaceType); - this.family = family; - this.lbPolicy = lb; - this.partitionName = partitionName; - this.id = id; - this.originTarget = originTarget; - } - - public StatefulClusteredInvocationHandler(AsynchProvider provider, String containerId, String containerGuid, - Interceptor[] interceptors, FamilyWrapper family, LoadBalancePolicy lb, String partitionName, - Object originTarget, Object id, String businessInterfaceType) - { - super(containerId, containerGuid, interceptors, businessInterfaceType); - this.provider = provider; - this.family = family; - this.lbPolicy = lb; - this.partitionName = partitionName; - this.id = id; - this.originTarget = originTarget; - } - - protected StatefulClusteredInvocationHandler() - { - } - - public Object invoke(Object proxy, Method method, Object[] args) - throws Throwable - { - if (method.getDeclaringClass() == AsynchProvider.class) - { - return provider.getFuture(); - } - - long hash = MethodHashing.calculateHash(method); - Object ret = ProxyUtils.handleCallLocally(hash, (JBossProxy) proxy, this, method, args); - if (ret != null) - { - return ret; - } - - StatefulRemoteInvocation sri = new StatefulRemoteInvocation(interceptors, hash, method, method, null, id); - sri.setArguments(args); - sri.setInstanceResolver(metadata); - sri.getMetaData().addMetaData(Dispatcher.DISPATCHER, Dispatcher.OID, containerId, PayloadKey.AS_IS); - sri.getMetaData().addMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.CLUSTER_FAMILY_WRAPPER, family, PayloadKey.TRANSIENT); - sri.getMetaData().addMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.LOADBALANCE_POLICY, lbPolicy, PayloadKey.TRANSIENT); - sri.getMetaData().addMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.HA_TARGET, originTarget, PayloadKey.TRANSIENT); - sri.getMetaData().addMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.PARTITION_NAME, partitionName, PayloadKey.TRANSIENT); - 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); - StatefulClusteredInvocationHandler handler = new StatefulClusteredInvocationHandler(mixin, containerId, - containerGuid, newInterceptors, family, lbPolicy, partitionName, this.originTarget, this.id, - this.getBusinessInterfaceType()); - return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, handler); - } - - //I was already asynchronous - return proxy; - } - - public String toString() - { - if (id != null) - { - return containerId.toString() + ":" + id.toString(); - } - else - { - //If the proxy has not been used yet, create a temporary id - GUID guid = new GUID(); - return containerId.toString() + ":" + guid.toString(); - } - } - -} Index: src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulLocalProxyInvocationHandler.java =================================================================== --- src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulLocalProxyInvocationHandler.java (revision 83932) +++ src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulLocalProxyInvocationHandler.java (working copy) @@ -1,147 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2006, Red Hat Middleware LLC, and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.ejb3.proxy.handler.stateful; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; -import java.rmi.dgc.VMID; - -import javax.ejb.EJBException; - -import org.jboss.aspects.asynch.AsynchMixin; -import org.jboss.aspects.asynch.AsynchProvider; -import org.jboss.aspects.asynch.FutureHolder; -import org.jboss.ejb3.Container; -import org.jboss.ejb3.Ejb3Registry; -import org.jboss.ejb3.LocalProxyInvocationHandler; -import org.jboss.ejb3.proxy.ProxyUtils; -import org.jboss.ejb3.session.SessionContainer; - -/** - * Comment - * - * @author Bill Burke - * @version $Revision: 68194 $ - */ -public class StatefulLocalProxyInvocationHandler extends LocalProxyInvocationHandler -{ - private static final long serialVersionUID = 206913210970415540L; - - protected Object id; - AsynchProvider provider; - - protected boolean isClustered = false; - - public StatefulLocalProxyInvocationHandler(Container container, Object id, VMID vmid, String businessInterfaceType) - { - super(container, businessInterfaceType); - this.id = id; - this.containerGuid = Ejb3Registry.guid(container, vmid); - isClustered = ((SessionContainer) container).isClustered(); - } - - public StatefulLocalProxyInvocationHandler(AsynchProvider provider, Container container, Object id, - String businessInterfaceType) - { - super(container, businessInterfaceType); - this.provider = provider; - this.id = id; - this.containerGuid = Ejb3Registry.guid(container); - isClustered = ((SessionContainer) container).isClustered(); - } - - public StatefulLocalProxyInvocationHandler() - { - } - - //@Override - public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException - { - super.readExternal(in); - id = in.readObject(); - isClustered = in.readBoolean(); - } - - //@Override - public void writeExternal(ObjectOutput out) throws IOException - { - super.writeExternal(out); - out.writeObject(id); - out.writeBoolean(isClustered); - } - - public Object invoke(Object proxy, Method method, Object[] args) - throws Throwable - { - if (method.getDeclaringClass() == AsynchProvider.class) - { - return provider.getFuture(); - } - - // Make sure we get the cache id before getting the asynchronous interface - Object ret = ProxyUtils.handleCallLocally(proxy, this, method, args); - if (ret != null) - { - return ret; - } - - Container container = Ejb3Registry.findContainer(containerGuid); - if (isClustered && container == null && Ejb3Registry.hasClusterContainer(containerClusterUid)) - container = Ejb3Registry.getClusterContainer(containerClusterUid); - - if (container == null) - throw new EJBException("Invalid (i.e. remote) invocation of local interface (null container) for " + containerGuid); - - SessionContainer sfsb = (SessionContainer)container; - return sfsb.localInvoke(id, method, args, (FutureHolder) provider); - } - - public Object getAsynchronousProxy(Object proxy) - { - Class[] infs = proxy.getClass().getInterfaces(); - if (!ProxyUtils.isAsynchronous(infs)) - { - Class[] interfaces = ProxyUtils.addAsynchProviderInterface(infs); - AsynchMixin mixin = new AsynchMixin(); - StatefulLocalProxyInvocationHandler handler = new StatefulLocalProxyInvocationHandler(mixin, getContainer(), - id, this.getBusinessInterfaceType()); - return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, handler); - } - - //I was already asynchronous - return proxy; - } - - public String toString() - { - if (getContainer() != null && id != null) - { - return getContainer().getEjbName().toString() + ":" + id.toString(); - } - - return proxyName; - } - -} Index: src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulRemoteProxyInvocationHandler.java =================================================================== --- src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulRemoteProxyInvocationHandler.java (revision 83932) +++ src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulRemoteProxyInvocationHandler.java (working copy) @@ -1,202 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2006, Red Hat Middleware LLC, and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.ejb3.proxy.handler.stateful; - -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; - -import javax.ejb.EJBMetaData; -import javax.ejb.Handle; -import javax.ejb.HomeHandle; - -import org.jboss.aop.Dispatcher; -import org.jboss.aop.advice.Interceptor; -import org.jboss.aop.util.MethodHashing; -import org.jboss.aop.util.PayloadKey; -import org.jboss.aspects.asynch.AsynchMixin; -import org.jboss.aspects.asynch.AsynchProvider; -import org.jboss.aspects.remoting.InvokeRemoteInterceptor; -import org.jboss.ejb3.Container; -import org.jboss.ejb3.asynchronous.AsynchronousInterceptor; -import org.jboss.ejb3.proxy.ProxyUtils; -import org.jboss.ejb3.remoting.IsLocalInterceptor; -import org.jboss.ejb3.stateful.ForwardId; -import org.jboss.ejb3.stateful.StatefulConstants; -import org.jboss.ejb3.stateful.StatefulHandleRemoteImpl; -import org.jboss.ejb3.stateful.StatefulRemoteInvocation; -import org.jboss.logging.Logger; -import org.jboss.remoting.InvokerLocator; -import org.jboss.util.id.GUID; - -/** - * Comment - * - * @author Bill Burke - * @version $Revision: 72001 $ - */ -public class StatefulRemoteProxyInvocationHandler extends org.jboss.ejb3.proxy.handler.BaseSessionRemoteProxyInvocationHandler -{ - private static final long serialVersionUID = -2164496320326661428L; - - private static final Logger log = Logger.getLogger(StatefulRemoteProxyInvocationHandler.class); - - protected InvokerLocator uri; - AsynchProvider provider; - - private Handle handle; - private HomeHandle homeHandle; - private EJBMetaData ejbMetaData; - - public StatefulRemoteProxyInvocationHandler(Container container, Interceptor[] interceptors, InvokerLocator uri, Object id, - String businessInterfaceType) - { - super(container, interceptors, businessInterfaceType); - this.uri = uri; - this.id = id; - } - - public StatefulRemoteProxyInvocationHandler(AsynchProvider provider, String containerId, String containerGuid, - Interceptor[] interceptors, InvokerLocator uri, String businessInterfaceType) - { - super(containerId, containerGuid, interceptors, businessInterfaceType); - this.uri = uri; - this.provider = provider; - } - - protected StatefulRemoteProxyInvocationHandler() - { - } - - public void setHandle(StatefulHandleRemoteImpl handle) - { - this.handle = handle; - } - - public void setHomeHandle(HomeHandle homeHandle) - { - this.homeHandle = homeHandle; - } - - public void setEjbMetaData(EJBMetaData ejbMetaData) - { - this.ejbMetaData = ejbMetaData; - } - - public Object invoke(Object proxy, Method method, Object[] args) - throws Throwable - { - if (method.getDeclaringClass() == AsynchProvider.class) - { - return provider.getFuture(); - } - - long hash = MethodHashing.calculateHash(method); - Object ret = ProxyUtils.handleCallLocally(hash, proxy, this, method, args); - if (ret != null) - { - return ret; - } - - ret = handleEjb21CallLocally(method, args); - if (ret != null) - { - return ret; - } - - StatefulRemoteInvocation sri = new StatefulRemoteInvocation(interceptors, hash, method, method, null, id); - sri.setArguments(args); - sri.setInstanceResolver(metadata); - sri.getMetaData().addMetaData(Dispatcher.DISPATCHER, Dispatcher.OID, containerId, PayloadKey.AS_IS); - sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.INVOKER_LOCATOR, uri, PayloadKey.AS_IS); - sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.SUBSYSTEM, "AOP", PayloadKey.AS_IS); - sri.getMetaData().addMetaData(IsLocalInterceptor.IS_LOCAL, IsLocalInterceptor.GUID, containerGuid, PayloadKey.AS_IS); - - if (provider != null) - { - sri.getMetaData().addMetaData(AsynchronousInterceptor.ASYNCH, AsynchronousInterceptor.INVOKE_ASYNCH, "YES", PayloadKey.AS_IS); - } - try - { - Object rtn = sri.invokeNext(); - // if this is first invocation then container passes back actual ID - if (id == null) - { - id = sri.getResponseAttachment(StatefulConstants.NEW_ID); - } - return rtn; - } - catch (ForwardId forward) - { - // if this is first invocation then container passes back actual ID - // The ForwardId exception is needed if 1st operation throws an exception - id = forward.getId(); - throw forward.getCause(); - } - } - - public Object getAsynchronousProxy(Object proxy) - { - Class[] infs = proxy.getClass().getInterfaces(); - if (!ProxyUtils.isAsynchronous(infs)) - { - Class[] interfaces = ProxyUtils.addAsynchProviderInterface(infs); - AsynchMixin mixin = new AsynchMixin(); - Interceptor[] newInterceptors = ProxyUtils.addAsynchProxyInterceptor(mixin, interceptors); - StatefulRemoteProxyInvocationHandler handler = new StatefulRemoteProxyInvocationHandler(mixin, containerId, containerGuid, newInterceptors, uri, - this.getBusinessInterfaceType()); - return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, handler); - } - - //I was already asynchronous - return proxy; - } - - public String toString() - { - if (id != null) - { - return containerId.toString() + ":" + id.toString(); - } - else - { - //If the proxy has not been used yet, create a temporary id - GUID guid = new GUID(); - return containerId.toString() + ":" + guid.toString(); - } - } - - private Object handleEjb21CallLocally(Method method, Object[] args) - { - if (method.equals(ProxyUtils.GET_HOME_HANDLE)) - { - return homeHandle; - } else if (method.equals(ProxyUtils.GET_EJB_METADATA)) - { - return ejbMetaData; - } else if (method.equals(ProxyUtils.GET_HANDLE)) - { - return handle; - } - - return null; - } -} Index: src/main/java/org/jboss/ejb3/proxy/handler/stateless/StatelessClusteredInvocationHandler.java =================================================================== --- src/main/java/org/jboss/ejb3/proxy/handler/stateless/StatelessClusteredInvocationHandler.java (revision 83932) +++ src/main/java/org/jboss/ejb3/proxy/handler/stateless/StatelessClusteredInvocationHandler.java (working copy) @@ -1,143 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2006, Red Hat Middleware LLC, and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.ejb3.proxy.handler.stateless; - -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; -import org.jboss.aop.Dispatcher; -import org.jboss.aop.advice.Interceptor; -import org.jboss.aop.joinpoint.MethodInvocation; -import org.jboss.aop.util.MethodHashing; -import org.jboss.aop.util.PayloadKey; -import org.jboss.aspects.asynch.AsynchMixin; -import org.jboss.aspects.asynch.AsynchProvider; -import org.jboss.aspects.remoting.ClusterConstants; -import org.jboss.aspects.remoting.FamilyWrapper; -import org.jboss.aspects.remoting.InvokeRemoteInterceptor; -import org.jboss.ejb3.Container; -import org.jboss.ejb3.asynchronous.AsynchronousInterceptor; -import org.jboss.ejb3.proxy.JBossProxy; -import org.jboss.ejb3.proxy.ProxyUtils; -import org.jboss.ejb3.proxy.handler.BaseProxyInvocationHandlerRemote; -import org.jboss.ejb3.remoting.ClusteredIsLocalInterceptor; -import org.jboss.ejb3.remoting.IsLocalInterceptor; -import org.jboss.ha.client.loadbalance.LoadBalancePolicy; - -/** - * InvocationHandler for a clustered SLSB proxy. - * - * @author Bill Burke - * @author Brian Stansberry - * @version $Revision$ - */ -public class StatelessClusteredInvocationHandler extends BaseProxyInvocationHandlerRemote -{ - private static final long serialVersionUID = -4100015258079818357L; - - protected FamilyWrapper family; - protected LoadBalancePolicy lbPolicy; - protected AsynchProvider provider; - protected String partitionName; - protected Object originTarget; - - public StatelessClusteredInvocationHandler(Container container, Interceptor[] interceptors, FamilyWrapper family, - LoadBalancePolicy lbPolicy, String partitionName, Object originTarget, String businessInterfaceClassName) - { - super(container, interceptors, businessInterfaceClassName); - this.family = family; - this.lbPolicy = lbPolicy; - this.partitionName = partitionName; - this.originTarget = originTarget; - } - - public StatelessClusteredInvocationHandler(AsynchProvider provider, String containerId, String containerGuid, - Interceptor[] interceptors, FamilyWrapper family, LoadBalancePolicy lbPolicy, String partitionName, - Object originTarget, String businessInterfaceClassName) - { - super(containerId, containerGuid, interceptors, businessInterfaceClassName); - this.provider = provider; - this.family = family; - this.lbPolicy = lbPolicy; - this.partitionName = partitionName; - this.originTarget = originTarget; - } - - public StatelessClusteredInvocationHandler() - { - } - - public Object invoke(Object proxy, Method method, Object[] args) - throws Throwable - { - if (method.getDeclaringClass() == AsynchProvider.class) - { - return provider.getFuture(); - } - - long hash = MethodHashing.calculateHash(method); - Object ret = ProxyUtils.handleCallLocally(hash, (JBossProxy) proxy, this, method, args); - if (ret != null) - { - return ret; - } - - MethodInvocation sri = new MethodInvocation(interceptors, hash, method, method, null); - sri.setArguments(args); - sri.setInstanceResolver(metadata); - sri.getMetaData().addMetaData(Dispatcher.DISPATCHER, Dispatcher.OID, containerId, PayloadKey.AS_IS); - sri.getMetaData().addMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.CLUSTER_FAMILY_WRAPPER, family, PayloadKey.TRANSIENT); - sri.getMetaData().addMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.LOADBALANCE_POLICY, lbPolicy, PayloadKey.TRANSIENT); - sri.getMetaData().addMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.HA_TARGET, originTarget, PayloadKey.TRANSIENT); - sri.getMetaData().addMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.PARTITION_NAME, partitionName, PayloadKey.TRANSIENT); - sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.SUBSYSTEM, "AOP", PayloadKey.AS_IS); - sri.getMetaData().addMetaData(IsLocalInterceptor.IS_LOCAL, IsLocalInterceptor.GUID, containerGuid, PayloadKey.AS_IS); - - if (provider != null) - { - sri.getMetaData().addMetaData(AsynchronousInterceptor.ASYNCH, AsynchronousInterceptor.INVOKE_ASYNCH, "YES", PayloadKey.AS_IS); - } - return sri.invokeNext(); - } - - public Object getAsynchronousProxy(Object proxy) - { - Class[] infs = proxy.getClass().getInterfaces(); - if (!ProxyUtils.isAsynchronous(infs)) - { - Class[] interfaces = ProxyUtils.addAsynchProviderInterface(infs); - AsynchMixin mixin = new AsynchMixin(); - Interceptor[] newInterceptors = ProxyUtils.addAsynchProxyInterceptor(mixin, interceptors); - StatelessClusteredInvocationHandler handler = new StatelessClusteredInvocationHandler(mixin, containerId, - containerGuid, newInterceptors, family, lbPolicy, partitionName, this.originTarget, this.getBusinessInterfaceType()); - return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, handler); - } - - //I was already asynchronous - return proxy; - } - - public String toString() - { - return containerId.toString(); - } - -} Index: src/main/java/org/jboss/ejb3/proxy/handler/stateless/StatelessLocalProxyInvocationHandler.java =================================================================== --- src/main/java/org/jboss/ejb3/proxy/handler/stateless/StatelessLocalProxyInvocationHandler.java (revision 83932) +++ src/main/java/org/jboss/ejb3/proxy/handler/stateless/StatelessLocalProxyInvocationHandler.java (working copy) @@ -1,130 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2006, Red Hat Middleware LLC, and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.ejb3.proxy.handler.stateless; - -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; - -import javax.ejb.EJBException; - -import org.jboss.aspects.asynch.AsynchMixin; -import org.jboss.aspects.asynch.AsynchProvider; -import org.jboss.aspects.asynch.FutureHolder; -import org.jboss.ejb3.Container; -import org.jboss.ejb3.LocalProxyInvocationHandler; -import org.jboss.ejb3.proxy.ProxyUtils; -import org.jboss.ejb3.stateless.StatelessContainer; -import org.jboss.logging.Logger; - -/** - * Comment - * - * @author Bill Burke - * @version $Revision$ - */ -public class StatelessLocalProxyInvocationHandler extends LocalProxyInvocationHandler -{ - private static final long serialVersionUID = -3241008127518089831L; - - private static final Logger log = Logger.getLogger(StatelessLocalProxyInvocationHandler.class); - - AsynchProvider provider; - - public StatelessLocalProxyInvocationHandler() - { - } - - public StatelessLocalProxyInvocationHandler(Container container, String businessInterfaceType) - { - super(container, businessInterfaceType); - } - - public StatelessLocalProxyInvocationHandler(AsynchProvider provider, Container container, - String businessInterfaceType) - { - super(container, businessInterfaceType); - this.provider = provider; - } - - public Object invoke(Object proxy, Method method, Object[] args) - throws Throwable - { - if (method.getDeclaringClass() == AsynchProvider.class) - { - return provider.getFuture(); - } - - Object ret = ProxyUtils.handleCallLocally(proxy, this, method, args); - if (ret != null) - { - return ret; - } - - StatelessContainer container = (StatelessContainer) getContainer(); - - if (container == null) - { - throw new EJBException("Invalid invocation of local interface (null container)"); - } - - return container.localInvoke(method, args, (FutureHolder) provider); - } - - public Object getAsynchronousProxy(Object proxy) - { - Class[] infs = proxy.getClass().getInterfaces(); - if (!ProxyUtils.isAsynchronous(infs)) - { - Class[] interfaces = ProxyUtils.addAsynchProviderInterface(infs); - AsynchMixin mixin = new AsynchMixin(); - StatelessLocalProxyInvocationHandler handler = new StatelessLocalProxyInvocationHandler(mixin, getContainer(), - this.getBusinessInterfaceType()); - return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, handler); - } - - //I was already asynchronous - return proxy; - } -/* - @Override - public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException - { - super.readExternal(in); - provider = (AsynchProvider)in.readObject(); - } - - @Override - public void writeExternal(ObjectOutput out) throws IOException - { - super.writeExternal(out); - out.writeObject(provider); - } -*/ - - public String toString() - { - if (getContainer() == null) - return proxyName; - else - return getContainer().getEjbName(); - } -} Index: src/main/java/org/jboss/ejb3/proxy/handler/stateless/StatelessRemoteProxyInvocationHandler.java =================================================================== --- src/main/java/org/jboss/ejb3/proxy/handler/stateless/StatelessRemoteProxyInvocationHandler.java (revision 83932) +++ src/main/java/org/jboss/ejb3/proxy/handler/stateless/StatelessRemoteProxyInvocationHandler.java (working copy) @@ -1,150 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2006, Red Hat Middleware LLC, and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.ejb3.proxy.handler.stateless; - -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; - -import org.jboss.aop.Dispatcher; -import org.jboss.aop.advice.Interceptor; -import org.jboss.aop.joinpoint.MethodInvocation; -import org.jboss.aop.util.MethodHashing; -import org.jboss.aop.util.PayloadKey; -import org.jboss.aspects.asynch.AsynchMixin; -import org.jboss.aspects.asynch.AsynchProvider; -import org.jboss.aspects.remoting.InvokeRemoteInterceptor; -import org.jboss.ejb3.Container; -import org.jboss.ejb3.asynchronous.AsynchronousInterceptor; -import org.jboss.ejb3.proxy.ProxyUtils; -import org.jboss.ejb3.proxy.handler.BaseSessionRemoteProxyInvocationHandler; -import org.jboss.ejb3.remoting.IsLocalInterceptor; -import org.jboss.logging.Logger; -import org.jboss.remoting.InvokerLocator; - -/** - * Comment - * - * @author Bill Burke - * @version $Revision$ - */ -public class StatelessRemoteProxyInvocationHandler extends org.jboss.ejb3.proxy.handler.BaseSessionRemoteProxyInvocationHandler -{ - private static final long serialVersionUID = 2583299153931800023L; - private static final Logger log = Logger.getLogger(StatelessRemoteProxyInvocationHandler.class); - - protected InvokerLocator uri; - AsynchProvider provider; - - public StatelessRemoteProxyInvocationHandler(Container container, Interceptor[] interceptors, InvokerLocator uri, String businessInterfaceType) - { - super(container, interceptors, businessInterfaceType); - this.uri = uri; - } - - public StatelessRemoteProxyInvocationHandler(AsynchProvider provider, String containerId, String containerGuid, Interceptor[] interceptors, InvokerLocator uri, String businessInterfaceType) - { - super(containerId, containerGuid, interceptors, businessInterfaceType); - this.uri = uri; - this.provider = provider; - } - - - protected StatelessRemoteProxyInvocationHandler() - { - } - - - public Object invoke(Object proxy, Method method, Object[] args) - throws Throwable - { - if (method.getDeclaringClass() == AsynchProvider.class) - { - return provider.getFuture(); - } - - long hash = MethodHashing.calculateHash(method); - Object ret = ProxyUtils.handleCallLocally(hash, proxy, this, method, args); - if (ret != null) - { - return ret; - } - - ret = handleEjb21CallLocally(method, args); - if (ret != null) - { - return ret; - } - - MethodInvocation sri = new MethodInvocation(interceptors, hash, method, method, null); - sri.setArguments(args); - sri.setInstanceResolver(metadata); - sri.getMetaData().addMetaData(Dispatcher.DISPATCHER, Dispatcher.OID, containerId, PayloadKey.AS_IS); - sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.INVOKER_LOCATOR, uri, PayloadKey.AS_IS); - sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.SUBSYSTEM, "AOP", PayloadKey.AS_IS); - sri.getMetaData().addMetaData(IsLocalInterceptor.IS_LOCAL, IsLocalInterceptor.GUID, containerGuid, PayloadKey.AS_IS); - - - if (provider != null) - { - sri.getMetaData().addMetaData(AsynchronousInterceptor.ASYNCH, AsynchronousInterceptor.INVOKE_ASYNCH, "YES", PayloadKey.AS_IS); - } - return sri.invokeNext(); - } - - public Object getAsynchronousProxy(Object proxy) - { - Class[] infs = proxy.getClass().getInterfaces(); - if (!ProxyUtils.isAsynchronous(infs)) - { - Class[] interfaces = ProxyUtils.addAsynchProviderInterface(infs); - AsynchMixin mixin = new AsynchMixin(); - Interceptor[] newInterceptors = ProxyUtils.addAsynchProxyInterceptor(mixin, interceptors); - StatelessRemoteProxyInvocationHandler handler = new StatelessRemoteProxyInvocationHandler(mixin, containerId, - containerGuid, newInterceptors, uri, this.getBusinessInterfaceType()); - return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, handler); - } - - //I was already asynchronous - return proxy; - } - - public String toString() - { - return containerId.toString(); - } - - private Object handleEjb21CallLocally(Method method, Object[] args) - { - if (method.equals(ProxyUtils.GET_HOME_HANDLE)) - { - return homeHandle; - } else if (method.equals(ProxyUtils.GET_EJB_METADATA)) - { - return ejbMetaData; - } else if (method.equals(ProxyUtils.GET_HANDLE)) - { - return handle; - } - - return null; - } -} Index: src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandlerDeprecated.java =================================================================== --- src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandlerDeprecated.java (revision 83932) +++ src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandlerDeprecated.java (working copy) @@ -1,46 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2006, Red Hat Middleware LLC, and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ - -package org.jboss.ejb3.proxy.handler; - -/** - * ProxyInvocationHandler - * - * Defines - * - * @author Kabir Khan - * @author ALR - * @version $Revision: 73407 $ - * @deprecated Has moved to EJB3 Proxy Component - */ -@Deprecated -public interface ProxyInvocationHandlerDeprecated -{ - /** - * For use in hashCode, toString() and equals() * - */ - String toString(); - - Object getAsynchronousProxy(Object proxy); - - String getBusinessInterfaceType(); -} \ No newline at end of file Index: src/main/java/org/jboss/ejb3/asynchronous/Asynch.java =================================================================== --- src/main/java/org/jboss/ejb3/asynchronous/Asynch.java (revision 83932) +++ src/main/java/org/jboss/ejb3/asynchronous/Asynch.java (working copy) @@ -1,47 +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.asynchronous; - -import org.jboss.ejb3.proxy.JBossProxy; -import org.jboss.aspects.asynch.Future; -import org.jboss.aspects.asynch.AsynchProvider; - -/** - * Helper class to make getting a asynch proxy and future easier. - * - * @author Bill Burke - * @version $Revision$ - */ -public class Asynch -{ - public static Object getAsynchronousProxy(Object ejbRef) - { - JBossProxy proxy = (JBossProxy)ejbRef; - return proxy.getAsynchronousProxy(); - } - - public static Future getFutureResult(Object asynchProxy) - { - AsynchProvider provider = (AsynchProvider)asynchProxy; - return provider.getFuture(); - } -} Index: src/main/java/org/jboss/ejb3/asynchronous/AsynchronousInterceptor.java =================================================================== --- src/main/java/org/jboss/ejb3/asynchronous/AsynchronousInterceptor.java (revision 83932) +++ src/main/java/org/jboss/ejb3/asynchronous/AsynchronousInterceptor.java (working copy) @@ -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.asynchronous; - -import java.security.Principal; -import org.jboss.aop.advice.Interceptor; -import org.jboss.aop.joinpoint.Invocation; -import org.jboss.aop.joinpoint.MethodInvocation; -import org.jboss.aspects.asynch.AsynchAspect; -import org.jboss.aspects.asynch.Future; -import org.jboss.aspects.asynch.FutureHolder; -import org.jboss.aspects.asynch.ThreadPoolExecutor; -import org.jboss.aspects.remoting.InvokeRemoteInterceptor; -import org.jboss.aspects.tx.ClientTxPropagationInterceptor; -import org.jboss.logging.Logger; -import org.jboss.remoting.InvokerLocator; -import org.jboss.security.SecurityAssociation; -import org.jboss.tm.TransactionPropagationContextFactory; -import org.jboss.tm.TransactionPropagationContextUtil; - - -/** - * @author Kabir Khan - * @version $Revision$ - */ -public class AsynchronousInterceptor extends AsynchAspect implements Interceptor -{ - private static final Logger log = Logger.getLogger(AsynchronousInterceptor.class); - - public static final String ASYNCH = "ASYNCH"; - public static final String INVOKE_ASYNCH = "INVOKE_ASYNCH"; - public static final String FUTURE_HOLDER = "FUTURE_HOLDER"; - - public AsynchronousInterceptor() - { - try - { - super.executor = (org.jboss.aspects.asynch.ExecutorAbstraction)ThreadPoolExecutor.class.newInstance(); - } - catch (InstantiationException e) - { - throw new RuntimeException(e); - } - catch (IllegalAccessException e) - { - throw new RuntimeException(e); - } - } - - public String getName() - { - return "AsynchronousInterceptor"; - } - - public Object invoke(Invocation invocation) throws Throwable - { - MethodInvocation mi = (MethodInvocation) invocation; - - if (invocation.getMetaData(ASYNCH, INVOKE_ASYNCH) != null) - { - //TODO This should maybe go somewhere nicer - InvokerLocator locator = (InvokerLocator) invocation.getMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.INVOKER_LOCATOR); - if (locator == null) - { - //We are a local invocation. Add security and current transaction info to the invocation - // (for remote invocations this is done by the client side interceptors) - TransactionPropagationContextFactory tpcFactory = TransactionPropagationContextUtil.getTPCFactoryClientSide(); - if (tpcFactory != null) - { - Object tpc = tpcFactory.getTransactionPropagationContext(); - if (tpc != null) - { - invocation.getMetaData().addMetaData(ClientTxPropagationInterceptor.TRANSACTION_PROPAGATION_CONTEXT, - ClientTxPropagationInterceptor.TRANSACTION_PROPAGATION_CONTEXT, tpc); - } - } - - Principal principal = SecurityAssociation.getPrincipal(); - if (principal != null) invocation.getMetaData().addMetaData("security", "principal", principal); - - Object credential = SecurityAssociation.getCredential(); - if (credential != null) invocation.getMetaData().addMetaData("security", "credential", credential); - } - - return super.execute(mi); - } - return mi.invokeNext(); - } - - //@Override - protected void setupLocalFuture(MethodInvocation invocation, Future future) - { - FutureHolder provider = (FutureHolder) invocation.getMetaData(ASYNCH, FUTURE_HOLDER); - provider.setFuture(future); - } - - /** - * We don't want to generate proxies for ejb 3 clients, to avoid dependencies on javassist. - * Use a dynamic proxy to the future instead - */ - //@Override - protected boolean generateProxy() - { - return false; - } - - -} Index: src/main/java/org/jboss/ejb3/mdb/ProducerFactory.java =================================================================== --- src/main/java/org/jboss/ejb3/mdb/ProducerFactory.java (revision 83932) +++ src/main/java/org/jboss/ejb3/mdb/ProducerFactory.java (working copy) @@ -38,8 +38,8 @@ import org.jboss.ejb3.annotation.Producer; import org.jboss.ejb3.annotation.Producers; import org.jboss.ejb3.annotation.impl.ProducerImpl; +import org.jboss.ejb3.proxy.JndiSessionProxyObjectFactory; import org.jboss.ejb3.proxy.ProxyFactory; -import org.jboss.ejb3.proxy.JndiSessionProxyObjectFactory; import org.jboss.logging.Logger; import org.jboss.util.naming.Util; Index: src/main/java/org/jboss/ejb3/mdb/RemoteProducerFactory.java =================================================================== --- src/main/java/org/jboss/ejb3/mdb/RemoteProducerFactory.java (revision 83932) +++ src/main/java/org/jboss/ejb3/mdb/RemoteProducerFactory.java (working copy) @@ -34,7 +34,7 @@ import org.jboss.ejb3.Container; import org.jboss.ejb3.annotation.MessageProperties; import org.jboss.ejb3.proxy.ProxyFactory; -import org.jboss.ejb3.proxy.factory.RemoteProxyFactory; +import org.jboss.ejb3.proxy.remoting.ProxyRemotingUtils; import org.jboss.util.naming.Util; /** @@ -83,7 +83,7 @@ { super.start(); Class[] interfaces = {ProxyFactory.class}; - Object factoryProxy = Remoting.createPojiProxy(jndiName + PROXY_FACTORY_NAME, interfaces, RemoteProxyFactory.DEFAULT_CLIENT_BINDING); + Object factoryProxy = Remoting.createPojiProxy(jndiName + PROXY_FACTORY_NAME, interfaces, ProxyRemotingUtils.getDefaultClientBinding()); try { Util.rebind(ctx, jndiName + PROXY_FACTORY_NAME, factoryProxy); Index: src/main/java/org/jboss/ejb3/Ejb3Deployment.java =================================================================== --- src/main/java/org/jboss/ejb3/Ejb3Deployment.java (revision 83932) +++ src/main/java/org/jboss/ejb3/Ejb3Deployment.java (working copy) @@ -121,7 +121,6 @@ private MessageDestinationReferenceResolver messageDestinationReferenceResolver = new DefaultMessageDestinationReferenceResolver(); protected CacheFactoryRegistry cacheFactoryRegistry; - protected RemoteProxyFactoryRegistry remoteProxyFactoryRegistry; protected PersistenceManagerFactoryRegistry persistenceManagerFactoryRegistry; protected PoolFactoryRegistry poolFactoryRegistry; @@ -207,13 +206,17 @@ this.cacheFactoryRegistry = registry; } + @Deprecated public RemoteProxyFactoryRegistry getRemoteProxyFactoryRegistry() { - return remoteProxyFactoryRegistry; + log.warn("[EJBTHREE-1641] NoOp getRemoteProxyFactoryRegistry; developers may ignore this message; it will be removed when backwards-compatibility between EJB3 and AS is resolved"); + return null; } + + @Deprecated public void setRemoteProxyFactoryRegistry(RemoteProxyFactoryRegistry registry) { - this.remoteProxyFactoryRegistry = registry; + log.warn("[EJBTHREE-1641] NoOp setRemoteProxyFactoryRegistry; developers may ignore this message; it will be removed when backwards-compatibility between EJB3 and AS is resolved"); } public PersistenceManagerFactoryRegistry getPersistenceManagerFactoryRegistry() Index: src/main/resources/META-INF/ejb3-deployers-jboss-beans.xml =================================================================== --- src/main/resources/META-INF/ejb3-deployers-jboss-beans.xml (revision 83932) +++ src/main/resources/META-INF/ejb3-deployers-jboss-beans.xml (working copy) @@ -44,7 +44,6 @@ - false @@ -224,51 +223,6 @@ - - - - - - - - RemoteProxyFactory - org.jboss.ejb3.proxy.factory.RemoteProxyFactory - - - - IORFactory - org.jboss.ejb3.iiop.IORFactory - - - - ServiceRemoteProxyFactory - org.jboss.ejb3.proxy.factory.session.service.ServiceRemoteProxyFactory - - - - StatefulClusterProxyFactory - org.jboss.ejb3.proxy.factory.stateful.StatefulClusterProxyFactory - - - - StatefulRemoteProxyFactory - org.jboss.ejb3.proxy.factory.stateful.StatefulRemoteProxyFactory - - - - StatelessClusterProxyFactory - org.jboss.ejb3.proxy.factory.stateless.StatelessClusterProxyFactory - - - - StatelessRemoteProxyFactory - org.jboss.ejb3.proxy.factory.stateless.StatelessRemoteProxyFactory - - - - - Index: src/main/resources/ejb3-interceptors-aop.xml =================================================================== --- src/main/resources/ejb3-interceptors-aop.xml (revision 83932) +++ src/main/resources/ejb3-interceptors-aop.xml (working copy) @@ -17,20 +17,6 @@ - - - - - - - - - - - - - - @@ -62,7 +48,6 @@ - @@ -157,7 +142,6 @@ - @@ -187,7 +171,6 @@ - @@ -217,7 +200,6 @@ - @@ -287,7 +269,6 @@ - @@ -402,7 +383,6 @@ - @@ -429,7 +409,6 @@ - Index: pom.xml =================================================================== --- pom.xml (revision 83932) +++ pom.xml (working copy) @@ -342,12 +342,6 @@ - - - org.jboss.ejb3 - jboss-ejb3-async - 1.0.0 - org.jboss.ejb3