Overview | Package | Class | Use | Tree | Serialized | Deprecated | Index | Help
| ABLE 2.3.0 07/13/2005 14:21:00
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.ibm.able.beans
Class AbleExport

    java.lang.Object
      com.ibm.able.AbleObject
          com.ibm.able.beans.AbleExport

All Implemented Interfaces:
  AbleBean, AbleDataBufferManager, AbleDataSink, AbleEventListener, AbleEventListenerManager, AbleEventQueueManager, AbleEventQueueProcessor, AblePropertyChangeManager, AbleSerializable, java.io.Serializable

public class AbleExport
extends AbleObject
implements AbleDataSink, java.io.Serializable

This class writes data out to external text files.

See Also:
  Serialized Form

Field Summary
`protected java.lang.String` | `dataFileName` The dataFileName is the file name and extension.
`static java.lang.String` | `defaultName`
`protected int` | `numFieldsPerRecord` The number of fields in a record in the output data.
`protected java.io.BufferedWriter` | `out`

Fields inherited from class com.ibm.able.AbleObject
`changed, chgSupport, comment, dataFlowEnabled, destBufferConnections, eventQueue, fileName, inputBuffer, listeners, logger, name, outputBuffer, parent, properties, propertyConnectionMgr, sourceBufferConnections, state, stateChgSupport, trace`

Constructor Summary
`AbleExport()` Construct a default AbleExport object
`AbleExport(java.lang.String name)` Construct an AbleExport object with specified name.
`AbleExport(java.lang.String name, java.lang.String dataFileName)` Construct an AbleExport object with specified name and file.

Method Summary
`void` | `close()` Close the output file, disable data flow, and set its state to Unititiated.
`void` | `erase()` Erase the current file and close the current writer.
`void` | `flush()` Flush the output buffer.
`java.lang.String` | `getDataFileName()` Get the current output file name.
`java.lang.String` | `getDelimiter()` Return the current delimiter String.
`int` | `getNumberOfInputFields()` Returns the number of inputs provided to this output device.
`void` | `init()` Open the output datafile.
`boolean` | `isReady()` Indicate whether the export is ready to write data.
`void` | `process()` Write out the contents of inputBuffer to file using specified delimiter.
`java.lang.Object` | `process(java.lang.Object theArg)` Write out the contents of the parameter to the data file.
`void` | `processAbleEvent(AbleEvent theEvent)` Extract the argument object from an AbleEvent and output it to the data file.
`void` | `quitAll()` Close any open file.
`void` | `reset()` re-initialize the bean close and reopen the output file
`void` | `setDataFileName(java.lang.String newName)` Set the current output file name.
`void` | `setDelimiter(java.lang.String newDelims)` Set the current delimiter.
`void` | `setNumberOfInputs(int inputs)` Sets the number of inputs to be provided to this output device.

Methods inherited from class com.ibm.able.AbleObject
`addAbleEventListener, addDestBufferConnection, addPropertyChangeListener, addPropertyConnection, addSourceBufferConnection, addStateChangeListener, dataChanged, firePropertyChange, flushAbleEventQueue, getAbleEventListeners, getAbleEventProcessingEnabled, getAbleEventQueueSize, getComment, getDestBufferConnections, getFileName, getInputBuffer, getInputBuffer, getInputBufferAsString, getInputBufferAsStringArray, getInputBufferContents, getLogger, getName, getOutputBuffer, getOutputBuffer, getOutputBufferAsString, getOutputBufferAsStringArray, getOutputBufferContents, getParent, getProperties, getProperty, getPropertyChangeListeners, getPropertyConnectionManager, getSleepTime, getSourceBufferConnections, getState, getTraceLogger, handleAbleEvent, hasInputBuffer, hasOutputBuffer, init, isAbleEventPostingEnabled, isAbleEventProcessingEnabled, isChanged, isConnectable, isDataFlowEnabled, isTimerEventProcessingEnabled, notifyAbleEventListeners, processBufferConnections, processNoEventProcessingEnabledSituation, processTimerEvent, quitEnabledEventProcessing, removeAbleEventListener, removeAllAbleEventListeners, removeAllBufferConnections, removeAllConnections, removeAllPropertyConnections, removeDestBufferConnection, removeProperty, removePropertyChangeListener, removePropertyConnection, removeSourceBufferConnection, removeStateChangeListener, restartEnabledEventProcessing, restoreFromFile, restoreFromFile, restoreFromSerializedFile, restoreFromStream, resumeAll, resumeEnabledEventProcessing, saveToFile, saveToFile, setAbleEventProcessingEnabled, setChanged, setComment, setDataFlowEnabled, setFileName, setInputBuffer, setInputBuffer, setLogger, setName, setOutputBuffer, setOutputBuffer, setParent, setProperties, setProperty, setSleepTime, setState, setTimerEventProcessingEnabled, setTraceLogger, sourceConnectionsOK, startEnabledEventProcessing, suspendAll, suspendEnabledEventProcessing`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface com.ibm.able.AbleBean
`getComment, getLogger, getName, getParent, getProperties, getProperty, getState, getTraceLogger, init, isChanged, removeAllConnections, removeProperty, resumeAll, setChanged, setComment, setLogger, setName, setParent, setProperties, setProperty, setState, setTraceLogger, suspendAll`

