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 intm_ChunkSizethe chunk size to use.protected DataRowm_DataRowTypethe data row type to use.protected Tokenm_OutputTokenthe generated output token.protected SQLStatementm_Querythe SQL query to execute.protected Readerm_Readerfor reading the data.protected ResultSetm_ResultSetthe current result set.protected AbstractTypeMapperm_TypeMapperthe 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 StringchunkSizeTipText()Returns the tip text for this property.StringdataRowTypeTipText()Returns the tip text for this property.voiddefineOptions()Adds options to the internal list of options.Class[]generates()Returns the class of objects that it generates.intgetChunkSize()Returns the current chunk size.protected abstract AbstractDatabaseConnectiongetDatabaseConnection()Determines the database connection in the flow.DataRowgetDataRowType()Returns the type of data row to use.protected abstract AbstractDatabaseConnectiongetDefaultDatabaseConnection()Returns the default database connection.SQLStatementgetQuery()Returns the SQL query.StringgetQuickInfo()Returns a quick info about the actor, which will be displayed in the GUI.AbstractTypeMappergetTypeMapper()Returns the type mapper in use.StringglobalInfo()Returns a string describing the object.booleanhasPendingOutput()Checks whether there is pending output to be collected after executing the flow item.Tokenoutput()Returns the generated token.protected StringqueryDatabase()Performs the actual database query.StringqueryTipText()Returns the tip text for this property.protected voidreset()Resets the scheme.voidsetChunkSize(int value)Sets the maximum chunk size.voidsetDataRowType(DataRow value)Sets the type of data row to use.voidsetQuery(SQLStatement value)Sets the SQL query.voidsetTypeMapper(AbstractTypeMapper value)Sets the type mapper to use.voidstopExecution()Stops the execution.StringtypeMapperTipText()Returns the tip text for this property.voidwrapUp()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:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractActor
-
reset
protected void reset()
Resets the scheme.- Overrides:
resetin classAbstractActor
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.- Specified by:
getQuickInfoin interfaceActor- Specified by:
getQuickInfoin interfaceQuickInfoSupporter- Overrides:
getQuickInfoin 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:
setDataRowTypein interfaceDataRowTypeHandler- Parameters:
value- the type
-
getDataRowType
public DataRow getDataRowType()
Returns the type of data row to use.- Specified by:
getDataRowTypein interfaceDataRowTypeHandler- Returns:
- the type
-
dataRowTypeTipText
public String dataRowTypeTipText()
Returns the tip text for this property.- Specified by:
dataRowTypeTipTextin 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:
getDefaultDatabaseConnectionin classAbstractDbSource- Returns:
- the default database connection
-
getDatabaseConnection
protected abstract AbstractDatabaseConnection getDatabaseConnection()
Determines the database connection in the flow.- Specified by:
getDatabaseConnectionin classAbstractDbSource- Returns:
- the database connection to use
-
generates
public Class[] generates()
Returns the class of objects that it generates.- Specified by:
generatesin interfaceOutputProducer- Returns:
- the Class of the generated tokens
-
queryDatabase
protected String queryDatabase()
Performs the actual database query.- Specified by:
queryDatabasein 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:
hasPendingOutputin interfaceOutputProducer- Returns:
- true if there is pending output
-
output
public Token output()
Returns the generated token.- Specified by:
outputin interfaceOutputProducer- Returns:
- the generated token
-
stopExecution
public void stopExecution()
Stops the execution. No message set.- Specified by:
stopExecutionin interfaceActor- Specified by:
stopExecutionin interfaceStoppable- Overrides:
stopExecutionin classAbstractActor
-
wrapUp
public void wrapUp()
Cleans up after the execution has finished. Graphical output is left untouched.- Specified by:
wrapUpin interfaceActor- Overrides:
wrapUpin classAbstractDbSource
-
-