Class DirectQueryBinding
java.lang.Object
com.inductiveautomation.perspective.gateway.binding.AbstractPollingBinding<QueryBindingParams>
com.inductiveautomation.perspective.gateway.binding.query.DirectQueryBinding
- All Implemented Interfaces:
QueryBindingConstants,Binding
Implementation of a Perspective query binding. These bindings will execute a named query,
optionally on a rate.
The polling rate, as well as the parameter values, are all expressions that can produce new values at any time. Care is taken to ensure that any blocking work takes place on the perspective working thread-pool.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.inductiveautomation.perspective.gateway.binding.AbstractPollingBinding
AbstractPollingBinding.State -
Field Summary
FieldsFields inherited from class com.inductiveautomation.perspective.gateway.binding.AbstractPollingBinding
context, stateFields inherited from interface com.inductiveautomation.perspective.gateway.api.Binding
BAD_CONFIG, BAD_REF, BIDIRECTIONAL_KEY, COALESCE_KEY, INITIAL_VALUE, MDC_BINDING_TARGET, NOT_FOUNDFields inherited from interface com.inductiveautomation.perspective.common.config.constants.QueryBindingConstants
CONFIG_MODE, QUERY_PATH, TYPE_ID -
Method Summary
Modifier and TypeMethodDescriptionprotected QueryBindingParamsThis method will be called when it is time to fetch a new value.static QualifiedValueexecute(QueryBindingParams params) Executes a named query and returns the result as a qualified value.protected final com.inductiveautomation.perspective.gateway.binding.query.AbstractQueryBinding.ParameterCollectionProvides access to the parameter collection for subclasses.protected StringReturns the query path to check against when listening for query updates.protected booleanisDirty()If any dependencies of the implementation have changed, this method should return true, which will kick off another execution if dependencies have changed while the execution was running.protected booleanIndicates whether the query path has changed since the last execution.protected booleanIndicates whether the query path is ready for execution.protected booleanisReady()Indicates whether or not the instance of the underlying implementation is ready for execution.protected Collection<PropertyReference>Resolves property references specific to the query path.voidshutdown()Shut down the binding.protected voidHook for subclasses to perform query path-specific shutdown logic.voidstartup()Start up the binding.protected voidHook for subclasses to perform query path-specific startup logic.Methods inherited from class com.inductiveautomation.perspective.gateway.binding.AbstractPollingBinding
onUserRefresh, scheduleNowMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.inductiveautomation.perspective.gateway.api.Binding
isBidirectional, onTargetUpdated, shouldCoalesce
-
Field Details
-
config
-
-
Method Details
-
getQueryPathForListener
Returns the query path to check against when listening for query updates.- Returns:
- the query path string to monitor for updates, or null if not yet determined
-
isQueryPathReady
protected boolean isQueryPathReady()Indicates whether the query path is ready for execution.- Returns:
- true if the query path has a valid value
-
isQueryPathDirty
protected boolean isQueryPathDirty()Indicates whether the query path has changed since the last execution.- Returns:
- true if the query path needs to be re-evaluated
-
resolveQueryPathReferences
Resolves property references specific to the query path.- Returns:
- collection of property references used by the query path
-
isReady
protected boolean isReady()Description copied from class:AbstractPollingBindingIndicates whether or not the instance of the underlying implementation is ready for execution. -
isDirty
protected boolean isDirty()Description copied from class:AbstractPollingBindingIf any dependencies of the implementation have changed, this method should return true, which will kick off another execution if dependencies have changed while the execution was running. -
buildFetchParameters
Description copied from class:AbstractPollingBindingThis method will be called when it is time to fetch a new value. The parameter object must implement hashcode and equals, and must contain everything needed to run this parameter's fetch function. The parameter object will be given to theValueCache, which will then execute the fetch function if a new value is needed. This method will be called within a synchronized block holding this lock.- Specified by:
buildFetchParametersin classAbstractPollingBinding<QueryBindingParams>
-
startupQueryPath
protected void startupQueryPath()Hook for subclasses to perform query path-specific startup logic.Called during
AbstractPollingBinding.startup()before parameters are started up. -
shutdownQueryPath
protected void shutdownQueryPath()Hook for subclasses to perform query path-specific shutdown logic.Called during
AbstractPollingBinding.shutdown()before parameters are shut down. -
resolveReferences
- Specified by:
resolveReferencesin interfaceBinding- Overrides:
resolveReferencesin classAbstractPollingBinding<QueryBindingParams>
-
startup
public void startup()Description copied from interface:BindingStart up the binding. Will be called on-queue- Specified by:
startupin interfaceBinding- Overrides:
startupin classAbstractPollingBinding<QueryBindingParams>
-
shutdown
public void shutdown()Description copied from interface:BindingShut down the binding. Will be called on-queue- Specified by:
shutdownin interfaceBinding- Overrides:
shutdownin classAbstractPollingBinding<QueryBindingParams>
-
getParameters
protected final com.inductiveautomation.perspective.gateway.binding.query.AbstractQueryBinding.ParameterCollection getParameters()Provides access to the parameter collection for subclasses.- Returns:
- the parameter collection
-
execute
Executes a named query and returns the result as a qualified value.This method performs the actual query execution with appropriate caching and format conversion based on the provided parameters.
- Parameters:
params- the query execution parameters- Returns:
- the query result wrapped in a QualifiedValue
-