jena icon indicating copy to clipboard operation
jena copied to clipboard

Improve ability to support custom arguments for Fuseki Servers

Open rvesse opened this issue 4 months ago • 3 comments

Version

5.1.0

Feature

The Fuseki Modules mechanism makes it possible to add extensions to Fuseki but modules have to rely upon external configuration sources e.g. System Properties, Environment Variables, Fuseki Configuration file etc. because there isn't a meaningful way to pass configuration via the command line.

FusekiMain is built on Jena's general CLI framework which means we can in principal extend FusekiMain and add additional arguments via the constructor, or use the static FusekiMain.addArgModule() method to register global extensions.

However, it's hard to do anything meaningful with these custom arguments, processModulesAndArgs() currently populates a private ServerConfig class which is then used to actually populate a FusekiServer.builder() via a private static applyServerArgs() which cannot be modified. Thus even if a custom argument is introduced the only way for it to pass configuration to a module would be by placing it into System Properties, static variable or another JVM wide store that the module can later read back.

As a practical example of this we're looking to introduce support for specifying Fuseki configuration via a YAML configuration file for which we'd like to add a --yaml-config <yaml-file> argument and then have a FusekiModule do a prepare() step which reads in the <yaml-file> and modifies the FusekiServer.Builder accordingly. Right now we can't do that cleanly because there's no way to get the value of <yaml-file> passed into the builder for later access without resorting to passing it out-of-band.

It would be better if we were able to carry extra configuration information via ServerConfig and override applyServerArgs() so that we can apply that to the builder this would offer users who want to extend FusekiMain much more flexibility.

Are you interested in contributing a solution yourself?

Yes

rvesse avatar Oct 02 '24 13:10 rvesse