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