org.apache.openjpa.writebehind
Interface WriteBehindCache

All Known Implementing Classes:
AbstractWriteBehindCache, SimpleWriteBehindCache

public interface WriteBehindCache

The WriteBehindCache stores updates to entities before flushing to the database. A WriteBehindCallback instance will be used to write the changes to the database.


Method Summary
 List<Exception> add(Collection<OpenJPAStateManager> sms)
          Add the provided StateManagerImpls to the cache.
 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.
 String getName()
          Returns a string name that can be used by end-user-visible code to identify this cache.
 int getSize()
          Obtain the number of entities in the cache.
 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.
 void setName(String name)
          Sets a string name to be used to identify this cache to end-user needs.
 

Method Detail

getSize

int getSize()
Obtain the number of entities in the cache.

Returns:
number of entities in the cache.

contains

boolean contains(Object o)
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.

getName

String getName()
Returns a string name that can be used by end-user-visible code to identify this cache.


setName

void setName(String name)
Sets a string name to be used to identify this cache to end-user needs.


add

List<Exception> add(Collection<OpenJPAStateManager> sms)
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.

getStateManagers

Collection<OpenJPAStateManager> getStateManagers()
Obtain the StateManagers currently in the cache.

Returns:
collection of state managers.

initialize

void initialize(WriteBehindCacheManager manager)
Initialize any resources associated with the given WriteBehindCacheManager.


getKey

WriteBehindCacheKey getKey(OpenJPAStateManager sm)
Obtain a cache key for the provided StateManagerImpl.

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

isEmpty

boolean isEmpty()
Determine whether the cache is empty.

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

clear

void clear()
Remove all entities from the cache.



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