Class HistorianPointQueryExecutor<P extends DataPoint<?>,K extends DataPointQueryKey>
java.lang.Object
com.inductiveautomation.historian.gateway.interop.HistorianPointQueryExecutor<P,K>
- All Implemented Interfaces:
QueriedPointProcessor<P,,K, DataPointType> HistoryQueryExecutor
- Direct Known Subclasses:
HistorianAggregatedQueryExecutor,HistorianRawQueryExecutor
public abstract class HistorianPointQueryExecutor<P extends DataPoint<?>,K extends DataPointQueryKey>
extends Object
implements HistoryQueryExecutor, QueriedPointProcessor<P,K,DataPointType>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final com.google.common.collect.Multimap<K,HistorianDataColumn<K>> protected final List<HistorianDataColumn<K>>protected final QueryControllerprotected static final LoggerExprotected final QueryEngine -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedHistorianPointQueryExecutor(QueryEngine queryEngine, Collection<HistorianDataColumn<K>> columns, QueryController controller) -
Method Summary
Modifier and TypeMethodDescriptionvoidIf startReading was called, this function must be called (that is, it should be in a finally block).protected abstract voidList<? extends ResultNode>Returns the HistoryNodes of this executor.booleanhasMore()Returns TRUE if there is more data available to be written on call to processData()voidInitializes the query, performing any actions necessary to get the information required to run the query.protected booleanprotected booleanisOperationTimedOut(long startMS) longnextTime()The timestamp of the next value.protected voidvoidCalled when all processing is complete.voidonError(QualityCode error) Handles a terminal error condition with a quality code.voidHandles a terminal error condition with an exception.booleanonInitialize(ProcessingContext<K, DataPointType> context) Initializes the processor with context information before processing begins.voidonKeyFailure(K queryKey, QualityCode failureCode) Handles a failure specific to a query key.booleanonPointAvailable(K queryKey, P point) Processes a single temporal point.longPuts the next value(s) into the appropriate column, returning the latest timestamp loaded, or -1 if no data was loaded.voidBegins reading data.protected voidprotected voidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.inductiveautomation.ignition.gateway.sqltags.history.query.HistoryQueryExecutor
getEffectiveWindowSizeMS
-
Field Details
-
log
-
columnMap
protected final com.google.common.collect.Multimap<K extends DataPointQueryKey,HistorianDataColumn<K extends DataPointQueryKey>> columnMap -
columns
-
queryEngine
-
controller
-
-
Constructor Details
-
HistorianPointQueryExecutor
protected HistorianPointQueryExecutor(QueryEngine queryEngine, Collection<HistorianDataColumn<K>> columns, QueryController controller)
-
-
Method Details
-
initialize
public void initialize()Description copied from interface:HistoryQueryExecutorInitializes the query, performing any actions necessary to get the information required to run the query.- Specified by:
initializein interfaceHistoryQueryExecutor
-
getColumnNodes
Description copied from interface:HistoryQueryExecutorReturns the HistoryNodes of this executor. There MUST be one for every tag path, and they must be in the same order as the paths provided to the executor when it was created. Also, these values must be available as soon as the executor is created. However, they won't be consulted for their data type until after initialize is called, so the normal procedure is to create and returnDelegatingResultNodes, which get filled in later.- Specified by:
getColumnNodesin interfaceHistoryQueryExecutor
-
startReading
public void startReading()Description copied from interface:HistoryQueryExecutorBegins reading data. IMPORTANT: endReading should always be called at some point after calling startReading.- Specified by:
startReadingin interfaceHistoryQueryExecutor
-
waitForColumnInit
protected void waitForColumnInit() -
endReading
public void endReading()Description copied from interface:HistoryQueryExecutorIf startReading was called, this function must be called (that is, it should be in a finally block).- Specified by:
endReadingin interfaceHistoryQueryExecutor
-
isOperationTimedOut
protected boolean isOperationTimedOut(long startMS) -
waitForData
protected void waitForData() -
isFinished
protected boolean isFinished() -
hasMore
public boolean hasMore()Description copied from interface:HistoryQueryExecutorReturns TRUE if there is more data available to be written on call to processData()- Specified by:
hasMorein interfaceHistoryQueryExecutor
-
nextTime
public long nextTime()Description copied from interface:HistoryQueryExecutorThe timestamp of the next value. -1 if no value is available.- Specified by:
nextTimein interfaceHistoryQueryExecutor
-
processData
public long processData()Description copied from interface:HistoryQueryExecutorPuts the next value(s) into the appropriate column, returning the latest timestamp loaded, or -1 if no data was loaded.- Specified by:
processDatain interfaceHistoryQueryExecutor
-
onInitialize
Description copied from interface:QueriedPointProcessorInitializes the processor with context information before processing begins. This method is called once before any points are processed.- Specified by:
onInitializein interfaceQueriedPointProcessor<P extends DataPoint<?>,K extends DataPointQueryKey, DataPointType> - Parameters:
context- The processing context containing initialization properties.- Returns:
- True if initialization was successful and processing should continue, false to stop.
-
onPointAvailable
Description copied from interface:QueriedPointProcessorProcesses a single temporal point. Called repeatedly for each point in the result set.- Specified by:
onPointAvailablein interfaceQueriedPointProcessor<P extends DataPoint<?>,K extends DataPointQueryKey, DataPointType> - Parameters:
queryKey- The query key associated with the point.point- The temporal point to process.- Returns:
- True to continue processing additional points, false to stop.
-
onKeyFailure
Description copied from interface:QueriedPointProcessorHandles a failure specific to a query key. Processing continues for other query keys after this is called. This method can be called prior toQueriedPointProcessor.onInitialize(ProcessingContext)as needed.- Specified by:
onKeyFailurein interfaceQueriedPointProcessor<P extends DataPoint<?>,K extends DataPointQueryKey, DataPointType> - Parameters:
queryKey- The query key that failed.failureCode- The quality code indicating the reason for failure.
-
onError
Description copied from interface:QueriedPointProcessorHandles a terminal error condition with a quality code. Processing stops after this method is called.- Specified by:
onErrorin interfaceQueriedPointProcessor<P extends DataPoint<?>,K extends DataPointQueryKey, DataPointType> - Parameters:
error- The quality code representing the error condition.
-
onError
Description copied from interface:QueriedPointProcessorHandles a terminal error condition with an exception. Processing stops after this method is called.- Specified by:
onErrorin interfaceQueriedPointProcessor<P extends DataPoint<?>,K extends DataPointQueryKey, DataPointType> - Parameters:
error- The exception that caused the error.
-
onComplete
public void onComplete()Description copied from interface:QueriedPointProcessorCalled when all processing is complete. This method is called exactly once after all points have been processed or processing has been stopped.- Specified by:
onCompletein interfaceQueriedPointProcessor<P extends DataPoint<?>,K extends DataPointQueryKey, DataPointType>
-
notifyValueBuffer
protected void notifyValueBuffer() -
executeQuery
protected abstract void executeQuery()
-