ABLE, Version 1.1b

com.ibm.able.beans
Class AbleImport

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--com.ibm.able.AbleObject
                          |
                          +--com.ibm.able.beans.AbleImport

public class AbleImport
extends AbleObject
implements AbleDataSource, java.io.Serializable

This class provides an interface to external text-file data for Able Beans.

Version:
1.0.0; change log:
 Version   Description
 --------  -----------
 1.0.0     Initial release.

 
See Also:
Serialized Form

Field Summary
static int BINARY_FILE
           
protected  int bufferSize
           
protected  int curRecIndex
           
protected  double[] curRecord
           
protected  java.lang.String dataFileName
           
protected  AbleDataSet dataSet
           
protected  java.lang.String delimiters
           
protected  boolean eofFlag
           
protected  java.io.File file
           
protected  java.lang.String fileType
           
protected  long numEpochs
           
protected  int numFieldsPerRecord
           
protected  long numRecords
           
 double[] outNum
           
 java.lang.String[] outSym
           
protected  boolean randomizeData
           
static int TEXT_FILE
           
 
Fields inherited from class com.ibm.able.AbleObject
changed, chgSupport, comment, dataFlowEnabled, destBufferConnections, eventQueue, fileName, inputBuffer, listeners, logger, name, outputBuffer, parent, propertyConnectionMgr, sourceBufferConnections, state, stateChgSupport
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
AbleImport()
          construct an AbleImport object
AbleImport(java.lang.String aName)
          construct an AbleImport object with specified name
 
Method Summary
 void close()
          close the source file Note: this is a noop now, the entire file is read at open() time
 void endOfFile()
          tell any listeners that we are at the end of the file
 void generateTranslateTemplate()
          generate a Translate template based on the .dfn and .dat file contents
 int getBufferSize()
          get the current DataSet buffer size
 java.lang.String getDataFileName()
          return the data file name
 AbleDataSet getDataSet()
          return the data set object
 java.lang.String getDelimiters()
          get the current delimiters (default is space)
 java.lang.String getFileType()
          return the file type of the source file (text, binary, etc.)
 long getNumEpochs()
          Retrieve the number of passes over the data
 int getNumFieldsPerRec()
          get the number of fields per record in the data file
 long getNumRecords()
          get the number of records in the data file
 void handleAbleEvent(AbleEvent e)
          process an AbleEvent sent by another Able bean
 void init()
          Initialize the Import bean set up the timer (off) and async event processing (disabled) open the file if a file name was specified
 boolean isEofFlag()
          check whether we are at end of file
 boolean isRandomizeData()
           
 boolean isReady()
          indicate whether import dataset is ready to provide data that means the definition file was ready and data file is open
 void open()
          open the file specfied by dataFileName create a DataSet object and load the data into memory
 void process()
          process the next record in the source file wrap at end of file and signal eof event
protected  void readObject(java.io.ObjectInputStream ois)
          Read a serialized object from a file
 void reset()
          re-initialize (reopen) the file
 void setBufferSize(int size)
          Set the buffer size, determines whether load the entire file (=0) or just pieces of it (>0) into memory
 void setDataFileName(java.lang.String aFileName)
          set the data file name
 void setDataFlowEnabled(boolean newState)
          set the data flow processing processing state of the object
 void setDataSet(AbleDataSet newDataSet)
          set and open the new data set object
 void setDelimiters(java.lang.String delims)
          set the current delimiters (default is space)
 void setFileType(java.lang.String type)
          set the file type of the source file
 void setNumFieldsPerRec(int num)
          set the number of fields per records in the data file
 void setNumRecords(long num)
          set the number of records in the source file
 void setRandomizeData(boolean state)
           
 java.lang.String toString()
          return a formatted string describing the state of this DataSet
 
Methods inherited from class com.ibm.able.AbleObject
addAbleEventListener, addDestBufferConnection, addPropertyChangeListener, addPropertyConnection, addSourceBufferConnection, addStateChangeListener, Copyright, dataChanged, firePropertyChange, flushAbleEventQueue, getAbleEventListeners, getAbleEventProcessingEnabled, getAbleEventQueueSize, getBuffer, getBufferContents, getComment, getDestBufferConnections, getFileName, getInputBuffer, getInputBuffer, getInputBufferAsStringArray, getInputBufferContents, getLogger, getName, getOutputBuffer, getOutputBuffer, getOutputBufferAsStringArray, getOutputBufferContents, getParent, getPropertyConnectionManager, getSleepTime, getSourceBufferConnections, getState, hasInputBuffer, hasOutputBuffer, init, isAbleEventPostingEnabled, isAbleEventProcessingEnabled, isChanged, isConnectable, isDataFlowEnabled, isTimerEventProcessingEnabled, notifyAbleEventListeners, processAbleEvent, processBufferConnections, processNoEventProcessingEnabledSituation, processTimerEvent, propertyChange, quitAll, quitEnabledEventProcessing, removeAbleEventListener, removeAllAbleEventListeners, removeAllBufferConnections, removeAllPropertyConnections, removeDestBufferConnection, removePropertyChangeListener, removePropertyConnection, removeSourceBufferConnection, removeStateChangeListener, restartEnabledEventProcessing, restoreFromFile, restoreFromFile, restoreFromSerializedFile, restoreFromStream, resumeAll, resumeEnabledEventProcessing, saveToFile, saveToFile, setAbleEventProcessingEnabled, setChanged, setComment, setFileName, setInputBuffer, setInputBuffer, setLogger, setName, setOutputBuffer, setOutputBuffer, setParent, setSleepTime, setState, setTimerEventProcessingEnabled, sourceConnectionsOK, startEnabledEventProcessing, suspendAll, suspendEnabledEventProcessing
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TEXT_FILE

