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 2004-2005 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.jmx.test.helpers;
043:
044: /**
045: * Used to check JMX Manager wizard values.
046: */
047: public class Manager {
048:
049: public static String DEFAULT_PROTOCOL = "RMI JVM Agent";
050: public static String DEFAULT_HOST = "localhost";
051: public static String DEFAULT_PORT = "1099";
052: public static String DEFAULT_PATH = "/jndi/rmi://localhost:1099/jmxrmi";
053:
054: private String name = "";
055:
056: // Variables initialized with wizard default values
057: private String agentURL = "";
058: private String protocol = DEFAULT_PROTOCOL;
059: private String host = DEFAULT_HOST;
060: private String port = DEFAULT_PORT;
061: private String path = DEFAULT_PATH;
062: private String userName = "";
063: private String password = "";
064: private boolean generateMainMethod = true;
065: private boolean projectMainClass = true;
066: private boolean generateSampleDiscoveryCode = true;
067: private boolean authenticatedConnection = true;
068: private boolean generateSampleConnectionCode = true;
069:
070: /** Creates a new instance of Manager with default values */
071: public Manager() {
072: }
073:
074: public String getName() {
075: return name;
076: }
077:
078: public void setName(String s) {
079: this .name = s;
080: }
081:
082: public String getAgentURL() {
083: return agentURL;
084: }
085:
086: /**
087: * The agent URL text field is not editable.
088: * It is updated using the agent URL popup values.
089: */
090: public void updateAgentURL() {
091: if (this .protocol.equals(DEFAULT_PROTOCOL)) {
092: this .agentURL = "service:jmx:rmi://" + host + ":" + port
093: + path;
094: } else {
095: this .agentURL = "service:jmx:" + protocol + "://" + host
096: + ":" + port + path;
097: }
098: }
099:
100: public String getProtocol() {
101: return protocol;
102: }
103:
104: public void setProtocol(String s) {
105: this .protocol = s;
106: }
107:
108: public String getHost() {
109: return host;
110: }
111:
112: public void setHost(String s) {
113: this .host = s;
114: }
115:
116: public String getPort() {
117: return port;
118: }
119:
120: public void setPort(String s) {
121: this .port = s;
122: }
123:
124: public String getPath() {
125: return path;
126: }
127:
128: public void setPath(String s) {
129: this .path = s;
130: }
131:
132: public String getUserName() {
133: return userName;
134: }
135:
136: public void setUserName(String s) {
137: this .userName = s;
138: }
139:
140: public String getPassword() {
141: return password;
142: }
143:
144: public void setPassword(String s) {
145: this .password = s;
146: }
147:
148: public boolean getGenerateMainMethod() {
149: return generateMainMethod;
150: }
151:
152: public void setGenerateMainMethod(boolean b) {
153: this .generateMainMethod = b;
154: if (this .generateMainMethod == false) {
155: this .projectMainClass = false;
156: this .generateSampleDiscoveryCode = false;
157: }
158: }
159:
160: public boolean getProjectMainClass() {
161: return projectMainClass;
162: }
163:
164: public void setProjectMainClass(boolean b) {
165: this .projectMainClass = b;
166: }
167:
168: public boolean getGenerateSampleDiscoveryCode() {
169: return generateSampleDiscoveryCode;
170: }
171:
172: public void setGenerateSampleDiscoveryCode(boolean b) {
173: this .generateSampleDiscoveryCode = b;
174: }
175:
176: public boolean getAuthenticatedConnection() {
177: return authenticatedConnection;
178: }
179:
180: public void setAuthenticatedConnection(boolean b) {
181: this .authenticatedConnection = b;
182: }
183:
184: public boolean getGenerateSampleConnectionCode() {
185: return generateSampleConnectionCode;
186: }
187:
188: public void setGenerateSampleConnectionCode(boolean b) {
189: this .generateSampleConnectionCode = b;
190: }
191:
192: public boolean getGenerateCredentialsConnectionCode() {
193: return !generateSampleConnectionCode;
194: }
195:
196: public void setGenerateCredentialsConnectionCode(boolean b) {
197: this.generateSampleConnectionCode = !b;
198: }
199: }
|