3 * Copyright (C) 2009 Hyperic, Inc.
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 package org.collectd.api;
22 * Java representation of collectd/src/plugin.h:notfication_t structure.
24 public class Notification extends PluginData {
25 public static final int FAILURE = 1;
26 public static final int WARNING = 2;
27 public static final int OKAY = 4;
29 public static String[] SEVERITY = {
36 private int _severity;
37 private String _message;
39 public Notification () {
41 _message = "Initial notification message";
44 public Notification (PluginData pd) {
47 _message = "Initial notification message";
50 public void setSeverity (int severity) {
51 if ((severity == FAILURE)
52 || (severity == WARNING)
53 || (severity == OKAY))
54 this._severity = severity;
57 public int getSeverity() {
61 public String getSeverityString() {
74 public void setMessage (String message) {
75 this._message = message;
78 public String getMessage() {
82 public String toString() {
83 StringBuffer sb = new StringBuffer(super.toString());
84 sb.append(" [").append(getSeverityString()).append("] ");