org.eclipse.wst.validation.package.html Maven / Gradle / Ivy
Validation Framework
A framework for calling validators that are build based.
Also see Frequently Asked Questions
There are two main types of validation, build based and
as you type. This framework supports build based
validation. If auto build is turned on then the validators are called
when the user saves their file. If auto build is not turned on then
the validators are called when the user starts a build.
This framework was added to WTP in version 3.0.
Dependency Support
Sometimes resources depend on other resources, to determine whether they are
valid or not. An example would be that an XML resource could depend on a DTD. If at some
point in the future the DTD changes, then the dependent XML resource should be
revalidated to ensure that it still meets the requirements of the changed DTD
file. In order to do this efficiently, there needs to be an association between
the DTD and all the resources that depend on it.
To be as efficient as possible, the validation framework allows
this dependency information to be returned as part of a
validate operation. Since the validator needed to figure this out anyways,
why not pass this information back to the framework, so that it can be saved.
This saves the cost of having to parse the file at some later point in time
(when the file is probably sitting cold on disk). The fewer times that we need
to open, read and/or parse the same file, will improve the performance of the
product.
In particular when the validate method returns, a
ValidationResult must be returned, inside of
this result, all your dependencies need to be specified with the
setDependsOn method.
In addition to keeping the dependency information
up-to-date through the normal course of validation, direct access is also
provided to the dependency support through the
getDependencyIndex
method. The IDependencyIndex allows you to
directly manipulate the dependency information for a validator.
Entry Points into the Validation Framework
Here are some of the points where the platform calls into the framework:
- Builder - ValidationBuilder
- IFacetedProjectListener - ValManager
- IJobChangeListener - ValidationOperation, ValidationOperation.ValidationLauncherJob
- IProjectChangeListener - ValManager
- IPropertyChangeListener - ValidationConfiguration, DisabledResourceManager
- IResourceChangeListener - EventManger
- IValChangedListener - ValManager, DisabledValidatorManager