Class Service
- java.lang.Object
-
- io.keyko.nevermined.models.AbstractModel
-
- io.keyko.nevermined.models.service.Service
-
- All Implemented Interfaces:
FromJsonToModel
- Direct Known Subclasses:
AccessService,AuthorizationService,ComputingService,MetadataService,ProvenanceService
public class Service extends AbstractModel implements FromJsonToModel
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classService.AssetTypesType of Asset.static classService.Attributesstatic classService.ConditionDependencystatic classService.ServiceAgreementTemplatestatic classService.ServiceTypesType of service in the DDO
-
Field Summary
Fields Modifier and Type Field Description Service.Attributesattributesstatic StringCONSUMER_ADDRESS_PARAMstatic intDEFAULT_ACCESS_INDEXstatic intDEFAULT_AUTHORIZATION_INDEXstatic intDEFAULT_COMPUTE_INDEXstatic intDEFAULT_METADATA_INDEXstatic intDEFAULT_PROVENANCE_INDEXintindexstatic StringSERVICE_AGREEMENT_PARAMStringserviceEndpointstatic StringSIGNATURE_PARAMStringtemplateIdStringtypestatic StringURL_PARAMstatic StringWORKFLOWID_PARAM-
Fields inherited from class io.keyko.nevermined.models.AbstractModel
DATE_FORMAT, DATE_PATTERN, logger
-
-
Constructor Summary
Constructors Constructor Description Service()Service(Service.ServiceTypes type, String serviceEndpoint, int index)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IntegercalculateServiceTimeout()StringfetchConditionValues()byte[]fetchTemplateIdEncoded()StringfetchTimelock()StringfetchTimeout()List<byte[]>generateByteConditionIds(String agreementId, Map<String,String> conditionsAddresses, String publisherAddress, String consumerAddress)List<String>generateConditionIds(String agreementId, Map<String,String> conditionsAddresses, String publisherAddress, String consumerAddress)StringgenerateEscrowRewardConditionId(String serviceAgreementId, String consumerAddress, String publisherAddress, String escrowRewardConditionAddress, String lockConditionId, String releaseConditionId)StringgenerateLockRewardId(String serviceAgreementId, String escrowRewardAddress, String lockRewardConditionAddress)StringgenerateReleaseConditionId(String serviceAgreementId, String consumerAddress, String releaseConditionAddress, String conditionName)StringgenerateServiceAgreementHash(String serviceAgreementId, String consumerAddress, String publisherAddress, Map<String,String> conditionsAddresses)Generates a Hash representing a Service Agreement The Hash is having the following parameters: (templateId, conditionKeys, conditionValues, timeout, serviceAgreementId)StringgenerateServiceAgreementSignatureFromHash(org.web3j.protocol.Web3j web3, String consumerAddress, String consumerPassword, String hash)ConditiongetConditionbyName(String name)StringgetTemplateId()List<BigInteger>retrieveTimeLocks()List<BigInteger>retrieveTimeOuts()private byte[]wrappedEncoder(String s)-
Methods inherited from class io.keyko.nevermined.models.AbstractModel
checksum, convertToModel, fromJSON, getDateNowFormatted, getMapperInstance, toJson, toJson
-
-
-
-
Field Detail
-
CONSUMER_ADDRESS_PARAM
public static final String CONSUMER_ADDRESS_PARAM
- See Also:
- Constant Field Values
-
SERVICE_AGREEMENT_PARAM
public static final String SERVICE_AGREEMENT_PARAM
- See Also:
- Constant Field Values
-
URL_PARAM
public static final String URL_PARAM
- See Also:
- Constant Field Values
-
WORKFLOWID_PARAM
public static final String WORKFLOWID_PARAM
- See Also:
- Constant Field Values
-
SIGNATURE_PARAM
public static final String SIGNATURE_PARAM
- See Also:
- Constant Field Values
-
DEFAULT_METADATA_INDEX
public static final int DEFAULT_METADATA_INDEX
- See Also:
- Constant Field Values
-
DEFAULT_PROVENANCE_INDEX
public static final int DEFAULT_PROVENANCE_INDEX
- See Also:
- Constant Field Values
-
DEFAULT_AUTHORIZATION_INDEX
public static final int DEFAULT_AUTHORIZATION_INDEX
- See Also:
- Constant Field Values
-
DEFAULT_ACCESS_INDEX
public static final int DEFAULT_ACCESS_INDEX
- See Also:
- Constant Field Values
-
DEFAULT_COMPUTE_INDEX
public static final int DEFAULT_COMPUTE_INDEX
- See Also:
- Constant Field Values
-
index
public int index
-
type
public String type
-
templateId
public String templateId
-
serviceEndpoint
public String serviceEndpoint
-
attributes
public Service.Attributes attributes
-
-
Constructor Detail
-
Service
public Service()
-
Service
public Service(Service.ServiceTypes type, String serviceEndpoint, int index)
-
-
Method Detail
-
getTemplateId
public String getTemplateId()
-
fetchTemplateIdEncoded
public byte[] fetchTemplateIdEncoded() throws UnsupportedEncodingException- Throws:
UnsupportedEncodingException
-
retrieveTimeOuts
public List<BigInteger> retrieveTimeOuts()
-
calculateServiceTimeout
public Integer calculateServiceTimeout()
-
retrieveTimeLocks
public List<BigInteger> retrieveTimeLocks()
-
fetchConditionValues
public String fetchConditionValues() throws UnsupportedEncodingException
- Throws:
UnsupportedEncodingException
-
fetchTimeout
public String fetchTimeout() throws IOException
- Throws:
IOException
-
fetchTimelock
public String fetchTimelock() throws IOException
- Throws:
IOException
-
wrappedEncoder
private byte[] wrappedEncoder(String s)
-
generateByteConditionIds
public List<byte[]> generateByteConditionIds(String agreementId, Map<String,String> conditionsAddresses, String publisherAddress, String consumerAddress) throws Exception
- Throws:
Exception
-
generateConditionIds
public List<String> generateConditionIds(String agreementId, Map<String,String> conditionsAddresses, String publisherAddress, String consumerAddress) throws Exception
- Throws:
Exception
-
generateLockRewardId
public String generateLockRewardId(String serviceAgreementId, String escrowRewardAddress, String lockRewardConditionAddress) throws UnsupportedEncodingException
- Throws:
UnsupportedEncodingException
-
generateEscrowRewardConditionId
public String generateEscrowRewardConditionId(String serviceAgreementId, String consumerAddress, String publisherAddress, String escrowRewardConditionAddress, String lockConditionId, String releaseConditionId) throws UnsupportedEncodingException
- Throws:
UnsupportedEncodingException
-
generateReleaseConditionId
public String generateReleaseConditionId(String serviceAgreementId, String consumerAddress, String releaseConditionAddress, String conditionName) throws UnsupportedEncodingException
- Throws:
UnsupportedEncodingException
-
generateServiceAgreementSignatureFromHash
public String generateServiceAgreementSignatureFromHash(org.web3j.protocol.Web3j web3, String consumerAddress, String consumerPassword, String hash) throws IOException
- Throws:
IOException
-
generateServiceAgreementHash
public String generateServiceAgreementHash(String serviceAgreementId, String consumerAddress, String publisherAddress, Map<String,String> conditionsAddresses) throws ServiceAgreementException
Generates a Hash representing a 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 assetconditionsAddresses- addresses of the conditions- Returns:
- Hash
- Throws:
ServiceAgreementException- ServiceAgreementException
-
-