Class AbstractSubResource<W extends AbstractSubResourceWebService<?>>
java.lang.Object
de.aristaflow.ilm.ws.rest.base.service.AbstractSubResource<W>
- Type Parameters:
W- TheAbstractSubResourceWebServicewhich 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
ConstructorsModifierConstructorDescriptionprotectedAbstractSubResource(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 TypeMethodDescriptionprotected ExceptionAdapts 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 voidensureReqMaxVersion(String required) Ensures that the current request wants at most the designatedrequiredAPI version (or the same but not no version).protected voidensureReqMinVersion(String required) Ensures that the current request wants at least the designatedrequiredAPI version (or the same or the current, aka.protected de.aristaflow.adept2.base.communication.rest.ExceptionHandlerGets the exception handler creating appropriate wrapping exceptions for expected exceptions.protected LoggerGets the logger to be used by web service endpoint implementations.protected com.fasterxml.jackson.databind.ObjectMapperGets the object mapper for stubs of this sub resource.protected de.aristaflow.adept2.base.communication.rest.RequestHandlerGets the request handler allowing to access additional data from requests, e.protected de.aristaflow.adept2.base.communication.rest.ResponseHandlerGets the response handler allowing to adapt the responses without returning aResponseinstance but the normal return value of the method.protected de.aristaflow.adept2.base.communication.rest.ServiceResourceConfigGets the configuration of this service resource.protected WGets the web service instance mapping from ILM to the Java API and back.
-
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 aResponseinstance 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 aResponseinstance but the normal return value of the method.- Returns:
- The response handler allowing to adapt the responses without returning a
Responseinstance 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
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
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
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
Ensures that the current request wants at least the designatedrequiredAPI 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
Ensures that the current request wants at most the designatedrequiredAPI version (or the same but not no version).- Parameters:
required- The version the current request needs to request at most (and not no version).
-