Interface ProtocolAssetService


public interface ProtocolAssetService
Interface for protocols to perform limited asset related operations within their own realm
  • Method Details

    • mergeAsset

      <T extends 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 Asset<?>> T findAsset(String assetId)
      Get asset from the store by ID.
    • findAssets

      List<Asset<?>> findAssets(AssetQuery assetQuery)
      Get assets by an AssetQuery; can only access Assets that are within the same realm as the Agent.
    • sendAttributeEvent

      void sendAttributeEvent(AttributeEvent attributeEvent)
      Send an AttributeEvent through the system
    • subscribeChildAssetChange

      void subscribeChildAssetChange(Consumer<PersistenceEvent<Asset<?>>> assetChangeConsumer)
      Subscribe to changes of Assets that are descendants of the 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(Consumer<PersistenceEvent<Asset<?>>> assetChangeConsumer)
      Unsubscribe to changes of Assets that are descendants of the agent.

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