This project has retired. For details please refer to its Attic page.
NetworkProxy xref
View Javadoc
1   package org.apache.archiva.admin.model.beans;
2   /*
3    * Licensed to the Apache Software Foundation (ASF) under one
4    * or more contributor license agreements.  See the NOTICE file
5    * distributed with this work for additional information
6    * regarding copyright ownership.  The ASF licenses this file
7    * to you under the Apache License, Version 2.0 (the
8    * "License"); you may not use this file except in compliance
9    * with the License.  You may obtain a copy of the License at
10   *
11   *   http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing,
14   * software distributed under the License is distributed on an
15   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16   * KIND, either express or implied.  See the License for the
17   * specific language governing permissions and limitations
18   * under the License.
19   */
20  
21  import javax.xml.bind.annotation.XmlRootElement;
22  import java.io.Serializable;
23  
24  /**
25   * @author Olivier Lamy
26   * @since 1.4-M1
27   */
28  @XmlRootElement( name = "networkProxy" )
29  public class NetworkProxy
30      implements Serializable
31  {
32      private String id;
33  
34      /**
35       * The network protocol to use with this proxy: "http", "socks-4"
36       * .
37       */
38      private String protocol = "http";
39  
40      /**
41       * The proxy host.
42       */
43      private String host;
44  
45      /**
46       * The proxy port.
47       */
48      private int port = 8080;
49  
50      /**
51       * The proxy user.
52       */
53      private String username;
54  
55      /**
56       * The proxy password.
57       */
58      private String password;
59  
60      /**
61       * @since 1.4-M3
62       *
63       * use NTLM proxy
64       */
65      private boolean useNtlm;
66  
67      public NetworkProxy()
68      {
69          // no op
70      }
71  
72      public NetworkProxy( String id, String protocol, String host, int port, String username, String password )
73      {
74          this.id = id;
75          this.protocol = protocol;
76          this.host = host;
77          this.port = port;
78          this.username = username;
79          this.password = password;
80      }
81  
82      public String getId()
83      {
84          return id;
85      }
86  
87      public void setId( String id )
88      {
89          this.id = id;
90      }
91  
92      public String getProtocol()
93      {
94          return protocol;
95      }
96  
97      public void setProtocol( String protocol )
98      {
99          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 }