0

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

sairn
  • 461
  • 3
  • 24
  • 58

1 Answers1

0

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.

stevedlawrence
  • 466
  • 3
  • 6