ABLE 2.3.0 07/13/2005 14:21:00

com.ibm.able.beans
Class AbleDBExport

java.lang.Object
  extended bycom.ibm.able.AbleObject
      extended bycom.ibm.able.beans.AbleDBExport
All Implemented Interfaces:
AbleBean, AbleDataBufferManager, AbleDataSink, AbleEventListener, AbleEventListenerManager, AbleEventQueueManager, AbleEventQueueProcessor, AblePropertyChangeManager, AbleSerializable, java.io.Serializable

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

AbleDBExport provides Able beans with the ability to write data to to a database table using JDBC interfaces.

See Also:
Serialized Form

Field Summary
static java.lang.String defaultName
          Value assigned to name by default.
 
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
AbleDBExport()
          Construct a default AbleDBImport object.
AbleDBExport(java.lang.String name)
          Construct an AbleDBImport object with a specified name.
 
Method Summary
 void close()
          Override the superclass Close so that the connection is closed before calling super.close().
 void createTable(java.lang.String[] columnNames, java.lang.String[] columnTypes)
           
 int delete(java.util.Map map)
          Delete selected records from the current table.
 int delete(java.lang.String whereString)
          Delete selected records from the current table.
 void erase()
          Drop the current table and close the connection.
 java.lang.String[] getColumnNames()
           
 java.sql.Connection getConnection()
           
 java.lang.String getConnectionOptions()
           
 java.lang.String getDatabase()
           
 java.lang.String getDriver()
           
 int getNumberOfInputFields()
          Returns the number of inputs provided to this output device.
 java.lang.String getProtocol()
           
 java.lang.String getProtocolURL()
           
 java.lang.String getSchema()
           
 java.lang.String getSchemaTable()
          Method getSchemaTable.
 java.lang.String getSubprotocol()
           
 java.lang.String getTable()
          Returns the table name.
 java.lang.String getUserid()
           
 void init()
          Overrides the superclass init so that a connection is created before running the superclass init.
 boolean isCreatable()
          Deprecated. We are considering whether we want to support creating tables on the fly so this is deprecated as a warning.
 boolean isCreatableDB()
          Deprecated. We are considering whether we want to support creating tables on the fly so this is deprecated as a warning.
 boolean isReady()
          Method isReady.
 void open()
          Create the connection needed to write data to a database table.
 void process()
          Write out the contents of the parameter to the data file.
 java.lang.Object process(java.lang.Object buffer)
          Write out the contents of inputBuffer to file using specified delimiter.
 void processAbleEvent(AbleEvent theEvent)
          Extract the argument object from an AbleEvent and output it to the data file.
 void quitAll()
          Close any open connections.
 void reset()
          Re-initialize the bean Close and reopen the output file.
 void setConnectionOptions(java.lang.String options)
           
 void setCreatable(boolean createIfNeeded)
          Deprecated. We are considering whether we want to support creating tables on the fly so this is deprecated as a warning.
 void setCreatableDB(boolean createIfNeeded)
          Deprecated. We are considering whether we want to support creating tables on the fly so this is deprecated as a warning. It would be better if you included any additional JDBC protocol information in the subprotocol specific to your JDBC implementation.
 void setDatabase(java.lang.String database)
           
 void setDriver(java.lang.String driver)
           
 void setNumberOfInputs(int inputs)
          Sets the number of inputs to be provided to this output device.
 void setPassword(java.lang.String password)
           
 void setProtocol(java.lang.String protocol)
           
 void setProtocolURL(java.lang.String url)
           
 void setSchema(java.lang.String schema)
           
 void setSubprotocol(java.lang.String subprotocol)
           
 void setTable(java.lang.String table)
          Sets the table name.
 void setUserid(java.lang.String userid)
           
 java.lang.String toString()
           
 int update(java.util.Collection buffer, java.lang.String whereString)
          Update the selected record.
 int update(double[] buffer, java.lang.String whereString)
          Update the selected record.
 int update(java.util.Map valueMap, java.util.Map whereMap)
          Update selected records from the current table.
 int update(java.lang.Object[] buffer, java.lang.String whereString)
          Update the selected record.
 int update(java.lang.String[] buffer, java.lang.String whereString)
          Update the selected record.
 
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, 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
Value assigned to name by default.

Constructor Detail

AbleDBExport

public AbleDBExport()
             throws AbleException
Construct a default AbleDBImport object.


AbleDBExport

public AbleDBExport(java.lang.String name)
             throws AbleException
Construct an AbleDBImport object with a specified name.

Parameters:
name - A String containing the name used to identify this bean.
Method Detail

open

public void open()
          throws AbleException
Create the connection needed to write data to a database table.

Throws:
AbleException
See Also:
AbleAbstractImport.open()

createTable

public void createTable(java.lang.String[] columnNames,
                        java.lang.String[] columnTypes)
                 throws AbleException
Parameters:
columnNames -
columnTypes -
Throws:
AbleException

init

public void init()
          throws AbleException
Overrides the superclass init so that a connection is created before running the superclass init.

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

close

public void close()
           throws AbleException
Override the superclass Close so that the connection is closed before calling super.close().

Throws:
AbleException
See Also:
AbleAbstractImport.close()

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.

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.

process

public void process()
             throws AbleException
Write out the contents of the parameter to the data file.

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 buffer)
                         throws AbleException
Write out the contents of inputBuffer to file using specified delimiter.

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

