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.vfs.cache;
18  
19  import java.util.List;
20  
21  import org.apache.commons.vfs.FileContent;
22  import org.apache.commons.vfs.FileObject;
23  import org.apache.commons.vfs.FileSelector;
24  import org.apache.commons.vfs.FileSystemException;
25  import org.apache.commons.vfs.FileType;
26  import org.apache.commons.vfs.NameScope;
27  import org.apache.commons.vfs.impl.DecoratedFileObject;
28  
29  /***
30   * This decorator refreshes the fileObject data on every call
31   *
32   * @author <a href="mailto:imario@apache.org">Mario Ivankovits</a>
33   * @version $Revision: 480428 $ $Date: 2006-11-29 07:15:24 +0100 (Mi, 29 Nov 2006) $
34   */
35  public class OnCallRefreshFileObject extends DecoratedFileObject
36  {
37  	public OnCallRefreshFileObject(FileObject fileObject)
38  	{
39  		super(fileObject);		
40  	}
41  
42  	public void close() throws FileSystemException
43  	{
44  		refresh();
45  		super.close();
46  	}
47  
48  	public void copyFrom(FileObject srcFile, FileSelector selector) throws FileSystemException
49  	{
50  		refresh();
51  		super.copyFrom(srcFile, selector);
52  	}
53  
54  	public void createFile() throws FileSystemException
55  	{
56  		refresh();
57  		super.createFile();
58  	}
59  
60  	public void createFolder() throws FileSystemException
61  	{
62  		refresh();
63  		super.createFolder();
64  	}
65  
66  	public boolean delete() throws FileSystemException
67  	{
68  		refresh();
69  		return super.delete();
70  	}
71  
72  	public int delete(FileSelector selector) throws FileSystemException
73  	{
74  		refresh();
75  		return super.delete(selector);
76  	}
77  
78  	public boolean exists() throws FileSystemException
79  	{
80  		refresh();
81  		return super.exists();
82  	}
83  
84  	public void findFiles(FileSelector selector, boolean depthwise, List selected) throws FileSystemException
85  	{
86  		refresh();
87  		super.findFiles(selector, depthwise, selected);
88  	}
89  
90  	public FileObject[] findFiles(FileSelector selector) throws FileSystemException
91  	{
92  		refresh();
93  		return super.findFiles(selector);
94  	}
95  
96  	public FileObject getChild(String name) throws FileSystemException
97  	{
98  		refresh();
99  		return super.getChild(name);
100 	}
101 
102 	public FileObject[] getChildren() throws FileSystemException
103 	{
104 		refresh();
105 		return super.getChildren();
106 	}
107 
108 	public FileContent getContent() throws FileSystemException
109 	{
110 		refresh();
111 		return super.getContent();
112 	}
113 
114 	public FileType getType() throws FileSystemException
115 	{
116 		refresh();
117 		return super.getType();
118 	}
119 
120 	public boolean isHidden() throws FileSystemException
121 	{
122 		refresh();
123 		return super.isHidden();
124 	}
125 
126 	public boolean isReadable() throws FileSystemException
127 	{
128 		refresh();
129 		return super.isReadable();
130 	}
131 
132 	public boolean isWriteable() throws FileSystemException
133 	{
134 		refresh();
135 		return super.isWriteable();
136 	}
137 
138 	public void moveTo(FileObject destFile) throws FileSystemException
139 	{
140 		refresh();
141 		super.moveTo(destFile);
142 	}
143 
144 	public FileObject resolveFile(String name, NameScope scope) throws FileSystemException
145 	{
146 		refresh();
147 		return super.resolveFile(name, scope);
148 	}
149 
150 	public FileObject resolveFile(String path) throws FileSystemException
151 	{
152 		refresh();
153 		return super.resolveFile(path);
154 	}
155 }