CollectionPtr Collection::buildCollection(const string& sConfFile) { CollectionConfigurePtr pConfigure(new CollectionConfigure()); try { XMLConfigurator loader; loader.load(sConfFile); pConfigure->configure(loader); makePathAbsolute(loader.getDir(), pConfigure->Collection.source); makePathAbsolute(loader.getDir(), pConfigure->Collection.target); GLOBAL_CONF().makePathsAbsolute(loader.getDir()); } catch(const FirteXException& fe) { FX_LOG(ERROR, "Parse Configure file: [%s], reson: [%s]", sConfFile.c_str(), fe.what().c_str()); throw; } CollectionPtr pCol(CollectionFactory::instance()->createCollection( pConfigure->Collection.identifier)); if (!pCol) { return pCol; } pCol->init(pConfigure); return pCol; }
//static DocumentSchemaPtr Index::readSchema(FileSystemPtr& pFileSys) { XMLConfigurator configurator; configurator.load(SCHEMA_FILENAME, pFileSys); DocumentSchemaPtr pDocSchema = new DocumentSchema(); pDocSchema->configure(configurator); return pDocSchema; }
CollectionPtr Collection::buildIndex(const std::string& sConfFile, const ProgressObserverPtr& pProgressObserver, bool bBlock) { CollectionConfigurePtr pConfigure(new CollectionConfigure()); XMLConfigurator xmlConf; xmlConf.load(sConfFile); pConfigure->configure(xmlConf); makePathAbsolute(xmlConf.getDir(), pConfigure->Collection.source); makePathAbsolute(xmlConf.getDir(), pConfigure->Collection.target); GLOBAL_CONF().makePathsAbsolute(xmlConf.getDir()); return buildIndex(pConfigure, pProgressObserver, bBlock); }