Interface TagActor

  • All Known Subinterfaces:
    HistoryActorFactory.HistoryActor, ValueGeneratingActor
    All Known Implementing Classes:
    HistoryActorFactory.ArrayHistorizer, HistoryActorFactory.AtomicHistorizer, HistoryActorFactory.DelayedAtomicHistorizer, ScalingActorFactory.ScalingActor

    public interface TagActor
    A TagActor can be thought of as part of a pipeline. When a tag read or write is performed, the tag's new value is sent thru a pipeline of TagActors. Each TagActor can act to change the value or let the value pass through as is.

    There is a single pipeline for both reading and writing. Reading causes the value to travel thru the pipeline in one direction, and writing to travel in the opposite direction. For reading, the value is passed into each configured TagActor, which can potentially modify the value. The modified value is then passed to the next tag actor in the pipeline. For writing, when a problem such as a security issue has been detected, any TagActor can cause the pipeline to abort the write. A TagActor must implement the WriteProcessor interface to be included in the write direction of the pipeline.

    Each pipeline needs to have a value actor on one end. This value actor generates a tag's value based on an external system (such as OPC or from a database), and sends that value thru the pipeline. For writes, the requested write value starts on the opposite end of the pipeline, and reaches the value actor last. The value actor is responsible for propogating the new value to the external system. A value actor is identified by registering the actor in the GatewayTagActorRegistry using an actor classification of ActorClassification.VALUE.

    Since:
    8.0
    • Method Detail

      • actorClassification

        ActorClassification actorClassification()
        The classification of this actor. A tag can only have one actor per classification.
      • initialize

        void initialize​(NodeContext context,
                        PropertySet configuration)
        Override to set up any extra configuration that is needed before the actor can process a value. It should be expected that the configuration has NOT been altered since the actor was instantiated.
      • destroy

        void destroy​(NodeContext context,
                     ShutdownReason reason)
        Override to perform cleanup for actors that have set up extra configuration to process values.
      • attemptConfiguration

        boolean attemptConfiguration​(NodeContext context,
                                     VersionedPropertySet config)
        Provides an opportunity to update the running actor on the fly. If FALSE is returned from this class, the actor will be uninitialized, and if appropriate, a new one created.

        Therefore, the implementation should also verify that the configuration is still valid for this actor.

        The config object provide is the entire configuration for the tag. However, it is provided as a Diff, which is relative to the last time configuration was attempted. This allows actors to quickly see if relevant properties have changed. Many actors will choose to simply rebuild themselves if the properties have changed, but given how often this function is called, it's important not to rebuild unnecessarily (hence, check the changed properties).

      • onPathChanged

        default boolean onPathChanged​(TagPath newPath)
        Called when path has changed, if the function returns False, the actor will be rebuilt. The default implementation returns true, because the majority of actors don't care about the path.
      • onLeasedChanged

        default void onLeasedChanged​(boolean isLeased)
        Called when the lease state of the tag changes.
      • processValue

        QualifiedValue processValue​(QualifiedValue value)
        The value is generated by the source actor and then passed along to the next actor. If the return is null, the value change will be cancelled.
      • addBrowseTraits

        default void addBrowseTraits​(NodeDescription.NodeDescriptionBuilder desc)
        Gives the actor a chance to report NodeAttribute traits for the tag it belongs to. NodeAttributes are registered in the designer in order to modify the display of browse nodes.