Back to index

nordugrid-arc-nox  1.1.0~rc6
Loader.cpp
Go to the documentation of this file.
00001 #ifdef HAVE_CONFIG_H
00002 #include <config.h>
00003 #endif
00004 
00005 #include <arc/Logger.h>
00006 #include <arc/StringConv.h>
00007 
00008 #include "Loader.h"
00009 
00010 namespace Arc {
00011 
00012   Logger Loader::logger(Logger::rootLogger, "Loader");
00013 
00014   Loader::~Loader(void) {
00015     if(factory_) delete factory_;
00016   }
00017 
00018   Loader::Loader(XMLNode cfg) {
00019     factory_    = new PluginsFactory(cfg);
00020     for(int n = 0;; ++n) {
00021       XMLNode cn = cfg.Child(n);
00022       if(!cn) break;
00023 
00024       if(MatchXMLName(cn, "ModuleManager")) {
00025         continue;
00026       }
00027 
00028       if(MatchXMLName(cn, "Plugins")) {
00029         XMLNode n;
00030         for (int i = 0; (n = cn["Name"][i]) != false; i++) { 
00031             std::string name = (std::string)n;
00032             factory_->load(name);
00033         }
00034       }
00035 
00036       // Configuration processing is split to multiple functions - hence
00037       // ignoring all unknown elements.
00038       //logger.msg(WARNING, "Unknown element \"%s\" - ignoring", cn.Name());
00039     }
00040 
00041   }
00042 
00043 } // namespace Arc