Package com.basistech.rosette.api
Class HttpRosetteAPI
java.lang.Object
com.basistech.rosette.api.common.AbstractRosetteAPI
com.basistech.rosette.api.HttpRosetteAPI
- All Implemented Interfaces:
AutoCloseable
Access to the Analytics API via HTTP.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Builder for HttpRosetteAPI objects. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
Fields inherited from class com.basistech.rosette.api.common.AbstractRosetteAPI
ADDRESS_SIMILARITY_SERVICE_PATH, CATEGORIES_SERVICE_PATH, DOC_ENDPOINTS, ENTITIES_SERVICE_PATH, EVENTS_SERVICE_PATH, INFO_SERVICE_PATH, LANGUAGE_SERVICE_PATH, MORPHOLOGY_SERVICE_PATH, NAME_DEDUPLICATION_SERVICE_PATH, NAME_SIMILARITY_SERVICE_PATH, NAME_TRANSLATION_SERVICE_PATH, NAMES_ENDPOINTS, PING_SERVICE_PATH, RECORD_SIMILARITY_SERVICE_PATH, RELATIONSHIPS_SERVICE_PATH, SEMANTIC_VECTORS_SERVICE_PATH, SENTENCES_SERVICE_PATH, SENTIMENT_SERVICE_PATH, SIMILAR_TERMS_SERVICE_PATH, SUPPORTED_LANGUAGES_SUBPATH, SYNTAX_DEPENDENCIES_SERVICE_PATH, TEXT_EMBEDDING_SERVICE_PATH, TOKENS_SERVICE_PATH, TOPICS_SERVICE_PATH, TRANSLITERATION_SERVICE_PATH
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
createRosetteRequest
(String endpoint, com.basistech.rosette.apimodel.Request request, Class<? extends com.basistech.rosette.apimodel.Response> responseClass) Creates a RosetteRequest which can be sent concurrently through this HttpRosetteAPIint
Return failure retries.com.basistech.rosette.apimodel.SupportedLanguagePairsResponse
getSupportedLanguagePairs
(String endpoint) Gets the set of language, script codes and transliteration scheme pairs supported by the specified Analytics API endpoint.com.basistech.rosette.apimodel.SupportedLanguagesResponse
getSupportedLanguages
(String endpoint) Gets the set of language and script codes supported by the specified Analytics API endpoint.com.basistech.rosette.apimodel.InfoResponse
info()
Gets information about the Analytics API, returns name, version, build number and build time.<RequestType extends com.basistech.rosette.apimodel.Request>
com.basistech.rosette.dm.AnnotatedTextPerform a request to an endpoint of the Analytics API.<RequestType extends com.basistech.rosette.apimodel.Request,
ResponseType extends com.basistech.rosette.apimodel.Response>
ResponseTypePerform a request to an endpoint of the Analytics API.<RequestType extends com.basistech.rosette.apimodel.Request,
ResponseType extends com.basistech.rosette.apimodel.Response>
Future<ResponseType> performAsync
(String endpoint, RequestType request, Class<ResponseType> responseClass) This method always throws UnsupportedOperationException.com.basistech.rosette.apimodel.PingResponse
ping()
Pings the Analytics API for a response indicating that the service is available.
-
Field Details
-
DEFAULT_URL_BASE
- See Also:
-
SERVICE_NAME
- See Also:
-
BINDING_VERSION
-
USER_AGENT_STR
-
-
Method Details
-
getFailureRetries
public int getFailureRetries()Return failure retries.- Returns:
- failure retries
-
info
public com.basistech.rosette.apimodel.InfoResponse info() throws IOException, HttpRosetteAPIExceptionGets information about the Analytics API, returns name, version, build number and build time.- Returns:
- InfoResponse
- Throws:
HttpRosetteAPIException
- Analytics specific exceptionIOException
- General IO exception
-
ping
public com.basistech.rosette.apimodel.PingResponse ping() throws IOException, HttpRosetteAPIExceptionPings the Analytics API for a response indicating that the service is available.- Returns:
- PingResponse
- Throws:
HttpRosetteAPIException
- Analytics specific exceptionIOException
- General IO exception
-
getSupportedLanguages
public com.basistech.rosette.apimodel.SupportedLanguagesResponse getSupportedLanguages(String endpoint) throws HttpRosetteAPIException Gets the set of language and script codes supported by the specified Analytics API endpoint.- Specified by:
getSupportedLanguages
in classAbstractRosetteAPI
- Parameters:
endpoint
- Analytics API endpoint.- Returns:
- SupportedLanguagesResponse
- Throws:
HttpRosetteAPIException
- for an error returned from the Analytics API.
-
getSupportedLanguagePairs
public com.basistech.rosette.apimodel.SupportedLanguagePairsResponse getSupportedLanguagePairs(String endpoint) throws HttpRosetteAPIException Gets the set of language, script codes and transliteration scheme pairs supported by the specified Analytics API endpoint.- Specified by:
getSupportedLanguagePairs
in classAbstractRosetteAPI
- Parameters:
endpoint
- Analytics API endpoint.- Returns:
- SupportedLanguagePairsResponse
- Throws:
HttpRosetteAPIException
- for an error returned from the Analytics API.
-
perform
public <RequestType extends com.basistech.rosette.apimodel.Request,ResponseType extends com.basistech.rosette.apimodel.Response> ResponseType perform(String endpoint, RequestType request, Class<ResponseType> responseClass) throws HttpRosetteAPIException Description copied from class:AbstractRosetteAPI
Perform a request to an endpoint of the Analytics API.- Specified by:
perform
in classAbstractRosetteAPI
- Type Parameters:
RequestType
- the type of the request object.ResponseType
- the type of the response object.- Parameters:
endpoint
- which endpoint.request
- the data for the request.responseClass
- the JavaClass
object for the response object.- Returns:
- the response.
- Throws:
HttpRosetteAPIException
- for an error returned from the Analytics API.com.basistech.rosette.RosetteRuntimeException
- for other errors, such as communications problems with HTTP.
-
perform
public <RequestType extends com.basistech.rosette.apimodel.Request> com.basistech.rosette.dm.AnnotatedText perform(String endpoint, RequestType request) throws HttpRosetteAPIException Description copied from class:AbstractRosetteAPI
Perform a request to an endpoint of the Analytics API.- Specified by:
perform
in classAbstractRosetteAPI
- Type Parameters:
RequestType
- the type of the request object.- Parameters:
endpoint
- which endpoint.request
- the data for the request.- Returns:
- the response,
AnnotatedText
. - Throws:
HttpRosetteAPIException
- for an error returned from the Analytics API.com.basistech.rosette.RosetteRuntimeException
- for other errors, such as communications problems with HTTP.
-
performAsync
public <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 HttpRosetteAPIException This method always throws UnsupportedOperationException.- Specified by:
performAsync
in classAbstractRosetteAPI
- 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 JavaClass
object for the response object.- Returns:
- a
Future
for the response. - Throws:
HttpRosetteAPIException
-
createRosetteRequest
public RosetteRequest createRosetteRequest(String endpoint, com.basistech.rosette.apimodel.Request request, Class<? extends com.basistech.rosette.apimodel.Response> responseClass) Creates a RosetteRequest which can be sent concurrently through this HttpRosetteAPI- Parameters:
endpoint
- the endpoint to which the request is sent torequest
- the request objectresponseClass
- Response's class- Returns:
- RosetteRequest which when started sends the predefined request through this http client
-
close
- Throws:
IOException
-