View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      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.vfs2.impl;
18  
19  import java.net.URL;
20  import java.util.Iterator;
21  import java.util.List;
22  
23  import org.apache.commons.vfs2.FileContent;
24  import org.apache.commons.vfs2.FileName;
25  import org.apache.commons.vfs2.FileObject;
26  import org.apache.commons.vfs2.FileSelector;
27  import org.apache.commons.vfs2.FileSystem;
28  import org.apache.commons.vfs2.FileSystemException;
29  import org.apache.commons.vfs2.FileType;
30  import org.apache.commons.vfs2.NameScope;
31  import org.apache.commons.vfs2.operations.FileOperations;
32  
33  /**
34   * Base class to build a fileObject decoration.
35   */
36  public class DecoratedFileObject implements FileObject
37  {
38      private final FileObject decoratedFileObject;
39  
40      public DecoratedFileObject(final FileObject decoratedFileObject)
41      {
42          super();
43          this.decoratedFileObject = decoratedFileObject;
44      }
45  
46      @Override
47      public boolean canRenameTo(final FileObject newfile)
48      {
49          return decoratedFileObject.canRenameTo(newfile);
50      }
51  
52      @Override
53      public void close() throws FileSystemException
54      {
55          decoratedFileObject.close();
56      }
57  
58      @Override
59      public int compareTo(final FileObject fo)
60      {
61          return decoratedFileObject.compareTo(fo);
62      }
63  
64      @Override
65      public void copyFrom(final FileObject srcFile, final FileSelector selector) throws FileSystemException
66      {
67          decoratedFileObject.copyFrom(srcFile, selector);
68      }
69  
70      @Override
71      public void createFile() throws FileSystemException
72      {
73          decoratedFileObject.createFile();
74      }
75  
76      @Override
77      public void createFolder() throws FileSystemException
78      {
79          decoratedFileObject.createFolder();
80      }
81  
82      @Override
83      public boolean delete() throws FileSystemException
84      {
85          return decoratedFileObject.delete();
86      }
87  
88      @Override
89      public int delete(final FileSelector selector) throws FileSystemException
90      {
91          return decoratedFileObject.delete(selector);
92      }
93  
94      @Override
95      public int deleteAll() throws FileSystemException
96      {
97          return decoratedFileObject.deleteAll();
98      }
99  
100     @Override
101     public boolean exists() throws FileSystemException
102     {
103         return decoratedFileObject.exists();
104     }
105 
106     @Override
107     public FileObject[] findFiles(final FileSelector selector) throws FileSystemException
108     {
109         return decoratedFileObject.findFiles(selector);
110     }
111 
112     @Override
113     public void findFiles(final FileSelector selector, final boolean depthwise, final List<FileObject> selected)
114         throws FileSystemException
115     {
116         decoratedFileObject.findFiles(selector, depthwise, selected);
117     }
118 
119     @Override
120     public FileObject getChild(final String name) throws FileSystemException
121     {
122         return decoratedFileObject.getChild(name);
123     }
124 
125     @Override
126     public FileObject[] getChildren() throws FileSystemException
127     {
128         return decoratedFileObject.getChildren();
129     }
130 
131     @Override
132     public FileContent getContent() throws FileSystemException
133     {
134         return decoratedFileObject.getContent();
135     }
136 
137     public FileObject getDecoratedFileObject()
138     {
139         return decoratedFileObject;
140     }
141 
142     @Override
143     public FileOperations getFileOperations() throws FileSystemException
144     {
145         return decoratedFileObject.getFileOperations();
146     }
147 
148     @Override
149     public FileSystem getFileSystem()
150     {
151         return decoratedFileObject.getFileSystem();
152     }
153 
154     @Override
155     public String getPublicURIString()
156     {
157         return decoratedFileObject.getPublicURIString();
158     }
159 
160     @Override
161     public FileName getName()
162     {
163         return decoratedFileObject.getName();
164     }
165 
166     @Override
167     public FileObject getParent() throws FileSystemException
168     {
169         return decoratedFileObject.getParent();
170     }
171 
172     @Override
173     public FileType getType() throws FileSystemException
174     {
175         return decoratedFileObject.getType();
176     }
177 
178     @Override
179     public URL getURL() throws FileSystemException
180     {
181         return decoratedFileObject.getURL();
182     }
183 
184     @Override
185     public boolean isAttached()
186     {
187         return decoratedFileObject.isAttached();
188     }
189 
190     @Override
191     public boolean isContentOpen()
192     {
193         return decoratedFileObject.isContentOpen();
194     }
195 
196     @Override
197     public boolean isExecutable() throws FileSystemException
198     {
199         return decoratedFileObject.isExecutable();
200     }
201 
202     @Override
203     public boolean isFile() throws FileSystemException
204     {
205         return decoratedFileObject.isFile();
206     }
207 
208     @Override
209     public boolean isFolder() throws FileSystemException
210     {
211         return decoratedFileObject.isFolder();
212     }
213 
214     @Override
215     public boolean isHidden() throws FileSystemException
216     {
217         return decoratedFileObject.isHidden();
218     }
219 
220     @Override
221     public boolean isReadable() throws FileSystemException
222     {
223         return decoratedFileObject.isReadable();
224     }
225 
226     @Override
227     public boolean isWriteable() throws FileSystemException
228     {
229         return decoratedFileObject.isWriteable();
230     }
231 
232     @Override
233     public Iterator<FileObject> iterator()
234     {
235         return decoratedFileObject.iterator();
236     }
237 
238     @Override
239     public void moveTo(final FileObject destFile) throws FileSystemException
240     {
241         decoratedFileObject.moveTo(destFile);
242     }
243 
244     @Override
245     public void refresh() throws FileSystemException
246     {
247         decoratedFileObject.refresh();
248     }
249 
250     @Override
251     public FileObject resolveFile(final String path) throws FileSystemException
252     {
253         return decoratedFileObject.resolveFile(path);
254     }
255 
256     @Override
257     public FileObject resolveFile(final String name, final NameScope scope) throws FileSystemException
258     {
259         return decoratedFileObject.resolveFile(name, scope);
260     }
261 
262     @Override
263     public boolean setExecutable(final boolean executable, final boolean ownerOnly) throws FileSystemException
264     {
265         return decoratedFileObject.setExecutable(executable, ownerOnly);
266     }
267 
268     @Override
269     public boolean setReadable(final boolean readable, final boolean ownerOnly) throws FileSystemException
270     {
271         return decoratedFileObject.setReadable(readable, ownerOnly);
272     }
273 
274     @Override
275     public boolean setWritable(final boolean writable, final boolean ownerOnly) throws FileSystemException
276     {
277         return decoratedFileObject.setWritable(writable, ownerOnly);
278     }
279 
280     @Override
281     public String toString()
282     {
283         return decoratedFileObject.toString();
284     }
285 
286 
287 }