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