Package com.oceanprotocol.squid.manager
Class ConditionsManager
- java.lang.Object
-
- com.oceanprotocol.squid.manager.BaseManager
-
- com.oceanprotocol.squid.manager.ConditionsManager
-
public class ConditionsManager extends BaseManager
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.oceanprotocol.squid.manager.BaseManager
BaseManager.ContractAddresses
-
-
Field Summary
Fields Modifier and Type Field Description private static org.apache.logging.log4j.Logger
log
-
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 ConditionsManager(KeeperService keeperService, AquariusService aquariusService)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ConditionsManager
getInstance(KeeperService keeperService, AquariusService aquariusService)
Given the KeeperService and AquariusService, returns a new instance of ConditionsManager using them as attributesBoolean
grantAccess(String agreementId, DID did, String granteeAddress)
Grant access to an address to consume a did.Boolean
lockReward(String agreementId, BigInteger amount)
Lock reward for a service agreement.Boolean
refundReward(String agreementId, BigInteger amount)
Refund the price in case that some of the step was wrong.Boolean
releaseReward(String agreementId, BigInteger amount)
Release reward to the address after the access was granted.-
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
-
ConditionsManager
public ConditionsManager(KeeperService keeperService, AquariusService aquariusService)
-
-
Method Detail
-
getInstance
public static ConditionsManager getInstance(KeeperService keeperService, AquariusService aquariusService)
Given the KeeperService and AquariusService, returns a new instance of ConditionsManager using them as attributes- Parameters:
keeperService
- Keeper DtoaquariusService
- 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
-
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
-
-