Class AccessService
- java.lang.Object
-
- com.oceanprotocol.squid.models.AbstractModel
-
- com.oceanprotocol.squid.models.service.Service
-
- com.oceanprotocol.squid.models.service.AccessService
-
- All Implemented Interfaces:
FromJsonToModel
public class AccessService extends Service
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AccessService.ConditionDependency
static class
AccessService.ServiceAgreementTemplate
-
Nested classes/interfaces inherited from class com.oceanprotocol.squid.models.service.Service
Service.serviceTypes
-
-
Field Summary
Fields Modifier and Type Field Description String
creator
String
description
private static org.apache.logging.log4j.Logger
log
String
name
String
purchaseEndpoint
AccessService.ServiceAgreementTemplate
serviceAgreementTemplate
-
Fields inherited from class com.oceanprotocol.squid.models.service.Service
CONSUMER_ADDRESS_PARAM, DEFAULT_ACCESS_SERVICE_ID, DEFAULT_AUTHORIZATION_SERVICE_ID, DEFAULT_METADATA_SERVICE_ID, SERVICE_AGREEMENT_PARAM, serviceDefinitionId, serviceEndpoint, templateId, type, URL_PARAM
-
Fields inherited from class com.oceanprotocol.squid.models.AbstractModel
DATE_FORMAT, DATE_PATTERN
-
-
Constructor Summary
Constructors Constructor Description AccessService()
AccessService(String serviceEndpoint, String serviceDefinitionId, AccessService.ServiceAgreementTemplate serviceAgreementTemplate, String templateId)
AccessService(String serviceEndpoint, String serviceDefinitionId, String templateId)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
fetchConditionValues()
String
fetchTimelock()
String
fetchTimeout()
String
generateAccessSecretStoreConditionId(String serviceAgreementId, String consumerAddress, String accessSecretStoreConditionAddress)
List<byte[]>
generateConditionIds(String agreementId, OceanManager oceanManager, DDO ddo, String consumerAddress)
String
generateEscrowRewardConditionId(String serviceAgreementId, String consumerAddress, String publisherAddress, String escrowRewardConditionAddress, String lockConditionId, String releaseConditionId)
String
generateLockRewardId(String serviceAgreementId, String escrowRewardAddress, String lockRewardConditionAddress)
String
generateServiceAgreementHash(String serviceAgreementId, String consumerAddress, String publisherAddress, String lockRewardConditionAddress, String accessSecretStoreConditionAddress, String escrowRewardAddress)
Generates a Hash representing the Access Service Agreement The Hash is having the following parameters: (templateId, conditionKeys, conditionValues, timeout, serviceAgreementId)String
generateServiceAgreementSignature(org.web3j.protocol.Web3j web3, String consumerAddress, String consumerPassword, String publisherAddress, String serviceAgreementId, String lockRewardConditionAddress, String accessSecretStoreConditionAddress, String escrowRewardAddress)
String
generateServiceAgreementSignatureFromHash(org.web3j.protocol.Web3j web3, String consumerAddress, String consumerPassword, String hash)
Condition
getConditionbyName(String name)
List<BigInteger>
retrieveTimeLocks()
List<BigInteger>
retrieveTimeOuts()
-
Methods inherited from class com.oceanprotocol.squid.models.AbstractModel
convertToModel, fromJSON, getDateNowFormatted, getMapperInstance, toJson, toJson
-
-
-
-
Field Detail
-
log
private static final org.apache.logging.log4j.Logger log
-
purchaseEndpoint
public String purchaseEndpoint
-
name
public String name
-
description
public String description
-
creator
public String creator
-
serviceAgreementTemplate
public AccessService.ServiceAgreementTemplate serviceAgreementTemplate
-
-
Constructor Detail
-
AccessService
public AccessService()
-
AccessService
public AccessService(String serviceEndpoint, String serviceDefinitionId, String templateId)
-
AccessService
public AccessService(String serviceEndpoint, String serviceDefinitionId, AccessService.ServiceAgreementTemplate serviceAgreementTemplate, String templateId)
-
-
Method Detail
-
generateServiceAgreementHash
public String generateServiceAgreementHash(String serviceAgreementId, String consumerAddress, String publisherAddress, String lockRewardConditionAddress, String accessSecretStoreConditionAddress, String escrowRewardAddress) throws IOException
Generates a Hash representing the Access Service Agreement The Hash is having the following parameters: (templateId, conditionKeys, conditionValues, timeout, serviceAgreementId)- Parameters:
serviceAgreementId
- Service Agreement IdconsumerAddress
- the address of the consumer of the servicepublisherAddress
- the address of the publisher of the assetlockRewardConditionAddress
- the address of the lockRewardCondition contractaccessSecretStoreConditionAddress
- the address of the accessSecretStoreCondition contractescrowRewardAddress
- the address of the escrowReward Contract- Returns:
- Hash
- Throws:
IOException
- if the hash function fails
-
generateLockRewardId
public String generateLockRewardId(String serviceAgreementId, String escrowRewardAddress, String lockRewardConditionAddress) throws UnsupportedEncodingException
- Throws:
UnsupportedEncodingException
-
generateAccessSecretStoreConditionId
public String generateAccessSecretStoreConditionId(String serviceAgreementId, String consumerAddress, String accessSecretStoreConditionAddress) throws UnsupportedEncodingException
- Throws:
UnsupportedEncodingException
-
generateEscrowRewardConditionId
public String generateEscrowRewardConditionId(String serviceAgreementId, String consumerAddress, String publisherAddress, String escrowRewardConditionAddress, String lockConditionId, String releaseConditionId) throws UnsupportedEncodingException
- Throws:
UnsupportedEncodingException
-
generateServiceAgreementSignature
public String generateServiceAgreementSignature(org.web3j.protocol.Web3j web3, String consumerAddress, String consumerPassword, String publisherAddress, String serviceAgreementId, String lockRewardConditionAddress, String accessSecretStoreConditionAddress, String escrowRewardAddress) throws IOException
- Throws:
IOException
-
generateServiceAgreementSignatureFromHash
public String generateServiceAgreementSignatureFromHash(org.web3j.protocol.Web3j web3, String consumerAddress, String consumerPassword, String hash) throws IOException
- Throws:
IOException
-
fetchConditionValues
public String fetchConditionValues() throws UnsupportedEncodingException
- Throws:
UnsupportedEncodingException
-
fetchTimeout
public String fetchTimeout() throws IOException
- Throws:
IOException
-
fetchTimelock
public String fetchTimelock() throws IOException
- Throws:
IOException
-
retrieveTimeOuts
public List<BigInteger> retrieveTimeOuts()
-
retrieveTimeLocks
public List<BigInteger> retrieveTimeLocks()
-
-