File Source: ServerInfo.java
/*
P/P * Method: com.dmdirc.parser.irc.ServerInfo__static_init
*/
1 /*
2 * Copyright (c) 2006-2009 Chris Smith, Shane Mc Cormack, Gregory Holmes
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 * SOFTWARE.
21 */
22
23 package com.dmdirc.parser.irc;
24
25 /**
26 * Contains Server information.
27 *
28 * @author Shane Mc Cormack
29 * @author Chris Smith
30 * @see IRCParser
31 */
32 public class ServerInfo {
33 /**
34 * A version number for this class. It should be changed whenever the class
35 * structure is changed (or anything else that would prevent serialized
36 * objects being unserialized with the new class).
37 */
38 private static final long serialVersionUID = 1;
39
40 /** Server to connect to (Default: "irc.quakenet.org"). */
41 private String host = "irc.quakenet.org";
42 /** Port server listens on for client connections (Default: 6667). */
43 private int port = 6667;
44 /** Optional password needed to connect to server (Default: ""). */
45 private String password = "";
46 /** Is this an ssl-enabled server (Default: false). */
47 private boolean isSSL = false;
48 /** Are we using a socks proxy (Default: false). */
49 private boolean useSocksProxy = false;
50 /** Proxy server to connect to (Default: "127.0.0.1"). */
51 private String proxyHost = "127.0.0.1";
52 /** Port server listens on for client connections (Default: 8080). */
53 private int proxyPort = 1080;
54 /** Proxy username if required. */
55 private String proxyUser = "";
56 /** Proxy password if required. */
57 private String proxyPass = "";
58
59 /** Constructor using Default values. */
/*
P/P * Method: void com.dmdirc.parser.irc.ServerInfo()
*
* Postconditions:
* this.host == &"irc.quakenet.org"
* this.isSSL == 0
* this.useSocksProxy == 0
* this.password == &""
* this.proxyPass == &""
* this.proxyUser == &""
* this.port == 6_667
* this.proxyHost == &"127.0.0.1"
* this.proxyPort == 1_080
*/
60 public ServerInfo () { }
61
62 /**
63 * Constructor using specifed host, port and password, SSL/Proxy must be specifed separately.
64 *
65 * @param serverHost Host to use
66 * @param serverPort Port to use
67 * @param serverPass Password to use
68 */
/*
P/P * Method: void com.dmdirc.parser.irc.ServerInfo(String, int, String)
*
* Postconditions:
* this.host == serverHost
* init'ed(this.host)
* this.isSSL == 0
* this.useSocksProxy == 0
* this.password == serverPass
* init'ed(this.password)
* this.port == serverPort
* init'ed(this.port)
* this.proxyHost == &"127.0.0.1"
* this.proxyPass == &""
* ...
*/
69 public ServerInfo (final String serverHost, final int serverPort, final String serverPass) {
70 host = serverHost;
71 port = serverPort;
72 password = serverPass;
73 }
74
75 /**
76 * Set the hostname.
77 *
78 * @param newValue Value to set to.
79 */
/*
P/P * Method: void setHost(String)
*
* Postconditions:
* this.host == newValue
* init'ed(this.host)
*/
80 public void setHost(final String newValue) { host = newValue; }
81
82 /**
83 * Get the hostname.
84 *
85 * @return Current hostname
86 */
/*
P/P * Method: String getHost()
*
* Preconditions:
* init'ed(this.host)
*
* Postconditions:
* return_value == this.host
* init'ed(return_value)
*/
87 public String getHost() { return host; }
88
89 /**
90 * Set the port.
91 *
92 * @param newValue Value to set to.
93 */
/*
P/P * Method: void setPort(int)
*
* Postconditions:
* this.port == newValue
* init'ed(this.port)
*/
94 public void setPort(final int newValue) { port = newValue; }
95
96 /**
97 * Get the port.
98 *
99 * @return Current port
100 */
/*
P/P * Method: int getPort()
*
* Preconditions:
* init'ed(this.port)
*
* Postconditions:
* return_value == this.port
* init'ed(return_value)
*/
101 public int getPort() { return port; }
102
103 /**
104 * Set the password.
105 *
106 * @param newValue Value to set to.
107 */
/*
P/P * Method: void setPassword(String)
*
* Postconditions:
* this.password == newValue
* init'ed(this.password)
*/
108 public void setPassword(final String newValue) { password = newValue; }
109
110 /**
111 * Get the password.
112 *
113 * @return Current Password
114 */
/*
P/P * Method: String getPassword()
*
* Preconditions:
* init'ed(this.password)
*
* Postconditions:
* return_value == this.password
* init'ed(return_value)
*/
115 public String getPassword() { return password; }
116
117 /**
118 * Set if the server uses ssl.
119 *
120 * @param newValue true if server uses ssl, else false
121 */
/*
P/P * Method: void setSSL(bool)
*
* Postconditions:
* this.isSSL == newValue
* init'ed(this.isSSL)
*/
122 public void setSSL(final boolean newValue) { isSSL = newValue; }
123
124 /**
125 * Get if the server uses ssl.
126 *
127 * @return true if server uses ssl, else false
128 */
/*
P/P * Method: bool getSSL()
*
* Preconditions:
* init'ed(this.isSSL)
*
* Postconditions:
* return_value == this.isSSL
* init'ed(return_value)
*/
129 public boolean getSSL() { return isSSL; }
130
131 /**
132 * Set if we are connecting via a socks proxy.
133 *
134 * @param newValue true if we are using socks, else false
135 */
/*
P/P * Method: void setUseSocks(bool)
*
* Postconditions:
* this.useSocksProxy == newValue
* init'ed(this.useSocksProxy)
*/
136 public void setUseSocks(final boolean newValue) { useSocksProxy = newValue; }
137
138 /**
139 * Get if we are connecting via a socks proxy.
140 *
141 * @return true if we are using socks, else false
142 */
/*
P/P * Method: bool getUseSocks()
*
* Preconditions:
* init'ed(this.useSocksProxy)
*
* Postconditions:
* return_value == this.useSocksProxy
* init'ed(return_value)
*/
143 public boolean getUseSocks() { return useSocksProxy; }
144
145 /**
146 * Set the Proxy hostname.
147 *
148 * @param newValue Value to set to.
149 */
/*
P/P * Method: void setProxyHost(String)
*
* Postconditions:
* this.proxyHost == newValue
* init'ed(this.proxyHost)
*/
150 public void setProxyHost(final String newValue) { proxyHost = newValue; }
151
152 /**
153 * Get the Proxy hostname.
154 *
155 * @return Current Proxy hostname
156 */
/*
P/P * Method: String getProxyHost()
*
* Preconditions:
* init'ed(this.proxyHost)
*
* Postconditions:
* return_value == this.proxyHost
* init'ed(return_value)
*/
157 public String getProxyHost() { return proxyHost; }
158
159 /**
160 * Set the Proxy port.
161 *
162 * @param newValue Value to set to.
163 */
/*
P/P * Method: void setProxyPort(int)
*
* Postconditions:
* this.proxyPort == newValue
* init'ed(this.proxyPort)
*/
164 public void setProxyPort(final int newValue) { proxyPort = newValue; }
165
166 /**
167 * Get the Proxy port.
168 *
169 * @return Current Proxy port
170 */
/*
P/P * Method: int getProxyPort()
*
* Preconditions:
* init'ed(this.proxyPort)
*
* Postconditions:
* return_value == this.proxyPort
* init'ed(return_value)
*/
171 public int getProxyPort() { return proxyPort; }
172
173 /**
174 * Set the Proxy username.
175 *
176 * @param newValue Value to set to.
177 */
/*
P/P * Method: void setProxyUser(String)
*
* Postconditions:
* this.proxyUser == newValue
* init'ed(this.proxyUser)
*/
178 public void setProxyUser(final String newValue) { proxyUser = newValue; }
179
180 /**
181 * Get the Proxy username.
182 *
183 * @return Current Proxy username
184 */
/*
P/P * Method: String getProxyUser()
*
* Preconditions:
* init'ed(this.proxyUser)
*
* Postconditions:
* return_value == this.proxyUser
* init'ed(return_value)
*/
185 public String getProxyUser() { return proxyUser; }
186
187 /**
188 * Set the Proxy password.
189 *
190 * @param newValue Value to set to.
191 */
/*
P/P * Method: void setProxyPass(String)
*
* Postconditions:
* this.proxyPass == newValue
* init'ed(this.proxyPass)
*/
192 public void setProxyPass(final String newValue) { proxyPass = newValue; }
193
194 /**
195 * Get the Proxy password.
196 *
197 * @return Current Proxy password
198 */
/*
P/P * Method: String getProxyPass()
*
* Preconditions:
* init'ed(this.proxyPass)
*
* Postconditions:
* return_value == this.proxyPass
* init'ed(return_value)
*/
199 public String getProxyPass() { return proxyPass; }
200 }
201
SofCheck Inspector Build Version : 2.17854
| ServerInfo.java |
2009-Jun-25 01:54:24 |
| ServerInfo.class |
2009-Sep-02 17:04:12 |