Back to index

nordugrid-arc-nox  1.1.0~rc6
conf_cache.h
Go to the documentation of this file.
00001 #ifndef __GM_CONFIG_CACHE_H__
00002 #define __GM_CONFIG_CACHE_H__
00003 
00004 #include <string>
00005 #include <fstream>
00006 
00007 #include <arc/StringConv.h>
00008 #include <arc/XMLNode.h>
00009 
00010 #include "conf.h"
00011 #include "environment.h"
00012 #include "gridmap.h"
00013 #include "conf_sections.h"
00014 
00018 class CacheConfigException : public std::exception {
00019 private:
00020   std::string _desc;
00021   
00022 public:
00023   CacheConfigException(std::string desc = ""): _desc(desc) {};
00024   ~CacheConfigException() throw() {};
00025   std::string what() {return _desc;};
00026 };
00027 
00031 class CacheConfig {
00032  private:
00036    std::vector<std::string> _cache_dirs;
00040    std::vector<std::string> _remote_cache_dirs;
00041    int _cache_max;
00042    int _cache_min;
00046    std::vector<std::string> _draining_cache_dirs;
00050    std::string _log_level;
00051  public:
00057   CacheConfig(std::string username = "");
00061   void parseINIConf(std::string username, ConfigSections* cf);
00062   void parseXMLConf(std::string username, Arc::XMLNode cfg);
00063   std::vector<std::string> getCacheDirs() { return _cache_dirs; };
00064   std::vector<std::string> getRemoteCacheDirs() { return _remote_cache_dirs; };
00065   std::vector<std::string> getDrainingCacheDirs() { return _draining_cache_dirs; };
00069   void setCacheDirs(std::vector<std::string> cache_dirs) { _cache_dirs = cache_dirs; };
00070   void setRemoteCacheDirs(std::vector<std::string> remote_cache_dirs) { _remote_cache_dirs = remote_cache_dirs; };
00071   void setDrainingCacheDirs(std::vector<std::string> draining_cache_dirs) { _draining_cache_dirs = draining_cache_dirs; }; 
00072   int getCacheMax() { return _cache_max; };
00073   int getCacheMin() { return _cache_min; };
00074   bool cleanCache() { return _cache_max < 100; };
00075   std::string getLogLevel() { return _log_level; };
00076 };
00077 
00078 #endif /*__GM_CONFIG_CACHE_H__*/