|
||||||||||
PREV CLASS (src) NEXT CLASS (src) | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.mx.util.JBossNotificationBroadcasterSupport (src)
org.jboss.system.ServiceMBeanSupport (src)
org.jboss.ejb.plugins.CMPFilePersistenceManager
A file-based CMP entity bean persistence manager.
Reads and writes entity bean objects to files by using the standard Java serialization mechanism.
Enitiy state files are stored under: jboss-server-data-dir/storeDirectoryName/ejb-name.
Note, currently the name of the entity must be unique across the server, or unless the store directory is changed, to avoid data collisions.
jason: disabled because XDoclet can not handle right now _@_jmx:mbean extends="org.jboss.system.ServiceMBean"
Field Summary | |
static java.lang.String |
DEFAULT_STORE_DIRECTORY_NAME
The default store directory name ("entities"). |
Fields inherited from class org.jboss.system.ServiceMBeanSupport (src) |
log, server, SERVICE_CONTROLLER_SIG, serviceName |
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 | |
CMPFilePersistenceManager()
|
Method Summary | |
void |
activateEntity(EntityEnterpriseContext (src) ctx)
Non-operation. |
java.lang.Object |
createBeanClassInstance()
Returns a new instance of the bean class or a subclass of the bean class. |
java.lang.Object |
createEntity(java.lang.reflect.Method m,
java.lang.Object[] args,
EntityEnterpriseContext (src) ctx)
This method is called whenever an entity is to be created. |
protected void |
createService()
Sub-classes should override this method to provide custum 'create' logic. |
protected void |
destroyService()
Try to remove the store directory, if we can't then ignore. |
java.util.Collection |
findEntities(java.lang.reflect.Method finderMethod,
java.lang.Object[] args,
EntityEnterpriseContext (src) ctx,
GenericEntityObjectFactory (src) factory)
This method is called when collections of entities are to be found. |
java.lang.Object |
findEntity(java.lang.reflect.Method finderMethod,
java.lang.Object[] args,
EntityEnterpriseContext (src) ctx,
GenericEntityObjectFactory (src) factory)
This method is called when single entities are to be found. |
protected java.io.File |
getFile(java.lang.Object id)
|
java.io.File |
getStoreDirectory()
Returns the directory used to store entity state files. |
java.lang.String |
getStoreDirectoryName()
Get the sub-directory name under the server data directory where entity data is stored. |
void |
initEntity(EntityEnterpriseContext (src) ctx)
Reset all attributes to default value |
boolean |
isModified(EntityEnterpriseContext (src) ctx)
This method is used to determined whether the instance was modified. |
boolean |
isStoreRequired(EntityEnterpriseContext (src) ctx)
This method is used to determine if an entity should be stored. |
void |
loadEntity(EntityEnterpriseContext (src) ctx)
This method is called whenever an entity shall be load from the underlying storage. |
void |
passivateEntity(EntityEnterpriseContext (src) ctx)
Non-operation. |
java.lang.Object |
postCreateEntity(java.lang.reflect.Method m,
java.lang.Object[] args,
EntityEnterpriseContext (src) ctx)
This method is called after the createEntity. |
void |
removeEntity(EntityEnterpriseContext (src) ctx)
This method is called when an entity shall be removed from the underlying storage. |
void |
setContainer(Container (src) c)
Saves a reference to the EntityContainer (src) for
its bean type. |
void |
setStoreDirectoryName(java.lang.String dirName)
Set the sub-directory name under the server data directory where entity data will be stored. |
void |
storeEntity(EntityEnterpriseContext (src) ctx)
This method is called whenever an entity shall be stored to the underlying storage. |
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, startService, stop, stopService |
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.system.Service (src) |
create, destroy, start, stop |
Field Detail |
public static final java.lang.String DEFAULT_STORE_DIRECTORY_NAME
Constructor Detail |
public CMPFilePersistenceManager()
Method Detail |
public void setContainer(Container (src) c)
EntityContainer
(src) for
its bean type.
setContainer
in interface ContainerPlugin (src)
c
- The container using this plugin. This may be null if the
plugin is being disassociated from a container.
java.lang.ClassCastException
- Container is not a EntityContainer.public void setStoreDirectoryName(java.lang.String dirName)
This value will be appened to the value of jboss-server-data-dir.
This value is only used during creation and will not dynamically change the store directory when set after the create step has finished.
dirName
- A sub-directory name.public java.lang.String getStoreDirectoryName()
setStoreDirectoryName(java.lang.String)
public java.io.File getStoreDirectory()
protected void createService() throws java.lang.Exception
ServiceMBeanSupport (src)
This method is empty, and is provided for convenience when concrete service classes do not need to perform anything specific for this state change.
createService
in class ServiceMBeanSupport (src)
java.lang.Exception
protected void destroyService() throws java.lang.Exception
destroyService
in class ServiceMBeanSupport (src)
java.lang.Exception
public java.lang.Object createBeanClassInstance() throws java.lang.Exception
EntityPersistenceStore (src)
createBeanClassInstance
in interface EntityPersistenceStore (src)
java.lang.Exception
public void initEntity(EntityEnterpriseContext (src) ctx)
The EJB 1.1 specification is not entirely clear about this, the EJB 2.0 spec is, see page 169. Robustness is more important than raw speed for most server applications, and not resetting atrribute values result in *very* weird errors (old states re-appear in different instances and the developer thinks he's on drugs).
initEntity
in interface EntityPersistenceStore (src)
ctx
- public java.lang.Object createEntity(java.lang.reflect.Method m, java.lang.Object[] args, EntityEnterpriseContext (src) ctx) throws java.lang.Exception
EntityPersistenceStore (src)
createEntity
in interface EntityPersistenceStore (src)
m
- the create method in the home interface that was
calledargs
- any create parametersctx
- the instance being used for this create call
java.lang.Exception
public java.lang.Object postCreateEntity(java.lang.reflect.Method m, java.lang.Object[] args, EntityEnterpriseContext (src) ctx) throws java.lang.Exception
EntityPersistenceStore (src)
postCreateEntity
in interface EntityPersistenceStore (src)
m
- the ejbPostCreate method in the bean class that was
calledargs
- any create parametersctx
- the instance being used for this create call
java.lang.Exception
public java.lang.Object findEntity(java.lang.reflect.Method finderMethod, java.lang.Object[] args, EntityEnterpriseContext (src) ctx, GenericEntityObjectFactory (src) factory) throws FinderException (src)
EntityPersistenceStore (src)
findEntity
in interface EntityPersistenceStore (src)
finderMethod
- the find method in the home interface that was
calledargs
- any finder parametersctx
- the instance to use for the finder call
FinderException (src)
public java.util.Collection findEntities(java.lang.reflect.Method finderMethod, java.lang.Object[] args, EntityEnterpriseContext (src) ctx, GenericEntityObjectFactory (src) factory)
EntityPersistenceStore (src)
findEntities
in interface EntityPersistenceStore (src)
finderMethod
- the find method in the home interface that was
calledargs
- any finder parametersctx
- the instance to use for the finder call
public void activateEntity(EntityEnterpriseContext (src) ctx)
activateEntity
in interface EntityPersistenceStore (src)
ctx
- the instance to use for the activationpublic void loadEntity(EntityEnterpriseContext (src) ctx)
EntityPersistenceStore (src)
loadEntity
in interface EntityPersistenceStore (src)
ctx
- the instance to synchronizepublic boolean isStoreRequired(EntityEnterpriseContext (src) ctx) throws java.lang.Exception
EntityPersistenceStore (src)
isStoreRequired
in interface EntityPersistenceStore (src)
ctx
- the instance to check
java.lang.Exception
- thrown if some system exception occurspublic boolean isModified(EntityEnterpriseContext (src) ctx) throws java.lang.Exception
EntityPersistenceStore (src)
isModified
in interface EntityPersistenceStore (src)
ctx
-
java.lang.Exception
public void storeEntity(EntityEnterpriseContext (src) ctx)
EntityPersistenceStore (src)
storeEntity
in interface EntityPersistenceStore (src)
ctx
- the instance to synchronizepublic void passivateEntity(EntityEnterpriseContext (src) ctx)
passivateEntity
in interface EntityPersistenceStore (src)
ctx
- the instance to passivatepublic void removeEntity(EntityEnterpriseContext (src) ctx) throws RemoveException (src)
EntityPersistenceStore (src)
removeEntity
in interface EntityPersistenceStore (src)
ctx
- the instance to remove
RemoveException (src)
- thrown if the instance could not be removedprotected java.io.File getFile(java.lang.Object id)
|
||||||||||
PREV CLASS (src) NEXT CLASS (src) | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |