Package com.oceanprotocol.squid.external
Class BrizoService
- java.lang.Object
-
- com.oceanprotocol.squid.external.BrizoService
-
public class BrizoService extends Object
Service for Brizo's Integration
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BrizoService.ServiceAgreementResult
-
Field Summary
Fields Modifier and Type Field Description private static org.apache.logging.log4j.Logger
log
-
Constructor Summary
Constructors Constructor Description BrizoService()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static HttpHelper.DownloadResult
consumeUrl(String serviceEndpoint, String consumerAddress, String serviceAgreementId, String url, String destinationPath)
Calls a Brizo´s endpoint to download an assetstatic InputStream
downloadUrl(String serviceEndpoint, String consumerAddress, String serviceAgreementId, String url, Boolean isRangeRequest, Integer startRange, Integer endRange)
Calls a Brizo´s endpoint to download an assetstatic void
downloadUrl(String serviceEndpoint, String consumerAddress, String serviceAgreementId, String url, String destinationPath)
Calls a Brizo´s endpoint to download an assetstatic BrizoService.ServiceAgreementResult
initializeAccessServiceAgreement(String url, InitializeAccessSLA payload)
Calls a Brizo's endpoint to request the initialization of a new Service Agreement
-
-
-
Method Detail
-
initializeAccessServiceAgreement
public static BrizoService.ServiceAgreementResult initializeAccessServiceAgreement(String url, InitializeAccessSLA payload)
Calls a Brizo's endpoint to request the initialization of a new Service Agreement- Parameters:
url
- the urlpayload
- the payload- Returns:
- an object that indicates if Brizo initialized the Service Agreement correctly
-
consumeUrl
public static HttpHelper.DownloadResult consumeUrl(String serviceEndpoint, String consumerAddress, String serviceAgreementId, String url, String destinationPath) throws IOException, URISyntaxException
Calls a Brizo´s endpoint to download an asset- Parameters:
serviceEndpoint
- the service endpointconsumerAddress
- the address of the consumerserviceAgreementId
- the serviceAgreement Idurl
- the urldestinationPath
- the path to download the resource- Returns:
- DownloadResult Instance of DownloadResult that indicates if the download was correct
- Throws:
IOException
- IOExceptionURISyntaxException
- URISyntaxException
-
downloadUrl
public static void downloadUrl(String serviceEndpoint, String consumerAddress, String serviceAgreementId, String url, String destinationPath) throws IOException
Calls a Brizo´s endpoint to download an asset- Parameters:
serviceEndpoint
- the service endpointconsumerAddress
- the address of the consumerserviceAgreementId
- the serviceAgreement Idurl
- the urldestinationPath
- the path to download the resource- Throws:
IOException
- Exception during the download process
-
downloadUrl
public static InputStream downloadUrl(String serviceEndpoint, String consumerAddress, String serviceAgreementId, String url, Boolean isRangeRequest, Integer startRange, Integer endRange) throws IOException
Calls a Brizo´s endpoint to download an asset- Parameters:
serviceEndpoint
- the service endpointconsumerAddress
- the address of the consumerserviceAgreementId
- the serviceAgreement Idurl
- the urlstartRange
- the start of the bytes rangeendRange
- the end of the bytes rangeisRangeRequest
- indicates if is a range request- Returns:
- an InputStream that represents the binary content
- Throws:
IOException
- Exception during the download process
-
-