Package com.oceanprotocol.squid.api.impl
Class AgreementsImpl
- java.lang.Object
-
- com.oceanprotocol.squid.api.impl.AgreementsImpl
-
- All Implemented Interfaces:
AgreementsAPI
public class AgreementsImpl extends Object implements AgreementsAPI
-
-
Field Summary
Fields Modifier and Type Field Description private AgreementsManager
agreementsManager
private OceanManager
oceanManager
-
Constructor Summary
Constructors Constructor Description AgreementsImpl(AgreementsManager agreementsManager, OceanManager oceanManager)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
create(DID did, String agreementId, String serviceDefinitionId, String signature, String consumerAddress)
Create a service agreement.org.web3j.tuples.generated.Tuple2<String,String>
prepare(DID did, String serviceDefinitionId, Account consumerAccount)
Prepare the service agreement.void
send(DID did, String agreementId, String serviceDefinitionId, String signature, Account consumerAccount)
Send a signed service agreement to the publisher Brizo instance to consume/access the service.String
sign(String agreementId, DID did, String serviceDefinitionId, Account consumerAccount)
AgreementStatus
status(String agreementId)
Get the status of a service agreement.
-
-
-
Field Detail
-
agreementsManager
private AgreementsManager agreementsManager
-
oceanManager
private OceanManager oceanManager
-
-
Constructor Detail
-
AgreementsImpl
public AgreementsImpl(AgreementsManager agreementsManager, OceanManager oceanManager)
Constructor- Parameters:
agreementsManager
- the accountsManageroceanManager
- an instance of oceanManager
-
-
Method Detail
-
prepare
public org.web3j.tuples.generated.Tuple2<String,String> prepare(DID did, String serviceDefinitionId, Account consumerAccount) throws Exception
Description copied from interface:AgreementsAPI
Prepare the service agreement.- Specified by:
prepare
in interfaceAgreementsAPI
- Parameters:
did
- the didserviceDefinitionId
- the service definition id of the agreementconsumerAccount
- the address of the consumer- Returns:
- Tuple with agreement id and signature.
- Throws:
Exception
- Exception
-
send
public void send(DID did, String agreementId, String serviceDefinitionId, String signature, Account consumerAccount) throws Exception
Description copied from interface:AgreementsAPI
Send a signed service agreement to the publisher Brizo instance to consume/access the service.- Specified by:
send
in interfaceAgreementsAPI
- Parameters:
did
- the didagreementId
- the agreement idserviceDefinitionId
- the service definition id of the agreementsignature
- the signatureconsumerAccount
- the account of the consumer- Throws:
Exception
- Exception
-
create
public boolean create(DID did, String agreementId, String serviceDefinitionId, String signature, String consumerAddress) throws Exception
Description copied from interface:AgreementsAPI
Create a service agreement.- Specified by:
create
in interfaceAgreementsAPI
- Parameters:
did
- the didagreementId
- the agreement idserviceDefinitionId
- the service definition id of the agreementsignature
- the signatureconsumerAddress
- the address of the consumer- Returns:
- a flag a true if the creation of the agreement was successful.
- Throws:
Exception
- Exception
-
status
public AgreementStatus status(String agreementId) throws Exception
Description copied from interface:AgreementsAPI
Get the status of a service agreement.- Specified by:
status
in interfaceAgreementsAPI
- Parameters:
agreementId
- id of the agreement- Returns:
- AgreementStatus with condition status of each of the agreement's conditions.
- Throws:
Exception
- Exception
-
-