Package adams.flow.source
Class AbstractSpreadSheetDbReader
-
- All Implemented Interfaces:
AdditionalInformationHandler
,CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,ShallowCopySupporter<Actor>
,SizeOfHandler
,Stoppable
,StoppableWithFeedback
,VariablesInspectionHandler
,DataRowTypeHandler
,VariableChangeListener
,Actor
,ErrorHandler
,OutputProducer
,Serializable
,Comparable
- Direct Known Subclasses:
SpreadSheetDbReader
public abstract class AbstractSpreadSheetDbReader extends AbstractDbSource implements DataRowTypeHandler
Ancestor for spreadsheet database readers.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected int
m_ChunkSize
the chunk size to use.protected DataRow
m_DataRowType
the data row type to use.protected Token
m_OutputToken
the generated output token.protected SQLStatement
m_Query
the SQL query to execute.protected Reader
m_Reader
for reading the data.protected ResultSet
m_ResultSet
the current result set.protected AbstractTypeMapper
m_TypeMapper
the type mapper to use.-
Fields inherited from class adams.flow.source.AbstractDbSource
m_DatabaseConnection
-
Fields inherited from class adams.flow.core.AbstractActor
m_Annotations, m_BackupState, m_DetectedObjectVariables, m_DetectedVariables, m_ErrorHandler, m_Executed, m_Executing, m_ExecutionListeningSupporter, m_FullName, m_LoggingPrefix, m_Name, m_Parent, m_ScopeHandler, m_Self, m_Silent, m_Skip, m_StopFlowOnError, m_StopMessage, m_Stopped, m_StorageHandler, m_VariablesUpdated
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
Fields inherited from interface adams.flow.core.Actor
FILE_EXTENSION, FILE_EXTENSION_GZ
-
-
Constructor Summary
Constructors Constructor Description AbstractSpreadSheetDbReader()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description String
chunkSizeTipText()
Returns the tip text for this property.String
dataRowTypeTipText()
Returns the tip text for this property.void
defineOptions()
Adds options to the internal list of options.Class[]
generates()
Returns the class of objects that it generates.int
getChunkSize()
Returns the current chunk size.protected abstract AbstractDatabaseConnection
getDatabaseConnection()
Determines the database connection in the flow.DataRow
getDataRowType()
Returns the type of data row to use.protected abstract AbstractDatabaseConnection
getDefaultDatabaseConnection()
Returns the default database connection.SQLStatement
getQuery()
Returns the SQL query.String
getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.AbstractTypeMapper
getTypeMapper()
Returns the type mapper in use.String
globalInfo()
Returns a string describing the object.boolean
hasPendingOutput()
Checks whether there is pending output to be collected after executing the flow item.Token
output()
Returns the generated token.protected String
queryDatabase()
Performs the actual database query.String
queryTipText()
Returns the tip text for this property.protected void
reset()
Resets the scheme.void
setChunkSize(int value)
Sets the maximum chunk size.void
setDataRowType(DataRow value)
Sets the type of data row to use.void
setQuery(SQLStatement value)
Sets the SQL query.void
setTypeMapper(AbstractTypeMapper value)
Sets the type mapper to use.void
stopExecution()
Stops the execution.String
typeMapperTipText()
Returns the tip text for this property.void
wrapUp()
Cleans up after the execution has finished.-
Methods inherited from class adams.flow.source.AbstractDbSource
doExecute, initialize, setUpDatabaseConnection
-
Methods inherited from class adams.flow.core.AbstractActor
annotationsTipText, backupState, canInspectOptions, canPerformSetUpCheck, cleanUp, compareTo, configureLogger, destroy, equals, execute, finalUpdateVariables, findVariables, findVariables, forceVariables, forCommandLine, forName, forName, getAdditionalInformation, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowActors, getFlowExecutionListeningSupporter, getFullName, getName, getNextSibling, getParent, getParentComponent, getPreviousSibling, getRoot, getScopeHandler, getSilent, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, handleException, hasErrorHandler, hasStopMessage, index, isBackedUp, isExecuted, isExecuting, isFinished, isHeadless, isStopped, nameTipText, performSetUpChecks, performVariableChecks, postExecute, preExecute, pruneBackup, pruneBackup, restoreState, setAnnotations, setErrorHandler, setName, setParent, setSilent, setSkip, setStopFlowOnError, setUp, setVariables, shallowCopy, shallowCopy, silentTipText, sizeOf, skipTipText, stopExecution, stopFlowOnErrorTipText, updateDetectedVariables, updatePrefix, updateVariables, variableChanged
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.flow.core.Actor
cleanUp, compareTo, destroy, equals, execute, findVariables, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowExecutionListeningSupporter, getFullName, getName, getNextSibling, getParent, getParentComponent, getPreviousSibling, getRoot, getScopeHandler, getSilent, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, hasErrorHandler, hasStopMessage, index, isExecuted, isFinished, isHeadless, isStopped, setAnnotations, setErrorHandler, setName, setParent, setSilent, setSkip, setStopFlowOnError, setUp, setVariables, shallowCopy, shallowCopy, sizeOf, stopExecution, toCommandLine, variableChanged
-
Methods inherited from interface adams.core.AdditionalInformationHandler
getAdditionalInformation
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel, setLoggingLevel
-
Methods inherited from interface adams.core.logging.LoggingSupporter
getLogger, isLoggingEnabled
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager
-
Methods inherited from interface adams.core.VariablesInspectionHandler
canInspectOptions
-
-
-
-
Field Detail
-
m_TypeMapper
protected AbstractTypeMapper m_TypeMapper
the type mapper to use.
-
m_Query
protected SQLStatement m_Query
the SQL query to execute.
-
m_DataRowType
protected DataRow m_DataRowType
the data row type to use.
-
m_ChunkSize
protected int m_ChunkSize
the chunk size to use.
-
m_OutputToken
protected Token m_OutputToken
the generated output token.
-
m_Reader
protected Reader m_Reader
for reading the data.
-
m_ResultSet
protected transient ResultSet m_ResultSet
the current result set.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractActor
-
reset
protected void reset()
Resets the scheme.- Overrides:
reset
in classAbstractActor
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.- Specified by:
getQuickInfo
in interfaceActor
- Specified by:
getQuickInfo
in interfaceQuickInfoSupporter
- Overrides:
getQuickInfo
in classAbstractActor
- Returns:
- null if no info available, otherwise short string
-
setTypeMapper
public void setTypeMapper(AbstractTypeMapper value)
Sets the type mapper to use.- Parameters:
value
- the mapper
-
getTypeMapper
public AbstractTypeMapper getTypeMapper()
Returns the type mapper in use.- Returns:
- the mapper
-
typeMapperTipText
public String typeMapperTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setQuery
public void setQuery(SQLStatement value)
Sets the SQL query.- Parameters:
value
- the query
-
getQuery
public SQLStatement getQuery()
Returns the SQL query.- Returns:
- the query
-
queryTipText
public String queryTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setDataRowType
public void setDataRowType(DataRow value)
Sets the type of data row to use.- Specified by:
setDataRowType
in interfaceDataRowTypeHandler
- Parameters:
value
- the type
-
getDataRowType
public DataRow getDataRowType()
Returns the type of data row to use.- Specified by:
getDataRowType
in interfaceDataRowTypeHandler
- Returns:
- the type
-
dataRowTypeTipText
public String dataRowTypeTipText()
Returns the tip text for this property.- Specified by:
dataRowTypeTipText
in interfaceDataRowTypeHandler
- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setChunkSize
public void setChunkSize(int value)
Sets the maximum chunk size.- Parameters:
value
- the size of the chunks, < 1 denotes infinity
-
getChunkSize
public int getChunkSize()
Returns the current chunk size.- Returns:
- the size of the chunks, < 1 denotes infinity
-
chunkSizeTipText
public String chunkSizeTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the gui
-
getDefaultDatabaseConnection
protected abstract AbstractDatabaseConnection getDefaultDatabaseConnection()
Returns the default database connection.- Specified by:
getDefaultDatabaseConnection
in classAbstractDbSource
- Returns:
- the default database connection
-
getDatabaseConnection
protected abstract AbstractDatabaseConnection getDatabaseConnection()
Determines the database connection in the flow.- Specified by:
getDatabaseConnection
in classAbstractDbSource
- Returns:
- the database connection to use
-
generates
public Class[] generates()
Returns the class of objects that it generates.- Specified by:
generates
in interfaceOutputProducer
- Returns:
- the Class of the generated tokens
-
queryDatabase
protected String queryDatabase()
Performs the actual database query.- Specified by:
queryDatabase
in classAbstractDbSource
- Returns:
- null if everything is fine, otherwise error message
-
hasPendingOutput
public boolean hasPendingOutput()
Checks whether there is pending output to be collected after executing the flow item.- Specified by:
hasPendingOutput
in interfaceOutputProducer
- Returns:
- true if there is pending output
-
output
public Token output()
Returns the generated token.- Specified by:
output
in interfaceOutputProducer
- Returns:
- the generated token
-
stopExecution
public void stopExecution()
Stops the execution. No message set.- Specified by:
stopExecution
in interfaceActor
- Specified by:
stopExecution
in interfaceStoppable
- Overrides:
stopExecution
in classAbstractActor
-
wrapUp
public void wrapUp()
Cleans up after the execution has finished. Graphical output is left untouched.- Specified by:
wrapUp
in interfaceActor
- Overrides:
wrapUp
in classAbstractDbSource
-
-