Class AbstractRosetteAPI

java.lang.Object
com.basistech.rosette.api.common.AbstractRosetteAPI
All Implemented Interfaces:
AutoCloseable
Direct Known Subclasses:
HttpRosetteAPI

public abstract class AbstractRosetteAPI extends Object implements AutoCloseable
This class defines the common API to Rosette, whether over HTTP or other integration mechanisms.
  • Field Details

  • Constructor Details

    • AbstractRosetteAPI

      public AbstractRosetteAPI()
  • Method Details

    • getSupportedLanguages

      public abstract com.basistech.rosette.apimodel.SupportedLanguagesResponse getSupportedLanguages(String endpoint) throws com.basistech.rosette.apimodel.CommonRosetteAPIException
      Gets the set of language and script codes supported by the specified Rosette API endpoint.
      Parameters:
      endpoint - Rosette API endpoint.
      Returns:
      SupportedLanguagesResponse
      Throws:
      com.basistech.rosette.apimodel.CommonRosetteAPIException - for an error.
    • getSupportedLanguagePairs

      public abstract com.basistech.rosette.apimodel.SupportedLanguagePairsResponse getSupportedLanguagePairs(String endpoint) throws com.basistech.rosette.apimodel.CommonRosetteAPIException
      Gets the set of language, script codes and transliteration scheme pairs supported by the specified Rosette API endpoint.
      Parameters:
      endpoint - Rosette API endpoint.
      Returns:
      SupportedLanguagePairsResponse
      Throws:
      com.basistech.rosette.apimodel.CommonRosetteAPIException - for an error returned from the Rosette API.
    • perform

      public abstract <RequestType extends com.basistech.rosette.apimodel.Request, ResponseType extends com.basistech.rosette.apimodel.Response> ResponseType perform(String endpoint, RequestType request, Class<ResponseType> responseClass) throws com.basistech.rosette.apimodel.CommonRosetteAPIException
      Perform a request to an endpoint of the Rosette API.
      Type Parameters:
      RequestType - The class of the request object for this endpoint.
      ResponseType - the class of the response object for this endpoint.
      Parameters:
      endpoint - which endpoint.
      request - the data for the request.
      responseClass - the Java Class object for the response object.
      Returns:
      the response.
      Throws:
      com.basistech.rosette.apimodel.CommonRosetteAPIException - for an error.
    • perform

      public abstract <RequestType extends com.basistech.rosette.apimodel.Request> com.basistech.rosette.dm.AnnotatedText perform(String endpoint, RequestType request) throws com.basistech.rosette.apimodel.CommonRosetteAPIException
      Perform a request to an endpoint of the Rosette API.
      Type Parameters:
      RequestType - The class of the request object for this endpoint.
      Parameters:
      endpoint - which endpoint.
      request - the data for the request.
      Returns:
      the response, AnnotatedText.
      Throws:
      com.basistech.rosette.apimodel.CommonRosetteAPIException - for an error.
    • performAsync

      public abstract <RequestType extends com.basistech.rosette.apimodel.Request, ResponseType extends com.basistech.rosette.apimodel.Response> Future<ResponseType> performAsync(String endpoint, RequestType request, Class<ResponseType> responseClass) throws com.basistech.rosette.apimodel.CommonRosetteAPIException
      Start an asynchronous request to an endpoint of the Rosette API.
      Type Parameters:
      RequestType - The class of the request object for this endpoint.
      ResponseType - the class of the response object for this endpoint.
      Parameters:
      endpoint - which endpoint.
      request - the data for the request.
      responseClass - the Java Class object for the response object.
      Returns:
      a Future for the response.
      Throws:
      com.basistech.rosette.apimodel.CommonRosetteAPIException - for an error.