Configuration Validation
As mentioned earlier the configuration file syntax only describes plug-ins in general, but does not know anything about concrete implementations. Thus configuration parameters of plug-ins have to be verified programmatically. nevisDataPorter provides some validation infrastructure to free plug-ins from repetitive validation code.
A plug-in has to provide a description of its configuration parameters in a public static class member called DESC. The following classes must be used.
/**
* Plug-In Description
*/
Desc(
Class<?> objectType, // class of the object to create.
PluginType pluginType, // type of the object e.g. DATASOURCE
Param[] parameters // description of all parameters.
);
/**
* Description of a configuration parameters.
*/
public Param(
String name, // name of the configuration attribute
boolean mandatory, // is the configuration attribute mandatory
Object defaultValue, // default value for non mandatory
Validator validator, // validates the configuration value
boolean deferred, // is deferred evaluation allowed
boolean sensitive // if the value can be shown in the exception
);
The Validator is an interface. nevisDataPorter provides a bunch of different implementations. Nevertheless, a plugin can provide its own Validators if necessary.