Back to index

nordugrid-arc-nox  1.1.0~rc6
TargetGenerator.h
Go to the documentation of this file.
00001 // -*- indent-tabs-mode: nil -*-
00002 
00003 #ifndef __ARC_TARGETGENERATOR_H__
00004 #define __ARC_TARGETGENERATOR_H__
00005 
00006 #include <list>
00007 #include <string>
00008 
00009 
00010 #include <arc/Thread.h>
00011 #include <arc/UserConfig.h>
00012 #include <arc/client/ExecutionTarget.h>
00013 #include <arc/client/Job.h>
00014 #include <arc/client/TargetRetriever.h>
00015 
00016 namespace Arc {
00017 
00018   class Config;
00019   class Logger;
00020   class URL;
00021 
00023 
00036   class TargetGenerator {
00037   public:
00039 
00051     TargetGenerator(const UserConfig& usercfg); ~TargetGenerator();
00052 
00054 
00065     void GetTargets(int targetType, int detailLevel);
00066 
00068 
00072     const std::list<ExecutionTarget>& FoundTargets() const;
00073     
00075 
00079     std::list<ExecutionTarget>& ModifyFoundTargets();
00080     
00082 
00086     const std::list<XMLNode*>& FoundJobs() const;
00087     
00089 
00098     bool AddService(const URL& url);
00099     
00101 
00111     bool AddIndexServer(const URL& url);
00112     
00114 
00121     void AddTarget(const ExecutionTarget& target);
00122     
00124 
00131     // XMLNode is reference by itself - passing it as const& has no sense
00132     void AddJob(const XMLNode& job);
00133     
00135 
00139     void RetrieverDone();
00140 
00142 
00148     void PrintTargetInfo(bool longlist) const;
00149 
00150   private:
00151     TargetRetrieverLoader loader;
00152 
00153     const UserConfig& usercfg;
00154 
00155     std::list<URL> foundServices;
00156     std::list<URL> foundIndexServers;
00157     std::list<ExecutionTarget> foundTargets;
00158     std::list<XMLNode*> foundJobs;
00159 
00160     Glib::Mutex serviceMutex;
00161     Glib::Mutex indexServerMutex;
00162     Glib::Mutex targetMutex;
00163     Glib::Mutex jobMutex;
00164 
00165     int threadCounter;
00166     Glib::Mutex threadMutex;
00167     Glib::Cond threadCond;
00168 
00169     static Logger logger;
00170   };
00171 
00172 } // namespace Arc
00173 
00174 #endif // __ARC_TARGETGENERATOR_H__