2 * collectd/java - org/collectd/api/Collectd.java
3 * Copyright (C) 2009 Florian octo Forster
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; only version 2 of the License is applicable.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 * Florian octo Forster <octo at verplant.org>
22 package org.collectd.api;
25 * Java API to internal functions of collectd.
27 * All functions in this class are {@code static}. You don't need to create an
28 * object of this class (in fact, you can't). Just call these functions
31 * @author Florian Forster <octo at verplant.org>
37 * Constant for severity (log level) "error".
39 * @see CollectdLogInterface
41 public static final int LOG_ERR = 3;
44 * Constant for severity (log level) "warning".
46 * @see CollectdLogInterface
48 public static final int LOG_WARNING = 4;
51 * Constant for severity (log level) "notice".
53 * @see CollectdLogInterface
55 public static final int LOG_NOTICE = 5;
58 * Constant for severity (log level) "info".
60 * @see CollectdLogInterface
62 public static final int LOG_INFO = 6;
65 * Constant for severity (log level) "debug".
67 * @see CollectdLogInterface
69 public static final int LOG_DEBUG = 7;
72 * Return value of match methods: No match.
74 * This is one of two valid return values from match callbacks, indicating
75 * that the passed {@link DataSet} and {@link ValueList} did not match.
77 * Do not use the numeric value directly, it is subject to change without
80 * @see CollectdMatchInterface
82 public static final int FC_MATCH_NO_MATCH = 0;
85 * Return value of match methods: Match.
87 * This is one of two valid return values from match callbacks, indicating
88 * that the passed {@link DataSet} and {@link ValueList} did match.
90 * Do not use the numeric value directly, it is subject to change without
93 * @see CollectdMatchInterface
95 public static final int FC_MATCH_MATCHES = 1;
98 * Return value of target methods: Continue.
100 * This is one of three valid return values from target callbacks, indicating
101 * that processing of the {@link ValueList} should continue.
103 * Do not use the numeric value directly, it is subject to change without
106 * @see CollectdTargetInterface
108 public static final int FC_TARGET_CONTINUE = 0;
111 * Return value of target methods: Stop.
113 * This is one of three valid return values from target callbacks, indicating
114 * that processing of the {@link ValueList} should stop immediately.
116 * Do not use the numeric value directly, it is subject to change without
119 * @see CollectdTargetInterface
121 public static final int FC_TARGET_STOP = 1;
124 * Return value of target methods: Return.
126 * This is one of three valid return values from target callbacks, indicating
127 * that processing of the current chain should be stopped and processing of
128 * the {@link ValueList} should continue in the calling chain.
130 * Do not use the numeric value directly, it is subject to change without
133 * @see CollectdTargetInterface
135 public static final int FC_TARGET_RETURN = 2;
138 * Java representation of collectd/src/plugin.h:plugin_register_config
140 * @return Zero when successful, non-zero otherwise.
141 * @see CollectdConfigInterface
143 native public static int registerConfig (String name,
144 CollectdConfigInterface object);
147 * Java representation of collectd/src/plugin.h:plugin_register_init
149 * @return Zero when successful, non-zero otherwise.
150 * @see CollectdInitInterface
152 native public static int registerInit (String name,
153 CollectdInitInterface object);
156 * Java representation of collectd/src/plugin.h:plugin_register_read
158 * @return Zero when successful, non-zero otherwise.
159 * @see CollectdReadInterface
161 native public static int registerRead (String name,
162 CollectdReadInterface object);
165 * Java representation of collectd/src/plugin.h:plugin_register_write
167 * @return Zero when successful, non-zero otherwise.
168 * @see CollectdWriteInterface
170 native public static int registerWrite (String name,
171 CollectdWriteInterface object);
174 * Java representation of collectd/src/plugin.h:plugin_register_flush
176 * @return Zero when successful, non-zero otherwise.
177 * @see CollectdFlushInterface
179 native public static int registerFlush (String name,
180 CollectdFlushInterface object);
183 * Java representation of collectd/src/plugin.h:plugin_register_shutdown
185 * @return Zero when successful, non-zero otherwise.
186 * @see CollectdShutdownInterface
188 native public static int registerShutdown (String name,
189 CollectdShutdownInterface object);
192 * Java representation of collectd/src/plugin.h:plugin_register_log
194 * @return Zero when successful, non-zero otherwise.
195 * @see CollectdLogInterface
197 native public static int registerLog (String name,
198 CollectdLogInterface object);
201 * Java representation of collectd/src/plugin.h:plugin_register_notification
203 * @return Zero when successful, non-zero otherwise.
204 * @see CollectdNotificationInterface
206 native public static int registerNotification (String name,
207 CollectdNotificationInterface object);
210 * Java representation of collectd/src/filter_chain.h:fc_register_match
212 * @return Zero when successful, non-zero otherwise.
213 * @see CollectdMatchFactoryInterface
215 native public static int registerMatch (String name,
216 CollectdMatchFactoryInterface object);
219 * Java representation of collectd/src/filter_chain.h:fc_register_target
221 * @return Zero when successful, non-zero otherwise.
222 * @see CollectdTargetFactoryInterface
224 native public static int registerTarget (String name,
225 CollectdTargetFactoryInterface object);
228 * Java representation of collectd/src/plugin.h:plugin_dispatch_values
230 * @return Zero when successful, non-zero otherwise.
232 native public static int dispatchValues (ValueList vl);
235 * Java representation of collectd/src/plugin.h:plugin_dispatch_notification
237 * @return Zero when successful, non-zero otherwise.
239 native public static int dispatchNotification (Notification n);
242 * Java representation of collectd/src/plugin.h:plugin_get_ds
244 * @return The appropriate {@link DataSet} object or {@code null} if no such
245 * type is registered.
247 native public static DataSet getDS (String type);
250 * Java representation of collectd/src/plugin.h:plugin_log
252 native private static void log (int severity, String message);
255 * Prints an error message.
257 public static void logError (String message)
259 log (LOG_ERR, message);
260 } /* void logError */
263 * Prints a warning message.
265 public static void logWarning (String message)
267 log (LOG_WARNING, message);
268 } /* void logWarning */
273 public static void logNotice (String message)
275 log (LOG_NOTICE, message);
276 } /* void logNotice */
279 * Prints an info message.
281 public static void logInfo (String message)
283 log (LOG_INFO, message);
287 * Prints a debug message.
289 public static void logDebug (String message)
291 log (LOG_DEBUG, message);
292 } /* void logDebug */
293 } /* class Collectd */
295 /* vim: set sw=2 sts=2 et fdm=marker : */