KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > vfs > provider > compressed > CompressedFileFileProvider


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.compressed;
17
18 import org.apache.commons.vfs.FileName;
19 import org.apache.commons.vfs.FileObject;
20 import org.apache.commons.vfs.FileSystem;
21 import org.apache.commons.vfs.FileSystemException;
22 import org.apache.commons.vfs.FileSystemOptions;
23 import org.apache.commons.vfs.FileType;
24 import org.apache.commons.vfs.provider.AbstractLayeredFileProvider;
25 import org.apache.commons.vfs.provider.FileProvider;
26 import org.apache.commons.vfs.provider.LayeredFileName;
27
28 import java.util.Collection JavaDoc;
29
30 /**
31  * A file system provider for compressed files. Provides read-only file
32  * systems.
33  *
34  * @author <a HREF="mailto:imario@apache.org">Mario Ivankovits</a>
35  */

36 public abstract class CompressedFileFileProvider
37     extends AbstractLayeredFileProvider
38     implements FileProvider
39 {
40     public CompressedFileFileProvider()
41     {
42         super();
43     }
44
45     /**
46      * Parses an absolute URI.
47      *
48      * @param uri The URI to parse.
49      */

50     /*
51     public FileName parseUri(final String uri)
52         throws FileSystemException
53     {
54         return ZipFileName.parseUri(uri);
55     }
56     */

57
58     /**
59      * Creates a layered file system. This method is called if the file system
60      * is not cached.
61      *
62      * @param scheme The URI scheme.
63      * @param file The file to create the file system on top of.
64      * @return The file system.
65      */

66     protected FileSystem doCreateFileSystem(final String JavaDoc scheme,
67                                             final FileObject file,
68                                             final FileSystemOptions fileSystemOptions)
69         throws FileSystemException
70     {
71         final FileName name =
72             new LayeredFileName(scheme, file.getName(), FileName.ROOT_PATH, FileType.FOLDER);
73         return createFileSystem(name, file, fileSystemOptions);
74     }
75
76     protected abstract FileSystem createFileSystem(final FileName name, final FileObject file, final FileSystemOptions fileSystemOptions) throws FileSystemException;
77
78     public abstract Collection JavaDoc getCapabilities();
79 }
80
Popular Tags