Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.ejb.plugins
Class CMPClusteredInMemoryPersistenceManager

    java.lang.Object
      org.jboss.ejb.plugins.CMPClusteredInMemoryPersistenceManager

All Implemented Interfaces:
  org.jboss.ejb.AllowedOperationsFlags, org.jboss.ejb.ContainerPlugin, org.jboss.ejb.EntityPersistenceStore, org.jboss.system.Service

public class CMPClusteredInMemoryPersistenceManager
extends Object
implements org.jboss.ejb.EntityPersistenceStore

EntityPersistenceStore implementation storing values in-memory and shared accross the cluster through the DistributedState service from the clustering framework. It always uses the DefaultPartition.

Version:
  $Revision: 1.12 $
Author:
  Sacha Labourey.
See Also:
  `EntityPersistenceStore`, `CMPInMemoryPersistenceManager`, `DistributedState`

Field Summary
`protected org.jboss.ejb.EntityContainer` | `con`
`protected DistributedState` | `ds`
`protected String` | `DS_CATEGORY`
`protected Field` | `idField`
`protected Method` | `isModified` Optional isModified method used by storeEntity

Fields inherited from interface org.jboss.ejb.AllowedOperationsFlags
`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`

Constructor Summary
`CMPClusteredInMemoryPersistenceManager()`

