Package sg.dex.starfish.impl.remote
Class RemoteDataAsset
- java.lang.Object
-
- sg.dex.starfish.impl.AAsset
-
- sg.dex.starfish.impl.remote.ARemoteAsset
-
- sg.dex.starfish.impl.remote.RemoteDataAsset
-
public class RemoteDataAsset extends ARemoteAsset implements DataAsset
Class representing a data asset managed via a remote agent. *- Version:
- 0.5
- Author:
- Mike
-
-
Field Summary
-
Fields inherited from class sg.dex.starfish.impl.remote.ARemoteAsset
remoteAgent
-
Fields inherited from class sg.dex.starfish.impl.AAsset
id, metadataString
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
RemoteDataAsset(String meta, RemoteAgent remoteAgent)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static RemoteDataAsset
create(RemoteAgent agent, String meta)
Creates a RemoteAsset with the given metadata on the specified remote agentlong
getContentSize()
Gets the size of this data asset's contentInputStream
getContentStream()
Gets raw data corresponding to this AssetDID
getDID()
Gets the DID for this asset.Map<String,Object>
getParamValue()
Gets the representation of this asset as required to pass to a remote invokable service.boolean
isDataAsset()
Returns true if this asset is a data asset, i.e.-
Methods inherited from class sg.dex.starfish.impl.AAsset
getAssetID, getMetadata, getMetadataString, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface sg.dex.starfish.Asset
getAssetID, getContent, getMetadata, getMetadataString, isBundle, isOperation
-
Methods inherited from interface sg.dex.starfish.DataAsset
getContentHash, includeContentHash, updateMeta, validateContentHash
-
-
-
-
Constructor Detail
-
RemoteDataAsset
protected RemoteDataAsset(String meta, RemoteAgent remoteAgent)
-
-
Method Detail
-
create
public static RemoteDataAsset create(RemoteAgent agent, String meta)
Creates a RemoteAsset with the given metadata on the specified remote agent- Parameters:
agent
- RemoteAgent on which to create the RemoteAssetmeta
- Asset metadata which must be a valid JSON string- Returns:
- RemoteAsset
-
isDataAsset
public boolean isDataAsset()
Description copied from interface:Asset
Returns true if this asset is a data asset, i.e. the asset represents an immutable data object.- Specified by:
isDataAsset
in interfaceAsset
- Specified by:
isDataAsset
in interfaceDataAsset
- Returns:
- true if the asset is a data asset, false otherwise
-
getContentStream
public InputStream getContentStream()
Gets raw data corresponding to this Asset- Specified by:
getContentStream
in interfaceAsset
- Specified by:
getContentStream
in interfaceDataAsset
- Returns:
- An input stream allowing consumption of the asset data
- Throws:
AuthorizationException
- if requestor does not have access permissionStorageException
- if unable to load the Asset
-
getContentSize
public long getContentSize()
Description copied from interface:DataAsset
Gets the size of this data asset's content- Specified by:
getContentSize
in interfaceDataAsset
- Returns:
- The size of the asset in bytes
-
getParamValue
public Map<String,Object> getParamValue()
Description copied from interface:Asset
Gets the representation of this asset as required to pass to a remote invokable service.- Specified by:
getParamValue
in interfaceAsset
- Overrides:
getParamValue
in classAAsset
- Returns:
- A map representing this asset
-
getDID
public DID getDID()
Description copied from interface:Asset
Gets the DID for this asset. The DID may include a DID path to specify the precise asset if the DID refers to an agent managing the asset. Throws an exception if a DID is not available or cannot be constructed.- Specified by:
getDID
in interfaceAsset
- Overrides:
getDID
in classAAsset
- Returns:
- The global DID for this asset.
- See Also:
- W3C DID spec
-
-