org.apache.ojb.broker.cache
Class ObjectCacheSoftImpl

java.lang.Object
  extended by org.apache.ojb.broker.cache.ObjectCacheSoftImpl
All Implemented Interfaces:
ObjectCache, org.apache.ojb.broker.util.configuration.Configurable

public class ObjectCacheSoftImpl
extends java.lang.Object
implements ObjectCache, org.apache.ojb.broker.util.configuration.Configurable

A global ObjectCache implementation.

Version:
$Id: ObjectCacheSoftImpl.java 365232 2005-12-21 22:36:07Z tomdz $
Author:
matthew.baird

Nested Class Summary
static class ObjectCacheSoftImpl.SoftHashMap
          Kind of map using SoftReference to store values
 
Constructor Summary
ObjectCacheSoftImpl(PersistenceBroker broker, java.util.Properties properties)
          Constructor called by ojb
 
Method Summary
 void cache(Identity oid, java.lang.Object obj)
          Used to cache objects by it's Identity.
 boolean cacheIfNew(Identity oid, java.lang.Object obj)
           
 void clear()
          Clear the cache.
 void configure(org.apache.ojb.broker.util.configuration.Configuration configuration)
          configure an object using the Configuration pConfig
 java.lang.Object lookup(Identity oid)
          Lookup object with Identity 'oid' in cache.
 void remove(Identity oid)
          Removes an Object from the cache.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectCacheSoftImpl

public ObjectCacheSoftImpl(PersistenceBroker broker,
                           java.util.Properties properties)
Constructor called by ojb

Parameters:
broker - ignored parameter
properties - ignored parameter
Method Detail

configure

public void configure(org.apache.ojb.broker.util.configuration.Configuration configuration)
               throws org.apache.ojb.broker.util.configuration.ConfigurationException
Description copied from interface: org.apache.ojb.broker.util.configuration.Configurable
configure an object using the Configuration pConfig

Specified by:
configure in interface org.apache.ojb.broker.util.configuration.Configurable
Parameters:
configuration - the Configuration object used to configure current instance
Throws:
org.apache.ojb.broker.util.configuration.ConfigurationException
See Also:
Configurable.configure(org.apache.ojb.broker.util.configuration.Configuration)

cache

public void cache(Identity oid,
                  java.lang.Object obj)
Description copied from interface: ObjectCache
Used to cache objects by it's Identity.

Specified by:
cache in interface ObjectCache
Parameters:
oid - Identity of the object to cache.
obj - The object to cache.
See Also:
ObjectCache.cache(org.apache.ojb.broker.Identity, java.lang.Object)

cacheIfNew

public boolean cacheIfNew(Identity oid,
                          java.lang.Object obj)

lookup

public java.lang.Object lookup(Identity oid)
Description copied from interface: ObjectCache
Lookup object with Identity 'oid' in cache.

Specified by:
lookup in interface ObjectCache
Parameters:
oid - Identity of the object to search for.
Returns:
The cached object or null if no matching object for specified Identity is found.
See Also:
ObjectCache.lookup(org.apache.ojb.broker.Identity)

remove

public void remove(Identity oid)
Description copied from interface: ObjectCache
Removes an Object from the cache.

Specified by:
remove in interface ObjectCache
Parameters:
oid - Identity of the object to be removed.
See Also:
ObjectCache.remove(org.apache.ojb.broker.Identity)

clear

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

Specified by:
clear in interface ObjectCache
See Also:
ObjectCache.clear()


(C) 2002 - 2006 Apache Software Foundation
All rights reserved. Published under the Apache License 2.0.
http://db.apache.org/ojb
Version: 1.0.4, 2005-12-30