I started working on an experimental plugin system [1] to play around with
ideas I had for log4j 3. As part of that, I started with a minimal config
file support setup by piggybacking off of Jackson (originally I was just
using Yaml from snakeyaml, but I switched over to ObjectMapper to support
more formats). Upon searching for Jackson data formats, I found this [2]
module that adds property support. For examples, compare the simple.foo
files in [3].

Now I know we'd like to be able to support at least some form of useful
configuration file without external dependencies, though I found it
interesting that most of our config formats could be supported by Jackson
databind. I haven't even looked into it, but I wonder if it'd be possible
to make a data format for Groovy or other scripting languages for config
files as well.

Do note, though, that in Java 9+, the standard XML APIs (SAX, StAX, JAXB,
DOM, etc.) are all outside the java.base module, so we are sort of left
with no built in way of parsing config files besides a flat properties file
(at least not without linking in additional modules which may or may not
continue to exist in the JDK; I have no idea at this point). Choosing an
appropriate strategy for supporting config files will be necessary anyways.

[1]: https://github.com/jvz/plugin-system
[2]: https://github.com/FasterXML/jackson-dataformats-text
[3]: https://github.com/jvz/plugin-system/tree/master/src/test/resources

-- 
Matt Sicker <[email protected]>

Reply via email to