KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > clif > storage > api > AlarmEvent


1 /*
2 * CLIF is a Load Injection Framework
3 * Copyright (C) 2003 France Telecom R&D
4 * Copyright (C) 2003 INRIA
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 * CLIF $Name: $
21 *
22 * Contact: clif@objectweb.org
23 */

24
25 package org.objectweb.clif.storage.api;
26
27 import java.io.Serializable JavaDoc;
28
29
30 /**
31  * This class represent the different alarm generated by injector or console
32  *
33  * @author Julien Buret
34  * @author Nicolas Droze
35  * @author Bruno Dillenseger
36  */

37 public class AlarmEvent extends AbstractEvent
38 {
39     static public final String JavaDoc EVENT_TYPE_LABEL = "alarm";
40     static private final String JavaDoc[] EVENT_FIELD_LABELS =
41         new String JavaDoc[] { "date", "blade id", "severity", "argument" };
42     static public final int TRACE = 0;
43     static public final int WARNING = 1;
44     static public final int ERROR = 2;
45     static public final int FATAL = 3;
46
47
48     static
49     {
50         AbstractEvent.registerEventFieldLabels(
51             EVENT_TYPE_LABEL,
52             EVENT_FIELD_LABELS);
53     }
54
55
56     public int severity;
57     public Serializable JavaDoc argument;
58
59
60     public AlarmEvent(long date, String JavaDoc bladeId, int severity, Serializable JavaDoc argument)
61     {
62         super(date, bladeId);
63         this.severity = severity;
64         this.argument = argument;
65     }
66
67
68     public String JavaDoc getTypeLabel()
69     {
70         return EVENT_TYPE_LABEL;
71     }
72
73
74     public String JavaDoc toString()
75     {
76         return toString(0, ";");
77     }
78
79
80     public String JavaDoc toString(long dateOrigin, String JavaDoc separator)
81     {
82         return
83             (date - dateOrigin) + separator
84             + bladeId + separator
85             + severity + separator
86             + argument;
87     }
88 }
89
Popular Tags