Steve Lawrence created DAFFODIL-2992:
----------------------------------------

             Summary: Support embedding dependencies in saved parsers
                 Key: DAFFODIL-2992
                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2992
             Project: Daffodil
          Issue Type: Bug
            Reporter: Steve Lawrence


A common headache is building a saved parser that depends on charset, UDF, or 
layer plugins, and then making sure that plugin is made available on the 
classpath when that saved parser is reloaded. It is not a trivial task, and is 
easy to mess up. We should come up with a way to make this much easier and less 
error prone.

One approach is to change the format our our saved parser so that instead of 
just containing the serialized parser, it is a zip file the contains the 
serialized parser as well as any plugins and dependencies.

When the saved parser is reloaded, it could then extract the dependencies and 
make them available via a custom class loader.

One benefit of this is that different saved parsers could have different 
versions of the same plugin, since the classloader can keep that all separate. 
Interactions with the ServiceLoader may add complications.

One issue is how to define which jars should be added, since not all jars want 
to be embedded, just plugin jars. Other jars, like schema jars or daffodil jars 
should not be included.

Maybe with the CLI it must be done manually with a new option to the save 
parser command, e.g.

daffodil save-parser -s foo.dfdl.xsd -j charset.jar -j layer.jar foo.bin

Alternatively, now that the daffodil SBT plugin is more common, we could 
potentially add logic in that to scan libraryDependencies and add those when 
using "sbt daffodilPackageBin". It's not clear how to filter out schema jars 
and only get charset jars.

The DataProcessor.save API probably wants to change so that it can accept a 
list of additional jars to embed.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to