org.jboss.ejb
Class EntityContainer

java.lang.Object
  extended byorg.jboss.mx.util.JBossNotificationBroadcasterSupport (src) 
      extended byorg.jboss.system.ServiceMBeanSupport (src) 
          extended byorg.jboss.ejb.Container (src) 
              extended byorg.jboss.ejb.EntityContainer
All Implemented Interfaces:
AllowedOperationsFlags (src) , EJBProxyFactoryContainer (src) , InstancePoolContainer (src) , MBeanRegistration (src) , NotificationBroadcaster (src) , NotificationEmitter (src) , Service (src) , ServiceMBean (src)

public class EntityContainer
extends Container (src)
implements EJBProxyFactoryContainer (src) , InstancePoolContainer (src)

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

See Also:
Container (src) , EntityEnterpriseContext (src)

Nested Class Summary
 
Nested classes inherited from class org.jboss.ejb.Container (src)
Container.AbstractContainerInterceptor (src)
 
Field Summary
protected  java.util.Map beanMapping
          These are the mappings between the remote/local interface methods and the bean methods.
protected static GlobalTxEntityMap (src) globalTxEntityMap
          This provides a way to find the entities that are part of a given transaction EntitySynchronizationInterceptor and InstanceSynchronization manage this instance.
protected  java.util.Map homeMapping
          These are the mappings between the home interface methods and the container methods.
protected  InstanceCache (src) instanceCache
          This is the instance cache for this container
protected  InstancePool (src) instancePool
          This is the instancepool that is to be used
protected  Interceptor (src) interceptor
          This is the first interceptor in the chain.
protected  EntityPersistenceManager (src) persistenceManager
          This is the persistence manager for this container
protected  boolean readOnly
          readOnly determines if state can be written to resource manager.
 
Fields inherited from class org.jboss.ejb.Container (src)
BASE_EJB_CONTAINER_NAME, beanClass, classLoader, createCount, EJB_CONTAINER_QUERY_NAME, EJB_TIMEOUT, ejbModule, EJBOBJECT_REMOVE, homeInterface, invokeStats, jaccContextID, localClassLoader, localHomeInterface, localInterface, localProxyFactory, lockManager, marshalledInvocationMapping, metaData, ORB_NAME, proxyFactories, proxyFactoryTL, remoteInterface, removeCount, rm, securityProxy, sm, tm, webClassLoader
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport (src)
log, server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.ejb.AllowedOperationsFlags (src)
IN_AFTER_BEGIN, IN_AFTER_COMPLETION, IN_BEFORE_COMPLETION, IN_BUSINESS_METHOD, IN_EJB_ACTIVATE, IN_EJB_CREATE, IN_EJB_FIND, IN_EJB_HOME, IN_EJB_LOAD, IN_EJB_PASSIVATE, IN_EJB_POST_CREATE, IN_EJB_REMOVE, IN_EJB_STORE, IN_EJB_TIMEOUT, IN_INTERCEPTOR_METHOD, IN_SERVICE_ENDPOINT_METHOD, IN_SET_ENTITY_CONTEXT, IN_SET_MESSAGE_DRIVEN_CONTEXT, IN_SET_SESSION_CONTEXT, IN_UNSET_ENTITY_CONTEXT, NOT_ALLOWED
 
Fields inherited from interface org.jboss.system.ServiceMBean (src)
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Constructor Summary
EntityContainer()
           
 
Method Summary
 void addInterceptor(Interceptor (src)  in)
           
protected  void checkCoherency()
           
 java.lang.Object createBeanClassInstance()
          Returns a new instance of the bean class or a subclass of the bean class.
 EJBObject (src) createHome(Invocation (src)  mi)
          This method takes care of the wiring of the "EJBObject" trio (target, context, proxy).
 EJBLocalObject (src) createLocalHome(Invocation (src)  mi)
          Local home interface implementation
protected  void createService()
          The EJBDeployer calls this method.
protected  void destroyService()
          A default implementation of destroying the container service (no-op).
 java.lang.Object find(Invocation (src)  mi)
          This methods finds the target instances by delegating to the persistence manager It then manufactures EJBObject for all the involved instances found.
 java.lang.Object findLocal(Invocation (src)  mi)
           
 void flushCache()
          Flush the cache
 long getCacheSize()
           
 EJBHome (src) getEJBHome(Invocation (src)  mi)
           
 EJBLocalHome (src) getEJBLocalHome(Invocation (src)  mi)
          MF FIXME these are implemented on the client
 EJBMetaData (src) getEJBMetaDataHome(Invocation (src)  mi)
           
 EJBObject (src) getEJBObject(Invocation (src)  mi)
          A method for the getEJBObject from the handle
