1/* 2 * Copyright 2008 the original author or authors. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package org.mockftpserver.fake.filesystem; 18 19import java.util.Date; 20 21/** 22 * Interface for an entry within a fake file system, representing a single file or directory. 23 * 24 * @author Chris Mair 25 * @version $Revision$ - $Date$ 26 */ 27public interface FileSystemEntry { 28 29 /** 30 * Return true if this entry represents a directory, false otherwise 31 * 32 * @return true if this file system entry is a directory, false otherwise 33 */ 34 public boolean isDirectory(); 35 36 /** 37 * Return the path for this file system entry 38 * 39 * @return the path for this file system entry 40 */ 41 public String getPath(); 42 43 /** 44 * Return the file name or directory name (no path) for this entry 45 * 46 * @return the file name or directory name (no path) for this entry 47 */ 48 public String getName(); 49 50 /** 51 * Return the size of this file system entry 52 * 53 * @return the file size in bytes 54 */ 55 public long getSize(); 56 57 /** 58 * Return the timestamp Date for the last modification of this file system entry 59 * 60 * @return the last modified timestamp Date for this file system entry 61 */ 62 public Date getLastModified(); 63 64 /** 65 * Set the timestamp Date for the last modification of this file system entry 66 * 67 * @param lastModified - the lastModified value, as a Date 68 */ 69 public void setLastModified(Date lastModified); 70 71 /** 72 * @return the username of the owner of this file system entry 73 */ 74 public String getOwner(); 75 76 /** 77 * @return the name of the owning group for this file system entry 78 */ 79 public String getGroup(); 80 81 /** 82 * @return the Permissions for this file system entry 83 */ 84 public Permissions getPermissions(); 85 86 /** 87 * Return a new FileSystemEntry that is a clone of this object, except having the specified path 88 * 89 * @param path - the new path value for the cloned file system entry 90 * @return a new FileSystemEntry that has all the same values as this object except for its path 91 */ 92 public FileSystemEntry cloneWithNewPath(String path); 93 94 /** 95 * Lock down the path so it cannot be changed 96 */ 97 public void lockPath(); 98 99}