Package io.keyko.nevermined.manager
Class BaseManager
- java.lang.Object
-
- io.keyko.nevermined.manager.BaseManager
-
- Direct Known Subclasses:
AccountsManager,AgreementsManager,AssetsManager,ConditionsManager,NeverminedManager,ProvenanceManager,TemplatesManager
public abstract class BaseManager extends Object
Abstract class for the Managers
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBaseManager.ContractAddresses
-
Field Summary
Fields Modifier and Type Field Description protected io.keyko.nevermined.contracts.AccessSecretStoreConditionaccessSecretStoreConditionprotected io.keyko.nevermined.contracts.AgreementStoreManageragreementStoreManagerprotected io.keyko.nevermined.contracts.ComputeExecutionConditioncomputeExecutionConditionprotected io.keyko.nevermined.contracts.Conditionconditionprotected io.keyko.nevermined.contracts.ConditionStoreManagerconditionStoreManagerprotected com.typesafe.config.Configconfigprotected BaseManager.ContractAddressescontractAddressesprotected io.keyko.nevermined.contracts.DIDRegistrydidRegistryprotected io.keyko.nevermined.contracts.Dispenserdispenserprotected io.keyko.nevermined.contracts.EscrowAccessSecretStoreTemplateescrowAccessSecretStoreTemplateprotected io.keyko.nevermined.contracts.EscrowComputeExecutionTemplateescrowComputeExecutionTemplateprotected io.keyko.nevermined.contracts.EscrowRewardescrowRewardprivate io.keyko.secretstore.core.EvmDtoevmDtoprivate io.keyko.common.web3.KeeperServicekeeperServiceprotected io.keyko.nevermined.contracts.LockRewardConditionlockRewardConditionprotected static org.apache.logging.log4j.Loggerlogprotected AccountmainAccountprivate static intMAX_SS_RETRIESprivate MetadataApiServicemetadataApiServiceprotected StringproviderAddressprivate io.keyko.secretstore.core.SecretStoreDtosecretStoreDtoprivate SecretStoreManagersecretStoreManagerprivate static longSS_DECRYPTION_SLEEPprotected io.keyko.nevermined.contracts.TemplateStoreManagertemplateStoreManagerprotected io.keyko.nevermined.contracts.NeverminedTokentokenContract
-
Constructor Summary
Constructors Constructor Description BaseManager(io.keyko.common.web3.KeeperService keeperService, MetadataApiService metadataApiService)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected DDObuildDDO(MetadataService metadataService, String address)StringgenerateAccessGrantToken(String serviceAgreementId, DID did)Generate the Grant Token for the Access service.StringgenerateComputeGrantToken(String serviceAgreementId, String executionId)Generate the Grant Token for the Compute service.StringgenerateDownloadGrantToken(DID did)Generat the Grant Token for the Download service.StringgenerateExecuteGrantToken(String serviceAgreementId, DID workflowDid)Generate the Grant Token for the Execute service.StringgenerateSignature(String message)io.keyko.nevermined.contracts.AccessSecretStoreConditiongetAccessSecretStoreCondition()It gets the AccessSecretStoreCondition stub instanceio.keyko.nevermined.contracts.ComputeExecutionConditiongetComputeExecutionCondition()It gets the ComputeExecutionCondition stub instanceBaseManager.ContractAddressesgetContractAddresses()List<AssetMetadata.File>getDecriptedSecretStoreMetadataFiles(DDO ddo)List<AssetMetadata.File>getDecriptedSecretStoreMetadataFiles(DDO ddo, int retries)io.keyko.nevermined.contracts.EscrowComputeExecutionTemplategetEscrowComputeExecutionTemplate()It gets the EscrowComputeExecutionTemplate stub instanceio.keyko.nevermined.contracts.EscrowRewardgetEscrowReward()It gets the EscrowReward stub instanceio.keyko.secretstore.core.EvmDtogetEvmDto()Get the EvmDtoio.keyko.common.web3.KeeperServicegetKeeperService()Get the KeeperServiceio.keyko.nevermined.contracts.LockRewardConditiongetLockRewardCondition()It gets the lockRewardCondition stub instanceAccountgetMainAccount()MetadataApiServicegetMetadataApiService()Get the MetadataApiServiceStringgetProviderAddress()io.keyko.secretstore.core.SecretStoreDtogetSecretStoreDto()Get the SecretStoreDtoprivate SecretStoreManagergetSecretStoreInstance(AuthorizationService authorizationService)SecretStoreManagergetSecretStoreManager()Get the SecretStoreManagerbyte[]getTemplateIdByName(String contractName)DDOresolveDID(DID did)Given a DID, fetch the on-chain url from the DIDRegistry.DDOresolveDIDFromEvent(DID did)Given a DID, scans the DIDRegistry events to resolve the Metadata API url and return the DDO foundBaseManagersetAccessSecretStoreCondition(io.keyko.nevermined.contracts.AccessSecretStoreCondition accessSecretStoreCondition)It sets the EscrowReward instanceBaseManagersetAgreementStoreManagerContract(io.keyko.nevermined.contracts.AgreementStoreManager contract)It sets the AgreementStoreManager stub instanceBaseManagersetComputeExecutionCondition(io.keyko.nevermined.contracts.ComputeExecutionCondition computeExecutionCondition)It sets the ComputeExecutionCondition instanceBaseManagersetConditionStoreManagerContract(io.keyko.nevermined.contracts.ConditionStoreManager contract)It sets the AgreementStoreManager stub instanceBaseManagersetDidRegistryContract(io.keyko.nevermined.contracts.DIDRegistry contract)It sets the DIDRegistry stub instanceBaseManagersetDispenserContract(io.keyko.nevermined.contracts.Dispenser contract)It sets the Dispenser stub instanceBaseManagersetEscrowAccessSecretStoreTemplate(io.keyko.nevermined.contracts.EscrowAccessSecretStoreTemplate contract)It sets the EscrowAccessSecretStoreTemplate stub instanceBaseManagersetEscrowComputeExecutionTemplate(io.keyko.nevermined.contracts.EscrowComputeExecutionTemplate escrowComputeExecutionTemplate)It sets the EscrowComputeExecutionTemplate instanceBaseManagersetEscrowReward(io.keyko.nevermined.contracts.EscrowReward escrowReward)It sets the EscrowReward instanceBaseManagersetEvmDto(io.keyko.secretstore.core.EvmDto evmDto)Set the EvmDto necessary to stablish the encryption/decryption flow necessary by Secret StoreBaseManagersetKeeperService(io.keyko.common.web3.KeeperService keeperService)Set the KeeperServiceBaseManagersetLockRewardCondition(io.keyko.nevermined.contracts.LockRewardCondition lockRewardCondition)It sets the LockRewardCondition instanceBaseManagersetMainAccount(Account mainAccount)BaseManagersetMetadataApiService(MetadataApiService metadataApiService)Set the MetadataApiServiceBaseManagersetProviderAddress(String providerAddress)BaseManagersetSecretStoreDto(io.keyko.secretstore.core.SecretStoreDto secretStoreDto)Set the SecretStoreDtoBaseManagersetSecretStoreManager(SecretStoreManager secretStoreManager)Set the SecretStoreManagerBaseManagersetTemplateStoreManagerContract(io.keyko.nevermined.contracts.TemplateStoreManager contract)It sets the NeverminedToken stub instanceBaseManagersetTokenContract(io.keyko.nevermined.contracts.NeverminedToken contract)It sets the NeverminedToken stub instancebooleantokenApprove(io.keyko.nevermined.contracts.NeverminedToken tokenContract, String spenderAddress, String price)StringtoString()
-
-
-
Field Detail
-
log
protected static final org.apache.logging.log4j.Logger log
-
MAX_SS_RETRIES
private static final int MAX_SS_RETRIES
- See Also:
- Constant Field Values
-
SS_DECRYPTION_SLEEP
private static final long SS_DECRYPTION_SLEEP
- See Also:
- Constant Field Values
-
keeperService
private io.keyko.common.web3.KeeperService keeperService
-
metadataApiService
private MetadataApiService metadataApiService
-
secretStoreDto
private io.keyko.secretstore.core.SecretStoreDto secretStoreDto
-
evmDto
private io.keyko.secretstore.core.EvmDto evmDto
-
secretStoreManager
private SecretStoreManager secretStoreManager
-
tokenContract
protected io.keyko.nevermined.contracts.NeverminedToken tokenContract
-
dispenser
protected io.keyko.nevermined.contracts.Dispenser dispenser
-
didRegistry
protected io.keyko.nevermined.contracts.DIDRegistry didRegistry
-
lockRewardCondition
protected io.keyko.nevermined.contracts.LockRewardCondition lockRewardCondition
-
escrowReward
protected io.keyko.nevermined.contracts.EscrowReward escrowReward
-
accessSecretStoreCondition
protected io.keyko.nevermined.contracts.AccessSecretStoreCondition accessSecretStoreCondition
-
templateStoreManager
protected io.keyko.nevermined.contracts.TemplateStoreManager templateStoreManager
-
escrowAccessSecretStoreTemplate
protected io.keyko.nevermined.contracts.EscrowAccessSecretStoreTemplate escrowAccessSecretStoreTemplate
-
agreementStoreManager
protected io.keyko.nevermined.contracts.AgreementStoreManager agreementStoreManager
-
conditionStoreManager
protected io.keyko.nevermined.contracts.ConditionStoreManager conditionStoreManager
-
computeExecutionCondition
protected io.keyko.nevermined.contracts.ComputeExecutionCondition computeExecutionCondition
-
escrowComputeExecutionTemplate
protected io.keyko.nevermined.contracts.EscrowComputeExecutionTemplate escrowComputeExecutionTemplate
-
condition
protected io.keyko.nevermined.contracts.Condition condition
-
contractAddresses
protected BaseManager.ContractAddresses contractAddresses
-
config
protected com.typesafe.config.Config config
-
mainAccount
protected Account mainAccount
-
providerAddress
protected String providerAddress
-
-
Constructor Detail
-
BaseManager
public BaseManager(io.keyko.common.web3.KeeperService keeperService, MetadataApiService metadataApiService)Constructor- Parameters:
keeperService- KeeperServicemetadataApiService- MetadataApiService
-
-
Method Detail
-
getSecretStoreInstance
private SecretStoreManager getSecretStoreInstance(AuthorizationService authorizationService)
-
buildDDO
protected DDO buildDDO(MetadataService metadataService, String address) throws DDOException
- Throws:
DDOException
-
getDecriptedSecretStoreMetadataFiles
public List<AssetMetadata.File> getDecriptedSecretStoreMetadataFiles(DDO ddo) throws IOException, EncryptionException, InterruptedException
-
getDecriptedSecretStoreMetadataFiles
public List<AssetMetadata.File> getDecriptedSecretStoreMetadataFiles(DDO ddo, int retries) throws IOException, EncryptionException, InterruptedException
-
tokenApprove
public boolean tokenApprove(io.keyko.nevermined.contracts.NeverminedToken tokenContract, String spenderAddress, String price) throws TokenApproveException- Throws:
TokenApproveException
-
resolveDID
public DDO resolveDID(DID did) throws DDOException
Given a DID, fetch the on-chain url from the DIDRegistry. That urls resolves the DDO stored in the Metadata API. This method returns the DDO found- Parameters:
did- the did- Returns:
- DDO
- Throws:
DDOException- DDOException
-
resolveDIDFromEvent
public DDO resolveDIDFromEvent(DID did) throws DDOException
Given a DID, scans the DIDRegistry events to resolve the Metadata API url and return the DDO found- Parameters:
did- the did- Returns:
- DDO
- Throws:
DDOException- DDOException
-
getContractAddresses
public BaseManager.ContractAddresses getContractAddresses()
-
getKeeperService
public io.keyko.common.web3.KeeperService getKeeperService()
Get the KeeperService- Returns:
- KeeperService
-
setKeeperService
public BaseManager setKeeperService(io.keyko.common.web3.KeeperService keeperService)
Set the KeeperService- Parameters:
keeperService- KeeperService- Returns:
- this
-
getMetadataApiService
public MetadataApiService getMetadataApiService()
Get the MetadataApiService- Returns:
- MetadataApiService
-
setMetadataApiService
public BaseManager setMetadataApiService(MetadataApiService metadataApiService)
Set the MetadataApiService- Parameters:
metadataApiService- MetadataApiService- Returns:
- this
-
getSecretStoreDto
public io.keyko.secretstore.core.SecretStoreDto getSecretStoreDto()
Get the SecretStoreDto- Returns:
- SecretStoreDto
-
setSecretStoreDto
public BaseManager setSecretStoreDto(io.keyko.secretstore.core.SecretStoreDto secretStoreDto)
Set the SecretStoreDto- Parameters:
secretStoreDto- SecretStoreDto- Returns:
- this
-
getSecretStoreManager
public SecretStoreManager getSecretStoreManager()
Get the SecretStoreManager- Returns:
- SecretStoreDto
-
setSecretStoreManager
public BaseManager setSecretStoreManager(SecretStoreManager secretStoreManager)
Set the SecretStoreManager- Parameters:
secretStoreManager- SecretStoreDto- Returns:
- this
-
getEvmDto
public io.keyko.secretstore.core.EvmDto getEvmDto()
Get the EvmDto- Returns:
- EvmDto
-
setEvmDto
public BaseManager setEvmDto(io.keyko.secretstore.core.EvmDto evmDto)
Set the EvmDto necessary to stablish the encryption/decryption flow necessary by Secret Store- Parameters:
evmDto- EvmDto- Returns:
- this
-
setTokenContract
public BaseManager setTokenContract(io.keyko.nevermined.contracts.NeverminedToken contract)
It sets the NeverminedToken stub instance- Parameters:
contract- NeverminedToken instance- Returns:
- BaseManager instance
-
setTemplateStoreManagerContract
public BaseManager setTemplateStoreManagerContract(io.keyko.nevermined.contracts.TemplateStoreManager contract)
It sets the NeverminedToken stub instance- Parameters:
contract- NeverminedToken instance- Returns:
- BaseManager instance
-
setDispenserContract
public BaseManager setDispenserContract(io.keyko.nevermined.contracts.Dispenser contract)
It sets the Dispenser stub instance- Parameters:
contract- Dispenser instance- Returns:
- BaseManager instance
-
setEscrowAccessSecretStoreTemplate
public BaseManager setEscrowAccessSecretStoreTemplate(io.keyko.nevermined.contracts.EscrowAccessSecretStoreTemplate contract)
It sets the EscrowAccessSecretStoreTemplate stub instance- Parameters:
contract- EscrowAccessSecretStoreTemplate instance- Returns:
- BaseManager instance
-
setDidRegistryContract
public BaseManager setDidRegistryContract(io.keyko.nevermined.contracts.DIDRegistry contract)
It sets the DIDRegistry stub instance- Parameters:
contract- DIDRegistry instance- Returns:
- BaseManager instance
-
setAgreementStoreManagerContract
public BaseManager setAgreementStoreManagerContract(io.keyko.nevermined.contracts.AgreementStoreManager contract)
It sets the AgreementStoreManager stub instance- Parameters:
contract- AgreementStoreManager instance- Returns:
- BaseManager instance
-
setConditionStoreManagerContract
public BaseManager setConditionStoreManagerContract(io.keyko.nevermined.contracts.ConditionStoreManager contract)
It sets the AgreementStoreManager stub instance- Parameters:
contract- AgreementStoreManager instance- Returns:
- BaseManager instance
-
getLockRewardCondition
public io.keyko.nevermined.contracts.LockRewardCondition getLockRewardCondition()
It gets the lockRewardCondition stub instance- Returns:
- LockRewardCondition instance
-
setLockRewardCondition
public BaseManager setLockRewardCondition(io.keyko.nevermined.contracts.LockRewardCondition lockRewardCondition)
It sets the LockRewardCondition instance- Parameters:
lockRewardCondition- instance- Returns:
- BaseManager instance
-
getEscrowReward
public io.keyko.nevermined.contracts.EscrowReward getEscrowReward()
It gets the EscrowReward stub instance- Returns:
- EscrowReward instance
-
setEscrowReward
public BaseManager setEscrowReward(io.keyko.nevermined.contracts.EscrowReward escrowReward)
It sets the EscrowReward instance- Parameters:
escrowReward- EscrowReward instance- Returns:
- BaseManager instance
-
getComputeExecutionCondition
public io.keyko.nevermined.contracts.ComputeExecutionCondition getComputeExecutionCondition()
It gets the ComputeExecutionCondition stub instance- Returns:
- ComputeExecutionCondition instance
-
setComputeExecutionCondition
public BaseManager setComputeExecutionCondition(io.keyko.nevermined.contracts.ComputeExecutionCondition computeExecutionCondition)
It sets the ComputeExecutionCondition instance- Parameters:
computeExecutionCondition- ComputeExecutionCondition instance- Returns:
- BaseManager instance
-
getEscrowComputeExecutionTemplate
public io.keyko.nevermined.contracts.EscrowComputeExecutionTemplate getEscrowComputeExecutionTemplate()
It gets the EscrowComputeExecutionTemplate stub instance- Returns:
- EscrowComputeExecutionTemplate instance
-
setEscrowComputeExecutionTemplate
public BaseManager setEscrowComputeExecutionTemplate(io.keyko.nevermined.contracts.EscrowComputeExecutionTemplate escrowComputeExecutionTemplate)
It sets the EscrowComputeExecutionTemplate instance- Parameters:
escrowComputeExecutionTemplate- EscrowComputeExecutionTemplate instance- Returns:
- BaseManager instance
-
getAccessSecretStoreCondition
public io.keyko.nevermined.contracts.AccessSecretStoreCondition getAccessSecretStoreCondition()
It gets the AccessSecretStoreCondition stub instance- Returns:
- AccessSecretStoreCondition instance
-
setAccessSecretStoreCondition
public BaseManager setAccessSecretStoreCondition(io.keyko.nevermined.contracts.AccessSecretStoreCondition accessSecretStoreCondition)
It sets the EscrowReward instance- Parameters:
accessSecretStoreCondition- AccessSecretStoreCondition instance- Returns:
- BaseManager instance
-
getMainAccount
public Account getMainAccount()
-
setMainAccount
public BaseManager setMainAccount(Account mainAccount)
-
getProviderAddress
public String getProviderAddress()
-
setProviderAddress
public BaseManager setProviderAddress(String providerAddress)
-
getTemplateIdByName
public byte[] getTemplateIdByName(String contractName)
-
generateSignature
public String generateSignature(String message) throws IOException, org.web3j.crypto.CipherException
- Throws:
IOExceptionorg.web3j.crypto.CipherException
-
generateAccessGrantToken
public String generateAccessGrantToken(String serviceAgreementId, DID did) throws io.keyko.common.exceptions.CryptoException, IOException, org.web3j.crypto.CipherException
Generate the Grant Token for the Access service.- Parameters:
serviceAgreementId- The Service Agreement Id.did- The did.- Returns:
- String The Grant Token.
- Throws:
io.keyko.common.exceptions.CryptoException- CryptoExceptionIOException- IOExceptionorg.web3j.crypto.CipherException- CipherException
-
generateDownloadGrantToken
public String generateDownloadGrantToken(DID did) throws io.keyko.common.exceptions.CryptoException, IOException, org.web3j.crypto.CipherException
Generat the Grant Token for the Download service.- Parameters:
did- The did.- Returns:
- String The Grant Token.
- Throws:
io.keyko.common.exceptions.CryptoException- CryptoExceptionIOException- IOExcceptionorg.web3j.crypto.CipherException- CipherException
-
generateExecuteGrantToken
public String generateExecuteGrantToken(String serviceAgreementId, DID workflowDid) throws io.keyko.common.exceptions.CryptoException, IOException, org.web3j.crypto.CipherException
Generate the Grant Token for the Execute service.- Parameters:
serviceAgreementId- The Service Agreement Id.workflowDid- The workflow did.- Returns:
- String The Grant Token.
- Throws:
io.keyko.common.exceptions.CryptoException- CryptoExceptionIOException- IOExceptionorg.web3j.crypto.CipherException- CipherException
-
generateComputeGrantToken
public String generateComputeGrantToken(String serviceAgreementId, String executionId) throws io.keyko.common.exceptions.CryptoException, IOException, org.web3j.crypto.CipherException
Generate the Grant Token for the Compute service.- Parameters:
serviceAgreementId- The Service Agreement Id.executionId- The excution Id of the compute job.- Returns:
- String The Grant Token.
- Throws:
io.keyko.common.exceptions.CryptoException- CryptoExceptionIOException- IOExceptionorg.web3j.crypto.CipherException- CipherException
-
-