Interface ProtocolAssetService

All Superinterfaces:
org.openremote.model.ContainerService

public interface ProtocolAssetService extends org.openremote.model.ContainerService
Interface for protocols to perform limited asset related operations.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
    Options when merging and storing assets from protocols.
  • Field Summary

    Fields inherited from interface org.openremote.model.ContainerService

    DEFAULT_PRIORITY, HIGH_PRIORITY, LOW_PRIORITY, MED_PRIORITY
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    deleteAssets(String... assetIds)
    Protocols may remove assets from the context store.
    <T extends org.openremote.model.asset.Asset<?>>
    T
    findAsset(String assetId)
    Get asset from the store by ID.
    <T extends org.openremote.model.asset.Asset<?>>
    T
    findAsset(String assetId, Class<T> assetType)
    Get asset of specified type from the store by ID.
    List<org.openremote.model.asset.Asset<?>>
    findAssets(String assetId, org.openremote.model.query.AssetQuery assetQuery)
    Get assets by an AssetQuery; can only access Assets that are descendants of the specified Asset
    <T extends org.openremote.model.asset.Asset<?>>
    T
    mergeAsset(T asset)
    Protocols may store assets in the context or update existing assets.
    void
    sendAttributeEvent(org.openremote.model.attribute.AttributeEvent attributeEvent)
    Protocols can send arbitrary attribute change events for regular processing.
    void
    subscribeChildAssetChange(String agentId, Consumer<org.openremote.model.PersistenceEvent<org.openremote.model.asset.Asset<?>>> assetChangeConsumer)
    Subscribe to changes of Assets that are descendants of the specified agent.
    void
    unsubscribeChildAssetChange(String agentId, Consumer<org.openremote.model.PersistenceEvent<org.openremote.model.asset.Asset<?>>> assetChangeConsumer)
    Unsubscribe from asset changes for the specified agent.

    Methods inherited from interface org.openremote.model.ContainerService

    getPriority, init, start, stop
  • Method Details

    • mergeAsset

      <T extends org.openremote.model.asset.Asset<?>> T mergeAsset(T asset)
      Protocols may store assets in the context or update existing assets. A unique identifier must be set by the protocol implementor, and the parent must be the Agent associated with the requesting protocol instance. This operation stores transient or detached state and returns the current state. It will override any existing stored asset data, ignoring versions.
    • deleteAssets

      boolean deleteAssets(String... assetIds)
      Protocols may remove assets from the context store.
      Returns:
      false if the delete could not be performed (asset may have children?)
    • findAsset

      <T extends org.openremote.model.asset.Asset<?>> T findAsset(String assetId, Class<T> assetType)
      Get asset of specified type from the store by ID.
    • findAsset

      <T extends org.openremote.model.asset.Asset<?>> T findAsset(String assetId)
      Get asset from the store by ID.
    • findAssets

      List<org.openremote.model.asset.Asset<?>> findAssets(String assetId, org.openremote.model.query.AssetQuery assetQuery)
      Get assets by an AssetQuery; can only access Assets that are descendants of the specified Asset
    • sendAttributeEvent

      void sendAttributeEvent(org.openremote.model.attribute.AttributeEvent attributeEvent)
      Protocols can send arbitrary attribute change events for regular processing.
    • subscribeChildAssetChange

      void subscribeChildAssetChange(String agentId, Consumer<org.openremote.model.PersistenceEvent<org.openremote.model.asset.Asset<?>>> assetChangeConsumer)
      Subscribe to changes of Assets that are descendants of the specified agent.

      When an agent is unlinked from a protocol then all subscriptions will be automatically removed also; it is safe to call this method multiple times for the same agentId and assetChangeConsumer and only a single subscription would actually be created.

    • unsubscribeChildAssetChange

      void unsubscribeChildAssetChange(String agentId, Consumer<org.openremote.model.PersistenceEvent<org.openremote.model.asset.Asset<?>>> assetChangeConsumer)
      Unsubscribe from asset changes for the specified agent.

      When an agent is unlinked from a protocol then all subscriptions will be automatically removed also.