KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > vfs > provider > webdav > WebdavFileSystemConfigBuilder


1 /*
2  * Copyright 2002-2005 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.commons.vfs.provider.webdav;
17
18 import org.apache.commons.vfs.FileSystemConfigBuilder;
19 import org.apache.commons.vfs.FileSystemOptions;
20
21 /**
22  * Configuration options for WebDav
23  *
24  * @author <a HREF="mailto:imario@apache.org">Mario Ivankovits</a>
25  */

26 public class WebdavFileSystemConfigBuilder extends FileSystemConfigBuilder
27 {
28     private final static WebdavFileSystemConfigBuilder builder = new WebdavFileSystemConfigBuilder();
29
30     public static WebdavFileSystemConfigBuilder getInstance()
31     {
32         return builder;
33     }
34
35     private WebdavFileSystemConfigBuilder()
36     {
37     }
38
39     /**
40      * Set the charset used for url encoding<br>
41      *
42      * @param chaset the chaset
43      */

44     public void setUrlCharset(FileSystemOptions opts, String JavaDoc chaset)
45     {
46         setParam(opts, "urlCharset", chaset);
47     }
48
49     /**
50      * Set the charset used for url encoding<br>
51      *
52      * @return the chaset
53      */

54     public String JavaDoc getUrlCharset(FileSystemOptions opts)
55     {
56         return (String JavaDoc) getParam(opts, "urlCharset");
57     }
58
59     /**
60      * Set the proxy to use for webdav connection.<br>
61      * You have to set the ProxyPort too if you would like to have the proxy relly used.
62      *
63      * @param proxyHost the host
64      * @see #setProxyPort
65      */

66     public void setProxyHost(FileSystemOptions opts, String JavaDoc proxyHost)
67     {
68         setParam(opts, "proxyHost", proxyHost);
69     }
70
71     /**
72      * Set the proxy-port to use for webdav connection
73      * You have to set the ProxyHost too if you would like to have the proxy relly used.
74      *
75      * @param proxyPort the port
76      * @see #setProxyHost
77      */

78     public void setProxyPort(FileSystemOptions opts, int proxyPort)
79     {
80         setParam(opts, "proxyPort", new Integer JavaDoc(proxyPort));
81     }
82
83     /**
84      * Get the proxy to use for webdav connection
85      * You have to set the ProxyPort too if you would like to have the proxy relly used.
86      *
87      * @return proxyHost
88      * @see #setProxyPort
89      */

90     public String JavaDoc getProxyHost(FileSystemOptions opts)
91     {
92         return (String JavaDoc) getParam(opts, "proxyHost");
93     }
94
95     /**
96      * Get the proxy-port to use for webdav the connection
97      * You have to set the ProxyHost too if you would like to have the proxy relly used.
98      *
99      * @return proxyPort: the port number or 0 if it is not set
100      * @see #setProxyHost
101      */

102     public int getProxyPort(FileSystemOptions opts)
103     {
104         if (!hasParam(opts, "proxyPort"))
105         {
106             return 0;
107         }
108
109         return ((Number JavaDoc) getParam(opts, "proxyPort")).intValue();
110     }
111
112     protected Class JavaDoc getConfigClass()
113     {
114         return WebDavFileSystem.class;
115     }
116 }
117
Popular Tags