Class AbstractSubResource<W extends AbstractSubResourceWebService<?>>

    • 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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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.
      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).
      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.
      protected de.aristaflow.adept2.base.communication.rest.ExceptionHandler getExceptionHandler()
      Gets the exception handler creating appropriate wrapping exceptions for expected exceptions.
      protected Logger getLogger()
      Gets the logger to be used by web service endpoint implementations.
      protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
      Gets the object mapper for stubs of this sub resource.
      protected de.aristaflow.adept2.base.communication.rest.RequestHandler getRequestHandler()
      Gets the request handler allowing to access additional data from requests, e. g. headers.
      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.
      protected de.aristaflow.adept2.base.communication.rest.ServiceResourceConfig getServiceResourceConfig()
      Gets the configuration of this service resource.
      protected W getWebService()
      Gets the web service instance mapping from ILM to the Java API and back.
    • Constructor Detail

      • 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 Detail

      • 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).