ABLE 2.0.0 07/02/2003 10:25:01

com.ibm.able.beans
Class AbleDBExport

java.lang.Object
  |
  +--com.ibm.able.AbleObject
        |
        +--com.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, 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().
static java.lang.String Copyright()
          Determine the copyright of this class.
 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 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()
           
 java.lang.String getUserid()
           
 void init()
          Overrides the superclass init so that a connection is created before running the superclass init.
 boolean isCreatable()
          Returns the creatable table flag.
 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 setCreatable(boolean createIfNeeded)
          Sets the the creatable table flag.
 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 setSchema(java.lang.String schema)
           
 void setSubprotocol(java.lang.String subprotocol)
           
 void setTable(java.lang.String table)
           
 void setUserid(java.lang.String userid)
           
 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, getInputBufferAsStringArray, getInputBufferContents, getLogger, getName, getOutputBuffer, getOutputBuffer, getOutputBufferAsStringArray, getOutputBufferContents, getParent, 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, 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, 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, getState, getTraceLogger, init, isChanged, removeAllConnections, resumeAll, setChanged, setComment, setLogger, setName, setParent, setState, setTraceLogger, suspendAll
 
Methods inherited from interface com.ibm.able.AbleDataBufferManager
addDestBufferConnection, addSourceBufferConnection, getDestBufferConnections, getInputBuffer, getInputBuffer, getInputBufferAsStringArray, getInputBufferContents, getOutputBuffer, getOutputBuffer, 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, 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.
See Also:
AbleAbstractImport.open()

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
See Also:
AbleAbstractImport.init()

close

public void close()
           throws AbleException
Override the superclass Close so that the connection is closed before calling super.close().
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
Following copied from interface: com.ibm.able.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
Following copied from interface: com.ibm.able.AbleDataSink
Parameters:
count - 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
Following copied from interface: com.ibm.able.AbleBean
Throws:
AbleException - If an error occurs.

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
Following copied from interface: com.ibm.able.AbleBean
Parameters:
theArg - An Object used to provide data for the bean derive a result.
Returns:
The results of the process() computation, usually a clone of the bean's OutputBuffer.
Throws:
AbleException - If an error occurs.

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

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

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.

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.

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.

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.

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

erase

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

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
Following copied from interface: com.ibm.able.AbleBean
Throws:
AbleException - If an error occurs.

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.

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)

getProtocolURL

public java.lang.String getProtocolURL()

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

setTable

public void setTable(java.lang.String table)

isCreatable

public boolean isCreatable()
Returns the creatable table flag.
Returns:
boolean

setCreatable

public void setCreatable(boolean createIfNeeded)
Sets the the creatable table flag.
Parameters:
creatable - The creatable value to set.

isReady

public boolean isReady()
                throws AbleException
Method isReady.
Specified by:
isReady in interface AbleDataSink
Returns:
boolean

Copyright

public static java.lang.String Copyright()
Determine the copyright of this class.
Returns:
A String containing this class's copyright.


ABLE 2.0.0 07/02/2003 10:25:01

(C) Copyright IBM Corporation 1999, 2003