|
|||||||||
| Home >> All >> com >> RuntimeCollective >> [ webapps overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.RuntimeCollective.webapps
Interface EntityBeanStore

- All Known Implementing Classes:
- EntityBeanStoreHandler, IndexedEntityBeanStore, SimpleEntityBeanStore
- public interface EntityBeanStore
A store for EntityBeans that ensures that multiple instances of the same bean are never recreated from the database.
There are three advantages to using EntityBeanStores:
- Reduces the overhead in creating new Java objects.
- Reduces the overhead in extra reads from the database.
- Eliminates the problem of keeping multiple instances of the same bean synchronised.
There are four stages to using this store:
- Register bean types (
registerBean()) Register each type of bean class that the store will hold, using a specified cache class. - Initialise the store (
init()) The store will then construct a hashtable, keyed by primary key, for holding each type of bean. - Get bean instances (
get()andcreate()) Threads within a Runtime Struts application should never create new beans directly (except if they are guaranteed to be used only by a single thread). Instead they should get new bean instances from this store. If the bean has not yet bean created, then it will be generated from the database, stored in memory inside the store, and can be accessed by the thread. - Manipulate bean instances (
save()anddelete()) Threads should never save or delete beans directly, but on ly via the store.
An EntityBeanStore will be initialised automatically from the InitialiserServlet if the appropriate init-params are included in web.xml. Once initialised it is available from RuntimeParameters.getStore().
It is up to particular implementations of this interface to ensure that they are thread-safe. Interface methods are not declared synchronized, but implemented code may have to be.
- Version:
- $Id: EntityBeanStore.java,v 1.11 2003/09/30 15:13:03 joe Exp $
| Method Summary | |
void |
clear()
Clear the store of all bean instances |
com.RuntimeCollective.webapps.bean.EntityBean |
create(java.lang.String className)
Generate a new entity bean of the given class, with a new unique id. |
void |
delete(com.RuntimeCollective.webapps.bean.EntityBean bean)
Delete an entity bean. |
void |
delete(java.lang.String className,
int id)
Delete an entity bean. |
void |
flush(com.RuntimeCollective.webapps.bean.EntityBean eb)
Flush an entity bean from the memory, useful to spare memory, or for testing. |
void |
flush(java.lang.String className,
int id)
Flush an entity bean from the memory -- useful to spare memory, or for testing. |
com.RuntimeCollective.webapps.bean.EntityBean |
get(java.lang.String className,
int id)
Get an entity bean. |
java.util.Iterator |
getAll(java.lang.String className)
Get an iterator of all saved beans of this class name |
java.util.List |
getAllAsList(java.lang.String className)
Get a list of all saved beans of this class name |
java.util.Iterator |
getAllClasses()
Get an iterator of all class names that the EntityBeanStore handles |
java.util.Iterator |
getAllIds(java.lang.String className)
Get an iterator of all saved beans' ids of this class name |
java.util.List |
getAllIdsAsList(java.lang.String className)
Get a list of all saved beans' ids of this class name |
java.util.List |
getAsLazyList(java.lang.String className,
int[] ids)
Get a list of all beans in the id array, as a lazy-loading list |
java.util.List |
getAsLazyList(java.lang.String className,
java.util.List ids)
Get a list of all beans in the id array, as a lazy-loading list |
java.util.List |
getAsLazyList(java.lang.String className,
java.lang.String query)
Get a list of all beans whose ids are selected by the given query, as a lazy-loading list |
Cache |
getBeanCache(java.lang.String className)
Get the Cache for a Class name. |
java.util.Iterator |
getExactNameAll(java.lang.String className)
Get an iterator of all saved beans of this class name, but only this class, not sub-classes |
java.util.List |
getExactNameAllAsList(java.lang.String className)
Get a list of all saved beans of this class name, but only this class, not sub-classes |
java.util.Iterator |
getExactNameAllIds(java.lang.String className)
Get an iterator of all saved beans' ids of this class name, but only this class, not sub-classes |
java.util.List |
getExactNameAllIdsAsList(java.lang.String className)
Get a list of all saved beans' ids of this class name, but only this class, not sub-classes |
EntityBeanStore |
getStoreForBean(java.lang.String className)
Get the EntityBeanStore for a Class name. |
void |
init()
Initialise the store, creating the necessary caches to store the registered bean types. |
com.RuntimeCollective.webapps.bean.EntityBean |
refresh(com.RuntimeCollective.webapps.bean.EntityBean eb)
Refresh an entity bean in memory, this will flush the bean and get (reload) it. |
com.RuntimeCollective.webapps.bean.EntityBean |
refresh(java.lang.String className,
int id)
Refresh an entity bean in memory. |
void |
registerBean(java.lang.String className,
java.lang.String cacheName)
Register an Entity Bean class on this store. |
void |
save(com.RuntimeCollective.webapps.bean.EntityBean bean)
Save the current state of an entity bean. |
void |
save(java.lang.String className,
int id)
Save the current state of an entity bean. |
| Method Detail |
registerBean
public void registerBean(java.lang.String className, java.lang.String cacheName)
- Register an Entity Bean class on this store.
init
public void init()
- Initialise the store, creating the necessary caches to store the registered bean types.
get
public com.RuntimeCollective.webapps.bean.EntityBean get(java.lang.String className, int id)
- Get an entity bean.
refresh
public com.RuntimeCollective.webapps.bean.EntityBean refresh(com.RuntimeCollective.webapps.bean.EntityBean eb)
- Refresh an entity bean in memory, this will flush the bean and get (reload) it.
refresh
public com.RuntimeCollective.webapps.bean.EntityBean refresh(java.lang.String className, int id)
- Refresh an entity bean in memory. This will flush the bean and reload it.
flush
public void flush(com.RuntimeCollective.webapps.bean.EntityBean eb)
- Flush an entity bean from the memory, useful to spare memory, or for testing.
flush
public void flush(java.lang.String className, int id)
- Flush an entity bean from the memory -- useful to spare memory, or for testing.
create
public com.RuntimeCollective.webapps.bean.EntityBean create(java.lang.String className)
- Generate a new entity bean of the given class, with a new unique id.
clear
public void clear()
- Clear the store of all bean instances
save
public void save(com.RuntimeCollective.webapps.bean.EntityBean bean)
- Save the current state of an entity bean.
This should be called after every update to the internal state of a bean.
save
public void save(java.lang.String className, int id)
- Save the current state of an entity bean.
This should be called after every update to the internal state of a bean.
delete
public void delete(com.RuntimeCollective.webapps.bean.EntityBean bean)
- Delete an entity bean.
This will remove the bean from the cache, as well as from the database.
delete
public void delete(java.lang.String className, int id)
- Delete an entity bean.
This will remove the bean from the cache, as well as from the database.
getStoreForBean
public EntityBeanStore getStoreForBean(java.lang.String className)
- Get the EntityBeanStore for a Class name.
getBeanCache
public Cache getBeanCache(java.lang.String className)
- Get the Cache for a Class name.
getAll
public java.util.Iterator getAll(java.lang.String className) throws java.sql.SQLException
- Get an iterator of all saved beans of this class name
getAllIds
public java.util.Iterator getAllIds(java.lang.String className) throws java.sql.SQLException
- Get an iterator of all saved beans' ids of this class name
getExactNameAll
public java.util.Iterator getExactNameAll(java.lang.String className) throws java.sql.SQLException
- Get an iterator of all saved beans of this class name,
but only this class, not sub-classes
getExactNameAllIds
public java.util.Iterator getExactNameAllIds(java.lang.String className) throws java.sql.SQLException
- Get an iterator of all saved beans' ids of this class name,
but only this class, not sub-classes
getAllAsList
public java.util.List getAllAsList(java.lang.String className) throws java.sql.SQLException
- Get a list of all saved beans of this class name
getAllIdsAsList
public java.util.List getAllIdsAsList(java.lang.String className) throws java.sql.SQLException
- Get a list of all saved beans' ids of this class name
getExactNameAllAsList
public java.util.List getExactNameAllAsList(java.lang.String className) throws java.sql.SQLException
- Get a list of all saved beans of this class name,
but only this class, not sub-classes
getExactNameAllIdsAsList
public java.util.List getExactNameAllIdsAsList(java.lang.String className) throws java.sql.SQLException
- Get a list of all saved beans' ids of this class name,
but only this class, not sub-classes
getAllClasses
public java.util.Iterator getAllClasses() throws java.sql.SQLException
- Get an iterator of all class names that the EntityBeanStore handles
getAsLazyList
public java.util.List getAsLazyList(java.lang.String className, int[] ids)
- Get a list of all beans in the id array, as a lazy-loading list
getAsLazyList
public java.util.List getAsLazyList(java.lang.String className, java.util.List ids)
- Get a list of all beans in the id array, as a lazy-loading list
getAsLazyList
public java.util.List getAsLazyList(java.lang.String className, java.lang.String query)
- Get a list of all beans whose ids are selected by the given query,
as a lazy-loading list
|
|||||||||
| Home >> All >> com >> RuntimeCollective >> [ webapps overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC