JBoss API: Class EntityContainer

org.jboss.ejb
Class EntityContainer

java.lang.Object
  |
  +--org.jboss.ejb.Container
        |
        +--org.jboss.ejb.EntityContainer
All Implemented Interfaces:
ContainerInvokerContainer, InstancePoolContainer

public class EntityContainer
extends Container
implements ContainerInvokerContainer, InstancePoolContainer

This is a Container for EntityBeans (both BMP and CMP).

Version:
$Revision: 1.41.2.5 $
Author:
Rickard Öberg (rickard.oberg@telkel.com), Marc Fleury, Sebastien Alborini, Daniel OConnor (docodan@mvcsoft.com), Bill Burke
See Also:
Container, EntityEnterpriseContext

Field Summary
protected  java.util.Map beanMapping
           
protected  ContainerInvoker containerInvoker
           
protected static GlobalTxEntityMap globalTxEntityMap
          This provides a way to find the entities that are part of a given transaction EntitySynchronizationInterceptor and InstanceSynchronization manage this instance.
protected  java.lang.Class homeInterface
           
protected  java.util.Map homeMapping
           
protected  InstanceCache instanceCache
           
protected  InstancePool instancePool
           
protected  Interceptor interceptor
           
protected  java.lang.reflect.Method isModified
          Optional isModified method used by storeEntity
protected  EntityPersistenceManager persistenceManager
           
protected  java.lang.Class remoteInterface
           
protected  TxEntityMap txEntityMap
           
 
Fields inherited from class org.jboss.ejb.Container
application, beanClass, classLoader, localClassLoader, localContainerInvoker, localHomeInterface, localInterface, lockManager, log, metaData, rm, securityProxy, sm, tm
 
Constructor Summary
EntityContainer()
           
 
Method Summary
 void addInterceptor(Interceptor in)
           
 javax.ejb.EJBObject createHome(MethodInvocation mi)
          createHome(MethodInvocation) This method takes care of the wiring of the "EJBObject" trio (target, context, proxy) It delegates to the persistence manager.
 javax.ejb.EJBLocalObject createLocalHome(MethodInvocation mi)
           
 void destroy()
          A default implementation of destroying the container service (no-op).
 java.lang.Object find(MethodInvocation mi)
           
 java.lang.Object findLocal(MethodInvocation mi)
           
 ContainerInvoker getContainerInvoker()
           
 javax.ejb.EJBHome getEJBHome(MethodInvocation mi)
           
 javax.ejb.EJBLocalHome getEJBLocalHome(MethodInvocation mi)
          MF FIXME these are implemented on the client
 javax.ejb.EJBMetaData getEJBMetaDataHome(MethodInvocation mi)
           
 javax.ejb.EJBObject getEJBObject(MethodInvocation mi)
          A method for the getEJBObject from the handle
static GlobalTxEntityMap getGlobalTxEntityMap()
           
 javax.ejb.Handle getHandle(MethodInvocation mi)
          MF FIXME these are implemented on the client For the JRMP CI yes, but should be implemented for other CI's
 java.lang.Class getHomeClass()
           
 javax.ejb.HomeHandle getHomeHandleHome(MethodInvocation mi)
           
 InstanceCache getInstanceCache()
           
 InstancePool getInstancePool()
           
 Interceptor getInterceptor()
           
 LocalContainerInvoker getLocalContainerInvoker()
           
 EntityPersistenceManager getPersistenceManager()
           
 java.lang.Object getPrimaryKey(MethodInvocation mi)
           
 java.lang.Class getRemoteClass()
           
 TxEntityMap getTxEntityMap()
           
 void init()
          The ContainerFactory calls this method.
 java.lang.Object invoke(MethodInvocation mi)
          This method is called by the ContainerInvoker when a method call comes in on an EJBObject.
 java.lang.Object invokeHome(MethodInvocation mi)
          This method is called by the ContainerInvoker when a method call comes in on the Home object.
 boolean isIdentical(MethodInvocation mi)
           
 void remove(MethodInvocation mi)
           
 void removeHome(MethodInvocation mi)
           
 void removeLocalHome(MethodInvocation mi)
           
 void setContainerInvoker(ContainerInvoker ci)
           
 void setInstanceCache(InstanceCache ic)
           
 void setInstancePool(InstancePool ip)
           
 void setPersistenceManager(EntityPersistenceManager pm)
           
protected  void setupBeanMapping()
           
protected  void setupHomeMapping()
           
 void start()
          A default implementation of starting the container service (no-op).
 void stop()
          A default implementation of stopping the container service (no-op).
 void storeEntity(EntityEnterpriseContext ctx)
          store entity
static void synchronizeEntitiesWithinTransaction(javax.transaction.Transaction tx)
          Stores all of the entities associated with the specified transaction.
 
Methods inherited from class org.jboss.ejb.Container
createBeanClassInstance, getApplication, getBeanClass, getBeanMetaData, getClassLoader, getLocalClass, getLocalClassLoader, getLocalHomeClass, getLockManager, getMethodPermissions, getRealmMapping, getSecurityManager, getSecurityProxy, getTransactionManager, setApplication, setBeanMetaData, setClassLoader, setLocalClassLoader, setLockManager, setRealmMapping, setSecurityManager, setSecurityProxy, setTransactionManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.ejb.ContainerInvokerContainer
getLocalClass, getLocalHomeClass
 

Field Detail

homeInterface

protected java.lang.Class homeInterface

remoteInterface

protected java.lang.Class remoteInterface

homeMapping

protected java.util.Map homeMapping

beanMapping

protected java.util.Map beanMapping

containerInvoker

protected ContainerInvoker containerInvoker

persistenceManager

protected EntityPersistenceManager persistenceManager

instanceCache

protected InstanceCache instanceCache

instancePool

protected InstancePool instancePool

txEntityMap

protected TxEntityMap txEntityMap

interceptor

protected Interceptor interceptor

isModified

protected java.lang.reflect.Method isModified
Optional isModified method used by storeEntity

globalTxEntityMap

protected static GlobalTxEntityMap globalTxEntityMap
This provides a way to find the entities that are part of a given transaction EntitySynchronizationInterceptor and InstanceSynchronization manage this instance.
Constructor Detail

EntityContainer

public EntityContainer()
Method Detail

setContainerInvoker

public void setContainerInvoker(ContainerInvoker ci)

getContainerInvoker

public ContainerInvoker getContainerInvoker()
Specified by:
getContainerInvoker in interface ContainerInvokerContainer

getLocalContainerInvoker

public LocalContainerInvoker getLocalContainerInvoker()
Specified by:
getLocalContainerInvoker in interface ContainerInvokerContainer

setInstancePool

public void setInstancePool(InstancePool ip)

getInstancePool

public InstancePool getInstancePool()
Specified by:
getInstancePool in interface InstancePoolContainer

setInstanceCache

public void setInstanceCache(InstanceCache ic)

getInstanceCache

public InstanceCache getInstanceCache()

getPersistenceManager

public EntityPersistenceManager getPersistenceManager()

getTxEntityMap

public TxEntityMap getTxEntityMap()

setPersistenceManager

public void setPersistenceManager(EntityPersistenceManager pm)

addInterceptor

public void addInterceptor(Interceptor in)
Overrides:
addInterceptor in class Container

getInterceptor

public Interceptor getInterceptor()

getHomeClass

public java.lang.Class getHomeClass()
Specified by:
getHomeClass in interface ContainerInvokerContainer

getRemoteClass

public java.lang.Class getRemoteClass()
Specified by:
getRemoteClass in interface ContainerInvokerContainer

getGlobalTxEntityMap

public static GlobalTxEntityMap getGlobalTxEntityMap()

synchronizeEntitiesWithinTransaction

public static void synchronizeEntitiesWithinTransaction(javax.transaction.Transaction tx)
Stores all of the entities associated with the specified transaction. As per the spec 9.6.4, entities must be synchronized with the datastore when an ejbFind is called. Also, all entities within entire transaction should be synchronized before a remove, otherwise there may be problems with 'cascade delete'.
Parameters:
tx - the transaction that associated entites will be stored
Throws:
java.lang.Exception - if an problem occures while storing the entities

storeEntity

public void storeEntity(EntityEnterpriseContext ctx)
                 throws java.lang.Exception
store entity

init

public void init()
          throws java.lang.Exception
Description copied from class: Container
The ContainerFactory calls this method. The ContainerFactory has set all the plugins and interceptors that this bean requires and now proceeds to initialize the chain. The method looks for the standard classes in the URL, sets up the naming environment of the bean. The concrete container classes should override this method to introduce implementation specific initialization behaviour.
Overrides:
init in class Container
Following copied from class: org.jboss.ejb.Container
Throws:
java.lang.Exception - if loading the bean class failed (ClassNotFoundException) or setting up "java:" naming environment failed (DeploymentException)

start

public void start()
           throws java.lang.Exception
Description copied from class: Container
A default implementation of starting the container service (no-op). The concrete container classes should override this method to introduce implementation specific start behaviour.
Overrides:
start in class Container
Following copied from class: org.jboss.ejb.Container
Throws:
java.lang.Exception - an exception that occured during start

stop

public void stop()
Description copied from class: Container
A default implementation of stopping the container service (no-op). The concrete container classes should override this method to introduce implementation specific stop behaviour.
Overrides:
stop in class Container

destroy

public void destroy()
Description copied from class: Container
A default implementation of destroying the container service (no-op). The concrete container classes should override this method to introduce implementation specific destroy behaviour.
Overrides:
destroy in class Container

invokeHome

public java.lang.Object invokeHome(MethodInvocation mi)
                            throws java.lang.Exception
Description copied from class: Container
This method is called by the ContainerInvoker when a method call comes in on the Home object. The Container forwards this call to the interceptor chain for further processing.
Overrides:
invokeHome in class Container
Following copied from class: org.jboss.ejb.Container
Parameters:
mi - the object holding all info about this invocation
Returns:
the result of the home invocation
Throws:
java.lang.Exception -  

invoke

public java.lang.Object invoke(MethodInvocation mi)
                        throws java.lang.Exception
Description copied from class: Container
This method is called by the ContainerInvoker when a method call comes in on an EJBObject. The Container forwards this call to the interceptor chain for further processing.
Overrides:
invoke in class Container
Following copied from class: org.jboss.ejb.Container
Parameters:
id - the id of the object being invoked. May be null if stateless
method - the method being invoked
args - the parameters
Returns:
the result of the invocation
Throws:
java.lang.Exception -  

remove

public void remove(MethodInvocation mi)
            throws java.rmi.RemoteException,
                   javax.ejb.RemoveException

getHandle

public javax.ejb.Handle getHandle(MethodInvocation mi)
                           throws java.rmi.RemoteException
MF FIXME these are implemented on the client For the JRMP CI yes, but should be implemented for other CI's

getPrimaryKey

public java.lang.Object getPrimaryKey(MethodInvocation mi)
                               throws java.rmi.RemoteException

getEJBHome

public javax.ejb.EJBHome getEJBHome(MethodInvocation mi)
                             throws java.rmi.RemoteException

isIdentical

public boolean isIdentical(MethodInvocation mi)
                    throws java.rmi.RemoteException

getEJBLocalHome

public javax.ejb.EJBLocalHome getEJBLocalHome(MethodInvocation mi)
MF FIXME these are implemented on the client

removeLocalHome

public void removeLocalHome(MethodInvocation mi)
                     throws java.rmi.RemoteException,
                            javax.ejb.RemoveException

createLocalHome

public javax.ejb.EJBLocalObject createLocalHome(MethodInvocation mi)
                                         throws java.lang.Exception

findLocal

public java.lang.Object findLocal(MethodInvocation mi)
                           throws java.lang.Exception

find

public java.lang.Object find(MethodInvocation mi)
                      throws java.lang.Exception

createHome

public javax.ejb.EJBObject createHome(MethodInvocation mi)
                               throws java.lang.Exception
createHome(MethodInvocation) This method takes care of the wiring of the "EJBObject" trio (target, context, proxy) It delegates to the persistence manager.

getEJBObject

public javax.ejb.EJBObject getEJBObject(MethodInvocation mi)
                                 throws java.rmi.RemoteException
A method for the getEJBObject from the handle

removeHome

public void removeHome(MethodInvocation mi)
                throws java.rmi.RemoteException,
                       javax.ejb.RemoveException

getEJBMetaDataHome

public javax.ejb.EJBMetaData getEJBMetaDataHome(MethodInvocation mi)
                                         throws java.rmi.RemoteException

getHomeHandleHome

public javax.ejb.HomeHandle getHomeHandleHome(MethodInvocation mi)
                                       throws java.rmi.RemoteException

setupHomeMapping

protected void setupHomeMapping()
                         throws DeploymentException

setupBeanMapping

protected void setupBeanMapping()
                         throws DeploymentException


Copyright © 2000 The JBoss Organization. All Rights Reserved.