1 29 30 package com.caucho.vfs; 31 32 import java.util.logging.Level ; 33 import java.util.logging.Logger ; 34 35 38 public class PathExistsDependency implements Dependency { 39 private static final Logger log 40 = Logger.getLogger(PathExistsDependency.class.getName()); 41 42 Path _source; 43 boolean _exists; 44 45 50 public PathExistsDependency(Path source) 51 { 52 if (source instanceof JarPath) 53 source = ((JarPath) source).getContainer(); 54 55 _source = source; 56 _exists = source.exists(); 57 } 58 59 64 public PathExistsDependency(Path source, boolean exists) 65 { 66 _source = source; 67 _exists = exists; 68 } 69 70 73 public Path getPath() 74 { 75 return _source; 76 } 77 78 83 public boolean isModified() 84 { 85 boolean exists = _source.exists(); 86 87 if (exists == _exists) 88 return false; 89 else if (exists) { 90 if (log.isLoggable(Level.FINE)) 91 log.fine(_source.getNativePath() + " has been created."); 92 93 return true; 94 } 95 else { 96 if (log.isLoggable(Level.FINE)) 97 log.fine(_source.getNativePath() + " has been deleted."); 98 99 return true; 100 } 101 } 102 103 107 public boolean equals(Object obj) 108 { 109 if (! (obj instanceof PathExistsDependency)) 110 return false; 111 112 PathExistsDependency depend = (PathExistsDependency) obj; 113 114 return _source.equals(depend._source); 115 } 116 117 120 public String toString() 121 { 122 return ("PathExistsDependency[" + _source + "]"); 123 } 124 } 125 | Popular Tags |