Class AbstractHistoryLoader<I>
- java.lang.Object
-
- com.inductiveautomation.ignition.gateway.sqltags.history.query.AbstractHistoryLoader<I>
-
- All Implemented Interfaces:
HistoryQueryExecutor
- Direct Known Subclasses:
DatasourceQueryExecutor
,LegacyHistoryExecutor
public abstract class AbstractHistoryLoader<I> extends java.lang.Object implements HistoryQueryExecutor
Provides a base level of functionality that should serve any type of history loader.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractHistoryLoader(QueryController controller)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
endReading()
If startReading was called, this function must be called (that is, it should be in a finally block).QueryController
getController()
protected long
getEndTime()
protected abstract LoggerEx
getLogger()
protected java.lang.String
getQueryId()
java.util.SortedSet<? extends IdentifiedHistoricalValue<I>>
getSeedValues()
protected long
getStartTime()
boolean
hasMore()
Returns TRUE if there is more data available to be written on call to processData()void
initialize()
Initializes the query, performing any actions necessary to get the information required to run the query.protected abstract long
loadValue(IdentifiedHistoricalValue<I> value)
Puts the value into the appropriate column.long
nextTime()
The timestamp of the next value.protected java.lang.String
pathToString(QualifiedPath path)
protected abstract void
primeRead()
This function starts the read process, and gets the system ready for the first call to readNextFromSourcelong
processData()
Puts the next value(s) into the appropriate column, returning the latest timestamp loaded, or -1 if no data was loaded.protected void
readNext()
Primes the nextValueprotected abstract IdentifiedHistoricalValue<I>
readNextFromSource()
protected void
setErrored(DataQuality code)
protected void
setPostValues(java.util.SortedSet<? extends IdentifiedHistoricalValue<I>> postValues)
protected void
setSeedValues(java.util.SortedSet<? extends IdentifiedHistoricalValue<I>> seedValues)
void
startReading()
Executes query to begin data read.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.inductiveautomation.ignition.gateway.sqltags.history.query.HistoryQueryExecutor
getColumnNodes, getEffectiveWindowSizeMS
-
-
-
-
Constructor Detail
-
AbstractHistoryLoader
protected AbstractHistoryLoader(QueryController controller)
-
-
Method Detail
-
getQueryId
protected java.lang.String getQueryId()
-
getController
public QueryController getController()
-
getLogger
protected abstract LoggerEx getLogger()
-
getStartTime
protected long getStartTime()
-
getEndTime
protected long getEndTime()
-
pathToString
protected java.lang.String pathToString(QualifiedPath path)
-
initialize
public void initialize() throws java.lang.Exception
Description copied from interface:HistoryQueryExecutor
Initializes the query, performing any actions necessary to get the information required to run the query.- Specified by:
initialize
in interfaceHistoryQueryExecutor
- Throws:
java.lang.Exception
-
setErrored
protected void setErrored(DataQuality code)
-
getSeedValues
public java.util.SortedSet<? extends IdentifiedHistoricalValue<I>> getSeedValues()
-
setSeedValues
protected void setSeedValues(java.util.SortedSet<? extends IdentifiedHistoricalValue<I>> seedValues)
-
setPostValues
protected void setPostValues(java.util.SortedSet<? extends IdentifiedHistoricalValue<I>> postValues)
-
startReading
public void startReading() throws java.lang.Exception
Executes query to begin data read. Important: endRead should be called in finally block of invoking method.- Specified by:
startReading
in interfaceHistoryQueryExecutor
- Throws:
java.lang.Exception
-
primeRead
protected abstract void primeRead() throws java.lang.Exception
This function starts the read process, and gets the system ready for the first call to readNextFromSource- Throws:
java.lang.Exception
-
endReading
public void endReading()
Description copied from interface:HistoryQueryExecutor
If startReading was called, this function must be called (that is, it should be in a finally block).- Specified by:
endReading
in interfaceHistoryQueryExecutor
-
hasMore
public boolean hasMore()
Description copied from interface:HistoryQueryExecutor
Returns TRUE if there is more data available to be written on call to processData()- Specified by:
hasMore
in interfaceHistoryQueryExecutor
-
nextTime
public long nextTime()
Description copied from interface:HistoryQueryExecutor
The timestamp of the next value. -1 if no value is available.- Specified by:
nextTime
in interfaceHistoryQueryExecutor
-
processData
public long processData() throws java.lang.Exception
Description copied from interface:HistoryQueryExecutor
Puts the next value(s) into the appropriate column, returning the latest timestamp loaded, or -1 if no data was loaded.- Specified by:
processData
in interfaceHistoryQueryExecutor
- Throws:
java.lang.Exception
-
readNext
protected void readNext() throws java.lang.Exception
Primes the nextValue- Throws:
java.lang.Exception
-
readNextFromSource
protected abstract IdentifiedHistoricalValue<I> readNextFromSource() throws java.lang.Exception
- Throws:
java.lang.Exception
-
loadValue
protected abstract long loadValue(IdentifiedHistoricalValue<I> value)
Puts the value into the appropriate column.
-
-