KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > admin > monitor > stats > lb > InstanceStats


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 /**
25  * This generated bean class InstanceStats
26  * matches the schema element 'instance-stats'.
27  *
28  * Generated on Fri Aug 19 00:43:43 IST 2005
29  */

30
31 package com.sun.enterprise.admin.monitor.stats.lb;
32
33 public class InstanceStats implements com.sun.enterprise.admin.monitor.stats.lb.InstanceStatsInterface, com.sun.enterprise.admin.monitor.stats.lb.CommonBean {
34     private java.lang.String JavaDoc _Id;
35     private java.lang.String JavaDoc _Health;
36     private java.lang.String JavaDoc _NumTotalRequests;
37     private java.lang.String JavaDoc _NumActiveRequests;
38     private java.util.List JavaDoc _ApplicationStats = new java.util.ArrayList JavaDoc(); // List<boolean>
39
private java.lang.String JavaDoc _ApplicationStatsId;
40     private java.lang.String JavaDoc _ApplicationStatsAverageResponseTime;
41     private java.lang.String JavaDoc _ApplicationStatsMinResponseTime;
42     private java.lang.String JavaDoc _ApplicationStatsMaxResponseTime;
43     private java.lang.String JavaDoc _ApplicationStatsNumFailoverRequests;
44     private java.lang.String JavaDoc _ApplicationStatsNumErrorRequests;
45     private java.lang.String JavaDoc _ApplicationStatsNumActiveRequests;
46     private java.lang.String JavaDoc _ApplicationStatsNumIdempotentUrlRequests;
47     private java.lang.String JavaDoc _ApplicationStatsNumTotalRequests;
48
49     public InstanceStats() {
50         _Id = "";
51         _Health = "";
52         _NumTotalRequests = "";
53         _NumActiveRequests = "";
54         _ApplicationStatsId = "";
55         _ApplicationStatsAverageResponseTime = "";
56         _ApplicationStatsMinResponseTime = "";
57         _ApplicationStatsMaxResponseTime = "";
58         _ApplicationStatsNumFailoverRequests = "";
59         _ApplicationStatsNumErrorRequests = "";
60         _ApplicationStatsNumActiveRequests = "";
61         _ApplicationStatsNumIdempotentUrlRequests = "";
62         _ApplicationStatsNumTotalRequests = "";
63     }
64
65     // Deep copy
66
public InstanceStats(com.sun.enterprise.admin.monitor.stats.lb.InstanceStats source) {
67         _Id = source._Id;
68         _Health = source._Health;
69         _NumTotalRequests = source._NumTotalRequests;
70         _NumActiveRequests = source._NumActiveRequests;
71         for (java.util.Iterator JavaDoc it = source._ApplicationStats.iterator();
72             it.hasNext(); ) {
73             _ApplicationStats.add(it.next());
74         }
75         _ApplicationStatsId = source._ApplicationStatsId;
76         _ApplicationStatsAverageResponseTime = source._ApplicationStatsAverageResponseTime;
77         _ApplicationStatsMinResponseTime = source._ApplicationStatsMinResponseTime;
78         _ApplicationStatsMaxResponseTime = source._ApplicationStatsMaxResponseTime;
79         _ApplicationStatsNumFailoverRequests = source._ApplicationStatsNumFailoverRequests;
80         _ApplicationStatsNumErrorRequests = source._ApplicationStatsNumErrorRequests;
81         _ApplicationStatsNumActiveRequests = source._ApplicationStatsNumActiveRequests;
82         _ApplicationStatsNumIdempotentUrlRequests = source._ApplicationStatsNumIdempotentUrlRequests;
83         _ApplicationStatsNumTotalRequests = source._ApplicationStatsNumTotalRequests;
84     }
85
86     // This attribute is mandatory
87
public void setId(java.lang.String JavaDoc value) {
88         _Id = value;
89     }
90
91     public java.lang.String JavaDoc getId() {
92         return _Id;
93     }
94
95     // This attribute is mandatory
96
public void setHealth(java.lang.String JavaDoc value) {
97         _Health = value;
98     }
99
100     public java.lang.String JavaDoc getHealth() {
101         return _Health;
102     }
103
104     // This attribute is mandatory
105
public void setNumTotalRequests(java.lang.String JavaDoc value) {
106         _NumTotalRequests = value;
107     }
108
109     public java.lang.String JavaDoc getNumTotalRequests() {
110         return _NumTotalRequests;
111     }
112
113     // This attribute is mandatory
114
public void setNumActiveRequests(java.lang.String JavaDoc value) {
115         _NumActiveRequests = value;
116     }
117
118     public java.lang.String JavaDoc getNumActiveRequests() {
119         return _NumActiveRequests;
120     }
121
122     // This attribute is an array, possibly empty
123
public void setApplicationStats(boolean[] value) {
124         if (value == null)
125             value = new boolean[0];
126         _ApplicationStats.clear();
127         for (int i = 0; i < value.length; ++i) {
128             _ApplicationStats.add((value[i] ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE));
129         }
130     }
131
132     public void setApplicationStats(int index, boolean value) {
133         _ApplicationStats.set(index, (value ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE));
134     }
135
136     public boolean[] getApplicationStats() {
137         boolean[] arr = new boolean[_ApplicationStats.size()];
138         for (int i = 0; i < arr.length; ++i) {
139             arr[i] = ((java.lang.Boolean JavaDoc)_ApplicationStats.get(i)).booleanValue();
140         }
141         return arr;
142     }
143
144     public java.util.List JavaDoc fetchApplicationStatsList() {
145         return _ApplicationStats;
146     }
147
148     public boolean isApplicationStats(int index) {
149         return ((java.lang.Boolean JavaDoc)_ApplicationStats.get(index)).booleanValue();
150     }
151
152     // Return the number of applicationStats
153
public int sizeApplicationStats() {
154         return _ApplicationStats.size();
155     }
156
157     public int addApplicationStats(boolean value) {
158         _ApplicationStats.add((value ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE));
159         return _ApplicationStats.size()-1;
160     }
161
162     // Search from the end looking for @param value, and then remove it.
163
public int removeApplicationStats(boolean value) {
164         int pos = _ApplicationStats.indexOf((value ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE));
165         if (pos >= 0) {
166             _ApplicationStats.remove(pos);
167         }
168         return pos;
169     }
170
171     // This attribute is mandatory
172
public void setApplicationStatsId(java.lang.String JavaDoc value) {
173         _ApplicationStatsId = value;
174     }
175
176     public java.lang.String JavaDoc getApplicationStatsId() {
177         return _ApplicationStatsId;
178     }
179
180     // This attribute is mandatory
181
public void setApplicationStatsAverageResponseTime(java.lang.String JavaDoc value) {
182         _ApplicationStatsAverageResponseTime = value;
183     }
184
185     public java.lang.String JavaDoc getApplicationStatsAverageResponseTime() {
186         return _ApplicationStatsAverageResponseTime;
187     }
188
189     // This attribute is mandatory
190
public void setApplicationStatsMinResponseTime(java.lang.String JavaDoc value) {
191         _ApplicationStatsMinResponseTime = value;
192     }
193
194     public java.lang.String JavaDoc getApplicationStatsMinResponseTime() {
195         return _ApplicationStatsMinResponseTime;
196     }
197
198     // This attribute is mandatory
199
public void setApplicationStatsMaxResponseTime(java.lang.String JavaDoc value) {
200         _ApplicationStatsMaxResponseTime = value;
201     }
202
203     public java.lang.String JavaDoc getApplicationStatsMaxResponseTime() {
204         return _ApplicationStatsMaxResponseTime;
205     }
206
207     // This attribute is mandatory
208
public void setApplicationStatsNumFailoverRequests(java.lang.String JavaDoc value) {
209         _ApplicationStatsNumFailoverRequests = value;
210     }
211
212     public java.lang.String JavaDoc getApplicationStatsNumFailoverRequests() {
213         return _ApplicationStatsNumFailoverRequests;
214     }
215
216     // This attribute is mandatory
217
public void setApplicationStatsNumErrorRequests(java.lang.String JavaDoc value) {
218         _ApplicationStatsNumErrorRequests = value;
219     }
220
221     public java.lang.String JavaDoc getApplicationStatsNumErrorRequests() {
222         return _ApplicationStatsNumErrorRequests;
223     }
224
225     // This attribute is mandatory
226
public void setApplicationStatsNumActiveRequests(java.lang.String JavaDoc value) {
227         _ApplicationStatsNumActiveRequests = value;
228     }
229
230     public java.lang.String JavaDoc getApplicationStatsNumActiveRequests() {
231         return _ApplicationStatsNumActiveRequests;
232     }
233
234     // This attribute is mandatory
235
public void setApplicationStatsNumIdempotentUrlRequests(java.lang.String JavaDoc value) {
236         _ApplicationStatsNumIdempotentUrlRequests = value;
237     }
238
239     public java.lang.String JavaDoc getApplicationStatsNumIdempotentUrlRequests() {
240         return _ApplicationStatsNumIdempotentUrlRequests;
241     }
242
243     // This attribute is mandatory
244
public void setApplicationStatsNumTotalRequests(java.lang.String JavaDoc value) {
245         _ApplicationStatsNumTotalRequests = value;
246     }
247
248     public java.lang.String JavaDoc getApplicationStatsNumTotalRequests() {
249         return _ApplicationStatsNumTotalRequests;
250     }
251
252     public void writeNode(java.io.Writer JavaDoc out, String JavaDoc nodeName, String JavaDoc indent) throws java.io.IOException JavaDoc {
253         out.write(indent);
254         out.write("<");
255         out.write(nodeName);
256         // id is an attribute
257
if (_Id != null) {
258             out.write(" id"); // NOI18N
259
out.write("='"); // NOI18N
260
com.sun.enterprise.admin.monitor.stats.lb.LoadBalancerStats.writeXML(out, _Id, true);
261             out.write("'"); // NOI18N
262
}
263         // health is an attribute
264
if (_Health != null) {
265             out.write(" health"); // NOI18N
266
out.write("='"); // NOI18N
267
com.sun.enterprise.admin.monitor.stats.lb.LoadBalancerStats.writeXML(out, _Health, true);
268             out.write("'"); // NOI18N
269
}
270         // num-total-requests is an attribute
271
if (_NumTotalRequests != null) {
272             out.write(" num-total-requests"); // NOI18N
273
out.write("='"); // NOI18N
274
com.sun.enterprise.admin.monitor.stats.lb.LoadBalancerStats.writeXML(out, _NumTotalRequests, true);
275             out.write("'"); // NOI18N
276
}
277         // num-active-requests is an attribute
278
if (_NumActiveRequests != null) {
279             out.write(" num-active-requests"); // NOI18N
280
out.write("='"); // NOI18N
281
com.sun.enterprise.admin.monitor.stats.lb.LoadBalancerStats.writeXML(out, _NumActiveRequests, true);
282             out.write("'"); // NOI18N
283
}
284         out.write(">\n");
285         String JavaDoc nextIndent = indent + " ";
286         for (java.util.Iterator JavaDoc it = _ApplicationStats.iterator();
287             it.hasNext(); ) {
288             boolean element = ((java.lang.Boolean JavaDoc)it.next()).booleanValue();
289             if (element) {
290                 out.write(nextIndent);
291                 out.write("<application-stats"); // NOI18N
292
// id is an attribute
293
if (_ApplicationStatsId != null) {
294                     out.write(" id"); // NOI18N
295
out.write("='"); // NOI18N
296
com.sun.enterprise.admin.monitor.stats.lb.LoadBalancerStats.writeXML(out, _ApplicationStatsId, true);
297                     out.write("'"); // NOI18N
298
}
299                 // average-response-time is an attribute
300
if (_ApplicationStatsAverageResponseTime != null) {
301                     out.write(" average-response-time"); // NOI18N
302
out.write("='"); // NOI18N
303
com.sun.enterprise.admin.monitor.stats.lb.LoadBalancerStats.writeXML(out, _ApplicationStatsAverageResponseTime, true);
304                     out.write("'"); // NOI18N
305
}
306                 // min-response-time is an attribute
307
if (_ApplicationStatsMinResponseTime != null) {
308                     out.write(" min-response-time"); // NOI18N
309
out.write("='"); // NOI18N
310
com.sun.enterprise.admin.monitor.stats.lb.LoadBalancerStats.writeXML(out, _ApplicationStatsMinResponseTime, true);
311                     out.write("'"); // NOI18N
312
}
313                 // max-response-time is an attribute
314
if (_ApplicationStatsMaxResponseTime != null) {
315                     out.write(" max-response-time"); // NOI18N
316
out.write("='"); // NOI18N
317
com.sun.enterprise.admin.monitor.stats.lb.LoadBalancerStats.writeXML(out, _ApplicationStatsMaxResponseTime, true);
318                     out.write("'"); // NOI18N
319
}
320                 // num-failover-requests is an attribute
321
if (_ApplicationStatsNumFailoverRequests != null) {
322                     out.write(" num-failover-requests"); // NOI18N
323
out.write("='"); // NOI18N
324
com.sun.enterprise.admin.monitor.stats.lb.LoadBalancerStats.writeXML(out, _ApplicationStatsNumFailoverRequests, true);
325                     out.write("'"); // NOI18N
326
}
327                 // num-error-requests is an attribute
328
if (_ApplicationStatsNumErrorRequests != null) {
329                     out.write(" num-error-requests"); // NOI18N
330
out.write("='"); // NOI18N
331
com.sun.enterprise.admin.monitor.stats.lb.LoadBalancerStats.writeXML(out, _ApplicationStatsNumErrorRequests, true);
332                     out.write("'"); // NOI18N
333
}
334                 // num-active-requests is an attribute
335
if (_ApplicationStatsNumActiveRequests != null) {
336                     out.write(" num-active-requests"); // NOI18N
337
out.write("='"); // NOI18N
338
com.sun.enterprise.admin.monitor.stats.lb.LoadBalancerStats.writeXML(out, _ApplicationStatsNumActiveRequests, true);
339                     out.write("'"); // NOI18N
340
}
341                 // num-idempotent-url-requests is an attribute
342
if (_ApplicationStatsNumIdempotentUrlRequests != null) {
343                     out.write(" num-idempotent-url-requests"); // NOI18N
344
out.write("='"); // NOI18N
345
com.sun.enterprise.admin.monitor.stats.lb.LoadBalancerStats.writeXML(out, _ApplicationStatsNumIdempotentUrlRequests, true);
346                     out.write("'"); // NOI18N
347
}
348                 // num-total-requests is an attribute
349
if (_ApplicationStatsNumTotalRequests != null) {
350                     out.write(" num-total-requests"); // NOI18N
351
out.write("='"); // NOI18N
352
com.sun.enterprise.admin.monitor.stats.lb.LoadBalancerStats.writeXML(out, _ApplicationStatsNumTotalRequests, true);
353                     out.write("'"); // NOI18N
354
}
355                 out.write("/>\n"); // NOI18N
356
}
357         }
358         out.write(indent);
359         out.write("</"+nodeName+">\n");
360     }
361
362     public void readNode(org.w3c.dom.Node JavaDoc node) {
363         if (node.hasAttributes()) {
364             org.w3c.dom.NamedNodeMap JavaDoc attrs = node.getAttributes();
365             org.w3c.dom.Attr JavaDoc attr;
366             attr = (org.w3c.dom.Attr JavaDoc) attrs.getNamedItem("id");
367             if (attr != null) {
368                 _Id = attr.getValue();
369             }
370             attr = (org.w3c.dom.Attr JavaDoc) attrs.getNamedItem("health");
371             if (attr != null) {
372                 _Health = attr.getValue();
373             }
374             attr = (org.w3c.dom.Attr JavaDoc) attrs.getNamedItem("num-total-requests");
375             if (attr != null) {
376                 _NumTotalRequests = attr.getValue();
377             }
378             attr = (org.w3c.dom.Attr JavaDoc) attrs.getNamedItem("num-active-requests");
379             if (attr != null) {
380                 _NumActiveRequests = attr.getValue();
381             }
382         }
383         org.w3c.dom.NodeList JavaDoc children = node.getChildNodes();
384         int lastElementType = 0;
385         for (int i = 0, size = children.getLength(); i < size; ++i) {
386             org.w3c.dom.Node JavaDoc childNode = children.item(i);
387             String JavaDoc childNodeName = (childNode.getLocalName() == null ? childNode.getNodeName().intern() : childNode.getLocalName().intern());
388             String JavaDoc childNodeValue = "";
389             if (childNode.getFirstChild() != null) {
390                 childNodeValue = childNode.getFirstChild().getNodeValue();
391             }
392             if (childNodeName == "application-stats") {
393                 boolean aApplicationStats;
394                 if (childNode.getFirstChild() == null)
395                     aApplicationStats = true;
396                 else
397                     aApplicationStats = java.lang.Boolean.valueOf(childNodeValue).booleanValue();
398                 if (childNode.hasAttributes()) {
399                     org.w3c.dom.NamedNodeMap JavaDoc attrs = childNode.getAttributes();
400                     org.w3c.dom.Attr JavaDoc attr;
401                     attr = (org.w3c.dom.Attr JavaDoc) attrs.getNamedItem("id");
402                     if (attr != null) {
403                         _ApplicationStatsId = attr.getValue();
404                     }
405                     attr = (org.w3c.dom.Attr JavaDoc) attrs.getNamedItem("average-response-time");
406                     if (attr != null) {
407                         _ApplicationStatsAverageResponseTime = attr.getValue();
408                     }
409                     attr = (org.w3c.dom.Attr JavaDoc) attrs.getNamedItem("min-response-time");
410                     if (attr != null) {
411                         _ApplicationStatsMinResponseTime = attr.getValue();
412                     }
413                     attr = (org.w3c.dom.Attr JavaDoc) attrs.getNamedItem("max-response-time");
414                     if (attr != null) {
415                         _ApplicationStatsMaxResponseTime = attr.getValue();
416                     }
417                     attr = (org.w3c.dom.Attr JavaDoc) attrs.getNamedItem("num-failover-requests");
418                     if (attr != null) {
419                         _ApplicationStatsNumFailoverRequests = attr.getValue();
420                     }
421                     attr = (org.w3c.dom.Attr JavaDoc) attrs.getNamedItem("num-error-requests");
422                     if (attr != null) {
423                         _ApplicationStatsNumErrorRequests = attr.getValue();
424                     }
425                     attr = (org.w3c.dom.Attr JavaDoc) attrs.getNamedItem("num-active-requests");
426                     if (attr != null) {
427                         _ApplicationStatsNumActiveRequests = attr.getValue();
428                     }
429                     attr = (org.w3c.dom.Attr JavaDoc) attrs.getNamedItem("num-idempotent-url-requests");
430                     if (attr != null) {
431                         _ApplicationStatsNumIdempotentUrlRequests = attr.getValue();
432                     }
433                     attr = (org.w3c.dom.Attr JavaDoc) attrs.getNamedItem("num-total-requests");
434                     if (attr != null) {
435                         _ApplicationStatsNumTotalRequests = attr.getValue();
436                     }
437                 }
438                 _ApplicationStats.add((aApplicationStats ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE));
439                 lastElementType = 4;
440             }
441             else {
442                 // Found extra unrecognized childNode
443
}
444         }
445     }
446
447     public void validate() throws com.sun.enterprise.admin.monitor.stats.lb.LoadBalancerStats.ValidateException {
448         boolean restrictionFailure = false;
449         // Validating property id
450
if (getId() == null) {
451             throw new com.sun.enterprise.admin.monitor.stats.lb.LoadBalancerStats.ValidateException("getId() == null", "id", this); // NOI18N
452
}
453         // Validating property health
454
if (getHealth() == null) {
455             throw new com.sun.enterprise.admin.monitor.stats.lb.LoadBalancerStats.ValidateException("getHealth() == null", "health", this); // NOI18N
456
}
457         // Validating property numTotalRequests
458
if (getNumTotalRequests() == null) {
459             throw new com.sun.enterprise.admin.monitor.stats.lb.LoadBalancerStats.ValidateException("getNumTotalRequests() == null", "numTotalRequests", this); // NOI18N
460
}
461         // Validating property numActiveRequests
462
if (getNumActiveRequests() == null) {
463             throw new com.sun.enterprise.admin.monitor.stats.lb.LoadBalancerStats.ValidateException("getNumActiveRequests() == null", "numActiveRequests", this); // NOI18N
464
}
465         // Validating property applicationStats
466
for (int _index = 0; _index < sizeApplicationStats(); ++_index) {
467             boolean element = isApplicationStats(_index);
468         }
469         // Validating property applicationStatsId
470
if (getApplicationStatsId() == null) {
471             throw new com.sun.enterprise.admin.monitor.stats.lb.LoadBalancerStats.ValidateException("getApplicationStatsId() == null", "applicationStatsId", this); // NOI18N
472
}
473         // Validating property applicationStatsAverageResponseTime
474
if (getApplicationStatsAverageResponseTime() == null) {
475             throw new com.sun.enterprise.admin.monitor.stats.lb.LoadBalancerStats.ValidateException("getApplicationStatsAverageResponseTime() == null", "applicationStatsAverageResponseTime", this); // NOI18N
476
}
477         // Validating property applicationStatsMinResponseTime
478
if (getApplicationStatsMinResponseTime() == null) {
479             throw new com.sun.enterprise.admin.monitor.stats.lb.LoadBalancerStats.ValidateException("getApplicationStatsMinResponseTime() == null", "applicationStatsMinResponseTime", this); // NOI18N
480
}
481         // Validating property applicationStatsMaxResponseTime
482
if (getApplicationStatsMaxResponseTime() == null) {
483             throw new com.sun.enterprise.admin.monitor.stats.lb.LoadBalancerStats.ValidateException("getApplicationStatsMaxResponseTime() == null", "applicationStatsMaxResponseTime", this); // NOI18N
484
}
485         // Validating property applicationStatsNumFailoverRequests
486
if (getApplicationStatsNumFailoverRequests() == null) {
487             throw new com.sun.enterprise.admin.monitor.stats.lb.LoadBalancerStats.ValidateException("getApplicationStatsNumFailoverRequests() == null", "applicationStatsNumFailoverRequests", this); // NOI18N
488
}
489         // Validating property applicationStatsNumErrorRequests
490
if (getApplicationStatsNumErrorRequests() == null) {
491             throw new com.sun.enterprise.admin.monitor.stats.lb.LoadBalancerStats.ValidateException("getApplicationStatsNumErrorRequests() == null", "applicationStatsNumErrorRequests", this); // NOI18N
492
}
493         // Validating property applicationStatsNumActiveRequests
494
if (getApplicationStatsNumActiveRequests() == null) {
495             throw new com.sun.enterprise.admin.monitor.stats.lb.LoadBalancerStats.ValidateException("getApplicationStatsNumActiveRequests() == null", "applicationStatsNumActiveRequests", this); // NOI18N
496
}
497         // Validating property applicationStatsNumIdempotentUrlRequests
498
if (getApplicationStatsNumIdempotentUrlRequests() == null) {
499             throw new com.sun.enterprise.admin.monitor.stats.lb.LoadBalancerStats.ValidateException("getApplicationStatsNumIdempotentUrlRequests() == null", "applicationStatsNumIdempotentUrlRequests", this); // NOI18N
500
}
501         // Validating property applicationStatsNumTotalRequests
502
if (getApplicationStatsNumTotalRequests() == null) {
503             throw new com.sun.enterprise.admin.monitor.stats.lb.LoadBalancerStats.ValidateException("getApplicationStatsNumTotalRequests() == null", "applicationStatsNumTotalRequests", this); // NOI18N
504
}
505     }
506
507     public void changePropertyByName(String JavaDoc name, Object JavaDoc value) {
508         if (name == null) return;
509         name = name.intern();
510         if (name == "id")
511             setId((java.lang.String JavaDoc)value);
512         else if (name == "health")
513             setHealth((java.lang.String JavaDoc)value);
514         else if (name == "numTotalRequests")
515             setNumTotalRequests((java.lang.String JavaDoc)value);
516         else if (name == "numActiveRequests")
517             setNumActiveRequests((java.lang.String JavaDoc)value);
518         else if (name == "applicationStats")
519             addApplicationStats(((java.lang.Boolean JavaDoc)value).booleanValue());
520         else if (name == "applicationStats[]")
521             setApplicationStats((boolean[]) value);
522         else if (name == "applicationStatsId")
523             setApplicationStatsId((java.lang.String JavaDoc)value);
524         else if (name == "applicationStatsAverageResponseTime")
525             setApplicationStatsAverageResponseTime((java.lang.String JavaDoc)value);
526         else if (name == "applicationStatsMinResponseTime")
527             setApplicationStatsMinResponseTime((java.lang.String JavaDoc)value);
528         else if (name == "applicationStatsMaxResponseTime")
529             setApplicationStatsMaxResponseTime((java.lang.String JavaDoc)value);
530         else if (name == "applicationStatsNumFailoverRequests")
531             setApplicationStatsNumFailoverRequests((java.lang.String JavaDoc)value);
532         else if (name == "applicationStatsNumErrorRequests")
533             setApplicationStatsNumErrorRequests((java.lang.String JavaDoc)value);
534         else if (name == "applicationStatsNumActiveRequests")
535             setApplicationStatsNumActiveRequests((java.lang.String JavaDoc)value);
536         else if (name == "applicationStatsNumIdempotentUrlRequests")
537             setApplicationStatsNumIdempotentUrlRequests((java.lang.String JavaDoc)value);
538         else if (name == "applicationStatsNumTotalRequests")
539             setApplicationStatsNumTotalRequests((java.lang.String JavaDoc)value);
540         else
541             throw new IllegalArgumentException JavaDoc(name+" is not a valid property name for InstanceStats");
542     }
543
544     public Object JavaDoc fetchPropertyByName(String JavaDoc name) {
545         if (name == "id")
546             return getId();
547         if (name == "health")
548             return getHealth();
549         if (name == "numTotalRequests")
550             return getNumTotalRequests();
551         if (name == "numActiveRequests")
552             return getNumActiveRequests();
553         if (name == "applicationStats[]")
554             return getApplicationStats();
555         if (name == "applicationStatsId")
556             return getApplicationStatsId();
557         if (name == "applicationStatsAverageResponseTime")
558             return getApplicationStatsAverageResponseTime();
559         if (name == "applicationStatsMinResponseTime")
560             return getApplicationStatsMinResponseTime();
561         if (name == "applicationStatsMaxResponseTime")
562             return getApplicationStatsMaxResponseTime();
563         if (name == "applicationStatsNumFailoverRequests")
564             return getApplicationStatsNumFailoverRequests();
565         if (name == "applicationStatsNumErrorRequests")
566             return getApplicationStatsNumErrorRequests();
567         if (name == "applicationStatsNumActiveRequests")
568             return getApplicationStatsNumActiveRequests();
569         if (name == "applicationStatsNumIdempotentUrlRequests")
570             return getApplicationStatsNumIdempotentUrlRequests();
571         if (name == "applicationStatsNumTotalRequests")
572             return getApplicationStatsNumTotalRequests();
573         throw new IllegalArgumentException JavaDoc(name+" is not a valid property name for InstanceStats");
574     }
575
576     // Return an array of all of the properties that are beans and are set.
577
public com.sun.enterprise.admin.monitor.stats.lb.CommonBean[] childBeans(boolean recursive) {
578         java.util.List JavaDoc children = new java.util.LinkedList JavaDoc();
579         childBeans(recursive, children);
580         com.sun.enterprise.admin.monitor.stats.lb.CommonBean[] result = new com.sun.enterprise.admin.monitor.stats.lb.CommonBean[children.size()];
581         return (com.sun.enterprise.admin.monitor.stats.lb.CommonBean[]) children.toArray(result);
582     }
583
584     // Put all child beans into the beans list.
585
public void childBeans(boolean recursive, java.util.List JavaDoc beans) {
586     }
587
588     public boolean equals(Object JavaDoc o) {
589         if (o == this)
590             return true;
591         if (!(o instanceof com.sun.enterprise.admin.monitor.stats.lb.InstanceStats))
592             return false;
593         com.sun.enterprise.admin.monitor.stats.lb.InstanceStats inst = (com.sun.enterprise.admin.monitor.stats.lb.InstanceStats) o;
594         if (!(_Id == null ? inst._Id == null : _Id.equals(inst._Id)))
595             return false;
596         if (!(_Health == null ? inst._Health == null : _Health.equals(inst._Health)))
597             return false;
598         if (!(_NumTotalRequests == null ? inst._NumTotalRequests == null : _NumTotalRequests.equals(inst._NumTotalRequests)))
599             return false;
600         if (!(_NumActiveRequests == null ? inst._NumActiveRequests == null : _NumActiveRequests.equals(inst._NumActiveRequests)))
601             return false;
602         if (sizeApplicationStats() != inst.sizeApplicationStats())
603             return false;
604         // Compare every element.
605
for (java.util.Iterator JavaDoc it = _ApplicationStats.iterator(), it2 = inst._ApplicationStats.iterator();
606             it.hasNext() && it2.hasNext(); ) {
607             boolean element = ((java.lang.Boolean JavaDoc)it.next()).booleanValue();
608             boolean element2 = ((java.lang.Boolean JavaDoc)it2.next()).booleanValue();
609             if (!(element == element2))
610                 return false;
611         }
612         if (!(_ApplicationStatsId == null ? inst._ApplicationStatsId == null : _ApplicationStatsId.equals(inst._ApplicationStatsId)))
613             return false;
614         if (!(_ApplicationStatsAverageResponseTime == null ? inst._ApplicationStatsAverageResponseTime == null : _ApplicationStatsAverageResponseTime.equals(inst._ApplicationStatsAverageResponseTime)))
615             return false;
616         if (!(_ApplicationStatsMinResponseTime == null ? inst._ApplicationStatsMinResponseTime == null : _ApplicationStatsMinResponseTime.equals(inst._ApplicationStatsMinResponseTime)))
617             return false;
618         if (!(_ApplicationStatsMaxResponseTime == null ? inst._ApplicationStatsMaxResponseTime == null : _ApplicationStatsMaxResponseTime.equals(inst._ApplicationStatsMaxResponseTime)))
619             return false;
620         if (!(_ApplicationStatsNumFailoverRequests == null ? inst._ApplicationStatsNumFailoverRequests == null : _ApplicationStatsNumFailoverRequests.equals(inst._ApplicationStatsNumFailoverRequests)))
621             return false;
622         if (!(_ApplicationStatsNumErrorRequests == null ? inst._ApplicationStatsNumErrorRequests == null : _ApplicationStatsNumErrorRequests.equals(inst._ApplicationStatsNumErrorRequests)))
623             return false;
624         if (!(_ApplicationStatsNumActiveRequests == null ? inst._ApplicationStatsNumActiveRequests == null : _ApplicationStatsNumActiveRequests.equals(inst._ApplicationStatsNumActiveRequests)))
625             return false;
626         if (!(_ApplicationStatsNumIdempotentUrlRequests == null ? inst._ApplicationStatsNumIdempotentUrlRequests == null : _ApplicationStatsNumIdempotentUrlRequests.equals(inst._ApplicationStatsNumIdempotentUrlRequests)))
627             return false;
628         if (!(_ApplicationStatsNumTotalRequests == null ? inst._ApplicationStatsNumTotalRequests == null : _ApplicationStatsNumTotalRequests.equals(inst._ApplicationStatsNumTotalRequests)))
629             return false;
630         return true;
631     }
632
633     public int hashCode() {
634         int result = 17;
635         result = 37*result + (_Id == null ? 0 : _Id.hashCode());
636         result = 37*result + (_Health == null ? 0 : _Health.hashCode());
637         result = 37*result + (_NumTotalRequests == null ? 0 : _NumTotalRequests.hashCode());
638         result = 37*result + (_NumActiveRequests == null ? 0 : _NumActiveRequests.hashCode());
639         result = 37*result + ((_ApplicationStats).hashCode());
640         result = 37*result + (_ApplicationStatsId == null ? 0 : _ApplicationStatsId.hashCode());
641         result = 37*result + (_ApplicationStatsAverageResponseTime == null ? 0 : _ApplicationStatsAverageResponseTime.hashCode());
642         result = 37*result + (_ApplicationStatsMinResponseTime == null ? 0 : _ApplicationStatsMinResponseTime.hashCode());
643         result = 37*result + (_ApplicationStatsMaxResponseTime == null ? 0 : _ApplicationStatsMaxResponseTime.hashCode());
644         result = 37*result + (_ApplicationStatsNumFailoverRequests == null ? 0 : _ApplicationStatsNumFailoverRequests.hashCode());
645         result = 37*result + (_ApplicationStatsNumErrorRequests == null ? 0 : _ApplicationStatsNumErrorRequests.hashCode());
646         result = 37*result + (_ApplicationStatsNumActiveRequests == null ? 0 : _ApplicationStatsNumActiveRequests.hashCode());
647         result = 37*result + (_ApplicationStatsNumIdempotentUrlRequests == null ? 0 : _ApplicationStatsNumIdempotentUrlRequests.hashCode());
648         result = 37*result + (_ApplicationStatsNumTotalRequests == null ? 0 : _ApplicationStatsNumTotalRequests.hashCode());
649         return result;
650     }
651
652     public String JavaDoc toString() {
653         java.io.StringWriter JavaDoc sw = new java.io.StringWriter JavaDoc();
654         try {
655             writeNode(sw, "InstanceStats", "");
656         } catch (java.io.IOException JavaDoc e) {
657             // How can we actually get an IOException on a StringWriter?
658
// We'll just ignore it.
659
}
660         return sw.toString();
661     }
662 }
663
664
665 /*
666         The following schema file has been used for generation:
667
668 <?xml version="1.0" encoding="UTF-8"?>
669
670 <!--
671     Document : sun_loadbalancer_stats_1_0.dtd.dtd
672     Created on : August 15, 2005, 3:22 PM
673     Author : hr124446
674     Description:
675         Purpose of the document follows.
676
677     TODO define vocabulary identification data
678     PUBLIC ID : -//Sun Microsystems Inc.//DTD Application Server 9.0 LoadBalancer Stats//EN
679     SYSTEM ID : http://www.sun.com/software/appserver/dtds/sun_loadbalancer_stats_1_0.dtd
680 -->
681
682 <!-- Root element for load balancer. It contains all the statistics -->
683    <!ELEMENT load-balancer-stats (cluster-stats*)>
684
685    <!--
686    Cluster Statistics
687      id Cluster name
688    -->
689
690    <!ELEMENT cluster-stats (instance-stats*)>
691    <!ATTLIST cluster-stats
692      id CDATA #REQUIRED>
693
694    <!--
695    Instance Statistics
696      id Server instance name
697      num-active-requests The number of active requests on this server.
698      num-total-requests The number of total requests on this server.
699    -->
700    <!ELEMENT instance-stats (application-stats*)>
701    <!ATTLIST instance-stats
702      id CDATA #REQUIRED
703      health CDATA #REQUIRED
704      num-total-requests CDATA #REQUIRED
705      num-active-requests CDATA #REQUIRED>
706
707    <!--
708    Application Statistics
709      id web module or web service endpoint's uri.
710      average-response-time Average response time in milli seconds.
711      min-response-time Minimum response time observed in milli seconds.
712      max-response-time Maximum response time observed in milli seconds.
713      num-failover-requests The number of failed-over requests for this context root.
714      num-error-requests The number of failed requests for this context root.
715      num-active-requests The number of active requests for this context root.
716      num-total-requests The number of total requests for this context root.
717      num-idempotent-url-requests The number of times all the idempotent urls in
718     this application are accessesd.
719    -->
720    <!ELEMENT application-stats EMPTY>
721    <!ATTLIST application-stats
722      id CDATA #REQUIRED
723      average-response-time CDATA #REQUIRED
724      min-response-time CDATA #REQUIRED
725      max-response-time CDATA #REQUIRED
726      num-failover-requests CDATA #REQUIRED
727      num-error-requests CDATA #REQUIRED
728      num-active-requests CDATA #REQUIRED
729      num-idempotent-url-requests CDATA #REQUIRED
730      num-total-requests CDATA #REQUIRED>
731
732
733 */

734
Popular Tags