Exemple #1
0
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;
}
Exemple #2
0
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);
}