Changeset 1649


Ignore:
Timestamp:
12/09/11 20:37:32 (12 years ago)
Author:
vronk
Message:

correcting config-loading / -usage

Location:
MDUTILS/src/eu/clarin/cmdi/mdservice/internal
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • MDUTILS/src/eu/clarin/cmdi/mdservice/internal/MDTransformer.java

    r1622 r1649  
    101101
    102102        public Properties getConfig(){
    103                 if (config == null){
    104                          return Utils.getConfig();
     103                if (config == null){ // shouldn't happen  - config should be set by the calling app.
     104                                                        // if not - try to use the default config
     105                         return Utils.getAppConfig("");
    105106                }
    106107                return config;
  • MDUTILS/src/eu/clarin/cmdi/mdservice/internal/Utils.java

    r1645 r1649  
    129129         */
    130130        //obsolete
    131         public static Properties getConfig() {
     131        /*
     132         * public static Properties getConfig() {
     133         
    132134                if (config==null)  {
    133135                        loadConfig(config_path);
     
    135137                return config;
    136138        }
     139        */
     140        /**
     141         * Returns the properties loaded from the configuration,
     142         * the parameter allows to distinguish which application's properties to get
     143         * if parameter="" first properties-object will be delivered
     144         * if no config-properties are loaded null is returned. 
     145         */
    137146        public static Properties getAppConfig(String appname){
    138                 return config_hashtable.get(appname);
     147                Properties ret_prop = null;
     148                if (config_hashtable.size() > 0)
     149                {
     150                        if (appname.equals("")) {
     151                                //if no appname specified return the first Properties element available.
     152                                ret_prop = config_hashtable.elements().nextElement();
     153                        } else {
     154                                ret_prop = config_hashtable.get(appname);
     155                        }
     156                }
     157               
     158                return ret_prop;
    139159        }
    140160/**
Note: See TracChangeset for help on using the changeset viewer.