Class AbstractRestStub

  • Direct Known Subclasses:
    ActivityStateNotificationRestStub, ClientWorklistRestStub, ExecutionMessageNotificationRestStub, InstanceStateNotificationRestStub, OrgPolicyScriptHandlerRestStub

    public class AbstractRestStub
    extends AbstractStub
    This class provides the means for making REST calls to callback objects. These objects are provided as URLs satisfying the corresponding callback interface. Subclasses of this class have to implement the callback interface defined as Java or ILM and forward the calls to the REST callback. Afterwards the responses of the callback have to be converted and returned to the caller of the callback (stub).
    This also includes handling of expected exceptions (which belong to the interface) as well as various unexpected exceptions, especially ones caused by the REST framework.

    This stub implementation is rather simple and uses a plain HttpURLConnection and an ObjectMapper for converting to and from JSON.

    • Field Detail

      • baseUrl

        protected final URL baseUrl
        The base URL of the callback.
      • version

        protected final String version
        The API version which to expect from the callback.
    • Constructor Detail

      • AbstractRestStub

        protected AbstractRestStub​(URL baseUrl,
                                   String version,
                                   Supplier<com.fasterxml.jackson.databind.ObjectMapper> om,
                                   LogService logService)
        Creates a new abstract stub providing the basic means for making REST callback calls.
        Parameters:
        baseUrl - The base URL of the callback.
        version - The API version which to expect from the callback.
        om - The object mapper (supplier) for reading JSON objects from responses (including exceptions).
        logService - The log service for creating class-specific loggers.
    • Method Detail

      • get

        public AbstractRestStub.Request get​(String path)
        Gets a #GET request for the designated path (operation) at the callback.
        Parameters:
        path - The path (operation) which to call.
        Returns:
        A #GET request for the designated path (operation) at the callback.
      • post

        public AbstractRestStub.Request post​(String path)
        Gets a #POST request for the designated path (operation) at the callback.
        Parameters:
        path - The path (operation) which to call.
        Returns:
        A #POST request for the designated path (operation) at the callback.
      • delete

        public AbstractRestStub.Request delete​(String path)
        Gets a #DELETE request for the designated path (operation) at the callback.
        Parameters:
        path - The path (operation) which to call.
        Returns:
        A #DELETE request for the designated path (operation) at the callback.
      • put

        public AbstractRestStub.Request put​(String path)
        Gets a #PUT request for the designated path (operation) at the callback.
        Parameters:
        path - The path (operation) which to call.
        Returns:
        A #PUT request for the designated path (operation) at the callback.