Package sg.dex.starfish
Interface Agent
-
- All Known Implementing Classes:
AAgent
,MemoryAgent
,RemoteAgent
,SquidAgent
public interface Agent
Interface representing an Agent in the Ocean ecosystem- Version:
- 0.5
- Author:
- Mike
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <R extends Asset>
RgetAsset(String id)
Gets an asset for the given asset ID from this agent.<R extends Asset>
RgetAsset(DID did)
Gets an asset for the given asset DID from this agent.Map<String,Object>
getDDO()
Gets the DDO for the agentDID
getDID()
Gets the DID for an Agent<R extends Asset>
RregisterAsset(String metaString)
Registers asset metadata with this agent.<R extends Asset>
RregisterAsset(Asset asset)
Registers an asset with this agent.<R extends Asset>
RuploadAsset(Asset a)
Uploads an asset to this agent.
-
-
-
Method Detail
-
getDDO
Map<String,Object> getDDO()
Gets the DDO for the agent- Returns:
- The DDO of the agent as a metadata Map
-
getDID
DID getDID()
Gets the DID for an Agent- Returns:
- DID The DID that can be used to address this agent in the Ocean Ecosystem
-
registerAsset
<R extends Asset> R registerAsset(Asset asset)
Registers an asset with this agent. The agent must support metadata storage.- Parameters:
asset
- The asset to register- Returns:
- Asset
- Throws:
AuthorizationException
- if requester does not have register permissionUnsupportedOperationException
- if the agent does not support metadata storage
-
registerAsset
<R extends Asset> R registerAsset(String metaString)
Registers asset metadata with this agent. The agent must support metadata storage.- Parameters:
asset
- The asset to register- Returns:
- Asset
- Throws:
AuthorizationException
- if requester does not have register permissionUnsupportedOperationException
- if the agent does not support metadata storage
-
getAsset
<R extends Asset> R getAsset(String id)
Gets an asset for the given asset ID from this agent. Returns null if the asset ID does not exist in the context of the agent- Parameters:
id
- The ID of the asset to get from this agent- Returns:
- Asset The asset found, or null if the agent does not have the specified asset
-
getAsset
<R extends Asset> R getAsset(DID did)
Gets an asset for the given asset DID from this agent. Returns null if the asset not exist.- Parameters:
did
- The DID of the asset to get from this agent- Returns:
- Asset The asset found, or null if not found
- Throws:
AuthorizationException
- if requester does not have access permissionStorageException
- if there is an error in retrieving the Asset
-
uploadAsset
<R extends Asset> R uploadAsset(Asset a)
Uploads an asset to this agent. Registers the asset with the agent if required.Throws an exception if upload is not possible, with the following likely causes: - The agent does not support uploads of this asset type / size - The data for the asset cannot be accessed by the agent
- Parameters:
a
- Asset to upload- Returns:
- Asset An asset stored on the agent if the upload is successful
- Throws:
AuthorizationException
- if requester does not have upload permissionStorageException
- if there is an error in uploading the Asset
-
-