org.apache.ojb.broker.cache
Class AbstractMetaCache
java.lang.Object
org.apache.ojb.broker.cache.AbstractMetaCache
- All Implemented Interfaces:
- ObjectCache
- Direct Known Subclasses:
- CacheDistributor, CacheFilterRegistry, ObjectCacheJCSPerClassImpl, ObjectCachePerClassImpl
- public abstract class AbstractMetaCache
- extends java.lang.Object
- implements ObjectCache
An abstract 'meta' implementation of the ObjectCache
interace.
Implement the abstract getCache(org.apache.ojb.broker.Identity, java.lang.Object, int)
method in sub-classes.
All base Object/Identity validation is done by this class.
- Version:
- $Id: AbstractMetaCache.java,v 1.3 2003/09/17 23:00:15 arminw Exp $
- Author:
- Armin Waibel
Method Summary |
void |
cache(Identity oid,
java.lang.Object obj)
Caches the given object using the given Identity as key |
abstract ObjectCache |
getCache(Identity oid,
java.lang.Object obj,
int callingMethod)
This method handle all calls against the ObjectCache interface. |
java.lang.Object |
lookup(Identity oid)
Looks up the object from the cache |
void |
remove(Identity oid)
Removes the given object from the cache |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
METHOD_CACHE
public static final int METHOD_CACHE
- See Also:
- Constant Field Values
METHOD_LOOKUP
public static final int METHOD_LOOKUP
- See Also:
- Constant Field Values
METHOD_REMOVE
public static final int METHOD_REMOVE
- See Also:
- Constant Field Values
AbstractMetaCache
public AbstractMetaCache()
getCache
public abstract ObjectCache getCache(Identity oid,
java.lang.Object obj,
int callingMethod)
- 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.
- 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. METHOD_CACHE
, METHOD_LOOKUP
, METHOD_REMOVE
.
- Returns:
- The
ObjectCache
implementation.
cache
public void cache(Identity oid,
java.lang.Object obj)
- Caches the given object using the given Identity as key
- Specified by:
cache
in interface ObjectCache
- Parameters:
oid
- The Identity keyobj
- The object o cache
lookup
public java.lang.Object lookup(Identity oid)
- Looks up the object from the cache
- Specified by:
lookup
in interface ObjectCache
- Parameters:
oid
- The Identity to look up the object for
- Returns:
- The object if found, otherwise null
remove
public void remove(Identity oid)
- Removes the given object from the cache
- Specified by:
remove
in interface ObjectCache
- Parameters:
oid
- oid of the object to remove
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