Is it feasible to pre-compile (Maven/Gradle) Apache Daffodil DataProcessor for use as a dependency in a separate parsing app?

107 views Asked by At

Apache Daffodil newby...

Trying to save start up time with an Apache Daffodil message parsing application.

Just wanted to know if it were possible (or feasible) to pre-compile an Apache Daffodil "DataProcessor" object (with a designated schema, of course) - and then to use it as a build dependency for a separate application using Daffodil parsing.
---I.e., versus awaiting the schema compile at runtime

1

There are 1 answers

0
stevedlawrence On

The Daffodil API does provide methods to serialize and deserialize a DataProcessor via the DataProcessor#save and Compiler#reload methods.

For example, to save the DataProcessor to a file:

DataProcessor dp = ...;

FileChannel fc = FileChannel.open(filePath);
dp.save(fc);

To reload that file to a data processor:

FileChannel fc = FileChannel.open(filePath);
DataProcessor dp = Compiler.reload(fc);

That example is for using a file, but the API supports saving to any WritableByteChannel and reloading from any ReadableByteChannel.

There aren't any existing Maven/Gradle plugins that automatically do this that I am aware of, but the compile/save could be put in a resource generator, and then reload called at runtime to load the resource.