public void configure() {
try {
prepareIniFile();
Properties keeper = new Properties();
SchedulerFactory sf = new StdSchedulerFactory();
keeper.load(new FileInputStream("../main_config.ini"));
Vars.mysql_host = keeper.getProperty("mysql_host");
Vars.mysql_port = keeper.getProperty("mysql_port");
Vars.mysql_db = keeper.getProperty("mysql_db");
Vars.mysql_user = keeper.getProperty("mysql_user");
Vars.mysql_password = keeper.getProperty("mysql_passwd");
Vars.Mater_Lector = keeper.getProperty("Mater_Lector");
Vars.Lector_Repository = keeper.getProperty("Lector_Repository");
Vars.CronExpressionForIndexer = keeper.getProperty("CronExpressionForIndexer");
Vars.dubl_remover_time = keeper.getProperty("dubl_remover_time");
Vars.IndexerToUse = keeper.getProperty("IndexerToUse");
Vars.Lucene_Repo = keeper.getProperty("Lucene_Repo");
Vars.PathToTmpDir = keeper.getProperty("PathToTmpDir");
Vars.max_threads = Integer.parseInt(keeper.getProperty("max_threads"));
PropertyConfigurator.configure(props());
Vars.logger = Logger.getRootLogger();
if (System.getProperty("os.name").toUpperCase().contains("WIN")) {
if (System.getProperty("os.arch").contains("x86")) {
Vars.os = 1;
}
if (System.getProperty("os.arch").contains("amd64")) {
Vars.os = 2;
}
}
loadParsersFromXML();
if (Vars.PathToTmpDir == null) {
File tmpDir = new File("");
tmpDir = new File(tmpDir.getAbsolutePath() + "/temp");
if (tmpDir.mkdirs()) {
Vars.logger.info("Temporary directory successfully created");
} else {
Vars.logger.warn("Temporary directory was not created!");
}
Vars.PathToTmpDir = tmpDir.getAbsolutePath().replace("\\", "/");
tmpDir = null;
}
Vars.sched = sf.getScheduler();
Vars.sched.start();
} catch (Exception ex) {
ex.printStackTrace();
Vars.logger.fatal("Error: ", ex);
}