KickJava   Java API By Example, From Geeks To Geeks.

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


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

23
24 package org.objectweb.clif.storage.api;
25
26
27 import org.objectweb.clif.storage.api.AbstractEvent;
28 import java.io.Serializable JavaDoc;
29
30
31 /**
32  * Class of events produced by load injectors.
33  * @author Bruno Dillenseger
34  */

35 public class ActionEvent extends AbstractEvent
36 {
37     static public final String JavaDoc EVENT_TYPE_LABEL = "action";
38     static private final String JavaDoc[] EVENT_FIELD_LABELS =
39         new String JavaDoc[] {
40             "date",
41             "blade id",
42             "session id",
43             "action type",
44             "iteration",
45             "success",
46             "duration",
47             "comment",
48             "result"};
49
50
51     static
52     {
53         AbstractEvent.registerEventFieldLabels(
54             EVENT_TYPE_LABEL,
55             EVENT_FIELD_LABELS);
56     }
57
58
59     public String JavaDoc type;
60     public long iteration;
61     public long sessionId;
62     public boolean successful;
63     public int duration;
64     public Serializable JavaDoc result;
65     public String JavaDoc comment;
66
67
68     public ActionEvent(
69         long date,
70         String JavaDoc bladeId,
71         String JavaDoc type,
72         long iteration,
73         long sessionId,
74         boolean successful,
75         int duration,
76         Serializable JavaDoc result,
77         String JavaDoc comment)
78     {
79         super(date, bladeId);
80         this.type = type;
81         this.iteration = iteration;
82         this.sessionId = sessionId;
83         this.successful = successful;
84         this.duration = duration;
85         this.result = result;
86         this.comment = comment;
87     }
88
89
90     public String JavaDoc getTypeLabel()
91     {
92         return EVENT_TYPE_LABEL;
93     }
94
95
96     public boolean isSuccessful()
97     {
98         return successful;
99     }
100
101
102     public int getDuration()
103     {
104         return duration;
105     }
106
107
108     public long getSession()
109     {
110         return sessionId;
111     }
112
113
114     public Serializable JavaDoc getResult()
115     {
116         return result;
117     }
118
119
120     public String JavaDoc getComment()
121     {
122         return comment;
123     }
124
125
126     public String JavaDoc getType()
127     {
128         return type;
129     }
130
131
132     public String JavaDoc toString()
133     {
134         return toString(0, ";");
135     }
136
137
138     public String JavaDoc toString(long dateOrigin, String JavaDoc separator)
139     {
140         return
141             (date - dateOrigin) + separator
142             + bladeId + separator
143             + sessionId + separator
144             + type + separator
145             + iteration + separator
146             + successful + separator
147             + duration + separator
148             + comment + separator
149             + result;
150     }
151 }
152
Popular Tags