summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b00dd5d)
raw | patch | inline | side by side (parent: b00dd5d)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Thu, 19 Feb 2009 20:59:09 +0000 (21:59 +0100) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Thu, 19 Feb 2009 20:59:09 +0000 (21:59 +0100) |
bindings/java/org/collectd/api/CollectdAPI.java | patch | blob | history | |
src/java.c | patch | blob | history |
diff --git a/bindings/java/org/collectd/api/CollectdAPI.java b/bindings/java/org/collectd/api/CollectdAPI.java
index bd8d950e678941a6083a7cbb6d2f31c1d6e560f6..67c8e6ad2b0186be7e737d4c14bfc69498ecdf78 100644 (file)
package org.collectd.api;
+import java.util.List;
import org.collectd.protocol.ValueList;
+import org.collectd.protocol.DataSource;
public class CollectdAPI
{
native public static int DispatchValues (ValueList vl);
+
+ native public static List<DataSource> GetDS (String type);
} /* class CollectdAPI */
/* vim: set sw=2 sts=2 et fdm=marker : */
diff --git a/src/java.c b/src/java.c
index a1e4971e6cee5a7d48cca3b39993d5f56197e84d..779847edbf12452251d13f3c15bea292e3305278 100644 (file)
--- a/src/java.c
+++ b/src/java.c
return (status);
} /* }}} jint cjni_api_dispatch_values */
+static jobject JNICALL cjni_api_get_ds (JNIEnv *jvm_env, /* {{{ */
+ jobject this, jobject o_string_type)
+{
+ const char *ds_name;
+ const data_set_t *ds;
+ jobject o_dataset;
+
+ ds_name = (*jvm_env)->GetStringUTFChars (jvm_env, o_string_type, 0);
+ if (ds_name == NULL)
+ {
+ ERROR ("java plugin: cjni_api_get_ds: GetStringUTFChars failed.");
+ return (NULL);
+ }
+
+ ds = plugin_get_ds (ds_name);
+ DEBUG ("java plugin: cjni_api_get_ds: "
+ "plugin_get_ds (%s) = %p;", ds_name, (void *) ds);
+
+ (*jvm_env)->ReleaseStringUTFChars (jvm_env, o_string_type, ds_name);
+
+ if (ds == NULL)
+ return (NULL);
+
+ o_dataset = ctoj_data_set (jvm_env, ds);
+ return (o_dataset);
+} /* }}} jint cjni_api_get_ds */
+
static JNINativeMethod jni_api_functions[] =
{
- { "DispatchValues", "(Lorg/collectd/protocol/ValueList;)I", cjni_api_dispatch_values }
+ { "DispatchValues", "(Lorg/collectd/protocol/ValueList;)I", cjni_api_dispatch_values },
+ { "GetDS", "(Ljava/lang/String;)Ljava/util/List;", cjni_api_get_ds }
};
static size_t jni_api_functions_num = sizeof (jni_api_functions)
/ sizeof (jni_api_functions[0]);