Package org.openremote.agent.protocol
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 ClassesModifier and TypeInterfaceDescriptionstatic classOptions 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 TypeMethodDescriptionbooleandeleteAssets(String... assetIds) Protocols may remove assets from the context store.<T extends org.openremote.model.asset.Asset<?>>
TGet asset from the store by ID.<T extends org.openremote.model.asset.Asset<?>>
TGet 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 anAssetQuery; can only accessAssets that are descendants of the specifiedAsset<T extends org.openremote.model.asset.Asset<?>>
TmergeAsset(T asset) Protocols may store assets in the context or update existing assets.voidsendAttributeEvent(org.openremote.model.attribute.AttributeEvent attributeEvent) Protocols can send arbitrary attribute change events for regular processing.voidsubscribeChildAssetChange(String agentId, Consumer<org.openremote.model.PersistenceEvent<org.openremote.model.asset.Asset<?>>> assetChangeConsumer) Subscribe to changes ofAssets that are descendants of the specified agent.voidunsubscribeChildAssetChange(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 theAgentassociated 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
Protocols may remove assets from the context store.- Returns:
falseif the delete could not be performed (asset may have children?)
-
findAsset
Get asset of specified type from the store by ID. -
findAsset
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 anAssetQuery; can only accessAssets that are descendants of the specifiedAsset -
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 ofAssets 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.
-