net.sourceforge.groboutils.util.classes.v1
Class AbstractMultipleStore

java.lang.Object
  extended bynet.sourceforge.groboutils.util.classes.v1.AbstractMultipleStore
Direct Known Subclasses:
SPISingletonStore

public abstract class AbstractMultipleStore
extends java.lang.Object

Similar in concept to the AbstractSingleStore, except this houses multiple instances of 'singletons'.

Since:
June 28, 2002
Version:
$Date: 2003/02/10 22:52:36 $
Author:
Matt Albrecht groboclown@users.sourceforge.net

Nested Class Summary
static class AbstractMultipleStore.AllowMultiplesAction
           
 
Field Summary
static AbstractMultipleStore.AllowMultiplesAction MULTIPLES_OK
           
static AbstractMultipleStore.AllowMultiplesAction NO_MULTIPLES_ERROR
           
static AbstractMultipleStore.AllowMultiplesAction NO_MULTIPLES_SILENT
           
 
Constructor Summary
AbstractMultipleStore(java.lang.Class instanceOf, AbstractMultipleStore.AllowMultiplesAction ama)
          Constructor specifying all the parameters for using a singleton in this framework.
 
Method Summary
protected abstract  void addDefaultSingletons()
          Adds the default inner singletons, which is an implementation specific method.
 void addSingleton(java.lang.Object singleton)
          Sets the singleton.
 java.util.Enumeration getSingletons()
          Returns the current inner singletons.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_MULTIPLES_ERROR

public static final AbstractMultipleStore.AllowMultiplesAction NO_MULTIPLES_ERROR

NO_MULTIPLES_SILENT

public static final AbstractMultipleStore.AllowMultiplesAction NO_MULTIPLES_SILENT

MULTIPLES_OK

public static final AbstractMultipleStore.AllowMultiplesAction MULTIPLES_OK
Constructor Detail

AbstractMultipleStore

public AbstractMultipleStore(java.lang.Class instanceOf,
                             AbstractMultipleStore.AllowMultiplesAction ama)
Constructor specifying all the parameters for using a singleton in this framework.

Parameters:
instanceOf - singletons must be of this class.
ama - true if this store should allow multiple instances of the exact same class, or false if it should prevent multiple instances sharing the exact same class. This helps to enforce the idea of 'singleton'.
Method Detail

getSingletons

public java.util.Enumeration getSingletons()
Returns the current inner singletons. If it has never been set, then the default will be used instead.

Returns:
the inner singleton instances.
Throws:
IllegalStateException - if no singleton was created.

addSingleton

public void addSingleton(java.lang.Object singleton)
Sets the singleton. It must be of the correct class, and non-null.

Parameters:
singleton - the singleton to set.
Throws:
IllegalArgumentException - if singleton is null, or is not of the correct type.

addDefaultSingletons

protected abstract void addDefaultSingletons()
Adds the default inner singletons, which is an implementation specific method.



Copyright © 2001-2003 by The GroboUtils Project