Package io.keyko.nevermined.manager
Class AssetsManager
- java.lang.Object
-
- io.keyko.nevermined.manager.BaseManager
-
- io.keyko.nevermined.manager.AssetsManager
-
public class AssetsManager extends BaseManager
Manages the functionality related with Assets
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.keyko.nevermined.manager.BaseManager
BaseManager.ContractAddresses
-
-
Field Summary
-
Fields inherited from class io.keyko.nevermined.manager.BaseManager
accessSecretStoreCondition, agreementStoreManager, computeExecutionCondition, condition, conditionStoreManager, config, contractAddresses, didRegistry, dispenser, escrowAccessSecretStoreTemplate, escrowComputeExecutionTemplate, escrowReward, lockRewardCondition, log, mainAccount, providerAddress, templateStoreManager, tokenContract
-
-
Constructor Summary
Constructors Constructor Description AssetsManager(io.keyko.common.web3.KeeperService keeperService, MetadataApiService metadataApiService)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BooleandeleteAsset(DID did)Retire the asset ddo from Metadata Api.DDOgetByDID(String id)Gets a DDO from the DIDStringgetDIDOwner(DID did)Get the owner of a did already registered.static AssetsManagergetInstance(io.keyko.common.web3.KeeperService keeperService, MetadataApiService metadataApiService)Gets an instance of AssetManagerList<DID>getOwnerAssets(String ownerAddress)List of Asset objects published by ownerAddressBooleangetPermission(DID did, String subjectAddress)BooleangrantPermission(DID did, String subjectAddress)DDOpublishMetadata(DDO ddo)Publishes in Metadata Api the metadata of a DDOBooleanrevokePermission(DID did, String subjectAddress)revoke the permission over an DID for a subject addressSearchResultsearchAssets(String text, int offset, int page)Gets all the DDOs that match the search criteriaSearchResultsearchAssets(Map<String,Object> params, int offset, int page, int sort)Gets all the DDOs that match the parameters of the queryBooleantransferOwnership(DID did, String newOwnerAddress)Transfer the ownsership of a DIDbooleanupdateMetadata(String id, DDO ddo)Updates the metadata of a DDOBooleanvalidateMetadata(AssetMetadata metadata)Check that the metadata has a valid formUrl.-
Methods inherited from class io.keyko.nevermined.manager.BaseManager
buildDDO, getAccessSecretStoreCondition, getComputeExecutionCondition, getContractAddresses, getDecriptedSecretStoreMetadataFiles, getDecriptedSecretStoreMetadataFiles, getEscrowComputeExecutionTemplate, getEscrowReward, getEvmDto, getKeeperService, getLockRewardCondition, getMainAccount, getMetadataApiService, getProviderAddress, getSecretStoreDto, getSecretStoreManager, getTemplateIdByName, resolveDID, setAccessSecretStoreCondition, setAgreementStoreManagerContract, setComputeExecutionCondition, setConditionStoreManagerContract, setDidRegistryContract, setDispenserContract, setEscrowAccessSecretStoreTemplate, setEscrowComputeExecutionTemplate, setEscrowReward, setEvmDto, setKeeperService, setLockRewardCondition, setMainAccount, setMetadataApiService, setProviderAddress, setSecretStoreDto, setSecretStoreManager, setTemplateStoreManagerContract, setTokenContract, tokenApprove, toString
-
-
-
-
Constructor Detail
-
AssetsManager
public AssetsManager(io.keyko.common.web3.KeeperService keeperService, MetadataApiService metadataApiService)
-
-
Method Detail
-
getInstance
public static AssetsManager getInstance(io.keyko.common.web3.KeeperService keeperService, MetadataApiService metadataApiService)
Gets an instance of AssetManager- Parameters:
keeperService- instance of keeperServicemetadataApiService- instance of MetadataApiService- Returns:
- an initialized instance of AssetManager
-
publishMetadata
public DDO publishMetadata(DDO ddo) throws Exception
Publishes in Metadata Api the metadata of a DDO- Parameters:
ddo- the DDO to publish- Returns:
- the published DDO
- Throws:
Exception- if Metadata Api service fails publishing the DDO
-
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 Metadata Api 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 Metadata Api 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 Metadata Api.- 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 formUrl.- Parameters:
metadata- the metadata of the DDO- Returns:
- a flag that indicates if the metadata is valid
- Throws:
DDOException- DDOException
-
getDIDOwner
public String getDIDOwner(DID did) throws Exception
Get the owner of a did already registered.- Parameters:
did- the did- Returns:
- owner address
- Throws:
Exception- Exception
-
getOwnerAssets
public List<DID> getOwnerAssets(String ownerAddress) throws ServiceException
List of Asset objects published by ownerAddress- Parameters:
ownerAddress- ethereum address of owner/publisher- Returns:
- list of dids
- Throws:
ServiceException- ServiceException
-
transferOwnership
public Boolean transferOwnership(DID did, String newOwnerAddress) throws DDOException
Transfer the ownsership of a DID- Parameters:
did- the didnewOwnerAddress- the address of the new owner- Returns:
- a flag indicates if the operation has been executed correctly
- Throws:
DDOException- DDOException
-
grantPermission
public Boolean grantPermission(DID did, String subjectAddress) throws DDOException
- Throws:
DDOException
-
revokePermission
public Boolean revokePermission(DID did, String subjectAddress) throws DDOException
revoke the permission over an DID for a subject address- Parameters:
did- the didsubjectAddress- the address- Returns:
- a flag indicates if the operation has been executed correctly
- Throws:
DDOException- DDOException
-
getPermission
public Boolean getPermission(DID did, String subjectAddress) throws DDOException
- Throws:
DDOException
-
-