KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > upgrade > cluster > LBCluster


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  * LBCluster.java
26  *
27  * Created on June 21, 2004, 4:53 PM
28  */

29
30 package com.sun.enterprise.tools.upgrade.cluster;
31 /**
32  * This class represents a cluster element in loadbalancer
33  *
34  * @author prakash
35  */

36 import java.util.*;
37 import org.w3c.dom.Element JavaDoc;
38 import org.w3c.dom.Node JavaDoc;
39 import org.w3c.dom.NodeList JavaDoc;
40
41 public class LBCluster {
42     
43     private List JavaDoc instances;
44     private List JavaDoc webModules;
45     private LBHealthChecker healthChecker;
46     /** Creates a new instance of LBCluster */
47     public LBCluster(Element JavaDoc clusterElement) {
48         instances = new ArrayList();
49         webModules = new ArrayList();
50         NodeList JavaDoc inEles = clusterElement.getElementsByTagName("instance");
51         for(int lh =0; lh < inEles.getLength(); lh++){
52             instances.add(new LBInstance((Element JavaDoc)inEles.item(lh)));
53         }
54         NodeList JavaDoc webEles = clusterElement.getElementsByTagName("web-module");
55         for(int ih =0; ih < webEles.getLength(); ih++){
56             webModules.add(new LBWebModule((Element JavaDoc)webEles.item(ih)));
57         }
58         NodeList JavaDoc helEles = clusterElement.getElementsByTagName("health-checker");
59         for(int ih =0; ih < helEles.getLength(); ih++){
60             // There should either zero or one health-checker.
61
healthChecker = new LBHealthChecker((Element JavaDoc)helEles.item(ih));
62         }
63     }
64     
65     public LBHealthChecker getHealthChecker() {
66         return healthChecker;
67     }
68     public java.util.List JavaDoc getInstances() {
69         return instances;
70     }
71     public java.util.List JavaDoc getWebModules() {
72         return webModules;
73     }
74 }
75
Popular Tags