KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > internal > net > ProxyData


1 /*******************************************************************************
2  * Copyright (c) 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.core.internal.net;
12
13 import org.eclipse.core.net.proxy.IProxyData;
14
15 public class ProxyData implements IProxyData {
16
17     private String JavaDoc type;
18     private String JavaDoc host;
19     private int port;
20     private String JavaDoc user;
21     private String JavaDoc password;
22     private boolean requiresAuthentication;
23
24     public ProxyData(String JavaDoc type, String JavaDoc host, int port, boolean requiresAuthentication) {
25         this.type = type;
26         this.host = host;
27         this.port = port;
28         this.requiresAuthentication = requiresAuthentication;
29     }
30
31     public ProxyData(String JavaDoc type) {
32         this.type = type;
33     }
34
35     public String JavaDoc getHost() {
36         return host;
37     }
38
39     public String JavaDoc getPassword() {
40         return password;
41     }
42
43     public int getPort() {
44         return port;
45     }
46
47     public String JavaDoc getType() {
48         return type;
49     }
50
51     public String JavaDoc getUserId() {
52         return user;
53     }
54
55     public void setHost(String JavaDoc host) {
56         if (host.length() == 0)
57             host = null;
58         this.host = host;
59     }
60
61     public void setPassword(String JavaDoc password) {
62         this.password = password;
63     }
64
65     public void setPort(int port) {
66         this.port = port;
67     }
68
69     public void setUserid(String JavaDoc userid) {
70         this.user = userid;
71         requiresAuthentication = userid != null;
72     }
73
74     public boolean isRequiresAuthentication() {
75         return requiresAuthentication;
76     }
77
78     public void disable() {
79         host = null;
80         port = -1;
81         user = null;
82         password = null;
83         requiresAuthentication = false;
84     }
85
86 }
87
Popular Tags