Changeset 30475 for main/trunk


Ignore:
Timestamp:
2016-04-14T13:49:00+12:00 (8 years ago)
Author:
kjdon
Message:

now we have a main ServiceRack.properties file for most of the core services. So we have changed the way we look for a text fragment. Do the same thing as before looking for classname.properties, then up the inheritance chain. But if not found then, we look up ServiceRack.properties, first looking for classname.key, then just key. May need to add inheritance in lookup names here too, but don't need it at the moment

File:
1 edited

Legend:

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

    r28966 r30475  
    474474
    475475        // now we try class names for dictionary names
    476         String class_name = this.getClass().getName();
    477         class_name = class_name.substring(class_name.lastIndexOf('.') + 1);
    478         Dictionary dict = new Dictionary(class_name, lang, this.class_loader);
     476        String original_class_name = this.getClass().getName();
     477        original_class_name = original_class_name.substring(original_class_name.lastIndexOf('.') + 1);
     478        Dictionary dict = new Dictionary(original_class_name, lang, this.class_loader);
    479479        String result = dict.get(key, args);
    480480        if (result != null)
     
    484484
    485485        // we have to try super classes
     486        String class_name;
    486487        Class c = this.getClass().getSuperclass();
    487488        while (result == null && c != null)
     
    500501        if (result == null)
    501502        {
    502             return "_" + key + "_";
     503          // try the ServiceRack properties
     504          // at the moment we look for original_class_name.key, then just key
     505          // if there is lots of inheritance, may want to try down the list of superclasses too...
     506          class_name = "ServiceRack";
     507          dict = new Dictionary(class_name, lang, this.class_loader);
     508          String full_key = original_class_name+"."+key;
     509          result = dict.get(full_key, args);
     510          if(result == null) {
     511            result = dict.get(key, args);
     512          }
     513          if(result == null) {
     514            return "_" + key + "_";
     515          }
    503516        }
    504517        return result;
    505 
     518   
    506519    }
    507520
Note: See TracChangeset for help on using the changeset viewer.