Skip to content
This repository has been archived by the owner on Feb 8, 2022. It is now read-only.

Commit

Permalink
adaptation to new access flow
Browse files Browse the repository at this point in the history
  • Loading branch information
aaitor committed May 16, 2020
1 parent ab4c467 commit 8a0acfa
Show file tree
Hide file tree
Showing 32 changed files with 683 additions and 277 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
History
=======

0.3.0 (May, 2020)
-------------------------

* [#8](https://github.com/keyko-io/nevermined-sdk-java/issues/8) Modify the publishing & consume flow for making RSA the default auth method
* [#9](https://github.com/keyko-io/nevermined-sdk-java/issues/9) Integration of new access gateway flow that grants permissions


0.2.0 (April, 2020)
-------------------------

Expand Down
4 changes: 2 additions & 2 deletions library.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
},
{
"name": "nevermined-contracts",
"version": "0.1.2"
"version": "0.2.1"
},
{
"name": "metadata",
"version": "0.1"
},
{
"name": "gateway",
"version": "0.1.0"
"version": "0.3.1"
},
{
"name": "events-handler",
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<final-name>nevermined-sdk</final-name>

<web3j.version>4.5.17</web3j.version>
<common-utils.version>0.1.2</common-utils.version>
<common-utils.version>0.1.3</common-utils.version>

<nevermined.contracts.version>0.2.0</nevermined.contracts.version>
<ocean.secretstore.version>0.1.4</ocean.secretstore.version>
Expand Down
112 changes: 29 additions & 83 deletions src/main/java/io/keyko/nevermined/api/AssetsAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import io.keyko.nevermined.models.asset.AssetMetadata;
import io.keyko.nevermined.models.asset.OrderResult;
import io.keyko.nevermined.models.metadata.SearchResult;
import io.keyko.nevermined.models.service.AuthConfig;
import io.keyko.nevermined.models.service.ProviderConfig;
import io.keyko.nevermined.models.service.types.ComputingService;
import io.reactivex.Flowable;
Expand All @@ -24,11 +25,11 @@ public interface AssetsAPI {
*
* @param metadata the metadata of the DDO
* @param providerConfig the endpoints of the DDO's services
* @param threshold the secret store threshold
* @param authConfig Auth configuration
* @return an instance of the DDO created
* @throws DDOException DDOException
*/
public DDO create(AssetMetadata metadata, ProviderConfig providerConfig, int threshold) throws DDOException;
DDO create(AssetMetadata metadata, ProviderConfig providerConfig, AuthConfig authConfig) throws DDOException;

/**
* Creates a new DDO, registering it on-chain through DidRegistry contract and off-chain in Metadata
Expand All @@ -38,8 +39,7 @@ public interface AssetsAPI {
* @return an instance of the DDO created
* @throws DDOException DDOException
*/
public DDO create(AssetMetadata metadata, ProviderConfig providerConfig) throws DDOException;

DDO create(AssetMetadata metadata, ProviderConfig providerConfig) throws DDOException;


/**
Expand All @@ -48,22 +48,10 @@ public interface AssetsAPI {
* @param metadata the metadata of the DDO
* @param providerConfig the endpoints of the DDO's services
* @param computingProvider the computing provider configuration
* @param threshold the secret store threshold
* @return an instance of the DDO created
* @throws DDOException DDOException
*/
public DDO createComputingService(AssetMetadata metadata, ProviderConfig providerConfig, ComputingService.Provider computingProvider, int threshold) throws DDOException;

/**
* Creates a new ComputingService DDO, registering it on-chain through DidRegistry contract and off-chain in Metadata
*
* @param metadata the metadata of the DDO
* @param providerConfig the endpoints of the DDO's services
* @param computingProvider the computing provider configuration
* @return an instance of the DDO created
* @throws DDOException DDOException
*/
public DDO createComputingService(AssetMetadata metadata, ProviderConfig providerConfig, ComputingService.Provider computingProvider) throws DDOException;
DDO createComputingService(AssetMetadata metadata, ProviderConfig providerConfig, ComputingService.Provider computingProvider) throws DDOException;


/**
Expand All @@ -74,15 +62,15 @@ public interface AssetsAPI {
* @throws EthereumException EthereumException
* @throws DDOException DDOException
*/
public DDO resolve(DID did) throws EthereumException, DDOException;
DDO resolve(DID did) throws EthereumException, DDOException;

/**
* Gets the list of the files that belongs to a DDO
* @param did the DID to resolve
* @return a list of the Files
* @throws DDOException EncryptionException
*/
public List<AssetMetadata.File> getMetadataFiles(DID did) throws DDOException;
List<AssetMetadata.File> getMetadataFiles(DID did) throws DDOException;

/**
* Gets all the DDO that match the search criteria
Expand All @@ -91,7 +79,7 @@ public interface AssetsAPI {
* @return a List with all the DDOs found
* @throws DDOException DDOException
*/
public SearchResult search(String text) throws DDOException;
SearchResult search(String text) throws DDOException;

/**
* Gets all the DDOs that match the search criteria
Expand All @@ -102,7 +90,7 @@ public interface AssetsAPI {
* @return a List with all the DDOs found
* @throws DDOException DDOException
*/
public SearchResult search(String text, int offset, int page) throws DDOException;
SearchResult search(String text, int offset, int page) throws DDOException;

/**
* Gets all the DDOs that match the parameters of the query
Expand All @@ -114,7 +102,7 @@ public interface AssetsAPI {
* @return a List with all the DDOs found
* @throws DDOException DDOException
*/
public SearchResult query(Map<String, Object> params, int offset, int page, int sort) throws DDOException;
SearchResult query(Map<String, Object> params, int offset, int page, int sort) throws DDOException;

/**
* Gets all the DDOs that match the parameters of the query
Expand All @@ -123,32 +111,7 @@ public interface AssetsAPI {
* @return a List with all the DDOs found
* @throws DDOException DDOException
*/
public SearchResult query(Map<String, Object> params) throws DDOException;

/**
* Downloads a single file of an Asset previously ordered through a Service Agreement
* @param serviceAgreementId the service agreement id of the asset
* @param did the did
* @param serviceDefinitionId the service definition id
* @param index of the file inside the files definition in metadata
* @param basePath the path where the asset will be downloaded
* @param threshold secret store threshold to decrypt the urls of the asset
* @return a flag that indicates if the consume flow was executed correctly
* @throws ConsumeServiceException ConsumeServiceException
*/
public Boolean consume(String serviceAgreementId, DID did, int serviceDefinitionId, Integer index, String basePath, int threshold) throws ConsumeServiceException;

/**
* Downloads a single file of an Asset previously ordered through a Service Agreement
* @param serviceAgreementId the service agreement id of the asset
* @param did the did
* @param serviceDefinitionId the service definition id
* @param index of the file inside the files definition in metadata
* @param basePath the path where the asset will be downloaded
* @return a flag that indicates if the consume flow was executed correctly
* @throws ConsumeServiceException ConsumeServiceException
*/
public Boolean consume(String serviceAgreementId, DID did, int serviceDefinitionId, Integer index, String basePath) throws ConsumeServiceException;
SearchResult query(Map<String, Object> params) throws DDOException;

/**
* Downloads an Asset previously ordered through a Service Agreement
Expand All @@ -157,76 +120,59 @@ public interface AssetsAPI {
* @param did the did
* @param serviceDefinitionId the service definition id
* @param basePath the path where the asset will be downloaded
* @param threshold secret store threshold to decrypt the urls of the asset
* @return a flag that indicates if the consume flow was executed correctly
* @throws ConsumeServiceException ConsumeServiceException
*/
public Boolean consume(String serviceAgreementId, DID did, int serviceDefinitionId, String basePath, int threshold) throws ConsumeServiceException;
Boolean consume(String serviceAgreementId, DID did, int serviceDefinitionId, String basePath) throws ConsumeServiceException;

/**
* Downloads an Asset previously ordered through a Service Agreement
*
* @param serviceAgreementId the service agreement id of the asset
* @param did the did
* @param serviceDefinitionId the service definition id
* @param fileIndex index id of the file to consume
* @param basePath the path where the asset will be downloaded
* @return a flag that indicates if the consume flow was executed correctly
* @throws ConsumeServiceException ConsumeServiceException
*/
public Boolean consume(String serviceAgreementId, DID did, int serviceDefinitionId, String basePath) throws ConsumeServiceException;
Boolean consume(String serviceAgreementId, DID did, int serviceDefinitionId, int fileIndex, String basePath) throws ConsumeServiceException;


/**
* Gets the input stream of one file of the asset
* @param serviceAgreementId the service agreement id of the asset
* @param did the did
* @param serviceDefinitionId the service definition id
* @param index the index of the file
* @return the input stream wit the binary content of the file
* @throws ConsumeServiceException ConsumeServiceException
*/
InputStream consumeBinary(String serviceAgreementId, DID did, int serviceDefinitionId, Integer index) throws ConsumeServiceException;
InputStream consumeBinary(String serviceAgreementId, DID did, int serviceDefinitionId) throws ConsumeServiceException;

/**
* Gets the input stream of one file of the asset
* @param serviceAgreementId the service agreement id of the asset
* @param did the did
* @param serviceDefinitionId the service definition id
* @param index the index of the file
* @param threshold secret store threshold to decrypt the urls of the asset
* @param fileIndex the index of the file
* @return the input stream wit the binary content of the file
* @throws ConsumeServiceException ConsumeServiceException
*/
public InputStream consumeBinary(String serviceAgreementId, DID did, int serviceDefinitionId, Integer index, int threshold) throws ConsumeServiceException;


/**
* Gets a range of bytes of the input stream of one file of the asset
* @param serviceAgreementId the service agreement id of the asset
* @param did the did
* @param serviceDefinitionId the service definition id
* @param index the index of the file
* @param rangeStart the start of the bytes range
* @param rangeEnd the end of the bytes range
* @return the input stream wit the binary content of the specified range
* @throws ConsumeServiceException ConsumeServiceException
*/
public InputStream consumeBinary(String serviceAgreementId, DID did, int serviceDefinitionId, Integer index, Integer rangeStart, Integer rangeEnd) throws ConsumeServiceException;
InputStream consumeBinary(String serviceAgreementId, DID did, int serviceDefinitionId, int fileIndex) throws ConsumeServiceException;


/**
* Gets a range of bytes of the input stream of one file of the asset
* @param serviceAgreementId the service agreement id of the asset
* @param did the did
* @param serviceDefinitionId the service definition id
* @param index the index of the file
* @param fileIndex the index of the file
* @param rangeStart the start of the bytes range
* @param rangeEnd the end of the bytes range
* @param threshold secret store threshold to decrypt the urls of the asset
* @return the input stream wit the binary content of the specified range
* @throws ConsumeServiceException ConsumeServiceException
*/
InputStream consumeBinary(String serviceAgreementId, DID did, int serviceDefinitionId, Integer index, Integer rangeStart, Integer rangeEnd, int threshold) throws ConsumeServiceException;
InputStream consumeBinary(String serviceAgreementId, DID did, int serviceDefinitionId, int fileIndex, int rangeStart, int rangeEnd) throws ConsumeServiceException;


/**
Expand Down Expand Up @@ -258,7 +204,7 @@ public interface AssetsAPI {
* @return an execution id
* @throws ServiceException ServiceException
*/
public String execute(String agreementId, DID did, int index, String workflowDID) throws ServiceException;
String execute(String agreementId, DID did, int index, String workflowDID) throws ServiceException;

/**
* Return the owner of the asset.
Expand All @@ -267,7 +213,7 @@ public interface AssetsAPI {
* @return the ethereum address of the owner/publisher of given asset did
* @throws Exception Exception
*/
public String owner(DID did) throws Exception;
String owner(DID did) throws Exception;

/**
* List of Asset objects published by ownerAddress
Expand All @@ -276,7 +222,7 @@ public interface AssetsAPI {
* @return list of dids
* @throws ServiceException ServiceException
*/
public List<DID> ownerAssets(String ownerAddress) throws ServiceException;
List<DID> ownerAssets(String ownerAddress) throws ServiceException;

/**
* List of Asset objects purchased by consumerAddress
Expand All @@ -285,7 +231,7 @@ public interface AssetsAPI {
* @return list of dids
* @throws ServiceException ServiceException
*/
public List<DID> consumerAssets(String consumerAddress) throws ServiceException;
List<DID> consumerAssets(String consumerAddress) throws ServiceException;

/**
* Retire this did of Metadata
Expand All @@ -294,7 +240,7 @@ public interface AssetsAPI {
* @return a flag that indicates if the action was executed correctly
* @throws DDOException DDOException
*/
public Boolean retire(DID did) throws DDOException;
Boolean retire(DID did) throws DDOException;

/**
* Validate the asset metadata.
Expand All @@ -303,7 +249,7 @@ public interface AssetsAPI {
* @return a flag that indicates if the metadata is valid
* @throws DDOException DDOException
*/
public Boolean validate(AssetMetadata metadata) throws DDOException;
Boolean validate(AssetMetadata metadata) throws DDOException;


/**
Expand All @@ -313,7 +259,7 @@ public interface AssetsAPI {
* @return a flag that indicates if the action was executed correctly
* @throws DDOException DDOException
*/
public Boolean transferOwnership(DID did, String newOwnerAddress) throws DDOException;
Boolean transferOwnership(DID did, String newOwnerAddress) throws DDOException;


/**
Expand All @@ -323,7 +269,7 @@ public interface AssetsAPI {
* @return a flag that indicates if the action was executed correctly
* @throws DDOException DDOException
*/
public Boolean delegatePermissions(DID did, String subjectAddress) throws DDOException;
Boolean delegatePermissions(DID did, String subjectAddress) throws DDOException;

/**
* For a existing asset, the owner of the asset revoke the access grants of a subject.
Expand All @@ -332,7 +278,7 @@ public interface AssetsAPI {
* @return a flag that indicates if the action was executed correctly
* @throws DDOException DDOException
*/
public Boolean revokePermissions(DID did, String subjectAddress) throws DDOException;
Boolean revokePermissions(DID did, String subjectAddress) throws DDOException;


/**
Expand All @@ -342,7 +288,7 @@ public interface AssetsAPI {
* @return a flag that indicates if the subject address has permissions
* @throws DDOException DDOException
*/
public Boolean getPermissions(DID did, String subjectAddress) throws DDOException;
Boolean getPermissions(DID did, String subjectAddress) throws DDOException;


}

0 comments on commit 8a0acfa

Please sign in to comment.