Returns:
The number of records written.
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()

  • getSchemaTable

    public java.lang.String getSchemaTable()
    Method getSchemaTable.

    Returns:
    Object

    quitAll

    public void quitAll()
                 throws AbleException
    Close any open connections.

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

    delete

    public int delete(java.lang.String whereString)
               throws AbleException
    Delete selected records from the current table.

    Parameters:
    whereString - String of selection criteria to be included after the SQL WHERE keyword.
    Returns:
    the number of records deleted
    Throws:
    AbleException

    delete

    public int delete(java.util.Map map)
               throws AbleException
    Delete selected records from the current table.

    Parameters:
    map - Map containing a keyString of selection criteria to be included after the SQL WHERE keyword.
    Returns:
    the number of records deleted
    Throws:
    AbleException

    update

    public int update(java.lang.String[] buffer,
                      java.lang.String whereString)
               throws AbleException
    Update the selected record.

    Parameters:
    buffer - The new values for the record fields in sequence.
    whereString - String of selection criteria to be included after the SQL WHERE keyword. May be null to update all records.
    Returns:
    the number of records updated.
    Throws:
    AbleException

    update

    public int update(double[] buffer,
                      java.lang.String whereString)
               throws AbleException
    Update the selected record.

    Parameters:
    buffer - The new values for the record fields in sequence.
    whereString - String of selection criteria to be included after the SQL WHERE keyword. May be null to update all records.
    Returns:
    the number of records updated.
    Throws:
    AbleException

    update

    public int update(java.lang.Object[] buffer,
                      java.lang.String whereString)
               throws AbleException
    Update the selected record.

    Parameters:
    buffer - The new values for the record fields in sequence.
    whereString - String of selection criteria to be included after the SQL WHERE keyword. May be null to update all records.
    Returns:
    the number of records updated.
    Throws:
    AbleException

    update

    public int update(java.util.Collection buffer,
                      java.lang.String whereString)
               throws AbleException
    Update the selected record.

    Parameters:
    buffer - The new values for the record fields in sequence.
    whereString - String of selection criteria to be included after the SQL WHERE keyword. May be null to update all records.
    Returns:
    the number of records updated.
    Throws:
    AbleException

    update

    public int update(java.util.Map valueMap,
                      java.util.Map whereMap)
               throws AbleException
    Update selected records from the current table.

    Parameters:
    valueMap - A Map containing a keyString of column name and value to be included after the SQL SET keyword.
    whereMap - A Map containing a keyString of selection criteria to be included after the SQL WHERE keyword. May be null. The selection will be connected with AND.
    Returns:
    the number of records deleted
    Throws:
    AbleException

    erase

    public void erase()
               throws AbleException
    Drop the current table and close the connection.

    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()

    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)

    getDriver

    public java.lang.String getDriver()

    setDriver

    public void setDriver(java.lang.String driver)

    getProtocol

    public java.lang.String getProtocol()

    setProtocol

    public void setProtocol(java.lang.String protocol)

    getSubprotocol

    public java.lang.String getSubprotocol()

    setSubprotocol

    public void setSubprotocol(java.lang.String subprotocol)

    getConnection

    public java.sql.Connection getConnection()

    getColumnNames

    public java.lang.String[] getColumnNames()

    getDatabase

    public java.lang.String getDatabase()

    setDatabase

    public void setDatabase(java.lang.String database)

    getConnectionOptions

    public java.lang.String getConnectionOptions()

    setConnectionOptions

    public void setConnectionOptions(java.lang.String options)

    getProtocolURL

    public java.lang.String getProtocolURL()

    setProtocolURL

    public void setProtocolURL(java.lang.String url)

    getUserid

    public java.lang.String getUserid()

    setUserid

    public void setUserid(java.lang.String userid)

    setPassword

    public void setPassword(java.lang.String password)

    getSchema

    public java.lang.String getSchema()

    setSchema

    public void setSchema(java.lang.String schema)

    getTable

    public java.lang.String getTable()
    Returns the table name.

    Returns:
    name of the database table.

    setTable

    public void setTable(java.lang.String table)
    Sets the table name. Depending on the database used, case may be significant.

    Parameters:
    table - The name of the table.

    isCreatable

    public boolean isCreatable()
    Deprecated. We are considering whether we want to support creating tables on the fly so this is deprecated as a warning.

    Returns the creatable table flag.

    Returns:
    boolean

    setCreatable

    public void setCreatable(boolean createIfNeeded)
    Deprecated. We are considering whether we want to support creating tables on the fly so this is deprecated as a warning.

    Sets the the creatable table flag.

    Parameters:
    createIfNeeded - The creatable value to set.

    isCreatableDB

    public boolean isCreatableDB()
    Deprecated. We are considering whether we want to support creating tables on the fly so this is deprecated as a warning.

    Returns the creatable table flag.

    Returns:
    boolean

    setCreatableDB

    public void setCreatableDB(boolean createIfNeeded)
    Deprecated. We are considering whether we want to support creating tables on the fly so this is deprecated as a warning. It would be better if you included any additional JDBC protocol information in the subprotocol specific to your JDBC implementation.

    Sets the the creatable table flag.

    Parameters:
    createIfNeeded - The creatable value to set.

    isReady

    public boolean isReady()
                    throws AbleException
    Method isReady.

    Specified by:
    isReady in interface AbleDataSink
    Returns:
    boolean
    Throws:
    AbleException

    toString

    public java.lang.String toString()

    ABLE 2.3.0 07/13/2005 14:21:00

    (C) Copyright IBM Corporation 1999, 2005