1 /* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */ 2 3 #ifndef CONFIGOBJECTUTILITY_H 4 #define CONFIGOBJECTUTILITY_H 5 6 #include "remote/i2-remote.hpp" 7 #include "base/array.hpp" 8 #include "base/configobject.hpp" 9 #include "base/dictionary.hpp" 10 #include "base/type.hpp" 11 12 namespace icinga 13 { 14 15 /** 16 * Helper functions. 17 * 18 * @ingroup remote 19 */ 20 class ConfigObjectUtility 21 { 22 23 public: 24 static String GetConfigDir(); 25 static String GetObjectConfigPath(const Type::Ptr& type, const String& fullName); 26 static void RepairPackage(const String& package); 27 static void CreateStorage(); 28 29 static String CreateObjectConfig(const Type::Ptr& type, const String& fullName, 30 bool ignoreOnError, const Array::Ptr& templates, const Dictionary::Ptr& attrs); 31 32 static bool CreateObject(const Type::Ptr& type, const String& fullName, 33 const String& config, const Array::Ptr& errors, const Array::Ptr& diagnosticInformation, const Value& cookie = Empty); 34 35 static bool DeleteObject(const ConfigObject::Ptr& object, bool cascade, const Array::Ptr& errors, 36 const Array::Ptr& diagnosticInformation, const Value& cookie = Empty); 37 38 private: 39 static String EscapeName(const String& name); 40 static bool DeleteObjectHelper(const ConfigObject::Ptr& object, bool cascade, const Array::Ptr& errors, 41 const Array::Ptr& diagnosticInformation, const Value& cookie = Empty); 42 }; 43 44 } 45 46 #endif /* CONFIGOBJECTUTILITY_H */ 47