001package org.apache.archiva.configuration; 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022/** 023 * Class NetworkProxyConfiguration. 024 * 025 * @version $Revision$ $Date$ 026 */ 027@SuppressWarnings( "all" ) 028public class NetworkProxyConfiguration 029 implements java.io.Serializable 030{ 031 032 //--------------------------/ 033 //- Class/Member Variables -/ 034 //--------------------------/ 035 036 /** 037 * 038 * The ID for this proxy. 039 * 040 */ 041 private String id; 042 043 /** 044 * 045 * The network protocol to use with this proxy: 046 * "http", "socks-4" 047 * . 048 */ 049 private String protocol = "http"; 050 051 /** 052 * 053 * The proxy host. 054 * 055 */ 056 private String host; 057 058 /** 059 * 060 * The proxy port. 061 * 062 */ 063 private int port = 8080; 064 065 /** 066 * 067 * The proxy user. 068 * 069 */ 070 private String username; 071 072 /** 073 * 074 * The proxy password. 075 * 076 */ 077 private String password; 078 079 /** 080 * 081 * Use ntlm authentification. 082 * 083 */ 084 private boolean useNtlm = false; 085 086 087 //-----------/ 088 //- Methods -/ 089 //-----------/ 090 091 /** 092 * Get the proxy host. 093 * 094 * @return String 095 */ 096 public String getHost() 097 { 098 return this.host; 099 } //-- String getHost() 100 101 /** 102 * Get the ID for this proxy. 103 * 104 * @return String 105 */ 106 public String getId() 107 { 108 return this.id; 109 } //-- String getId() 110 111 /** 112 * Get the proxy password. 113 * 114 * @return String 115 */ 116 public String getPassword() 117 { 118 return this.password; 119 } //-- String getPassword() 120 121 /** 122 * Get the proxy port. 123 * 124 * @return int 125 */ 126 public int getPort() 127 { 128 return this.port; 129 } //-- int getPort() 130 131 /** 132 * Get the network protocol to use with this proxy: "http", 133 * "socks-4". 134 * 135 * @return String 136 */ 137 public String getProtocol() 138 { 139 return this.protocol; 140 } //-- String getProtocol() 141 142 /** 143 * Get the proxy user. 144 * 145 * @return String 146 */ 147 public String getUsername() 148 { 149 return this.username; 150 } //-- String getUsername() 151 152 /** 153 * Get use ntlm authentification. 154 * 155 * @return boolean 156 */ 157 public boolean isUseNtlm() 158 { 159 return this.useNtlm; 160 } //-- boolean isUseNtlm() 161 162 /** 163 * Set the proxy host. 164 * 165 * @param host 166 */ 167 public void setHost( String host ) 168 { 169 this.host = host; 170 } //-- void setHost( String ) 171 172 /** 173 * Set the ID for this proxy. 174 * 175 * @param id 176 */ 177 public void setId( String id ) 178 { 179 this.id = id; 180 } //-- void setId( String ) 181 182 /** 183 * Set the proxy password. 184 * 185 * @param password 186 */ 187 public void setPassword( String password ) 188 { 189 this.password = password; 190 } //-- void setPassword( String ) 191 192 /** 193 * Set the proxy port. 194 * 195 * @param port 196 */ 197 public void setPort( int port ) 198 { 199 this.port = port; 200 } //-- void setPort( int ) 201 202 /** 203 * Set the network protocol to use with this proxy: "http", 204 * "socks-4". 205 * 206 * @param protocol 207 */ 208 public void setProtocol( String protocol ) 209 { 210 this.protocol = protocol; 211 } //-- void setProtocol( String ) 212 213 /** 214 * Set use ntlm authentification. 215 * 216 * @param useNtlm 217 */ 218 public void setUseNtlm( boolean useNtlm ) 219 { 220 this.useNtlm = useNtlm; 221 } //-- void setUseNtlm( boolean ) 222 223 /** 224 * Set the proxy user. 225 * 226 * @param username 227 */ 228 public void setUsername( String username ) 229 { 230 this.username = username; 231 } //-- void setUsername( String ) 232 233 234 public int hashCode() 235 { 236 int result = 17; 237 result = 37 * result + ( id != null ? id.hashCode() : 0 ); 238 return result; 239 } 240 241 public boolean equals( Object other ) 242 { 243 if ( this == other ) 244 { 245 return true; 246 } 247 248 if ( !( other instanceof NetworkProxyConfiguration ) ) 249 { 250 return false; 251 } 252 253 NetworkProxyConfiguration that = (NetworkProxyConfiguration) other; 254 boolean result = true; 255 result = result && ( getId() == null ? that.getId() == null : getId().equals( that.getId() ) ); 256 return result; 257 } 258 259}