Class AbstractSubResource<W extends AbstractSubResourceWebService<?>>

java.lang.Object
de.aristaflow.ilm.ws.rest.base.service.AbstractSubResource<W>
Type Parameters:
W - The AbstractSubResourceWebService which transforms between web service calls and the corresponding Java API.
Direct Known Subclasses:
ActivityExecutionControlRest, ActivityStartingRest, ActivityTerminationRest, ClientAdministrationRest, DelegationManagerRest, ExecutionControlManagerRest, ExecutionLogManagerRest, GlobalSecurityManagerRest, GlobalUserConfigurationRest, IncWorklistRest, IncWorklistUpdateRest, InstanceControlRest, InstanceExecutionMonitorRest, InstanceManagerRest, ModelChangeOperationsRest, ModelExplorerRest, PolicyResolutionRest, RemoteActivityStartingRest, RemoteExecutionControlManagerRest, RemoteIteratorRest, RemoteProgressMonitorRest, RemoteRuntimeEnvironmentRest, ResModelChangeOperationsRest, ResModelExplorerRest, ResModelExpressionEvaluationRest, ServerStreamStringIteratorRest, SynchronousActivityStartingRest, TemplateManagerRest, WorklistAdministrationRest, WorklistUpdateManagerRest

public abstract class AbstractSubResource<W extends AbstractSubResourceWebService<?>> extends Object
This class provides the basic means for a REST sub resource. It manages the sub resource web service (W) that maps from the generic ILM to the Java API, e. g. transforms the ILM objects to the Java model and back. Usually REST (sub) resources create just simple wrappers which extend this class but do not create instances of sub resource web services. Instead these are retrieved from the corresponding (parent/root) web service.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    AbstractSubResource(W webService, de.aristaflow.adept2.base.communication.rest.RequestHandler reqHandler, de.aristaflow.adept2.base.communication.rest.ResponseHandler respHandler, de.aristaflow.adept2.base.communication.rest.ExceptionHandler excpHandler, de.aristaflow.adept2.base.communication.rest.ServiceResourceConfig srConf, Supplier<com.fasterxml.jackson.databind.ObjectMapper> objectMapper, UnaryOperator<Exception> headerDataExcpAdapter)
    Creates a new REST sub resource the designated (sub) web service using.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected Exception
    Adapts generic data of the designated exception to specific data in case the exception is caused in a lower level due to invalid header data.
    protected void
    Ensures that the current request wants at most the designated required API version (or the same but not no version).
    protected void
    Ensures that the current request wants at least the designated required API version (or the same or the current, aka.
    protected de.aristaflow.adept2.base.communication.rest.ExceptionHandler
    Gets the exception handler creating appropriate wrapping exceptions for expected exceptions.
    protected Logger
    Gets the logger to be used by web service endpoint implementations.
    protected com.fasterxml.jackson.databind.ObjectMapper
    Gets the object mapper for stubs of this sub resource.
    protected de.aristaflow.adept2.base.communication.rest.RequestHandler
    Gets the request handler allowing to access additional data from requests, e.
    protected de.aristaflow.adept2.base.communication.rest.ResponseHandler
    Gets the response handler allowing to adapt the responses without returning a Response instance but the normal return value of the method.
    protected de.aristaflow.adept2.base.communication.rest.ServiceResourceConfig
    Gets the configuration of this service resource.
    protected W
    Gets the web service instance mapping from ILM to the Java API and back.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AbstractSubResource

      protected AbstractSubResource(W webService, de.aristaflow.adept2.base.communication.rest.RequestHandler reqHandler, de.aristaflow.adept2.base.communication.rest.ResponseHandler respHandler, de.aristaflow.adept2.base.communication.rest.ExceptionHandler excpHandler, de.aristaflow.adept2.base.communication.rest.ServiceResourceConfig srConf, Supplier<com.fasterxml.jackson.databind.ObjectMapper> objectMapper, UnaryOperator<Exception> headerDataExcpAdapter)
      Creates a new REST sub resource the designated (sub) web service using.
      Parameters:
      webService - The (sub) web service wrapped by this REST sub resource.
      reqHandler - The request handler allowing to access additional data from requests, e. g. headers.
      respHandler - The response handler allowing to adapt the responses without returning a Response instance but the normal return value of the method.
      excpHandler - The exception handler creating appropriate wrapping exceptions for expected exceptions.
      srConf - The configuration of this service (sub) resource.
      objectMapper - The object mapper created once and used for all stubs of a root resource. Its creation is rather complex.
      headerDataExcpAdapter - A function adapting generic data to specific data in exceptions occurring on a lower level due to invalid header data.
  • Method Details

    • getRequestHandler

      protected de.aristaflow.adept2.base.communication.rest.RequestHandler getRequestHandler()
      Gets the request handler allowing to access additional data from requests, e. g. headers.
      Returns:
      The request handler allowing to access additional data from requests, e. g. headers.
    • getResponseHandler

      protected de.aristaflow.adept2.base.communication.rest.ResponseHandler getResponseHandler()
      Gets the response handler allowing to adapt the responses without returning a Response instance but the normal return value of the method.
      Returns:
      The response handler allowing to adapt the responses without returning a Response instance but the normal return value of the method.
    • getExceptionHandler

      protected de.aristaflow.adept2.base.communication.rest.ExceptionHandler getExceptionHandler()
      Gets the exception handler creating appropriate wrapping exceptions for expected exceptions.
      Returns:
      The exception handler creating appropriate wrapping exceptions for expected exceptions.
    • getServiceResourceConfig

      protected de.aristaflow.adept2.base.communication.rest.ServiceResourceConfig getServiceResourceConfig()
      Gets the configuration of this service resource.
      Returns:
      The configuration of this service resource.
    • getWebService

      protected W getWebService()
      Gets the web service instance mapping from ILM to the Java API and back.
      Returns:
      The web service instance mapping from ILM to the Java API and back.
    • getLogger

      protected Logger getLogger()
      Gets the logger to be used by web service endpoint implementations.
      Returns:
      The logger to be used by web service endpoint implementations.
    • getObjectMapper

      protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
      Gets the object mapper for stubs of this sub resource.

      This will actually create a mapper if none has been created yet. So only call this method if you really need it.

      Returns:
      The object mapper for stubs of this sub resource.
    • adaptHeaderData

      protected Exception adaptHeaderData(Exception e)
      Adapts generic data of the designated exception to specific data in case the exception is caused in a lower level due to invalid header data.
      Parameters:
      e - The exception in which to possibly adapt data.
      Returns:
      The designated exception with possibly adapted data.
    • ensureReqMinVersion

      protected void ensureReqMinVersion(String required)
      Ensures that the current request wants at least the designated required API version (or the same or the current, aka. null).
      Parameters:
      required - The version the current request needs to request at least (or no version).
    • ensureReqMaxVersion

      protected void ensureReqMaxVersion(String required)
      Ensures that the current request wants at most the designated required API version (or the same but not no version).
      Parameters:
      required - The version the current request needs to request at most (and not no version).