org.apache.ojb.broker.cache
Class CacheDistributor

java.lang.Object
  extended byorg.apache.ojb.broker.cache.AbstractMetaCache
      extended byorg.apache.ojb.broker.cache.CacheDistributor
All Implemented Interfaces:
ObjectCache

public class CacheDistributor
extends AbstractMetaCache

A intern used AbstractMetaCache implementation acting as distributor of ObjectCache implementations declared in configuration metadata.

Reads the name of the used ObjectCache implementation
a) from class-descriptor, or if not found
b) from jdbc-connection-descriptor, or if not found
use a given standard ObjectCache implementation (given by constructor argument).

Version:
$Id: CacheDistributor.java,v 1.4 2004/01/04 18:27:31 arminw Exp $
Author:
Matthew Baird (mattbaird@yahoo.com), Armin Waibel

Field Summary
 
Fields inherited from class org.apache.ojb.broker.cache.AbstractMetaCache
METHOD_CACHE, METHOD_LOOKUP, METHOD_REMOVE
 
Constructor Summary
CacheDistributor(PersistenceBroker broker, ObjectCache defaultCache)
          public Default Constructor
 
Method Summary
 void clear()
          clear the ObjectCache.
 ObjectCache getCache(Identity oid, java.lang.Object obj, int callingMethod)
          This method handle all calls against the ObjectCache interface.
protected  ObjectCacheDescriptor searchInClassDescriptor(Identity oid)
          Try to lookup ObjectCacheDescriptor in ClassDescriptor.
protected  ObjectCacheDescriptor searchInJdbcConnectionDescriptor()
          Lookup ObjectCacheDescriptor in JdbcConnectionDescriptor.
 java.lang.String toString()
           
 
Methods inherited from class org.apache.ojb.broker.cache.AbstractMetaCache
cache, lookup, remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CacheDistributor

public CacheDistributor(PersistenceBroker broker,
                        ObjectCache defaultCache)
public Default Constructor

Method Detail

clear

public void clear()
Description copied from interface: ObjectCache
clear the ObjectCache.


getCache

public ObjectCache getCache(Identity oid,
                            java.lang.Object obj,
                            int callingMethod)
Description copied from class: AbstractMetaCache
This method handle all calls against the ObjectCache interface. Note: The parameter obj can be null - e.g. when lookup or remove method was called.

Specified by:
getCache in class AbstractMetaCache
Parameters:
oid - Identity of the target object.
obj - The target object itself or null if not available.
callingMethod - Specifies the type of method call against the ObjectCache interface. AbstractMetaCache.METHOD_CACHE, AbstractMetaCache.METHOD_LOOKUP, AbstractMetaCache.METHOD_REMOVE.
Returns:
The ObjectCache implementation.

searchInClassDescriptor

protected ObjectCacheDescriptor searchInClassDescriptor(Identity oid)
Try to lookup ObjectCacheDescriptor in ClassDescriptor.

Parameters:
oid -
Returns:
Returns the found ObjectCacheDescriptor or null if none was found.

searchInJdbcConnectionDescriptor

protected ObjectCacheDescriptor searchInJdbcConnectionDescriptor()
Lookup ObjectCacheDescriptor in JdbcConnectionDescriptor.

Returns:
Returns the found ObjectCacheDescriptor or null if none was found.

toString

public java.lang.String toString()


Authors: Thomas Mahler and others. (C) 2000 - 2003 Apache Software Foundation
All rights reserved. Published under the Apache License.
http://db.apache.org/ojb
Version: 1.0.rc5, 2003-12-14