1 64 65 package com.jcorporate.expresso.core.misc; 66 67 import java.util.Hashtable ; 68 import java.util.Vector ; 69 70 71 79 public class ConfigContext { 80 81 84 private String name = null; 85 private String hasSetupTables = "y"; 86 87 90 private String description = null; 91 92 95 private ConfigJdbc myJdbc = null; 96 97 100 private ConfigLdap myLdap = null; 101 102 105 private String images = null; 106 107 110 private String startJobHandler = null; 111 112 116 private String showStackTrace = null; 117 118 121 private String mailDebug = null; 122 123 126 private Hashtable customProperties = new Hashtable (); 127 128 131 private Vector typeMappings = new Vector (); 132 private Vector pathMappings = new Vector (); 133 134 138 private String active = "y"; 139 140 144 private String useSSL = "n"; 145 146 149 private String language = "en"; 150 151 154 private String country = "US"; 155 156 159 private String expressoDir = "expresso"; 160 161 164 private Vector setupDefaults = new Vector (); 165 166 169 private String minPasswordSize = "6"; 170 171 174 private String styleSheet = null; 175 176 179 private String useEmailAsLogin = "n"; 180 181 public ConfigContext() { 182 } 183 184 public void setUseEmailAsLogin(String newUse) { 185 StringUtil.assertBoolean(newUse, "You must specify a boolean value"); 186 useEmailAsLogin = newUse; 187 } 188 189 public boolean useEmailAsLogin() { 190 return StringUtil.toBoolean(useEmailAsLogin); 191 } 192 193 public void setStyleSheet(String newSheet) { 194 styleSheet = newSheet; 195 } 196 197 public String getStyleSheet() { 198 return styleSheet; 199 } 200 201 public void setMinPasswordSize(String newSize) { 202 minPasswordSize = newSize; 203 } 204 205 public String getMinPasswordSize() { 206 return minPasswordSize; 207 } 208 209 public Vector getSetupDefaults() { 210 return setupDefaults; 211 } 212 213 public void addSetupDefault(ConfigSetupDefault newDefault) { 214 setupDefaults.addElement(newDefault); 215 } 216 217 public Vector getCustomProperties() { 218 return new Vector (customProperties.entrySet()); 219 } 220 221 224 public String getCustomProperty(String customPropertyName) { 225 String result = null; 226 ConfigCustomProperty prop = 227 (ConfigCustomProperty) customProperties.get(customPropertyName); 228 if (prop != null) { 229 result = prop.getValue(); 230 } 231 232 return result; 233 } 234 235 public void addJdbc(ConfigJdbc newJdbc) { 236 myJdbc = newJdbc; 237 } 238 239 public void addPathMapping(ConfigPathMapping newPathMapping) { 240 pathMappings.addElement(newPathMapping); 241 } 242 243 public Vector getPathMappings() { 244 return pathMappings; 245 } 246 247 public void addLdap(ConfigLdap newLdap) { 248 myLdap = newLdap; 249 } 250 251 public void setExpressoDir(String newDir) { 252 StringUtil.assertNotBlank(newDir, "You must specify a directory"); 253 expressoDir = newDir; 254 } 255 256 public String getExpressoDir() { 257 return ConfigManager.expandValue(expressoDir); 258 } 259 260 public void setLanguage(String newLang) { 261 language = newLang; 262 } 263 264 public String getLanguage() { 265 return language; 266 } 267 268 public void setCountry(String newCountry) { 269 country = newCountry; 270 } 271 272 public String getCountry() { 273 return country; 274 } 275 276 public void setActive(String newActive) { 277 StringUtil.assertBoolean(newActive, "You must specify a boolean value"); 278 active = newActive; 279 } 280 281 public void setActive(boolean newValue) { 282 active = Boolean.toString(newValue); 283 } 284 285 public void setUseSSL(String newValue) { 286 StringUtil.assertBoolean(newValue, "You must specify a boolean value"); 287 useSSL = newValue; 288 } 289 290 public void setUseSSL(boolean newValue) { 291 useSSL = Boolean.toString(newValue); 292 } 293 294 public boolean isActive() { 295 return StringUtil.toBoolean(active); 296 } 297 298 public boolean isUseSSL() { 299 return StringUtil.toBoolean(useSSL); 300 } 301 302 public void addTypeMapping(ConfigTypeMapping newMapping) { 303 typeMappings.addElement(newMapping); 304 } 305 306 public Vector getTypeMappings() { 307 return typeMappings; 308 } 309 310 public ConfigJdbc getJdbc() { 311 return myJdbc; 312 } 313 314 public ConfigLdap getLdap() { 315 return myLdap; 316 } 317 318 public void addCustomProperty(ConfigCustomProperty newCustom) { 319 customProperties.put(newCustom.getName(), newCustom); 320 } 321 322 public void setStartJobHandler(String newJobHandler) { 323 StringUtil.assertBoolean(newJobHandler, 324 "You must specify a boolean value"); 325 startJobHandler = newJobHandler; 326 } 327 328 public boolean startJobHandler() { 329 return StringUtil.toBoolean(startJobHandler); 330 } 331 332 public void setShowStackTrace(String newStackTrace) { 333 StringUtil.assertBoolean(newStackTrace, 334 "You must specify a boolean value"); 335 showStackTrace = newStackTrace; 336 } 337 338 public boolean showStackTrace() { 339 return StringUtil.toBoolean(showStackTrace); 340 } 341 342 public void setMailDebug(String newMailDebug) { 343 StringUtil.assertBoolean(newMailDebug, 344 "You must specify a boolean value"); 345 mailDebug = newMailDebug; 346 } 347 348 public boolean mailDebug() { 349 return StringUtil.toBoolean(mailDebug); 350 } 351 352 public void setName(String newName) { 353 StringUtil.assertNotBlank(newName, "You must specify a name"); 354 name = newName; 355 } 356 357 public String getName() { 358 return name; 359 } 360 361 public void setDescription(String newDescrip) { 362 StringUtil.assertNotBlank(newDescrip, "You must specify a description"); 363 description = newDescrip; 364 } 365 366 public String getDescription() { 367 return description; 368 } 369 370 public void setImages(String newImages) { 371 StringUtil.assertNotBlank(newImages, 372 "You may not specify an empty location"); 373 images = newImages; 374 } 375 376 public String getImages() { 377 return ConfigManager.expandValue(images); 378 } 379 380 public void setHasSetupTables(String newHasSetup) { 381 StringUtil.assertBoolean(newHasSetup, 382 "You must specify a boolean value"); 383 hasSetupTables = newHasSetup; 384 } 385 386 public boolean hasSetupTables() { 387 return StringUtil.toBoolean(hasSetupTables); 388 } 389 } 390 | Popular Tags |