Package org.apache.hadoop.ozone.om.request.validation


package org.apache.hadoop.ozone.om.request.validation
Request's feature validation handling. This package holds facilities to add new situation specific behaviour to request handling without cluttering the basic logic of the request handler code. Typical use case scenarios, that we had in mind during the design: - during an upgrade, in the pre-finalized state certain request types are to be rejected based on provided properties of the request not based on the request type - a client connects to the server but uses an older version of the protocol - a client connects to the server but uses a newer version of the protocol - the code can handle certain checks that have to run all the time, but at first we do not see a general use case that we would pull in immediately. These are the current ValidationConditions but this list might be extended later on if we see other use cases. The system uses a reflection based discovery to find methods that are annotated with the RequestFeatureValidator annotation. This annotation is used to specify the condition in which a certain validator has to be used, the request type to which the validation should be applied, and the request processing phase in which we apply the validation. One validator can be applied in multiple ValidationCondition but a validator has to handle strictly just one OzoneManagerProtocolProtos.Type. The main reason to avoid validating multiple request types with the same validator, is that these validators have to be simple methods without state any complex validation has to happen in the reql request handling. In these validators we need to ensure that in the given condition the request is rejected with a proper message, or rewritten to the proper format if for example we want to handle an old request with a new server, but we need some additional values set to something default, while in the meantime we want to add meaning to a null value from newer clients. In general, it is a good practice to have the request handling code, and the validations tied together in one class.
  • Class
    Description
    An annotation to mark methods that do certain request validations based on the request protocol's client version.
    An annotation to mark methods that do certain request validations based on the server's layout version and capability to perform a certain operation.
    An annotation to mark methods that do certain request validations.
    Main class to configure and set up and access the request/response validation framework.
    Defines conditions for which validators can be assigned to.
    A context that contains useful information for request validator instances.
    Registry that loads and stores the request validators to be applied by a service.
    Class to extract version out of OM request.