示例#1
0
MMSPluginManager::MMSPluginManager() {
    MMSConfigData *config = new MMSConfigData();
    this->source          = new DataSource(config->getConfigDBDBMS(),
    		                               config->getConfigDBDatabase(),
    		                               config->getConfigDBAddress(),
    		                               config->getConfigDBPort(),
    		                               config->getConfigDBUser(),
    		                               config->getConfigDBPassword());
    delete config;

    this->service = new MMSPluginService(source);
}
示例#2
0
void Cmd::prepareDb() {
    MMSRcParser         	rcparser;
    MMSConfigDataGlobal		*rcGlobal;
    MMSConfigDataDB     	*rcConfigDB, *rcDataDB;
    MMSConfigDataGraphics	*rcGraphics;
    MMSConfigDataLanguage   *rcLanguage;

    //get datasource
    try {

    	rcparser.parseFile(cmdline["config"]);
	    rcparser.getMMSRc(&rcGlobal, &rcConfigDB, &rcDataDB, &rcGraphics,&rcLanguage);

    } catch (MMSRcParserError &ex) {
    	char error[1024];
    	sprintf(error,"cannot read configuration file @[1m%s@[0m.",configfile.c_str());
        cons.printError(error);
        exit(1);
    }

    rcGlobal->stdout = true;
    MMSConfigData config = MMSConfigData(*rcGlobal, *rcConfigDB, *rcDataDB, *rcGraphics,*rcLanguage);

    //printworkingdata(&config);

    try {
        /* get the active osd and central plugins */
        datasource = new DataSource(config.getConfigDBDBMS(),
                                           config.getConfigDBDatabase(),
                                           config.getConfigDBAddress(),
                                           config.getConfigDBPort(),
                                           config.getConfigDBUser(),
                                           config.getConfigDBPassword());
    } catch(MMSError &ex) {
    	cons.printText("cannot get data source.");
    }

}