edu.iris.Fissures.seed.director
Class SeedExportDirector

java.lang.Object
  extended by edu.iris.Fissures.seed.director.ExportDirector
      extended by edu.iris.Fissures.seed.director.SeedExportDirector

public class SeedExportDirector
extends ExportDirector

Concrete class specifically to handle to direct export of SEED data from a SeedObjectContainer and ExportTemplate. Can connect to any concrete ExportBuilder.

Take special note of the object Type referencing used for the ExportTemplate in the methods getContext() and filterBlockette(). This is necessary for the heirarchichal arrangement of station/channel/response blockettes and data blockettes. This is a SEED-specific case that makes special use of the ExportTemplate tabulation process.

Version:
01/14/08
Author:
Robert Casey

Field Summary
 
Fields inherited from class edu.iris.Fissures.seed.director.ExportDirector
builder, container, expTemplate
 
Constructor Summary
SeedExportDirector()
           
 
Method Summary
 void fillTemplate(BuilderFilter templateFilter)
          Using the provided BuilderFilter, pick out matching blockette objects to populate the ExportTemplate.
 long generateContext(int childObjType, int parentId)
          Generate context ID value from object type and parent ID.
protected  long getContext(int objType)
          Get a context ID value.
protected  java.lang.Object getObject(int refNum)
          Return a 'flat' copy of the Blockette object associated with the refNum ID.
protected  void startVolume()
          Signal the director that we are starting a new volume.
 
Methods inherited from class edu.iris.Fissures.seed.director.ExportDirector
assignBuilder, assignContainer, assignTemplate, construct
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SeedExportDirector

public SeedExportDirector()
Method Detail

fillTemplate

public void fillTemplate(BuilderFilter templateFilter)
                  throws java.lang.Exception
Using the provided BuilderFilter, pick out matching blockette objects to populate the ExportTemplate. This process must be implemented by the concrete ExportDirector so as to query for only relevant object types. if templateFilter is null, then accept all blockettes of the listed types.

Specified by:
fillTemplate in class ExportDirector
Throws:
java.lang.Exception

startVolume

protected void startVolume()
Signal the director that we are starting a new volume. Perform necessary initializations.

Specified by:
startVolume in class ExportDirector

getObject

protected java.lang.Object getObject(int refNum)
                              throws java.lang.Exception
Return a 'flat' copy of the Blockette object associated with the refNum ID. If disk persistent caching (serialization) is not being used, Objects pulled from the Object Container are copied, dictionary indices are resequenced and the resultant Blockette is saved to a temporary cache before it is returned. In the case of disk persistent caching, copying of the blockette is not necessary. The blockette objects returned are considered 'flat' because they may no longer retain their original child blockette tree links or dictionary mapping references, depending on the caching mode of the attached container. These 'flat' blockettes are appropriate for passing to the assigned export builder since only the field values will need to be accessed by the Export Builder.

Specified by:
getObject in class ExportDirector
Throws:
java.lang.Exception

getContext

protected long getContext(int objType)
                   throws BuilderException
Get a context ID value. Track parent-child context and possibly modify the object type number to include parent reference. Helps with templates that index heirarchy relationships. Other blockettes that do not meet the criteria for context modification (like parent blockettes) will simply have the identical value returned as objType.

Specified by:
getContext in class ExportDirector
Throws:
BuilderException

generateContext

public long generateContext(int childObjType,
                            int parentId)
                     throws BuilderException
Generate context ID value from object type and parent ID. The Export Template stores each Blockette ID in a series vector with a long value as a key. This long value can either be the blockette type, or in the case of a child blockette, a much larger 'context' reference value which consists of a blockette type number appended to the parent's Blockette ID. This context reference will be a unique number that associates a parent ID with a sequence of child Blockettes of a certain type (like a series of type 53's).

The reason for using a long value is that the number space required to represent the full parent lookup ID plus the blockette type is too large to be accomodated by an integer. The pattern is:

B B B B V V V T N N N N N N

which is 4 digits for the blockette number followed by the full parent lookup ID. The long value has a lot of room to expand for other kinds of mappings (max value = 9 223 372 036 854 775 807).

Throws:
BuilderException