Class AbstractHistoryLoader<V>

java.lang.Object
com.inductiveautomation.historian.gateway.query.execution.AbstractHistoryLoader<V>
All Implemented Interfaces:
HistoryQueryExecutor
Direct Known Subclasses:
AbstractHistoryQueryExecutor

public abstract class AbstractHistoryLoader<V> extends Object implements HistoryQueryExecutor
Provides a base level of functionality that should serve any type of history loader.
  • Field Details

    • startTime

      protected long startTime
    • endTime

      protected long endTime
  • Constructor Details

  • Method Details

    • getQueryId

      protected String getQueryId()
    • getController

      public QueryController getController()
    • getLogger

      protected abstract LoggerEx getLogger()
    • getStartTime

      protected long getStartTime()
    • getEndTime

      protected long getEndTime()
    • shouldReadBoundaryValues

      protected boolean shouldReadBoundaryValues()
      Helper function to determine whether bounding values should be read.
    • pathToString

      protected String pathToString(QualifiedPath path)
    • initialize

      public void initialize() throws 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 interface HistoryQueryExecutor
      Throws:
      Exception
    • setErrored

      protected void setErrored(DataQuality code)
    • getSeedValues

      public List<? extends V> getSeedValues()
    • setSeedValues

      protected void setSeedValues(List<? extends V> seedValues)
    • setPostValues

      protected void setPostValues(List<? extends V> postValues)
    • startReading

      public final void startReading() throws Exception
      Executes query to begin data read. Important: endReading should be called in finally block of invoking method.
      Specified by:
      startReading in interface HistoryQueryExecutor
      Throws:
      Exception
    • primeRead

      protected abstract void primeRead() throws Exception
      This function starts the read process, and gets the system ready for the first call to readNextFromSource
      Throws:
      Exception
    • endReading

      public final 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 interface HistoryQueryExecutor
    • closeRead

      protected abstract void closeRead()
      The reading has been ended, clean up any resources.
    • 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 interface HistoryQueryExecutor
    • getTimestampFor

      protected abstract long getTimestampFor(V value)
    • 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 interface HistoryQueryExecutor
    • processData

      public long processData() throws 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 interface HistoryQueryExecutor
      Throws:
      Exception
    • readNext

      protected void readNext() throws Exception
      Primes the nextValue
      Throws:
      Exception
    • readNextFromSource

      protected abstract V readNextFromSource() throws Exception
      Throws:
      Exception
    • loadValue

      protected abstract long loadValue(V value)
      Puts the value into the appropriate column.