1 18 package net.sf.drftpd.remotefile; 19 20 import java.util.Collection ; 21 import java.util.Collections ; 22 import java.util.List ; 23 24 30 public class StaticRemoteFile extends AbstractRemoteFile { 31 private long _checkSum; 32 private String _groupname; 33 private boolean _isDeleted; 34 private long _lastModified; 35 private long _length; 36 private String _link = null; 37 private String _name; 38 private List _rslaves; 39 private String _username; 40 private long _xfertime; 41 42 45 public StaticRemoteFile( 46 List rslaves, 47 String name, 48 String owner, 49 String group, 50 long size, 51 long lastModified) { 52 _rslaves = rslaves; 53 _name = name; 54 _username = owner; 58 _groupname = group; 59 _length = size; 60 _lastModified = lastModified; 61 } 62 63 public StaticRemoteFile( 64 List rslaves, 65 String name, 66 String owner, 67 String group, 68 long size, 69 long lastModified, 70 long checkSum) { 71 this(rslaves, name, owner, group, size, lastModified); 72 _checkSum = checkSum; 73 } 74 75 public StaticRemoteFile(List rslaves, String name, long size) { 76 this(rslaves, name, null, null, size, System.currentTimeMillis()); 77 } 78 public StaticRemoteFile(String name) { 79 _name = name; 80 } 81 82 public StaticRemoteFile(String name, List rslaves) { 83 this(name); 84 _rslaves = rslaves; 85 } 86 87 public long getCheckSumCached() { 88 return _checkSum; 89 } 90 91 95 public Collection getFiles() { 96 return Collections.EMPTY_LIST; 97 } 98 99 public String getGroupname() { 100 return _groupname; 101 } 102 103 public String getLinkPath() { 104 return _link; 105 } 106 107 public String getName() { 108 return _name; 109 } 110 111 public String getParent() { 112 throw new UnsupportedOperationException ("getParent() does not exist in StaticRemoteFile"); 113 } 114 115 public String getPath() { 116 throw new UnsupportedOperationException (); 117 } 118 119 public Collection getSlaves() { 120 return _rslaves; 121 } 122 123 public String getUsername() { 124 return _username; 125 } 126 127 public long getXfertime() { 128 return _xfertime; 129 } 130 131 public boolean isDeleted() { 132 return _isDeleted; 133 } 134 135 public boolean isDirectory() { 136 return _rslaves == null; 137 } 138 139 public boolean isFile() { 140 return _rslaves != null; 141 } 142 143 public boolean isLink() { 144 return _link != null; 145 } 146 147 public long lastModified() { 148 return _lastModified; 149 } 150 151 public long length() { 152 return _length; 153 } 154 155 159 public void setCheckSum(long checkSum) { 160 _checkSum = checkSum; 161 } 162 163 public void setDeleted(boolean isDeleted) { 164 _isDeleted = isDeleted; 165 } 166 167 public void setGroupname(String groupname) { 168 _groupname = groupname; 169 } 170 171 public void setLastModified(long lastmodified) { 172 _lastModified = lastmodified; 173 } 174 175 public void setLength(long length) { 176 _length = length; 177 } 178 179 public void setLink(String link) { 180 _link = link; 181 } 182 183 public void setRSlaves(List rslaves) { 184 _rslaves = rslaves; 185 } 186 187 public void setUsername(String username) { 188 _username = username; 189 } 190 191 public void setXfertime(long xfertime) { 192 _xfertime = xfertime; 193 } 194 195 public String toString() { 196 197 StringBuffer ret = new StringBuffer (); 198 ret.append(getClass().getName() + "["); 199 if (isDirectory()) 200 ret.append("[isDirectory(): true]"); 201 if (isFile()) 202 ret.append("[isFile(): true]"); 203 ret.append("[length(): " + length() + "]"); 204 ret.append(getName()); 205 ret.append("]"); 206 ret.append("[rslaves:" + _rslaves + "]"); 207 return ret.toString(); 208 } 209 210 } 211 | Popular Tags |