Methods inherited from interface com.ibm.able.AbleDataBufferManager
`addDestBufferConnection, addSourceBufferConnection, getDestBufferConnections, getInputBuffer, getInputBuffer, getInputBufferAsString, getInputBufferAsStringArray, getInputBufferContents, getOutputBuffer, getOutputBuffer, getOutputBufferAsString, getOutputBufferAsStringArray, getOutputBufferContents, getSourceBufferConnections, hasInputBuffer, hasOutputBuffer, isConnectable, isDataFlowEnabled, processBufferConnections, removeAllBufferConnections, removeDestBufferConnection, removeSourceBufferConnection, setDataFlowEnabled, setInputBuffer, setInputBuffer, setOutputBuffer, setOutputBuffer`

Methods inherited from interface com.ibm.able.AbleEventListener
`handleAbleEvent`

Methods inherited from interface com.ibm.able.AbleEventListenerManager
`addAbleEventListener, dataChanged, getAbleEventListeners, notifyAbleEventListeners, removeAbleEventListener`

Methods inherited from interface com.ibm.able.AbleEventQueueManager
`flushAbleEventQueue, getAbleEventProcessingEnabled, getAbleEventQueueSize, getSleepTime, isAbleEventPostingEnabled, isAbleEventProcessingEnabled, isTimerEventProcessingEnabled, quitEnabledEventProcessing, restartEnabledEventProcessing, resumeEnabledEventProcessing, setAbleEventProcessingEnabled, setSleepTime, setTimerEventProcessingEnabled, startEnabledEventProcessing, suspendEnabledEventProcessing`

Methods inherited from interface com.ibm.able.AbleEventQueueProcessor
`processNoEventProcessingEnabledSituation, processTimerEvent`

Methods inherited from interface com.ibm.able.AblePropertyChangeManager
`addPropertyChangeListener, addPropertyConnection, getPropertyChangeListeners, getPropertyConnectionManager, removeAllPropertyConnections, removePropertyChangeListener, removePropertyConnection`

Methods inherited from interface com.ibm.able.AbleSerializable
`getFileName, restoreFromFile, restoreFromFile, saveToFile, saveToFile, setFileName`

Field Detail

### defaultName

    public static final java.lang.String defaultName

### dataFileName

    protected java.lang.String dataFileName

  The dataFileName is the file name and extension.

### numFieldsPerRecord

    protected int numFieldsPerRecord

  The number of fields in a record in the output data.

### out

    protected transient java.io.BufferedWriter out

Constructor Detail

### AbleExport

    public AbleExport()
               throws AbleException

  Construct a default AbleExport object

### AbleExport

    public AbleExport(java.lang.String name)
               throws AbleException

  Construct an AbleExport object with specified name.

### AbleExport

    public AbleExport(java.lang.String name,
                      java.lang.String dataFileName)
               throws AbleException

  Construct an AbleExport object with specified name and file. A convenience method to avoid a separate call to setDataFileName.

Parameters:
  `name` - A String containing the name used to identify this bean.
  `dataFileName` - A String containing the name of the file with no file extension.

Method Detail

### init

    public void init()
              throws AbleException

  Open the output datafile. If event posting or processing is enabled, start event processing. This enables events to be exported to a file.

  Specified by:
    `init` in interface `AbleBean`
  Overrides:
    `init` in class `AbleObject`
  Throws:
    `AbleException` - If an error occurs.
  See Also:
    `AbleObject.startEnabledEventProcessing()`

### setDataFileName

    public void setDataFileName(java.lang.String newName)

  Set the current output file name.

### getDataFileName

    public java.lang.String getDataFileName()

  Get the current output file name.

