Class JDKRESTClientConnector
java.lang.Object
org.odpi.openmetadata.frameworks.connectors.Connector
org.odpi.openmetadata.frameworks.connectors.ConnectorBase
org.odpi.openmetadata.adapters.connectors.restclients.RESTClientConnector
org.odpi.openmetadata.adapters.connectors.restclients.jdk.JDKRESTClientConnector
- All Implemented Interfaces:
RESTClientCalls,AuditLoggingComponent,SecureConnectorExtension,VirtualConnectorExtension
JDKRESTClientConnector is responsible for issuing calls to the server's REST APIs using the JDK's native
java.net.http.HttpClient rather than a third-party framework such as Spring. It supports connection reuse
and HTTP/2 through java.net.http.HttpClient, and it calls Jackson directly to (de)serialize request and
response bodies, so that Jackson's own detailed error messages are surfaced unwrapped when a response body
cannot be parsed into the expected type.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.odpi.openmetadata.frameworks.connectors.ConnectorBase
ConnectorBase.ProtectedConnection -
Field Summary
Fields inherited from class org.odpi.openmetadata.adapters.connectors.restclients.RESTClientConnector
auditLogFields inherited from class org.odpi.openmetadata.frameworks.connectors.ConnectorBase
connectionBean, connectorInstanceId, embeddedConnectors, secretsStoreConnectorMap -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> TcallDeleteRESTCall(String methodName, Class<T> returnClass, String urlTemplate, Object requestBody, Object... params) Issue a DELETE REST call that returns a response object.<T> TcallDeleteRESTCallNoParams(String methodName, Class<T> returnClass, String urlTemplate, Object requestBody) Issue a DELETE REST call that returns a response object.<T> TcallGetRESTCall(String methodName, Class<T> returnClass, String urlTemplate, Object... params) Issue a GET REST call that returns a response object.<T> TcallGetRESTCallNoParams(String methodName, Class<T> returnClass, String urlTemplate) Issue a GET REST call that returns a response object.<T> TcallPatchRESTCall(String methodName, Class<T> returnClass, String urlTemplate, Object requestBody, Object... params) Issue a PATCH REST call that returns a response object.<T> TcallPostRESTCall(String methodName, Class<T> returnClass, String urlTemplate, Object requestBody, Object... params) Issue a POST REST call that returns a response object.<T> TcallPostRESTCallNoParams(String methodName, Class<T> returnClass, String urlTemplate, Object requestBody) Issue a POST REST call that returns a response object.<T> TcallPutRESTCall(String methodName, Class<T> returnClass, String urlTemplate, Object requestBody, Object... params) Issue a PUT REST call that returns a response object.<T> TcallPutRESTCallNoParams(String methodName, Class<T> returnClass, String urlTemplate, Object requestBody) Issue a PUT REST call that returns a response object.voidstart()Indicates that the connector is completely configured and can begin processing.Methods inherited from class org.odpi.openmetadata.adapters.connectors.restclients.RESTClientConnector
getConnectorComponentDescription, setAuditLogMethods inherited from class org.odpi.openmetadata.frameworks.connectors.ConnectorBase
combineConfigurationProperties, disconnect, disconnectConnectors, equals, fromCamelToCanonicalCase, fromCanonicalToCamelCase, fromCanonicalToKebabCase, fromCanonicalToSnakeCase, fromKebabToCanonicalCase, fromSnakeToCanonicalCase, getArrayConfigurationProperty, getArrayConfigurationProperty, getArrayConfigurationProperty, getBooleanConfigurationProperty, getConnection, getConnectorInstanceId, getDateConfigurationProperty, getIntConfigurationProperty, getLongConfigurationProperty, getSecretsCollectionName, getSecretsLocation, getSecretsProvider, getStringConfigurationProperty, getStringConfigurationProperty, getSuppliedPlaceholderProperties, hashCode, initialize, initializeEmbeddedConnectors, initializeSecretsStoreConnector, isActive, logExceptionRecord, logRecord, logRecord, throwMissingConfigurationProperty, throwMissingElement, throwMissingEndpointAddress, throwMissingResource, throwNoAsset, throwWrongTypeOfAsset, throwWrongTypeOfResource, throwWrongTypeOfRootSchema, toStringMethods inherited from class org.odpi.openmetadata.frameworks.connectors.Connector
clearStatisticProperty, clearStatisticTimestamp, getConnectorStatistics, getStatisticCounter, getStatisticProperty, getStatisticTimestamp, incrementStatisticCounter, initializeStatisticCounter, refreshStatistics, setStatisticProperty, setStatisticTimestampMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.odpi.openmetadata.frameworks.connectors.SecureConnectorExtension
initializeSecretsStoreConnector
-
Constructor Details
-
JDKRESTClientConnector
public JDKRESTClientConnector()Default constructor
-
-
Method Details
-
start
Indicates that the connector is completely configured and can begin processing.- Overrides:
startin classConnectorBase- Throws:
ConnectorCheckedException- the connector detected a problem.UserNotAuthorizedException- the connector was disconnected before/during start
-
callGetRESTCallNoParams
public <T> T callGetRESTCallNoParams(String methodName, Class<T> returnClass, String urlTemplate) throws RESTServerException Issue a GET REST call that returns a response object.- Type Parameters:
T- class name- Parameters:
methodName- name of the method being called.returnClass- class of the response object.urlTemplate- template of the URL for the REST API call with place-holders for the parameters.- Returns:
- response object
- Throws:
RESTServerException- something went wrong with the REST call stack.
-
callGetRESTCall
public <T> T callGetRESTCall(String methodName, Class<T> returnClass, String urlTemplate, Object... params) throws RESTServerException Issue a GET REST call that returns a response object.- Type Parameters:
T- class name- Parameters:
methodName- name of the method being called.returnClass- class of the response object.urlTemplate- template of the URL for the REST API call with place-holders for the parameters.params- a list of parameters that are slotted into the url template.- Returns:
- response object
- Throws:
RESTServerException- something went wrong with the REST call stack.
-
callPostRESTCallNoParams
public <T> T callPostRESTCallNoParams(String methodName, Class<T> returnClass, String urlTemplate, Object requestBody) throws RESTServerException Issue a POST REST call that returns a response object. This is typically a create, update, or find with complex parameters.- Type Parameters:
T- class name- Parameters:
methodName- name of the method being called.returnClass- class of the response object.urlTemplate- template of the URL for the REST API call with place-holders for the parameters.requestBody- request body for the request.- Returns:
- response object
- Throws:
RESTServerException- something went wrong with the REST call stack.
-
callPostRESTCall
public <T> T callPostRESTCall(String methodName, Class<T> returnClass, String urlTemplate, Object requestBody, Object... params) throws RESTServerException Issue a POST REST call that returns a response object. This is typically a create, update, or find with complex parameters.- Type Parameters:
T- class name- Parameters:
methodName- name of the method being called.returnClass- class of the response object.urlTemplate- template of the URL for the REST API call with place-holders for the parameters.requestBody- request body for the request.params- a list of parameters that are slotted into the url template.- Returns:
- response object
- Throws:
RESTServerException- something went wrong with the REST call stack.
-
callPutRESTCall
public <T> T callPutRESTCall(String methodName, Class<T> returnClass, String urlTemplate, Object requestBody, Object... params) throws RESTServerException Issue a PUT REST call that returns a response object. This is typically an update.- Type Parameters:
T- class name- Parameters:
methodName- name of the method being called.returnClass- class of the response object.urlTemplate- template of the URL for the REST API call with place-holders for the parameters.requestBody- request body for the request.params- a list of parameters that are slotted into the url template.- Returns:
- response object
- Throws:
RESTServerException- something went wrong with the REST call stack.
-
callPutRESTCallNoParams
public <T> T callPutRESTCallNoParams(String methodName, Class<T> returnClass, String urlTemplate, Object requestBody) throws RESTServerException Issue a PUT REST call that returns a response object. This is typically an update.- Type Parameters:
T- class name- Parameters:
methodName- name of the method being called.returnClass- class of the response object.urlTemplate- template of the URL for the REST API call with place-holders for the parameters.requestBody- request body for the request.- Returns:
- response object
- Throws:
RESTServerException- something went wrong with the REST call stack.
-
callDeleteRESTCallNoParams
public <T> T callDeleteRESTCallNoParams(String methodName, Class<T> returnClass, String urlTemplate, Object requestBody) throws RESTServerException Issue a DELETE REST call that returns a response object.- Type Parameters:
T- class name- Parameters:
methodName- name of the method being called.returnClass- class of the response object.urlTemplate- template of the URL for the REST API call with place-holders for the parameters.requestBody- request body for the request.- Returns:
- Object
- Throws:
RESTServerException- something went wrong with the REST call stack.
-
callDeleteRESTCall
public <T> T callDeleteRESTCall(String methodName, Class<T> returnClass, String urlTemplate, Object requestBody, Object... params) throws RESTServerException Issue a DELETE REST call that returns a response object.- Type Parameters:
T- class name- Parameters:
methodName- name of the method being called.returnClass- class of the response object.urlTemplate- template of the URL for the REST API call with place-holders for the parameters.requestBody- request body for the request.params- a list of parameters that are slotted into the url template.- Returns:
- Object
- Throws:
RESTServerException- something went wrong with the REST call stack.
-
callPatchRESTCall
public <T> T callPatchRESTCall(String methodName, Class<T> returnClass, String urlTemplate, Object requestBody, Object... params) throws RESTServerException Issue a PATCH REST call that returns a response object.- Type Parameters:
T- type of the return object- Parameters:
methodName- name of the method being called.returnClass- class of the response object.urlTemplate- template of the URL for the REST API call with place-holders for the parameters.requestBody- request body for the request.params- a list of parameters that are slotted into the url template.- Returns:
- Object
- Throws:
RESTServerException- something went wrong with the REST call stack.
-