[collectd] (Generic) Java plugin available for development/testing.

Florian Forster octo at verplant.org
Wed Feb 18 15:34:48 CET 2009


I started some work on Java integration into the collectd in form of a
new plugin, called simply `java'. It integrates a Java VM just like the
`perl' plugin integrates a Perl-interpreter.

The code is in a very early stage and probably unstable as anything. I'm
posting this in the hope to get some feedback at this early stage, while
design changes can still be done without much pain. Well, at least not
THAT much pain..

In a way, it brings together the code provided by Justo and Doug:

  * It integrates a JVM into the daemon, loads Java classes, creates
    objects and calls methods of those objects. Much of this was learned
    from Justo's code, thank you very much :)

  * In contrast to Justo's code, the Java API is very similar to
    collectd's C API: When an object is instantiated, the code will look
    for the following methods:
      int Init ();
      int Read ();
      int Write (ValueList);
      int Shutdown ();
    Those functions are called when the appropriate C functions are
    called, too. This means, it's possible write `read' and `write'
    plugins in Java. Other types are currently not implemented.

  * Java classes can call (some of) collectd's API functions. Right now,
    this is only `plugin_dispatch_values', which is available as static
    function via:
      public static void
      org.collectd.java.CollectdAPI.DispatchValues (ValueList);

  * The Java representation of the data has been taken from jcollectd,
    which Doug / Hyperic released under the GPLv2. Thanks again :)

The code is available in the `ff/java' branch from the normal collectd
Git repository.

As sad above, any feedback is highly welcome. Here are some of the
questions I currently have in mind:

  * Would it make sense to move `CollectdAPI' and `ValueList' and
    `DataSource' to `org.collectd.api' or something like that?

  * I was going to write a Java representation of the `config_item_t'
    data structure, so Java plugins can be configured more or less like
    C plugins. Does that make sense or is there some magic and standard-
    ized way to configure Java programs/components?

  * Would it be better to implement the `plugin_register_*' interface in
    Java, too? As far as I know function-pointers are a bit tricky in
    Java, right?

Florian octo Forster
Hacker in training
GnuPG: 0x91523C3D
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20090218/fa30de87/attachment.pgp 

More information about the collectd mailing list