1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.vfs.impl;
18
19 import org.apache.commons.vfs.FileObject;
20 import org.apache.commons.vfs.FileSystemException;
21 import org.apache.commons.vfs.FileSelector;
22 import org.apache.commons.vfs.FileContent;
23 import org.apache.commons.vfs.FileType;
24 import org.apache.commons.vfs.NameScope;
25
26 import java.util.List;
27
28 /***
29 * This decorator synchronize all access to the FileObject
30 *
31 * @author <a href="mailto:imario@apache.org">Mario Ivankovits</a>
32 * @version $Revision: 485638 $ $Date: 2006-12-11 13:20:55 +0100 (Mo, 11 Dez 2006) $
33 */
34 public class SynchronizedFileObject extends DecoratedFileObject
35 {
36 public SynchronizedFileObject(FileObject fileObject)
37 {
38 super(fileObject);
39 }
40
41 public void close() throws FileSystemException
42 {
43 synchronized(this)
44 {
45 super.close();
46 }
47 }
48
49 public void copyFrom(FileObject srcFile, FileSelector selector) throws FileSystemException
50 {
51 synchronized(this)
52 {
53 super.copyFrom(srcFile, selector);
54 }
55 }
56
57 public void createFile() throws FileSystemException
58 {
59 synchronized(this)
60 {
61 super.createFile();
62 }
63 }
64
65 public void createFolder() throws FileSystemException
66 {
67 synchronized(this)
68 {
69 super.createFolder();
70 }
71 }
72
73 public boolean delete() throws FileSystemException
74 {
75 synchronized(this)
76 {
77 return super.delete();
78 }
79 }
80
81 public int delete(FileSelector selector) throws FileSystemException
82 {
83 synchronized(this)
84 {
85 return super.delete(selector);
86 }
87 }
88
89 public boolean exists() throws FileSystemException
90 {
91 synchronized(this)
92 {
93 return super.exists();
94 }
95 }
96
97 public void findFiles(FileSelector selector, boolean depthwise, List selected) throws FileSystemException
98 {
99 synchronized(this)
100 {
101 super.findFiles(selector, depthwise, selected);
102 }
103 }
104
105 public FileObject[] findFiles(FileSelector selector) throws FileSystemException
106 {
107 synchronized(this)
108 {
109 return super.findFiles(selector);
110 }
111 }
112
113 public FileObject getChild(String name) throws FileSystemException
114 {
115 synchronized(this)
116 {
117 return super.getChild(name);
118 }
119 }
120
121 public FileObject[] getChildren() throws FileSystemException
122 {
123 synchronized(this)
124 {
125 return super.getChildren();
126 }
127 }
128
129 public FileContent getContent() throws FileSystemException
130 {
131 synchronized(this)
132 {
133 return super.getContent();
134 }
135 }
136
137 public FileType getType() throws FileSystemException
138 {
139 synchronized(this)
140 {
141 return super.getType();
142 }
143 }
144
145 public boolean isHidden() throws FileSystemException
146 {
147 synchronized(this)
148 {
149 return super.isHidden();
150 }
151 }
152
153 public boolean isReadable() throws FileSystemException
154 {
155 synchronized(this)
156 {
157 return super.isReadable();
158 }
159 }
160
161 public boolean isWriteable() throws FileSystemException
162 {
163 synchronized(this)
164 {
165 return super.isWriteable();
166 }
167 }
168
169 public void moveTo(FileObject destFile) throws FileSystemException
170 {
171 synchronized(this)
172 {
173 super.moveTo(destFile);
174 }
175 }
176
177 public FileObject resolveFile(String name, NameScope scope) throws FileSystemException
178 {
179 synchronized(this)
180 {
181 return super.resolveFile(name, scope);
182 }
183 }
184
185 public FileObject resolveFile(String path) throws FileSystemException
186 {
187 synchronized(this)
188 {
189 return super.resolveFile(path);
190 }
191 }
192 }