001 /* 002 003 $Id: AccessableFilesResponse.java,v 1.4 2003/05/02 20:29:47 culdesac Exp $ 004 005 */ 006 007 package sharpster.common; 008 009 import sharpster.common.Response; 010 import sharpster.common.FileCollection; 011 import java.io.Serializable; 012 013 /** 014 * A response containing information about accessible files. 015 */ 016 public class AccessableFilesResponse extends Response implements Serializable { 017 018 /** 019 * A collection of the files that are accessable. 020 */ 021 private FileCollection files; 022 023 /** 024 * Returns the type of this response. 025 */ 026 public int getType() { 027 return sharpster.common.ResponseType.ACCESSABLE_FILES; 028 } 029 030 /** 031 * Returns the FileCollection containing information about accessible files. 032 */ 033 public FileCollection getfiles() { 034 return files; 035 } 036 037 /** 038 * Sets the FileCollection containing information about accessible files. 039 */ 040 public void setFiles(FileCollection files) { 041 this.files = files; 042 } 043 044 public String toString() { 045 String msg = super.toString(); 046 047 msg = "Accessable files response\n" + msg; 048 msg += "- Files: "; 049 050 for(int i=0;i<files.getFileCount();i++) { 051 SharedFile file = files.getFile(i); 052 if(file != null) { 053 msg += file.getFileName() + "\n "; 054 } 055 } 056 057 return msg; 058 } 059 }