(Work in progress)
See also basic layering documentation: Proposal: Data Layering for Base64, Line-Folding, Compression, Etc
Extension of it for Checksums/CRC/Parity: Proposal: Checksums, CRC, Parity - Layering Enhancements
A Basic Mechanism Exists
As part of the work for
, I added new test layers in the daffodil-test module.You can see this in PR: https://github.com/apache/daffodil/pull/643
This illustrates a way of doing "field extensibility" of layer transforms now, without any particular dynamic loading feature.
You pass the name of your layer transform using dfdlx:layerTransform='{ "nameOfTransform" }' which because it is an expression it bypasses the validation checks against the LayerTransformEnum defined in the dfdlx.xsd schema. (in daffodil-propgen)
Then somewhere in Scala/Java code before compiling the schema one must call LayerTransformFactory.register(MyLayerTransformFactory), and the MyLayerTransformFactory object has to be defined on the classpath.
In the case of my tests in daffodil-test, the scala test driver code does this call.
This is likely sufficient for application developers using Daffodil via API from software.
However: It won't let you run a new layer transform from the Daffodil CLI tool.
Enabling CLI Loading of Layers
To make the CLI work:
- The enum check in dfdlx.xsd should just be removed entirely, and the diagnostic message if the layer transform is not found should list all the currently registered layer transform names.
- Provide a way that the evaluation of dfdlx:layerTransform property, if the name does not correspond to a registered LayerTransformFactory, it could guess the name of the corresponding LayerTransformFactory object, (e.g, by uppercase first letter, and append "LayerTransformFactory" to the string value of the property) and try to dynamically load it.
Test Plan
Tests in daffodil-test will illustrate how dynamic loading of a layer from a jar works, but the jar in that case isn't a published jar.
The ethernet-ip DFDL schema (on github) can be made into a full exercise of dynamically loading an implementation of IPv4 checksums.