1 5 package xdoclet; 6 7 import java.util.Collections ; 8 import java.util.HashMap ; 9 import java.util.Hashtable ; 10 import java.util.Map ; 11 12 17 public class DocletContext 18 { 19 private static DocletContext singleInstance = null; 20 private String destDir; 21 private String mergeDir; 22 private String excludedTags; 23 private SubTask[] subTasks; 24 private Hashtable properties; 25 private HashMap configs; 26 private boolean force; 27 private boolean verbose; 28 private String addedTags; 29 private Map unmodifiableProperties; 30 private SubTask activeSubTask; 31 32 45 public DocletContext( 46 String destDir, 47 String mergeDir, 48 String excludedTags, 49 SubTask[] subTasks, 50 Hashtable properties, 51 HashMap configs, 52 boolean force, 53 boolean verbose, 54 String addedTags 55 ) 56 { 57 this.destDir = destDir; 58 this.mergeDir = mergeDir; 59 this.excludedTags = excludedTags; 60 this.subTasks = subTasks; 61 this.properties = properties; 62 this.configs = configs; 63 this.force = force; 64 this.verbose = verbose; 65 this.addedTags = addedTags; 66 } 67 68 73 public static DocletContext getInstance() 74 { 75 return singleInstance; 76 } 77 78 83 public static void setSingleInstance(DocletContext singleInstance) 84 { 85 DocletContext.singleInstance = singleInstance; 86 } 87 88 93 public SubTask getActiveSubTask() 94 { 95 return activeSubTask; 96 } 97 98 103 public String getDestDir() 104 { 105 return destDir; 106 } 107 108 113 public String getMergeDir() 114 { 115 return mergeDir; 116 } 117 118 123 public boolean isForce() 124 { 125 return force; 126 } 127 128 133 public boolean isVerbose() 134 { 135 return verbose; 136 } 137 138 public String getAddedTags() 139 { 140 return addedTags; 141 } 142 143 148 public String getExcludedTags() 149 { 150 if (excludedTags == null) { 151 return ""; 152 } 153 else { 154 return excludedTags; 155 } 156 } 157 158 163 public SubTask[] getSubTasks() 164 { 165 return subTasks; 166 } 167 168 174 public String getProperty(String name) 175 { 176 return (String ) properties.get(name); 177 } 178 179 184 public Map getProperties() 185 { 186 if (unmodifiableProperties == null) { 189 unmodifiableProperties = Collections.unmodifiableMap(properties); 190 } 191 192 return unmodifiableProperties; 193 } 194 195 201 public Object getConfigParam(String name) 202 { 203 return configs.get(name.toLowerCase()); 204 } 205 206 212 public boolean isSubTaskDefined(String subtaskName) 213 { 214 return getSubTaskBy(subtaskName) != null; 215 } 216 217 223 public SubTask getSubTaskBy(String subtaskName) 224 { 225 for (int i = 0; i < subTasks.length; i++) { 226 if (subTasks[i] != null && subTasks[i].getSubTaskName().toLowerCase().equals(subtaskName.toLowerCase())) { 227 return subTasks[i]; 228 } 229 } 230 231 return null; 232 } 233 234 239 public void setActiveSubTask(SubTask activeSubTask) 240 { 241 this.activeSubTask = activeSubTask; 242 } 243 } 244 | Popular Tags |