1 18 package net.sf.drftpd.slave; 19 20 import java.io.IOException ; 21 22 import se.mog.io.File; 23 24 28 public class Root { 29 private File _rootFile; 30 private String _root; 31 private long _minSpaceFree = 50000000; private int _priority = 0; 33 private long _lastModified; 34 35 public Root(String root, long minSpaceFree, int priority) throws IOException { 36 _rootFile = new File(new File(root).getCanonicalFile()); 37 _root = _rootFile.getPath(); 38 _lastModified = getFile().lastModified(); 39 } 40 41 public File getFile() { 42 return _rootFile; 43 } 44 45 public String getPath() { 46 return _root; 47 } 48 49 public long lastModified() { 50 return _lastModified; 51 } 52 53 public void touch() { 54 getFile().setLastModified(_lastModified = System.currentTimeMillis()); 55 } 56 57 public long getMinSpaceFree() { 58 return _minSpaceFree; 59 } 60 61 public int getPriority() { 62 return _priority; 63 } 64 65 public String toString() { 66 return "[root=" + getPath() + "]"; 67 } 68 69 public long getDiskSpaceAvailable() { 70 return getFile().getDiskSpaceAvailable(); 71 } 72 73 public long getDiskSpaceCapacity() { 74 return getFile().getDiskSpaceCapacity(); 75 } 76 77 public File getFile(String path) { 78 return new File(_root + File.separator + path); 79 } 80 81 85 public boolean isFull() { 86 return getFile().getDiskSpaceAvailable() < getMinSpaceFree(); 87 } 88 } 89 | Popular Tags |