edu.iris.Fissures.seed.director
Class ImportDirector

java.lang.Object
  extended by edu.iris.Fissures.seed.director.ImportDirector
Direct Known Subclasses:
SeedImportDirector

public abstract class ImportDirector
extends java.lang.Object

Abstract class representing all Director classes for importing data.

Version:
8/26/2003
Author:
Robert Casey

Field Summary
protected  ObjectBuilder builder
           
protected  int fixedRecordLength
           
protected  java.io.DataInputStream inStream
           
 int maxRecordLength
           
protected  java.lang.String outputString
           
protected  ReadBuffer readBuffer
           
protected  int recCount
           
protected  int recLen
           
protected  byte[] record
           
protected  int recordOffset
           
protected  boolean streamOpen
           
 
Constructor Summary
ImportDirector()
          Instantiate without assigning a Builder to it.
ImportDirector(ObjectBuilder builder)
          Assign a Builder to the Director without yet importing a data stream.
 
Method Summary
 void assignBuilder(ObjectBuilder builder)
          Assign a builder object to this director
abstract  int build()
          Build a data object.
 void close()
          Close the input stream.
 int construct(java.io.InputStream inStream)
          Constructs objects from the input stream of a single volume.
 int construct(java.io.InputStream inStream, java.io.OutputStream outStream, boolean storeFlag)
          Constructs objects from the input stream of a single volume.
 ObjectBuilder getBuilder()
          Get the builder object registered to this director
abstract  int getRecLen()
          Determine and return the length in bytes of the data record currently in the readBuffer.
 void open(java.io.InputStream inStream)
          Open the input stream for reading.
 boolean read()
          Read a single record from the input stream and builds objects.
 boolean read(boolean storeFlag)
          Read a single record from the input stream and builds objects.
 void setRecLen(int length)
          Set import logical record length.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

streamOpen

protected boolean streamOpen

inStream

protected java.io.DataInputStream inStream

readBuffer

protected ReadBuffer readBuffer

record

protected byte[] record

recCount

protected int recCount

recLen

protected int recLen

recordOffset

protected int recordOffset

builder

protected ObjectBuilder builder

outputString

protected java.lang.String outputString

fixedRecordLength

protected int fixedRecordLength

maxRecordLength

public int maxRecordLength
Constructor Detail

ImportDirector

public ImportDirector()
Instantiate without assigning a Builder to it.


ImportDirector

public ImportDirector(ObjectBuilder builder)
Assign a Builder to the Director without yet importing a data stream.

Method Detail

getRecLen

public abstract int getRecLen()
                       throws java.lang.Exception
Determine and return the length in bytes of the data record currently in the readBuffer.

Throws:
java.lang.Exception

assignBuilder

public void assignBuilder(ObjectBuilder builder)
Assign a builder object to this director


getBuilder

public ObjectBuilder getBuilder()
Get the builder object registered to this director


setRecLen

public void setRecLen(int length)
Set import logical record length. The user can force the record length to be fixed in cases where automatic record length detection is not correctly finding the record length.


construct

public int construct(java.io.InputStream inStream,
                     java.io.OutputStream outStream,
                     boolean storeFlag)
              throws java.lang.Exception
Constructs objects from the input stream of a single volume. Optional output stream can capture a string representation of the objects constructed. Boolean flag indicates whether to store the generated objects in an object container or not. Returns the number of records read from the input stream.

Throws:
java.lang.Exception

construct

public int construct(java.io.InputStream inStream)
              throws java.lang.Exception
Constructs objects from the input stream of a single volume. Default version of construct that does not pipe string output and turns on storage of built objects in an object container.

Throws:
java.lang.Exception

open

public void open(java.io.InputStream inStream)
          throws java.lang.Exception
Open the input stream for reading.

Throws:
java.lang.Exception

close

public void close()
Close the input stream.


read

public boolean read(boolean storeFlag)
             throws java.lang.Exception
Read a single record from the input stream and builds objects. Returns true if data was read in. storeFlag whether to tell the ObjectBuilder to store() built objects or not. Set to TRUE to store objects.

Throws:
java.lang.Exception

read

public boolean read()
             throws java.lang.Exception
Read a single record from the input stream and builds objects. Returns true if data was read in. Storage of objects will occur.

Throws:
java.lang.Exception

build

public abstract int build()
                   throws java.lang.Exception
Build a data object. This method will order the registered builder to construct a data object from the data in the record array starting at the byte offset indicated by the instance variable recordOffset. Builder holds the object until next iteration. Returns an integer reflecting the number of bytes consumed in the build.

Throws:
java.lang.Exception