From 685611f4154ec03a2d237189c5d8d4b855cd12ce Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Sun, 22 Feb 2009 18:55:27 +0100 Subject: [PATCH] java plugin: Change the name of all functions to conform to the Java convention. --- bindings/java/org/collectd/api/CollectdAPI.java | 56 +++++++++++----------- .../org/collectd/api/CollectdConfigInterface.java | 2 +- .../org/collectd/api/CollectdInitInterface.java | 2 +- .../org/collectd/api/CollectdReadInterface.java | 2 +- .../collectd/api/CollectdShutdownInterface.java | 2 +- .../org/collectd/api/CollectdWriteInterface.java | 2 +- src/collectd-java.pod | 48 +++++++++---------- src/java.c | 26 +++++----- 8 files changed, 70 insertions(+), 70 deletions(-) diff --git a/bindings/java/org/collectd/api/CollectdAPI.java b/bindings/java/org/collectd/api/CollectdAPI.java index 2b6e06cf..3d713bac 100644 --- a/bindings/java/org/collectd/api/CollectdAPI.java +++ b/bindings/java/org/collectd/api/CollectdAPI.java @@ -37,72 +37,72 @@ public class CollectdAPI /** * 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 */ diff --git a/bindings/java/org/collectd/api/CollectdConfigInterface.java b/bindings/java/org/collectd/api/CollectdConfigInterface.java index 87530729..fc6d9bdc 100644 --- a/bindings/java/org/collectd/api/CollectdConfigInterface.java +++ b/bindings/java/org/collectd/api/CollectdConfigInterface.java @@ -23,5 +23,5 @@ package org.collectd.api; public interface CollectdConfigInterface { - public int Config (OConfigItem ci); + public int config (OConfigItem ci); } diff --git a/bindings/java/org/collectd/api/CollectdInitInterface.java b/bindings/java/org/collectd/api/CollectdInitInterface.java index 09a2ab75..6997a2f8 100644 --- a/bindings/java/org/collectd/api/CollectdInitInterface.java +++ b/bindings/java/org/collectd/api/CollectdInitInterface.java @@ -23,5 +23,5 @@ package org.collectd.api; public interface CollectdInitInterface { - public int Init (); + public int init (); } diff --git a/bindings/java/org/collectd/api/CollectdReadInterface.java b/bindings/java/org/collectd/api/CollectdReadInterface.java index d5b924b2..ac6060b8 100644 --- a/bindings/java/org/collectd/api/CollectdReadInterface.java +++ b/bindings/java/org/collectd/api/CollectdReadInterface.java @@ -23,5 +23,5 @@ package org.collectd.api; public interface CollectdReadInterface { - public int Read (); + public int read (); } diff --git a/bindings/java/org/collectd/api/CollectdShutdownInterface.java b/bindings/java/org/collectd/api/CollectdShutdownInterface.java index f0ccba0c..4181a10f 100644 --- a/bindings/java/org/collectd/api/CollectdShutdownInterface.java +++ b/bindings/java/org/collectd/api/CollectdShutdownInterface.java @@ -23,5 +23,5 @@ package org.collectd.api; public interface CollectdShutdownInterface { - public int Shutdown (); + public int shutdown (); } diff --git a/bindings/java/org/collectd/api/CollectdWriteInterface.java b/bindings/java/org/collectd/api/CollectdWriteInterface.java index dd76f2c0..13315a6d 100644 --- a/bindings/java/org/collectd/api/CollectdWriteInterface.java +++ b/bindings/java/org/collectd/api/CollectdWriteInterface.java @@ -23,5 +23,5 @@ package org.collectd.api; public interface CollectdWriteInterface { - public int Write (ValueList vl); + public int write (ValueList vl); } diff --git a/src/collectd-java.pod b/src/collectd-java.pod index 97204bc4..02feff6e 100644 --- a/src/collectd-java.pod +++ b/src/collectd-java.pod @@ -88,11 +88,11 @@ whenever one is available. Each callback method is now explained in more detail: -=head2 Config callback +=head2 config callback Interface: B -Signature: I B (I) +Signature: I B (I) This method is passed a B object, if both, method and configuration, are available. B is the root of a tree representing @@ -103,11 +103,11 @@ root are the first interesting objects. 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 -Signature: I B () +Signature: I B () This method is called after the configuration has been handled. It is supposed to set up the plugin. e.Eg. start threads, open connections, or @@ -116,15 +116,15 @@ check if can do anything useful at all. 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 -Signature: I B () +Signature: I B () This method is called periodically and is supposed to gather statistics in whatever fashion. These statistics are represented as a B object and -sent to the daemon using B, see L<"CALLING API FUNCTIONS"> +sent to the daemon using B, see L<"CALLING API FUNCTIONS"> below. To signal success, this method has to return zero. Anything else will be @@ -133,11 +133,11 @@ Currently, returning non-zero does not have any other effects. In particular, Java "read"-methods are not suspended for increasing intervals like C "read"-functions. -=head2 Write callback +=head2 write callback Interface: B -Signature: I B (I) +Signature: I B (I) This method is called whenever a value is dispatched to the daemon. The corresponding C "write"-functions are passed a C, so they can @@ -148,11 +148,11 @@ method of the B object. 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 -Signature: I B () +Signature: I B () 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. @@ -174,16 +174,16 @@ daemon: { 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); } } @@ -195,31 +195,31 @@ class. This makes calling these functions pretty straight forward. The currently exported functions are: -=head2 RegisterRead +=head2 registerRead -Signature: I B (I name, +Signature: I B (I name, I object) -Registers the B function of I with the daemon. +Registers the B function of I with the daemon. For a description of the B interface, see L<"REGISTERING CALLBACKS"> above. Returns zero upon success and non-zero when an error occurred. -=head2 RegisterWrite +=head2 registerWrite -Signature: I B (I name, +Signature: I B (I name, I object) -Registers the B function of I with the daemon. +Registers the B function of I with the daemon. For a description of the B interface, see L<"REGISTERING CALLBACKS"> above. Returns zero upon success and non-zero when an error occurred. -=head2 DispatchValues +=head2 dispatchValues -Signature: I B (I) +Signature: I B (I) Passes the values represented by the B object to the C function of the daemon. The "data set" (or list of @@ -229,9 +229,9 @@ is therefore absolutely okay to leave this blank. Returns zero upon success or non-zero upon failure. -=head2 GetDS +=head2 getDS -Signature: I B (I) +Signature: I B (I) Returns the approrpate I or B if the type is not defined. diff --git a/src/java.c b/src/java.c index 55382706..d4acdab9 100644 --- a/src/java.c +++ b/src/java.c @@ -1280,35 +1280,35 @@ static void JNICALL cjni_api_log (JNIEnv *jvm_env, /* {{{ */ * 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 }, }; @@ -1332,27 +1332,27 @@ static cjni_callback_info_t *cjni_callback_info_create (JNIEnv *jvm_env, /* {{{ 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; -- 2.11.0