Source Code Cross Referenced for FtpFileSystemConfigBuilder.java in  » Library » Apache-commons-vfs-20070724-src » org » apache » commons » vfs » provider » ftp » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Library » Apache commons vfs 20070724 src » org.apache.commons.vfs.provider.ftp 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         *
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:        package org.apache.commons.vfs.provider.ftp;
018:
019:        import org.apache.commons.net.ftp.parser.FTPFileEntryParserFactory;
020:        import org.apache.commons.vfs.FileSystemConfigBuilder;
021:        import org.apache.commons.vfs.FileSystemOptions;
022:
023:        /**
024:         * The config builder for various ftp configuration options
025:         *
026:         * @author <a href="mailto:imario@apache.org">Mario Ivankovits</a>
027:         * @version $Revision: 480428 $ $Date: 2006-11-28 22:15:24 -0800 (Tue, 28 Nov 2006) $
028:         */
029:        public class FtpFileSystemConfigBuilder extends FileSystemConfigBuilder {
030:            private final static FtpFileSystemConfigBuilder builder = new FtpFileSystemConfigBuilder();
031:
032:            private final static String FACTORY_KEY = FTPFileEntryParserFactory.class
033:                    .getName()
034:                    + ".KEY";
035:            private final static String PASSIVE_MODE = FtpFileSystemConfigBuilder.class
036:                    .getName()
037:                    + ".PASSIVE";
038:            private final static String USER_DIR_IS_ROOT = FtpFileSystemConfigBuilder.class
039:                    .getName()
040:                    + ".USER_DIR_IS_ROOT";
041:            private final static String DATA_TIMEOUT = FtpFileSystemConfigBuilder.class
042:                    .getName()
043:                    + ".DATA_TIMEOUT";
044:
045:            private final static String SERVER_LANGUAGE_CODE = FtpFileSystemConfigBuilder.class
046:                    .getName()
047:                    + ".SERVER_LANGUAGE_CODE";
048:            private final static String DEFAULT_DATE_FORMAT = FtpFileSystemConfigBuilder.class
049:                    .getName()
050:                    + ".DEFAULT_DATE_FORMAT";
051:            private final static String RECENT_DATE_FORMAT = FtpFileSystemConfigBuilder.class
052:                    .getName()
053:                    + ".RECENT_DATE_FORMAT";
054:            private final static String SERVER_TIME_ZONE_ID = FtpFileSystemConfigBuilder.class
055:                    .getName()
056:                    + ".SERVER_TIME_ZONE_ID";
057:            private final static String SHORT_MONTH_NAMES = FtpFileSystemConfigBuilder.class
058:                    .getName()
059:                    + ".SHORT_MONTH_NAMES";
060:
061:            public static FtpFileSystemConfigBuilder getInstance() {
062:                return builder;
063:            }
064:
065:            private FtpFileSystemConfigBuilder() {
066:            }
067:
068:            /**
069:             * FTPFileEntryParserFactory which will be used for ftp-entry parsing
070:             *
071:             * @param opts
072:             * @param factory instance of your factory
073:             */
074:            public void setEntryParserFactory(FileSystemOptions opts,
075:                    FTPFileEntryParserFactory factory) {
076:                setParam(opts, FTPFileEntryParserFactory.class.getName(),
077:                        factory);
078:            }
079:
080:            /**
081:             * @param opts
082:             * @see #setEntryParserFactory
083:             */
084:            public FTPFileEntryParserFactory getEntryParserFactory(
085:                    FileSystemOptions opts) {
086:                return (FTPFileEntryParserFactory) getParam(opts,
087:                        FTPFileEntryParserFactory.class.getName());
088:            }
089:
090:            /**
091:             * set the FQCN of your FileEntryParser used to parse the directory listing from your server.<br />
092:             * <br />
093:             * <i>If you do not use the default commons-net FTPFileEntryParserFactory e.g. by using {@link #setEntryParserFactory}
094:             * this is the "key" parameter passed as argument into your custom factory</i>
095:             *
096:             * @param opts
097:             * @param key
098:             */
099:            public void setEntryParser(FileSystemOptions opts, String key) {
100:                setParam(opts, FACTORY_KEY, key);
101:            }
102:
103:            /**
104:             * @param opts
105:             * @see #setEntryParser
106:             */
107:            public String getEntryParser(FileSystemOptions opts) {
108:                return (String) getParam(opts, FACTORY_KEY);
109:            }
110:
111:            protected Class getConfigClass() {
112:                return FtpFileSystem.class;
113:            }
114:
115:            /**
116:             * enter into passive mode
117:             *
118:             * @param opts
119:             * @param passiveMode
120:             */
121:            public void setPassiveMode(FileSystemOptions opts,
122:                    boolean passiveMode) {
123:                setParam(opts, PASSIVE_MODE, passiveMode ? Boolean.TRUE
124:                        : Boolean.FALSE);
125:            }
126:
127:            /**
128:             * @param opts
129:             * @see #setPassiveMode
130:             */
131:            public Boolean getPassiveMode(FileSystemOptions opts) {
132:                return (Boolean) getParam(opts, PASSIVE_MODE);
133:            }
134:
135:            /**
136:             * use user directory as root (do not change to fs root)
137:             *
138:             * @param opts
139:             * @param userDirIsRoot
140:             */
141:            public void setUserDirIsRoot(FileSystemOptions opts,
142:                    boolean userDirIsRoot) {
143:                setParam(opts, USER_DIR_IS_ROOT, userDirIsRoot ? Boolean.TRUE
144:                        : Boolean.FALSE);
145:            }
146:
147:            /**
148:             * @param opts
149:             * @see #setUserDirIsRoot
150:             */
151:            public Boolean getUserDirIsRoot(FileSystemOptions opts) {
152:                return (Boolean) getParam(opts, USER_DIR_IS_ROOT);
153:            }
154:
155:            /**
156:             * @param opts
157:             * @see #setDataTimeout
158:             */
159:            public Integer getDataTimeout(FileSystemOptions opts) {
160:                return (Integer) getParam(opts, DATA_TIMEOUT);
161:            }
162:
163:            /**
164:             * set the data timeout for the ftp client.<br />
165:             * If you set the dataTimeout to <code>null</code> no dataTimeout will be set on the
166:             * ftp client.
167:             *
168:             * @param opts
169:             * @param dataTimeout
170:             */
171:            public void setDataTimeout(FileSystemOptions opts,
172:                    Integer dataTimeout) {
173:                setParam(opts, DATA_TIMEOUT, dataTimeout);
174:            }
175:
176:            /**
177:             * get the language code used by the server. see {@link org.apache.commons.net.ftp.FTPClientConfig}
178:             * for details and examples.
179:             */
180:            public String getServerLanguageCode(FileSystemOptions opts) {
181:                return (String) getParam(opts, SERVER_LANGUAGE_CODE);
182:            }
183:
184:            /**
185:             * set the language code used by the server. see {@link org.apache.commons.net.ftp.FTPClientConfig}
186:             * for details and examples.
187:             */
188:            public void setServerLanguageCode(FileSystemOptions opts,
189:                    String serverLanguageCode) {
190:                setParam(opts, SERVER_LANGUAGE_CODE, serverLanguageCode);
191:            }
192:
193:            /**
194:             * get the language code used by the server. see {@link org.apache.commons.net.ftp.FTPClientConfig}
195:             * for details and examples.
196:             */
197:            public String getDefaultDateFormat(FileSystemOptions opts) {
198:                return (String) getParam(opts, DEFAULT_DATE_FORMAT);
199:            }
200:
201:            /**
202:             * set the language code used by the server. see {@link org.apache.commons.net.ftp.FTPClientConfig}
203:             * for details and examples.
204:             */
205:            public void setDefaultDateFormat(FileSystemOptions opts,
206:                    String defaultDateFormat) {
207:                setParam(opts, DEFAULT_DATE_FORMAT, defaultDateFormat);
208:            }
209:
210:            /**
211:             * see {@link org.apache.commons.net.ftp.FTPClientConfig} for details and examples.
212:             */
213:            public String getRecentDateFormat(FileSystemOptions opts) {
214:                return (String) getParam(opts, RECENT_DATE_FORMAT);
215:            }
216:
217:            /**
218:             * see {@link org.apache.commons.net.ftp.FTPClientConfig} for details and examples.
219:             */
220:            public void setRecentDateFormat(FileSystemOptions opts,
221:                    String recentDateFormat) {
222:                setParam(opts, RECENT_DATE_FORMAT, recentDateFormat);
223:            }
224:
225:            /**
226:             * see {@link org.apache.commons.net.ftp.FTPClientConfig} for details and examples.
227:             */
228:            public String getServerTimeZoneId(FileSystemOptions opts) {
229:                return (String) getParam(opts, SERVER_TIME_ZONE_ID);
230:            }
231:
232:            /**
233:             * see {@link org.apache.commons.net.ftp.FTPClientConfig} for details and examples.
234:             */
235:            public void setServerTimeZoneId(FileSystemOptions opts,
236:                    String serverTimeZoneId) {
237:                setParam(opts, SERVER_TIME_ZONE_ID, serverTimeZoneId);
238:            }
239:
240:            /**
241:             * see {@link org.apache.commons.net.ftp.FTPClientConfig} for details and examples.
242:             */
243:            public String[] getShortMonthNames(FileSystemOptions opts) {
244:                return (String[]) getParam(opts, SHORT_MONTH_NAMES);
245:            }
246:
247:            /**
248:             * see {@link org.apache.commons.net.ftp.FTPClientConfig} for details and examples.
249:             */
250:            public void setShortMonthNames(FileSystemOptions opts,
251:                    String[] shortMonthNames) {
252:                String[] clone = null;
253:                if (shortMonthNames != null) {
254:                    clone = new String[shortMonthNames.length];
255:                    System.arraycopy(shortMonthNames, 0, clone, 0,
256:                            shortMonthNames.length);
257:                }
258:
259:                setParam(opts, SHORT_MONTH_NAMES, clone);
260:            }
261:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.