Package io.keyko.nevermined.manager
Class ConditionsManager
- java.lang.Object
-
- io.keyko.nevermined.manager.BaseManager
-
- io.keyko.nevermined.manager.ConditionsManager
-
public class ConditionsManager 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 ConditionsManager(io.keyko.common.web3.KeeperService keeperService, MetadataApiService metadataApiService)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ConditionsManagergetInstance(io.keyko.common.web3.KeeperService keeperService, MetadataApiService metadataApiService)Given the KeeperService and MetadataApiService, returns a new instance of ConditionsManager using them as attributesBooleangrantAccess(String agreementId, DID did, String granteeAddress)Grant access to an address to consume a did.BooleangrantCompute(String agreementId, DID did, String granteeAddress)Grant compute to an address.BooleanlockReward(String agreementId, BigInteger amount)Lock reward for a service agreement.BooleanrefundReward(String agreementId, BigInteger amount)Refund the price in case that some of the step was wrong.BooleanreleaseReward(String agreementId, BigInteger amount)Release reward to the address after the access was granted.-
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
-
ConditionsManager
public ConditionsManager(io.keyko.common.web3.KeeperService keeperService, MetadataApiService metadataApiService)
-
-
Method Detail
-
getInstance
public static ConditionsManager getInstance(io.keyko.common.web3.KeeperService keeperService, MetadataApiService metadataApiService)
Given the KeeperService and MetadataApiService, returns a new instance of ConditionsManager using them as attributes- Parameters:
keeperService- Keeper DtometadataApiService- Provider Dto- Returns:
- ConditionsManager
-
lockReward
public Boolean lockReward(String agreementId, BigInteger amount) throws Exception
Lock reward for a service agreement.- Parameters:
agreementId- the agreement id.amount- the amount to be locked.- Returns:
- a flag true if was executed successfully.
- Throws:
Exception- exception
-
grantAccess
public Boolean grantAccess(String agreementId, DID did, String granteeAddress) throws Exception
Grant access to an address to consume a did.- Parameters:
agreementId- the agreement id.did- the did.granteeAddress- an eth address.- Returns:
- a flag true if was executed successfully.
- Throws:
Exception- exception
-
grantCompute
public Boolean grantCompute(String agreementId, DID did, String granteeAddress) throws Exception
Grant compute to an address.- Parameters:
agreementId- the agreement id.did- the did.granteeAddress- an eth address.- Returns:
- a flag true if was executed successfully.
- Throws:
Exception- exception
-
releaseReward
public Boolean releaseReward(String agreementId, BigInteger amount) throws Exception
Release reward to the address after the access was granted.- Parameters:
agreementId- the agreement id.amount- the price.- Returns:
- a flag true if was executed successfully.
- Throws:
Exception- exception
-
refundReward
public Boolean refundReward(String agreementId, BigInteger amount) throws Exception
Refund the price in case that some of the step was wrong.- Parameters:
agreementId- the agreement id.amount- the price.- Returns:
- a flag true if was executed successfully.
- Throws:
Exception- exception
-
-