[jboss-cvs] JBossAS SVN: r74169 - in projects/ejb3/trunk/core: src/main/java/org/jboss/ejb3/service and 4 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Jun 5 17:19:42 EDT 2008
Author: ALRubinger
Date: 2008-06-05 17:19:42 -0400 (Thu, 05 Jun 2008)
New Revision: 74169
Modified:
projects/ejb3/trunk/core/pom.xml
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/ServiceContainer.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionContainer.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java
projects/ejb3/trunk/core/src/main/resources/META-INF/ejb3-deployers-beans.xml
Log:
[EJBTHREE-1385] Reverted Refactoring onto Proxy Component for release, to be reversed
Modified: projects/ejb3/trunk/core/pom.xml
===================================================================
--- projects/ejb3/trunk/core/pom.xml 2008-06-05 21:08:58 UTC (rev 74168)
+++ projects/ejb3/trunk/core/pom.xml 2008-06-05 21:19:42 UTC (rev 74169)
@@ -320,12 +320,6 @@
<dependency>
<groupId>org.jboss.ejb3</groupId>
- <artifactId>jboss-ejb3-proxy</artifactId>
- <version>0.1.0-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.ejb3</groupId>
<artifactId>jboss-ejb3-test</artifactId>
<version>0.1.1-SNAPSHOT</version>
<scope>test</scope>
@@ -336,7 +330,7 @@
<artifactId>jboss-ejb3-transactions</artifactId>
<version>0.13.1-SNAPSHOT</version>
</dependency>
-
+
<dependency>
<groupId>org.jboss.embedded</groupId>
<artifactId>jboss-embedded</artifactId>
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/ServiceContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/ServiceContainer.java 2008-06-05 21:08:58 UTC (rev 74168)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/ServiceContainer.java 2008-06-05 21:19:42 UTC (rev 74169)
@@ -61,7 +61,6 @@
import org.jboss.ejb3.proxy.factory.SessionProxyFactory;
import org.jboss.ejb3.proxy.factory.service.ServiceLocalProxyFactory;
import org.jboss.ejb3.proxy.factory.service.ServiceRemoteProxyFactory;
-import org.jboss.ejb3.proxy.lang.SerializableMethod;
import org.jboss.ejb3.session.SessionContainer;
import org.jboss.ejb3.timerservice.TimedObjectInvoker;
import org.jboss.ejb3.timerservice.TimerServiceFactory;
@@ -207,7 +206,6 @@
public void start() throws Exception
{
super.start();
- proxyDeployer.start();
try
{
@@ -233,7 +231,7 @@
}
public void stop() throws Exception
- {
+ {
invokeOptionalMethod("stop");
if (timerService != null)
@@ -249,15 +247,6 @@
beanContext = null;
super.stop();
-
- try
- {
- proxyDeployer.stop();
- }
- catch (Exception ignore)
- {
- log.debug("Proxy deployer stop failed", ignore);
- }
}
public void destroy() throws Exception
@@ -535,6 +524,21 @@
return delegate.invoke(actionName, params, signature);
}
+ @Override
+ protected Object invokeEJBObjectMethod(ProxyFactory factory, Object id, MethodInfo info, Object[] args) throws Exception
+ {
+ throw new RuntimeException("NYI");
+ }
+
+
+ //TODO This shouldn't be required of @Service
+ @Override
+ protected Object invokeHomeCreate(SessionProxyFactory factory, Method unadvisedMethod, Object args[])
+ throws Exception
+ {
+ throw new NotImplementedException("Invalid for " + ServiceContainer.class.getName());
+ }
+
public MBeanInfo getMBeanInfo()
{
return delegate.getMBeanInfo();
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionContainer.java 2008-06-05 21:08:58 UTC (rev 74168)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionContainer.java 2008-06-05 21:19:42 UTC (rev 74169)
@@ -29,6 +29,7 @@
import java.util.List;
import java.util.Map;
+import javax.ejb.EJBLocalObject;
import javax.ejb.EJBObject;
import javax.ejb.Handle;
import javax.ejb.LocalHome;
@@ -54,7 +55,6 @@
import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
import org.jboss.ejb3.proxy.factory.SessionProxyFactory;
-import org.jboss.ejb3.proxy.lang.SerializableMethod;
import org.jboss.ejb3.remoting.IsLocalInterceptor;
import org.jboss.ejb3.stateful.StatefulContainerInvocation;
import org.jboss.ha.framework.server.HATarget;
@@ -75,6 +75,18 @@
protected ProxyDeployer proxyDeployer;
private Map<String, HATarget> clusterFamilies;
+
+ public class InvokedMethod
+ {
+ public InvokedMethod(boolean localInterface, Method method)
+ {
+ isLocalInterface = localInterface;
+ this.method = method;
+ }
+
+ public boolean isLocalInterface;
+ public Method method;
+ }
/**
* Returns a remote binding for this container
@@ -96,10 +108,7 @@
return binding;
}
- //TODO This should be available in ThreadLocal Scope via an Interceptor
- // http://jira.jboss.com/jira/browse/EJBTHREE-1269
- // http://jira.jboss.com/jira/browse/EJBTHREE-1268
- protected ThreadLocalStack<SerializableMethod> invokedMethod = new ThreadLocalStack<SerializableMethod>();
+ protected ThreadLocalStack<InvokedMethod> invokedMethod = new ThreadLocalStack<InvokedMethod>();
public SessionContainer(ClassLoader cl, String beanClassName, String ejbName, Domain domain,
Hashtable ctxProperties, Ejb3Deployment deployment, JBossSessionBeanMetaData beanMetaData) throws ClassNotFoundException
@@ -126,14 +135,24 @@
public Class<?> getInvokedBusinessInterface()
{
-
- SerializableMethod method = invokedMethod.get();
+ InvokedMethod method = invokedMethod.get();
if (method == null) throw new IllegalStateException("getInvokedBusinessInterface() being invoked outside of a business invocation");
- if (method.getName() == null || method.getName().equals("")) throw new IllegalStateException("getInvokedBusinessInterface() being invoked outside of a business invocation");
-
- Class<?> invokedBusinessInterface = null;
-
- return invokedBusinessInterface;
+ if (method.method == null) throw new IllegalStateException("getInvokedBusinessInterface() being invoked outside of a business invocation");
+ if (method.isLocalInterface) return method.method.getDeclaringClass();
+ Class<?>[] remoteInterfaces = ProxyFactoryHelper.getRemoteAndBusinessRemoteInterfaces(this);
+ for (Class<?> intf : remoteInterfaces)
+ {
+ try
+ {
+ intf.getMethod(method.method.getName(), method.method.getParameterTypes());
+ return intf;
+ }
+ catch (NoSuchMethodException ignored)
+ {
+ // continue
+ }
+ }
+ throw new IllegalStateException("Unable to find geInvokedBusinessInterface()");
}
protected JBossSessionBeanMetaData getMetaData()
@@ -166,9 +185,7 @@
super.start();
// So that Remoting layer can reference this container easily.
Dispatcher.singleton.registerTarget(getObjectName().getCanonicalName(), new ClassProxyHack(this));
-
- //TODO Remove
- // proxyDeployer.start();
+ proxyDeployer.start();
}
/**
@@ -193,17 +210,16 @@
public void stop() throws Exception
{
- //TODO Remove
-// try
-// {
-// proxyDeployer.stop();
-// }
-// catch (Exception ignore)
-// {
-// log.debug("Proxy deployer stop failed", ignore);
-// }
try
{
+ proxyDeployer.stop();
+ }
+ catch (Exception ignore)
+ {
+ log.debug("Proxy deployer stop failed", ignore);
+ }
+ try
+ {
Dispatcher.singleton.unregisterTarget(getObjectName().getCanonicalName());
}
catch (Exception ignore)
@@ -300,6 +316,32 @@
}
*/
+ protected boolean isHomeMethod(Method method)
+ {
+ if (javax.ejb.EJBHome.class.isAssignableFrom(method.getDeclaringClass())) return true;
+ if (javax.ejb.EJBLocalHome.class.isAssignableFrom(method.getDeclaringClass())) return true;
+ return false;
+ }
+
+ protected boolean isEJBObjectMethod(Method method)
+ {
+ if (method.getDeclaringClass().getName().equals(EJBObject.class.getName()))
+ return true;
+
+ if (method.getDeclaringClass().getName().equals(EJBLocalObject.class.getName()))
+ return true;
+
+ return false;
+ }
+
+ protected boolean isHandleMethod(Method method)
+ {
+ if (method.getDeclaringClass().getName().equals(Handle.class.getName()))
+ return true;
+
+ return false;
+ }
+
public static InvocationResponse marshallException(Invocation invocation, Throwable exception, Map responseContext) throws Throwable
{
if (invocation.getMetaData(IsLocalInterceptor.IS_LOCAL,IsLocalInterceptor.IS_LOCAL) == null) throw exception;
@@ -340,9 +382,7 @@
* @param method the business or home method to invoke
* @param args the arguments for the method
* @param provider for asynchronous usage
- * @deprecated Use "invoke" as defined by InvokableContext
*/
- @Deprecated
public Object invoke(SessionProxyFactory factory, Object id, Method method, Object args[], FutureHolder provider) throws Throwable
{
ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
@@ -358,18 +398,17 @@
+ method.toString());
}
-
- // Handled now by SessionSpecContainer
- //Method unadvisedMethod = info.getUnadvisedMethod();
-// if (unadvisedMethod != null && isHomeMethod(unadvisedMethod))
-// {
-// return invokeHomeMethod(factory, info, args);
-// }
-// else if (unadvisedMethod != null && isEJBObjectMethod(unadvisedMethod))
-// {
-// return invokeEJBObjectMethod(factory, id, info, args);
-// }
+ Method unadvisedMethod = info.getUnadvisedMethod();
+ if (unadvisedMethod != null && isHomeMethod(unadvisedMethod))
+ {
+ return invokeHomeMethod(factory, info, args);
+ }
+ else if (unadvisedMethod != null && isEJBObjectMethod(unadvisedMethod))
+ {
+ return invokeEJBObjectMethod(factory, id, info, args);
+ }
+
// FIXME: Ahem, stateful container invocation works on all.... (violating contract though)
EJBContainerInvocation nextInvocation = new StatefulContainerInvocation(info, id);
nextInvocation.setAdvisor(getAdvisor());
@@ -381,7 +420,7 @@
ProxyUtils.addLocalAsynchronousInfo(nextInvocation, provider);
try
{
- invokedMethod.push(new SerializableMethod(method));
+ invokedMethod.push(new InvokedMethod(true, method));
return nextInvocation.invokeNext();
}
finally
@@ -397,6 +436,46 @@
}
/**
+ * TODO: work in progress (refactor both invokeHomeMethod's, localHomeInvoke)
+ * TODO: Move this to SessionSpecContainer
+ */
+ //TODO
+ private Object invokeHomeMethod(SessionProxyFactory factory, MethodInfo info, Object args[]) throws Exception
+ {
+ Method unadvisedMethod = info.getUnadvisedMethod();
+ if (unadvisedMethod.getName().equals("create"))
+ {
+ return this.invokeHomeCreate(factory, unadvisedMethod, args);
+ }
+ else if (unadvisedMethod.getName().equals("remove"))
+ {
+ if(args[0] instanceof Handle)
+ removeHandle((Handle) args[0]);
+ else
+ destroySession(args[0]);
+
+ return null;
+ }
+ else
+ {
+ throw new IllegalArgumentException("illegal home method " + unadvisedMethod);
+ }
+ }
+
+ /**
+ * Provides implementation for this bean's EJB 2.1 Home.create() method
+ *
+ * @param factory
+ * @param unadvisedMethod
+ * @param args
+ * @return
+ * @throws Exception
+ */
+ //TODO Move this to SessionSpecContainer
+ protected abstract Object invokeHomeCreate(SessionProxyFactory factory, Method unadvisedMethod, Object args[])
+ throws Exception;
+
+ /**
* Create session to an EJB bean.
*
* @param initParameterTypes the parameter types used by the home's create method
@@ -433,12 +512,12 @@
return proxyDeployer.hasJNDIBinding(jndiName);
}
- protected Object invokeEJBObjectMethod(Object id, MethodInfo info, Object args[]) throws Exception
+ protected Object invokeEJBObjectMethod(ProxyFactory factory, Object id, MethodInfo info, Object args[]) throws Exception
{
Method unadvisedMethod = info.getUnadvisedMethod();
if(unadvisedMethod.getName().equals("getEJBHome"))
{
- return this.getInitialContext().lookup(this.getMetaData().getHomeJndiName());
+ return factory.createHomeProxy();
}
if(unadvisedMethod.getName().equals("getPrimaryKey"))
{
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java 2008-06-05 21:08:58 UTC (rev 74168)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java 2008-06-05 21:19:42 UTC (rev 74169)
@@ -1,34 +1,11 @@
package org.jboss.ejb3.session;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
import java.util.Hashtable;
-import javax.ejb.EJBLocalObject;
-import javax.ejb.EJBObject;
-import javax.ejb.Handle;
-
-import org.jboss.aop.Dispatcher;
import org.jboss.aop.Domain;
-import org.jboss.aop.MethodInfo;
-import org.jboss.aop.util.MethodHashing;
-import org.jboss.beans.metadata.api.annotations.Start;
-import org.jboss.beans.metadata.api.annotations.Stop;
-import org.jboss.ejb3.EJBContainerInvocation;
import org.jboss.ejb3.Ejb3Deployment;
import org.jboss.ejb3.annotation.LocalBinding;
import org.jboss.ejb3.annotation.RemoteBinding;
-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.interceptors.container.ContainerMethodInvocation;
-import org.jboss.ejb3.proxy.container.InvokableContext;
-import org.jboss.ejb3.proxy.handler.session.stateful.StatefulProxyInvocationHandlerBase;
-import org.jboss.ejb3.proxy.jndiregistrar.JndiSessionRegistrarBase;
-import org.jboss.ejb3.proxy.lang.SerializableMethod;
-import org.jboss.ejb3.stateful.StatefulContainerInvocation;
-import org.jboss.logging.Logger;
import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
/**
@@ -41,31 +18,17 @@
* @version $Revision: $
*/
public abstract class SessionSpecContainer extends SessionContainer
- implements
- InvokableContext<ContainerMethodInvocation>
{
-
- // ------------------------------------------------------------------------------||
- // Class Members ----------------------------------------------------------------||
- // ------------------------------------------------------------------------------||
-
- private static final Logger log = Logger.getLogger(SessionSpecContainer.class);
-
- // ------------------------------------------------------------------------------||
- // Instance Members -------------------------------------------------------------||
- // ------------------------------------------------------------------------------||
-
- // ------------------------------------------------------------------------------||
- // Constructor ------------------------------------------------------------------||
- // ------------------------------------------------------------------------------||
-
+
+ // Constructor
+
public SessionSpecContainer(ClassLoader cl, String beanClassName, String ejbName, Domain domain,
Hashtable ctxProperties, Ejb3Deployment deployment, JBossSessionBeanMetaData beanMetaData)
throws ClassNotFoundException
{
super(cl, beanClassName, ejbName, domain, ctxProperties, deployment, beanMetaData);
}
-
+
/**
* Create a remote proxy (EJBObject) for an enterprise bean identified by id
*
@@ -111,298 +74,4 @@
* @throws Exception
*/
public abstract Object createProxyLocalEjb21(LocalBinding binding, String businessInterfaceType) throws Exception;
-
- /**
- * Obtains the JndiSessionRegistrarBase from MC, null if not found
- *
- * @return
- */
- protected JndiSessionRegistrarBase getJndiRegistrar()
- {
- // Initialize
- String jndiRegistrarBindName = this.getJndiRegistrarBindName();
-
- // Obtain Registrar
- Ejb3Registrar registrar = Ejb3RegistrarLocator.locateRegistrar();
-
- // Lookup
- Object obj = null;
- try
- {
- obj = registrar.lookup(jndiRegistrarBindName);
- }
- // If not installed, warn and return null
- catch (NotBoundException e)
- {
- log.warn("No " + JndiSessionRegistrarBase.class.getName()
- + " was found installed in the ObjectStore (Registry) at " + jndiRegistrarBindName);
- return null;
-
- }
-
- // Cast
- JndiSessionRegistrarBase jndiRegistrar = (JndiSessionRegistrarBase) obj;
-
- // Return
- return jndiRegistrar;
- }
-
- /**
- * Invokes the method described by the specified serializable method
- * as called from the specified proxy, using the specified arguments
- *
- * @param proxy The proxy making the invocation
- * @param method The method to be invoked
- * @param args The arguments to the invocation
- * @throws Throwable A possible exception thrown by the invocation
- * @return
- */
- public Object invoke(Object proxy, SerializableMethod method, Object[] args) throws Throwable
- {
- ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
- pushEnc();
- try
- {
- Method clMethod = method.toMethod(this.getClassloader());
- long hash = MethodHashing.calculateHash(clMethod);
- MethodInfo info = getAdvisor().getMethodInfo(hash);
- if (info == null)
- {
- throw new RuntimeException("Could not resolve beanClass method from proxy call: " + method.toString());
- }
-
- Method unadvisedMethod = info.getUnadvisedMethod();
-
- //TODO Use Polymorphism to have sessions only in StatefulContainer
- InvocationHandler handler = Proxy.getInvocationHandler(proxy);
- Object sessionId = null;
- if (handler instanceof StatefulProxyInvocationHandlerBase)
- {
- sessionId = ((StatefulProxyInvocationHandlerBase) handler).getSessionId();
- }
-
- if (unadvisedMethod != null && isHomeMethod(method))
- {
- return invokeHomeMethod(method, args);
- }
- else if (unadvisedMethod != null && this.isEjbObjectMethod(method))
- {
- return invokeEJBObjectMethod(sessionId, info, args);
- }
-
- // FIXME: Ahem, stateful container invocation works on all.... (violating contract though)
- EJBContainerInvocation nextInvocation = new StatefulContainerInvocation(info, sessionId);
- nextInvocation.setAdvisor(getAdvisor());
- nextInvocation.setArguments(args);
-
- // allow a container to supplement information into an invocation
- nextInvocation = populateInvocation(nextInvocation);
-
- //TODO Support Async Invocation
- // ProxyUtils.addLocalAsynchronousInfo(nextInvocation, provider);
- try
- {
- invokedMethod.push(method);
- return nextInvocation.invokeNext();
- }
- finally
- {
- invokedMethod.pop();
- }
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(oldLoader);
- popEnc();
- }
- }
-
- /**
- * Provides implementation for this bean's EJB 2.1 Home.create() method
- *
- * @param method
- * @param args
- * @return
- * @throws Exception
- */
- protected abstract Object invokeHomeCreate(SerializableMethod method, Object args[]) throws Exception;
-
- /**
- * TODO: work in progress (refactor both invokeHomeMethod's, localHomeInvoke)
- * TODO: Move this to SessionSpecContainer
- */
- //TODO
- private Object invokeHomeMethod(SerializableMethod method, Object args[]) throws Exception
- {
- if (method.getName().equals("create"))
- {
- return this.invokeHomeCreate(method, args);
- }
- else if (method.getName().equals("remove"))
- {
- if (args[0] instanceof Handle)
- removeHandle((Handle) args[0]);
- else
- destroySession(args[0]);
-
- return null;
- }
- else
- {
- throw new IllegalArgumentException("illegal home method " + method);
- }
- }
-
- /**
- * @deprecated Use isHomeMethod(SerializableMethod method) in SessionSpecContainer
- */
- @Deprecated
- protected boolean isHomeMethod(Method method)
- {
- if (javax.ejb.EJBHome.class.isAssignableFrom(method.getDeclaringClass()))
- return true;
- if (javax.ejb.EJBLocalHome.class.isAssignableFrom(method.getDeclaringClass()))
- return true;
- return false;
- }
-
- /**
- * Determines whether the specified method is an EJB2.x Home Method
- *
- * @param method
- * @return
- */
- protected boolean isHomeMethod(SerializableMethod method)
- {
- // Get the Method
- Method invokingMethod = method.toMethod(this.getClassloader());
-
- // Use legacy
- return this.isHomeMethod(invokingMethod);
- }
-
- /**
- * @param method
- * @return
- * @deprecated Use isEjbObjectMethod(SerializableMethod method)
- */
- @Deprecated
- protected boolean isEJBObjectMethod(Method method)
- {
- if (method.getDeclaringClass().getName().equals(EJBObject.class.getName()))
- return true;
-
- if (method.getDeclaringClass().getName().equals(EJBLocalObject.class.getName()))
- return true;
-
- return false;
- }
-
- /**
- * Determines whether the specified method is an EJB2.x Local
- * or Remote Method
- *
- * @param method
- * @return
- */
- protected boolean isEjbObjectMethod(SerializableMethod method)
- {
- // Get the Method
- Method invokingMethod = method.toMethod(this.getClassloader());
-
- // Use legacy
- return this.isEJBObjectMethod(invokingMethod);
- }
-
- /**
- *
- * @param method
- * @return
- * @deprecated Use isHandleMethod(SerializableMethod method)
- */
- @Deprecated
- protected boolean isHandleMethod(Method method)
- {
- if (method.getDeclaringClass().getName().equals(Handle.class.getName()))
- return true;
-
- return false;
- }
-
- /**
- * Determines if the specified Method is a Handle Method
- * @param method
- * @return
- */
- protected boolean isHandleMethod(SerializableMethod method)
- {
- // Get the Method
- Method invokingMethod = method.toMethod(this.getClassloader());
-
- // Use legacy
- return this.isHandleMethod(invokingMethod);
- }
-
- // ------------------------------------------------------------------------------||
- // Lifecycle Methods ------------------------------------------------------------||
- // ------------------------------------------------------------------------------||
-
- /**
- * Lifecycle Start
- */
- @Start
- @Override
- public void start() throws Exception
- {
- log.info("Starting " + this);
-
- super.start();
-
- // Register with Remoting
- Dispatcher.singleton.registerTarget(this.getName(), this);
-
- // Obtain registrar
- JndiSessionRegistrarBase registrar = this.getJndiRegistrar();
-
- // Bind all appropriate references/factories to Global JNDI for Client access, if a JNDI Registrar is present
- if (registrar != null)
- {
- registrar.bindEjb(this.getMetaData(), this.getClassloader(), this.getName());
- }
- else
- {
- log.warn("No " + JndiSessionRegistrarBase.class.getSimpleName()
- + " was found; byassing binding of Proxies to " + this.getName() + " in Global JNDI.");
- }
- }
-
- /**
- * Lifecycle Stop
- */
- @Override
- @Stop
- public void stop() throws Exception
- {
- log.info("Stopping " + this);
-
- super.stop();
-
- // Deregister with Remoting
- Dispatcher.singleton.unregisterTarget(this.getName());
-
- //TODO We need to unbind the EJB, something like:
- //JndiSessionRegistrarBase.unbindEjb(this.metaData);
- // or some key by which the registrar will keep track of all bindings
- }
-
- // --------------------------------------------------------------------------------||
- // Contracts ----------------------------------------------------------------------||
- // --------------------------------------------------------------------------------||
-
- /**
- * Returns the name under which the JNDI Registrar for this container is bound
- *
- * @return
- */
- protected abstract String getJndiRegistrarBindName();
}
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java 2008-06-05 21:08:58 UTC (rev 74168)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java 2008-06-05 21:19:42 UTC (rev 74169)
@@ -27,10 +27,8 @@
import java.lang.reflect.Modifier;
import java.rmi.NoSuchObjectException;
import java.rmi.RemoteException;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.Hashtable;
-import java.util.List;
import java.util.Map;
import javax.ejb.EJBHome;
@@ -51,7 +49,6 @@
import org.jboss.aop.joinpoint.InvocationResponse;
import org.jboss.aop.util.MethodHashing;
import org.jboss.aspects.asynch.FutureHolder;
-import org.jboss.beans.metadata.api.annotations.Stop;
import org.jboss.ejb3.BeanContext;
import org.jboss.ejb3.EJBContainerInvocation;
import org.jboss.ejb3.Ejb3Deployment;
@@ -68,14 +65,13 @@
import org.jboss.ejb3.proxy.ProxyFactory;
import org.jboss.ejb3.proxy.ProxyUtils;
import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
+import org.jboss.ejb3.proxy.factory.SessionProxyFactory;
import org.jboss.ejb3.proxy.factory.stateful.BaseStatefulRemoteProxyFactory;
import org.jboss.ejb3.proxy.factory.stateful.StatefulClusterProxyFactory;
import org.jboss.ejb3.proxy.factory.stateful.StatefulProxyFactory;
import org.jboss.ejb3.proxy.factory.stateful.StatefulRemoteProxyFactory;
import org.jboss.ejb3.proxy.impl.EJBMetaDataImpl;
import org.jboss.ejb3.proxy.impl.HomeHandleImpl;
-import org.jboss.ejb3.proxy.lang.SerializableMethod;
-import org.jboss.ejb3.proxy.objectstore.ObjectStoreBindings;
import org.jboss.ejb3.session.SessionContainer;
import org.jboss.ejb3.session.SessionSpecContainer;
import org.jboss.injection.Injector;
@@ -303,8 +299,6 @@
}
- @Stop
- @Override
public void stop() throws Exception
{
super.stop();
@@ -330,16 +324,6 @@
{
return this.getDeployment().getCacheFactoryRegistry();
}
-
- /**
- * Returns the name under which the JNDI Registrar for this container is bound
- *
- * @return
- */
- protected String getJndiRegistrarBindName()
- {
- return ObjectStoreBindings.OBJECTSTORE_BEAN_NAME_JNDI_REGISTRAR_SFSB;
- }
/**
* Performs a synchronous local invocation
@@ -422,7 +406,7 @@
ProxyUtils.addLocalAsynchronousInfo(nextInvocation, provider);
- invokedMethod.push(new SerializableMethod(method));
+ invokedMethod.push(new InvokedMethod(true, method));
return nextInvocation.invokeNext();
}
finally
@@ -540,7 +524,7 @@
Object rtn = null;
- invokedMethod.push(new SerializableMethod(unadvisedMethod));
+ invokedMethod.push(new InvokedMethod(false, unadvisedMethod));
rtn = newSi.invokeNext();
response = marshallResponse(invocation, rtn, newSi.getResponseContextInfo());
@@ -975,13 +959,10 @@
* @throws Exception
*/
@Override
- protected Object invokeHomeCreate(SerializableMethod method, Object args[])
+ protected Object invokeHomeCreate(SessionProxyFactory factory, Method unadvisedMethod, Object args[])
throws Exception
{
- // Lookup
- Object factory = this.getInitialContext().lookup(this.getMetaData().getHomeJndiName());
-
// Cast
String errorMessage = "Specified factory " + factory.getClass().getName() + " is not of type "
+ StatefulProxyFactory.class.getName() + " as required by " + StatefulContainer.class.getName();
@@ -1000,21 +981,15 @@
{};
Object[] initParameterValues =
{};
- if (method.getArgumentTypes().length > 0)
+ if (unadvisedMethod.getParameterTypes().length > 0)
{
- List<Class<?>> argTypes = new ArrayList<Class<?>>();
- for(String argTypeName : method.getArgumentTypes())
- {
- argTypes.add(this.getClassloader().loadClass(argTypeName));
- }
-
- initParameterTypes = argTypes.toArray(new Class<?>[]{});
+ initParameterTypes = unadvisedMethod.getParameterTypes();
initParameterValues = args;
}
Object id = createSession(initParameterTypes, initParameterValues);
- Object proxy = statefulFactory.createProxyBusiness(id, method.getReturnType());
+ Object proxy = statefulFactory.createProxyBusiness(id, unadvisedMethod.getReturnType().getName());
return proxy;
}
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java 2008-06-05 21:08:58 UTC (rev 74168)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java 2008-06-05 21:19:42 UTC (rev 74169)
@@ -22,17 +22,6 @@
package org.jboss.ejb3.stateless;
-import java.lang.reflect.Method;
-import java.util.Hashtable;
-import java.util.Map;
-
-import javax.ejb.EJBContext;
-import javax.ejb.EJBException;
-import javax.ejb.Handle;
-import javax.ejb.Timer;
-import javax.ejb.TimerService;
-import javax.naming.NamingException;
-
import org.jboss.aop.Domain;
import org.jboss.aop.MethodInfo;
import org.jboss.aop.joinpoint.Invocation;
@@ -55,8 +44,6 @@
import org.jboss.ejb3.proxy.factory.stateless.StatelessClusterProxyFactory;
import org.jboss.ejb3.proxy.factory.stateless.StatelessLocalProxyFactory;
import org.jboss.ejb3.proxy.factory.stateless.StatelessRemoteProxyFactory;
-import org.jboss.ejb3.proxy.lang.SerializableMethod;
-import org.jboss.ejb3.proxy.objectstore.ObjectStoreBindings;
import org.jboss.ejb3.session.SessionSpecContainer;
import org.jboss.ejb3.timerservice.TimedObjectInvoker;
import org.jboss.ejb3.timerservice.TimerServiceFactory;
@@ -74,7 +61,13 @@
import org.jboss.wsf.spi.invocation.integration.InvocationContextCallback;
import org.jboss.wsf.spi.invocation.integration.ServiceEndpointContainer;
+import javax.ejb.*;
+import javax.naming.NamingException;
+import java.lang.reflect.Method;
+import java.util.Hashtable;
+import java.util.Map;
+
/**
* Comment
*
@@ -317,7 +310,7 @@
{
invokeStats.callIn();
- invokedMethod.push(new SerializableMethod(unadvisedMethod));
+ invokedMethod.push(new InvokedMethod(true, unadvisedMethod));
if (unadvisedMethod != null && isHomeMethod(unadvisedMethod))
{
@@ -372,7 +365,7 @@
{
invokeStats.callIn();
- invokedMethod.push(new SerializableMethod(unadvisedMethod));
+ invokedMethod.push(new InvokedMethod(false, unadvisedMethod));
Map responseContext = null;
Object rtn = null;
if (unadvisedMethod != null && isHomeMethod(unadvisedMethod))
@@ -479,14 +472,11 @@
* @throws Exception
*/
@Override
- protected Object invokeHomeCreate(SerializableMethod unadvisedMethod, Object args[])
+ protected Object invokeHomeCreate(SessionProxyFactory factory, Method unadvisedMethod, Object args[])
throws Exception
{
- // Lookup factory
- Object factory = this.getInitialContext().lookup(this.getMetaData().getHomeJndiName());
- SessionProxyFactory proxyFactory = SessionProxyFactory.class.cast(factory);
- Object proxy = proxyFactory.createProxyBusiness(unadvisedMethod.getReturnType());
+ Object proxy = factory.createProxyBusiness(unadvisedMethod.getReturnType().getName());
return proxy;
}
@@ -598,16 +588,6 @@
return name;
}
- /**
- * Returns the name under which the JNDI Registrar for this container is bound
- *
- * @return
- */
- protected String getJndiRegistrarBindName()
- {
- return ObjectStoreBindings.OBJECTSTORE_BEAN_NAME_JNDI_REGISTRAR_SLSB;
- }
-
static class WSCallbackImpl implements BeanContextLifecycleCallback
{
private ExtensibleWebServiceContext jaxwsContext;
Modified: projects/ejb3/trunk/core/src/main/resources/META-INF/ejb3-deployers-beans.xml
===================================================================
--- projects/ejb3/trunk/core/src/main/resources/META-INF/ejb3-deployers-beans.xml 2008-06-05 21:08:58 UTC (rev 74168)
+++ projects/ejb3/trunk/core/src/main/resources/META-INF/ejb3-deployers-beans.xml 2008-06-05 21:19:42 UTC (rev 74169)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- EJB3 Deployers
+ JCA Deployers
-->
<deployment xmlns="urn:jboss:bean-deployer:2.0">
@@ -270,51 +270,6 @@
<!-- Persistence Unit deployers -->
<bean name="PersistenceUnitParsingDeployer" class="org.jboss.ejb3.deployers.PersistenceUnitParsingDeployer">
<property name="type">car</property>
- </bean>
-
- <!--
-
- JNDI Registrars
-
-
- The JNDI Registrar is responsible for all JNDI Bindings for
- an EJB. Its constructor takes the following arguments, in order:
-
- javax.naming.Context (JNDI Context into which to bind objects)
- org.jboss.ejb3.proxy.spi.registry.ProxyFactoryRegistry (Implementation of ProxyFactoryRegistry)
- String statelessSessionProxyObjectFactoryType The JNDI ObjectFactory implementation to use for SLSB
- ...more later when SFSB, @Service, MDB Implemented
-
- -->
-
- <!-- SLSB JNDI Registrar -->
- <bean name="org.jboss.ejb3.JndiRegistrar.Session.SLSBJndiRegistrar"
- class="org.jboss.ejb3.proxy.jndiregistrar.JndiStatelessSessionRegistrar">
- <constructor>
- <parameter>
- <inject bean="org.jboss.ejb3.JndiContext" />
- </parameter>
- <parameter>
- org.jboss.ejb3.proxy.objectfactory.session.stateless.StatelessSessionProxyObjectFactory
- </parameter>
- </constructor>
- </bean>
-
- <!-- SFSB JNDI Registrar -->
- <bean name="org.jboss.ejb3.JndiRegistrar.Session.SFSBJndiRegistrar"
- class="org.jboss.ejb3.proxy.jndiregistrar.JndiStatefulSessionRegistrar">
- <constructor>
- <parameter>
- <inject bean="org.jboss.ejb3.JndiContext" />
- </parameter>
- <parameter>
- org.jboss.ejb3.proxy.objectfactory.session.stateful.StatefulSessionProxyObjectFactory
- </parameter>
- </constructor>
- </bean>
-
- <!-- JNDI Registrar Configuration -->
- <bean name="org.jboss.ejb3.JndiContext"
- class="javax.naming.InitialContext" />
+ </bean>
</deployment>
More information about the jboss-cvs-commits
mailing list