org.apache.openjpa.writebehind
Class SimpleWriteBehindCache

java.lang.Object
  extended by org.apache.openjpa.writebehind.AbstractWriteBehindCache
      extended by org.apache.openjpa.writebehind.SimpleWriteBehindCache
All Implemented Interfaces:
WriteBehindCache

public class SimpleWriteBehindCache
extends AbstractWriteBehindCache


Constructor Summary
SimpleWriteBehindCache()
           
 
Method Summary
 List<Exception> add(Collection<OpenJPAStateManager> sms)
          Add the provided StateManagerImpls to the cache.
protected  void add(OpenJPAStateManager sm)
           
 void clear()
          Remove all entities from the cache.
 boolean contains(Object o)
          Answer whether the provided object is included in the WriteBehindCache
 WriteBehindCacheKey getKey(OpenJPAStateManager sm)
          Obtain a cache key for the provided StateManagerImpl.
 int getSize()
          Obtain the number of entities in the cache.
protected  StateManagerImpl getStateManager(Object o)
           
 Collection<OpenJPAStateManager> getStateManagers()
          Obtain the StateManagers currently in the cache.
 void initialize(WriteBehindCacheManager manager)
          Initialize any resources associated with the given WriteBehindCacheManager.
 boolean isEmpty()
          Determine whether the cache is empty.
protected  OpenJPAStateManager merge(OpenJPAStateManager from, OpenJPAStateManager into)
           
 
Methods inherited from class org.apache.openjpa.writebehind.AbstractWriteBehindCache
getName, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleWriteBehindCache

public SimpleWriteBehindCache()
Method Detail

add

public List<Exception> add(Collection<OpenJPAStateManager> sms)
Description copied from interface: WriteBehindCache
Add the provided StateManagerImpls to the cache. Mimics the StoreManager.flush() method. If the StateManagers cannot be added to the cache or if any exceptions occur they will be returned to the caller in a collection.

Parameters:
sms - StateManagerImpls to add.
Returns:
A collection of exceptions if any occurred when adding the StateManager to the cache. If no exceptions occur the collection will be empty.

add

protected void add(OpenJPAStateManager sm)

contains

public boolean contains(Object o)
Description copied from interface: WriteBehindCache
Answer whether the provided object is included in the WriteBehindCache

Parameters:
o - Object which may be in the cache
Returns:
True if the object is in the cache, otherwise false.

getKey

public WriteBehindCacheKey getKey(OpenJPAStateManager sm)
Description copied from interface: WriteBehindCache
Obtain a cache key for the provided StateManagerImpl.

Parameters:
sm - A StateManager
Returns:
A key that may be used to cache the StateManager.

getSize

public int getSize()
Description copied from interface: WriteBehindCache
Obtain the number of entities in the cache.

Returns:
number of entities in the cache.

getStateManagers

public Collection<OpenJPAStateManager> getStateManagers()
Description copied from interface: WriteBehindCache
Obtain the StateManagers currently in the cache.

Returns:
collection of state managers.

initialize

public void initialize(WriteBehindCacheManager manager)
Description copied from interface: WriteBehindCache
Initialize any resources associated with the given WriteBehindCacheManager.


getStateManager

protected StateManagerImpl getStateManager(Object o)

clear

public void clear()
Description copied from interface: WriteBehindCache
Remove all entities from the cache.


isEmpty

public boolean isEmpty()
Description copied from interface: WriteBehindCache
Determine whether the cache is empty.

Returns:
true if there are no entities in the cache, otherwise false.

merge

protected OpenJPAStateManager merge(OpenJPAStateManager from,
                                    OpenJPAStateManager into)


Copyright © 2006-2009 Apache Software Foundation. All Rights Reserved.