Ejemplo n.º 1
0
//============================================================================//
void Configuration::checkForSoftware(AbstractConfiguration &config)
{
    if(!config.has("path")) throw Exception(
        "<path> node doesn't exist");

    if(!File(config.getString("path")).exists()) throw Exception(
        "<path> node refers to not exist path or access denied to the folder");

    if(!config.has("uri"))  throw Exception(
        "<uri> node doesn't exist");

    if(!config.has("schedules")) throw Exception(
        "<schedules> doesn't exist");
}
Ejemplo n.º 2
0
//============================================================================//
void Configuration::checkForApplication(AbstractConfiguration &config)
{
    if(!config.has("identifier")) throw Exception(
        "<identifier> node doesn't exist");

    if(!config.has("temporary"))  throw Exception(
        "<temporary> node doesn't exist");

    if(!File(config.getString("temporary")).exists()) throw Exception(
        "<temporary> node refers to not exist path or access denied to the folder");

    if(!config.has("updateSoftwares")) throw Exception(
        "<updateSoftwares> node doesn't exist");

}
Ejemplo n.º 3
0
//============================================================================//
void AnalyzerDispatcher::create(AbstractConfiguration &config)
{
    AbstractConfiguration::Keys             analyzersCodes;
    AbstractConfiguration::Keys::iterator   iter;

    config.keys("analyzers.list", analyzersCodes);

    for(iter = analyzersCodes.begin(); iter != analyzersCodes.end(); ++iter) {

        string type = config.getString("analyzers.list."+(*iter)+".type");

        if(config.has("analyzers.list."+(*iter)+".disabled")) {
            poco_information_f2(Logger::get(_loggerName),
                "analyzer type of [%s] with code [%s] disabled",
                type, string(*iter));
            continue;
        }

        if(_fabrics->isClass(type)) {

            poco_information_f1(Logger::get(_loggerName), "create analyzer for type [%s]", type);

            Analyzer::Arguments  args(*iter, config);
            Analyzer *a = _fabrics->create(type, args);

            poco_information_f2(Logger::get(_loggerName),
                "starting analyzer type of [%s] with code [%s]",
                type, string(a->getCode()));

            try {
                a->start();
                _analyzers.insert(pair<string, SharedPtr<Analyzer> >(*iter, a));
            }
            catch(exception &e) {
                delete a;
            }
        }
        else {
            poco_warning_f1(Logger::get(_loggerName), "unknown analyzer type [%s]... skip this.", type);
        }
    }

    poco_information_f1(Logger::get(_loggerName), "[%d] analyzers was registered", (int)_analyzers.size());
}