public static final int TEXT_FILE

BINARY_FILE

public static final int BINARY_FILE

dataFileName

protected java.lang.String dataFileName

numFieldsPerRecord

protected int numFieldsPerRecord

bufferSize

protected int bufferSize

delimiters

protected java.lang.String delimiters

file

protected java.io.File file

fileType

protected java.lang.String fileType

numRecords

protected long numRecords

numEpochs

protected long numEpochs

outNum

public transient double[] outNum

outSym

public transient java.lang.String[] outSym

eofFlag

protected transient boolean eofFlag

dataSet

protected AbleDataSet dataSet

curRecord

protected double[] curRecord

curRecIndex

protected int curRecIndex

randomizeData

protected boolean randomizeData
Constructor Detail

AbleImport

public AbleImport()
           throws java.rmi.RemoteException
construct an AbleImport object

AbleImport

public AbleImport(java.lang.String aName)
           throws java.rmi.RemoteException
construct an AbleImport object with specified name
Method Detail

init

public void init()
          throws java.rmi.RemoteException
Initialize the Import bean set up the timer (off) and async event processing (disabled) open the file if a file name was specified
Overrides:
init in class AbleObject

process

public void process()
             throws java.rmi.RemoteException
process the next record in the source file wrap at end of file and signal eof event
Overrides:
process in class AbleObject

reset

public void reset()
           throws java.rmi.RemoteException
re-initialize (reopen) the file
Overrides:
reset in class AbleObject

open

public void open()
          throws java.rmi.RemoteException,
                 java.io.IOException,
                 java.lang.NumberFormatException
open the file specfied by dataFileName create a DataSet object and load the data into memory

close

public void close()
close the source file Note: this is a noop now, the entire file is read at open() time

setFileType

public void setFileType(java.lang.String type)
set the file type of the source file

getFileType

public java.lang.String getFileType()
return the file type of the source file (text, binary, etc.)

setDataFlowEnabled

public void setDataFlowEnabled(boolean newState)
                        throws java.rmi.RemoteException
set the data flow processing processing state of the object
Overrides:
setDataFlowEnabled in class AbleObject

setDelimiters

public void setDelimiters(java.lang.String delims)
set the current delimiters (default is space)

getDelimiters

public java.lang.String getDelimiters()
get the current delimiters (default is space)

setNumFieldsPerRec

public void setNumFieldsPerRec(int num)
set the number of fields per records in the data file
Specified by:
setNumFieldsPerRec in interface AbleDataSource

getNumFieldsPerRec

public int getNumFieldsPerRec()
get the number of fields per record in the data file
Specified by:
getNumFieldsPerRec in interface AbleDataSource

getNumRecords

public long getNumRecords()
get the number of records in the data file
Specified by:
getNumRecords in interface AbleDataSource

setNumRecords

public void setNumRecords(long num)
set the number of records in the source file
Specified by:
setNumRecords in interface AbleDataSource

setDataFileName

public void setDataFileName(java.lang.String aFileName)
set the data file name

getDataFileName

public java.lang.String getDataFileName()
return the data file name

setBufferSize

public void setBufferSize(int size)
Set the buffer size, determines whether load the entire file (=0) or just pieces of it (>0) into memory

getBufferSize

public int getBufferSize()
get the current DataSet buffer size

handleAbleEvent

public void handleAbleEvent(AbleEvent e)
process an AbleEvent sent by another Able bean
Overrides:
handleAbleEvent in class AbleObject

getNumEpochs

public long getNumEpochs()
Retrieve the number of passes over the data
Specified by:
getNumEpochs in interface AbleDataSource

isEofFlag

public boolean isEofFlag()
check whether we are at end of file

isReady

public boolean isReady()
indicate whether import dataset is ready to provide data that means the definition file was ready and data file is open

endOfFile

public void endOfFile()
tell any listeners that we are at the end of the file

generateTranslateTemplate

public void generateTranslateTemplate()
                               throws java.io.IOException
generate a Translate template based on the .dfn and .dat file contents

readObject

protected void readObject(java.io.ObjectInputStream ois)
                   throws java.lang.ClassNotFoundException,
                          java.io.IOException
Read a serialized object from a file
Parameters:
ios - The object input stream on the file
Throws:
java.io.IOException - an IO exception
java.lang.ClassNotFoundException - if class file not found

toString

public java.lang.String toString()
return a formatted string describing the state of this DataSet
Overrides:
toString in class AbleObject

setDataSet

public void setDataSet(AbleDataSet newDataSet)
                throws java.rmi.RemoteException,
                       java.io.IOException,
                       java.lang.NumberFormatException
set and open the new data set object

getDataSet

public AbleDataSet getDataSet()
return the data set object

setRandomizeData

public void setRandomizeData(boolean state)

isRandomizeData

public boolean isRandomizeData()

ABLE, Version 1.1b

ABLE: Produced by Joe, Don, and Jeff who say, 'Thanks for your support.'