Back to index

nordugrid-arc-nox  1.1.0~rc6
janitor.h
Go to the documentation of this file.
00001 #include <string>
00002 
00003 #include <arc/Thread.h>
00004 
00006 class Janitor {
00007  public:
00008   typedef enum {
00009     DEPLOYED,
00010     REMOVED,
00011     NOTENABLED,
00012     FAILED
00013   } Result;
00014  private:
00015   bool enabled_;
00016   std::string path_;
00017   std::string id_;
00018   std::string cdir_;
00019   bool running_;
00020   Result result_;
00021   Arc::SimpleCondition completed_;
00022   Arc::SimpleCondition cancel_;
00023   static void deploy_thread(void* arg);
00024   static void remove_thread(void* arg);
00025   void cancel(void);
00026   bool readConfig();
00027  public:
00029 
00032   Janitor(const std::string& id,const std::string& cdir);
00033   ~Janitor(void);
00035   bool enabled() { return enabled_; };
00037   operator bool(void) { return !path_.empty(); };
00039   bool operator!(void) { return path_.empty(); };
00041 
00046   bool deploy(void);
00048 
00053   bool remove(void);
00055 
00059   bool wait(int timeout);
00061 
00062   Result result(void);
00063 };
00064