2 * collectd - bindings/java/org/collectd/api/Collectd.java
3 * Copyright (C) 2009 Florian octo Forster
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
24 * Florian octo Forster <octo at collectd.org>
27 package org.collectd.api;
30 * Java API to internal functions of collectd.
32 * All functions in this class are {@code static}. You don't need to create an
33 * object of this class (in fact, you can't). Just call these functions
36 * @author Florian Forster <octo at collectd.org>
42 * Constant for severity (log level) "error".
44 * @see CollectdLogInterface
46 public static final int LOG_ERR = 3;
49 * Constant for severity (log level) "warning".
51 * @see CollectdLogInterface
53 public static final int LOG_WARNING = 4;
56 * Constant for severity (log level) "notice".
58 * @see CollectdLogInterface
60 public static final int LOG_NOTICE = 5;
63 * Constant for severity (log level) "info".
65 * @see CollectdLogInterface
67 public static final int LOG_INFO = 6;
70 * Constant for severity (log level) "debug".
72 * @see CollectdLogInterface
74 public static final int LOG_DEBUG = 7;
77 * Return value of match methods: No match.
79 * This is one of two valid return values from match callbacks, indicating
80 * that the passed {@link DataSet} and {@link ValueList} did not match.
82 * Do not use the numeric value directly, it is subject to change without
85 * @see CollectdMatchInterface
87 public static final int FC_MATCH_NO_MATCH = 0;
90 * Return value of match methods: Match.
92 * This is one of two valid return values from match callbacks, indicating
93 * that the passed {@link DataSet} and {@link ValueList} did match.
95 * Do not use the numeric value directly, it is subject to change without
98 * @see CollectdMatchInterface
100 public static final int FC_MATCH_MATCHES = 1;
103 * Return value of target methods: Continue.
105 * This is one of three valid return values from target callbacks, indicating
106 * that processing of the {@link ValueList} should continue.
108 * Do not use the numeric value directly, it is subject to change without
111 * @see CollectdTargetInterface
113 public static final int FC_TARGET_CONTINUE = 0;
116 * Return value of target methods: Stop.
118 * This is one of three valid return values from target callbacks, indicating
119 * that processing of the {@link ValueList} should stop immediately.
121 * Do not use the numeric value directly, it is subject to change without
124 * @see CollectdTargetInterface
126 public static final int FC_TARGET_STOP = 1;
129 * Return value of target methods: Return.
131 * This is one of three valid return values from target callbacks, indicating
132 * that processing of the current chain should be stopped and processing of
133 * the {@link ValueList} should continue in the calling chain.
135 * Do not use the numeric value directly, it is subject to change without
138 * @see CollectdTargetInterface
140 public static final int FC_TARGET_RETURN = 2;
143 * Java representation of collectd/src/plugin.h:plugin_register_config
145 * @return Zero when successful, non-zero otherwise.
146 * @see CollectdConfigInterface
148 native public static int registerConfig (String name,
149 CollectdConfigInterface object);
152 * Java representation of collectd/src/plugin.h:plugin_register_init
154 * @return Zero when successful, non-zero otherwise.
155 * @see CollectdInitInterface
157 native public static int registerInit (String name,
158 CollectdInitInterface object);
161 * Java representation of collectd/src/plugin.h:plugin_register_read
163 * @return Zero when successful, non-zero otherwise.
164 * @see CollectdReadInterface
166 native public static int registerRead (String name,
167 CollectdReadInterface object);
170 * Java representation of collectd/src/plugin.h:plugin_register_write
172 * @return Zero when successful, non-zero otherwise.
173 * @see CollectdWriteInterface
175 native public static int registerWrite (String name,
176 CollectdWriteInterface object);
179 * Java representation of collectd/src/plugin.h:plugin_register_flush
181 * @return Zero when successful, non-zero otherwise.
182 * @see CollectdFlushInterface
184 native public static int registerFlush (String name,
185 CollectdFlushInterface object);
188 * Java representation of collectd/src/plugin.h:plugin_register_shutdown
190 * @return Zero when successful, non-zero otherwise.
191 * @see CollectdShutdownInterface
193 native public static int registerShutdown (String name,
194 CollectdShutdownInterface object);
197 * Java representation of collectd/src/plugin.h:plugin_register_log
199 * @return Zero when successful, non-zero otherwise.
200 * @see CollectdLogInterface
202 native public static int registerLog (String name,
203 CollectdLogInterface object);
206 * Java representation of collectd/src/plugin.h:plugin_register_notification
208 * @return Zero when successful, non-zero otherwise.
209 * @see CollectdNotificationInterface
211 native public static int registerNotification (String name,
212 CollectdNotificationInterface object);
215 * Java representation of collectd/src/filter_chain.h:fc_register_match
217 * @return Zero when successful, non-zero otherwise.
218 * @see CollectdMatchFactoryInterface
220 native public static int registerMatch (String name,
221 CollectdMatchFactoryInterface object);
224 * Java representation of collectd/src/filter_chain.h:fc_register_target
226 * @return Zero when successful, non-zero otherwise.
227 * @see CollectdTargetFactoryInterface
229 native public static int registerTarget (String name,
230 CollectdTargetFactoryInterface object);
233 * Java representation of collectd/src/plugin.h:plugin_dispatch_values
235 * @return Zero when successful, non-zero otherwise.
237 native public static int dispatchValues (ValueList vl);
240 * Java representation of collectd/src/plugin.h:plugin_dispatch_notification
242 * @return Zero when successful, non-zero otherwise.
244 native public static int dispatchNotification (Notification n);
247 * Java representation of collectd/src/plugin.h:plugin_get_ds
249 * @return The appropriate {@link DataSet} object or {@code null} if no such
250 * type is registered.
252 native public static DataSet getDS (String type);
255 * Java representation of collectd/src/plugin.h:plugin_log
257 native private static void log (int severity, String message);
260 * Yield contents of collectd/src/collectd.h:hostname_g
262 * @return The hostname as set in the collectd configuration.
264 native public static java.lang.String getHostname ();
267 * Prints an error message.
269 public static void logError (String message)
271 log (LOG_ERR, message);
272 } /* void logError */
275 * Prints a warning message.
277 public static void logWarning (String message)
279 log (LOG_WARNING, message);
280 } /* void logWarning */
285 public static void logNotice (String message)
287 log (LOG_NOTICE, message);
288 } /* void logNotice */
291 * Prints an info message.
293 public static void logInfo (String message)
295 log (LOG_INFO, message);
299 * Prints a debug message.
301 public static void logDebug (String message)
303 log (LOG_DEBUG, message);
304 } /* void logDebug */
305 } /* class Collectd */
307 /* vim: set sw=2 sts=2 et fdm=marker : */