org.openejb.core.entity
Class EntityContainer

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

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

Bean-Managed Persistence EntityBean container

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

Field Summary
protected  java.lang.Object containerID
          The unique id for this container
protected  java.util.HashMap deploymentRegistry
          Contains deployment information for each by deployed to this container
protected  EntityInstanceManager instanceManager
          Managed bean instances; transaction ready and ready pools
 Logger logger
           
 
Fields inherited from interface org.openejb.Container
ENTITY, MESSAGE_DRIVEN, STATEFUL, STATELESS
 
Constructor Summary
EntityContainer()
           
 
Method Summary
protected  ProxyInfo createEJBObject(java.lang.reflect.Method callMethod, java.lang.Object[] args, ThreadContext callContext)
           
 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.
protected  void didCreateBean(ThreadContext callContext, javax.ejb.EntityBean bean)
           
protected  void didRemove(javax.ejb.EntityBean bean, ThreadContext callContext)
           
 void discardInstance(javax.ejb.EnterpriseBean bean, ThreadContext threadContext)
           
 void ejbLoad_If_No_Transaction(ThreadContext callContext, javax.ejb.EntityBean bean)
          If a business method or remove method is called without a transaction context the ejbLoad method must be invoked before the call is serviced.
 void ejbStore_If_No_Transaction(ThreadContext callContext, javax.ejb.EntityBean bean)
          If a business method is called without a transaction context the ejbStore method must be invoked after the call is serviced.
protected  java.lang.Object findMethod(java.lang.reflect.Method callMethod, java.lang.Object[] args, ThreadContext callContext)
          This method is used to execute the find methods which are considered global in scope.
 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.
 EntityInstanceManager getInstanceManager()
           
protected  java.lang.Object homeMethod(java.lang.reflect.Method callMethod, java.lang.Object[] args, ThreadContext callContext)
          This method is used to execute the home methods which are considered global in scope.
 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, 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.
protected  void removeEJBObject(java.lang.reflect.Method callMethod, java.lang.Object[] args, ThreadContext callContext)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instanceManager

protected EntityInstanceManager instanceManager
Managed bean instances; transaction ready and ready pools


deploymentRegistry

protected java.util.HashMap deploymentRegistry
Contains deployment information for each by deployed to this container


containerID

protected java.lang.Object containerID
The unique id for this container


logger

public Logger logger
Constructor Detail

EntityContainer

public EntityContainer()
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
OpenEJBException
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 -
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 EntityInstanceManager getInstanceManager()

invoke

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

ejbLoad_If_No_Transaction

public void ejbLoad_If_No_Transaction(ThreadContext callContext,
                                      javax.ejb.EntityBean bean)
                               throws SystemException,
                                      java.lang.Exception
If a business method or remove method is called without a transaction context the ejbLoad method must be invoked before the call is serviced. This provides a bean instance that is not in a transaction an opportunity to load its state.

Parameters:
callContext -
bean -
Throws:
SystemException
java.lang.Exception

ejbStore_If_No_Transaction

public void ejbStore_If_No_Transaction(ThreadContext callContext,
                                       javax.ejb.EntityBean bean)
                                throws java.lang.Exception
If a business method is called without a transaction context the ejbStore method must be invoked after the call is serviced. This provides a bean instance that is not in a transaction an opportunity to store its state.

Parameters:
callContext -
bean -
Throws:
java.lang.Exception

didCreateBean

protected void didCreateBean(ThreadContext callContext,
                             javax.ejb.EntityBean bean)
                      throws OpenEJBException
Throws:
OpenEJBException

createEJBObject

protected ProxyInfo createEJBObject(java.lang.reflect.Method callMethod,
                                    java.lang.Object[] args,
                                    ThreadContext callContext)
                             throws OpenEJBException
Throws:
OpenEJBException

findMethod

protected java.lang.Object findMethod(java.lang.reflect.Method callMethod,
                                      java.lang.Object[] args,
                                      ThreadContext callContext)
                               throws OpenEJBException
This method is used to execute the find methods which are considered global in scope. Global methods use bean instances from the MethodReady pool and are not specific to on bean identity. The return value will be either a single ProxyInfo object or collection of ProxyInfo objects representing one or more remote references.

Parameters:
callMethod -
args -
callContext -
Returns:
Object
Throws:
OpenEJBException

homeMethod

protected java.lang.Object homeMethod(java.lang.reflect.Method callMethod,
                                      java.lang.Object[] args,
                                      ThreadContext callContext)
                               throws OpenEJBException
This method is used to execute the home methods which are considered global in scope. Global methods use bean instances from the MethodReady pool and are not specific to on bean identity.

Parameters:
callMethod -
args -
callContext -
Returns:
Object
Throws:
OpenEJBException

didRemove

protected void didRemove(javax.ejb.EntityBean bean,
                         ThreadContext callContext)
                  throws OpenEJBException
Throws:
OpenEJBException

removeEJBObject

protected void removeEJBObject(java.lang.reflect.Method callMethod,
                               java.lang.Object[] args,
                               ThreadContext callContext)
                        throws OpenEJBException
Throws:
OpenEJBException

discardInstance

public void discardInstance(javax.ejb.EnterpriseBean bean,
                            ThreadContext threadContext)
Specified by:
discardInstance in interface TransactionContainer
Parameters:
bean -
threadContext -


Copyright © 1999-2011 OpenEJB. All Rights Reserved.