1 7 package com.inversoft.savant; 8 9 10 import java.io.File ; 11 12 13 21 public class LocalProject { 22 23 private String group; 24 private String name; 25 private String antfile = "build.xml"; 26 private String target; 27 private File dir; 28 private LocalProjectBuilder builder = new DefaultLocalProjectBuilder(); 29 30 33 public LocalProject() { 34 } 35 36 37 40 public String getGroup() { 41 return group; 42 } 43 44 47 public void setGroup(String group) { 48 this.group = group; 49 } 50 51 54 public String getName() { 55 return name; 56 } 57 58 61 public void setName(String name) { 62 this.name = name; 63 } 64 65 69 public String getAntfile() { 70 return antfile; 71 } 72 73 76 public void setAntfile(String antfile) { 77 this.antfile = antfile; 78 } 79 80 84 public String getTarget() { 85 return target; 86 } 87 88 91 public void setTarget(String target) { 92 this.target = target; 93 } 94 95 98 public File getDir() { 99 return dir; 100 } 101 102 105 public void setDir(File dir) { 106 this.dir = dir; 107 } 108 109 113 public LocalProjectBuilder getBuilder() { 114 return builder; 115 } 116 117 120 public void setBuilder(LocalProjectBuilder builder) { 121 this.builder = builder; 122 } 123 124 130 public String getID() { 131 return makeProjectID(group, name); 132 } 133 134 141 public static String makeProjectID(String group, String name) { 142 return group + "#" + name; 143 } 144 145 150 public void validate() throws SavantException { 151 if (group == null) { 152 throw new SavantException("group attribute is required for a localproject"); 153 } 154 155 if (name == null) { 156 throw new SavantException("name attribute is required for a localproject"); 157 } 158 159 if (dir == null) { 160 throw new SavantException("dir attribute is required for a localproject"); 161 } 162 } 163 164 168 public void build() throws SavantException { 169 builder.build(this); 170 } 171 172 179 public boolean equals(Object obj) { 180 if (this == obj) return true; 181 if (!(obj instanceof LocalProject)) return false; 182 183 final LocalProject localProjectType = (LocalProject) obj; 184 185 if (!group.equals(localProjectType.group)) return false; 186 if (!name.equals(localProjectType.name)) return false; 187 188 return true; 189 } 190 191 197 public int hashCode() { 198 int result; 199 result = group.hashCode(); 200 result = 29 * result + name.hashCode(); 201 return result; 202 } 203 } | Popular Tags |