|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.ojb.broker.cache.CacheDistributor
class CacheDistributor
A intern used AbstractMetaCache
implementation acting
as distributor of ObjectCache
implementations declared
in configuration metadata.
Nested Class Summary | |
---|---|
(package private) static class |
CacheDistributor.ObjectCacheInternalWrapper
Wrapper class used to make existing ObjectCache implementations work
with ObjectCacheInternal . |
Field Summary | |
---|---|
private PersistenceBroker |
broker
|
static String |
CACHE_EXCLUDES_STRING
|
private Map |
caches
map, represents used cache implementations |
private static String |
DELIMITER_FOR_EXCLUDE
|
private static String |
DESCRIPTOR_BASED_CACHES
|
private boolean |
descriptorBasedCaches
If true the class name of the object is used
to find a per class ObjectCache implementation. |
private static ObjectCacheInternal |
DUMMY_CACHE
|
private List |
excludedPackages
|
private static Logger |
log
|
Fields inherited from interface org.apache.ojb.broker.cache.ObjectCacheInternal |
---|
TYPE_CACHED_READ, TYPE_NEW_MATERIALIZED, TYPE_TEMP, TYPE_UNKNOWN, TYPE_WRITE |
Constructor Summary | |
---|---|
CacheDistributor(PersistenceBroker broker)
public Default Constructor |
Method Summary | |
---|---|
void |
cache(Identity oid,
Object obj)
Used to cache objects by it's Identity . |
boolean |
cacheIfNew(Identity oid,
Object obj)
For internal use within ObjectCache implementations or to build two-level caches. |
void |
clear()
Clear the cache. |
private List |
createExcludedPackagesList(String theList)
|
void |
doInternalCache(Identity oid,
Object obj,
int type)
For internal use. |
ObjectCacheInternal |
getCache(Class targetClass)
|
private boolean |
isExcluded(Class targetClass)
|
Object |
lookup(Identity oid)
Lookup object with Identity 'oid' in cache. |
private ObjectCacheInternal |
lookupCache(Object key)
|
private ObjectCacheInternal |
prepareAndAddCache(Object key,
ObjectCacheDescriptor ocd)
|
void |
remove(Identity oid)
Removes an Object from the cache. |
protected ObjectCacheDescriptor |
searchInClassDescriptor(Class targetClass)
Try to lookup ObjectCacheDescriptor in
ClassDescriptor . |
protected ObjectCacheDescriptor |
searchInJdbcConnectionDescriptor()
Lookup ObjectCacheDescriptor in
JdbcConnectionDescriptor . |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static Logger log
private static final String DESCRIPTOR_BASED_CACHES
public static final String CACHE_EXCLUDES_STRING
private static final String DELIMITER_FOR_EXCLUDE
private static final ObjectCacheInternal DUMMY_CACHE
private Map caches
private List excludedPackages
private final PersistenceBroker broker
private boolean descriptorBasedCaches
true
the class name of the object is used
to find a per class ObjectCache
implementation.
If set false
the ObjectCacheDescriptor
instance is used as key to find a per class ObjectCache.
Constructor Detail |
---|
public CacheDistributor(PersistenceBroker broker)
Method Detail |
---|
public void cache(Identity oid, Object obj)
ObjectCache
Identity
.
cache
in interface ObjectCache
oid
- Identity of the object to cache.obj
- The object to cache.public boolean cacheIfNew(Identity oid, Object obj)
ObjectCacheInternal
Used to cache new objects (not already cached) by it's
Identity
. This method was used to
cache new materialized objects and should work as a "atomic" method
(the check and the put of the object should be atomic) to avoid
concurrency problems.
Currently it's not mandatory that all ObjectCache implementations
support this method, so in some cases it's allowed to delegate this
method call to the standard cache
.
cacheIfNew
in interface ObjectCacheInternal
oid
- Identity of the object to cache.obj
- The object to cache.
ObjectCacheInternal.cacheIfNew(org.apache.ojb.broker.Identity, Object)
public Object lookup(Identity oid)
ObjectCache
lookup
in interface ObjectCache
oid
- Identity of the object to search for.
Identity
is found.public void remove(Identity oid)
ObjectCache
remove
in interface ObjectCache
oid
- Identity of the object to be removed.public void clear()
ObjectCache
clear
in interface ObjectCache
public void doInternalCache(Identity oid, Object obj, int type)
ObjectCacheInternal
doInternalCache
in interface ObjectCacheInternal
public ObjectCacheInternal getCache(Class targetClass)
private ObjectCacheInternal prepareAndAddCache(Object key, ObjectCacheDescriptor ocd)
private ObjectCacheInternal lookupCache(Object key)
private List createExcludedPackagesList(String theList)
private boolean isExcluded(Class targetClass)
protected ObjectCacheDescriptor searchInClassDescriptor(Class targetClass)
ObjectCacheDescriptor
in
ClassDescriptor
.
targetClass
-
ObjectCacheDescriptor
or null
if none was found.protected ObjectCacheDescriptor searchInJdbcConnectionDescriptor()
ObjectCacheDescriptor
in
JdbcConnectionDescriptor
.
ObjectCacheDescriptor
or null
if none was found.public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |