KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > dbforms > config > EventInfo


1 /*
2  * $Header: /cvsroot/jdbforms/dbforms/src/org/dbforms/config/EventInfo.java,v 1.9 2004/10/23 13:35:37 hkollmann Exp $
3  * $Revision: 1.9 $
4  * $Date: 2004/10/23 13:35:37 $
5  *
6  * DbForms - a Rapid Application Development Framework
7  * Copyright (C) 2001 Joachim Peer <joepeer@excite.com>
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22  */

23
24 package org.dbforms.config;
25
26 import org.apache.commons.logging.Log;
27 import org.apache.commons.logging.LogFactory;
28
29 import org.dbforms.util.Util;
30
31 import java.io.Serializable JavaDoc;
32 import java.util.Properties JavaDoc;
33
34
35
36 /**
37  * Event information class
38  *
39  * @author Luca Fossato
40  *
41  */

42 public class EventInfo implements Serializable JavaDoc{
43    /** logging category */
44    private static Log logCat = LogFactory.getLog(EventInfo.class.getName());
45    private Properties JavaDoc properties = null;
46    private String JavaDoc className = null;
47    private String JavaDoc id = null;
48    private String JavaDoc type = null;
49
50    /**
51     * Default constructor.
52     */

53    public EventInfo() {
54       properties = new Properties JavaDoc();
55    }
56
57
58    /**
59     * Constructor.
60     *
61     * @param type the event type
62     * @param className the full qualified bname of the event class
63     */

64    public EventInfo(String JavaDoc type,
65                     String JavaDoc className) {
66       this();
67       this.type = type;
68       this.className = className;
69    }
70
71    /**
72     * Sets the className attribute of the EventInfo object
73     *
74     * @param className The new className value
75     */

76    public void setClassName(String JavaDoc className) {
77       this.className = className;
78    }
79
80
81    /**
82     * Gets the className attribute of the EventInfo object
83     *
84     * @return The className value
85     */

86    public String JavaDoc getClassName() {
87       return className;
88    }
89
90
91    /**
92     * Sets the id attribute of the EventInfo object
93     *
94     * @param id The new id value
95     */

96    public void setId(String JavaDoc id) {
97       this.id = id;
98    }
99
100
101    /**
102     * Gets the id attribute of the EventInfo object
103     *
104     * @return The id value
105     */

106    public String JavaDoc getId() {
107       //return id;
108
return (!Util.isNull(id)) ? id
109                                 : type;
110    }
111
112
113    /**
114     * Gets the properties attribute of the EventInfo object
115     *
116     * @return The properties value
117     */

118    public Properties JavaDoc getProperties() {
119       return properties;
120    }
121
122
123    /**
124     * Sets the type attribute of the EventInfo object
125     *
126     * @param type The new type value
127     */

128    public void setType(String JavaDoc type) {
129       this.type = type;
130    }
131
132
133    /**
134     * Gets the type attribute of the EventInfo object
135     *
136     * @return The type value
137     */

138    public String JavaDoc getType() {
139       return type;
140    }
141
142
143    /**
144     * Adds a new property to this EventInfo object.
145     *
146     * @param property The feature to be added to the Property attribute
147     */

148    public void addProperty(DbConnectionProperty property) {
149       String JavaDoc name = property.getName();
150       String JavaDoc value = property.getValue();
151       properties.put(name, value);
152       logCat.info("::addProperty - added the property [" + name + ", " + value
153                   + "] to event [" + getId() + "]");
154    }
155
156
157    /**
158     * Return the String representation of this object.
159     *
160     * @return the String representation of this object
161     */

162    public String JavaDoc toString() {
163       return new StringBuffer JavaDoc("event: id = ").append(getId())
164                                              .append("; type = ")
165                                              .append(type)
166                                              .append("; className = ")
167                                              .append(className)
168                                              .toString();
169    }
170 }
171
Popular Tags