/**
* Java representation of collectd/src/plugin.h:plugin_register_config
*/
- native public static int RegisterConfig (String name,
- CollectdConfigInterface obj);
+ native public static int registerConfig (String name,
+ CollectdConfigInterface object);
/**
* Java representation of collectd/src/plugin.h:plugin_register_init
*/
- native public static int RegisterInit (String name,
- CollectdInitInterface obj);
+ native public static int registerInit (String name,
+ CollectdInitInterface object);
/**
* Java representation of collectd/src/plugin.h:plugin_register_read
*/
- native public static int RegisterRead (String name,
- CollectdReadInterface obj);
+ native public static int registerRead (String name,
+ CollectdReadInterface object);
/**
* Java representation of collectd/src/plugin.h:plugin_register_write
*/
- native public static int RegisterWrite (String name,
- CollectdWriteInterface obj);
+ native public static int registerWrite (String name,
+ CollectdWriteInterface object);
/**
* Java representation of collectd/src/plugin.h:plugin_register_shutdown
*/
- native public static int RegisterShutdown (String name,
- CollectdShutdownInterface obj);
+ native public static int registerShutdown (String name,
+ CollectdShutdownInterface object);
/**
* Java representation of collectd/src/plugin.h:plugin_dispatch_values
*/
- native public static int DispatchValues (ValueList vl);
+ native public static int dispatchValues (ValueList vl);
/**
* Java representation of collectd/src/plugin.h:plugin_get_ds
*/
- native public static DataSet GetDS (String type);
+ native public static DataSet getDS (String type);
/**
* Java representation of collectd/src/plugin.h:plugin_log
*/
- native private static void Log (int severity, String message);
+ native private static void log (int severity, String message);
- public static void LogError (String message)
+ public static void logError (String message)
{
- Log (LOG_ERR, message);
- } /* void LogError */
+ log (LOG_ERR, message);
+ } /* void logError */
- public static void LogWarning (String message)
+ public static void logWarning (String message)
{
- Log (LOG_WARNING, message);
- } /* void LogWarning */
+ log (LOG_WARNING, message);
+ } /* void logWarning */
- public static void LogNotice (String message)
+ public static void logNotice (String message)
{
- Log (LOG_NOTICE, message);
- } /* void LogNotice */
+ log (LOG_NOTICE, message);
+ } /* void logNotice */
- public static void LogInfo (String message)
+ public static void logInfo (String message)
{
- Log (LOG_INFO, message);
- } /* void LogInfo */
+ log (LOG_INFO, message);
+ } /* void logInfo */
- public static void LogDebug (String message)
+ public static void logDebug (String message)
{
- Log (LOG_DEBUG, message);
- } /* void LogDebug */
+ log (LOG_DEBUG, message);
+ } /* void logDebug */
} /* class CollectdAPI */
public interface CollectdConfigInterface
{
- public int Config (OConfigItem ci);
+ public int config (OConfigItem ci);
}
public interface CollectdInitInterface
{
- public int Init ();
+ public int init ();
}
public interface CollectdReadInterface
{
- public int Read ();
+ public int read ();
}
public interface CollectdShutdownInterface
{
- public int Shutdown ();
+ public int shutdown ();
}
public interface CollectdWriteInterface
{
- public int Write (ValueList vl);
+ public int write (ValueList vl);
}
Each callback method is now explained in more detail:
-=head2 Config callback
+=head2 config callback
Interface: B<org.collectd.api.CollectdConfigInterface>
-Signature: I<int> B<Config> (I<OConfigItem>)
+Signature: I<int> B<config> (I<OConfigItem>)
This method is passed a B<OConfigItem> object, if both, method and
configuration, are available. B<OConfigItem> is the root of a tree representing
To signal success, this method has to return zero. Anything else will be
considered an error condition and the plugin will be disabled entirely.
-=head2 Init callback
+=head2 init callback
Interface: B<org.collectd.api.CollectdInitInterface>
-Signature: I<int> B<Init> ()
+Signature: I<int> B<init> ()
This method is called after the configuration has been handled. It is
supposed to set up the plugin. e.E<nbsp>g. start threads, open connections, or
To signal success, this method has to return zero. Anything else will be
considered an error condition and the plugin will be disabled entirely.
-=head2 Read callback
+=head2 read callback
Interface: B<org.collectd.api.CollectdReadInterface>
-Signature: I<int> B<Read> ()
+Signature: I<int> B<read> ()
This method is called periodically and is supposed to gather statistics in
whatever fashion. These statistics are represented as a B<ValueList> object and
-sent to the daemon using B<DispatchValues>, see L<"CALLING API FUNCTIONS">
+sent to the daemon using B<dispatchValues>, see L<"CALLING API FUNCTIONS">
below.
To signal success, this method has to return zero. Anything else will be
Java "read"-methods are not suspended for increasing intervals like C
"read"-functions.
-=head2 Write callback
+=head2 write callback
Interface: B<org.collectd.api.CollectdWriteInterface>
-Signature: I<int> B<Write> (I<ValueList>)
+Signature: I<int> B<write> (I<ValueList>)
This method is called whenever a value is dispatched to the daemon. The
corresponding C "write"-functions are passed a C<data_set_t>, so they can
To signal success, this method has to return zero. Anything else will be
considered an error condition and cause an appropriate message to be logged.
-=head2 Shutdown callback
+=head2 shutdown callback
Interface: B<org.collectd.api.CollectdShutdownInterface>
-Signature: I<int> B<Shutdown> ()
+Signature: I<int> B<shutdown> ()
This method is called when the daemon is shutting down. You should not rely on
the destructor to clean up behind the object but use this function instead.
{
public Foobar ()
{
- CollectdAPI.RegisterRead ("Foobar", this);
+ CollectdAPI.registerRead ("Foobar", this);
}
- public int Read ()
+ public int read ()
{
ValueList vl;
/* Do something... */
- CollectdAPI.DispatchValues (vl);
+ CollectdAPI.dispatchValues (vl);
}
}
The currently exported functions are:
-=head2 RegisterRead
+=head2 registerRead
-Signature: I<int> B<RegisterRead> (I<String> name,
+Signature: I<int> B<registerRead> (I<String> name,
I<CollectdReadInterface> object)
-Registers the B<Read> function of I<object> with the daemon.
+Registers the B<read> function of I<object> with the daemon.
For a description of the B<CollectdReadInterface> interface, see
L<"REGISTERING CALLBACKS"> above.
Returns zero upon success and non-zero when an error occurred.
-=head2 RegisterWrite
+=head2 registerWrite
-Signature: I<int> B<RegisterWrite> (I<String> name,
+Signature: I<int> B<registerWrite> (I<String> name,
I<CollectdWriteInterface> object)
-Registers the B<Write> function of I<object> with the daemon.
+Registers the B<write> function of I<object> with the daemon.
For a description of the B<CollectdWriteInterface> interface, see
L<"REGISTERING CALLBACKS"> above.
Returns zero upon success and non-zero when an error occurred.
-=head2 DispatchValues
+=head2 dispatchValues
-Signature: I<int> B<DispatchValues> (I<ValueList>)
+Signature: I<int> B<dispatchValues> (I<ValueList>)
Passes the values represented by the B<ValueList> object to the
C<plugin_dispatch_values> function of the daemon. The "data set" (or list of
Returns zero upon success or non-zero upon failure.
-=head2 GetDS
+=head2 getDS
-Signature: I<DataSet> B<GetDS> (I<String>)
+Signature: I<DataSet> B<getDS> (I<String>)
Returns the approrpate I<type> or B<null> if the type is not defined.
* Java. */
static JNINativeMethod jni_api_functions[] = /* {{{ */
{
- { "DispatchValues",
+ { "dispatchValues",
"(Lorg/collectd/api/ValueList;)I",
cjni_api_dispatch_values },
- { "GetDS",
+ { "getDS",
"(Ljava/lang/String;)Lorg/collectd/api/DataSet;",
cjni_api_get_ds },
- { "RegisterConfig",
+ { "registerConfig",
"(Ljava/lang/String;Lorg/collectd/api/CollectdConfigInterface;)I",
cjni_api_register_config },
- { "RegisterInit",
+ { "registerInit",
"(Ljava/lang/String;Lorg/collectd/api/CollectdInitInterface;)I",
cjni_api_register_init },
- { "RegisterRead",
+ { "registerRead",
"(Ljava/lang/String;Lorg/collectd/api/CollectdReadInterface;)I",
cjni_api_register_read },
- { "RegisterWrite",
+ { "registerWrite",
"(Ljava/lang/String;Lorg/collectd/api/CollectdWriteInterface;)I",
cjni_api_register_write },
- { "RegisterShutdown",
+ { "registerShutdown",
"(Ljava/lang/String;Lorg/collectd/api/CollectdShutdownInterface;)I",
cjni_api_register_shutdown },
- { "Log",
+ { "log",
"(ILjava/lang/String;)V",
cjni_api_log },
};
switch (type)
{
case CB_TYPE_CONFIG:
- method_name = "Config";
+ method_name = "config";
method_signature = "(Lorg/collectd/api/OConfigItem;)I";
break;
case CB_TYPE_INIT:
- method_name = "Init";
+ method_name = "init";
method_signature = "()I";
break;
case CB_TYPE_READ:
- method_name = "Read";
+ method_name = "read";
method_signature = "()I";
break;
case CB_TYPE_WRITE:
- method_name = "Write";
+ method_name = "write";
method_signature = "(Lorg/collectd/api/ValueList;)I";
break;
case CB_TYPE_SHUTDOWN:
- method_name = "Shutdown";
+ method_name = "shutdown";
method_signature = "()I";
break;