Method Summary
`void` | `activateEntity(org.jboss.ejb.EntityEnterpriseContext instance)` This method is called when an entity shall be activated.
`void` | `create()` create the service, do expensive operations etc
`Object` | `createBeanClassInstance()` Returns a new instance of the bean class or a subclass of the bean class.
`Object` | `createEntity(Method m, Object[] args, org.jboss.ejb.EntityEnterpriseContext ctx)` This method is called whenever an entity is to be created.
`void` | `destroy()` destroy the service, tear down
`Collection` | `findEntities(Method finderMethod, Object[] args, org.jboss.ejb.EntityEnterpriseContext instance, org.jboss.ejb.GenericEntityObjectFactory factory)` This method is called when collections of entities are to be found.
`Object` | `findEntity(Method finderMethod, Object[] args, org.jboss.ejb.EntityEnterpriseContext instance, org.jboss.ejb.GenericEntityObjectFactory factory)` This method is called when single entities are to be found.
`void` | `initEntity(org.jboss.ejb.EntityEnterpriseContext ctx)` Initializes the instance context.
`boolean` | `isModified(org.jboss.ejb.EntityEnterpriseContext ctx)`
`boolean` | `isStoreRequired(org.jboss.ejb.EntityEnterpriseContext ctx)` This method is used to determine if an entity should be stored.
`void` | `loadEntity(org.jboss.ejb.EntityEnterpriseContext ctx)` This method is called whenever an entity shall be load from the underlying storage.
`void` | `passivateEntity(org.jboss.ejb.EntityEnterpriseContext instance)` This method is called when an entity shall be passivate.
`Object` | `postCreateEntity(Method m, Object[] args, org.jboss.ejb.EntityEnterpriseContext ctx)` This method is called after the ejbCreate.
`void` | `removeEntity(org.jboss.ejb.EntityEnterpriseContext ctx)` This method is called when an entity shall be removed from the underlying storage.
`void` | `setContainer(org.jboss.ejb.Container con)` This callback is set by the container so that the plugin may access it
`void` | `start()` start the service, create is already called
`void` | `stop()` stop the service
`void` | `storeEntity(org.jboss.ejb.EntityEnterpriseContext ctx)` This method is called whenever an entity shall be stored to the underlying storage.
`protected void` | `storeEntity(Object id, Object obj)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### con

    protected org.jboss.ejb.EntityContainer con

### idField

    protected Field idField

### ds

    protected DistributedState ds

### DS_CATEGORY

    protected String DS_CATEGORY

### isModified

    protected Method isModified

  Optional isModified method used by storeEntity

Constructor Detail

### CMPClusteredInMemoryPersistenceManager

    public CMPClusteredInMemoryPersistenceManager()

Method Detail

### setContainer

    public void setContainer(org.jboss.ejb.Container con)

  This callback is set by the container so that the plugin may access it

  Specified by:
    `setContainer` in interface `org.jboss.ejb.ContainerPlugin`
  Parameters:
    `con` - The container using this plugin.

### create

    public void create()
                throws Exception

  create the service, do expensive operations etc

  Specified by:
    `create` in interface `org.jboss.system.Service`
  Throws:
    `Exception`

### start

    public void start()
               throws Exception

  start the service, create is already called

  Specified by:
    `start` in interface `org.jboss.system.Service`
  Throws:
    `Exception`

### stop

    public void stop()

  stop the service

  Specified by:
    `stop` in interface `org.jboss.system.Service`

### destroy

    public void destroy()

  destroy the service, tear down

  Specified by:
    `destroy` in interface `org.jboss.system.Service`

### createBeanClassInstance

    public Object createBeanClassInstance()
                                   throws Exception

  Returns a new instance of the bean class or a subclass of the bean class.

  Specified by:
    `createBeanClassInstance` in interface `org.jboss.ejb.EntityPersistenceStore`
  Returns:
    the new instance
  Throws:
    `Exception`

### initEntity

    public void initEntity(org.jboss.ejb.EntityEnterpriseContext ctx)

  Initializes the instance context.

  This method is called before createEntity, and should reset the value of all cmpFields to 0 or null.

  Specified by:
    `initEntity` in interface `org.jboss.ejb.EntityPersistenceStore`
  Parameters:
    `ctx` -

### createEntity

    public Object createEntity(Method m,
                               Object[] args,
                               org.jboss.ejb.EntityEnterpriseContext ctx)
                        throws Exception

  This method is called whenever an entity is to be created. The persistence manager is responsible for handling the results properly wrt the persistent store.

  Specified by:
    `createEntity` in interface `org.jboss.ejb.EntityPersistenceStore`
  Parameters:
    `m` - the create method in the home interface that was called
    `args` - any create parameters
    `ctx` - the instance ctx being used for this create call
  Returns:
    The primary key computed by CMP PM or null for BMP
  Throws:
    `Exception`

### postCreateEntity

    public Object postCreateEntity(Method m,
                                   Object[] args,
                                   org.jboss.ejb.EntityEnterpriseContext ctx)
                            throws Exception

  This method is called after the ejbCreate. The persistence manager is responsible for handling the results properly wrt the persistent store.

  Specified by:
    `postCreateEntity` in interface `org.jboss.ejb.EntityPersistenceStore`
  Parameters:
    `m` - the ejbPostCreate method in the bean class that was called
    `args` - any create parameters
    `ctx` - the instance being used for this create call
  Returns:
    The primary key computed by CMP PM or null for BMP
  Throws:
    `Exception`

### findEntity

    public Object findEntity(Method finderMethod,
                             Object[] args,
                             org.jboss.ejb.EntityEnterpriseContext instance,
                             org.jboss.ejb.GenericEntityObjectFactory factory)
                      throws Exception

  This method is called when single entities are to be found. The persistence manager must find out whether the wanted instance is available in the persistence store, if so it returns the primary key of the object.

  Specified by:
    `findEntity` in interface `org.jboss.ejb.EntityPersistenceStore`
  Parameters:
    `finderMethod` - the find method in the home interface that was called
    `args` - any finder parameters
    `instance` - the instance to use for the finder call
  Returns:
    a primary key representing the found entity
  Throws:
    `RemoteException` - thrown if some system exception occurs
    `javax.ejb.FinderException` - thrown if some heuristic problem occurs
    `Exception`

### findEntities

    public Collection findEntities(Method finderMethod,
                                   Object[] args,
                                   org.jboss.ejb.EntityEnterpriseContext instance,
                                   org.jboss.ejb.GenericEntityObjectFactory factory)
                            throws Exception

  This method is called when collections of entities are to be found. The persistence manager must find out whether the wanted instances are available in the persistence store, and if so it must return a collection of primaryKeys.

  Specified by:
    `findEntities` in interface `org.jboss.ejb.EntityPersistenceStore`
  Parameters:
    `finderMethod` - the find method in the home interface that was called
    `args` - any finder parameters
    `instance` - the instance to use for the finder call
  Returns:
    an primary key collection representing the found entities
  Throws:
    `RemoteException` - thrown if some system exception occurs
    `javax.ejb.FinderException` - thrown if some heuristic problem occurs
    `Exception`

### activateEntity

    public void activateEntity(org.jboss.ejb.EntityEnterpriseContext instance)

  This method is called when an entity shall be activated.

  With the PersistenceManager factorization most EJB calls should not exists However this calls permits us to introduce optimizations in the persistence store. Particularly the context has a "PersistenceContext" that a PersistenceStore can use (JAWS does for smart updates) and this is as good a callback as any other to set it up.

  Specified by:
    `activateEntity` in interface `org.jboss.ejb.EntityPersistenceStore`
  Parameters:
    `instance` - the instance to use for the activation
  Throws:
    `RemoteException` - thrown if some system exception occurs

### loadEntity

    public void loadEntity(org.jboss.ejb.EntityEnterpriseContext ctx)

  This method is called whenever an entity shall be load from the underlying storage. The persistence manager must load the state from the underlying storage and then call ejbLoad on the supplied instance.

  Specified by:
    `loadEntity` in interface `org.jboss.ejb.EntityPersistenceStore`
  Parameters:
    `ctx` - the instance to synchronize
  Throws:
    `RemoteException` - thrown if some system exception occurs

### isStoreRequired

    public boolean isStoreRequired(org.jboss.ejb.EntityEnterpriseContext ctx)
                            throws Exception

  This method is used to determine if an entity should be stored.

  Specified by:
    `isStoreRequired` in interface `org.jboss.ejb.EntityPersistenceStore`
  Parameters:
    `ctx` - the instance to check
  Returns:
    true, if the entity has been modified
  Throws:
    `Exception` - thrown if some system exception occurs

### isModified

    public boolean isModified(org.jboss.ejb.EntityEnterpriseContext ctx)
                       throws Exception

  Specified by:
    `isModified` in interface `org.jboss.ejb.EntityPersistenceStore`
  Throws:
    `Exception`

### storeEntity

    public void storeEntity(org.jboss.ejb.EntityEnterpriseContext ctx)
                     throws RemoteException

  This method is called whenever an entity shall be stored to the underlying storage. The persistence manager must call ejbStore on the supplied instance and then store the state to the underlying storage. B

  Specified by:
    `storeEntity` in interface `org.jboss.ejb.EntityPersistenceStore`
  Parameters:
    `ctx` - the instance to synchronize
  Throws:
    `RemoteException` - thrown if some system exception occurs

### passivateEntity

    public void passivateEntity(org.jboss.ejb.EntityEnterpriseContext instance)

  This method is called when an entity shall be passivate. The persistence manager must call the ejbPassivate method on the instance.

  See the activate discussion for the reason for exposing EJB callback calls to the store.

  Specified by:
    `passivateEntity` in interface `org.jboss.ejb.EntityPersistenceStore`
  Parameters:
    `instance` - the instance to passivate
  Throws:
    `RemoteException` - thrown if some system exception occurs

### removeEntity

    public void removeEntity(org.jboss.ejb.EntityEnterpriseContext ctx)
                      throws javax.ejb.RemoveException

  This method is called when an entity shall be removed from the underlying storage. The persistence manager must call ejbRemove on the instance and then remove its state from the underlying storage.

  Specified by:
    `removeEntity` in interface `org.jboss.ejb.EntityPersistenceStore`
  Parameters:
    `ctx` - the instance to remove
  Throws:
    `RemoteException` - thrown if some system exception occurs
    `javax.ejb.RemoveException` - thrown if the instance could not be removed

### storeEntity

    protected void storeEntity(Object id,
                               Object obj)
                        throws Exception

  Throws:
    `Exception`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002 JBoss Group, LLC. All Rights Reserved.