Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.RuntimeCollective.webapps
Class IndexedEntityBeanStore  view IndexedEntityBeanStore download IndexedEntityBeanStore.java

java.lang.Object
  extended bycom.RuntimeCollective.webapps.IndexedEntityBeanStore
All Implemented Interfaces:
EntityBeanStore
Direct Known Subclasses:
AlwaysUpdateEntityBeanStore, SynchronizedEntityBeanStore

public class IndexedEntityBeanStore
extends java.lang.Object
implements EntityBeanStore

An extension of SimpleEntityBeanStore that maintains a object index. This records the entity bean type for each unique ID, and enables this store to handle superclasses and interfaces properly.

For example, if a bean is registered on the store using a particular id and class name, but then retrieved using a superclass or interface name, then this store can still determine the correct constructor to call.

Version:
$Id: IndexedEntityBeanStore.java,v 1.43 2003/10/03 14:48:10 criss Exp $

Field Summary
protected  Cache[] caches
           
protected  java.util.ArrayList cachesList
           
static java.lang.String CLASS_NAME_FIELD
           
protected  java.lang.Class[] classes
           
protected  java.util.ArrayList classesList
           
protected static java.lang.Class[] classId
           
protected  java.util.HashMap classIndices
           
protected static java.lang.Class[] classNew
           
static java.lang.String CREATED_BEAN
           
protected  java.lang.reflect.Constructor[] creates
           
protected  java.util.ArrayList createsList
           
static java.lang.String DELETE_QUERY
           
static java.lang.String DELETING_BEAN
           
static java.lang.String ESC_COMMA_ESC
           
static java.lang.String FLUSHING_BEAN
           
static java.lang.String FOR_CLASS
           
static java.lang.String FROM_DB
           
protected  java.lang.reflect.Constructor[] gets
           
protected  java.util.ArrayList getsList
           
(package private)  java.util.Hashtable GlobalObjectIdNameHash
           
protected  int noRegisteredBeans
           
static java.lang.String NOTHING
           
static java.lang.String OBJECT_TABLE
           
static java.lang.String ORDER_BY
           
protected static java.lang.Integer[] paramId
           
protected static java.lang.Integer[] paramNew
           
static java.util.Hashtable ParentLists
           
static java.lang.String REFRESHING_BEAN
           
static java.lang.String RELOADING_BEAN
           
static java.lang.String SAVING_BEAN
           
static java.lang.String SELECT_CLASSNAME_QUERY
           
static java.lang.String SELECT_ID
           
static java.lang.String SELECT_QUERY
           
static java.lang.String SPACE
           
protected  java.lang.String[] tables
           
protected  java.util.ArrayList tablesList
           
static java.lang.String WHERE_CLASSNAME
           
 
Constructor Summary
IndexedEntityBeanStore()
           
 
Method Summary
static boolean checkClassExtendsOrImplementsAnother(java.lang.String subClassName, java.lang.String parentClassName)
          Check if a class name extends or implements another
 void clear()
          Clear the store.
 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 eb)
          Delete an entity bean
 void delete(java.lang.String className, int id)
          Delete an entity bean
 void fillGlobalObjectCache()
           
 void flush(com.RuntimeCollective.webapps.bean.EntityBean eb)
          Flush an entity bean from the cache, useful to spare memory, or for testing.
 void flush(java.lang.String className, int id)
          Flush an entity bean from the cache, useful to spare memory, or for testing.
 com.RuntimeCollective.webapps.bean.EntityBean get(java.lang.String className, int id)
          Get an entity bean (this used to use entity name)
 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 (entity 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.
protected  java.lang.String getRealClassName(java.lang.String className, int id)
          Get the real class name of a bean, which should be a subclass of the class provided
 EntityBeanStore getStoreForBean(java.lang.String className)
          Get the EntityBeanStore for a Class name.
 void init()
          Initialise the store, creating the necessary hash maps to store the registered bean types.
 com.RuntimeCollective.webapps.bean.EntityBean refresh(com.RuntimeCollective.webapps.bean.EntityBean eb)
          Refresh an entity bean in cache: flush it and get it.
 com.RuntimeCollective.webapps.bean.EntityBean refresh(java.lang.String className, int id)
          Refresh an entity bean in cache: flush it and get it.
 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 eb)
          Save an entity bean
 void save(java.lang.String className, int id)
          Save an entity bean
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OBJECT_TABLE

public static final java.lang.String OBJECT_TABLE
See Also:
Constant Field Values

DELETE_QUERY

public static final java.lang.String DELETE_QUERY
See Also:
Constant Field Values

SELECT_QUERY

public static final java.lang.String SELECT_QUERY
See Also:
Constant Field Values

SELECT_CLASSNAME_QUERY

public static final java.lang.String SELECT_CLASSNAME_QUERY
See Also:
Constant Field Values

SELECT_ID

public static final java.lang.String SELECT_ID
See Also:
Constant Field Values

WHERE_CLASSNAME

public static final java.lang.String WHERE_CLASSNAME
See Also:
Constant Field Values

ORDER_BY

public static final java.lang.String ORDER_BY
See Also:
Constant Field Values

ESC_COMMA_ESC

public static final java.lang.String ESC_COMMA_ESC
See Also:
Constant Field Values

CLASS_NAME_FIELD

public static final java.lang.String CLASS_NAME_FIELD
See Also:
Constant Field Values

RELOADING_BEAN

public static final java.lang.String RELOADING_BEAN
See Also:
Constant Field Values

REFRESHING_BEAN

public static final java.lang.String REFRESHING_BEAN
See Also:
Constant Field Values

FLUSHING_BEAN

public static final java.lang.String FLUSHING_BEAN
See Also:
Constant Field Values

SAVING_BEAN

public static final java.lang.String SAVING_BEAN
See Also:
Constant Field Values

DELETING_BEAN

public static final java.lang.String DELETING_BEAN
See Also:
Constant Field Values

CREATED_BEAN

public static final java.lang.String CREATED_BEAN
See Also:
Constant Field Values

FROM_DB

public static final java.lang.String FROM_DB
See Also:
Constant Field Values

FOR_CLASS

public static final java.lang.String FOR_CLASS
See Also:
Constant Field Values

SPACE

public static final java.lang.String SPACE
See Also:
Constant Field Values

NOTHING

public static final java.lang.String NOTHING
See Also:
Constant Field Values

noRegisteredBeans

protected int noRegisteredBeans

classIndices

protected java.util.HashMap classIndices

gets

protected java.lang.reflect.Constructor[] gets

getsList

protected java.util.ArrayList getsList

creates

protected java.lang.reflect.Constructor[] creates

createsList

protected java.util.ArrayList createsList

classes

protected java.lang.Class[] classes

classesList

protected java.util.ArrayList classesList

tables

protected java.lang.String[] tables

tablesList

protected java.util.ArrayList tablesList

caches

protected Cache[] caches

cachesList

protected java.util.ArrayList cachesList

paramId

protected static java.lang.Integer[] paramId

paramNew

protected static java.lang.Integer[] paramNew

classId

protected static java.lang.Class[] classId

classNew

protected static java.lang.Class[] classNew

GlobalObjectIdNameHash

java.util.Hashtable GlobalObjectIdNameHash

ParentLists

public static java.util.Hashtable ParentLists
Constructor Detail

IndexedEntityBeanStore

public IndexedEntityBeanStore()
Method Detail

registerBean

public void registerBean(java.lang.String className,
                         java.lang.String cacheName)
                  throws java.lang.RuntimeException
Register an Entity Bean class on this store.

Specified by:
registerBean in interface EntityBeanStore

init

public void init()
          throws java.lang.RuntimeException
Initialise the store, creating the necessary hash maps to store the registered bean types.

Specified by:
init in interface EntityBeanStore

fillGlobalObjectCache

public void fillGlobalObjectCache()

get

public com.RuntimeCollective.webapps.bean.EntityBean get(java.lang.String className,
                                                         int id)
                                                  throws java.lang.RuntimeException
Get an entity bean (this used to use entity name)

Specified by:
get in interface EntityBeanStore

refresh

public com.RuntimeCollective.webapps.bean.EntityBean refresh(com.RuntimeCollective.webapps.bean.EntityBean eb)
                                                      throws java.lang.RuntimeException
Refresh an entity bean in cache: flush it and get it.

Specified by:
refresh in interface EntityBeanStore

refresh

public com.RuntimeCollective.webapps.bean.EntityBean refresh(java.lang.String className,
                                                             int id)
                                                      throws java.lang.RuntimeException
Refresh an entity bean in cache: flush it and get it.

Specified by:
refresh in interface EntityBeanStore

flush

public void flush(com.RuntimeCollective.webapps.bean.EntityBean eb)
           throws java.lang.RuntimeException
Flush an entity bean from the cache, useful to spare memory, or for testing.

Specified by:
flush in interface EntityBeanStore

flush

public void flush(java.lang.String className,
                  int id)
           throws java.lang.RuntimeException
Flush an entity bean from the cache, useful to spare memory, or for testing.

Specified by:
flush in interface EntityBeanStore

create

public com.RuntimeCollective.webapps.bean.EntityBean create(java.lang.String className)
                                                     throws java.lang.RuntimeException
Generate a new entity bean of the given class, with a new unique id.

Specified by:
create in interface EntityBeanStore

save

public void save(com.RuntimeCollective.webapps.bean.EntityBean eb)
          throws java.lang.RuntimeException
Save an entity bean

Specified by:
save in interface EntityBeanStore

save

public void save(java.lang.String className,
                 int id)
          throws java.lang.RuntimeException
Save an entity bean

Specified by:
save in interface EntityBeanStore

delete

public void delete(com.RuntimeCollective.webapps.bean.EntityBean eb)
            throws java.lang.RuntimeException
Delete an entity bean

Specified by:
delete in interface EntityBeanStore

delete

public void delete(java.lang.String className,
                   int id)
            throws java.lang.RuntimeException
Delete an entity bean

Specified by:
delete in interface EntityBeanStore

clear

public void clear()
Clear the store.

Specified by:
clear in interface EntityBeanStore

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

Specified by:
getAll in interface EntityBeanStore

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

Specified by:
getAllAsList in interface EntityBeanStore

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

Specified by:
getAllIds in interface EntityBeanStore

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

Specified by:
getAllIdsAsList in interface EntityBeanStore

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.

Specified by:
getExactNameAll in interface EntityBeanStore

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

Specified by:
getExactNameAllAsList in interface EntityBeanStore

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.

Specified by:
getExactNameAllIds in interface EntityBeanStore

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.

Specified by:
getExactNameAllIdsAsList in interface EntityBeanStore

getAllClasses

public java.util.Iterator getAllClasses()
                                 throws java.sql.SQLException
Get an iterator of all class names (entity names) that the EntityBeanStore handles

Specified by:
getAllClasses in interface EntityBeanStore

getStoreForBean

public EntityBeanStore getStoreForBean(java.lang.String className)
Get the EntityBeanStore for a Class name.

Specified by:
getStoreForBean in interface EntityBeanStore

getBeanCache

public Cache getBeanCache(java.lang.String className)
Get the Cache for a Class name.

Specified by:
getBeanCache in interface EntityBeanStore

getRealClassName

protected java.lang.String getRealClassName(java.lang.String className,
                                            int id)
                                     throws java.lang.RuntimeException
Get the real class name of a bean, which should be a subclass of the class provided


checkClassExtendsOrImplementsAnother

public static boolean checkClassExtendsOrImplementsAnother(java.lang.String subClassName,
                                                           java.lang.String parentClassName)
                                                    throws java.lang.RuntimeException
Check if a class name extends or implements another


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

Specified by:
getAsLazyList in interface EntityBeanStore

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

Specified by:
getAsLazyList in interface EntityBeanStore

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

Specified by:
getAsLazyList in interface EntityBeanStore