Class ServiceResponseHandler


  • public final class ServiceResponseHandler
    extends Object
    This class handles taking the HttpResponses we've gotten back, and producing an appropriate response object for usage
    • Constructor Detail

      • ServiceResponseHandler

        public ServiceResponseHandler()
    • Method Detail

      • unmarshallIngestResponse

        public static IngestResponse unmarshallIngestResponse​(net.snowflake.client.jdbc.internal.apache.http.HttpResponse response,
                                                              UUID requestId)
                                                       throws IOException,
                                                              IngestResponseException,
                                                              BackOffException
        unmarshallIngestResponse Given an HttpResponse object - attempts to deserialize it into an IngestResponse object
        Parameters:
        response - the HTTPResponse we want to distill into an IngestResponse
        requestId -
        Returns:
        An IngestResponse with all of the parsed out information
        Throws:
        IOException - if our entity is somehow corrupt or we can't get it
        IngestResponseException - - if we have an uncategorized network issue
        BackOffException - - if we have a 503 issue
      • unmarshallHistoryResponse

        public static HistoryResponse unmarshallHistoryResponse​(net.snowflake.client.jdbc.internal.apache.http.HttpResponse response,
                                                                UUID requestId)
                                                         throws IOException,
                                                                IngestResponseException,
                                                                BackOffException
        unmarshallHistoryResponse Given an HttpResponse object - attempts to deserialize it into a HistoryResponse object
        Parameters:
        response - the HttpResponse object we are trying to deserialize
        requestId -
        Returns:
        a HistoryResponse with all the parsed out information
        Throws:
        IOException - if our entity is somehow corrupt or we can't get it
        IngestResponseException - - if we have an uncategorized network issue
        BackOffException - - if we have a 503 issue
      • unmarshallHistoryRangeResponse

        public static HistoryRangeResponse unmarshallHistoryRangeResponse​(net.snowflake.client.jdbc.internal.apache.http.HttpResponse response,
                                                                          UUID requestId)
                                                                   throws IOException,
                                                                          IngestResponseException,
                                                                          BackOffException
        Given an HttpResponse object - attempts to deserialize it into a HistoryRangeResponse
        Parameters:
        response - the HttpResponse object we are trying to deserialize
        requestId -
        Returns:
        HistoryRangeResponse
        Throws:
        IOException - if our entity is somehow corrupt or we can't get it
        IngestResponseException - - if we have an uncategorized network issue
        BackOffException - - if we have a 503 issue
      • unmarshallConfigureClientResponse

        public static ConfigureClientResponse unmarshallConfigureClientResponse​(net.snowflake.client.jdbc.internal.apache.http.HttpResponse response,
                                                                                UUID requestId)
                                                                         throws IOException,
                                                                                IngestResponseException,
                                                                                BackOffException
        unmarshallConfigureClientResponse - Given an HttpResponse object, attempts to deserialize it into a ConfigureClientResponse
        Parameters:
        response - HttpResponse
        requestId -
        Returns:
        ConfigureClientResponse
        Throws:
        IOException - if our entity is somehow corrupt or we can't get it
        IngestResponseException - - if we have an uncategorized network issue
        BackOffException - - if we have a 503 issue
      • unmarshallGetClientStatus

        public static ClientStatusResponse unmarshallGetClientStatus​(net.snowflake.client.jdbc.internal.apache.http.HttpResponse response,
                                                                     UUID requestId)
                                                              throws IOException,
                                                                     IngestResponseException,
                                                                     BackOffException
        unmarshallGetClientStatus - Given an HttpResponse object, attempts to deserialize it into a ClientStatusResponse
        Parameters:
        response - HttpResponse
        requestId -
        Returns:
        ClientStatusResponse
        Throws:
        IOException - if our entity is somehow corrupt or we can't get it
        IngestResponseException - - if we have an uncategorized network issue
        BackOffException - - if we have a 503 issue
      • unmarshallStreamingIngestResponse

        public static <T> T unmarshallStreamingIngestResponse​(net.snowflake.client.jdbc.internal.apache.http.HttpResponse response,
                                                              Class<T> valueType,
                                                              ServiceResponseHandler.ApiName apiName)
                                                       throws IOException,
                                                              IngestResponseException
        unmarshallStreamingIngestResponse Given an HttpResponse object - attempts to deserialize it into an Object based on input type
        Parameters:
        response - http response from server
        valueType - the class type
        apiName - enum to represent the corresponding api name
        Returns:
        the corresponding response object based on input class type
        Throws:
        IOException - if a low-level I/O problem
        IngestResponseException - if received an exceptional status code