Greetings,

Please consider the following proposal to extend the Daffodil Infoset 
Validation API.  The proposed changes support deploying custom validation 
implementations that are not built as part of the Daffodil distribution but are 
instead made available at runtime as Java Service Provider Interface (SPI) [1] 
"plug-ins".

The intent here is to enable a wide range of validation approaches without 
increasing overhead for the Daffodil project, while increasing the velocity at 
which such implementations can be deployed.

To support the discussion there is a minimally functional reference 
implementation for Daffodil[2] and sample application using Schematron in a 
standalone project[3].

I look forward to discussing the approach in more detail.


Approach
---

1. Extract a Validator interface that describes validation behavior.
2. Detect implementations of this interface at runtime using SPI.
3. Parse additional validation arguments from CLI
4. Pass "Custom" validators through the existing api.ValidationMode.
5. Change ParseResult to execute validation through a SPI provided instance.

- Instances of the Validator are accessed at runtime using SPI metadata from 
META-INF.
- The existing Validator behavior remains and is installed as the "default" 
behavior.
- The current CLI arguments for validation would not change, but an extended 
set of parse patterns is added.


CLI Usage
---

In the Schematron sample application there are a few CLI patterns impemented 
for reference.

The simplest usage, using the BMP schema, is

`daffodil parse --schema data/bmp.dfdl.xsd --validate sch=data/bmp.sch 
data/MARBLES.BMP`

Where 'sch' is the lookup name for the SPI validator and following the '=' is 
an argument which points to the schematron to use.

There are other argument configurations that will need discussed.


Unknowns
---

- How to approach breaking changes in the Validator API
- How to evolve serialized API objects to prevent breakage in existing 
serialized objects (specifically from daffodil.api.ValidationMode)
- Is there a better overall approach to this  :P



1. https://docs.oracle.com/javase/tutorial/ext/basics/spi.html
2. https://github.com/ctc-oss/incubator-daffodil
3. https://github.com/ctc-oss/daffodil-schematron-validator



--
John Wass
Software Engineer
Concurrent Technologies Corporation


-----------------------------------------------------------------
This message and any files transmitted within are intended
solely for the addressee or its representative and may contain
company proprietary information.  If you are not the intended
recipient, notify the sender immediately and delete this
message.  Publication, reproduction, forwarding, or content
disclosure is prohibited without the consent of the original
sender and may be unlawful.

Concurrent Technologies Corporation and its Affiliates.
www.ctc.com  1-800-282-4392
-----------------------------------------------------------------

Reply via email to