1 package org.apache.maven.wagon.proxy;
2
3 /*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21
22 import org.apache.maven.wagon.WagonConstants;
23
24 import java.io.Serializable;
25
26 /**
27 * Contains set of properties used by <code>Wagon</code> objects
28 * while connection to the repository must go thru a proxy server.
29 *
30 * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
31 *
32 * @todo Propose standard types of proxy servers (e.g. <i>SOCKSv4</i>),
33 * which can be shared between wagon api and providers
34 */
35 public class ProxyInfo
36 implements Serializable
37 {
38 public static final String PROXY_SOCKS5 = "SOCKS_5";
39
40 public static final String PROXY_SOCKS4 = "SOCKS4";
41
42 public static final String PROXY_HTTP = "HTTP";
43
44 /**
45 * Proxy server host
46 */
47 private String host = null;
48
49 /**
50 * Username used to access the proxy server
51 */
52 private String userName = null;
53
54 /**
55 * Password associated with the proxy server
56 */
57 private String password = null;
58
59 /**
60 * Proxy server port
61 */
62 private int port = WagonConstants.UNKNOWN_PORT;
63
64 /**
65 * Type of the proxy
66 */
67 private String type = null;
68
69 /**
70 * The non-proxy hosts. Follows Java system property format: <code>*.foo.com|localhost</code>.
71 */
72 private String nonProxyHosts;
73
74 /**
75 * For NTLM proxies, specifies the NTLM host.
76 */
77 private String ntlmHost;
78
79 /**
80 * For NTLM proxies, specifies the NTLM domain.
81 */
82 private String ntlmDomain;
83
84 /**
85 * Return proxy server host name.
86 *
87 * @return proxy server host name
88 */
89 public String getHost()
90 {
91 return host;
92 }
93
94 /**
95 * Set proxy host name.
96 *
97 * @param host proxy server host name
98 */
99 public void setHost( final String host )
100 {
101 this.host = host;
102 }
103
104 /**
105 * Get user's password used to login to proxy server.
106 *
107 * @return user's password at proxy host
108 */
109 public String getPassword()
110 {
111 return password;
112 }
113
114 /**
115 * Set the user's password for the proxy server.
116 *
117 * @param password password to use to login to a proxy server
118 */
119 public void setPassword( final String password )
120 {
121 this.password = password;
122 }
123
124 /**
125 * Get the proxy port.
126 *
127 * @return proxy server port
128 */
129 public int getPort()
130 {
131 return port;
132 }
133
134 /**
135 * Set the proxy port.
136 *
137 * @param port proxy server port
138 */
139 public void setPort( final int port )
140 {
141 this.port = port;
142 }
143
144 /**
145 * Get the proxy username.
146 *
147 * @return username for the proxy server
148 */
149 public String getUserName()
150 {
151 return userName;
152 }
153
154 /**
155 * Set the proxy username.
156 *
157 * @param userName username for the proxy server
158 */
159 public void setUserName( final String userName )
160 {
161 this.userName = userName;
162 }
163
164 /**
165 * Get the type of the proxy server.
166 *
167 * @return the type of the proxy server
168 */
169 public String getType()
170 {
171 return type;
172 }
173
174 /**
175 * @param type the type of the proxy server like <i>SOCKSv4</i>
176 */
177 public void setType( final String type )
178 {
179 this.type = type;
180 }
181
182 public String getNonProxyHosts()
183 {
184 return nonProxyHosts;
185 }
186
187 public void setNonProxyHosts( String nonProxyHosts )
188 {
189 this.nonProxyHosts = nonProxyHosts;
190 }
191
192 public String getNtlmHost()
193 {
194 return ntlmHost;
195 }
196
197 public void setNtlmHost( String ntlmHost )
198 {
199 this.ntlmHost = ntlmHost;
200 }
201
202 public void setNtlmDomain( String ntlmDomain )
203 {
204 this.ntlmDomain = ntlmDomain;
205 }
206
207 public String getNtlmDomain()
208 {
209 return ntlmDomain;
210 }
211
212 @Override
213 public String toString()
214 {
215 return "ProxyInfo{" + "host='" + host + '\'' + ", userName='" + userName + '\'' + ", port=" + port + ", type='"
216 + type + '\'' + ", nonProxyHosts='" + nonProxyHosts + '\'' + '}';
217 }
218 }