Changeset 1620


Ignore:
Timestamp:
11/17/11 23:05:42 (13 years ago)
Author:
gaba
Message:

new lib hierarchy

Location:
SMC/trunk/SMC/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • SMC/trunk/SMC/src/eu/clarin/cmdi/smc/SMC.java

    r1610 r1620  
    99import java.util.List;
    1010import java.util.Map;
     11import java.util.Properties;
     12//import org.apache.commons.configuration.Configuration;
     13//import org.apache.commons.lang.exception.NestableException;
     14//import org.apache.commons.configuration.ConfigurationException;
     15//import org.apache.commons.configuration.PropertiesConfiguration;
     16//
     17
     18
    1119
    1220import javax.xml.transform.TransformerException;
     
    2634       
    2735        public SMC () {
    28                 Utils.loadConfig("smc.properties");
     36                //Utils.loadConfig("smc.properties");
     37               
     38                this.configure();
    2939                this.addParam("cache_dir", Utils.getConfig("cache.dir"));
     40                //this.addParam("cache_dir", config.getString("cache.dir"));
     41               
    3042        }
    3143        private Map<String,String[]> params;
    3244       
    3345        public static Logger log = Logger.getLogger("SMC");
     46       
    3447       
    3548        public static void main(String[] args) {
     
    4558        }
    4659
     60        public void configure(){
     61                Utils.loadConfig("smc", "smc.properties", this.getClass().getClassLoader());
     62        }
     63        public void configure(String configPath) {
     64                try {
     65                        Utils.loadConfig("smc", configPath, this.getClass().getClassLoader());
     66                        //config = new PropertiesConfiguration("smc.properties");
     67                } catch (Exception e) {
     68                        // TODO Auto-generated catch block
     69                        e.printStackTrace();
     70                }
     71        }
    4772/**
    4873 * load data from registries based on configuration
     
    5277 
    5378                InputStream is =null;
    54                 is = Utils.load2Stream(Utils.getConfig("termsets.config.file"));
     79                is = Utils.load2Stream(Utils.getConfig("termsets.config.file"),this.getClass().getClassLoader());
     80                //is = Utils.load2Stream(config.getString("termsets.config.file"));
    5581               
    5682                MDTransformer transformer = new MDTransformer();
     83                //transformer.configure(config, this.getClass().getClassLoader());
    5784                // set URL as srcFile (for MDTransformer to pass to xsl-scripts)
    5885                // TODO: WHY??
     
    7097                        // store the result in the cache
    7198                        String output_path = Utils.getConfig("cache.dir") +  getParam("data_key") + ".xml" ;           
     99                        //String output_path = config.getString("cache.dir") +  getParam("data_key") + ".xml" ;
    72100                        File f = Utils.write2File(output_path, resultStream);
    73101                        log.debug("result stored in: " + f.getAbsolutePath());
     
    165193        public InputStream listTermsets(String context) {
    166194                InputStream is =null;
    167                 is = Utils.load2Stream(Utils.getConfig("termsets.config.file"));
     195                is = Utils.load2Stream(Utils.getConfig("termsets.config.file").trim(), this.getClass().getClassLoader());
    168196                return is;
    169197        }
  • SMC/trunk/SMC/src/smc.properties

    r1607 r1620  
    1 termsets.config.file = smc_config.xml 
    2 cache.dir = C:/Users/m/3lingua/clarin/CMDI/SMC/cache/
     1termsets.config.file = smc_config.xml
     2#cache.dir = C:/Users/m/3lingua/clarin/CMDI/SMC/cache/
     3cache.dir = C:/apache-tomcat-6.0.26/webapps/SMC_cache/
    34
    45scripts.path = scripts/
Note: See TracChangeset for help on using the changeset viewer.