edu.iris.Fissures.seed.container
Class BlocketteDecoratorFactory

java.lang.Object
  extended by edu.iris.Fissures.seed.container.BlocketteDecoratorFactory

public class BlocketteDecoratorFactory
extends java.lang.Object

BlocketteDecoratorFactory - singleton factory used for generating new BlocketteDecorators of various flavors. Also used to track session-specific links, such as pointers to Containers and other necessities that need to be detached from direct reference by the Decorator instance itself.


Method Summary
static CachedBlocketteDecorator createCachedDecorator(Blockette blk, boolean persistenceCached)
          Construct and return a new CachedBlocketteDecorator seeding it with the offered Blockette and indicating true if disk persistence caching is being used.
static ObjectContainer getContainerByVol(int volNum)
          return a handle to the ObjectContainer that relates to this Volume Number
static BlocketteDecoratorFactory getInstance()
          return a singleton instance of this factory class
static int getNewVolumeNumber()
          Strange but true.
static void setContainerByVol(ObjectContainer oc, int volNum)
          Associate an ObjectContainer instance with the indicated volume number.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static BlocketteDecoratorFactory getInstance()
return a singleton instance of this factory class


createCachedDecorator

public static CachedBlocketteDecorator createCachedDecorator(Blockette blk,
                                                             boolean persistenceCached)
                                                      throws ContainerException,
                                                             SeedException
Construct and return a new CachedBlocketteDecorator seeding it with the offered Blockette and indicating true if disk persistence caching is being used.

Parameters:
blk -
persistenceCached -
Returns:
a new CachedBlocketteDecorator
Throws:
ContainerException
SeedException

getContainerByVol

public static ObjectContainer getContainerByVol(int volNum)
return a handle to the ObjectContainer that relates to this Volume Number


setContainerByVol

public static void setContainerByVol(ObjectContainer oc,
                                     int volNum)
Associate an ObjectContainer instance with the indicated volume number. Typically called by the ObjectContainer in question to notify of its current chosen volume number. To keep the volume numbers from multiple containers colliding with each other, call getNewVolumeNumber() in this class to be handed a new volume number to use.

Parameters:
oc - the ObjectContainer instance
volNum - the volume number that relates to it

getNewVolumeNumber

public static int getNewVolumeNumber()
Strange but true. Design smell? Because of the container association by volume number required by this singleton factory, this class becomes an authority for assigning a new volume number when a new container or volume in a container appears. Note that setContainerByVol() must be called to actually carry out assigning a container to this volume number. Otherwise, the same volume number will be handed to the next caller.

Returns:
an incremented volume number to assign to a lookupID