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
Constructors Modifier Constructor Description protectedAbstractSubResource(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 ExceptionadaptHeaderData(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 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.ExceptionHandlergetExceptionHandler()Gets the exception handler creating appropriate wrapping exceptions for expected exceptions.protected LoggergetLogger()Gets the logger to be used by web service endpoint implementations.protected com.fasterxml.jackson.databind.ObjectMappergetObjectMapper()Gets the object mapper for stubs of this sub resource.protected de.aristaflow.adept2.base.communication.rest.RequestHandlergetRequestHandler()Gets the request handler allowing to access additional data from requests, e.protected de.aristaflow.adept2.base.communication.rest.ResponseHandlergetResponseHandler()Gets 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.ServiceResourceConfiggetServiceResourceConfig()Gets the configuration of this service resource.protected WgetWebService()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 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 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 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
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 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
protected void ensureReqMaxVersion(String required)
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).
-
-