001package org.apache.archiva.admin.model.beans; 002/* 003 * Licensed to the Apache Software Foundation (ASF) under one 004 * or more contributor license agreements. See the NOTICE file 005 * distributed with this work for additional information 006 * regarding copyright ownership. The ASF licenses this file 007 * to you under the Apache License, Version 2.0 (the 008 * "License"); you may not use this file except in compliance 009 * with the License. You may obtain a copy of the License at 010 * 011 * http://www.apache.org/licenses/LICENSE-2.0 012 * 013 * Unless required by applicable law or agreed to in writing, 014 * software distributed under the License is distributed on an 015 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 016 * KIND, either express or implied. See the License for the 017 * specific language governing permissions and limitations 018 * under the License. 019 */ 020 021import javax.xml.bind.annotation.XmlRootElement; 022import java.io.Serializable; 023 024/** 025 * @author Olivier Lamy 026 * @since 1.4-M1 027 */ 028@XmlRootElement( name = "networkProxy" ) 029public class NetworkProxy 030 implements Serializable 031{ 032 private String id; 033 034 /** 035 * The network protocol to use with this proxy: "http", "socks-4" 036 * . 037 */ 038 private String protocol = "http"; 039 040 /** 041 * The proxy host. 042 */ 043 private String host; 044 045 /** 046 * The proxy port. 047 */ 048 private int port = 8080; 049 050 /** 051 * The proxy user. 052 */ 053 private String username; 054 055 /** 056 * The proxy password. 057 */ 058 private String password; 059 060 /** 061 * @since 1.4-M3 062 * 063 * use NTLM proxy 064 */ 065 private boolean useNtlm; 066 067 public NetworkProxy() 068 { 069 // no op 070 } 071 072 public NetworkProxy( String id, String protocol, String host, int port, String username, String password ) 073 { 074 this.id = id; 075 this.protocol = protocol; 076 this.host = host; 077 this.port = port; 078 this.username = username; 079 this.password = password; 080 } 081 082 public String getId() 083 { 084 return id; 085 } 086 087 public void setId( String id ) 088 { 089 this.id = id; 090 } 091 092 public String getProtocol() 093 { 094 return protocol; 095 } 096 097 public void setProtocol( String protocol ) 098 { 099 this.protocol = protocol; 100 } 101 102 public String getHost() 103 { 104 return host; 105 } 106 107 public void setHost( String host ) 108 { 109 this.host = host; 110 } 111 112 public int getPort() 113 { 114 return port; 115 } 116 117 public void setPort( int port ) 118 { 119 this.port = port; 120 } 121 122 public String getUsername() 123 { 124 return username; 125 } 126 127 public void setUsername( String username ) 128 { 129 this.username = username; 130 } 131 132 public String getPassword() 133 { 134 return password; 135 } 136 137 public void setPassword( String password ) 138 { 139 this.password = password; 140 } 141 142 public boolean isUseNtlm() 143 { 144 return useNtlm; 145 } 146 147 public void setUseNtlm( boolean useNtlm ) 148 { 149 this.useNtlm = useNtlm; 150 } 151 152 @Override 153 public boolean equals( Object o ) 154 { 155 if ( this == o ) 156 { 157 return true; 158 } 159 if ( o == null || getClass() != o.getClass() ) 160 { 161 return false; 162 } 163 164 NetworkProxy that = (NetworkProxy) o; 165 166 if ( id != null ? !id.equals( that.id ) : that.id != null ) 167 { 168 return false; 169 } 170 171 return true; 172 } 173 174 @Override 175 public int hashCode() 176 { 177 int result = 17; 178 result = 37 * result + ( id != null ? id.hashCode() : 0 ); 179 return result; 180 } 181 182 @Override 183 public String toString() 184 { 185 final StringBuilder sb = new StringBuilder(); 186 sb.append( "NetworkProxy" ); 187 sb.append( "{id='" ).append( id ).append( '\'' ); 188 sb.append( ", protocol='" ).append( protocol ).append( '\'' ); 189 sb.append( ", host='" ).append( host ).append( '\'' ); 190 sb.append( ", port=" ).append( port ); 191 sb.append( ", username='" ).append( username ).append( '\'' ); 192 //sb.append( ", password='" ).append( password ).append( '\'' ); 193 sb.append( ", useNtlm=" ).append( useNtlm ); 194 sb.append( '}' ); 195 return sb.toString(); 196 } 197}