001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.modules.sun.manager.jbi.util;
043:
044: import java.io.Serializable;
045:
046: /**
047: * DOCUMENT ME!
048: *
049: * @author Graj TODO To change the template for this generated type comment go to Window -
050: * Preferences - Java - Code Style - Code Templates
051: */
052: /*
053:
054: */
055: public class ServerInstance implements Serializable {
056:
057: static final String DISPLAY_NAME = "displayName"; // NOI18N
058: static final String DOMAIN = "DOMAIN"; // NOI18N
059: static final String HTTP_MONITOR_ON = "HttpMonitorOn"; // NOI18N
060: static final String HTTP_PORT_NUMBER = "httpportnumber"; // NOI18N
061: static final String LOCATION = "LOCATION"; // NOI18N
062: static final String PASSWORD = "password"; // NOI18N
063: static final String URL = "url"; // NOI18N
064: static final String USER_NAME = "username"; // NOI18N
065:
066: private String displayName;
067: private String domain;
068: private String httpMonitorOn;
069: private String httpPortNumber;
070: private String location;
071: private String password;
072: private String url;
073: private String userName;
074: private String hostName;
075: private String adminPort;
076:
077: public ServerInstance() {
078: }
079:
080: /**
081: * DOCUMENT ME!
082: *
083: * @param displayName
084: * @param domain
085: * @param httpMonitorOn
086: * @param httpPortNumber
087: * @param location
088: * @param password
089: * @param url
090: * @param userName
091: */
092: public ServerInstance(String displayName, String domain,
093: String httpMonitorOn, String httpPortNumber,
094: String location, String password, String url,
095: String userName) {
096: this .displayName = displayName;
097: this .domain = domain;
098: this .httpMonitorOn = httpMonitorOn;
099: this .httpPortNumber = httpPortNumber;
100: this .location = location;
101: this .password = password;
102: this .url = url;
103: this .userName = userName;
104: }
105:
106: /**
107: * DOCUMENT ME!
108: *
109: * @return Returns the displayName.
110: */
111: public String getDisplayName() {
112: return this .displayName;
113: }
114:
115: /**
116: * DOCUMENT ME!
117: *
118: * @param displayName The displayName to set.
119: */
120: public void setDisplayName(String displayName) {
121: this .displayName = displayName;
122: }
123:
124: /**
125: * DOCUMENT ME!
126: *
127: * @return Returns the domain.
128: */
129: public String getDomain() {
130: return this .domain;
131: }
132:
133: /**
134: * DOCUMENT ME!
135: *
136: * @param domain The domain to set.
137: */
138: public void setDomain(String domain) {
139: this .domain = domain;
140: }
141:
142: /**
143: * DOCUMENT ME!
144: *
145: * @return Returns the httpMonitorOn.
146: */
147: public String getHttpMonitorOn() {
148: return this .httpMonitorOn;
149: }
150:
151: /**
152: * DOCUMENT ME!
153: *
154: * @param httpMonitorOn The httpMonitorOn to set.
155: */
156: public void setHttpMonitorOn(String httpMonitorOn) {
157: this .httpMonitorOn = httpMonitorOn;
158: }
159:
160: /**
161: * DOCUMENT ME!
162: *
163: * @return Returns the httpPortNumber.
164: */
165: public String getHttpPortNumber() {
166: return this .httpPortNumber;
167: }
168:
169: /**
170: * DOCUMENT ME!
171: *
172: * @param httpPortNumber The httpPortNumber to set.
173: */
174: public void setHttpPortNumber(String httpPortNumber) {
175: this .httpPortNumber = httpPortNumber;
176: }
177:
178: /**
179: * Gets local domain's parent location. For remote domain, this location
180: * is empty.
181: *
182: * @return Returns the location.
183: */
184: public String getLocation() {
185: return this .location;
186: }
187:
188: /**
189: * DOCUMENT ME!
190: *
191: * @param location The location to set.
192: */
193: public void setLocation(String location) {
194: this .location = location;
195: }
196:
197: /**
198: * DOCUMENT ME!
199: *
200: * @return Returns the password.
201: */
202: public String getPassword() {
203: return this .password;
204: }
205:
206: /**
207: * DOCUMENT ME!
208: *
209: * @param password The password to set.
210: */
211: public void setPassword(String password) {
212: this .password = password;
213: }
214:
215: /**
216: * DOCUMENT ME!
217: *
218: * @return Returns the url.
219: */
220: public String getUrl() {
221: return this .url;
222: }
223:
224: /**
225: * Gets the location part from the URL. For remote server, the location
226: * is undefined. The location part from the URL gives the location of
227: * local server installation.
228: */
229: public String getUrlLocation() {
230: String url = getUrl();
231: int index = url.indexOf(']'); // NOI18N
232: if (index != -1) {
233: return url.substring(1, index);
234: } else {
235: return null; // unconfigured Tomcat, for example
236: }
237: }
238:
239: /**
240: * DOCUMENT ME!
241: *
242: * @param url The url to set.
243: */
244: public void setUrl(String url) {
245: this .url = url;
246:
247: String[] separator = this .url.split(":"); // NOI18N
248:
249: int k = separator.length - 1;
250:
251: /* NB5.0 Format changed...
252: [C:\alaska\root\jbi\runtime\Sun\AppServer]deployer:Sun:AppServer::localhost:4848
253: [/home/tli/SUNWappserver]deployer:Sun:AppServer::localhost:24848"
254: */
255: this .hostName = separator[k - 1];
256: this .adminPort = separator[k];
257: }
258:
259: /**
260: * DOCUMENT ME!
261: *
262: * @return Returns the userName.
263: */
264: public String getUserName() {
265: return this .userName;
266: }
267:
268: /**
269: * DOCUMENT ME!
270: *
271: * @param userName The userName to set.
272: */
273: public void setUserName(String userName) {
274: this .userName = userName;
275: }
276:
277: /**
278: * DOCUMENT ME!
279: *
280: * @return Returns the adminPort.
281: */
282: public String getAdminPort() {
283: return this .adminPort;
284: }
285:
286: /**
287: * DOCUMENT ME!
288: *
289: * @return Returns the hostName.
290: */
291: public String getHostName() {
292: return this .hostName;
293: }
294:
295: /**
296: * DOCUMENT ME!
297: */
298: public void printOut() {
299: System.out
300: .println("/////////////////////////////////////////////////"); // NOI18N
301: System.out.println("// -- Instance values --"); // NOI18N
302: System.out
303: .println("/////////////////////////////////////////////////"); // NOI18N
304: System.out.println("// displayName is :" + this .displayName); // NOI18N
305: System.out.println("// domain is :" + this .domain); // NOI18N
306: System.out
307: .println("// httpMonitorOn is :" + this .httpMonitorOn); // NOI18N
308: System.out.println("// httpPortNumber is :"
309: + this .httpPortNumber); // NOI18N
310: System.out.println("// location is :" + this .location); // NOI18N
311: System.out.println("// password is :" + this .password); // NOI18N
312: System.out.println("// url is :" + this .url); // NOI18N
313: System.out.println("// userName is :" + this .userName); // NOI18N
314: System.out.println("// hostName is :" + this .hostName); // NOI18N
315: System.out.println("// adminPort is :" + this .adminPort); // NOI18N
316: System.out
317: .println("/////////////////////////////////////////////////"); // NOI18N
318: }
319: }
|