KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > net > proxy > IProxyData


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.net.proxy;
12
13 /**
14  * An {@link IProxyData} contains the information that is required to connect
15  * to a particular proxy server.
16  * <p>
17  * This interface is not intended to be implemented by clients.
18  *
19  * @since 1.0
20  */

21 public interface IProxyData {
22     
23     /**
24      * Type constant (value "HTTP") which identifies an HTTP proxy.
25      * @see #getType()
26      */

27     public static final String JavaDoc HTTP_PROXY_TYPE = "HTTP"; //$NON-NLS-1$
28

29     /**
30      * Type constant (value "HTTPS") which identifies an HTTPS proxy.
31      * @see #getType()
32      */

33     public static final String JavaDoc HTTPS_PROXY_TYPE = "HTTPS"; //$NON-NLS-1$
34

35     /**
36      * Type constant (value "SOCKS") which identifies an SOCKS proxy.
37      * @see #getType()
38      */

39     public static final String JavaDoc SOCKS_PROXY_TYPE = "SOCKS"; //$NON-NLS-1$
40

41     /**
42      * Return the type of this proxy. Additional proxy types may be
43      * added in the future so clients should accommodate this.
44      * @return the type of this proxy
45      * @see #HTTP_PROXY_TYPE
46      * @see #HTTPS_PROXY_TYPE
47      * @see #SOCKS_PROXY_TYPE
48      */

49     String JavaDoc getType();
50     
51     /**
52      * Return the host name for the proxy server or <code>null</code>
53      * if a proxy server of this type is not available.
54      * @return the host name for the proxy server or <code>null</code>
55      */

56     String JavaDoc getHost();
57     
58     /**
59      * Set the host name for the proxy server of this type.
60      * If no proxy server of this type is available, the host name should
61      * be set to <code>null</code>.
62      * <p>
63      * Setting this value will not affect the data returned from {@link IProxyService#getProxyData()}.
64      * Clients can change the global settings by changing the proxy data instances and then
65      * by calling {@link IProxyService#setProxyData(IProxyData[])} with the adjusted data.
66      * @param host the host name for the proxy server or <code>null</code>
67      */

68     void setHost(String JavaDoc host);
69     
70     /**
71      * Return the port that should be used when connecting to the host or -1
72      * if the default port for the proxy protocol should be used.
73      * @return the port that should be used when connecting to the host
74      */

75     int getPort();
76     
77     /**
78      * Set the port that should be used when connecting to the host. Setting the port
79      * to a value of -1 will indicate that the default port number for
80      * the proxy type should be used.
81      * <p>
82      * Setting this value will not affect the data returned from {@link IProxyService#getProxyData()}.
83      * Clients can change the global settings by changing the proxy data instances and then
84      * by calling {@link IProxyService#setProxyData(IProxyData[])} with the adjusted data.
85      * @param port the port that should be used when connecting to the host
86      * or -1 if the default port is to be used
87      */

88     void setPort(int port);
89     
90     /**
91      * Return the id of the user that should be used when authenticating
92      * for the proxy. A <code>null</code> is returned if there is no
93      * authentication information.
94      * @return the id of the user that should be used when authenticating
95      * for the proxy or <code>null</code>
96      */

97     String JavaDoc getUserId();
98     
99     /**
100      * Set the id of the user that should be used when authenticating
101      * for the proxy. A <code>null</code> should be used if there is no
102      * authentication information.
103      * <p>
104      * Setting this value will not affect the data returned from {@link IProxyService#getProxyData()}.
105      * Clients can change the global settings by changing the proxy data instances and then
106      * by calling {@link IProxyService#setProxyData(IProxyData[])} with the adjusted data.
107      * @param userid the id of the user that should be used when authenticating
108      * for the proxy or <code>null</code>
109      */

110     void setUserid(String JavaDoc userid);
111     
112     /**
113      * Return the password that should be used when authenticating
114      * for the proxy. A <code>null</code> is returned if there is no
115      * password or the password is not known.
116      * @return the password that should be used when authenticating
117      * for the proxy or <code>null</code>
118      */

119     String JavaDoc getPassword();
120     
121     /**
122      * Set the password that should be used when authenticating
123      * for the proxy. A <code>null</code> should be passed if there is no
124      * password or the password is not known.
125      * <p>
126      * Setting this value will not affect the data returned from {@link IProxyService#getProxyData()}.
127      * Clients can change the global settings by changing the proxy data instances and then
128      * by calling {@link IProxyService#setProxyData(IProxyData[])} with the adjusted data.
129      * @param password the password that should be used when authenticating
130      * for the proxy or <code>null</code>
131      */

132     void setPassword(String JavaDoc password);
133     
134     /**
135      * Returns whether the proxy requires authentication. If the proxy
136      * requires authentication but the user name and password fields of
137      * this proxy data are null, the client can expect the connection
138      * to fail unless they somehow obtain the authentication information.
139      * @return whether the proxy requires authentication
140      */

141     boolean isRequiresAuthentication();
142
143     /**
144      * Set the values of this data to represent a disabling of its type.
145      * Note that the proxy type will not be disabled unless the client
146      * calls {@link IProxyService#setProxyData(IProxyData[])} with the
147      * disabled data as a parameter. A proxy data can be enabled by setting
148      * the host.
149      */

150     void disable();
151
152 }
153
Popular Tags