KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > web > monitor > data > SessionData


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.web.monitor.data;
21
22 import org.w3c.dom.*;
23 import org.netbeans.modules.schema2beans.*;
24 import java.beans.*;
25 import java.util.*;
26
27 public class SessionData extends BaseBean {
28
29     static Vector comparators = new Vector();
30
31     static public final String JavaDoc SESSIONIN = "SessionIn"; //NOI18N
32
static public final String JavaDoc SESSIONOUT = "SessionOut"; //NOI18N
33

34     public SessionData() {
35     this(Common.USE_DEFAULT_VALUES);
36     }
37
38     public SessionData(int options) {
39     super(SessionData.comparators, new org.netbeans.modules.schema2beans.Version(1, 0, 6));
40     // Properties (see root bean comments for the bean graph)
41
this.createProperty("SessionIn", SESSIONIN, //NOI18N
42
Common.TYPE_1 | Common.TYPE_BEAN | Common.TYPE_KEY,
43                 SessionIn.class);
44     this.createAttribute(SESSIONIN,
45                  "lastAccessed", //NOI18N
46
"LastAccessed", //NOI18N
47
AttrProp.CDATA | AttrProp.IMPLIED,
48                  null, null);
49     this.createAttribute(SESSIONIN,
50                  "inactiveInterval", //NOI18N
51
"InactiveInterval", //NOI18N
52
AttrProp.NMTOKEN | AttrProp.IMPLIED,
53                  null, null);
54     this.createProperty("SessionOut", SESSIONOUT, //NOI18N
55
Common.TYPE_1 | Common.TYPE_BEAN | Common.TYPE_KEY,
56                 SessionOut.class);
57     this.createAttribute(SESSIONOUT,
58                  "lastAccessed", //NOI18N
59
"LastAccessed", //NOI18N
60
AttrProp.CDATA | AttrProp.IMPLIED,
61                  null, null);
62     this.createAttribute(SESSIONOUT,
63                  "inactiveInterval", //NOI18N
64
"InactiveInterval", //NOI18N
65
AttrProp.NMTOKEN | AttrProp.IMPLIED,
66                  null, null);
67     this.initialize(options);
68     }
69
70     // Setting the default values of the properties
71
void initialize(int options) {
72
73     }
74
75     // This attribute is mandatory
76
public void setSessionIn(SessionIn value) {
77     this.setValue(SESSIONIN, value);
78     }
79
80     //
81
public SessionIn getSessionIn() {
82     return (SessionIn)this.getValue(SESSIONIN);
83     }
84
85     // This attribute is mandatory
86
public void setSessionOut(SessionOut value) {
87     this.setValue(SESSIONOUT, value);
88     }
89
90     //
91
public SessionOut getSessionOut() {
92     return (SessionOut)this.getValue(SESSIONOUT);
93     }
94
95     // This method verifies that the mandatory properties are set
96
public boolean verify() {
97     return true;
98     }
99
100     //
101
static public void addComparator(BeanComparator c) {
102     SessionData.comparators.add(c);
103     }
104
105     //
106
static public void removeComparator(BeanComparator c) {
107     SessionData.comparators.remove(c);
108     }
109     //
110
public void addPropertyChangeListener(PropertyChangeListener l) {
111     BeanProp p = this.beanProp();
112     if (p != null)
113         p.addPCListener(l);
114     }
115
116     //
117
public void removePropertyChangeListener(PropertyChangeListener l) {
118     BeanProp p = this.beanProp();
119     if (p != null)
120         p.removePCListener(l);
121     }
122
123     //
124
public void addPropertyChangeListener(String JavaDoc n, PropertyChangeListener l) {
125     BeanProp p = this.beanProp(n);
126     if (p != null)
127         p.addPCListener(l);
128     }
129
130     //
131
public void removePropertyChangeListener(String JavaDoc n,
132                          PropertyChangeListener l) {
133     BeanProp p = this.beanProp(n);
134     if (p != null)
135         p.removePCListener(l);
136     }
137
138     // Dump the content of this bean returning it as a String
139
public void dump(StringBuffer JavaDoc str, String JavaDoc indent) {
140     String JavaDoc s;
141     BaseBean n;
142     str.append(indent);
143     str.append("SessionIn");//NOI18N
144
n = this.getSessionIn();
145     if (n != null)
146         n.dump(str, indent + "\t"); //NOI18N
147
else
148         str.append(indent+"\tnull"); //NOI18N
149
this.dumpAttributes(SESSIONIN, 0, str, indent);
150
151     str.append(indent);
152     str.append("SessionOut"); //NOI18N
153
n = this.getSessionOut();
154     if (n != null)
155         n.dump(str, indent + "\t"); //NOI18N
156
else
157         str.append(indent+"\tnull"); //NOI18N
158
this.dumpAttributes(SESSIONOUT, 0, str, indent);
159
160     }
161
162     public String JavaDoc dumpBeanNode() {
163     StringBuffer JavaDoc str = new StringBuffer JavaDoc();
164     str.append("SessionData\n"); //NOI18N
165
this.dump(str, "\n "); //NOI18N
166
return str.toString();
167     }
168 }
169
Popular Tags