static GlobalTxEntityMap (src) getGlobalTxEntityMap()
           
 Handle (src) getHandle(Invocation (src)  mi)
           
 java.lang.Class getHomeClass()
          ???
 HomeHandle (src) getHomeHandleHome(Invocation (src)  mi)
           
 InstanceCache (src) getInstanceCache()
           
 InstancePool (src) getInstancePool()
          Get the instance pool for the container.
 Interceptor (src) getInterceptor()
           
 LocalProxyFactory (src) getLocalProxyFactory()
          ???
 EntityPersistenceManager (src) getPersistenceManager()
           
 java.lang.Object getPrimaryKey(Invocation (src)  mi)
           
 java.lang.Class getRemoteClass()
          ???
 java.lang.Object internalInvoke(Invocation (src)  mi)
          This method is called when a method call comes in on an EJBObject.
 java.lang.Object internalInvokeHome(Invocation (src)  mi)
          This method is called when a method call comes in on the Home object.
 void invokeEjbStore(EntityEnterpriseContext (src)  ctx)
          Invokes ejbStore method on the instance
 boolean isIdentical(Invocation (src)  mi)
           
 boolean isReadOnly()
           
 void postCreateHome(Invocation (src)  mi)
          Delegates to the persistence manager postCreateEntityMethod.
 void postCreateLocalHome(Invocation (src)  mi)
          Delegates to the persistence manager postCreateEntityMethod.
 void remove(Invocation (src)  mi)
           
 void removeHome(Invocation (src)  mi)
           
 void removeLocalHome(Invocation (src)  mi)
           
 void resetStatistic()
           
 java.util.Map retrieveStatistic()
           
 void setInstanceCache(InstanceCache (src)  ic)
           
 void setInstancePool(InstancePool (src)  ip)
           
 void setPersistenceManager(EntityPersistenceManager (src)  pm)
           
protected  void setupBeanMapping()
           
protected  void setupHomeMapping()
           
protected  void setupMarshalledInvocationMapping()
           
protected  void startService()
          A default implementation of starting the container service.
protected  void stopService()
          A default implementation of stopping the container service (no-op).
 void storeEntity(EntityEnterpriseContext (src)  ctx)
          For CMP actually stores the instance
static void synchronizeEntitiesWithinTransaction(Transaction (src)  tx)
          Stores all of the entities associated with the specified transaction.
 
Methods inherited from class org.jboss.ejb.Container (src)
addProxyFactory, getBeanClass, getBeanMetaData, getClassLoader, getCreateCount, getDeploymentInfo, getEjbModule, getEnvContext, getInvokeStats, getJaccContextID, getJmxName, getLocalClass, getLocalClassLoader, getLocalHomeClass, getLockManager, getMessageDestination, getMethodPermissions, getProxyFactory, getRealmMapping, getRemoveCount, getSecurityManager, getSecurityProxy, getTimerService, getTransactionManager, getWebClassLoader, invoke, isCallByValue, lookupProxyFactory, removeTimerService, setBeanMetaData, setClassLoader, setDeploymentInfo, setEjbModule, setJaccContextID, setLocalClassLoader, setLockManager, setProxyFactory, setRealmMapping, setSecurityManager, setSecurityProxy, setTransactionManager, setWebClassLoader
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport (src)
create, destroy, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, start, stop
 
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport (src)
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
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.EJBProxyFactoryContainer (src)
getLocalClass, getLocalHomeClass, getProxyFactory
 

Field Detail

homeMapping

protected java.util.Map homeMapping
These are the mappings between the home interface methods and the container methods.


beanMapping

protected java.util.Map beanMapping
These are the mappings between the remote/local interface methods and the bean methods.


persistenceManager

protected EntityPersistenceManager (src)  persistenceManager
This is the persistence manager for this container


instanceCache

protected InstanceCache (src)  instanceCache
This is the instance cache for this container


instancePool

protected InstancePool (src)  instancePool
This is the instancepool that is to be used


interceptor

protected Interceptor (src)  interceptor
This is the first interceptor in the chain. The last interceptor must be provided by the container itself.


