Class BrizoService


  • public class BrizoService
    extends Object
    Service for Brizo's Integration
    • Field Detail

      • log

        private static final org.apache.logging.log4j.Logger log
    • Constructor Detail

      • BrizoService

        public BrizoService()
    • 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 url
        payload - 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 endpoint
        consumerAddress - the address of the consumer
        serviceAgreementId - the serviceAgreement Id
        url - the url
        destinationPath - the path to download the resource
        Returns:
        DownloadResult Instance of DownloadResult that indicates if the download was correct
        Throws:
        IOException - IOException
        URISyntaxException - 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 endpoint
        consumerAddress - the address of the consumer
        serviceAgreementId - the serviceAgreement Id
        url - the url
        destinationPath - 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 endpoint
        consumerAddress - the address of the consumer
        serviceAgreementId - the serviceAgreement Id
        url - the url
        startRange - the start of the bytes range
        endRange - the end of the bytes range
        isRangeRequest - indicates if is a range request
        Returns:
        an InputStream that represents the binary content
        Throws:
        IOException - Exception during the download process