Package com.oceanprotocol.squid.manager
Class AssetsManager
- java.lang.Object
-
- com.oceanprotocol.squid.manager.BaseManager
-
- com.oceanprotocol.squid.manager.AssetsManager
-
public class AssetsManager extends BaseManager
Manages the functionality related with Assets
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.oceanprotocol.squid.manager.BaseManager
BaseManager.ContractAddresses
-
-
Field Summary
-
Fields inherited from class com.oceanprotocol.squid.manager.BaseManager
accessSecretStoreCondition, agreementStoreManager, conditionStoreManager, config, contractAddresses, didRegistry, dispenser, escrowAccessSecretStoreTemplate, escrowReward, lockRewardCondition, mainAccount, providerAddress, templateStoreManager, tokenContract
-
-
Constructor Summary
Constructors Constructor Description AssetsManager(KeeperService keeperService, AquariusService aquariusService)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Boolean
deleteAsset(DID did)
Retire the asset ddo from Aquarius.DDO
getByDID(String id)
Gets a DDO from the DIDstatic AssetsManager
getInstance(KeeperService keeperService, AquariusService aquariusService)
Gets an instance of AssetManagerDDO
publishMetadata(AssetMetadata metadata, String serviceEndpoint)
Publishes in Aquarius the metadata of a DDODDO
publishMetadata(DDO ddo)
Publishes in Aquarius the metadata of a DDOSearchResult
searchAssets(String text, int offset, int page)
Gets all the DDOs that match the search criteriaSearchResult
searchAssets(Map<String,Object> params, int offset, int page, int sort)
Gets all the DDOs that match the parameters of the queryboolean
updateMetadata(String id, DDO ddo)
Updates the metadata of a DDOBoolean
validateMetadata(AssetMetadata metadata)
Check that the metadata has a valid format.-
Methods inherited from class com.oceanprotocol.squid.manager.BaseManager
buildDDO, buildDDO, getAccessSecretStoreCondition, getAquariusService, getContractAddresses, getEscrowReward, getEvmDto, getKeeperService, getLockRewardCondition, getMainAccount, getMetadataFiles, getProviderAddress, getSecretStoreDto, getSecretStoreManager, setAccessSecretStoreCondition, setAgreementStoreManagerContract, setAquariusService, setConditionStoreManagerContract, setDidRegistryContract, setDispenserContract, setEscrowAccessSecretStoreTemplate, setEscrowReward, setEvmDto, setKeeperService, setLockRewardCondition, setMainAccount, setProviderAddress, setSecretStoreDto, setSecretStoreManager, setTemplateStoreManagerContract, setTokenContract, toString
-
-
-
-
Constructor Detail
-
AssetsManager
public AssetsManager(KeeperService keeperService, AquariusService aquariusService)
-
-
Method Detail
-
getInstance
public static AssetsManager getInstance(KeeperService keeperService, AquariusService aquariusService)
Gets an instance of AssetManager- Parameters:
keeperService
- instance of keeperServiceaquariusService
- instance of aquariusService- Returns:
- an initialized instance of AssetManager
-
publishMetadata
public DDO publishMetadata(DDO ddo) throws Exception
Publishes in Aquarius the metadata of a DDO- Parameters:
ddo
- the DDO to publish- Returns:
- the published DDO
- Throws:
Exception
- if Aquarius service fails publishing the DDO
-
publishMetadata
public DDO publishMetadata(AssetMetadata metadata, String serviceEndpoint) throws Exception
Publishes in Aquarius the metadata of a DDO- Parameters:
metadata
- the metadata of the DDOserviceEndpoint
- the endpoint of the service- Returns:
- the published DDO
- Throws:
Exception
- if Aquarius service fails publishing the metadata
-
getByDID
public DDO getByDID(String id) throws Exception
Gets a DDO from the DID- Parameters:
id
- the did of the DDO- Returns:
- an instance of the DDO represented by the DID
- Throws:
Exception
- if Aquarius service fails publishing the metadata
-
updateMetadata
public boolean updateMetadata(String id, DDO ddo) throws Exception
Updates the metadata of a DDO- Parameters:
id
- the did of the DDOddo
- the DDO- Returns:
- A flag that indicates if the update was executed correctly
- Throws:
Exception
- if Aquarius service fails updating the metadata
-
searchAssets
public SearchResult searchAssets(String text, int offset, int page) throws DDOException
Gets all the DDOs that match the search criteria- Parameters:
text
- contains the criteriaoffset
- parameter to paginate the resultspage
- parameter to paginate the results- Returns:
- SearchResult including the list of DDOs
- Throws:
DDOException
- if Aquairus fails searching the assets
-
searchAssets
public SearchResult searchAssets(Map<String,Object> params, int offset, int page, int sort) throws DDOException
Gets all the DDOs that match the parameters of the query- Parameters:
params
- contains the criteriaoffset
- parameter to paginate the resultspage
- parameter to paginate the resultssort
- parameter to sort the results- Returns:
- a List with all the DDOs found
- Throws:
DDOException
- if Aquairus fails searching the assets
-
deleteAsset
public Boolean deleteAsset(DID did) throws DDOException
Retire the asset ddo from Aquarius.- Parameters:
did
- the did- Returns:
- a flag that indicates if the retire operation was executed correctly
- Throws:
DDOException
- DDOException
-
validateMetadata
public Boolean validateMetadata(AssetMetadata metadata) throws DDOException
Check that the metadata has a valid format.- Parameters:
metadata
- the metadata of the DDO- Returns:
- a flag that indicates if the metadata is valid
- Throws:
DDOException
- DDOException
-
-