java.lang.Object
com.inductiveautomation.perspective.gateway.binding.AbstractPollingBinding<QueryBindingParams>
com.inductiveautomation.perspective.gateway.binding.query.DirectQueryBinding
All Implemented Interfaces:
QueryBindingConstants, Binding

public class DirectQueryBinding extends AbstractPollingBinding<QueryBindingParams>
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.

  • Field Details

  • Method Details

    • getQueryPathForListener

      protected String 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

      protected Collection<PropertyReference> 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: AbstractPollingBinding
      Indicates whether or not the instance of the underlying implementation is ready for execution.
    • isDirty

      protected boolean isDirty()
      Description copied from class: AbstractPollingBinding
      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.
    • buildFetchParameters

      protected QueryBindingParams buildFetchParameters()
      Description copied from class: AbstractPollingBinding
      This 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 the ValueCache, 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:
      buildFetchParameters in class AbstractPollingBinding<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

      public Collection<PropertyReference> resolveReferences()
      Specified by:
      resolveReferences in interface Binding
      Overrides:
      resolveReferences in class AbstractPollingBinding<QueryBindingParams>
    • startup

      public void startup()
      Description copied from interface: Binding
      Start up the binding. Will be called on-queue
      Specified by:
      startup in interface Binding
      Overrides:
      startup in class AbstractPollingBinding<QueryBindingParams>
    • shutdown

      public void shutdown()
      Description copied from interface: Binding
      Shut down the binding. Will be called on-queue
      Specified by:
      shutdown in interface Binding
      Overrides:
      shutdown in class AbstractPollingBinding<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

      public static QualifiedValue execute(QueryBindingParams params)
      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