Annotation Type OMClientVersionValidator
An annotation to mark methods that do certain request validations based on the
request protocol's client version.
The methods annotated with this annotation are collected by the
ValidatorRegistry class during the initialization of the server.
The conditions describe the specific use case in which the validator should be
applied to the request.
See VersionExtractor for getting all the supported different Versioned
component's actual version.
The validator method will be applied to the specified request type(s).
To help keep these methods simple and straightforward, use one method for multiple requests only If
you use the same validation code for different requests like bulk reject, in this case specify all the
request types to which the validation applies in an array.
The annotated methods have to have a fixed signature.
A RequestProcessingPhase.PRE_PROCESS phase method is running before
the request is processed by the regular code.
Its signature has to be the following:
- it has to be static and idempotent
- it has to have two parameters
- the first parameter is an
OzoneManagerProtocolProtos.OMRequest
- the second parameter is a ValidationContext
- the method has to return the modified request, or throw a ServiceException
in case the request is considered to be invalid
- the method does not need to care about preserving the request it gets,
the original request is captured and saved by the calling environment.
A RequestProcessingPhase.POST_PROCESS phase method is running once
the
OzoneManagerProtocolProtos.OMResponse
is calculated for a given request.
Its signature has to be the following:
- it has to be static and idempotent
- it has three parameters
- similarly to the pre-processing validators, first parameter is the
OMRequest, the second parameter is the OMResponse, and the third
parameter is a ValidationContext.
- the method has to return the modified OMResponse or throw a
ServiceException if the request is considered invalid based on response.
- the method gets the request object that was supplied for the general
request processing code, not the original request, while it gets a copy
of the original response object provided by the general request processing
code.-
Required Element Summary
Required ElementsModifier and TypeRequired ElementDescriptionorg.apache.hadoop.ozone.ClientVersionThe version before which the validator needs to run.org.apache.hadoop.ozone.request.validation.RequestProcessingPhaseDefines if the validation has to run before or after the general request processing.org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.Type[]The type(s) of the request(s) handled by this validator method.
-
Element Details
-
processingPhase
org.apache.hadoop.ozone.request.validation.RequestProcessingPhase processingPhaseDefines if the validation has to run before or after the general request processing.- Returns:
- if this is a pre or post processing validator
-
requestType
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.Type[] requestTypeThe type(s) of the request(s) handled by this validator method.- Returns:
- the requestType(s) onto which the validator should be applied
-
applyBefore
org.apache.hadoop.ozone.ClientVersion applyBeforeThe version before which the validator needs to run. The validator will run only for requests having a version which precedes the specified version.
-