Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ProxyInfo |
|
| 1.0;1 |
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 | * @version $Id: ProxyInfo.java 1153670 2011-08-03 21:15:53Z olamy $ | |
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 | 6 | 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 | 6 | private String host = null; |
48 | ||
49 | /** | |
50 | * Username used to access the proxy server | |
51 | */ | |
52 | 6 | private String userName = null; |
53 | ||
54 | /** | |
55 | * Password associated with the proxy server | |
56 | */ | |
57 | 6 | private String password = null; |
58 | ||
59 | /** | |
60 | * Proxy server port | |
61 | */ | |
62 | 6 | private int port = WagonConstants.UNKNOWN_PORT; |
63 | ||
64 | /** | |
65 | * Type of the proxy | |
66 | */ | |
67 | 6 | 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 | 1 | 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 | 3 | this.host = host; |
102 | 3 | } |
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 | 1 | 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 | 3 | this.password = password; |
122 | 3 | } |
123 | ||
124 | /** | |
125 | * Get the proxy port. | |
126 | * | |
127 | * @return proxy server port | |
128 | */ | |
129 | public int getPort() | |
130 | { | |
131 | 1 | 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 | 3 | this.port = port; |
142 | 3 | } |
143 | ||
144 | /** | |
145 | * Get the proxy username. | |
146 | * | |
147 | * @return username for the proxy server | |
148 | */ | |
149 | public String getUserName() | |
150 | { | |
151 | 1 | 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 | 3 | this.userName = userName; |
162 | 3 | } |
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 | 5 | 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 | 6 | this.type = type; |
180 | 6 | } |
181 | ||
182 | public String getNonProxyHosts() | |
183 | { | |
184 | 12 | return nonProxyHosts; |
185 | } | |
186 | ||
187 | public void setNonProxyHosts( String nonProxyHosts ) | |
188 | { | |
189 | 4 | this.nonProxyHosts = nonProxyHosts; |
190 | 4 | } |
191 | ||
192 | public String getNtlmHost() | |
193 | { | |
194 | 0 | return ntlmHost; |
195 | } | |
196 | ||
197 | public void setNtlmHost( String ntlmHost ) | |
198 | { | |
199 | 0 | this.ntlmHost = ntlmHost; |
200 | 0 | } |
201 | ||
202 | public void setNtlmDomain( String ntlmDomain ) | |
203 | { | |
204 | 0 | this.ntlmDomain = ntlmDomain; |
205 | 0 | } |
206 | ||
207 | public String getNtlmDomain() | |
208 | { | |
209 | 0 | return ntlmDomain; |
210 | } | |
211 | ||
212 | @Override | |
213 | public String toString() | |
214 | { | |
215 | 0 | return "ProxyInfo{" + "host='" + host + '\'' + ", userName='" + userName + '\'' + ", port=" + port + ", type='" |
216 | + type + '\'' + ", nonProxyHosts='" + nonProxyHosts + '\'' + '}'; | |
217 | } | |
218 | } |