KickJava   Java API By Example, From Geeks To Geeks.

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


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  * ClusteredInstance.java
26  *
27  * Created on May 21, 2004, 3:26 PM
28  */

29
30 package com.sun.enterprise.tools.upgrade.cluster;
31
32 /**
33  *
34  * @author prakash
35  */

36
37 /*
38  * This class represents one instance in clinstance.conf file
39  *
40  */

41
42 public class ClusteredInstance {
43     
44     private String JavaDoc instanceName;
45     private String JavaDoc user;
46     private String JavaDoc host;
47     private String JavaDoc port;
48     private String JavaDoc domain;
49     private String JavaDoc instancePort;
50     private boolean master;
51     /** Creates a new instance of ClusteredInstance */
52     public ClusteredInstance(String JavaDoc instName) {
53         this.instanceName = instName;
54     }
55     public void extractDataFromLine(String JavaDoc line){
56         if(line.trim().startsWith("user")){
57             this.user = line.substring("user".length()).trim();
58         }else if(line.trim().startsWith("host")){
59             this.host = line.substring("host".length()).trim();
60         }else if(line.trim().startsWith("port")){
61             this.port = line.substring("port".length()).trim();
62         }else if(line.trim().startsWith("domain")){
63             this.domain = line.substring("domain".length()).trim();
64         }else if(line.trim().startsWith("instanceport")){
65             this.instancePort = line.substring("instanceport".length()).trim();
66         }else if(line.trim().startsWith("master")){
67             String JavaDoc masterStr = line.substring("master".length()).trim();
68             this.master = ("true".equals(masterStr)) ? true :false;
69         }
70     }
71     /** Getter for property port.
72      * @return Value of property port.
73      *
74      */

75     public java.lang.String JavaDoc getPort() {
76         return port;
77     }
78     
79     /** Setter for property port.
80      * @param port New value of property port.
81      *
82      */

83     public void setPort(java.lang.String JavaDoc port) {
84         this.port = port;
85     }
86
87     /** Getter for property domain.
88      * @return Value of property domain.
89      *
90      */

91     public java.lang.String JavaDoc getDomain() {
92         return domain;
93     }
94     
95     /** Setter for property domain.
96      * @param domain New value of property domain.
97      *
98      */

99     public void setDomain(java.lang.String JavaDoc domain) {
100         this.domain = domain;
101     }
102     
103     /** Getter for property host.
104      * @return Value of property host.
105      *
106      */

107     public java.lang.String JavaDoc getHost() {
108         return host;
109     }
110     
111     /** Setter for property host.
112      * @param host New value of property host.
113      *
114      */

115     public void setHost(java.lang.String JavaDoc host) {
116         this.host = host;
117     }
118     
119     /** Getter for property instanceName.
120      * @return Value of property instanceName.
121      *
122      */

123     public java.lang.String JavaDoc getInstanceName() {
124         return instanceName;
125     }
126     
127     /** Setter for property instanceName.
128      * @param instanceName New value of property instanceName.
129      *
130      */

131     public void setInstanceName(java.lang.String JavaDoc instanceName) {
132         this.instanceName = instanceName;
133     }
134     
135     /** Getter for property instancePort.
136      * @return Value of property instancePort.
137      *
138      */

139     public java.lang.String JavaDoc getInstancePort() {
140         return instancePort;
141     }
142     
143     /** Setter for property instancePort.
144      * @param instancePort New value of property instancePort.
145      *
146      */

147     public void setInstancePort(java.lang.String JavaDoc instancePort) {
148         this.instancePort = instancePort;
149     }
150     
151     /** Getter for property user.
152      * @return Value of property user.
153      *
154      */

155     public java.lang.String JavaDoc getUser() {
156         return user;
157     }
158     
159     /** Setter for property user.
160      * @param user New value of property user.
161      *
162      */

163     public void setUser(java.lang.String JavaDoc user) {
164         this.user = user;
165     }
166     
167     /** Getter for property master.
168      * @return Value of property master.
169      *
170      */

171     public boolean isMaster() {
172         return master;
173     }
174     
175     /** Setter for property master.
176      * @param master New value of property master.
177      *
178      */

179     public void setMaster(boolean master) {
180         this.master = master;
181     }
182     
183 }
184
Popular Tags