1 21 22 package com.izforge.izpack.compiler; 23 24 import java.io.File ; 25 import java.io.FileNotFoundException ; 26 import java.util.ArrayList ; 27 import java.util.HashMap ; 28 import java.util.List ; 29 import java.util.Map ; 30 import java.util.Set ; 31 32 import com.izforge.izpack.ExecutableFile; 33 import com.izforge.izpack.Pack; 34 import com.izforge.izpack.PackFile; 35 import com.izforge.izpack.ParsableFile; 36 import com.izforge.izpack.UpdateCheck; 37 38 44 public class PackInfo 45 { 46 47 48 private Pack pack; 49 50 51 public int colour; 52 53 54 public final static int WHITE = 0; 55 56 57 public final static int GREY = 1; 58 59 60 public final static int BLACK = 2; 61 62 63 private Map files = new HashMap (); 64 65 66 private List parsables = new ArrayList (); 67 68 69 private List executables = new ArrayList (); 70 71 72 private List updateChecks = new ArrayList (); 73 74 82 protected PackInfo(String name, String id, String description, boolean required, boolean loose, String excludegroup) 83 { 84 boolean ispreselected = (excludegroup == null) ? true : false; 85 pack = new Pack(name, id, description, null, null, required, ispreselected, loose, excludegroup); 86 colour = PackInfo.WHITE; 87 } 88 89 92 93 public void setDependencies(List dependencies) 94 { 95 pack.dependencies = dependencies; 96 } 97 98 102 public void setExcludeGroup(String group) 103 { 104 pack.excludeGroup = group; 105 } 106 107 public void setOsConstraints(List osConstraints) 108 { 109 pack.osConstraints = osConstraints; 110 } 111 112 public List getOsConstraints(List osConstraints) 113 { 114 return pack.osConstraints; 115 } 116 117 public void setPreselected(boolean preselected) 118 { 119 pack.preselected = preselected; 120 } 121 122 public boolean isPreselected() 123 { 124 return pack.preselected; 125 } 126 127 131 public String getGroup() 132 { 133 return pack.group; 134 } 135 139 public void setGroup(String group) 140 { 141 pack.group = group; 142 } 143 144 148 public void addInstallGroup(String group) 149 { 150 pack.installGroups.add(group); 151 } 152 157 public boolean hasInstallGroup(String group) 158 { 159 return pack.installGroups.contains(group); 160 } 161 165 public Set getInstallGroups() 166 { 167 return pack.installGroups; 168 } 169 170 public Pack getPack() 171 { 172 return pack; 173 } 174 175 178 179 191 207 public void addFile(File baseDir, File file, String targetfile, List osList, int override, Map additionals) 208 throws FileNotFoundException 209 { 210 if (!file.exists()) throw new FileNotFoundException (file.toString()); 211 212 PackFile packFile = new PackFile(baseDir, file, targetfile, osList, override, additionals); 213 files.put(packFile, file); 214 } 215 216 217 public Set getPackFiles() 218 { 219 return files.keySet(); 220 } 221 222 226 public File getFile(PackFile packFile) 227 { 228 return (File ) files.get(packFile); 229 } 230 231 234 public void addParsable(ParsableFile parsable) 235 { 236 parsables.add(parsable); 237 } 238 239 240 public List getParsables() 241 { 242 return parsables; 243 } 244 245 249 public void addExecutable(ExecutableFile executable) 250 { 251 executables.add(executable); 252 } 253 254 255 public List getExecutables() 256 { 257 return executables; 258 } 259 260 264 public void addUpdateCheck(UpdateCheck updateCheck) 265 { 266 updateChecks.add(updateCheck); 267 } 268 269 270 public List getUpdateChecks() 271 { 272 return updateChecks; 273 } 274 275 278 public void addDependency(String dependency) 279 { 280 if (pack.dependencies == null) 281 { 282 pack.dependencies = new ArrayList (); 283 } 284 pack.dependencies.add(dependency); 285 } 286 287 public List getDependencies() 288 { 289 return pack.dependencies; 290 } 291 292 public String toString() 293 { 294 return pack.name; 295 } 296 } 297 | Popular Tags |