01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.commons.vfs.provider.ram;
18:
19: import java.util.Arrays;
20: import java.util.Collection;
21: import java.util.Collections;
22:
23: import org.apache.commons.vfs.Capability;
24: import org.apache.commons.vfs.FileName;
25: import org.apache.commons.vfs.FileSystem;
26: import org.apache.commons.vfs.FileSystemException;
27: import org.apache.commons.vfs.FileSystemOptions;
28: import org.apache.commons.vfs.provider.AbstractOriginatingFileProvider;
29: import org.apache.commons.vfs.provider.FileProvider;
30:
31: /**
32: * RAM File Provider
33: */
34: public class RamFileProvider extends AbstractOriginatingFileProvider
35: implements FileProvider {
36:
37: public final static Collection capabilities = Collections
38: .unmodifiableCollection(Arrays.asList(new Capability[] {
39: Capability.CREATE, Capability.DELETE,
40: Capability.RENAME, Capability.GET_TYPE,
41: Capability.GET_LAST_MODIFIED,
42: Capability.SET_LAST_MODIFIED_FILE,
43: Capability.SET_LAST_MODIFIED_FOLDER,
44: Capability.LIST_CHILDREN, Capability.READ_CONTENT,
45: Capability.URI, Capability.WRITE_CONTENT,
46: Capability.APPEND_CONTENT,
47: Capability.RANDOM_ACCESS_READ,
48: Capability.RANDOM_ACCESS_WRITE }));
49:
50: /**
51: * Constructor
52: */
53: public RamFileProvider() {
54: super ();
55: }
56:
57: /*
58: * (non-Javadoc)
59: *
60: * @see org.apache.commons.vfs.provider.AbstractOriginatingFileProvider#doCreateFileSystem(org.apache.commons.vfs.FileName,
61: * org.apache.commons.vfs.FileSystemOptions)
62: */
63: protected FileSystem doCreateFileSystem(FileName name,
64: FileSystemOptions fileSystemOptions)
65: throws FileSystemException {
66: return new RamFileSystem(name, fileSystemOptions);
67: }
68:
69: /*
70: * (non-Javadoc)
71: *
72: * @see org.apache.commons.vfs.provider.FileProvider#getCapabilities()
73: */
74: public Collection getCapabilities() {
75: return capabilities;
76: }
77: }
|