Changeset 9279
- Timestamp:
- 2005-03-04T15:22:41+13:00 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/ServiceRack.java
r9265 r9279 87 87 protected HashMap format_info_map = null; 88 88 89 /** the name of the Dictionary to be used. The classname will be used if null */90 protected String dictionary_name = null;91 92 89 /** sets the cluster name */ 93 90 public void setClusterName(String cluster_name) { … … 119 116 this.short_service_info = this.doc.createElement(GSXML.SERVICE_ELEM+GSXML.LIST_MODIFIER); 120 117 this.format_info_map = new HashMap(); 121 // the default value for the dictionary is the classname122 String class_name = this.getClass().getName();123 class_name = class_name.substring(class_name.lastIndexOf('.')+1);124 this.dictionary_name = class_name;125 126 118 } 127 119 … … 335 327 /** overloaded version for no args case */ 336 328 protected String getTextString(String key, String lang) { 337 return getTextString(key, lang, this.dictionary_name, null);329 return getTextString(key, lang, null, null); 338 330 } 339 331 … … 342 334 } 343 335 protected String getTextString(String key, String lang, String [] args) { 344 return getTextString(key, lang, this.dictionary_name, args);336 return getTextString(key, lang, null, args); 345 337 } 346 338 … … 352 344 //String class_name = this.getClass().getName(); 353 345 //class_name = class_name.substring(class_name.lastIndexOf('.')+1); 354 355 Dictionary dict = new Dictionary(dictionary, lang); 346 if (dictionary != null) { 347 // just try the one specified dictionary 348 Dictionary dict = new Dictionary(dictionary, lang); 349 String result = dict.get(key, args); 350 if (result == null) { // not found 351 return "_"+key+"_"; 352 } 353 return result; 354 } 355 356 // else we try class names for dictionary names 357 String class_name = this.getClass().getName(); 358 class_name = class_name.substring(class_name.lastIndexOf('.')+1); 359 Dictionary dict = new Dictionary(class_name, lang); 356 360 String result = dict.get(key, args); 357 if (result == null) { // not found 361 if (result != null) { 362 return result; 363 } 364 365 // we have to try super classes 366 Class c = this.getClass().getSuperclass(); 367 while (result == null && c != null) { 368 class_name = c.getName(); 369 class_name = class_name.substring(class_name.lastIndexOf('.')+1); 370 if (class_name.equals("ServiceRack")) { 371 // this is as far as we go 372 break; 373 } 374 dict = new Dictionary(class_name, lang); 375 result = dict.get(key, args); 376 c = c.getSuperclass(); 377 } 378 if (result == null) { 358 379 return "_"+key+"_"; 359 380 } 360 381 return result; 382 361 383 } 362 384
Note:
See TracChangeset
for help on using the changeset viewer.