|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.mx.util.JBossNotificationBroadcasterSupport org.jboss.system.ServiceMBeanSupport 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"
20010801 marc fleury:
20011201 Dain Sundstrom:
20020525 Dain Sundstrom:
Field Summary | |
static String |
DEFAULT_STORE_DIRECTORY_NAME
The default store directory name ("entities"). |
Fields inherited from class org.jboss.system.ServiceMBeanSupport |
log, server, SERVICE_CONTROLLER_SIG, serviceName |
Fields inherited from interface org.jboss.system.ServiceMBean |
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 ctx)
Non-operation. |
Object |
createBeanClassInstance()
Returns a new instance of the bean class or a subclass of the bean class. |
Object |
createEntity(Method m,
Object[] args,
EntityEnterpriseContext ctx)
This method is called whenever an entity is to be created. |
protected void |
createService()
|
protected void |
destroyService()
Try to remove the store directory, if we can't then ignore. |
Collection |
findEntities(Method finderMethod,
Object[] args,
EntityEnterpriseContext ctx,
GenericEntityObjectFactory factory)
This method is called when collections of entities are to be found. |
Object |
findEntity(Method finderMethod,
Object[] args,
EntityEnterpriseContext ctx,
GenericEntityObjectFactory factory)
This method is called when single entities are to be found. |
protected File |
getFile(Object id)
|
File |
getStoreDirectory()
Returns the directory used to store entity state files. |
String |
getStoreDirectoryName()
Get the sub-directory name under the server data directory where entity data is stored. |
void |
initEntity(EntityEnterpriseContext ctx)
Reset all attributes to default value |
boolean |
isModified(EntityEnterpriseContext ctx)
This method is used to determined whether the instance was modified. |
boolean |
isStoreRequired(EntityEnterpriseContext ctx)
This method is used to determine if an entity should be stored. |
void |
loadEntity(EntityEnterpriseContext ctx)
This method is called whenever an entity shall be load from the underlying storage. |
void |
passivateEntity(EntityEnterpriseContext ctx)
Non-operation. |
Object |
postCreateEntity(Method m,
Object[] args,
EntityEnterpriseContext ctx)
This method is called after the createEntity. |
void |
removeEntity(EntityEnterpriseContext ctx)
This method is called when an entity shall be removed from the underlying storage. |
void |
setContainer(Container c)
Saves a reference to the EntityContainer for
its bean type. |
void |
setStoreDirectoryName(String dirName)
Set the sub-directory name under the server data directory where entity data will be stored. |
void |
storeEntity(EntityEnterpriseContext ctx)
This method is called whenever an entity shall be stored to the underlying storage. |
Methods inherited from class org.jboss.system.ServiceMBeanSupport |
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 |
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 |
create, destroy, start, stop |
Field Detail |
public static final String DEFAULT_STORE_DIRECTORY_NAME
Constructor Detail |
public CMPFilePersistenceManager()
Method Detail |
public void setContainer(Container c)
EntityContainer
for
its bean type.
setContainer
in interface ContainerPlugin
c
- The container using this plugin. This may be null if the
plugin is being disassociated from a container.
ClassCastException
- Container is not a EntityContainer.public void setStoreDirectoryName(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 String getStoreDirectoryName()
setStoreDirectoryName(java.lang.String)
public File getStoreDirectory()
protected void createService() throws Exception
Exception
protected void destroyService() throws Exception
Exception
public Object createBeanClassInstance() throws Exception
EntityPersistenceStore
createBeanClassInstance
in interface EntityPersistenceStore
Exception
public void initEntity(EntityEnterpriseContext 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
ctx
- public Object createEntity(Method m, Object[] args, EntityEnterpriseContext ctx) throws Exception
EntityPersistenceStore
createEntity
in interface EntityPersistenceStore
m
- the create method in the home interface that was
calledargs
- any create parametersctx
- the instance being used for this create call
Exception
public Object postCreateEntity(Method m, Object[] args, EntityEnterpriseContext ctx) throws Exception
EntityPersistenceStore
postCreateEntity
in interface EntityPersistenceStore
m
- the ejbPostCreate method in the bean class that was
calledargs
- any create parametersctx
- the instance being used for this create call
Exception
public Object findEntity(Method finderMethod, Object[] args, EntityEnterpriseContext ctx, GenericEntityObjectFactory factory) throws javax.ejb.FinderException
EntityPersistenceStore
findEntity
in interface EntityPersistenceStore
finderMethod
- the find method in the home interface that was
calledargs
- any finder parametersctx
- the instance to use for the finder call
javax.ejb.FinderException
public Collection findEntities(Method finderMethod, Object[] args, EntityEnterpriseContext ctx, GenericEntityObjectFactory factory)
EntityPersistenceStore
findEntities
in interface EntityPersistenceStore
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 ctx)
activateEntity
in interface EntityPersistenceStore
ctx
- the instance to use for the activationpublic void loadEntity(EntityEnterpriseContext ctx)
EntityPersistenceStore
loadEntity
in interface EntityPersistenceStore
ctx
- the instance to synchronizepublic boolean isStoreRequired(EntityEnterpriseContext ctx) throws Exception
EntityPersistenceStore
isStoreRequired
in interface EntityPersistenceStore
ctx
- the instance to check
Exception
- thrown if some system exception occurspublic boolean isModified(EntityEnterpriseContext ctx) throws Exception
EntityPersistenceStore
isModified
in interface EntityPersistenceStore
ctx
-
Exception
public void storeEntity(EntityEnterpriseContext ctx)
EntityPersistenceStore
storeEntity
in interface EntityPersistenceStore
ctx
- the instance to synchronizepublic void passivateEntity(EntityEnterpriseContext ctx)
passivateEntity
in interface EntityPersistenceStore
ctx
- the instance to passivatepublic void removeEntity(EntityEnterpriseContext ctx) throws javax.ejb.RemoveException
EntityPersistenceStore
removeEntity
in interface EntityPersistenceStore
ctx
- the instance to remove
javax.ejb.RemoveException
- thrown if the instance could not be removedprotected File getFile(Object id)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |