|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.torque.manager.AbstractBaseManager<T>
T
- the class of the database object managed by this class.public abstract class AbstractBaseManager<T extends Persistent>
This class contains common functionality of a Manager for instantiating OM's.
Field Summary | |
---|---|
protected org.apache.jcs.access.GroupCacheAccess |
cache
used to cache the om objects. |
protected Map<String,org.apache.commons.collections.FastArrayList> |
listenersMap
The listeners for this manager. |
protected static org.apache.commons.logging.Log |
log
the log |
protected MethodResultCache |
mrCache
method results cache |
protected Map<String,?> |
validFields
The fields which are valid fields of interest for a listener. |
Constructor Summary | |
---|---|
AbstractBaseManager()
|
Method Summary | ||
---|---|---|
void |
addCacheListenerImpl(CacheListener<? extends Persistent> listener)
|
|
protected T |
cacheGet(Serializable key)
Get an object from cache |
|
protected void |
clearImpl()
Clears the cache |
|
void |
dispose()
Disposes of the cache. |
|
String |
getClassName()
Get the classname to instantiate for getInstance() |
|
MethodResultCache |
getMethodResultCache()
|
|
protected Class<T> |
getOMClass()
Get the Class instance |
|
protected T |
getOMInstance()
Get a fresh instance of an om |
|
protected T |
getOMInstance(ObjectKey id)
Return an instance of an om based on the id |
|
protected T |
getOMInstance(ObjectKey key,
boolean fromCache)
Return an instance of an om based on the id |
|
protected List<T> |
getOMs(List<? extends ObjectKey> ids)
Gets a list of om's based on id's. |
|
protected List<T> |
getOMs(List<? extends ObjectKey> ids,
boolean fromCache)
Gets a list of om's based on id's. |
|
protected List<T> |
getOMs(ObjectKey[] ids)
Gets a list of om's based on id's. |
|
String |
getRegion()
Get the cache region used for JCS. |
|
protected
|
notifyListeners(List<WeakReference<CacheListener<TT>>> listeners,
TT oldOm,
TT om)
|
|
protected T |
putInstanceImpl(Serializable key,
T om)
Put an object into the cache |
|
protected T |
putInstanceImpl(T om)
Put an object into the cache |
|
protected void |
registerAsListener()
NoOp version. |
|
protected T |
removeInstanceImpl(Serializable key)
Remove an object from the cache |
|
protected abstract T |
retrieveStoredOM(ObjectKey id)
Retrieve an object from persistent storage |
|
protected abstract List<T> |
retrieveStoredOMs(List<? extends ObjectKey> ids)
Gets a list of om's based on id's. |
|
void |
setClassName(String v)
Set the classname to instantiate for getInstance() |
|
protected void |
setOMClass(Class<T> omClass)
Set the Class that will be instantiated by this manager |
|
void |
setRegion(String v)
Set the cache region used for JCS. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final org.apache.commons.logging.Log log
protected transient org.apache.jcs.access.GroupCacheAccess cache
protected MethodResultCache mrCache
protected Map<String,?> validFields
protected Map<String,org.apache.commons.collections.FastArrayList> listenersMap
Constructor Detail |
---|
public AbstractBaseManager()
Method Detail |
---|
protected Class<T> getOMClass()
protected void setOMClass(Class<T> omClass)
omClass
- the om classprotected T getOMInstance() throws TorqueException
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.public String getClassName()
public void setClassName(String v) throws TorqueException
v
- Value to assign to className.
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.protected T getOMInstance(ObjectKey id) throws TorqueException
id
- the primary key of the object
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.protected T getOMInstance(ObjectKey key, boolean fromCache) throws TorqueException
key
- the primary key of the objectfromCache
- true if the object should be retrieved from cache
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.protected T cacheGet(Serializable key)
key
- the primary key of the object
protected void clearImpl() throws TorqueException
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.public void dispose()
protected T removeInstanceImpl(Serializable key) throws TorqueException
key
- the cache key for the object
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.protected T putInstanceImpl(T om) throws TorqueException
om
- the object
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.protected T putInstanceImpl(Serializable key, T om) throws TorqueException
key
- the cache key for the objectom
- the object
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.protected abstract T retrieveStoredOM(ObjectKey id) throws TorqueException
id
- the primary key of the object
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.protected List<T> getOMs(ObjectKey[] ids) throws TorqueException
ids
- a ObjectKey[]
value
List
value
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.protected List<T> getOMs(List<? extends ObjectKey> ids) throws TorqueException
ids
- a List
of ObjectKey
's
List
value
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.protected List<T> getOMs(List<? extends ObjectKey> ids, boolean fromCache) throws TorqueException
ids
- a List
of ObjectKey
's
List
value
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.protected abstract List<T> retrieveStoredOMs(List<? extends ObjectKey> ids) throws TorqueException
ids
- a List
of ObjectKey
's
List
value
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.public String getRegion()
public void setRegion(String v) throws TorqueException
v
- Value to assign to region.
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.public MethodResultCache getMethodResultCache()
protected void registerAsListener()
public void addCacheListenerImpl(CacheListener<? extends Persistent> listener)
listener
- A new listener for cache events.protected <TT extends Persistent> void notifyListeners(List<WeakReference<CacheListener<TT>>> listeners, TT oldOm, TT om)
listeners
- oldOm
- om
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |