Package io.keyko.nevermined.manager
Class AgreementsManager
- java.lang.Object
-
- io.keyko.nevermined.manager.BaseManager
-
- io.keyko.nevermined.manager.AgreementsManager
-
public class AgreementsManager extends BaseManager
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.keyko.nevermined.manager.BaseManager
BaseManager.ContractAddresses
-
-
Field Summary
Fields Modifier and Type Field Description private static org.apache.logging.log4j.Loggerlog-
Fields inherited from class io.keyko.nevermined.manager.BaseManager
accessSecretStoreCondition, agreementStoreManager, computeExecutionCondition, condition, conditionStoreManager, config, contractAddresses, didRegistry, dispenser, escrowAccessSecretStoreTemplate, escrowComputeExecutionTemplate, escrowReward, lockRewardCondition, mainAccount, providerAddress, templateStoreManager, tokenContract
-
-
Constructor Summary
Constructors Constructor Description AgreementsManager(io.keyko.common.web3.KeeperService keeperService, MetadataApiService metadataApiService)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BooleancreateAccessAgreement(String agreementId, DDO ddo, List<byte[]> conditionIds, String accessConsumer, Service service)Create an agreement using the escrowAccessSecretStoreTemplate.BooleancreateComputeAgreement(String agreementId, DDO ddo, List<byte[]> conditionIds, String accessConsumer, Service service)Create an agreement using the escrowComputeExecutionTemplate.private List<DID>getAccessAgreementsFulfilledByConsumer(String consumerAddress)AgreementgetAgreement(String agreementId)Retrieve the agreement for a agreement_id.private List<DID>getComputeAgreementsFulfilledByConsumer(String consumerAddress)private StringgetConditionNameByAddress(String address)Auxiliar method to get the name of the different conditions address.List<DID>getConsumerAssets(String consumerAddress)List of Asset objects purchased by consumerAddressstatic AgreementsManagergetInstance(io.keyko.common.web3.KeeperService keeperService, MetadataApiService metadataApiService)Given the KeeperService and MetadataApiService, returns a new instance of AgreementsManager using them as attributesAgreementStatusgetStatus(String agreementId)Get the status of a service agreement.-
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
-
AgreementsManager
public AgreementsManager(io.keyko.common.web3.KeeperService keeperService, MetadataApiService metadataApiService)
-
-
Method Detail
-
getInstance
public static AgreementsManager getInstance(io.keyko.common.web3.KeeperService keeperService, MetadataApiService metadataApiService)
Given the KeeperService and MetadataApiService, returns a new instance of AgreementsManager using them as attributes- Parameters:
keeperService- Keeper DtometadataApiService- Provider Dto- Returns:
- AgreementsManager
-
createAccessAgreement
public Boolean createAccessAgreement(String agreementId, DDO ddo, List<byte[]> conditionIds, String accessConsumer, Service service) throws Exception
Create an agreement using the escrowAccessSecretStoreTemplate. This method should be more specific in the future when we have more than one template.- Parameters:
agreementId- the agreement idddo- the ddoconditionIds- list with the conditions idsaccessConsumer- eth address of the consumer of the agreement.service- an instance of Service- Returns:
- a flag that is true if the agreement was successfully created.
- Throws:
Exception- exception
-
createComputeAgreement
public Boolean createComputeAgreement(String agreementId, DDO ddo, List<byte[]> conditionIds, String accessConsumer, Service service) throws Exception
Create an agreement using the escrowComputeExecutionTemplate. This method should be more specific in the future when we have more than one template.- Parameters:
agreementId- the agreement idddo- the ddoconditionIds- list with the conditions idsaccessConsumer- eth address of the consumer of the agreement.service- an instance of Service- Returns:
- a flag that is true if the agreement was successfully created.
- Throws:
Exception- exception
-
getAgreement
public Agreement getAgreement(String agreementId) throws Exception
Retrieve the agreement for a agreement_id.- Parameters:
agreementId- id of the agreement- Returns:
- Agreement
- Throws:
Exception- Exception
-
getStatus
public AgreementStatus getStatus(String agreementId) throws Exception
Get the status of a service agreement.- Parameters:
agreementId- id of the agreement- Returns:
- AgreementStatus with condition status of each of the agreement's conditions.
- Throws:
Exception- Exception
-
getConditionNameByAddress
private String getConditionNameByAddress(String address) throws Exception
Auxiliar method to get the name of the different conditions address.- Parameters:
address- contract address- Returns:
- string
- Throws:
Exception- exception
-
getAccessAgreementsFulfilledByConsumer
private List<DID> getAccessAgreementsFulfilledByConsumer(String consumerAddress) throws ServiceException
- Throws:
ServiceException
-
getComputeAgreementsFulfilledByConsumer
private List<DID> getComputeAgreementsFulfilledByConsumer(String consumerAddress) throws ServiceException
- Throws:
ServiceException
-
getConsumerAssets
public List<DID> getConsumerAssets(String consumerAddress) throws ServiceException
List of Asset objects purchased by consumerAddress- Parameters:
consumerAddress- ethereum address of consumer- Returns:
- list of dids
- Throws:
ServiceException- ServiceException
-
-