### setDelimiter

    public void setDelimiter(java.lang.String newDelims)

  Set the current delimiter. Only the first character in the String is used to delimit fields in a record.

### getDelimiter

    public java.lang.String getDelimiter()

  Return the current delimiter String.

### setNumberOfInputs

    public void setNumberOfInputs(int inputs)

  Description copied from interface: `AbleDataSink`
  Sets the number of inputs to be provided to this output device. Note that the number of inputs may also be derived from other methods.

  Specified by:
    `setNumberOfInputs` in interface `AbleDataSink`
  Parameters:
    `inputs` - The number of inputs required by this output device.

### getNumberOfInputFields

    public int getNumberOfInputFields()

  Description copied from interface: `AbleDataSink`
  Returns the number of inputs provided to this output device. Zero may indicate that the bean is not initialized or that the input is not an indexable Object such as a Hashtable.

  Specified by:
    `getNumberOfInputFields` in interface `AbleDataSink`
  Returns:
    The number of inputs provided to this output device.

### process

    public void process()
                 throws AbleException

  Write out the contents of inputBuffer to file using specified delimiter.

  Specified by:
    `process` in interface `AbleBean`
  Overrides:
    `process` in class `AbleObject`
  Throws:
    `AbleException`
  See Also:
    `AbleObject.inputBuffer`, `AbleObject.outputBuffer`, `AbleBean.process()`

### process

    public java.lang.Object process(java.lang.Object theArg)
                             throws AbleException

  Write out the contents of the parameter to the data file.

  Specified by:
    `process` in interface `AbleBean`
  Overrides:
    `process` in class `AbleObject`
  Parameters:
    `theArg` - An Object providing data input to the bean. Note: Only Object[], String[], Vector, and double[] arguments are handled

  Returns:
    the results of the process() computation, a clone of the bean OutputBuffer
  Throws:
    `AbleException` - In the following situations:
    - the inputBuffer variable is null (usually allocated in the init method)
    - the class of the parameter theArg does not match the class of the inputBuffer variable
    - the length of the parameter theArg array does not match the length of the inputBuffer array
    - the length of the parameter theArg Vector does not match the length of the inputBuffer Vector
    - when the bean has source data connections because the buffers could be overwritten from other threads
    - the outputBuffer variable is null (usually allocated in the init method)
    - the outputBuffer variable is an unsuppported class.
  See Also:
    `AbleObject.inputBuffer`, `AbleObject.outputBuffer`, `AbleBean.process()`

### quitAll

    public void quitAll()
                 throws AbleException

  Close any open file.

  Specified by:
    `quitAll` in interface `AbleBean`
  Overrides:
    `quitAll` in class `AbleObject`
  Throws:
    `AbleException`
  See Also:
    `close()`

### close

    public void close()

  Close the output file, disable data flow, and set its state to Unititiated.

### flush

    public void flush()
               throws AbleException

  Flush the output buffer.

  Throws:
    `AbleException`

### erase

    public void erase()
               throws AbleException

  Erase the current file and close the current writer.

  Throws:
    `AbleException`

### reset

    public void reset()
               throws AbleException

  re-initialize the bean close and reopen the output file

  Specified by:
    `reset` in interface `AbleBean`
  Overrides:
    `reset` in class `AbleObject`
  Throws:
    `AbleException` - If an error occurs.
  See Also:
    `AbleBean.reset()`

### isReady

    public boolean isReady()
                    throws AbleException

  Indicate whether the export is ready to write data. This means the file is open.

  Specified by:
    `isReady` in interface `AbleDataSink`
  Throws:
    `AbleException`

### processAbleEvent

    public void processAbleEvent(AbleEvent theEvent)
                          throws AbleException

  Extract the argument object from an AbleEvent and output it to the data file.

  Specified by:
    `processAbleEvent` in interface `AbleEventQueueProcessor`
  Overrides:
    `processAbleEvent` in class `AbleObject`
  Parameters:
    `theEvent` - An AbleEvent containing the data to be written to file.
  Throws:
    `AbleException` - If an error occurs.
  See Also:
    `AbleObject.setAbleEventProcessingEnabled(int)`, `AbleObject.startEnabledEventProcessing()`, `AbleObject.handleAbleEvent(AbleEvent)`

Overview | Package | Class | Use | Tree | Serialized | Deprecated | Index | Help
| ABLE 2.3.0 07/13/2005 14:21:00
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

(C) Copyright IBM Corporation 1999, 2005