Changeset 8952


Ignore:
Timestamp:
2005-02-02T14:42:29+13:00 (19 years ago)
Author:
kjdon
Message:

we now have a dictionary name specified for each class, rather than always using the class name. So classes can share dictionary files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/service/ServiceRack.java

    r6364 r8952  
    8787    protected HashMap format_info_map = null;
    8888
     89    /** the name of the Dictionary to be used. The classname will be used if null */
     90    protected String dictionary_name = null;
     91
    8992    /** sets the cluster name */
    9093    public void setClusterName(String cluster_name) {
     
    112115    /** the no-args constructor */
    113116    public ServiceRack() {
     117    System.err.println("service rack");
    114118    this.converter = new XMLConverter();
    115119    this.doc = this.converter.newDOM();
    116120    this.short_service_info = this.doc.createElement(GSXML.SERVICE_ELEM+GSXML.LIST_MODIFIER);
    117121    this.format_info_map = new HashMap();
     122    // the default value for the dictionary is the classname
     123    String class_name = this.getClass().getName();
     124    class_name = class_name.substring(class_name.lastIndexOf('.')+1);
     125    this.dictionary_name = class_name;
     126
    118127    }
    119128   
     
    318327    /** overloaded version for no args case */
    319328    protected String getTextString(String key, String lang) {
    320     return getTextString(key, null, lang);
    321     }
     329    return getTextString(key, lang, this.dictionary_name, null);
     330    }
     331
     332    protected String getTextString(String key, String lang, String dictionary) {
     333    return getTextString(key, lang, dictionary, null);
     334    }
     335    protected String getTextString(String key, String lang, String [] args) {
     336    return getTextString(key, lang, this.dictionary_name, args);
     337    }
     338   
    322339    /** getTextString - retrieves a language specific text string for the given
    323 key and locale
     340key and locale, from the specified resource_bundle
    324341    */
    325     protected String getTextString(String key, String[] args,  String lang) {
    326 
    327     String class_name = this.getClass().getName();
    328     class_name = class_name.substring(class_name.lastIndexOf('.')+1);
    329    
    330     Dictionary dict = new Dictionary(class_name, lang);
     342    protected String getTextString(String key, String lang, String dictionary, String[] args) {
     343
     344    //String class_name = this.getClass().getName();
     345    //class_name = class_name.substring(class_name.lastIndexOf('.')+1);
     346   
     347    Dictionary dict = new Dictionary(dictionary, lang);
    331348    String result = dict.get(key, args);
    332349    if (result == null) { // not found
Note: See TracChangeset for help on using the changeset viewer.