001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package org.apache.commons.vfs.cache;
018:
019: import java.util.List;
020:
021: import org.apache.commons.vfs.FileContent;
022: import org.apache.commons.vfs.FileObject;
023: import org.apache.commons.vfs.FileSelector;
024: import org.apache.commons.vfs.FileSystemException;
025: import org.apache.commons.vfs.FileType;
026: import org.apache.commons.vfs.NameScope;
027: import org.apache.commons.vfs.impl.DecoratedFileObject;
028:
029: /**
030: * This decorator refreshes the fileObject data on every call
031: *
032: * @author <a href="mailto:imario@apache.org">Mario Ivankovits</a>
033: * @version $Revision: 480428 $ $Date: 2006-11-28 22:15:24 -0800 (Tue, 28 Nov 2006) $
034: */
035: public class OnCallRefreshFileObject extends DecoratedFileObject {
036: public OnCallRefreshFileObject(FileObject fileObject) {
037: super (fileObject);
038: }
039:
040: public void close() throws FileSystemException {
041: refresh();
042: super .close();
043: }
044:
045: public void copyFrom(FileObject srcFile, FileSelector selector)
046: throws FileSystemException {
047: refresh();
048: super .copyFrom(srcFile, selector);
049: }
050:
051: public void createFile() throws FileSystemException {
052: refresh();
053: super .createFile();
054: }
055:
056: public void createFolder() throws FileSystemException {
057: refresh();
058: super .createFolder();
059: }
060:
061: public boolean delete() throws FileSystemException {
062: refresh();
063: return super .delete();
064: }
065:
066: public int delete(FileSelector selector) throws FileSystemException {
067: refresh();
068: return super .delete(selector);
069: }
070:
071: public boolean exists() throws FileSystemException {
072: refresh();
073: return super .exists();
074: }
075:
076: public void findFiles(FileSelector selector, boolean depthwise,
077: List selected) throws FileSystemException {
078: refresh();
079: super .findFiles(selector, depthwise, selected);
080: }
081:
082: public FileObject[] findFiles(FileSelector selector)
083: throws FileSystemException {
084: refresh();
085: return super .findFiles(selector);
086: }
087:
088: public FileObject getChild(String name) throws FileSystemException {
089: refresh();
090: return super .getChild(name);
091: }
092:
093: public FileObject[] getChildren() throws FileSystemException {
094: refresh();
095: return super .getChildren();
096: }
097:
098: public FileContent getContent() throws FileSystemException {
099: refresh();
100: return super .getContent();
101: }
102:
103: public FileType getType() throws FileSystemException {
104: refresh();
105: return super .getType();
106: }
107:
108: public boolean isHidden() throws FileSystemException {
109: refresh();
110: return super .isHidden();
111: }
112:
113: public boolean isReadable() throws FileSystemException {
114: refresh();
115: return super .isReadable();
116: }
117:
118: public boolean isWriteable() throws FileSystemException {
119: refresh();
120: return super .isWriteable();
121: }
122:
123: public void moveTo(FileObject destFile) throws FileSystemException {
124: refresh();
125: super .moveTo(destFile);
126: }
127:
128: public FileObject resolveFile(String name, NameScope scope)
129: throws FileSystemException {
130: refresh();
131: return super .resolveFile(name, scope);
132: }
133:
134: public FileObject resolveFile(String path)
135: throws FileSystemException {
136: refresh();
137: return super.resolveFile(path);
138: }
139: }
|