KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > vfs > provider > smb > SmbFileProvider


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.smb;
17
18 import org.apache.commons.vfs.Capability;
19 import org.apache.commons.vfs.FileName;
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.provider.AbstractOriginatingFileProvider;
24 import org.apache.commons.vfs.provider.FileProvider;
25
26 import java.util.Arrays JavaDoc;
27 import java.util.Collection JavaDoc;
28 import java.util.Collections JavaDoc;
29
30 /**
31  * A provider for SMB (Samba, Windows share) file systems.
32  *
33  * @author <a HREF="mailto:adammurdoch@apache.org">Adam Murdoch</a>
34  */

35 public class SmbFileProvider
36     extends AbstractOriginatingFileProvider
37     implements FileProvider
38 {
39     protected final static Collection JavaDoc capabilities = Collections.unmodifiableCollection(Arrays.asList(new Capability[]
40     {
41         Capability.CREATE,
42         Capability.DELETE,
43         Capability.RENAME,
44         Capability.GET_TYPE,
45         Capability.GET_LAST_MODIFIED,
46         Capability.LIST_CHILDREN,
47         Capability.READ_CONTENT,
48         Capability.URI,
49         Capability.WRITE_CONTENT,
50         Capability.APPEND_CONTENT,
51         Capability.RANDOM_ACCESS_READ,
52         Capability.RANDOM_ACCESS_WRITE
53     }));
54
55     public SmbFileProvider()
56     {
57         super();
58         setFileNameParser(SmbFileNameParser.getInstance());
59     }
60
61     /**
62      * Creates the filesystem.
63      */

64     protected FileSystem doCreateFileSystem(final FileName name, final FileSystemOptions fileSystemOptions)
65         throws FileSystemException
66     {
67         return new SmbFileSystem(name, fileSystemOptions);
68     }
69
70     public Collection JavaDoc getCapabilities()
71     {
72         return capabilities;
73     }
74 }
75
Popular Tags