readOnly

protected boolean readOnly
readOnly determines if state can be written to resource manager.


globalTxEntityMap

protected static GlobalTxEntityMap (src)  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

getGlobalTxEntityMap

public static GlobalTxEntityMap (src)  getGlobalTxEntityMap()

synchronizeEntitiesWithinTransaction

public static void synchronizeEntitiesWithinTransaction(Transaction (src)  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

isReadOnly

public boolean isReadOnly()

getLocalProxyFactory

public LocalProxyFactory (src)  getLocalProxyFactory()
Description copied from interface: EJBProxyFactoryContainer (src)
???

Specified by:
getLocalProxyFactory in interface EJBProxyFactoryContainer (src)
Returns:
???

setInstancePool

public void setInstancePool(InstancePool (src)  ip)

getInstancePool

public InstancePool (src)  getInstancePool()
Description copied from interface: InstancePoolContainer (src)
Get the instance pool for the container.

Specified by:
getInstancePool in interface InstancePoolContainer (src)
Returns:
The instance pool for the container.

setInstanceCache

public void setInstanceCache(InstanceCache (src)  ic)

getInstanceCache

public InstanceCache (src)  getInstanceCache()

getPersistenceManager

public EntityPersistenceManager (src)  getPersistenceManager()

setPersistenceManager

public void setPersistenceManager(EntityPersistenceManager (src)  pm)

addInterceptor

public void addInterceptor(Interceptor (src)  in)
Specified by:
addInterceptor in class Container (src)

getInterceptor

public Interceptor (src)  getInterceptor()

getHomeClass

public java.lang.Class getHomeClass()
Description copied from interface: EJBProxyFactoryContainer (src)
???

Specified by:
getHomeClass in interface EJBProxyFactoryContainer (src)
Overrides:
getHomeClass in class Container (src)

getRemoteClass

public java.lang.Class getRemoteClass()
Description copied from interface: EJBProxyFactoryContainer (src)
???

Specified by:
getRemoteClass in interface EJBProxyFactoryContainer (src)
Overrides:
getRemoteClass in class Container (src)

createBeanClassInstance

public java.lang.Object createBeanClassInstance()
                                         throws java.lang.Exception
Returns a new instance of the bean class or a subclass of the bean class. If this is 1.x cmp, simply return a new instance of the bean class. If this is 2.x cmp, return a subclass that provides an implementation of the abstract accessors.

Overrides:
createBeanClassInstance in class Container (src)
Returns:
The new instance.
Throws:
java.lang.Exception
See Also:
Class.newInstance()

createService

protected void createService()
                      throws java.lang.Exception
Description copied from class: Container (src)
The EJBDeployer calls this method. The EJBDeployer 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:
createService in class Container (src)
Throws:
java.lang.Exception - if loading the bean class failed (ClassNotFoundException) or setting up "java:" naming environment failed (DeploymentException)

startService

protected void startService()
                     throws java.lang.Exception
Description copied from class: Container (src)
A default implementation of starting the container service. The container registers it's dynamic MBean interface in the JMX base. The concrete container classes should override this method to introduce implementation specific start behaviour. todo implement the service lifecycle methods in an xmbean interceptor so non lifecycle managed ops are blocked when mbean is not started.

Overrides:
startService in class Container (src)
Throws:
java.lang.Exception - An exception that occured during start

stopService

protected void stopService()
                    throws java.lang.Exception
Description copied from class: Container (src)
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:
stopService in class Container (src)
Throws:
java.lang.Exception

destroyService

protected void destroyService()
                       throws java.lang.Exception
Description copied from class: Container (src)
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:
destroyService in class Container (src)
Throws:
java.lang.Exception

internalInvokeHome

public java.lang.Object internalInvokeHome(Invocation (src)  mi)
                                    throws java.lang.Exception
Description copied from class: Container (src)
This method is called when a method call comes in on the Home object. The Container forwards this call to the interceptor chain for further processing.

Specified by:
internalInvokeHome in class Container (src)
Parameters:
mi - the object holding all info about this invocation
Returns:
the result of the home invocation
Throws:
java.lang.Exception

internalInvoke

public java.lang.Object internalInvoke(Invocation (src)  mi)
                                throws java.lang.Exception
Description copied from class: Container (src)
This method is called when a method call comes in on an EJBObject. The Container forwards this call to the interceptor chain for further processing.

Specified by:
internalInvoke in class Container (src)
Throws:
java.lang.Exception

remove

public void remove(Invocation (src)  mi)
            throws java.rmi.RemoteException,
                   RemoveException (src) 
Throws:
java.rmi.RemoteException
RemoveException (src)

getHandle

public Handle (src)  getHandle(Invocation (src)  mi)
                 throws java.rmi.RemoteException
Throws:
java.lang.Error - Not yet implemented.
java.rmi.RemoteException

getPrimaryKey

public java.lang.Object getPrimaryKey(Invocation (src)  mi)
                               throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException

getEJBHome

public EJBHome (src)  getEJBHome(Invocation (src)  mi)
                   throws java.rmi.RemoteException
Throws:
java.lang.IllegalStateException - If container invoker is null.
java.rmi.RemoteException

isIdentical

public boolean isIdentical(Invocation (src)  mi)
                    throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException

getEJBLocalHome

public EJBLocalHome (src)  getEJBLocalHome(Invocation (src)  mi)
MF FIXME these are implemented on the client


removeLocalHome

public void removeLocalHome(Invocation (src)  mi)
                     throws java.rmi.RemoteException,
                            RemoveException (src) 
Throws:
java.lang.Error - Not yet implemented.
java.rmi.RemoteException
RemoveException (src)

createLocalHome

public EJBLocalObject (src)  createLocalHome(Invocation (src)  mi)
                               throws java.lang.Exception
Local home interface implementation

Throws:
java.lang.Exception

postCreateLocalHome

public void postCreateLocalHome(Invocation (src)  mi)
                         throws java.lang.Exception
Delegates to the persistence manager postCreateEntityMethod.

Throws:
java.lang.Exception

findLocal

public java.lang.Object findLocal(Invocation (src)  mi)
                           throws java.lang.Exception
Throws:
java.lang.Exception

find

public java.lang.Object find(Invocation (src)  mi)
                      throws java.lang.Exception
This methods finds the target instances by delegating to the persistence manager It then manufactures EJBObject for all the involved instances found.

Throws:
java.lang.Exception

invokeEjbStore

public void invokeEjbStore(EntityEnterpriseContext (src)  ctx)
                    throws java.lang.Exception
Invokes ejbStore method on the instance

Parameters:
ctx - the instance to invoke ejbStore on
Throws:
java.lang.Exception

storeEntity

public void storeEntity(EntityEnterpriseContext (src)  ctx)
                 throws java.lang.Exception
For CMP actually stores the instance

Throws:
java.lang.Exception

postCreateHome

public void postCreateHome(Invocation (src)  mi)
                    throws java.lang.Exception
Delegates to the persistence manager postCreateEntityMethod.

Throws:
java.lang.Exception

createHome

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

Throws:
java.lang.Exception

getEJBObject

public EJBObject (src)  getEJBObject(Invocation (src)  mi)
                       throws java.rmi.RemoteException
A method for the getEJBObject from the handle

Throws:
java.rmi.RemoteException

removeHome

public void removeHome(Invocation (src)  mi)
                throws java.rmi.RemoteException,
                       RemoveException (src) 
Throws:
java.lang.Error - Not yet implemented.
java.rmi.RemoteException
RemoveException (src)

getEJBMetaDataHome

public EJBMetaData (src)  getEJBMetaDataHome(Invocation (src)  mi)
                               throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException

getHomeHandleHome

public HomeHandle (src)  getHomeHandleHome(Invocation (src)  mi)
                             throws java.rmi.RemoteException
Throws:
java.lang.Error - Not yet implemented.
java.rmi.RemoteException

getCacheSize

public long getCacheSize()
Returns:
the current cache size

flushCache

public void flushCache()
Flush the cache


retrieveStatistic

public java.util.Map retrieveStatistic()

resetStatistic

public void resetStatistic()

setupHomeMapping

protected void setupHomeMapping()
                         throws java.lang.Exception
Throws:
java.lang.Exception

setupBeanMapping

protected void setupBeanMapping()
                         throws java.lang.Exception
Throws:
java.lang.Exception

setupMarshalledInvocationMapping

protected void setupMarshalledInvocationMapping()
                                         throws java.lang.Exception
Throws:
java.lang.Exception

checkCoherency

protected void checkCoherency()
                       throws java.lang.Exception
Throws:
java.lang.Exception