KickJava   Java API By Example, From Geeks To Geeks.

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


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 CookiesData extends BaseBean {
28
29     static Vector comparators = new Vector();
30
31     static public final String JavaDoc COOKIEIN = "CookieIn"; // NOI18N
32
static public final String JavaDoc COOKIEOUT = "CookieOut"; // NOI18N
33
//public final static String JSESSIONID = "JSESSIONID"; // NOI18N
34

35     public CookiesData() {
36     this(Common.USE_DEFAULT_VALUES);
37     }
38
39     public CookiesData(int options) {
40     super(RequestData.comparators, new org.netbeans.modules.schema2beans.Version(1, 0, 6));
41     // Properties (see root bean comments for the bean graph)
42
this.createProperty("CookieIn", COOKIEIN, // NOI18N
43
Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY,
44                 CookieIn.class);
45     this.createAttribute(COOKIEIN, "name", "Name", // NOI18N
46
AttrProp.CDATA | AttrProp.REQUIRED,
47                  null, null);
48     this.createAttribute(COOKIEIN, "value", "Value", // NOI18N
49
AttrProp.CDATA | AttrProp.IMPLIED,
50                  null, null);
51     this.createProperty("CookieOut", COOKIEOUT, // NOI18N
52
Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY,
53                 CookieOut.class);
54     this.createAttribute(COOKIEOUT, "name", "Name", // NOI18N
55
AttrProp.CDATA | AttrProp.REQUIRED,
56                  null, null);
57     this.createAttribute(COOKIEOUT, "value", "Value", // NOI18N
58
AttrProp.CDATA | AttrProp.REQUIRED,
59                  null, null);
60     this.createAttribute(COOKIEOUT, "path", "Path", // NOI18N
61
AttrProp.CDATA | AttrProp.IMPLIED,
62                  null, null);
63     this.createAttribute(COOKIEOUT, "domain", "Domain", // NOI18N
64
AttrProp.CDATA | AttrProp.IMPLIED,
65                  null, null);
66     this.createAttribute(COOKIEOUT, "maxAge", "MaxAge", // NOI18N
67
AttrProp.NMTOKEN | AttrProp.IMPLIED,
68                  null, null);
69     this.createAttribute(COOKIEOUT, "comment", "Comment", // NOI18N
70
AttrProp.CDATA | AttrProp.IMPLIED,
71                  null, null);
72     this.createAttribute(COOKIEOUT, "version", "Version", // NOI18N
73
AttrProp.NMTOKEN | AttrProp.IMPLIED,
74                  null, null);
75     this.createAttribute(COOKIEOUT, "secure", "Secure", // NOI18N
76
AttrProp.ENUM,
77                  new String JavaDoc[] { "false", "true" }, // NOI18N
78
"false"); // NOI18N
79
this.initialize(options);
80     }
81
82     // Setting the default values of the properties
83
void initialize(int options) {
84
85     }
86
87     // This attribute is an array, possibly empty
88
public void setCookieIn(int index, CookieIn value) {
89     this.setValue(COOKIEIN, index, value);
90     }
91
92     //
93
public CookieIn getCookieIn(int index) {
94     return (CookieIn)this.getValue(COOKIEIN, index);
95     }
96
97     // This attribute is an array, possibly empty
98
public void setCookieIn(CookieIn[] value) {
99     this.setValue(COOKIEIN, value);
100     }
101
102     //
103
public CookieIn[] getCookieIn() {
104     return (CookieIn[])this.getValues(COOKIEIN);
105     }
106
107     // Return the number of properties
108
public int sizeCookieIn() {
109     return this.size(COOKIEIN);
110     }
111
112     // Add a new element returning its index in the list
113
public int addCookieIn(CookieIn value) {
114     return this.addValue(COOKIEIN, value);
115     }
116
117     //
118
// Remove an element using its reference
119
// Returns the index the element had in the list
120
//
121
public int removeCookieIn(CookieIn value) {
122     return this.removeValue(COOKIEIN, value);
123     }
124
125     // This attribute is an array, possibly empty
126
public void setCookieOut(int index, CookieOut value) {
127     this.setValue(COOKIEOUT, index, value);
128     }
129
130     //
131
public CookieOut getCookieOut(int index) {
132     return (CookieOut)this.getValue(COOKIEOUT, index);
133     }
134
135     // This attribute is an array, possibly empty
136
public void setCookieOut(CookieOut[] value) {
137     this.setValue(COOKIEOUT, value);
138     }
139
140     //
141
public CookieOut[] getCookieOut() {
142     return (CookieOut[])this.getValues(COOKIEOUT);
143     }
144
145     // Return the number of properties
146
public int sizeCookieOut() {
147     return this.size(COOKIEOUT);
148     }
149
150     // Add a new element returning its index in the list
151
public int addCookieOut(CookieOut value) {
152     return this.addValue(COOKIEOUT, value);
153     }
154
155     //
156
// Remove an element using its reference
157
// Returns the index the element had in the list
158
//
159
public int removeCookieOut(CookieOut value) {
160     return this.removeValue(COOKIEOUT, value);
161     }
162
163     // This method verifies that the mandatory properties are set
164
public boolean verify() {
165     return true;
166     }
167
168     //
169
static public void addComparator(BeanComparator c) {
170     ClientData.comparators.add(c);
171     }
172
173     //
174
static public void removeComparator(BeanComparator c) {
175     ClientData.comparators.remove(c);
176     }
177     //
178
public void addPropertyChangeListener(PropertyChangeListener l) {
179     BeanProp p = this.beanProp();
180     if (p != null)
181         p.addPCListener(l);
182     }
183
184     //
185
public void removePropertyChangeListener(PropertyChangeListener l) {
186     BeanProp p = this.beanProp();
187     if (p != null)
188         p.removePCListener(l);
189     }
190
191     //
192
public void addPropertyChangeListener(String JavaDoc n, PropertyChangeListener l) {
193     BeanProp p = this.beanProp(n);
194     if (p != null)
195         p.addPCListener(l);
196     }
197
198     //
199
public void removePropertyChangeListener(String JavaDoc n,
200                          PropertyChangeListener l) {
201     BeanProp p = this.beanProp(n);
202     if (p != null)
203         p.removePCListener(l);
204     }
205
206     // Dump the content of this bean returning it as a String
207
public void dump(StringBuffer JavaDoc str, String JavaDoc indent) {
208     String JavaDoc s;
209     BaseBean n;
210
211     str.append(indent);
212     str.append("CookieIn["+this.sizeCookieIn()+"]"); // NOI18N
213
for(int i=0; i<this.sizeCookieIn(); i++)
214         {
215         str.append(indent+"\t"); // NOI18N
216
str.append("#"+i+":"); // NOI18N
217
n = this.getCookieIn(i);
218         if (n != null)
219             n.dump(str, indent + "\t"); // NOI18N
220
else
221             str.append(indent+"\tnull"); // NOI18N
222
this.dumpAttributes(COOKIEIN, i, str, indent);
223         }
224
225     str.append(indent);
226     str.append("CookieOut["+this.sizeCookieOut()+"]"); // NOI18N
227
for(int i=0; i<this.sizeCookieOut(); i++)
228         {
229         str.append(indent+"\t"); // NOI18N
230
str.append("#"+i+":"); // NOI18N
231
n = this.getCookieOut(i);
232         if (n != null)
233             n.dump(str, indent + "\t"); // NOI18N
234
else
235             str.append(indent+"\tnull"); // NOI18N
236
this.dumpAttributes(COOKIEOUT, i, str, indent);
237         }
238
239     }
240
241     public String JavaDoc dumpBeanNode() {
242     StringBuffer JavaDoc str = new StringBuffer JavaDoc();
243     str.append("CookiesData\n"); // NOI18N
244
this.dump(str, "\n "); // NOI18N
245
return str.toString();
246     }
247 }
248
249
Popular Tags