net.sf.spif
Class StoreManager

java.lang.Object
  |
  +--net.sf.spif.StoreManager

public class StoreManager
extends java.lang.Object

The store manager is a pluggable singleton which can be used to manage the store chain in larger applications. In systems with multiple components may be unaware of each other, and able to function in varying configurations it becomes impractical to let components set the store chain directly, but still the components should know themselves which store chains they need to function properly. The store manager may be used in such scenarios to ensure a globally sane store while still letting components influence its content.

The manager will ensure that :

The store chain manager may be subclassed to implement other store management policies, but the subclassing design is not done yet, so you'll need to change this type as well.

Version:
$Id: StoreManager.java,v 1.1 2003/02/05 22:15:45 bratseth Exp $
Author:
Jon S Bratseth

Constructor Summary
StoreManager()
          Only instantiate to set(net.sf.spif.StoreManager) a new instance for all to use.
 
Method Summary
 StoreChain addListening(StoreChain chain)
          Requests the addition of a listening store chain.
 StoreChain addStoring(StoreChain chain)
          Requests the addition of a storing chain object.
 StoreChain addVetoing(StoreChain chain)
          Requests the addition of a vetoing store chain.
static StoreManager get()
           
 java.lang.String getChainString()
          Returns a string enumerating all the elements of the current chain, in order
 StoreChain getPrevious(StoreChain chain)
          Returns the store chain element appearing before the given store chain element, or null if the given chain is not in the store chain
protected  void handleDuplicateAddition(StoreChain duplicate)
          Do type-dependent handling when a duplicate is attemted added
 void removeStore()
          Removes everything from the store chain
protected  void replace(StoreChain oldChain, StoreChain newChain)
          Replaces a chain element with another
static void set(StoreManager manager)
          Sets the instance to use
protected  boolean storeChainContains(StoreChain chain)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StoreManager

public StoreManager()
Only instantiate to set(net.sf.spif.StoreManager) a new instance for all to use. Use get() to get an instance.

Method Detail

get

public static StoreManager get()

set

public static void set(StoreManager manager)
Sets the instance to use


addVetoing

public StoreChain addVetoing(StoreChain chain)
Requests the addition of a vetoing store chain. A vetoing chain element makes some check on passing store requests and denies them (by throwing an exception) if a certain condition is true.

Returns:
the input chain

addListening

public StoreChain addListening(StoreChain chain)
Requests the addition of a listening store chain. A listening store chain makes some non-persistent changes to some state based on what passes the chain.

Returns:
the input chain

addStoring

public StoreChain addStoring(StoreChain chain)

Requests the addition of a storing chain object. A storing chain object will deliver requests for some objects from the storage it controls

If a StoreCache is added when one is allready present, the one with the largest size will be used.

Returns:
the input chain

handleDuplicateAddition

protected void handleDuplicateAddition(StoreChain duplicate)
Do type-dependent handling when a duplicate is attemted added


replace

protected void replace(StoreChain oldChain,
                       StoreChain newChain)
Replaces a chain element with another


getPrevious

public StoreChain getPrevious(StoreChain chain)
Returns the store chain element appearing before the given store chain element, or null if the given chain is not in the store chain


storeChainContains

protected boolean storeChainContains(StoreChain chain)

getChainString

public java.lang.String getChainString()
Returns a string enumerating all the elements of the current chain, in order


removeStore

public void removeStore()
Removes everything from the store chain



Spif 1.01 (2003-04-03). http://spif.sf.net