org.openejb.core.stateless
Class StatelessContainer

java.lang.Object
  extended by org.openejb.core.stateless.StatelessContainer
All Implemented Interfaces:
Container, TransactionContainer, RpcContainer

public class StatelessContainer
extends java.lang.Object
implements RpcContainer, TransactionContainer

Stateless SessionBean container

Version:
$Revision: 1976 $ $Date: 2005-07-05 19:04:04 -0700 (Tue, 05 Jul 2005) $
Author:
Richard Monson-Haefel, David Blevins

Field Summary
 
Fields inherited from interface org.openejb.Container
ENTITY, MESSAGE_DRIVEN, STATEFUL, STATELESS
 
Constructor Summary
StatelessContainer()
           
 
Method Summary
protected  ProxyInfo createEJBObject(DeploymentInfo deploymentInfo, java.lang.reflect.Method callMethod)
          This method creates a ProxyInfo object for a specific deployment.
 void deploy(java.lang.Object deploymentID, DeploymentInfo info)
          Adds a bean to this container.
 DeploymentInfo[] deployments()
          Gets the DeploymentInfo objects for all the beans deployed in this container.
 void discardInstance(javax.ejb.EnterpriseBean instance, ThreadContext context)
           
 java.lang.Object getContainerID()
          Gets the id of this container.
 int getContainerType()
          Gets the type of container (STATELESS, STATEFUL, ENTITY, or MESSAGE_DRIVEN
 DeploymentInfo getDeploymentInfo(java.lang.Object deploymentID)
          Gets the DeploymentInfo object for the bean with the specified deployment id.
 StatelessInstanceManager getInstanceManager()
           
 void init(java.lang.Object id, java.util.HashMap registry, java.util.Properties properties)
          Construct this container with the specified container id, deployments, container manager and properties.
protected  java.lang.Object invoke(java.lang.reflect.Method callMethod, java.lang.reflect.Method runMethod, java.lang.Object[] args, javax.ejb.EnterpriseBean bean, ThreadContext callContext)
           
 java.lang.Object invoke(java.lang.Object deployID, java.lang.reflect.Method callMethod, java.lang.Object[] args, java.lang.Object primKey, java.lang.Object securityIdentity)
          Invokes a method on an instance of the specified bean deployment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StatelessContainer

public StatelessContainer()
Method Detail

init

public void init(java.lang.Object id,
                 java.util.HashMap registry,
                 java.util.Properties properties)
          throws OpenEJBException
Construct this container with the specified container id, deployments, container manager and properties. The properties can include the class name of the preferred InstanceManager, org.openejb.core.entity.EntityInstanceManager is the default. The properties should also include the properties for the instance manager.

Specified by:
init in interface Container
Parameters:
id - the unique id to identify this container in the ContainerSystem
registry - a hashMap of bean delpoyments that this container will be responsible for
properties - the properties this container needs to initialize and run
Throws:
OpenEJBException - if there is a problem constructing the container
See Also:
Container

deployments

public DeploymentInfo[] deployments()
Gets the DeploymentInfo objects for all the beans deployed in this container.

Specified by:
deployments in interface Container
Returns:
an array of DeploymentInfo objects
See Also:
DeploymentInfo

getDeploymentInfo

public DeploymentInfo getDeploymentInfo(java.lang.Object deploymentID)
Gets the DeploymentInfo object for the bean with the specified deployment id.

Specified by:
getDeploymentInfo in interface Container
Parameters:
deploymentID - the deployment id of the deployed bean.
Returns:
the DeploymentInfo object associated with the bean.
See Also:
DeploymentInfo, DeploymentInfo.getDeploymentID()

getContainerType

public int getContainerType()
Gets the type of container (STATELESS, STATEFUL, ENTITY, or MESSAGE_DRIVEN

Specified by:
getContainerType in interface Container
Returns:
id type bean container

getContainerID

public java.lang.Object getContainerID()
Gets the id of this container.

Specified by:
getContainerID in interface Container
Returns:
the id of this container.

deploy

public void deploy(java.lang.Object deploymentID,
                   DeploymentInfo info)
            throws OpenEJBException
Adds a bean to this container.

Specified by:
deploy in interface Container
Parameters:
deploymentID - the deployment id of the bean to deploy.
info - the DeploymentInfo object associated with the bean.
Throws:
OpenEJBException - Occurs when the container is not able to deploy the bean for some reason.

invoke

public java.lang.Object invoke(java.lang.Object deployID,
                               java.lang.reflect.Method callMethod,
                               java.lang.Object[] args,
                               java.lang.Object primKey,
                               java.lang.Object securityIdentity)
                        throws OpenEJBException
Invokes a method on an instance of the specified bean deployment.

Specified by:
invoke in interface RpcContainer
Parameters:
deployID - the dployment id of the bean deployment
callMethod - the method to be called on the bean instance
args - the arguments to use when invoking the specified method
primKey - the primary key class of the bean or null if the bean does not need a primary key
securityIdentity - identity
Returns:
the result of invoking the specified method on the bean instance
Throws:
OpenEJBException
See Also:
StatefulContainer.invoke

getInstanceManager

public StatelessInstanceManager getInstanceManager()

invoke

protected java.lang.Object invoke(java.lang.reflect.Method callMethod,
                                  java.lang.reflect.Method runMethod,
                                  java.lang.Object[] args,
                                  javax.ejb.EnterpriseBean bean,
                                  ThreadContext callContext)
                           throws OpenEJBException
Throws:
OpenEJBException

createEJBObject

protected ProxyInfo createEJBObject(DeploymentInfo deploymentInfo,
                                    java.lang.reflect.Method callMethod)
This method creates a ProxyInfo object for a specific deployment. When a stateless session bean is created, the container does not need to create an bean instance because instances are shared and pooled and only delegated to service a request when a call is received from the client. The ProxyInfo object will allow the server to construct an appropriate remote reference that the client can use to make calls.


discardInstance

public void discardInstance(javax.ejb.EnterpriseBean instance,
                            ThreadContext context)
Specified by:
discardInstance in interface TransactionContainer


Copyright © 1999-2011 OpenEJB. All Rights Reserved.