confuse-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Confuse-devel] GSoC / libConfuse Java


From: Zhi An Ng
Subject: Re: [Confuse-devel] GSoC / libConfuse Java
Date: Wed, 2 Jul 2014 13:50:40 +0800

Thanks for sharing, I'm thinking of using JavaCC [1] to parse and generate a `Conf' object, which you can query for options. E.g. the configuration file has this:

globals {
  daemonize = yes
  setuid = yes
}

The API will look something like this

Conf gmondConf = Parser.parse(file);
Section globals = gmondConf.getSection("globals");
Option daemonize = globals.getOption("daemonize");
Boolean isDaemonize = daemonize.toBoolean();

However this is different from how libconfuse works. Libconfuse requires you to register each section and options available before parsing, and will return and error when an unknown section is encountered while parsing.

One possible way is to translate libconfuse to Java and add that as a dependency for use in gmetric4j and other projects that uses similar configuration files.

[1] http://javacc.java.net/

Best,
Zhi An

I had a use for this but was unable to find anything [1].

I ended up with a mess of regexes [2], but would also be happy to swith to something more proper.

[1] https://www.mail-archive.com/address@hiddensourceforge.net/msg07716.html

[2] https://github.com/addthis/metrics-reporter-config/blob/master/src/main/java/com/addthis/metrics/reporter/config/GmondConfigParser.java

On 07/01/2014 08:45 AM, Daniel Pocock wrote:

Hi all,

Zhi An (on CC) is one of the Google Summer of Code students for the
Ganglia project.

He has looked at making a Java parser for libConfuse config files, for
JMXetric to read /etc/ganglia/gmond.conf

Has anybody looked at this in the past?

Are there any other Java libraries that are known to parse libConfuse
format configs?

Would it be OK to contribute this work to the libConfuse Github
repository, so that the C and Java implementations can share the test cases?

Regards,

Daniel


_______________________________________________
Confuse-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/confuse-devel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]