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

com.ibm.able.beans
Class AbleDBImport

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

public class AbleDBImport
extends AbleAbstractImport
implements java.io.Serializable

This class provides Able beans with access to database data using JDBC interfaces.

A DBImport will read data from a database table, and write its records to a data outputbuffer. It knows how to create an AbleDBTable which is used by the AbleAbstractImport superclass to handle I/O and cacheing.

The DBImport object requires SQL connection and table access information. It builds a query in the following format:

     SELECT * from SYSCAT.TABLES WHERE ( SYSCAT.TABLES.DEFINER like 'SYS%' )
     

Meta-data definition is used by the AbleDBTable to create Able field variables and scan the source data, computing min/mean/max values for continuous fields, creating symbol to index mappings for categorical fields, and creating number to index mappings for discrete fields.

A DBImport can be used to generate an AbleFilter bean which will translate the data in the manner specified in the meta-data definition. Mapping from SQL data type to Able data type is performed by the AbleDBTable data member. Field usage may be specified from the GUI Data property panel, or via API.

See Also:
Serialized Form

Field Summary
protected  java.sql.Connection connection
          The SQL connection.
static java.lang.String defaultName
          Value assigned to name by default.
protected  java.lang.String schema
          A String specifying the schema cpntaining the table to read.
protected  java.lang.String schemaSeparator
           
protected  java.lang.String selectionColumns
          A comma-delimited String of names of columns to include in the selection.
protected  java.lang.String selectionWhere
          A String in the query as the clause immediately after the word "WHERE".
protected  java.lang.String table
          A String specifying the table to read.
 
Fields inherited from class com.ibm.able.beans.AbleAbstractImport
bufferRecordIndex, bufferSize, computeStatistics, cycleRelative, cycleSize, eof, fieldList, importData, numEpochs, numericData, numFieldsPerRecord, numRecords, outNum, outSym, randomIndices, randomizeData, recordIndex, recordsRead, textData
 
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
AbleDBImport()
          Construct a default AbleDBImport object.
AbleDBImport(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().
 java.sql.Connection getConnection()
           
 java.lang.String getConnectionOptions()
           
 java.lang.String getDatabase()
           
 java.lang.String getDriver()
           
 java.lang.String getProtocol()
           
 java.lang.String getProtocolURL()
           
 java.lang.String getSchema()
           
 java.lang.String getSchemaTable()
          Method getSchemaTable.
 java.lang.String getSelectionColumns()
           
 java.lang.String getSelectionWhere()
           
 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.
 void open()
          Open the table specfied by connection and statement.
 void setConnectionOptions(java.lang.String options)
           
 void setDatabase(java.lang.String database)
           
 void setDriver(java.lang.String driver)
           
 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 setSelectionColumns(java.lang.String selectionColumns)
           
 void setSelectionWhere(java.lang.String selectionWhere)
           
 void setSubprotocol(java.lang.String subprotocol)
           
 void setTable(java.lang.String table)
           
 void setUserid(java.lang.String userid)
           
 java.lang.String toString()
          return a formatted string describing the state of this DataSet
protected  void updateFieldUsage(java.util.Vector oldFieldList)
          Copy the usage for one field from the old field to the new so that an open does not wipe this data out.
 
Methods inherited from class com.ibm.able.beans.AbleAbstractImport
endOfFile, eof, generateRandomIndices, getAgentFieldList, getBufferSize, getComputeStatistics, getCurrentRecordIndex, getCycleSize, getCycleSizeAsString, getFieldList, getFieldList, getNextRecordBlock, getNextTextRecord, getNormalizedRecordSize, getNumberOfOutputFields, getNumEpochs, getNumRecords, getRecordIndex, getRecordsRead, getStepsPerCycle, isAllNumericData, isCycleRelative, isRandomizeData, isReady, process, processAbleEvent, processTimerEvent, quitAll, reset, setBufferSize, setComputeStatistics, setCycleSize, setDefaults, setFieldList, setRandomizeData, setRecordIndex
 
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, process, processBufferConnections, processNoEventProcessingEnabledSituation, 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, process, 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
 
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.


schema

protected java.lang.String schema
A String specifying the schema cpntaining the table to read.


table

protected java.lang.String table
A String specifying the table to read.


connection

protected transient java.sql.Connection connection
The SQL connection.


selectionColumns

protected java.lang.String selectionColumns
A comma-delimited String of names of columns to include in the selection. Defaults to "*". This is used as the clause immediately after the word "SELECT" in the query.


selectionWhere

protected java.lang.String selectionWhere
A String in the query as the clause immediately after the word "WHERE". Do not include "WHERE" in this String.


schemaSeparator

protected java.lang.String schemaSeparator
Constructor Detail

AbleDBImport

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


AbleDBImport

public AbleDBImport(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
Open the table specfied by connection and statement. Create an AbleDBTable object and load the data into memory. Since SQL meta data does not contain Able field usage information, preserve the usage setting when the table is opened and the fieldList Vector is recreated so that fields with the same name have the same usage before and after opening.

Overrides:
open in class AbleAbstractImport
Throws:
AbleException
See Also:
AbleAbstractImport.open()

updateFieldUsage

protected void updateFieldUsage(java.util.Vector oldFieldList)
Copy the usage for one field from the old field to the new so that an open does not wipe this data out.


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

getSchemaTable

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

Returns:
Object

close

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

Overrides:
close in class AbleAbstractImport
Throws:
AbleException
See Also:
AbleAbstractImport.close()

toString

public java.lang.String toString()
return a formatted string describing the state of this DataSet


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

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

setTable

public void setTable(java.lang.String table)

getSelectionColumns

public java.lang.String getSelectionColumns()

setSelectionColumns

public void setSelectionColumns(java.lang.String selectionColumns)

getSelectionWhere

public java.lang.String getSelectionWhere()

setSelectionWhere

public void setSelectionWhere(java.lang.String selectionWhere)

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

(C) Copyright IBM Corporation 1999, 2005