T
- the class of the database object managed by this class.public abstract class AbstractBaseManager<T extends Persistent> extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
protected org.apache.commons.jcs.access.CacheAccess<ObjectKey<?>,T> |
cache
used to cache the om objects.
|
protected org.apache.commons.jcs.access.GroupCacheAccess<MethodCacheKey,Object> |
groupCache
used to cache the method result objects.
|
protected static org.apache.logging.log4j.Logger |
log
the log
|
protected MethodResultCache |
mrCache
method results cache
|
Constructor and Description |
---|
AbstractBaseManager() |
Modifier and Type | Method and Description |
---|---|
void |
addCacheListenerImpl(CacheListener<?> listener)
Add a new listener
|
protected void |
addValidField(Column... columns)
Add variable number of fields to the list potentially monitored by a listener
|
protected T |
cacheGet(ObjectKey<?> key)
Get an object from cache
|
protected void |
clearImpl()
Clears the cache
|
void |
dispose()
Disposes of the manager.
|
String |
getClassName()
Get the classname to instantiate for getInstance()
|
MethodResultCache |
getMethodResultCache()
Get the object usable for result caching
|
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 <TT extends Persistent> |
notifyListeners(Column column,
TT oldOm,
TT om)
Notify all listeners associated to the column that an object has changed
|
protected T |
putInstanceImpl(ObjectKey<?> 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(ObjectKey<?> 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.
|
protected static final org.apache.logging.log4j.Logger log
protected transient org.apache.commons.jcs.access.CacheAccess<ObjectKey<?>,T extends Persistent> cache
protected transient org.apache.commons.jcs.access.GroupCacheAccess<MethodCacheKey,Object> groupCache
protected transient MethodResultCache mrCache
protected void setOMClass(Class<T> omClass)
omClass
- the om classprotected void addValidField(Column... columns)
columns
- array of columnsprotected 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 objectTorqueException
- 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 cacheTorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.protected T cacheGet(ObjectKey<?> key)
key
- the primary key of the objectprotected void clearImpl() throws TorqueException
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.public void dispose()
protected T removeInstanceImpl(ObjectKey<?> key) throws TorqueException
key
- the cache key for the objectTorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.protected T putInstanceImpl(T om) throws TorqueException
om
- the objectTorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.protected T putInstanceImpl(ObjectKey<?> key, T om) throws TorqueException
key
- the cache key for the objectom
- the objectTorqueException
- 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 objectTorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.protected List<T> getOMs(ObjectKey<?>... ids) throws TorqueException
ids
- a number of object idsList
of objectsTorqueException
- 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
'sList
valueTorqueException
- 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.fromCache
- boolean flag if we are to use the cacheList
value, not null.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
'sList
valueTorqueException
- 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<?> listener)
listener
- A new listener for cache events.protected <TT extends Persistent> void notifyListeners(Column column, TT oldOm, TT om)
TT
- column type classcolumn
- the column related to the listenersoldOm
- the previous object, null if the object has been addedom
- the new object, null if the object has been removedCopyright © 2000–2020 The Apache Software Foundation. All rights reserved.