1 package org.oddjob.io; 2 3 import java.io.File ; 4 import java.io.Serializable ; 5 6 7 25 26 public class ExistsJob implements Runnable , Serializable { 27 private static final long serialVersionUID = 20060117; 28 29 34 private String name; 35 36 41 private File file; 42 43 48 private File [] exists; 49 50 55 public String getName() { 56 return name; 57 } 58 59 64 public void setName(String name) { 65 this.name = name; 66 } 67 68 73 public File getFile() { 74 return file; 75 } 76 77 82 public void setFile(File file) { 83 this.file = file; 84 } 85 86 public File [] getExists() { 87 return exists; 88 } 89 94 public int getResult() { 95 if (exists == null) { 96 return -1; 97 } 98 return exists.length > 0 ? 0 : 1; 99 } 100 101 105 public void run() { 106 if (file == null) { 107 throw new IllegalStateException ("File must be specified."); 108 } 109 WildcardSpec wild = new WildcardSpec(file); 110 exists = wild.findFiles(); 111 } 112 113 117 public String toString() { 118 if (name == null) { 119 return "Check File Exists"; 120 } 121 return name; 122 } 123 } 124 | Popular Tags |