Source Code Cross Referenced for FileSystemManager.java in  » Library » Apache-commons-vfs-20070724-src » org » apache » commons » vfs » 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 
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;
018:
019:        import org.apache.commons.logging.Log;
020:
021:        import java.io.File;
022:        import java.net.URLStreamHandlerFactory;
023:        import java.util.Collection;
024:        import java.lang.reflect.Constructor;
025:
026:        import org.apache.commons.vfs.operations.FileOperationProvider;
027:
028:        /**
029:         * A FileSystemManager manages a set of file systems.  This interface is
030:         * used to locate a {@link FileObject} by name from one of those file systems.
031:         * <p/>
032:         * <p>To locate a {@link FileObject}, use one of the <code>resolveFile()</code>
033:         * methods.</p>
034:         * <p/>
035:         * <h4><a name="naming">File Naming</a></h4>
036:         * <p/>
037:         * <p>A file system manager can recognise several types of file names:
038:         * <p/>
039:         * <ul>
040:         * <p/>
041:         * <li><p>Absolute URI.  These must start with a scheme, such as
042:         * <code>file:</code> or <code>ftp:</code>, followed by a scheme dependent
043:         * file name.  Some examples:</p>
044:         * <pre>
045:         * file:/c:/somefile
046:         * ftp://somewhere.org/somefile
047:         * </pre>
048:         * <p/>
049:         * <li><p>Absolute local file name.  For example,
050:         * <code>/home/someuser/a-file</code> or <code>c:\dir\somefile.html</code>.
051:         * Elements in the name can be separated using any of the following
052:         * characters: <code>/</code>, <code>\</code>, or the native file separator
053:         * character. For example, the following file names are the same:</p>
054:         * <pre>
055:         * c:\somedir\somefile.xml
056:         * c:/somedir/somefile.xml
057:         * </pre>
058:         * <p/>
059:         * <li><p>Relative path.  For example: <code>../somefile</code> or
060:         * <code>somedir/file.txt</code>.   The file system manager resolves relative
061:         * paths against its <i>base file</i>.  Elements in the relative path can be
062:         * separated using <code>/</code>, <code>\</code>, or file system specific
063:         * separator characters.  Relative paths may also contain <code>..</code> and
064:         * <code>.</code> elements.  See {@link FileObject#resolveFile} for more
065:         * details.</p>
066:         * <p/>
067:         * </ul>
068:         *
069:         * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
070:         * @version $Revision: 484648 $ $Date: 2006-12-08 08:18:36 -0800 (Fri, 08 Dec 2006) $
071:         */
072:        public interface FileSystemManager {
073:            /**
074:             * Returns the base file used to resolve relative paths.
075:             */
076:            public FileObject getBaseFile() throws FileSystemException;
077:
078:            /**
079:             * Locates a file by name.  Equivalent to calling
080:             * <code>resolveFile(uri, getBaseName())</code>.
081:             *
082:             * @param name The name of the file.
083:             * @return The file.  Never returns null.
084:             * @throws FileSystemException On error parsing the file name.
085:             */
086:            public FileObject resolveFile(String name)
087:                    throws FileSystemException;
088:
089:            /**
090:             * Locates a file by name.  Equivalent to calling
091:             * <code>resolveFile(uri, getBaseName())</code>.
092:             *
093:             * @param name              The name of the file.
094:             * @param fileSystemOptions The FileSystemOptions used for FileSystem creation
095:             * @return The file.  Never returns null.
096:             * @throws FileSystemException On error parsing the file name.
097:             */
098:            public FileObject resolveFile(String name,
099:                    FileSystemOptions fileSystemOptions)
100:                    throws FileSystemException;
101:
102:            /**
103:             * Locates a file by name.  The name is resolved as described
104:             * <a href="#naming">above</a>.  That is, the name can be either
105:             * an absolute URI, an absolute file name, or a relative path to
106:             * be resolved against <code>baseFile</code>.
107:             * <p/>
108:             * <p>Note that the file does not have to exist when this method is called.
109:             *
110:             * @param name     The name of the file.
111:             * @param baseFile The base file to use to resolve relative paths.
112:             *                 May be null.
113:             * @return The file.  Never returns null.
114:             * @throws FileSystemException On error parsing the file name.
115:             */
116:            public FileObject resolveFile(FileObject baseFile, String name)
117:                    throws FileSystemException;
118:
119:            /**
120:             * Locates a file by name.  See {@link #resolveFile(FileObject, String)}
121:             * for details.
122:             *
123:             * @param baseFile The base file to use to resolve relative paths.
124:             *                 May be null.
125:             * @param name     The name of the file.
126:             * @return The file.  Never returns null.
127:             * @throws FileSystemException On error parsing the file name.
128:             */
129:            public FileObject resolveFile(File baseFile, String name)
130:                    throws FileSystemException;
131:
132:            /**
133:             * Resolves a name, relative to this file name.  Equivalent to calling
134:             * <code>resolveName( path, NameScope.FILE_SYSTEM )</code>.
135:             *
136:             * @param root the base filename
137:             * @param name The name to resolve.
138:             * @return A {@link FileName} object representing the resolved file name.
139:             * @throws FileSystemException If the name is invalid.
140:             */
141:            public FileName resolveName(final FileName root, final String name)
142:                    throws FileSystemException;
143:
144:            /**
145:             * Resolves a name, relative to the "root" file name.  Refer to {@link NameScope}
146:             * for a description of how names are resolved.
147:             *
148:             * @param root the base filename
149:             * @param name  The name to resolve.
150:             * @param scope The {@link NameScope} to use when resolving the name.
151:             * @return A {@link FileName} object representing the resolved file name.
152:             * @throws FileSystemException If the name is invalid.
153:             */
154:            public FileName resolveName(final FileName root, String name,
155:                    NameScope scope) throws FileSystemException;
156:
157:            /**
158:             * Converts a local file into a {@link FileObject}.
159:             *
160:             * @param file The file to convert.
161:             * @return The {@link FileObject} that represents the local file.  Never
162:             *         returns null.
163:             * @throws FileSystemException On error converting the file.
164:             */
165:            public FileObject toFileObject(File file)
166:                    throws FileSystemException;
167:
168:            /**
169:             * Creates a layered file system.  A layered file system is a file system
170:             * that is created from the contents of a file, such as a zip or tar file.
171:             *
172:             * @param provider The name of the file system provider to use.  This name
173:             *                 is the same as the scheme used in URI to identify the provider.
174:             * @param file     The file to use to create the file system.
175:             * @return The root file of the new file system.
176:             * @throws FileSystemException On error creating the file system.
177:             */
178:            public FileObject createFileSystem(String provider, FileObject file)
179:                    throws FileSystemException;
180:
181:            /**
182:             * Closes the given filesystem.<br />
183:             * If you use VFS as singleton it is VERY dangerous to call this method.
184:             */
185:            public void closeFileSystem(FileSystem filesystem);
186:
187:            /**
188:             * Creates a layered file system.  A layered file system is a file system
189:             * that is created from the contents of a file, such as a zip or tar file.
190:             *
191:             * @param file The file to use to create the file system.
192:             * @return The root file of the new file system.
193:             * @throws FileSystemException On error creating the file system.
194:             */
195:            public FileObject createFileSystem(FileObject file)
196:                    throws FileSystemException;
197:
198:            /**
199:             * Creates an empty virtual file system.  Can be populated by adding
200:             * junctions to it.
201:             *
202:             * @param rootUri The root URI to use for the new file system.  Can be null.
203:             * @return The root file of the new file system.
204:             */
205:            public FileObject createVirtualFileSystem(String rootUri)
206:                    throws FileSystemException;
207:
208:            /**
209:             * Creates a virtual file system.  The file system will contain a junction
210:             * at the fs root to the supplied root file.
211:             *
212:             * @param rootFile The root file to backs the file system.
213:             * @return The root of the new file system.
214:             */
215:            public FileObject createVirtualFileSystem(FileObject rootFile)
216:                    throws FileSystemException;
217:
218:            /**
219:             * Returns a streamhandler factory to enable URL lookup using this
220:             * FileSystemManager.
221:             */
222:            public URLStreamHandlerFactory getURLStreamHandlerFactory();
223:
224:            /**
225:             * Determines if a layered file system can be created for a given file.
226:             *
227:             * @param file The file to check for.
228:             */
229:            public boolean canCreateFileSystem(FileObject file)
230:                    throws FileSystemException;
231:
232:            /**
233:             * Get the cache used to cache fileobjects.
234:             */
235:            public FilesCache getFilesCache();
236:
237:            /**
238:             * Get the cache strategy used
239:             */
240:            public CacheStrategy getCacheStrategy();
241:
242:            /**
243:             * Get the file object decorator used
244:             */
245:            public Class getFileObjectDecorator();
246:
247:            /**
248:             * The constructor associated to the fileObjectDecorator.
249:             * We cache it here for performance reasons.
250:             */
251:            public Constructor getFileObjectDecoratorConst();
252:
253:            /**
254:             * The class to use to determine the content-type (mime-type)
255:             */
256:            public FileContentInfoFactory getFileContentInfoFactory();
257:
258:            /**
259:             * Get the schemes currently available.
260:             */
261:            public String[] getSchemes();
262:
263:            /**
264:             * Get the capabilities for a given scheme.
265:             *
266:             * @throws FileSystemException if the given scheme is not konwn
267:             */
268:            public Collection getProviderCapabilities(final String scheme)
269:                    throws FileSystemException;
270:
271:            /**
272:             * Sets the logger to use.
273:             */
274:            public void setLogger(final Log log);
275:
276:            /**
277:             * Get the configuration builder for the given scheme
278:             *
279:             * @throws FileSystemException if the given scheme is not konwn
280:             */
281:            public FileSystemConfigBuilder getFileSystemConfigBuilder(
282:                    final String scheme) throws FileSystemException;
283:
284:            /**
285:             * Resolve the uri to a filename
286:             *
287:             * @throws FileSystemException if this is not possible
288:             */
289:            public FileName resolveURI(String uri) throws FileSystemException;
290:
291:            // -- OPERATIONS --
292:            /**
293:             * Adds the specified FileOperationProvider for the specified scheme.
294:             * Several FileOperationProvider's might be registered for the same scheme.
295:             * For example, for "file" scheme we can register SvnWsOperationProvider and
296:             * CvsOperationProvider.
297:             *
298:             * @param scheme
299:             * @param operationProvider
300:             * @throws FileSystemException
301:             */
302:            public void addOperationProvider(final String scheme,
303:                    final FileOperationProvider operationProvider)
304:                    throws FileSystemException;
305:
306:            /**
307:             * @see FileSystemManager#addOperationProvider(String, org.apache.commons.vfs.operations.FileOperationProvider)
308:             *
309:             * @param schemes
310:             * @param operationProvider
311:             * @throws FileSystemException
312:             */
313:            public void addOperationProvider(final String[] schemes,
314:                    final FileOperationProvider operationProvider)
315:                    throws FileSystemException;
316:
317:            /**
318:             * @param scheme the scheme for wich we want to get the list af registered providers.
319:             *
320:             * @return the registered FileOperationProviders for the specified scheme.
321:             * If there were no providers registered for the scheme, it returns null.
322:             *
323:             * @throws FileSystemException
324:             */
325:            public FileOperationProvider[] getOperationProviders(
326:                    final String scheme) throws FileSystemException;
327:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.