From: Gunnar Beutner Date: Sat, 15 Aug 2015 18:28:05 +0000 (+0200) Subject: Rename DynamicObject/DynamicType to ConfigObject/ConfigType X-Git-Tag: v2.4.0~415 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=071d2f18fb41f2edd94c2222fb5ee436c0d16d21;p=icinga2 Rename DynamicObject/DynamicType to ConfigObject/ConfigType fixes #9914 --- diff --git a/lib/base/CMakeLists.txt b/lib/base/CMakeLists.txt index 6fcd8a99b..853068f47 100644 --- a/lib/base/CMakeLists.txt +++ b/lib/base/CMakeLists.txt @@ -16,7 +16,7 @@ # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. mkclass_target(application.ti application.tcpp application.thpp) -mkclass_target(dynamicobject.ti dynamicobject.tcpp dynamicobject.thpp) +mkclass_target(configobject.ti configobject.tcpp configobject.thpp) mkclass_target(filelogger.ti filelogger.tcpp filelogger.thpp) mkclass_target(logger.ti logger.tcpp logger.thpp) mkclass_target(streamlogger.ti streamlogger.tcpp streamlogger.thpp) @@ -26,7 +26,7 @@ set(base_SOURCES application.cpp application.thpp application-version.cpp array.cpp array-script.cpp boolean.cpp boolean-script.cpp console.cpp context.cpp convert.cpp debuginfo.cpp dictionary.cpp dictionary-script.cpp - dynamicobject.cpp dynamicobject.thpp dynamicobject-script.cpp dynamictype.cpp + configobject.cpp configobject.thpp configobject-script.cpp configtype.cpp exception.cpp fifo.cpp filelogger.cpp filelogger.thpp initialize.cpp json.cpp json-script.cpp loader.cpp logger.cpp logger.thpp math-script.cpp netstring.cpp networkstream.cpp number.cpp number-script.cpp object.cpp diff --git a/lib/base/application.cpp b/lib/base/application.cpp index 9a42f6989..a11e722a7 100644 --- a/lib/base/application.cpp +++ b/lib/base/application.cpp @@ -102,7 +102,7 @@ void Application::Stop(void) } else ClosePidFile(true); - DynamicObject::Stop(); + ConfigObject::Stop(); } Application::~Application(void) @@ -318,7 +318,7 @@ mainloop: Log(LogInformation, "Application", "Shutting down..."); - DynamicObject::StopObjects(); + ConfigObject::StopObjects(); Application::GetInstance()->OnShutdown(); UninitializeBase(); diff --git a/lib/base/application.ti b/lib/base/application.ti index f22ea6694..191158278 100644 --- a/lib/base/application.ti +++ b/lib/base/application.ti @@ -17,14 +17,14 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" library base; namespace icinga { -abstract class Application : DynamicObject +abstract class Application : ConfigObject { }; diff --git a/lib/base/dynamicobject-script.cpp b/lib/base/configobject-script.cpp similarity index 81% rename from lib/base/dynamicobject-script.cpp rename to lib/base/configobject-script.cpp index 514359c8d..bf112e33f 100644 --- a/lib/base/dynamicobject-script.cpp +++ b/lib/base/configobject-script.cpp @@ -17,7 +17,7 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" #include "base/dictionary.hpp" #include "base/function.hpp" #include "base/functionwrapper.hpp" @@ -25,28 +25,28 @@ using namespace icinga; -static void DynamicObjectModifyAttribute(const String& attr, const Value& value) +static void ConfigObjectModifyAttribute(const String& attr, const Value& value) { ScriptFrame *vframe = ScriptFrame::GetCurrentFrame(); - DynamicObject::Ptr self = vframe->Self; + ConfigObject::Ptr self = vframe->Self; return self->ModifyAttribute(attr, value); } -static void DynamicObjectRestoreAttribute(const String& attr) +static void ConfigObjectRestoreAttribute(const String& attr) { ScriptFrame *vframe = ScriptFrame::GetCurrentFrame(); - DynamicObject::Ptr self = vframe->Self; + ConfigObject::Ptr self = vframe->Self; return self->RestoreAttribute(attr); } -Object::Ptr DynamicObject::GetPrototype(void) +Object::Ptr ConfigObject::GetPrototype(void) { static Dictionary::Ptr prototype; if (!prototype) { prototype = new Dictionary(); - prototype->Set("modify_attribute", new Function(WrapFunction(DynamicObjectModifyAttribute), false)); - prototype->Set("restore_attribute", new Function(WrapFunction(DynamicObjectRestoreAttribute), false)); + prototype->Set("modify_attribute", new Function(WrapFunction(ConfigObjectModifyAttribute), false)); + prototype->Set("restore_attribute", new Function(WrapFunction(ConfigObjectRestoreAttribute), false)); } return prototype; diff --git a/lib/base/dynamicobject.cpp b/lib/base/configobject.cpp similarity index 73% rename from lib/base/dynamicobject.cpp rename to lib/base/configobject.cpp index 91175af36..16f8f3341 100644 --- a/lib/base/dynamicobject.cpp +++ b/lib/base/configobject.cpp @@ -17,9 +17,9 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -#include "base/dynamicobject.hpp" -#include "base/dynamicobject.tcpp" -#include "base/dynamictype.hpp" +#include "base/configobject.hpp" +#include "base/configobject.tcpp" +#include "base/configtype.hpp" #include "base/serializer.hpp" #include "base/netstring.hpp" #include "base/json.hpp" @@ -42,29 +42,29 @@ using namespace icinga; -REGISTER_TYPE_WITH_PROTOTYPE(DynamicObject, DynamicObject::GetPrototype()); +REGISTER_TYPE_WITH_PROTOTYPE(ConfigObject, ConfigObject::GetPrototype()); -boost::signals2::signal DynamicObject::OnStateChanged; +boost::signals2::signal ConfigObject::OnStateChanged; -DynamicObject::DynamicObject(void) +ConfigObject::ConfigObject(void) { } -DynamicType::Ptr DynamicObject::GetType(void) const +ConfigType::Ptr ConfigObject::GetType(void) const { - return DynamicType::GetByName(GetTypeNameV()); + return ConfigType::GetByName(GetTypeNameV()); } -bool DynamicObject::IsActive(void) const +bool ConfigObject::IsActive(void) const { return GetActive(); } -bool DynamicObject::IsPaused(void) const +bool ConfigObject::IsPaused(void) const { return GetPaused(); } -void DynamicObject::SetExtension(const String& key, const Value& value) +void ConfigObject::SetExtension(const String& key, const Value& value) { Dictionary::Ptr extensions = GetExtensions(); @@ -76,7 +76,7 @@ void DynamicObject::SetExtension(const String& key, const Value& value) extensions->Set(key, value); } -Value DynamicObject::GetExtension(const String& key) +Value ConfigObject::GetExtension(const String& key) { Dictionary::Ptr extensions = GetExtensions(); @@ -86,7 +86,7 @@ Value DynamicObject::GetExtension(const String& key) return extensions->Get(key); } -void DynamicObject::ClearExtension(const String& key) +void ConfigObject::ClearExtension(const String& key) { Dictionary::Ptr extensions = GetExtensions(); @@ -101,7 +101,7 @@ class ModAttrValidationUtils : public ValidationUtils public: virtual bool ValidateName(const String& type, const String& name) const override { - DynamicType::Ptr dtype = DynamicType::GetByName(type); + ConfigType::Ptr dtype = ConfigType::GetByName(type); if (!dtype) return false; @@ -113,7 +113,7 @@ public: } }; -void DynamicObject::ModifyAttribute(const String& attr, const Value& value) +void ConfigObject::ModifyAttribute(const String& attr, const Value& value) { Dictionary::Ptr original_attributes = GetOriginalAttributes(); bool updated_original_attributes = false; @@ -146,7 +146,7 @@ void DynamicObject::ModifyAttribute(const String& attr, const Value& value) NotifyOriginalAttributes(); } -void DynamicObject::RestoreAttribute(const String& attr) +void ConfigObject::RestoreAttribute(const String& attr) { Dictionary::Ptr original_attributes = GetOriginalAttributes(); @@ -159,7 +159,7 @@ void DynamicObject::RestoreAttribute(const String& attr) original_attributes->Remove(attr); } -bool DynamicObject::IsAttributeModified(const String& attr) const +bool ConfigObject::IsAttributeModified(const String& attr) const { Dictionary::Ptr original_attributes = GetOriginalAttributes(); @@ -169,23 +169,23 @@ bool DynamicObject::IsAttributeModified(const String& attr) const return original_attributes->Contains(attr); } -void DynamicObject::Register(void) +void ConfigObject::Register(void) { ASSERT(!OwnsLock()); - DynamicType::Ptr dtype = GetType(); + ConfigType::Ptr dtype = GetType(); dtype->RegisterObject(this); } -void DynamicObject::Unregister(void) +void ConfigObject::Unregister(void) { ASSERT(!OwnsLock()); - DynamicType::Ptr dtype = GetType(); + ConfigType::Ptr dtype = GetType(); dtype->UnregisterObject(this); } -void DynamicObject::Start(void) +void ConfigObject::Start(void) { ASSERT(!OwnsLock()); ObjectLock olock(this); @@ -193,7 +193,7 @@ void DynamicObject::Start(void) SetStartCalled(true); } -void DynamicObject::Activate(void) +void ConfigObject::Activate(void) { CONTEXT("Activating object '" + GetName() + "' of type '" + GetType()->GetName() + "'"); @@ -214,7 +214,7 @@ void DynamicObject::Activate(void) NotifyActive(); } -void DynamicObject::Stop(void) +void ConfigObject::Stop(void) { ASSERT(!OwnsLock()); ObjectLock olock(this); @@ -222,7 +222,7 @@ void DynamicObject::Stop(void) SetStopCalled(true); } -void DynamicObject::Deactivate(void) +void ConfigObject::Deactivate(void) { CONTEXT("Deactivating object '" + GetName() + "' of type '" + GetType()->GetName() + "'"); @@ -246,37 +246,37 @@ void DynamicObject::Deactivate(void) NotifyActive(); } -void DynamicObject::OnConfigLoaded(void) +void ConfigObject::OnConfigLoaded(void) { /* Nothing to do here. */ } -void DynamicObject::OnAllConfigLoaded(void) +void ConfigObject::OnAllConfigLoaded(void) { /* Nothing to do here. */ } -void DynamicObject::CreateChildObjects(const Type::Ptr& childType) +void ConfigObject::CreateChildObjects(const Type::Ptr& childType) { /* Nothing to do here. */ } -void DynamicObject::OnStateLoaded(void) +void ConfigObject::OnStateLoaded(void) { /* Nothing to do here. */ } -void DynamicObject::Pause(void) +void ConfigObject::Pause(void) { SetPauseCalled(true); } -void DynamicObject::Resume(void) +void ConfigObject::Resume(void) { SetResumeCalled(true); } -void DynamicObject::SetAuthority(bool authority) +void ConfigObject::SetAuthority(bool authority) { if (authority && GetPaused()) { SetResumeCalled(false); @@ -291,9 +291,9 @@ void DynamicObject::SetAuthority(bool authority) } } -void DynamicObject::DumpObjects(const String& filename, int attributeTypes) +void ConfigObject::DumpObjects(const String& filename, int attributeTypes) { - Log(LogInformation, "DynamicObject") + Log(LogInformation, "ConfigObject") << "Dumping program state to file '" << filename << "'"; String tempFilename = filename + ".tmp"; @@ -306,8 +306,8 @@ void DynamicObject::DumpObjects(const String& filename, int attributeTypes) StdioStream::Ptr sfp = new StdioStream(&fp, false); - BOOST_FOREACH(const DynamicType::Ptr& type, DynamicType::GetTypes()) { - BOOST_FOREACH(const DynamicObject::Ptr& object, type->GetObjects()) { + BOOST_FOREACH(const ConfigType::Ptr& type, ConfigType::GetTypes()) { + BOOST_FOREACH(const ConfigObject::Ptr& object, type->GetObjects()) { Dictionary::Ptr persistentObject = new Dictionary(); persistentObject->Set("type", type->GetName()); @@ -342,27 +342,27 @@ void DynamicObject::DumpObjects(const String& filename, int attributeTypes) } } -void DynamicObject::RestoreObject(const String& message, int attributeTypes) +void ConfigObject::RestoreObject(const String& message, int attributeTypes) { Dictionary::Ptr persistentObject = JsonDecode(message); String type = persistentObject->Get("type"); - DynamicType::Ptr dt = DynamicType::GetByName(type); + ConfigType::Ptr dt = ConfigType::GetByName(type); if (!dt) return; String name = persistentObject->Get("name"); - DynamicObject::Ptr object = dt->GetObject(name); + ConfigObject::Ptr object = dt->GetObject(name); if (!object) return; ASSERT(!object->IsActive()); #ifdef I2_DEBUG - Log(LogDebug, "DynamicObject") + Log(LogDebug, "ConfigObject") << "Restoring object '" << name << "' of type '" << type << "'."; #endif /* I2_DEBUG */ Dictionary::Ptr update = persistentObject->Get("update"); @@ -371,12 +371,12 @@ void DynamicObject::RestoreObject(const String& message, int attributeTypes) object->SetStateLoaded(true); } -void DynamicObject::RestoreObjects(const String& filename, int attributeTypes) +void ConfigObject::RestoreObjects(const String& filename, int attributeTypes) { if (!Utility::PathExists(filename)) return; - Log(LogInformation, "DynamicObject") + Log(LogInformation, "ConfigObject") << "Restoring program state from file '" << filename << "'"; std::fstream fp; @@ -399,7 +399,7 @@ void DynamicObject::RestoreObjects(const String& filename, int attributeTypes) if (srs != StatusNewItem) continue; - upq.Enqueue(boost::bind(&DynamicObject::RestoreObject, message, attributeTypes)); + upq.Enqueue(boost::bind(&ConfigObject::RestoreObject, message, attributeTypes)); restored++; } @@ -409,8 +409,8 @@ void DynamicObject::RestoreObjects(const String& filename, int attributeTypes) unsigned long no_state = 0; - BOOST_FOREACH(const DynamicType::Ptr& type, DynamicType::GetTypes()) { - BOOST_FOREACH(const DynamicObject::Ptr& object, type->GetObjects()) { + BOOST_FOREACH(const ConfigType::Ptr& type, ConfigType::GetTypes()) { + BOOST_FOREACH(const ConfigObject::Ptr& object, type->GetObjects()) { if (!object->GetStateLoaded()) { object->OnStateLoaded(); object->SetStateLoaded(true); @@ -420,23 +420,23 @@ void DynamicObject::RestoreObjects(const String& filename, int attributeTypes) } } - Log(LogInformation, "DynamicObject") + Log(LogInformation, "ConfigObject") << "Restored " << restored << " objects. Loaded " << no_state << " new objects without state."; } -void DynamicObject::StopObjects(void) +void ConfigObject::StopObjects(void) { - BOOST_FOREACH(const DynamicType::Ptr& dt, DynamicType::GetTypes()) { - BOOST_FOREACH(const DynamicObject::Ptr& object, dt->GetObjects()) { + BOOST_FOREACH(const ConfigType::Ptr& dt, ConfigType::GetTypes()) { + BOOST_FOREACH(const ConfigObject::Ptr& object, dt->GetObjects()) { object->Deactivate(); } } } -void DynamicObject::DumpModifiedAttributes(const boost::function& callback) +void ConfigObject::DumpModifiedAttributes(const boost::function& callback) { - BOOST_FOREACH(const DynamicType::Ptr& dt, DynamicType::GetTypes()) { - BOOST_FOREACH(const DynamicObject::Ptr& object, dt->GetObjects()) { + BOOST_FOREACH(const ConfigType::Ptr& dt, ConfigType::GetTypes()) { + BOOST_FOREACH(const ConfigObject::Ptr& object, dt->GetObjects()) { Dictionary::Ptr originalAttributes = object->GetOriginalAttributes(); if (!originalAttributes) @@ -454,8 +454,8 @@ void DynamicObject::DumpModifiedAttributes(const boost::functionGetObject(name); } diff --git a/lib/base/dynamicobject.hpp b/lib/base/configobject.hpp similarity index 85% rename from lib/base/dynamicobject.hpp rename to lib/base/configobject.hpp index 8bca65ef2..5885621f2 100644 --- a/lib/base/dynamicobject.hpp +++ b/lib/base/configobject.hpp @@ -21,7 +21,7 @@ #define DYNAMICOBJECT_H #include "base/i2-base.hpp" -#include "base/dynamicobject.thpp" +#include "base/configobject.thpp" #include "base/object.hpp" #include "base/type.hpp" #include "base/dictionary.hpp" @@ -30,21 +30,21 @@ namespace icinga { -class DynamicType; +class ConfigType; /** * A dynamic object that can be instantiated from the configuration file. * * @ingroup base */ -class I2_BASE_API DynamicObject : public ObjectImpl +class I2_BASE_API ConfigObject : public ObjectImpl { public: - DECLARE_OBJECT(DynamicObject); + DECLARE_OBJECT(ConfigObject); - static boost::signals2::signal OnStateChanged; + static boost::signals2::signal OnStateChanged; - intrusive_ptr GetType(void) const; + intrusive_ptr GetType(void) const; bool IsActive(void) const; bool IsPaused(void) const; @@ -78,7 +78,7 @@ public: template static intrusive_ptr GetObject(const String& name) { - DynamicObject::Ptr object = GetObject(T::GetTypeName(), name); + ConfigObject::Ptr object = GetObject(T::GetTypeName(), name); return static_pointer_cast(object); } @@ -87,15 +87,15 @@ public: static void RestoreObjects(const String& filename, int attributeTypes = FAState); static void StopObjects(void); - static void DumpModifiedAttributes(const boost::function& callback); + static void DumpModifiedAttributes(const boost::function& callback); static Object::Ptr GetPrototype(void); protected: - explicit DynamicObject(void); + explicit ConfigObject(void); private: - static DynamicObject::Ptr GetObject(const String& type, const String& name); + static ConfigObject::Ptr GetObject(const String& type, const String& name); static void RestoreObject(const String& message, int attributeTypes); }; @@ -107,7 +107,7 @@ private: \ inline static intrusive_ptr GetByName(const String& name) \ { \ - return DynamicObject::GetObject(name); \ + return ConfigObject::GetObject(name); \ } } diff --git a/lib/base/dynamicobject.ti b/lib/base/configobject.ti similarity index 94% rename from lib/base/dynamicobject.ti rename to lib/base/configobject.ti index c45dfc50f..209807629 100644 --- a/lib/base/dynamicobject.ti +++ b/lib/base/configobject.ti @@ -38,11 +38,11 @@ public: }; }}} -abstract class DynamicObjectBase +abstract class ConfigObjectBase { }; code {{{ -class I2_BASE_API DynamicObjectBase : public ObjectImpl +class I2_BASE_API ConfigObjectBase : public ObjectImpl { public: inline DebugInfo GetDebugInfo(void) const @@ -60,7 +60,7 @@ private: }; }}} -abstract class DynamicObject : DynamicObjectBase +abstract class ConfigObject : ConfigObjectBase { [config, internal] String __name (Name); [config] String "name" (ShortName) { diff --git a/lib/base/dynamictype.cpp b/lib/base/configtype.cpp similarity index 70% rename from lib/base/dynamictype.cpp rename to lib/base/configtype.cpp index e6386dcd8..90555f992 100644 --- a/lib/base/dynamictype.cpp +++ b/lib/base/configtype.cpp @@ -17,7 +17,7 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/serializer.hpp" #include "base/debug.hpp" #include "base/objectlock.hpp" @@ -26,26 +26,26 @@ using namespace icinga; -DynamicType::DynamicType(const String& name) +ConfigType::ConfigType(const String& name) : m_Name(name) { InflateMutex(); } -DynamicType::Ptr DynamicType::GetByName(const String& name) +ConfigType::Ptr ConfigType::GetByName(const String& name) { boost::mutex::scoped_lock lock(GetStaticMutex()); - DynamicType::TypeMap::const_iterator tt = InternalGetTypeMap().find(name); + ConfigType::TypeMap::const_iterator tt = InternalGetTypeMap().find(name); if (tt == InternalGetTypeMap().end()) { Type::Ptr type = Type::GetByName(name); - if (!type || !DynamicObject::TypeInstance->IsAssignableFrom(type) + if (!type || !ConfigObject::TypeInstance->IsAssignableFrom(type) || type->IsAbstract()) - return DynamicType::Ptr(); + return ConfigType::Ptr(); - DynamicType::Ptr dtype = new DynamicType(name); + ConfigType::Ptr dtype = new ConfigType(name); InternalGetTypeMap()[type->GetName()] = dtype; InternalGetTypeVector().push_back(dtype); @@ -57,40 +57,40 @@ DynamicType::Ptr DynamicType::GetByName(const String& name) } /** - * Note: Caller must hold DynamicType::GetStaticMutex() while using the map. + * Note: Caller must hold ConfigType::GetStaticMutex() while using the map. */ -DynamicType::TypeMap& DynamicType::InternalGetTypeMap(void) +ConfigType::TypeMap& ConfigType::InternalGetTypeMap(void) { - static DynamicType::TypeMap typemap; + static ConfigType::TypeMap typemap; return typemap; } -DynamicType::TypeVector& DynamicType::InternalGetTypeVector(void) +ConfigType::TypeVector& ConfigType::InternalGetTypeVector(void) { - static DynamicType::TypeVector typevector; + static ConfigType::TypeVector typevector; return typevector; } -DynamicType::TypeVector DynamicType::GetTypes(void) +ConfigType::TypeVector ConfigType::GetTypes(void) { boost::mutex::scoped_lock lock(GetStaticMutex()); return InternalGetTypeVector(); /* Making a copy of the vector here. */ } -std::pair, DynamicTypeIterator > DynamicType::GetObjects(void) +std::pair, ConfigTypeIterator > ConfigType::GetObjects(void) { return std::make_pair( - DynamicTypeIterator(this, 0), - DynamicTypeIterator(this, -1) + ConfigTypeIterator(this, 0), + ConfigTypeIterator(this, -1) ); } -String DynamicType::GetName(void) const +String ConfigType::GetName(void) const { return m_Name; } -void DynamicType::RegisterObject(const DynamicObject::Ptr& object) +void ConfigType::RegisterObject(const ConfigObject::Ptr& object) { String name = object->GetName(); @@ -113,7 +113,7 @@ void DynamicType::RegisterObject(const DynamicObject::Ptr& object) } } -void DynamicType::UnregisterObject(const DynamicObject::Ptr& object) +void ConfigType::UnregisterObject(const ConfigObject::Ptr& object) { String name = object->GetName(); @@ -125,19 +125,19 @@ void DynamicType::UnregisterObject(const DynamicObject::Ptr& object) } } -DynamicObject::Ptr DynamicType::GetObject(const String& name) const +ConfigObject::Ptr ConfigType::GetObject(const String& name) const { ObjectLock olock(this); - DynamicType::ObjectMap::const_iterator nt = m_ObjectMap.find(name); + ConfigType::ObjectMap::const_iterator nt = m_ObjectMap.find(name); if (nt == m_ObjectMap.end()) - return DynamicObject::Ptr(); + return ConfigObject::Ptr(); return nt->second; } -boost::mutex& DynamicType::GetStaticMutex(void) +boost::mutex& ConfigType::GetStaticMutex(void) { static boost::mutex mutex; return mutex; diff --git a/lib/base/dynamictype.hpp b/lib/base/configtype.hpp similarity index 66% rename from lib/base/dynamictype.hpp rename to lib/base/configtype.hpp index 9670857e2..6624fed7f 100644 --- a/lib/base/dynamictype.hpp +++ b/lib/base/configtype.hpp @@ -21,7 +21,7 @@ #define DYNAMICTYPE_H #include "base/i2-base.hpp" -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" #include "base/objectlock.hpp" #include # include @@ -30,50 +30,50 @@ namespace icinga { template -class DynamicTypeIterator; +class ConfigTypeIterator; -class I2_BASE_API DynamicType : public Object +class I2_BASE_API ConfigType : public Object { public: - DECLARE_PTR_TYPEDEFS(DynamicType); + DECLARE_PTR_TYPEDEFS(ConfigType); - DynamicType(const String& name); + ConfigType(const String& name); String GetName(void) const; - static DynamicType::Ptr GetByName(const String& name); + static ConfigType::Ptr GetByName(const String& name); - DynamicObject::Ptr GetObject(const String& name) const; + ConfigObject::Ptr GetObject(const String& name) const; - void RegisterObject(const DynamicObject::Ptr& object); - void UnregisterObject(const DynamicObject::Ptr& object); + void RegisterObject(const ConfigObject::Ptr& object); + void UnregisterObject(const ConfigObject::Ptr& object); - static std::vector GetTypes(void); - std::pair, DynamicTypeIterator > GetObjects(void); + static std::vector GetTypes(void); + std::pair, ConfigTypeIterator > GetObjects(void); template - static std::pair, DynamicTypeIterator > GetObjectsByType(void) + static std::pair, ConfigTypeIterator > GetObjectsByType(void) { - DynamicType::Ptr type = GetByName(T::GetTypeName()); + ConfigType::Ptr type = GetByName(T::GetTypeName()); return std::make_pair( - DynamicTypeIterator(type, 0), - DynamicTypeIterator(type, UINT_MAX) + ConfigTypeIterator(type, 0), + ConfigTypeIterator(type, UINT_MAX) ); } private: - template friend class DynamicTypeIterator; + template friend class ConfigTypeIterator; String m_Name; - typedef std::map ObjectMap; - typedef std::vector ObjectVector; + typedef std::map ObjectMap; + typedef std::vector ObjectVector; ObjectMap m_ObjectMap; ObjectVector m_ObjectVector; - typedef std::map TypeMap; - typedef std::vector TypeVector; + typedef std::map TypeMap; + typedef std::vector TypeVector; static TypeMap& InternalGetTypeMap(void); static TypeVector& InternalGetTypeVector(void); @@ -81,18 +81,18 @@ private: }; template -class DynamicTypeIterator : public boost::iterator_facade, const intrusive_ptr, boost::forward_traversal_tag> +class ConfigTypeIterator : public boost::iterator_facade, const intrusive_ptr, boost::forward_traversal_tag> { public: - DynamicTypeIterator(const DynamicType::Ptr& type, int index) + ConfigTypeIterator(const ConfigType::Ptr& type, int index) : m_Type(type), m_Index(index) { } private: friend class boost::iterator_core_access; - DynamicType::Ptr m_Type; - DynamicType::ObjectVector::size_type m_Index; + ConfigType::Ptr m_Type; + ConfigType::ObjectVector::size_type m_Index; mutable intrusive_ptr m_Current; void increment(void) @@ -110,7 +110,7 @@ private: m_Index += n; } - bool equal(const DynamicTypeIterator& other) const + bool equal(const ConfigTypeIterator& other) const { ASSERT(other.m_Type == m_Type); diff --git a/lib/base/exception.cpp b/lib/base/exception.cpp index b48de54ab..42ddcd3db 100644 --- a/lib/base/exception.cpp +++ b/lib/base/exception.cpp @@ -154,7 +154,7 @@ String icinga::DiagnosticInformation(const std::exception& ex, bool verbose, Sta if (vex) { DebugInfo di; - DynamicObject::Ptr dobj = vex->GetObject(); + ConfigObject::Ptr dobj = vex->GetObject(); if (dobj) di = dobj->GetDebugInfo(); @@ -315,7 +315,7 @@ const char *posix_error::what(void) const throw() return m_Message; } -ValidationError::ValidationError(const DynamicObject::Ptr& object, const std::vector& attributePath, const String& message) +ValidationError::ValidationError(const ConfigObject::Ptr& object, const std::vector& attributePath, const String& message) : m_Object(object), m_AttributePath(attributePath), m_Message(message) { String path; @@ -344,7 +344,7 @@ const char *ValidationError::what(void) const throw() return m_What.CStr(); } -DynamicObject::Ptr ValidationError::GetObject(void) const +ConfigObject::Ptr ValidationError::GetObject(void) const { return m_Object; } diff --git a/lib/base/exception.hpp b/lib/base/exception.hpp index daeed9677..d6a9b8470 100644 --- a/lib/base/exception.hpp +++ b/lib/base/exception.hpp @@ -27,7 +27,7 @@ #include "base/utility.hpp" #include "base/debuginfo.hpp" #include "base/dictionary.hpp" -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" #include #include #include @@ -72,12 +72,12 @@ private: class I2_BASE_API ValidationError : virtual public user_error { public: - ValidationError(const DynamicObject::Ptr& object, const std::vector& attributePath, const String& message); + ValidationError(const ConfigObject::Ptr& object, const std::vector& attributePath, const String& message); ~ValidationError(void) throw(); virtual const char *what(void) const throw(); - DynamicObject::Ptr GetObject(void) const; + ConfigObject::Ptr GetObject(void) const; std::vector GetAttributePath(void) const; String GetMessage(void) const; @@ -85,7 +85,7 @@ public: Dictionary::Ptr GetDebugHint(void) const; private: - DynamicObject::Ptr m_Object; + ConfigObject::Ptr m_Object; std::vector m_AttributePath; String m_Message; String m_What; diff --git a/lib/base/filelogger.cpp b/lib/base/filelogger.cpp index ab981bb76..4a80f131e 100644 --- a/lib/base/filelogger.cpp +++ b/lib/base/filelogger.cpp @@ -19,7 +19,7 @@ #include "base/filelogger.hpp" #include "base/filelogger.tcpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/statsfunction.hpp" #include "base/application.hpp" #include @@ -34,7 +34,7 @@ void FileLogger::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr&) { Dictionary::Ptr nodes = new Dictionary(); - BOOST_FOREACH(const FileLogger::Ptr& filelogger, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const FileLogger::Ptr& filelogger, ConfigType::GetObjectsByType()) { nodes->Set(filelogger->GetName(), 1); //add more stats } diff --git a/lib/base/logger.cpp b/lib/base/logger.cpp index 4ffe3ef2b..27151a9cf 100644 --- a/lib/base/logger.cpp +++ b/lib/base/logger.cpp @@ -21,7 +21,7 @@ #include "base/logger.tcpp" #include "base/application.hpp" #include "base/streamlogger.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/utility.hpp" #include "base/objectlock.hpp" #include "base/context.hpp" @@ -54,7 +54,7 @@ void Logger::StaticInitialize(void) */ void Logger::Start(void) { - DynamicObject::Start(); + ConfigObject::Start(); boost::mutex::scoped_lock lock(m_Mutex); m_Loggers.insert(this); @@ -67,7 +67,7 @@ void Logger::Stop(void) m_Loggers.erase(this); } - DynamicObject::Stop(); + ConfigObject::Stop(); } std::set Logger::GetLoggers(void) diff --git a/lib/base/logger.ti b/lib/base/logger.ti index e7c4138fd..4b1ee6343 100644 --- a/lib/base/logger.ti +++ b/lib/base/logger.ti @@ -17,14 +17,14 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" library base; namespace icinga { -abstract class Logger : DynamicObject +abstract class Logger : ConfigObject { [config] String severity; }; diff --git a/lib/base/scriptutils.cpp b/lib/base/scriptutils.cpp index edd58c858..c43525176 100644 --- a/lib/base/scriptutils.cpp +++ b/lib/base/scriptutils.cpp @@ -24,7 +24,7 @@ #include "base/json.hpp" #include "base/logger.hpp" #include "base/objectlock.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/application.hpp" #include #include @@ -251,7 +251,7 @@ Array::Ptr ScriptUtils::Keys(const Dictionary::Ptr& dict) return result; } -DynamicObject::Ptr ScriptUtils::GetObject(const Value& vtype, const String& name) +ConfigObject::Ptr ScriptUtils::GetObject(const Value& vtype, const String& name) { String typeName; @@ -260,24 +260,24 @@ DynamicObject::Ptr ScriptUtils::GetObject(const Value& vtype, const String& name else typeName = vtype; - DynamicType::Ptr dtype = DynamicType::GetByName(typeName); + ConfigType::Ptr dtype = ConfigType::GetByName(typeName); if (!dtype) - return DynamicObject::Ptr(); + return ConfigObject::Ptr(); return dtype->GetObject(name); } Array::Ptr ScriptUtils::GetObjects(const Type::Ptr& type) { - DynamicType::Ptr dtype = DynamicType::GetByName(type->GetName()); + ConfigType::Ptr dtype = ConfigType::GetByName(type->GetName()); if (!dtype) BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid type name")); Array::Ptr result = new Array(); - BOOST_FOREACH(const DynamicObject::Ptr& object, dtype->GetObjects()) + BOOST_FOREACH(const ConfigObject::Ptr& object, dtype->GetObjects()) result->Add(object); return result; diff --git a/lib/base/scriptutils.hpp b/lib/base/scriptutils.hpp index ff36327bc..204ca7761 100644 --- a/lib/base/scriptutils.hpp +++ b/lib/base/scriptutils.hpp @@ -25,7 +25,7 @@ #include "base/array.hpp" #include "base/dictionary.hpp" #include "base/type.hpp" -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" namespace icinga { @@ -47,7 +47,7 @@ public: static Array::Ptr Range(const std::vector& arguments); static Type::Ptr TypeOf(const Value& value); static Array::Ptr Keys(const Dictionary::Ptr& dict); - static DynamicObject::Ptr GetObject(const Value& type, const String& name); + static ConfigObject::Ptr GetObject(const Value& type, const String& name); static Array::Ptr GetObjects(const Type::Ptr& type); static void Assert(const Value& arg); static String MsiGetComponentPathShim(const String& component); diff --git a/lib/base/sysloglogger.cpp b/lib/base/sysloglogger.cpp index 34cffbcdd..b94cc4f67 100644 --- a/lib/base/sysloglogger.cpp +++ b/lib/base/sysloglogger.cpp @@ -18,7 +18,7 @@ ******************************************************************************/ #include "base/sysloglogger.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/statsfunction.hpp" #ifndef _WIN32 @@ -34,7 +34,7 @@ void SyslogLogger::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr&) { Dictionary::Ptr nodes = new Dictionary(); - BOOST_FOREACH(const SyslogLogger::Ptr& sysloglogger, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const SyslogLogger::Ptr& sysloglogger, ConfigType::GetObjectsByType()) { nodes->Set(sysloglogger->GetName(), 1); //add more stats } diff --git a/lib/checker/checkercomponent.cpp b/lib/checker/checkercomponent.cpp index b7b279839..175981384 100644 --- a/lib/checker/checkercomponent.cpp +++ b/lib/checker/checkercomponent.cpp @@ -23,7 +23,7 @@ #include "icinga/cib.hpp" #include "icinga/perfdatavalue.hpp" #include "remote/apilistener.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/objectlock.hpp" #include "base/utility.hpp" #include "base/logger.hpp" @@ -42,7 +42,7 @@ void CheckerComponent::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr { Dictionary::Ptr nodes = new Dictionary(); - BOOST_FOREACH(const CheckerComponent::Ptr& checker, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const CheckerComponent::Ptr& checker, ConfigType::GetObjectsByType()) { unsigned long idle = checker->GetIdleCheckables(); unsigned long pending = checker->GetPendingCheckables(); @@ -66,15 +66,15 @@ CheckerComponent::CheckerComponent(void) void CheckerComponent::OnConfigLoaded(void) { - DynamicObject::OnActiveChanged.connect(bind(&CheckerComponent::ObjectHandler, this, _1)); - DynamicObject::OnPausedChanged.connect(bind(&CheckerComponent::ObjectHandler, this, _1)); + ConfigObject::OnActiveChanged.connect(bind(&CheckerComponent::ObjectHandler, this, _1)); + ConfigObject::OnPausedChanged.connect(bind(&CheckerComponent::ObjectHandler, this, _1)); Checkable::OnNextCheckChanged.connect(bind(&CheckerComponent::NextCheckChangedHandler, this, _1)); } void CheckerComponent::Start(void) { - DynamicObject::Start(); + ConfigObject::Start(); m_Thread = boost::thread(boost::bind(&CheckerComponent::CheckThreadProc, this)); @@ -97,7 +97,7 @@ void CheckerComponent::Stop(void) m_ResultTimer->Stop(); m_Thread.join(); - DynamicObject::Stop(); + ConfigObject::Stop(); } void CheckerComponent::CheckThreadProc(void) @@ -252,7 +252,7 @@ void CheckerComponent::ResultTimerHandler(void) Log(LogNotice, "CheckerComponent", msgbuf.str()); } -void CheckerComponent::ObjectHandler(const DynamicObject::Ptr& object) +void CheckerComponent::ObjectHandler(const ConfigObject::Ptr& object) { Checkable::Ptr checkable = dynamic_pointer_cast(object); diff --git a/lib/checker/checkercomponent.hpp b/lib/checker/checkercomponent.hpp index 9c11dfdc6..e20c9a944 100644 --- a/lib/checker/checkercomponent.hpp +++ b/lib/checker/checkercomponent.hpp @@ -22,7 +22,7 @@ #include "checker/checkercomponent.thpp" #include "icinga/service.hpp" -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" #include "base/timer.hpp" #include "base/utility.hpp" #include @@ -96,7 +96,7 @@ private: void AdjustCheckTimer(void); - void ObjectHandler(const DynamicObject::Ptr& object); + void ObjectHandler(const ConfigObject::Ptr& object); void NextCheckChangedHandler(const Checkable::Ptr& checkable); void RescheduleCheckTimer(void); diff --git a/lib/checker/checkercomponent.ti b/lib/checker/checkercomponent.ti index 492ee312a..62beb8112 100644 --- a/lib/checker/checkercomponent.ti +++ b/lib/checker/checkercomponent.ti @@ -17,14 +17,14 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" library checker; namespace icinga { -class CheckerComponent : DynamicObject +class CheckerComponent : ConfigObject { }; diff --git a/lib/cli/objectlistcommand.cpp b/lib/cli/objectlistcommand.cpp index c503ed364..0856362cb 100644 --- a/lib/cli/objectlistcommand.cpp +++ b/lib/cli/objectlistcommand.cpp @@ -22,8 +22,8 @@ #include "base/logger.hpp" #include "base/application.hpp" #include "base/convert.hpp" -#include "base/dynamicobject.hpp" -#include "base/dynamictype.hpp" +#include "base/configobject.hpp" +#include "base/configtype.hpp" #include "base/json.hpp" #include "base/netstring.hpp" #include "base/stdiostream.hpp" diff --git a/lib/cli/repositoryutility.cpp b/lib/cli/repositoryutility.cpp index d0eb423df..8bb68bb03 100644 --- a/lib/cli/repositoryutility.cpp +++ b/lib/cli/repositoryutility.cpp @@ -236,7 +236,7 @@ bool RepositoryUtility::AddObject(const std::vector& object_paths, const Deserialize(object, attrs, false, FAConfig); RepositoryValidationUtils utils; - static_pointer_cast(object)->Validate(FAConfig, utils); + static_pointer_cast(object)->Validate(FAConfig, utils); } catch (const ScriptError& ex) { Log(LogCritical, "config", DiagnosticInformation(ex)); return false; diff --git a/lib/cli/variablegetcommand.cpp b/lib/cli/variablegetcommand.cpp index 5a90095ec..bc38bdebb 100644 --- a/lib/cli/variablegetcommand.cpp +++ b/lib/cli/variablegetcommand.cpp @@ -22,8 +22,8 @@ #include "base/logger.hpp" #include "base/application.hpp" #include "base/convert.hpp" -#include "base/dynamicobject.hpp" -#include "base/dynamictype.hpp" +#include "base/configobject.hpp" +#include "base/configtype.hpp" #include "base/json.hpp" #include "base/netstring.hpp" #include "base/stdiostream.hpp" diff --git a/lib/cli/variablelistcommand.cpp b/lib/cli/variablelistcommand.cpp index e7662f5c8..e3475cd40 100644 --- a/lib/cli/variablelistcommand.cpp +++ b/lib/cli/variablelistcommand.cpp @@ -22,7 +22,7 @@ #include "base/logger.hpp" #include "base/application.hpp" #include "base/convert.hpp" -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" #include "base/debug.hpp" #include "base/objectlock.hpp" #include "base/console.hpp" diff --git a/lib/compat/checkresultreader.cpp b/lib/compat/checkresultreader.cpp index 1ea5b6f9b..eb344ee70 100644 --- a/lib/compat/checkresultreader.cpp +++ b/lib/compat/checkresultreader.cpp @@ -23,7 +23,7 @@ #include "icinga/service.hpp" #include "icinga/pluginutility.hpp" #include "icinga/icingaapplication.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/objectlock.hpp" #include "base/logger.hpp" #include "base/convert.hpp" @@ -44,7 +44,7 @@ void CheckResultReader::StatsFunc(const Dictionary::Ptr& status, const Array::Pt { Dictionary::Ptr nodes = new Dictionary(); - BOOST_FOREACH(const CheckResultReader::Ptr& checkresultreader, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const CheckResultReader::Ptr& checkresultreader, ConfigType::GetObjectsByType()) { nodes->Set(checkresultreader->GetName(), 1); //add more stats } diff --git a/lib/compat/checkresultreader.ti b/lib/compat/checkresultreader.ti index c0552082f..a57844066 100644 --- a/lib/compat/checkresultreader.ti +++ b/lib/compat/checkresultreader.ti @@ -17,7 +17,7 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" #include "base/application.hpp" library compat; @@ -25,7 +25,7 @@ library compat; namespace icinga { -class CheckResultReader : DynamicObject +class CheckResultReader : ConfigObject { [config] String spool_dir { default {{{ return Application::GetLocalStateDir() + "/lib/icinga2/spool/checkresults/"; }}} diff --git a/lib/compat/compatlogger.cpp b/lib/compat/compatlogger.cpp index 57e40d85d..ff0f38ba6 100644 --- a/lib/compat/compatlogger.cpp +++ b/lib/compat/compatlogger.cpp @@ -26,7 +26,7 @@ #include "icinga/macroprocessor.hpp" #include "icinga/externalcommandprocessor.hpp" #include "icinga/compatutility.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/objectlock.hpp" #include "base/logger.hpp" #include "base/exception.hpp" @@ -47,7 +47,7 @@ void CompatLogger::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr&) { Dictionary::Ptr nodes = new Dictionary(); - BOOST_FOREACH(const CompatLogger::Ptr& compat_logger, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const CompatLogger::Ptr& compat_logger, ConfigType::GetObjectsByType()) { nodes->Set(compat_logger->GetName(), 1); //add more stats } @@ -59,7 +59,7 @@ void CompatLogger::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr&) */ void CompatLogger::Start(void) { - DynamicObject::Start(); + ConfigObject::Start(); Checkable::OnNewCheckResult.connect(bind(&CompatLogger::CheckResultHandler, this, _1, _2)); Checkable::OnNotificationSentToUser.connect(bind(&CompatLogger::NotificationSentHandler, this, _1, _2, _3, _4, _5, _6, _7, _8)); @@ -479,7 +479,7 @@ void CompatLogger::ReopenFile(bool rotate) WriteLine("LOG ROTATION: " + GetRotationMethod()); WriteLine("LOG VERSION: 2.0"); - BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType()) { String output; CheckResult::Ptr cr = host->GetLastCheckResult(); @@ -497,7 +497,7 @@ void CompatLogger::ReopenFile(bool rotate) WriteLine(msgbuf.str()); } - BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const Service::Ptr& service, ConfigType::GetObjectsByType()) { Host::Ptr host = service->GetHost(); String output; diff --git a/lib/compat/compatlogger.ti b/lib/compat/compatlogger.ti index 1313c9c56..9c1e7db77 100644 --- a/lib/compat/compatlogger.ti +++ b/lib/compat/compatlogger.ti @@ -17,7 +17,7 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" #include "base/application.hpp" library compat; @@ -25,7 +25,7 @@ library compat; namespace icinga { -class CompatLogger : DynamicObject +class CompatLogger : ConfigObject { [config] String log_dir { default {{{ return Application::GetLocalStateDir() + "/log/icinga2/compat"; }}} diff --git a/lib/compat/externalcommandlistener.cpp b/lib/compat/externalcommandlistener.cpp index 6c96a4c74..c13696738 100644 --- a/lib/compat/externalcommandlistener.cpp +++ b/lib/compat/externalcommandlistener.cpp @@ -20,7 +20,7 @@ #include "compat/externalcommandlistener.hpp" #include "compat/externalcommandlistener.tcpp" #include "icinga/externalcommandprocessor.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/logger.hpp" #include "base/exception.hpp" #include "base/application.hpp" @@ -36,7 +36,7 @@ void ExternalCommandListener::StatsFunc(const Dictionary::Ptr& status, const Arr { Dictionary::Ptr nodes = new Dictionary(); - BOOST_FOREACH(const ExternalCommandListener::Ptr& externalcommandlistener, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const ExternalCommandListener::Ptr& externalcommandlistener, ConfigType::GetObjectsByType()) { nodes->Set(externalcommandlistener->GetName(), 1); //add more stats } @@ -48,7 +48,7 @@ void ExternalCommandListener::StatsFunc(const Dictionary::Ptr& status, const Arr */ void ExternalCommandListener::Start(void) { - DynamicObject::Start(); + ConfigObject::Start(); #ifndef _WIN32 m_CommandThread = boost::thread(boost::bind(&ExternalCommandListener::CommandPipeThread, this, GetCommandPath())); diff --git a/lib/compat/externalcommandlistener.ti b/lib/compat/externalcommandlistener.ti index b2a562bd0..37af1da3e 100644 --- a/lib/compat/externalcommandlistener.ti +++ b/lib/compat/externalcommandlistener.ti @@ -17,7 +17,7 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" #include "base/application.hpp" library compat; @@ -25,7 +25,7 @@ library compat; namespace icinga { -class ExternalCommandListener : DynamicObject +class ExternalCommandListener : ConfigObject { [config] String command_path { default {{{ return Application::GetRunDir() + "/icinga2/cmd/icinga2.cmd"; }}} diff --git a/lib/compat/statusdatawriter.cpp b/lib/compat/statusdatawriter.cpp index 673a981c4..20f080472 100644 --- a/lib/compat/statusdatawriter.cpp +++ b/lib/compat/statusdatawriter.cpp @@ -29,7 +29,7 @@ #include "icinga/notificationcommand.hpp" #include "icinga/compatutility.hpp" #include "icinga/dependency.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/objectlock.hpp" #include "base/json.hpp" #include "base/convert.hpp" @@ -54,7 +54,7 @@ void StatusDataWriter::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr { Dictionary::Ptr nodes = new Dictionary(); - BOOST_FOREACH(const StatusDataWriter::Ptr& statusdatawriter, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const StatusDataWriter::Ptr& statusdatawriter, ConfigType::GetObjectsByType()) { nodes->Set(statusdatawriter->GetName(), 1); //add more stats } @@ -72,7 +72,7 @@ void StatusDataWriter::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr */ void StatusDataWriter::Start(void) { - DynamicObject::Start(); + ConfigObject::Start(); m_StatusTimer = new Timer(); m_StatusTimer->SetInterval(GetUpdateInterval()); @@ -556,7 +556,7 @@ void StatusDataWriter::UpdateObjectsCache(void) "# This file is auto-generated. Do not modify this file." "\n" "\n"; - BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType()) { std::ostringstream tempobjectfp; tempobjectfp << std::fixed; DumpHostObject(tempobjectfp, host); @@ -570,7 +570,7 @@ void StatusDataWriter::UpdateObjectsCache(void) } } - BOOST_FOREACH(const HostGroup::Ptr& hg, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const HostGroup::Ptr& hg, ConfigType::GetObjectsByType()) { std::ostringstream tempobjectfp; tempobjectfp << std::fixed; @@ -601,7 +601,7 @@ void StatusDataWriter::UpdateObjectsCache(void) objectfp << tempobjectfp.str(); } - BOOST_FOREACH(const ServiceGroup::Ptr& sg, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const ServiceGroup::Ptr& sg, ConfigType::GetObjectsByType()) { std::ostringstream tempobjectfp; tempobjectfp << std::fixed; @@ -642,7 +642,7 @@ void StatusDataWriter::UpdateObjectsCache(void) objectfp << tempobjectfp.str(); } - BOOST_FOREACH(const User::Ptr& user, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const User::Ptr& user, ConfigType::GetObjectsByType()) { std::ostringstream tempobjectfp; tempobjectfp << std::fixed; @@ -670,7 +670,7 @@ void StatusDataWriter::UpdateObjectsCache(void) objectfp << tempobjectfp.str(); } - BOOST_FOREACH(const UserGroup::Ptr& ug, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const UserGroup::Ptr& ug, ConfigType::GetObjectsByType()) { std::ostringstream tempobjectfp; tempobjectfp << std::fixed; @@ -686,23 +686,23 @@ void StatusDataWriter::UpdateObjectsCache(void) objectfp << tempobjectfp.str(); } - BOOST_FOREACH(const Command::Ptr& command, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const Command::Ptr& command, ConfigType::GetObjectsByType()) { DumpCommand(objectfp, command); } - BOOST_FOREACH(const Command::Ptr& command, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const Command::Ptr& command, ConfigType::GetObjectsByType()) { DumpCommand(objectfp, command); } - BOOST_FOREACH(const Command::Ptr& command, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const Command::Ptr& command, ConfigType::GetObjectsByType()) { DumpCommand(objectfp, command); } - BOOST_FOREACH(const TimePeriod::Ptr& tp, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const TimePeriod::Ptr& tp, ConfigType::GetObjectsByType()) { DumpTimePeriod(objectfp, tp); } - BOOST_FOREACH(const Dependency::Ptr& dep, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const Dependency::Ptr& dep, ConfigType::GetObjectsByType()) { Checkable::Ptr parent = dep->GetParent(); if (!parent) { @@ -829,7 +829,7 @@ void StatusDataWriter::StatusTimerHandler(void) statusfp << "\t" "}" "\n" "\n"; - BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType()) { std::ostringstream tempstatusfp; tempstatusfp << std::fixed; DumpHostStatus(tempstatusfp, host); diff --git a/lib/compat/statusdatawriter.ti b/lib/compat/statusdatawriter.ti index 542e77f4a..f65b71831 100644 --- a/lib/compat/statusdatawriter.ti +++ b/lib/compat/statusdatawriter.ti @@ -17,7 +17,7 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" #include "base/application.hpp" library compat; @@ -25,7 +25,7 @@ library compat; namespace icinga { -class StatusDataWriter : DynamicObject +class StatusDataWriter : ConfigObject { [config] String status_path { default {{{ return Application::GetLocalStateDir() + "/cache/icinga2/status.dat"; }}} diff --git a/lib/config/config_parser.yy b/lib/config/config_parser.yy index 36ee268ea..7fbfc625c 100644 --- a/lib/config/config_parser.yy +++ b/lib/config/config_parser.yy @@ -28,7 +28,7 @@ #include "base/value.hpp" #include "base/utility.hpp" #include "base/exception.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/exception.hpp" #include #include diff --git a/lib/config/configitem.cpp b/lib/config/configitem.cpp index 9b34ceb6f..6652cdd8e 100644 --- a/lib/config/configitem.cpp +++ b/lib/config/configitem.cpp @@ -22,7 +22,7 @@ #include "config/applyrule.hpp" #include "config/objectrule.hpp" #include "base/application.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/objectlock.hpp" #include "base/convert.hpp" #include "base/logger.hpp" @@ -144,12 +144,12 @@ public: }; /** - * Commits the configuration item by creating a DynamicObject + * Commits the configuration item by creating a ConfigObject * object. * - * @returns The DynamicObject that was created/updated. + * @returns The ConfigObject that was created/updated. */ -DynamicObject::Ptr ConfigItem::Commit(bool discard) +ConfigObject::Ptr ConfigItem::Commit(bool discard) { ASSERT(!OwnsLock()); @@ -160,12 +160,12 @@ DynamicObject::Ptr ConfigItem::Commit(bool discard) /* Make sure the type is valid. */ Type::Ptr type = Type::GetByName(GetType()); - ASSERT(type && DynamicObject::TypeInstance->IsAssignableFrom(type)); + ASSERT(type && ConfigObject::TypeInstance->IsAssignableFrom(type)); if (IsAbstract()) - return DynamicObject::Ptr(); + return ConfigObject::Ptr(); - DynamicObject::Ptr dobj = static_pointer_cast(type->Instantiate()); + ConfigObject::Ptr dobj = static_pointer_cast(type->Instantiate()); dobj->SetDebugInfo(m_DebugInfo); dobj->SetTypeNameV(m_Type); @@ -374,7 +374,7 @@ bool ConfigItem::CommitNewItems(WorkQueue& upq, std::vector& ne } BOOST_FOREACH(const Type::Ptr& type, all_types) { - if (DynamicObject::TypeInstance->IsAssignableFrom(type)) + if (ConfigObject::TypeInstance->IsAssignableFrom(type)) types.insert(type->GetName()); } @@ -401,7 +401,7 @@ bool ConfigItem::CommitNewItems(WorkQueue& upq, std::vector& ne BOOST_FOREACH(const ConfigItem::Ptr& item, new_items) { if (item->m_Type == type) - upq.Enqueue(boost::bind(&DynamicObject::OnAllConfigLoaded, item->m_Object)); + upq.Enqueue(boost::bind(&ConfigObject::OnAllConfigLoaded, item->m_Object)); } completed_types.insert(type); @@ -414,7 +414,7 @@ bool ConfigItem::CommitNewItems(WorkQueue& upq, std::vector& ne BOOST_FOREACH(const String& loadDep, ptype->GetLoadDependencies()) { BOOST_FOREACH(const ConfigItem::Ptr& item, new_items) { if (item->m_Type == loadDep) - upq.Enqueue(boost::bind(&DynamicObject::CreateChildObjects, item->m_Object, ptype)); + upq.Enqueue(boost::bind(&ConfigObject::CreateChildObjects, item->m_Object, ptype)); } } @@ -469,7 +469,7 @@ bool ConfigItem::ActivateItems(WorkQueue& upq, bool restoreState) if (restoreState) { /* restore the previous program state */ try { - DynamicObject::RestoreObjects(Application::GetStatePath()); + ConfigObject::RestoreObjects(Application::GetStatePath()); } catch (const std::exception& ex) { Log(LogCritical, "ConfigItem") << "Failed to restore state file: " << DiagnosticInformation(ex); @@ -478,8 +478,8 @@ bool ConfigItem::ActivateItems(WorkQueue& upq, bool restoreState) Log(LogInformation, "ConfigItem", "Triggering Start signal for config items"); - BOOST_FOREACH(const DynamicType::Ptr& type, DynamicType::GetTypes()) { - BOOST_FOREACH(const DynamicObject::Ptr& object, type->GetObjects()) { + BOOST_FOREACH(const ConfigType::Ptr& type, ConfigType::GetTypes()) { + BOOST_FOREACH(const ConfigObject::Ptr& object, type->GetObjects()) { if (object->IsActive()) continue; @@ -487,7 +487,7 @@ bool ConfigItem::ActivateItems(WorkQueue& upq, bool restoreState) Log(LogDebug, "ConfigItem") << "Activating object '" << object->GetName() << "' of type '" << object->GetType()->GetName() << "'"; #endif /* I2_DEBUG */ - upq.Enqueue(boost::bind(&DynamicObject::Activate, object)); + upq.Enqueue(boost::bind(&ConfigObject::Activate, object)); } } @@ -499,8 +499,8 @@ bool ConfigItem::ActivateItems(WorkQueue& upq, bool restoreState) } #ifdef I2_DEBUG - BOOST_FOREACH(const DynamicType::Ptr& type, DynamicType::GetTypes()) { - BOOST_FOREACH(const DynamicObject::Ptr& object, type->GetObjects()) { + BOOST_FOREACH(const ConfigType::Ptr& type, ConfigType::GetTypes()) { + BOOST_FOREACH(const ConfigObject::Ptr& object, type->GetObjects()) { ASSERT(object->IsActive()); } } diff --git a/lib/config/configitem.hpp b/lib/config/configitem.hpp index 8425336de..9513df9df 100644 --- a/lib/config/configitem.hpp +++ b/lib/config/configitem.hpp @@ -22,7 +22,7 @@ #include "config/i2-config.hpp" #include "config/expression.hpp" -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" #include "base/workqueue.hpp" namespace icinga @@ -53,7 +53,7 @@ public: boost::shared_ptr GetExpression(void) const; boost::shared_ptr GetFilter(void) const; - DynamicObject::Ptr Commit(bool discard = true); + ConfigObject::Ptr Commit(bool discard = true); void Register(void); void Unregister(void); @@ -83,7 +83,7 @@ private: Dictionary::Ptr m_Scope; /**< variable scope. */ String m_Zone; /**< The zone. */ - DynamicObject::Ptr m_Object; + ConfigObject::Ptr m_Object; static boost::mutex m_Mutex; diff --git a/lib/config/configitembuilder.cpp b/lib/config/configitembuilder.cpp index 5906f9ad6..9cf208575 100644 --- a/lib/config/configitembuilder.cpp +++ b/lib/config/configitembuilder.cpp @@ -18,7 +18,7 @@ ******************************************************************************/ #include "config/configitembuilder.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include #include #include @@ -83,7 +83,7 @@ ConfigItem::Ptr ConfigItemBuilder::Compile(void) BOOST_THROW_EXCEPTION(ScriptError(msgbuf.str(), m_DebugInfo)); } - if (!DynamicType::GetByName(m_Type)) { + if (!ConfigType::GetByName(m_Type)) { std::ostringstream msgbuf; msgbuf << "The type '" + m_Type + "' is unknown"; BOOST_THROW_EXCEPTION(ScriptError(msgbuf.str(), m_DebugInfo)); diff --git a/lib/db_ido/commanddbobject.hpp b/lib/db_ido/commanddbobject.hpp index d8a271d16..288331e26 100644 --- a/lib/db_ido/commanddbobject.hpp +++ b/lib/db_ido/commanddbobject.hpp @@ -21,7 +21,7 @@ #define COMMANDDBOBJECT_H #include "db_ido/dbobject.hpp" -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" namespace icinga { diff --git a/lib/db_ido/dbconnection.cpp b/lib/db_ido/dbconnection.cpp index d38aafb45..9c239eefb 100644 --- a/lib/db_ido/dbconnection.cpp +++ b/lib/db_ido/dbconnection.cpp @@ -23,7 +23,7 @@ #include "icinga/icingaapplication.hpp" #include "icinga/host.hpp" #include "icinga/service.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/convert.hpp" #include "base/objectlock.hpp" #include "base/utility.hpp" @@ -44,7 +44,7 @@ DbConnection::DbConnection(void) void DbConnection::OnConfigLoaded(void) { - DynamicObject::OnConfigLoaded(); + ConfigObject::OnConfigLoaded(); if (!GetEnableHa()) { Log(LogDebug, "DbConnection") @@ -58,15 +58,15 @@ void DbConnection::OnConfigLoaded(void) void DbConnection::Start(void) { - DynamicObject::Start(); + ConfigObject::Start(); DbObject::OnQuery.connect(boost::bind(&DbConnection::ExecuteQuery, this, _1)); - DynamicObject::OnActiveChanged.connect(boost::bind(&DbConnection::UpdateObject, this, _1)); + ConfigObject::OnActiveChanged.connect(boost::bind(&DbConnection::UpdateObject, this, _1)); } void DbConnection::Resume(void) { - DynamicObject::Resume(); + ConfigObject::Resume(); Log(LogInformation, "DbConnection") << "Resuming IDO connection: " << GetName(); @@ -79,7 +79,7 @@ void DbConnection::Resume(void) void DbConnection::Pause(void) { - DynamicObject::Pause(); + ConfigObject::Pause(); Log(LogInformation, "DbConnection") << "Pausing IDO connection: " << GetName(); @@ -167,10 +167,10 @@ void DbConnection::ProgramStatusHandler(void) query3.WhereCriteria->Set("instance_id", 0); /* DbConnection class fills in real ID */ DbObject::OnQuery(query3); - InsertRuntimeVariable("total_services", std::distance(DynamicType::GetObjectsByType().first, DynamicType::GetObjectsByType().second)); - InsertRuntimeVariable("total_scheduled_services", std::distance(DynamicType::GetObjectsByType().first, DynamicType::GetObjectsByType().second)); - InsertRuntimeVariable("total_hosts", std::distance(DynamicType::GetObjectsByType().first, DynamicType::GetObjectsByType().second)); - InsertRuntimeVariable("total_scheduled_hosts", std::distance(DynamicType::GetObjectsByType().first, DynamicType::GetObjectsByType().second)); + InsertRuntimeVariable("total_services", std::distance(ConfigType::GetObjectsByType().first, ConfigType::GetObjectsByType().second)); + InsertRuntimeVariable("total_scheduled_services", std::distance(ConfigType::GetObjectsByType().first, ConfigType::GetObjectsByType().second)); + InsertRuntimeVariable("total_hosts", std::distance(ConfigType::GetObjectsByType().first, ConfigType::GetObjectsByType().second)); + InsertRuntimeVariable("total_scheduled_hosts", std::distance(ConfigType::GetObjectsByType().first, ConfigType::GetObjectsByType().second)); Dictionary::Ptr vars = IcingaApplication::GetInstance()->GetVars(); @@ -378,7 +378,7 @@ void DbConnection::ExecuteQuery(const DbQuery&) /* Default handler does nothing. */ } -void DbConnection::UpdateObject(const DynamicObject::Ptr& object) +void DbConnection::UpdateObject(const ConfigObject::Ptr& object) { if (!GetConnected()) return; @@ -400,9 +400,9 @@ void DbConnection::UpdateObject(const DynamicObject::Ptr& object) void DbConnection::UpdateAllObjects(void) { - DynamicType::Ptr type; - BOOST_FOREACH(const DynamicType::Ptr& dt, DynamicType::GetTypes()) { - BOOST_FOREACH(const DynamicObject::Ptr& object, dt->GetObjects()) { + ConfigType::Ptr type; + BOOST_FOREACH(const ConfigType::Ptr& dt, ConfigType::GetTypes()) { + BOOST_FOREACH(const ConfigObject::Ptr& object, dt->GetObjects()) { UpdateObject(object); } } diff --git a/lib/db_ido/dbconnection.hpp b/lib/db_ido/dbconnection.hpp index f3b6b7e7a..ad71a0165 100644 --- a/lib/db_ido/dbconnection.hpp +++ b/lib/db_ido/dbconnection.hpp @@ -90,7 +90,7 @@ protected: virtual void FillIDCache(const DbType::Ptr& type) = 0; virtual void NewTransaction(void) = 0; - void UpdateObject(const DynamicObject::Ptr& object); + void UpdateObject(const ConfigObject::Ptr& object); void UpdateAllObjects(void); void PrepareDatabase(void); diff --git a/lib/db_ido/dbconnection.ti b/lib/db_ido/dbconnection.ti index 6d4f593ba..f1f2bef44 100644 --- a/lib/db_ido/dbconnection.ti +++ b/lib/db_ido/dbconnection.ti @@ -18,14 +18,14 @@ ******************************************************************************/ #include "db_ido/dbquery.hpp" -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" library db_ido; namespace icinga { -abstract class DbConnection : DynamicObject +abstract class DbConnection : ConfigObject { [config] String table_prefix { default {{{ return "icinga_"; }}} diff --git a/lib/db_ido/dbevents.cpp b/lib/db_ido/dbevents.cpp index 468d6fbee..77b13e506 100644 --- a/lib/db_ido/dbevents.cpp +++ b/lib/db_ido/dbevents.cpp @@ -23,7 +23,7 @@ #include "base/convert.hpp" #include "base/objectlock.hpp" #include "base/initialize.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/utility.hpp" #include "base/logger.hpp" #include "remote/endpoint.hpp" @@ -340,7 +340,7 @@ void DbEvents::AddCommentInternal(const Checkable::Ptr& checkable, const Comment AddCommentByType(checkable, comment, historical); } -void DbEvents::AddCommentByType(const DynamicObject::Ptr& object, const Comment::Ptr& comment, bool historical) +void DbEvents::AddCommentByType(const ConfigObject::Ptr& object, const Comment::Ptr& comment, bool historical) { unsigned long entry_time = static_cast(comment->GetEntryTime()); unsigned long entry_time_usec = (comment->GetEntryTime() - entry_time) * 1000 * 1000; @@ -351,11 +351,11 @@ void DbEvents::AddCommentByType(const DynamicObject::Ptr& object, const Comment: fields1->Set("entry_type", comment->GetEntryType()); fields1->Set("object_id", object); - if (object->GetType() == DynamicType::GetByName("Host")) { + if (object->GetType() == ConfigType::GetByName("Host")) { fields1->Set("comment_type", 2); /* requires idoutils 1.10 schema fix */ fields1->Set("internal_comment_id", comment->GetLegacyId()); - } else if (object->GetType() == DynamicType::GetByName("Service")) { + } else if (object->GetType() == ConfigType::GetByName("Service")) { fields1->Set("comment_type", 1); fields1->Set("internal_comment_id", comment->GetLegacyId()); } else { @@ -500,11 +500,11 @@ void DbEvents::AddDowntimeByType(const Checkable::Ptr& checkable, const Downtime fields1->Set("entry_time", DbValue::FromTimestamp(downtime->GetEntryTime())); fields1->Set("object_id", checkable); - if (checkable->GetType() == DynamicType::GetByName("Host")) { + if (checkable->GetType() == ConfigType::GetByName("Host")) { fields1->Set("downtime_type", 2); /* requires idoutils 1.10 schema fix */ fields1->Set("internal_downtime_id", downtime->GetLegacyId()); - } else if (checkable->GetType() == DynamicType::GetByName("Service")) { + } else if (checkable->GetType() == ConfigType::GetByName("Service")) { fields1->Set("downtime_type", 1); fields1->Set("internal_downtime_id", downtime->GetLegacyId()); } else { diff --git a/lib/db_ido/dbevents.hpp b/lib/db_ido/dbevents.hpp index 5052d4407..c1c3b7b7d 100644 --- a/lib/db_ido/dbevents.hpp +++ b/lib/db_ido/dbevents.hpp @@ -21,7 +21,7 @@ #define DBEVENTS_H #include "db_ido/dbobject.hpp" -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" #include "icinga/service.hpp" namespace icinga @@ -61,7 +61,7 @@ class DbEvents public: static void StaticInitialize(void); - static void AddCommentByType(const DynamicObject::Ptr& object, const Comment::Ptr& comment, bool historical); + static void AddCommentByType(const ConfigObject::Ptr& object, const Comment::Ptr& comment, bool historical); static void AddComments(const Checkable::Ptr& checkable); static void RemoveComments(const Checkable::Ptr& checkable); diff --git a/lib/db_ido/dbobject.cpp b/lib/db_ido/dbobject.cpp index 32a89f855..1689e91dc 100644 --- a/lib/db_ido/dbobject.cpp +++ b/lib/db_ido/dbobject.cpp @@ -24,8 +24,8 @@ #include "icinga/service.hpp" #include "icinga/compatutility.hpp" #include "remote/endpoint.hpp" -#include "base/dynamicobject.hpp" -#include "base/dynamictype.hpp" +#include "base/configobject.hpp" +#include "base/configtype.hpp" #include "base/json.hpp" #include "base/convert.hpp" #include "base/objectlock.hpp" @@ -47,16 +47,16 @@ DbObject::DbObject(const intrusive_ptr& type, const String& name1, const void DbObject::StaticInitialize(void) { /* triggered in ProcessCheckResult(), requires UpdateNextCheck() to be called before */ - DynamicObject::OnStateChanged.connect(boost::bind(&DbObject::StateChangedHandler, _1)); + ConfigObject::OnStateChanged.connect(boost::bind(&DbObject::StateChangedHandler, _1)); CustomVarObject::OnVarsChanged.connect(boost::bind(&DbObject::VarsChangedHandler, _1)); } -void DbObject::SetObject(const DynamicObject::Ptr& object) +void DbObject::SetObject(const ConfigObject::Ptr& object) { m_Object = object; } -DynamicObject::Ptr DbObject::GetObject(void) const +ConfigObject::Ptr DbObject::GetObject(void) const { return m_Object; } @@ -150,7 +150,7 @@ void DbObject::SendStatusUpdate(void) void DbObject::SendVarsConfigUpdate(void) { - DynamicObject::Ptr obj = GetObject(); + ConfigObject::Ptr obj = GetObject(); CustomVarObject::Ptr custom_var_object = dynamic_pointer_cast(obj); @@ -205,7 +205,7 @@ void DbObject::SendVarsConfigUpdate(void) void DbObject::SendVarsStatusUpdate(void) { - DynamicObject::Ptr obj = GetObject(); + ConfigObject::Ptr obj = GetObject(); CustomVarObject::Ptr custom_var_object = dynamic_pointer_cast(obj); @@ -289,7 +289,7 @@ void DbObject::OnStatusUpdate(void) /* Default handler does nothing. */ } -DbObject::Ptr DbObject::GetOrCreateByObject(const DynamicObject::Ptr& object) +DbObject::Ptr DbObject::GetOrCreateByObject(const ConfigObject::Ptr& object) { boost::mutex::scoped_lock lock(GetStaticMutex()); @@ -314,9 +314,9 @@ DbObject::Ptr DbObject::GetOrCreateByObject(const DynamicObject::Ptr& object) name1 = service->GetHost()->GetName(); name2 = service->GetShortName(); } else { - if (object->GetType() == DynamicType::GetByName("CheckCommand") || - object->GetType() == DynamicType::GetByName("EventCommand") || - object->GetType() == DynamicType::GetByName("NotificationCommand")) { + if (object->GetType() == ConfigType::GetByName("CheckCommand") || + object->GetType() == ConfigType::GetByName("EventCommand") || + object->GetType() == ConfigType::GetByName("NotificationCommand")) { Command::Ptr command = dynamic_pointer_cast(object); name1 = CompatUtility::GetCommandName(command); } @@ -332,7 +332,7 @@ DbObject::Ptr DbObject::GetOrCreateByObject(const DynamicObject::Ptr& object) return dbobj; } -void DbObject::StateChangedHandler(const DynamicObject::Ptr& object) +void DbObject::StateChangedHandler(const ConfigObject::Ptr& object) { DbObject::Ptr dbobj = GetOrCreateByObject(object); diff --git a/lib/db_ido/dbobject.hpp b/lib/db_ido/dbobject.hpp index 296629ae2..9e808b68f 100644 --- a/lib/db_ido/dbobject.hpp +++ b/lib/db_ido/dbobject.hpp @@ -25,7 +25,7 @@ #include "db_ido/dbquery.hpp" #include "db_ido/dbtype.hpp" #include "icinga/customvarobject.hpp" -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" namespace icinga { @@ -66,8 +66,8 @@ public: static void StaticInitialize(void); - void SetObject(const DynamicObject::Ptr& object); - DynamicObject::Ptr GetObject(void) const; + void SetObject(const ConfigObject::Ptr& object); + ConfigObject::Ptr GetObject(void) const; String GetName1(void) const; String GetName2(void) const; @@ -76,7 +76,7 @@ public: virtual Dictionary::Ptr GetConfigFields(void) const = 0; virtual Dictionary::Ptr GetStatusFields(void) const = 0; - static DbObject::Ptr GetOrCreateByObject(const DynamicObject::Ptr& object); + static DbObject::Ptr GetOrCreateByObject(const ConfigObject::Ptr& object); static boost::signals2::signal OnQuery; @@ -100,11 +100,11 @@ private: String m_Name1; String m_Name2; intrusive_ptr m_Type; - DynamicObject::Ptr m_Object; + ConfigObject::Ptr m_Object; double m_LastConfigUpdate; double m_LastStatusUpdate; - static void StateChangedHandler(const DynamicObject::Ptr& object); + static void StateChangedHandler(const ConfigObject::Ptr& object); static void VarsChangedHandler(const CustomVarObject::Ptr& object); static boost::mutex& GetStaticMutex(void); diff --git a/lib/db_ido/dbquery.hpp b/lib/db_ido/dbquery.hpp index ec06d1a36..dcab8771b 100644 --- a/lib/db_ido/dbquery.hpp +++ b/lib/db_ido/dbquery.hpp @@ -23,7 +23,7 @@ #include "db_ido/i2-db_ido.hpp" #include "icinga/customvarobject.hpp" #include "base/dictionary.hpp" -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" namespace icinga { diff --git a/lib/db_ido/endpointdbobject.cpp b/lib/db_ido/endpointdbobject.cpp index 21fa9ae25..db024f4cb 100644 --- a/lib/db_ido/endpointdbobject.cpp +++ b/lib/db_ido/endpointdbobject.cpp @@ -23,7 +23,7 @@ #include "icinga/icingaapplication.hpp" #include "base/objectlock.hpp" #include "base/initialize.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/utility.hpp" #include "base/convert.hpp" #include "base/logger.hpp" diff --git a/lib/db_ido/endpointdbobject.hpp b/lib/db_ido/endpointdbobject.hpp index 66f6555ea..f468c7e72 100644 --- a/lib/db_ido/endpointdbobject.hpp +++ b/lib/db_ido/endpointdbobject.hpp @@ -21,7 +21,7 @@ #define ENDPOINTDBOBJECT_H #include "db_ido/dbobject.hpp" -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" #include "remote/endpoint.hpp" namespace icinga diff --git a/lib/db_ido/hostdbobject.hpp b/lib/db_ido/hostdbobject.hpp index 2dddea375..f3d1fc695 100644 --- a/lib/db_ido/hostdbobject.hpp +++ b/lib/db_ido/hostdbobject.hpp @@ -21,7 +21,7 @@ #define HOSTDBOBJECT_H #include "db_ido/dbobject.hpp" -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" namespace icinga { diff --git a/lib/db_ido/hostgroupdbobject.cpp b/lib/db_ido/hostgroupdbobject.cpp index ad771f298..9d96af5f5 100644 --- a/lib/db_ido/hostgroupdbobject.cpp +++ b/lib/db_ido/hostgroupdbobject.cpp @@ -22,7 +22,7 @@ #include "db_ido/dbvalue.hpp" #include "base/objectlock.hpp" #include "base/initialize.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include using namespace icinga; diff --git a/lib/db_ido/hostgroupdbobject.hpp b/lib/db_ido/hostgroupdbobject.hpp index fab7b1e26..5544cd861 100644 --- a/lib/db_ido/hostgroupdbobject.hpp +++ b/lib/db_ido/hostgroupdbobject.hpp @@ -22,7 +22,7 @@ #include "db_ido/dbobject.hpp" #include "icinga/hostgroup.hpp" -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" namespace icinga { diff --git a/lib/db_ido/idochecktask.cpp b/lib/db_ido/idochecktask.cpp index 7020ef4be..6e70b91b8 100644 --- a/lib/db_ido/idochecktask.cpp +++ b/lib/db_ido/idochecktask.cpp @@ -27,7 +27,7 @@ #include "remote/zone.hpp" #include "base/function.hpp" #include "base/utility.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/convert.hpp" #include @@ -87,7 +87,7 @@ void IdoCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult return; } - DynamicType::Ptr dtype = DynamicType::GetByName(idoType); + ConfigType::Ptr dtype = ConfigType::GetByName(idoType); VERIFY(dtype); DbConnection::Ptr conn = static_pointer_cast(dtype->GetObject(idoName)); diff --git a/lib/db_ido/servicedbobject.cpp b/lib/db_ido/servicedbobject.cpp index bae4b3f54..3791d4632 100644 --- a/lib/db_ido/servicedbobject.cpp +++ b/lib/db_ido/servicedbobject.cpp @@ -32,7 +32,7 @@ #include "base/convert.hpp" #include "base/objectlock.hpp" #include "base/initialize.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/utility.hpp" #include "base/logger.hpp" #include diff --git a/lib/db_ido/servicedbobject.hpp b/lib/db_ido/servicedbobject.hpp index e43b636be..ccc289e6c 100644 --- a/lib/db_ido/servicedbobject.hpp +++ b/lib/db_ido/servicedbobject.hpp @@ -21,7 +21,7 @@ #define SERVICEDBOBJECT_H #include "db_ido/dbobject.hpp" -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" #include "icinga/service.hpp" namespace icinga diff --git a/lib/db_ido/servicegroupdbobject.hpp b/lib/db_ido/servicegroupdbobject.hpp index 274565258..4d7a1971a 100644 --- a/lib/db_ido/servicegroupdbobject.hpp +++ b/lib/db_ido/servicegroupdbobject.hpp @@ -22,7 +22,7 @@ #include "db_ido/dbobject.hpp" #include "icinga/servicegroup.hpp" -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" namespace icinga { diff --git a/lib/db_ido/timeperioddbobject.hpp b/lib/db_ido/timeperioddbobject.hpp index d94eb9362..4bedf7f5d 100644 --- a/lib/db_ido/timeperioddbobject.hpp +++ b/lib/db_ido/timeperioddbobject.hpp @@ -21,7 +21,7 @@ #define TIMEPERIODDBOBJECT_H #include "db_ido/dbobject.hpp" -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" namespace icinga { diff --git a/lib/db_ido/userdbobject.hpp b/lib/db_ido/userdbobject.hpp index 8f41ba1fa..2ea254ef0 100644 --- a/lib/db_ido/userdbobject.hpp +++ b/lib/db_ido/userdbobject.hpp @@ -21,7 +21,7 @@ #define USERDBOBJECT_H #include "db_ido/dbobject.hpp" -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" namespace icinga { diff --git a/lib/db_ido/usergroupdbobject.cpp b/lib/db_ido/usergroupdbobject.cpp index 651047ed2..d124d8d73 100644 --- a/lib/db_ido/usergroupdbobject.cpp +++ b/lib/db_ido/usergroupdbobject.cpp @@ -22,7 +22,7 @@ #include "db_ido/dbvalue.hpp" #include "base/objectlock.hpp" #include "base/initialize.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include using namespace icinga; diff --git a/lib/db_ido/usergroupdbobject.hpp b/lib/db_ido/usergroupdbobject.hpp index a33ebf9b2..d56ec2536 100644 --- a/lib/db_ido/usergroupdbobject.hpp +++ b/lib/db_ido/usergroupdbobject.hpp @@ -22,7 +22,7 @@ #include "db_ido/dbobject.hpp" #include "icinga/usergroup.hpp" -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" namespace icinga { diff --git a/lib/db_ido/zonedbobject.hpp b/lib/db_ido/zonedbobject.hpp index c0a1395e1..59b5f3989 100644 --- a/lib/db_ido/zonedbobject.hpp +++ b/lib/db_ido/zonedbobject.hpp @@ -21,7 +21,7 @@ #define ZONEDBOBJECT_H #include "db_ido/dbobject.hpp" -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" #include "remote/zone.hpp" namespace icinga diff --git a/lib/db_ido_mysql/idomysqlconnection.cpp b/lib/db_ido_mysql/idomysqlconnection.cpp index 8834d5200..93a811af8 100644 --- a/lib/db_ido_mysql/idomysqlconnection.cpp +++ b/lib/db_ido_mysql/idomysqlconnection.cpp @@ -28,7 +28,7 @@ #include "base/convert.hpp" #include "base/utility.hpp" #include "base/application.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/exception.hpp" #include "base/statsfunction.hpp" #include @@ -47,7 +47,7 @@ void IdoMysqlConnection::StatsFunc(const Dictionary::Ptr& status, const Array::P { Dictionary::Ptr nodes = new Dictionary(); - BOOST_FOREACH(const IdoMysqlConnection::Ptr& idomysqlconnection, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const IdoMysqlConnection::Ptr& idomysqlconnection, ConfigType::GetObjectsByType()) { size_t items = idomysqlconnection->m_QueryQueue.GetLength(); Dictionary::Ptr stats = new Dictionary(); @@ -672,7 +672,7 @@ bool IdoMysqlConnection::FieldToEscapedString(const String& key, const Value& va Value rawvalue = DbValue::ExtractValue(value); - if (rawvalue.IsObjectType()) { + if (rawvalue.IsObjectType()) { DbObject::Ptr dbobjcol = DbObject::GetOrCreateByObject(rawvalue); if (!dbobjcol) { diff --git a/lib/db_ido_pgsql/idopgsqlconnection.cpp b/lib/db_ido_pgsql/idopgsqlconnection.cpp index 729ff4c1b..db9e7a6ed 100644 --- a/lib/db_ido_pgsql/idopgsqlconnection.cpp +++ b/lib/db_ido_pgsql/idopgsqlconnection.cpp @@ -27,7 +27,7 @@ #include "base/convert.hpp" #include "base/utility.hpp" #include "base/application.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/exception.hpp" #include "base/context.hpp" #include "base/statsfunction.hpp" @@ -48,7 +48,7 @@ void IdoPgsqlConnection::StatsFunc(const Dictionary::Ptr& status, const Array::P { Dictionary::Ptr nodes = new Dictionary(); - BOOST_FOREACH(const IdoPgsqlConnection::Ptr& idopgsqlconnection, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const IdoPgsqlConnection::Ptr& idopgsqlconnection, ConfigType::GetObjectsByType()) { size_t items = idopgsqlconnection->m_QueryQueue.GetLength(); Dictionary::Ptr stats = new Dictionary(); @@ -545,7 +545,7 @@ bool IdoPgsqlConnection::FieldToEscapedString(const String& key, const Value& va Value rawvalue = DbValue::ExtractValue(value); - if (rawvalue.IsObjectType()) { + if (rawvalue.IsObjectType()) { DbObject::Ptr dbobjcol = DbObject::GetOrCreateByObject(rawvalue); if (!dbobjcol) { diff --git a/lib/demo/demo.cpp b/lib/demo/demo.cpp index fe2d9419d..221a138b4 100644 --- a/lib/demo/demo.cpp +++ b/lib/demo/demo.cpp @@ -21,7 +21,7 @@ #include "demo/demo.tcpp" #include "remote/apilistener.hpp" #include "remote/apifunction.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/logger.hpp" using namespace icinga; @@ -35,7 +35,7 @@ REGISTER_APIFUNCTION(HelloWorld, demo, &Demo::DemoMessageHandler); */ void Demo::Start(void) { - DynamicObject::Start(); + ConfigObject::Start(); m_DemoTimer = new Timer(); m_DemoTimer->SetInterval(5); @@ -54,7 +54,7 @@ void Demo::DemoTimerHandler(void) ApiListener::Ptr listener = ApiListener::GetInstance(); if (listener) { MessageOrigin::Ptr origin = new MessageOrigin(); - listener->RelayMessage(origin, DynamicObject::Ptr(), message, true); + listener->RelayMessage(origin, ConfigObject::Ptr(), message, true); Log(LogInformation, "Demo", "Sent demo::HelloWorld message"); } } diff --git a/lib/demo/demo.ti b/lib/demo/demo.ti index 0fd373c60..2f52e6d45 100644 --- a/lib/demo/demo.ti +++ b/lib/demo/demo.ti @@ -17,14 +17,14 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" library demo; namespace icinga { -class Demo : DynamicObject +class Demo : ConfigObject { }; diff --git a/lib/icinga/apiactions.cpp b/lib/icinga/apiactions.cpp index 1c2691aa7..11440d142 100644 --- a/lib/icinga/apiactions.cpp +++ b/lib/icinga/apiactions.cpp @@ -37,7 +37,7 @@ Dictionary::Ptr ApiActions::CreateResult(const int code, const String& status) { REGISTER_APIACTION(reschedule_check, "Service;Host", &ApiActions::RescheduleCheck); REGISTER_APIACTION(process_check_result, "Service;Host", &ApiActions::ProcessCheckResult); -Dictionary::Ptr ApiActions::RescheduleCheck(const DynamicObject::Ptr& object, const Dictionary::Ptr& params) +Dictionary::Ptr ApiActions::RescheduleCheck(const ConfigObject::Ptr& object, const Dictionary::Ptr& params) { Checkable::Ptr checkable = static_pointer_cast(object); @@ -58,7 +58,7 @@ Dictionary::Ptr ApiActions::RescheduleCheck(const DynamicObject::Ptr& object, co return ApiActions::CreateResult(200, "Successfully rescheduled check for " + checkable->GetName()); } -Dictionary::Ptr ApiActions::ProcessCheckResult(const DynamicObject::Ptr& object, const Dictionary::Ptr& params) +Dictionary::Ptr ApiActions::ProcessCheckResult(const ConfigObject::Ptr& object, const Dictionary::Ptr& params) { Checkable::Ptr checkable = static_pointer_cast(object); diff --git a/lib/icinga/apiactions.hpp b/lib/icinga/apiactions.hpp index 7682276d0..9dbb1681b 100644 --- a/lib/icinga/apiactions.hpp +++ b/lib/icinga/apiactions.hpp @@ -21,7 +21,7 @@ #define APIACTIONS_H #include "icinga/i2-icinga.hpp" -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" #include "base/dictionary.hpp" namespace icinga @@ -33,8 +33,8 @@ namespace icinga class I2_ICINGA_API ApiActions { public: - static Dictionary::Ptr RescheduleCheck(const DynamicObject::Ptr& object, const Dictionary::Ptr& params); - static Dictionary::Ptr ProcessCheckResult(const DynamicObject::Ptr& object, const Dictionary::Ptr& params); + static Dictionary::Ptr RescheduleCheck(const ConfigObject::Ptr& object, const Dictionary::Ptr& params); + static Dictionary::Ptr ProcessCheckResult(const ConfigObject::Ptr& object, const Dictionary::Ptr& params); private: static Dictionary::Ptr CreateResult(const int code, const String& status); diff --git a/lib/icinga/apievents.cpp b/lib/icinga/apievents.cpp index e352db69e..8a5e4932e 100644 --- a/lib/icinga/apievents.cpp +++ b/lib/icinga/apievents.cpp @@ -26,7 +26,7 @@ #include "remote/zone.hpp" #include "remote/apifunction.hpp" #include "base/application.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/utility.hpp" #include "base/exception.hpp" #include "base/initialize.hpp" @@ -1241,7 +1241,7 @@ void ApiEvents::VarsChangedHandler(const CustomVarObject::Ptr& object, const Mes Dictionary::Ptr params = new Dictionary(); params->Set("object", object->GetName()); - DynamicType::Ptr dtype = object->GetType(); + ConfigType::Ptr dtype = object->GetType(); ASSERT(dtype); params->Set("object_type", dtype->GetName()); @@ -1295,7 +1295,7 @@ Value ApiEvents::VarsChangedAPIHandler(const MessageOrigin::Ptr& origin, const D if (!object) object = NotificationCommand::GetByName(objectName); } else { - DynamicType::Ptr dtype = DynamicType::GetByName(objectType); + ConfigType::Ptr dtype = ConfigType::GetByName(objectType); if (!dtype) return Empty; @@ -1847,7 +1847,7 @@ void ApiEvents::RepositoryTimerHandler(void) Dictionary::Ptr repository = new Dictionary(); - BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType()) { Array::Ptr services = new Array(); BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) { diff --git a/lib/icinga/checkable-comment.cpp b/lib/icinga/checkable-comment.cpp index f957df2d7..89ea47611 100644 --- a/lib/icinga/checkable-comment.cpp +++ b/lib/icinga/checkable-comment.cpp @@ -18,7 +18,7 @@ ******************************************************************************/ #include "icinga/service.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/objectlock.hpp" #include "base/timer.hpp" #include "base/utility.hpp" @@ -234,11 +234,11 @@ void Checkable::RemoveExpiredComments(void) void Checkable::CommentsExpireTimerHandler(void) { - BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType()) { host->RemoveExpiredComments(); } - BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const Service::Ptr& service, ConfigType::GetObjectsByType()) { service->RemoveExpiredComments(); } } diff --git a/lib/icinga/checkable-downtime.cpp b/lib/icinga/checkable-downtime.cpp index 2dd058058..5f1f68f0a 100644 --- a/lib/icinga/checkable-downtime.cpp +++ b/lib/icinga/checkable-downtime.cpp @@ -18,7 +18,7 @@ ******************************************************************************/ #include "icinga/service.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/objectlock.hpp" #include "base/logger.hpp" #include "base/timer.hpp" @@ -321,11 +321,11 @@ void Checkable::RemoveExpiredDowntimes(void) void Checkable::DowntimesExpireTimerHandler(void) { - BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType()) { host->RemoveExpiredDowntimes(); } - BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const Service::Ptr& service, ConfigType::GetObjectsByType()) { service->RemoveExpiredDowntimes(); } } diff --git a/lib/icinga/checkable.cpp b/lib/icinga/checkable.cpp index f26631e0b..bccb68fed 100644 --- a/lib/icinga/checkable.cpp +++ b/lib/icinga/checkable.cpp @@ -47,7 +47,7 @@ void Checkable::Start(void) if (GetNextCheck() < now + 300) UpdateNextCheck(); - DynamicObject::Start(); + ConfigObject::Start(); } void Checkable::OnStateLoaded(void) diff --git a/lib/icinga/checkcommand.cpp b/lib/icinga/checkcommand.cpp index 26e39984e..a9b7cc6ca 100644 --- a/lib/icinga/checkcommand.cpp +++ b/lib/icinga/checkcommand.cpp @@ -19,7 +19,7 @@ #include "icinga/checkcommand.hpp" #include "icinga/checkcommand.tcpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" using namespace icinga; diff --git a/lib/icinga/cib.cpp b/lib/icinga/cib.cpp index 5b106d2bb..5f8aabd3a 100644 --- a/lib/icinga/cib.cpp +++ b/lib/icinga/cib.cpp @@ -22,7 +22,7 @@ #include "icinga/service.hpp" #include "base/objectlock.hpp" #include "base/utility.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/statsfunction.hpp" #include @@ -80,7 +80,7 @@ CheckableCheckStatistics CIB::CalculateHostCheckStats(void) double min_execution_time = -1, max_execution_time = 0, sum_execution_time = 0; int count_execution_time = 0; - BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType()) { ObjectLock olock(host); CheckResult::Ptr cr = host->GetLastCheckResult(); @@ -129,7 +129,7 @@ CheckableCheckStatistics CIB::CalculateServiceCheckStats(void) double min_execution_time = -1, max_execution_time = 0, sum_execution_time = 0; int count_execution_time = 0; - BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const Service::Ptr& service, ConfigType::GetObjectsByType()) { ObjectLock olock(service); CheckResult::Ptr cr = service->GetLastCheckResult(); @@ -175,7 +175,7 @@ ServiceStatistics CIB::CalculateServiceStats(void) { ServiceStatistics ss = {0}; - BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const Service::Ptr& service, ConfigType::GetObjectsByType()) { ObjectLock olock(service); CheckResult::Ptr cr = service->GetLastCheckResult(); @@ -209,7 +209,7 @@ HostStatistics CIB::CalculateHostStats(void) { HostStatistics hs = {0}; - BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType()) { ObjectLock olock(host); if (host->IsReachable()) { diff --git a/lib/icinga/comment.cpp b/lib/icinga/comment.cpp index ce6f8576e..bdbfcc50e 100644 --- a/lib/icinga/comment.cpp +++ b/lib/icinga/comment.cpp @@ -20,7 +20,7 @@ #include "icinga/comment.hpp" #include "icinga/comment.tcpp" #include "base/utility.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" using namespace icinga; diff --git a/lib/icinga/compatutility.cpp b/lib/icinga/compatutility.cpp index b88aafe9b..11bb2370e 100644 --- a/lib/icinga/compatutility.cpp +++ b/lib/icinga/compatutility.cpp @@ -23,7 +23,7 @@ #include "icinga/pluginutility.hpp" #include "icinga/service.hpp" #include "base/utility.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/objectlock.hpp" #include "base/convert.hpp" #include @@ -62,11 +62,11 @@ String CompatUtility::GetCommandNamePrefix(const Command::Ptr command) return Empty; String prefix; - if (command->GetType() == DynamicType::GetByName("CheckCommand")) + if (command->GetType() == ConfigType::GetByName("CheckCommand")) prefix = "check_"; - else if (command->GetType() == DynamicType::GetByName("NotificationCommand")) + else if (command->GetType() == ConfigType::GetByName("NotificationCommand")) prefix = "notification_"; - else if (command->GetType() == DynamicType::GetByName("EventCommand")) + else if (command->GetType() == ConfigType::GetByName("EventCommand")) prefix = "event_"; return prefix; @@ -376,12 +376,12 @@ Array::Ptr CompatUtility::GetModifiedAttributesList(const CustomVarObject::Ptr& { Array::Ptr mod_attr_list = new Array(); - if (object->GetType() != DynamicType::GetByName("Host") && - object->GetType() != DynamicType::GetByName("Service") && - object->GetType() != DynamicType::GetByName("User") && - object->GetType() != DynamicType::GetByName("CheckCommand") && - object->GetType() != DynamicType::GetByName("EventCommand") && - object->GetType() != DynamicType::GetByName("NotificationCommand")) + if (object->GetType() != ConfigType::GetByName("Host") && + object->GetType() != ConfigType::GetByName("Service") && + object->GetType() != ConfigType::GetByName("User") && + object->GetType() != ConfigType::GetByName("CheckCommand") && + object->GetType() != ConfigType::GetByName("EventCommand") && + object->GetType() != ConfigType::GetByName("NotificationCommand")) return mod_attr_list; int flags = object->GetModifiedAttributes(); diff --git a/lib/icinga/customvarobject.hpp b/lib/icinga/customvarobject.hpp index 41327fe71..46dd59d17 100644 --- a/lib/icinga/customvarobject.hpp +++ b/lib/icinga/customvarobject.hpp @@ -22,7 +22,7 @@ #include "icinga/i2-icinga.hpp" #include "icinga/customvarobject.thpp" -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" #include "remote/messageorigin.hpp" namespace icinga diff --git a/lib/icinga/customvarobject.ti b/lib/icinga/customvarobject.ti index ee6a915c7..d4d027178 100644 --- a/lib/icinga/customvarobject.ti +++ b/lib/icinga/customvarobject.ti @@ -17,14 +17,14 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" library icinga; namespace icinga { -abstract class CustomVarObject : DynamicObject +abstract class CustomVarObject : ConfigObject { [config] Dictionary::Ptr vars; }; diff --git a/lib/icinga/dependency-apply.cpp b/lib/icinga/dependency-apply.cpp index 9f86befc5..8f650fd7a 100644 --- a/lib/icinga/dependency-apply.cpp +++ b/lib/icinga/dependency-apply.cpp @@ -22,7 +22,7 @@ #include "config/configitembuilder.hpp" #include "config/applyrule.hpp" #include "base/initialize.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/logger.hpp" #include "base/context.hpp" #include "base/workqueue.hpp" diff --git a/lib/icinga/dependency.cpp b/lib/icinga/dependency.cpp index fc1545e12..de7ebf390 100644 --- a/lib/icinga/dependency.cpp +++ b/lib/icinga/dependency.cpp @@ -82,7 +82,7 @@ void Dependency::OnConfigLoaded(void) void Dependency::OnAllConfigLoaded(void) { - DynamicObject::OnAllConfigLoaded(); + ConfigObject::OnAllConfigLoaded(); Host::Ptr childHost = Host::GetByName(GetChildHostName()); @@ -125,7 +125,7 @@ void Dependency::OnAllConfigLoaded(void) void Dependency::Stop(void) { - DynamicObject::Stop(); + ConfigObject::Stop(); GetChild()->RemoveDependency(this); GetParent()->RemoveReverseDependency(this); diff --git a/lib/icinga/hostgroup.cpp b/lib/icinga/hostgroup.cpp index c6e009628..fdf495aa1 100644 --- a/lib/icinga/hostgroup.cpp +++ b/lib/icinga/hostgroup.cpp @@ -21,7 +21,7 @@ #include "icinga/hostgroup.tcpp" #include "config/objectrule.hpp" #include "config/configitem.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/logger.hpp" #include "base/objectlock.hpp" #include "base/context.hpp" diff --git a/lib/icinga/icingaapplication.cpp b/lib/icinga/icingaapplication.cpp index e7920b4d2..e7b827f32 100644 --- a/lib/icinga/icingaapplication.cpp +++ b/lib/icinga/icingaapplication.cpp @@ -21,7 +21,7 @@ #include "icinga/icingaapplication.tcpp" #include "icinga/cib.hpp" #include "config/configwriter.cpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/logger.hpp" #include "base/objectlock.hpp" #include "base/convert.hpp" @@ -69,7 +69,7 @@ void IcingaApplication::StatsFunc(const Dictionary::Ptr& status, const Array::Pt { Dictionary::Ptr nodes = new Dictionary(); - BOOST_FOREACH(const IcingaApplication::Ptr& icingaapplication, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const IcingaApplication::Ptr& icingaapplication, ConfigType::GetObjectsByType()) { Dictionary::Ptr stats = new Dictionary(); stats->Set("node_name", icingaapplication->GetNodeName()); stats->Set("enable_notifications", icingaapplication->GetEnableNotifications()); @@ -138,7 +138,7 @@ void IcingaApplication::OnShutdown(void) DumpProgramState(); } -static void PersistModAttrHelper(const ConfigWriter::Ptr& cw, DynamicObject::Ptr& previousObject, const DynamicObject::Ptr& object, const String& attr, const Value& value) +static void PersistModAttrHelper(const ConfigWriter::Ptr& cw, ConfigObject::Ptr& previousObject, const ConfigObject::Ptr& object, const String& attr, const Value& value) { if (object != previousObject) { if (previousObject) @@ -168,11 +168,11 @@ static void PersistModAttrHelper(const ConfigWriter::Ptr& cw, DynamicObject::Ptr void IcingaApplication::DumpProgramState(void) { - DynamicObject::DumpObjects(GetStatePath()); + ConfigObject::DumpObjects(GetStatePath()); ConfigWriter::Ptr cw = new ConfigWriter(GetModAttrPath()); - DynamicObject::Ptr previousObject; - DynamicObject::DumpModifiedAttributes(boost::bind(&PersistModAttrHelper, cw, boost::ref(previousObject), _1, _2, _3)); + ConfigObject::Ptr previousObject; + ConfigObject::DumpModifiedAttributes(boost::bind(&PersistModAttrHelper, cw, boost::ref(previousObject), _1, _2, _3)); if (previousObject) cw->EmitRaw("\n}\n"); diff --git a/lib/icinga/icingastatuswriter.cpp b/lib/icinga/icingastatuswriter.cpp index f01ec4754..b9963783c 100644 --- a/lib/icinga/icingastatuswriter.cpp +++ b/lib/icinga/icingastatuswriter.cpp @@ -20,7 +20,7 @@ #include "icinga/icingastatuswriter.hpp" #include "icinga/icingastatuswriter.tcpp" #include "icinga/cib.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/logger.hpp" #include "base/exception.hpp" #include "base/application.hpp" @@ -40,7 +40,7 @@ void IcingaStatusWriter::StatsFunc(const Dictionary::Ptr& status, const Array::P { Dictionary::Ptr nodes = new Dictionary(); - BOOST_FOREACH(const IcingaStatusWriter::Ptr& icingastatuswriter, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const IcingaStatusWriter::Ptr& icingastatuswriter, ConfigType::GetObjectsByType()) { nodes->Set(icingastatuswriter->GetName(), 1); //add more stats } @@ -58,7 +58,7 @@ void IcingaStatusWriter::StatsFunc(const Dictionary::Ptr& status, const Array::P */ void IcingaStatusWriter::Start(void) { - DynamicObject::Start(); + ConfigObject::Start(); m_StatusTimer = new Timer(); m_StatusTimer->SetInterval(GetUpdateInterval()); diff --git a/lib/icinga/icingastatuswriter.ti b/lib/icinga/icingastatuswriter.ti index f99c8ae0d..1421dcce7 100644 --- a/lib/icinga/icingastatuswriter.ti +++ b/lib/icinga/icingastatuswriter.ti @@ -25,7 +25,7 @@ library icinga; namespace icinga { -class IcingaStatusWriter : DynamicObject +class IcingaStatusWriter : ConfigObject { [config] String status_path { default {{{ return Application::GetLocalStateDir() + "/cache/icinga2/status.json"; }}} diff --git a/lib/icinga/macroprocessor.cpp b/lib/icinga/macroprocessor.cpp index e6a72252b..07f38b429 100644 --- a/lib/icinga/macroprocessor.cpp +++ b/lib/icinga/macroprocessor.cpp @@ -24,7 +24,7 @@ #include "base/objectlock.hpp" #include "base/logger.hpp" #include "base/context.hpp" -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" #include "base/scriptframe.hpp" #include #include diff --git a/lib/icinga/notification-apply.cpp b/lib/icinga/notification-apply.cpp index 707cf59d7..9d46b49d7 100644 --- a/lib/icinga/notification-apply.cpp +++ b/lib/icinga/notification-apply.cpp @@ -22,7 +22,7 @@ #include "config/configitembuilder.hpp" #include "config/applyrule.hpp" #include "base/initialize.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/logger.hpp" #include "base/context.hpp" #include "base/workqueue.hpp" diff --git a/lib/icinga/notification.cpp b/lib/icinga/notification.cpp index 45ba8ba43..5488345c5 100644 --- a/lib/icinga/notification.cpp +++ b/lib/icinga/notification.cpp @@ -115,7 +115,7 @@ void Notification::OnAllConfigLoaded(void) void Notification::Start(void) { - DynamicObject::Start(); + ConfigObject::Start(); Checkable::Ptr obj = GetCheckable(); @@ -125,7 +125,7 @@ void Notification::Start(void) void Notification::Stop(void) { - DynamicObject::Stop(); + ConfigObject::Stop(); Checkable::Ptr obj = GetCheckable(); diff --git a/lib/icinga/scheduleddowntime-apply.cpp b/lib/icinga/scheduleddowntime-apply.cpp index ebbb631da..9088d7bb1 100644 --- a/lib/icinga/scheduleddowntime-apply.cpp +++ b/lib/icinga/scheduleddowntime-apply.cpp @@ -22,7 +22,7 @@ #include "config/configitembuilder.hpp" #include "config/applyrule.hpp" #include "base/initialize.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/logger.hpp" #include "base/context.hpp" #include "base/exception.hpp" diff --git a/lib/icinga/scheduleddowntime.cpp b/lib/icinga/scheduleddowntime.cpp index 21d14f477..908493fb0 100644 --- a/lib/icinga/scheduleddowntime.cpp +++ b/lib/icinga/scheduleddowntime.cpp @@ -23,7 +23,7 @@ #include "icinga/downtime.hpp" #include "icinga/service.hpp" #include "base/timer.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/initialize.hpp" #include "base/utility.hpp" #include "base/objectlock.hpp" @@ -98,14 +98,14 @@ void ScheduledDowntime::OnAllConfigLoaded(void) void ScheduledDowntime::Start(void) { - DynamicObject::Start(); + ConfigObject::Start(); CreateNextDowntime(); } void ScheduledDowntime::TimerProc(void) { - BOOST_FOREACH(const ScheduledDowntime::Ptr& sd, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const ScheduledDowntime::Ptr& sd, ConfigType::GetObjectsByType()) { sd->CreateNextDowntime(); } } diff --git a/lib/icinga/service-apply.cpp b/lib/icinga/service-apply.cpp index 00baa5e65..b6373c5e1 100644 --- a/lib/icinga/service-apply.cpp +++ b/lib/icinga/service-apply.cpp @@ -21,7 +21,7 @@ #include "config/configitembuilder.hpp" #include "config/applyrule.hpp" #include "base/initialize.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/logger.hpp" #include "base/context.hpp" #include "base/workqueue.hpp" diff --git a/lib/icinga/servicegroup.cpp b/lib/icinga/servicegroup.cpp index 5513889dc..8e4a39304 100644 --- a/lib/icinga/servicegroup.cpp +++ b/lib/icinga/servicegroup.cpp @@ -21,7 +21,7 @@ #include "icinga/servicegroup.tcpp" #include "config/objectrule.hpp" #include "config/configitem.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/objectlock.hpp" #include "base/logger.hpp" #include "base/context.hpp" diff --git a/lib/icinga/timeperiod.cpp b/lib/icinga/timeperiod.cpp index 2611a7ed3..7a37ee80a 100644 --- a/lib/icinga/timeperiod.cpp +++ b/lib/icinga/timeperiod.cpp @@ -20,7 +20,7 @@ #include "icinga/timeperiod.hpp" #include "icinga/timeperiod.tcpp" #include "icinga/legacytimeperiod.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/objectlock.hpp" #include "base/exception.hpp" #include "base/logger.hpp" @@ -46,7 +46,7 @@ void TimePeriod::StaticInitialize(void) void TimePeriod::Start(void) { - DynamicObject::Start(); + ConfigObject::Start(); /* Pre-fill the time period for the next 24 hours. */ double now = Utility::GetTime(); @@ -268,7 +268,7 @@ void TimePeriod::UpdateTimerHandler(void) { double now = Utility::GetTime(); - BOOST_FOREACH(const TimePeriod::Ptr& tp, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const TimePeriod::Ptr& tp, ConfigType::GetObjectsByType()) { double valid_end; { diff --git a/lib/icinga/user.cpp b/lib/icinga/user.cpp index 073bd9d61..ff4d9661f 100644 --- a/lib/icinga/user.cpp +++ b/lib/icinga/user.cpp @@ -32,7 +32,7 @@ REGISTER_TYPE(User); void User::OnConfigLoaded(void) { - DynamicObject::OnConfigLoaded(); + ConfigObject::OnConfigLoaded(); SetTypeFilter(FilterArrayToInt(GetTypes(), ~0)); SetStateFilter(FilterArrayToInt(GetStates(), ~0)); @@ -40,7 +40,7 @@ void User::OnConfigLoaded(void) void User::OnAllConfigLoaded(void) { - DynamicObject::OnAllConfigLoaded(); + ConfigObject::OnAllConfigLoaded(); UserGroup::EvaluateObjectRules(this); @@ -62,7 +62,7 @@ void User::OnAllConfigLoaded(void) void User::Stop(void) { - DynamicObject::Stop(); + ConfigObject::Stop(); Array::Ptr groups = GetGroups(); diff --git a/lib/icinga/usergroup.cpp b/lib/icinga/usergroup.cpp index 82bc4b518..f122b231c 100644 --- a/lib/icinga/usergroup.cpp +++ b/lib/icinga/usergroup.cpp @@ -21,7 +21,7 @@ #include "icinga/usergroup.tcpp" #include "config/objectrule.hpp" #include "config/configitem.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/objectlock.hpp" #include "base/logger.hpp" #include "base/context.hpp" diff --git a/lib/livestatus/commandstable.cpp b/lib/livestatus/commandstable.cpp index 349d6068b..f8e7c133e 100644 --- a/lib/livestatus/commandstable.cpp +++ b/lib/livestatus/commandstable.cpp @@ -23,7 +23,7 @@ #include "icinga/eventcommand.hpp" #include "icinga/notificationcommand.hpp" #include "icinga/compatutility.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/objectlock.hpp" #include "base/convert.hpp" #include @@ -60,17 +60,17 @@ String CommandsTable::GetPrefix(void) const void CommandsTable::FetchRows(const AddRowFunction& addRowFn) { - BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const ConfigObject::Ptr& object, ConfigType::GetObjectsByType()) { if (!addRowFn(object, LivestatusGroupByNone, Empty)) return; } - BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const ConfigObject::Ptr& object, ConfigType::GetObjectsByType()) { if (!addRowFn(object, LivestatusGroupByNone, Empty)) return; } - BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const ConfigObject::Ptr& object, ConfigType::GetObjectsByType()) { if (!addRowFn(object, LivestatusGroupByNone, Empty)) return; } diff --git a/lib/livestatus/commentstable.cpp b/lib/livestatus/commentstable.cpp index a9b297864..c182c84d4 100644 --- a/lib/livestatus/commentstable.cpp +++ b/lib/livestatus/commentstable.cpp @@ -21,7 +21,7 @@ #include "livestatus/hoststable.hpp" #include "livestatus/servicestable.hpp" #include "icinga/service.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/objectlock.hpp" #include #include @@ -65,7 +65,7 @@ String CommentsTable::GetPrefix(void) const void CommentsTable::FetchRows(const AddRowFunction& addRowFn) { - BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType()) { Dictionary::Ptr comments = host->GetComments(); ObjectLock olock(comments); @@ -80,7 +80,7 @@ void CommentsTable::FetchRows(const AddRowFunction& addRowFn) } } - BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const Service::Ptr& service, ConfigType::GetObjectsByType()) { Dictionary::Ptr comments = service->GetComments(); ObjectLock olock(comments); diff --git a/lib/livestatus/contactgroupstable.cpp b/lib/livestatus/contactgroupstable.cpp index c1f9b6c03..fdf807441 100644 --- a/lib/livestatus/contactgroupstable.cpp +++ b/lib/livestatus/contactgroupstable.cpp @@ -19,7 +19,7 @@ #include "livestatus/contactgroupstable.hpp" #include "icinga/usergroup.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include using namespace icinga; @@ -49,7 +49,7 @@ String ContactGroupsTable::GetPrefix(void) const void ContactGroupsTable::FetchRows(const AddRowFunction& addRowFn) { - BOOST_FOREACH(const UserGroup::Ptr& ug, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const UserGroup::Ptr& ug, ConfigType::GetObjectsByType()) { if (!addRowFn(ug, LivestatusGroupByNone, Empty)) return; } diff --git a/lib/livestatus/contactstable.cpp b/lib/livestatus/contactstable.cpp index e557ae89f..490ca5e68 100644 --- a/lib/livestatus/contactstable.cpp +++ b/lib/livestatus/contactstable.cpp @@ -21,7 +21,7 @@ #include "icinga/user.hpp" #include "icinga/timeperiod.hpp" #include "icinga/compatutility.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/objectlock.hpp" #include "base/json.hpp" #include "base/utility.hpp" @@ -70,7 +70,7 @@ String ContactsTable::GetPrefix(void) const void ContactsTable::FetchRows(const AddRowFunction& addRowFn) { - BOOST_FOREACH(const User::Ptr& user, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const User::Ptr& user, ConfigType::GetObjectsByType()) { if (!addRowFn(user, LivestatusGroupByNone, Empty)) return; } diff --git a/lib/livestatus/downtimestable.cpp b/lib/livestatus/downtimestable.cpp index e9b8ed7c9..0bfc301e9 100644 --- a/lib/livestatus/downtimestable.cpp +++ b/lib/livestatus/downtimestable.cpp @@ -21,7 +21,7 @@ #include "livestatus/hoststable.hpp" #include "livestatus/servicestable.hpp" #include "icinga/service.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/objectlock.hpp" #include #include @@ -65,7 +65,7 @@ String DowntimesTable::GetPrefix(void) const void DowntimesTable::FetchRows(const AddRowFunction& addRowFn) { - BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType()) { Dictionary::Ptr downtimes = host->GetDowntimes(); ObjectLock olock(downtimes); @@ -80,7 +80,7 @@ void DowntimesTable::FetchRows(const AddRowFunction& addRowFn) } } - BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const Service::Ptr& service, ConfigType::GetObjectsByType()) { Dictionary::Ptr downtimes = service->GetDowntimes(); ObjectLock olock(downtimes); diff --git a/lib/livestatus/endpointstable.cpp b/lib/livestatus/endpointstable.cpp index ef8b1d290..fe8e53d51 100644 --- a/lib/livestatus/endpointstable.cpp +++ b/lib/livestatus/endpointstable.cpp @@ -23,7 +23,7 @@ #include "icinga/icingaapplication.hpp" #include "remote/endpoint.hpp" #include "remote/zone.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/objectlock.hpp" #include "base/convert.hpp" #include "base/utility.hpp" @@ -62,7 +62,7 @@ String EndpointsTable::GetPrefix(void) const void EndpointsTable::FetchRows(const AddRowFunction& addRowFn) { - BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const Endpoint::Ptr& endpoint, ConfigType::GetObjectsByType()) { if (!addRowFn(endpoint, LivestatusGroupByNone, Empty)) return; } diff --git a/lib/livestatus/hostgroupstable.cpp b/lib/livestatus/hostgroupstable.cpp index 01782aa9a..591cf8974 100644 --- a/lib/livestatus/hostgroupstable.cpp +++ b/lib/livestatus/hostgroupstable.cpp @@ -21,7 +21,7 @@ #include "icinga/hostgroup.hpp" #include "icinga/host.hpp" #include "icinga/service.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include using namespace icinga; @@ -73,7 +73,7 @@ String HostGroupsTable::GetPrefix(void) const void HostGroupsTable::FetchRows(const AddRowFunction& addRowFn) { - BOOST_FOREACH(const HostGroup::Ptr& hg, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const HostGroup::Ptr& hg, ConfigType::GetObjectsByType()) { if (!addRowFn(hg, LivestatusGroupByNone, Empty)) return; } diff --git a/lib/livestatus/hoststable.cpp b/lib/livestatus/hoststable.cpp index bff1b7de0..02c028d79 100644 --- a/lib/livestatus/hoststable.cpp +++ b/lib/livestatus/hoststable.cpp @@ -29,7 +29,7 @@ #include "icinga/macroprocessor.hpp" #include "icinga/icingaapplication.hpp" #include "icinga/compatutility.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/objectlock.hpp" #include "base/json.hpp" #include "base/convert.hpp" @@ -187,7 +187,7 @@ String HostsTable::GetPrefix(void) const void HostsTable::FetchRows(const AddRowFunction& addRowFn) { if (GetGroupByType() == LivestatusGroupByHostGroup) { - BOOST_FOREACH(const HostGroup::Ptr& hg, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const HostGroup::Ptr& hg, ConfigType::GetObjectsByType()) { BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) { /* the caller must know which groupby type and value are set for this row */ if (!addRowFn(host, LivestatusGroupByHostGroup, hg)) @@ -195,7 +195,7 @@ void HostsTable::FetchRows(const AddRowFunction& addRowFn) } } } else { - BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType()) { if (!addRowFn(host, LivestatusGroupByNone, Empty)) return; } diff --git a/lib/livestatus/livestatuslistener.cpp b/lib/livestatus/livestatuslistener.cpp index 10a46d4d9..98aa99db6 100644 --- a/lib/livestatus/livestatuslistener.cpp +++ b/lib/livestatus/livestatuslistener.cpp @@ -22,7 +22,7 @@ #include "icinga/perfdatavalue.hpp" #include "base/utility.hpp" #include "base/objectlock.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/logger.hpp" #include "base/exception.hpp" #include "base/tcpsocket.hpp" @@ -47,7 +47,7 @@ void LivestatusListener::StatsFunc(const Dictionary::Ptr& status, const Array::P { Dictionary::Ptr nodes = new Dictionary(); - BOOST_FOREACH(const LivestatusListener::Ptr& livestatuslistener, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const LivestatusListener::Ptr& livestatuslistener, ConfigType::GetObjectsByType()) { Dictionary::Ptr stats = new Dictionary(); stats->Set("connections", l_Connections); @@ -64,7 +64,7 @@ void LivestatusListener::StatsFunc(const Dictionary::Ptr& status, const Array::P */ void LivestatusListener::Start(void) { - DynamicObject::Start(); + ConfigObject::Start(); if (GetSocketType() == "tcp") { TcpSocket::Ptr socket = new TcpSocket(); @@ -121,7 +121,7 @@ void LivestatusListener::Start(void) void LivestatusListener::Stop(void) { - DynamicObject::Stop(); + ConfigObject::Stop(); m_Listener->Close(); diff --git a/lib/livestatus/livestatuslistener.ti b/lib/livestatus/livestatuslistener.ti index bbc8d0e35..f6a1c8ee9 100644 --- a/lib/livestatus/livestatuslistener.ti +++ b/lib/livestatus/livestatuslistener.ti @@ -17,7 +17,7 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" #include "base/application.hpp" library livestatus; @@ -25,7 +25,7 @@ library livestatus; namespace icinga { -class LivestatusListener : DynamicObject { +class LivestatusListener : ConfigObject { [config] String socket_type { default {{{ return "unix"; }}} }; diff --git a/lib/livestatus/servicegroupstable.cpp b/lib/livestatus/servicegroupstable.cpp index c1f81af2b..3eed539bf 100644 --- a/lib/livestatus/servicegroupstable.cpp +++ b/lib/livestatus/servicegroupstable.cpp @@ -19,7 +19,7 @@ #include "livestatus/servicegroupstable.hpp" #include "icinga/servicegroup.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include using namespace icinga; @@ -64,7 +64,7 @@ String ServiceGroupsTable::GetPrefix(void) const void ServiceGroupsTable::FetchRows(const AddRowFunction& addRowFn) { - BOOST_FOREACH(const ServiceGroup::Ptr& sg, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const ServiceGroup::Ptr& sg, ConfigType::GetObjectsByType()) { if (!addRowFn(sg, LivestatusGroupByNone, Empty)) return; } diff --git a/lib/livestatus/servicestable.cpp b/lib/livestatus/servicestable.cpp index 729141143..644240a94 100644 --- a/lib/livestatus/servicestable.cpp +++ b/lib/livestatus/servicestable.cpp @@ -31,7 +31,7 @@ #include "icinga/macroprocessor.hpp" #include "icinga/icingaapplication.hpp" #include "icinga/compatutility.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/objectlock.hpp" #include "base/json.hpp" #include "base/convert.hpp" @@ -167,7 +167,7 @@ String ServicesTable::GetPrefix(void) const void ServicesTable::FetchRows(const AddRowFunction& addRowFn) { if (GetGroupByType() == LivestatusGroupByServiceGroup) { - BOOST_FOREACH(const ServiceGroup::Ptr& sg, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const ServiceGroup::Ptr& sg, ConfigType::GetObjectsByType()) { BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) { /* the caller must know which groupby type and value are set for this row */ if (!addRowFn(service, LivestatusGroupByServiceGroup, sg)) @@ -175,7 +175,7 @@ void ServicesTable::FetchRows(const AddRowFunction& addRowFn) } } } else if (GetGroupByType() == LivestatusGroupByHostGroup) { - BOOST_FOREACH(const HostGroup::Ptr& hg, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const HostGroup::Ptr& hg, ConfigType::GetObjectsByType()) { ObjectLock ylock(hg); BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) { ObjectLock ylock(host); @@ -187,7 +187,7 @@ void ServicesTable::FetchRows(const AddRowFunction& addRowFn) } } } else { - BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const Service::Ptr& service, ConfigType::GetObjectsByType()) { if (!addRowFn(service, LivestatusGroupByNone, Empty)) return; } diff --git a/lib/livestatus/statustable.cpp b/lib/livestatus/statustable.cpp index 2a2078256..1bcd6c305 100644 --- a/lib/livestatus/statustable.cpp +++ b/lib/livestatus/statustable.cpp @@ -23,7 +23,7 @@ #include "icinga/cib.hpp" #include "icinga/host.hpp" #include "icinga/service.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/utility.hpp" #include "base/application.hpp" #include @@ -207,12 +207,12 @@ Value StatusTable::ProgramStartAccessor(const Value&) Value StatusTable::NumHostsAccessor(const Value&) { - return std::distance(DynamicType::GetObjectsByType().first, DynamicType::GetObjectsByType().second); + return std::distance(ConfigType::GetObjectsByType().first, ConfigType::GetObjectsByType().second); } Value StatusTable::NumServicesAccessor(const Value&) { - return std::distance(DynamicType::GetObjectsByType().first, DynamicType::GetObjectsByType().second); + return std::distance(ConfigType::GetObjectsByType().first, ConfigType::GetObjectsByType().second); } Value StatusTable::ProgramVersionAccessor(const Value&) diff --git a/lib/livestatus/timeperiodstable.cpp b/lib/livestatus/timeperiodstable.cpp index 31e1ed5ab..cf60b5822 100644 --- a/lib/livestatus/timeperiodstable.cpp +++ b/lib/livestatus/timeperiodstable.cpp @@ -20,7 +20,7 @@ #include "livestatus/timeperiodstable.hpp" #include "icinga/icingaapplication.hpp" #include "icinga/timeperiod.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/objectlock.hpp" #include "base/convert.hpp" #include "base/utility.hpp" @@ -54,7 +54,7 @@ String TimePeriodsTable::GetPrefix(void) const void TimePeriodsTable::FetchRows(const AddRowFunction& addRowFn) { - BOOST_FOREACH(const TimePeriod::Ptr& tp, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const TimePeriod::Ptr& tp, ConfigType::GetObjectsByType()) { if (!addRowFn(tp, LivestatusGroupByNone, Empty)) return; } diff --git a/lib/livestatus/zonestable.cpp b/lib/livestatus/zonestable.cpp index 89461d97e..1265320da 100644 --- a/lib/livestatus/zonestable.cpp +++ b/lib/livestatus/zonestable.cpp @@ -19,7 +19,7 @@ #include "livestatus/zonestable.hpp" #include "remote/zone.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include using namespace icinga; @@ -50,7 +50,7 @@ String ZonesTable::GetPrefix(void) const void ZonesTable::FetchRows(const AddRowFunction& addRowFn) { - BOOST_FOREACH(const Zone::Ptr& zone, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const Zone::Ptr& zone, ConfigType::GetObjectsByType()) { if (!addRowFn(zone, LivestatusGroupByNone, Empty)) return; } diff --git a/lib/methods/clrchecktask.cpp b/lib/methods/clrchecktask.cpp index 254e24225..be3b19564 100644 --- a/lib/methods/clrchecktask.cpp +++ b/lib/methods/clrchecktask.cpp @@ -22,7 +22,7 @@ #include "icinga/checkcommand.hpp" #include "icinga/macroprocessor.hpp" #include "icinga/icingaapplication.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/logger.hpp" #include "base/function.hpp" #include "base/utility.hpp" diff --git a/lib/methods/clusterchecktask.cpp b/lib/methods/clusterchecktask.cpp index bfe8c972e..77bddce23 100644 --- a/lib/methods/clusterchecktask.cpp +++ b/lib/methods/clusterchecktask.cpp @@ -28,7 +28,7 @@ #include "base/convert.hpp" #include "base/utility.hpp" #include "base/function.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include #include diff --git a/lib/methods/icingachecktask.cpp b/lib/methods/icingachecktask.cpp index 7ff5a9f4e..5e2643db9 100644 --- a/lib/methods/icingachecktask.cpp +++ b/lib/methods/icingachecktask.cpp @@ -26,7 +26,7 @@ #include "base/objectlock.hpp" #include "base/utility.hpp" #include "base/function.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" using namespace icinga; diff --git a/lib/methods/pluginchecktask.cpp b/lib/methods/pluginchecktask.cpp index bf1e5fee8..ed39ed6c9 100644 --- a/lib/methods/pluginchecktask.cpp +++ b/lib/methods/pluginchecktask.cpp @@ -22,7 +22,7 @@ #include "icinga/checkcommand.hpp" #include "icinga/macroprocessor.hpp" #include "icinga/icingaapplication.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/logger.hpp" #include "base/function.hpp" #include "base/utility.hpp" diff --git a/lib/methods/plugineventtask.cpp b/lib/methods/plugineventtask.cpp index bf6e08749..e753949aa 100644 --- a/lib/methods/plugineventtask.cpp +++ b/lib/methods/plugineventtask.cpp @@ -22,7 +22,7 @@ #include "icinga/macroprocessor.hpp" #include "icinga/pluginutility.hpp" #include "icinga/icingaapplication.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/logger.hpp" #include "base/function.hpp" #include "base/utility.hpp" diff --git a/lib/notification/notificationcomponent.cpp b/lib/notification/notificationcomponent.cpp index bc0011694..ccd2f6154 100644 --- a/lib/notification/notificationcomponent.cpp +++ b/lib/notification/notificationcomponent.cpp @@ -21,7 +21,7 @@ #include "notification/notificationcomponent.tcpp" #include "icinga/service.hpp" #include "icinga/icingaapplication.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/objectlock.hpp" #include "base/logger.hpp" #include "base/utility.hpp" @@ -39,7 +39,7 @@ void NotificationComponent::StatsFunc(const Dictionary::Ptr& status, const Array { Dictionary::Ptr nodes = new Dictionary(); - BOOST_FOREACH(const NotificationComponent::Ptr& notification_component, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const NotificationComponent::Ptr& notification_component, ConfigType::GetObjectsByType()) { nodes->Set(notification_component->GetName(), 1); //add more stats } @@ -51,7 +51,7 @@ void NotificationComponent::StatsFunc(const Dictionary::Ptr& status, const Array */ void NotificationComponent::Start(void) { - DynamicObject::Start(); + ConfigObject::Start(); Checkable::OnNotificationsRequested.connect(boost::bind(&NotificationComponent::SendNotificationsHandler, this, _1, _2, _3, _4, _5)); @@ -71,7 +71,7 @@ void NotificationComponent::NotificationTimerHandler(void) { double now = Utility::GetTime(); - BOOST_FOREACH(const Notification::Ptr& notification, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const Notification::Ptr& notification, ConfigType::GetObjectsByType()) { Checkable::Ptr checkable = notification->GetCheckable(); if (checkable->IsPaused() && GetEnableHA()) diff --git a/lib/notification/notificationcomponent.hpp b/lib/notification/notificationcomponent.hpp index e75f63fef..88e8fd0a5 100644 --- a/lib/notification/notificationcomponent.hpp +++ b/lib/notification/notificationcomponent.hpp @@ -22,7 +22,7 @@ #include "notification/notificationcomponent.thpp" #include "icinga/service.hpp" -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" #include "base/timer.hpp" namespace icinga diff --git a/lib/notification/notificationcomponent.ti b/lib/notification/notificationcomponent.ti index 31d78e22c..55422e13e 100644 --- a/lib/notification/notificationcomponent.ti +++ b/lib/notification/notificationcomponent.ti @@ -17,14 +17,14 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" library notification; namespace icinga { -class NotificationComponent : DynamicObject +class NotificationComponent : ConfigObject { [config] bool enable_ha (EnableHA) { default {{{ return true; }}} diff --git a/lib/perfdata/gelfwriter.cpp b/lib/perfdata/gelfwriter.cpp index 1efec3ec6..10a9a948f 100644 --- a/lib/perfdata/gelfwriter.cpp +++ b/lib/perfdata/gelfwriter.cpp @@ -25,7 +25,7 @@ #include "icinga/compatutility.hpp" #include "icinga/perfdatavalue.hpp" #include "base/tcpsocket.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/objectlock.hpp" #include "base/logger.hpp" #include "base/utility.hpp" @@ -40,7 +40,7 @@ REGISTER_TYPE(GelfWriter); void GelfWriter::Start(void) { - DynamicObject::Start(); + ConfigObject::Start(); m_ReconnectTimer = new Timer(); m_ReconnectTimer->SetInterval(10); diff --git a/lib/perfdata/gelfwriter.hpp b/lib/perfdata/gelfwriter.hpp index 374010c12..7b2dc6847 100644 --- a/lib/perfdata/gelfwriter.hpp +++ b/lib/perfdata/gelfwriter.hpp @@ -22,7 +22,7 @@ #include "perfdata/gelfwriter.thpp" #include "icinga/service.hpp" -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" #include "base/tcpsocket.hpp" #include "base/timer.hpp" #include diff --git a/lib/perfdata/gelfwriter.ti b/lib/perfdata/gelfwriter.ti index d2b00eddd..1f7fdc16c 100644 --- a/lib/perfdata/gelfwriter.ti +++ b/lib/perfdata/gelfwriter.ti @@ -17,14 +17,14 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" library perfdata; namespace icinga { -class GelfWriter : DynamicObject +class GelfWriter : ConfigObject { [config] String host { default {{{ return "127.0.0.1"; }}} diff --git a/lib/perfdata/graphitewriter.cpp b/lib/perfdata/graphitewriter.cpp index ef717116f..8a48ceb66 100644 --- a/lib/perfdata/graphitewriter.cpp +++ b/lib/perfdata/graphitewriter.cpp @@ -25,7 +25,7 @@ #include "icinga/compatutility.hpp" #include "icinga/perfdatavalue.hpp" #include "base/tcpsocket.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/objectlock.hpp" #include "base/logger.hpp" #include "base/convert.hpp" @@ -51,7 +51,7 @@ void GraphiteWriter::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr&) { Dictionary::Ptr nodes = new Dictionary(); - BOOST_FOREACH(const GraphiteWriter::Ptr& graphitewriter, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const GraphiteWriter::Ptr& graphitewriter, ConfigType::GetObjectsByType()) { nodes->Set(graphitewriter->GetName(), 1); //add more stats } @@ -60,7 +60,7 @@ void GraphiteWriter::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr&) void GraphiteWriter::Start(void) { - DynamicObject::Start(); + ConfigObject::Start(); m_ReconnectTimer = new Timer(); m_ReconnectTimer->SetInterval(10); diff --git a/lib/perfdata/graphitewriter.hpp b/lib/perfdata/graphitewriter.hpp index e20c88f22..32d961bbd 100644 --- a/lib/perfdata/graphitewriter.hpp +++ b/lib/perfdata/graphitewriter.hpp @@ -22,7 +22,7 @@ #include "perfdata/graphitewriter.thpp" #include "icinga/service.hpp" -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" #include "base/tcpsocket.hpp" #include "base/timer.hpp" #include diff --git a/lib/perfdata/graphitewriter.ti b/lib/perfdata/graphitewriter.ti index cfcaa694a..3863d4f3b 100644 --- a/lib/perfdata/graphitewriter.ti +++ b/lib/perfdata/graphitewriter.ti @@ -17,14 +17,14 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" library perfdata; namespace icinga { -class GraphiteWriter : DynamicObject +class GraphiteWriter : ConfigObject { [config] String host { default {{{ return "127.0.0.1"; }}} diff --git a/lib/perfdata/opentsdbwriter.cpp b/lib/perfdata/opentsdbwriter.cpp index 44f575177..b8c51414b 100644 --- a/lib/perfdata/opentsdbwriter.cpp +++ b/lib/perfdata/opentsdbwriter.cpp @@ -25,7 +25,7 @@ #include "icinga/compatutility.hpp" #include "icinga/perfdatavalue.hpp" #include "base/tcpsocket.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/objectlock.hpp" #include "base/logger.hpp" #include "base/convert.hpp" @@ -51,7 +51,7 @@ void OpenTsdbWriter::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr&) { Dictionary::Ptr nodes = new Dictionary(); - BOOST_FOREACH(const OpenTsdbWriter::Ptr& opentsdbwriter, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const OpenTsdbWriter::Ptr& opentsdbwriter, ConfigType::GetObjectsByType()) { nodes->Set(opentsdbwriter->GetName(), 1); //add more stats } @@ -60,7 +60,7 @@ void OpenTsdbWriter::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr&) void OpenTsdbWriter::Start(void) { - DynamicObject::Start(); + ConfigObject::Start(); m_ReconnectTimer = new Timer(); m_ReconnectTimer->SetInterval(10); diff --git a/lib/perfdata/opentsdbwriter.hpp b/lib/perfdata/opentsdbwriter.hpp index 4aa3afff8..02649cbcc 100644 --- a/lib/perfdata/opentsdbwriter.hpp +++ b/lib/perfdata/opentsdbwriter.hpp @@ -22,7 +22,7 @@ #include "perfdata/opentsdbwriter.thpp" #include "icinga/service.hpp" -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" #include "base/tcpsocket.hpp" #include "base/timer.hpp" #include diff --git a/lib/perfdata/opentsdbwriter.ti b/lib/perfdata/opentsdbwriter.ti index 3e63e9cf6..74c3dbbb1 100644 --- a/lib/perfdata/opentsdbwriter.ti +++ b/lib/perfdata/opentsdbwriter.ti @@ -17,14 +17,14 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" library perfdata; namespace icinga { -class OpenTsdbWriter : DynamicObject +class OpenTsdbWriter : ConfigObject { [config] String host { default {{{ return "127.0.0.1"; }}} diff --git a/lib/perfdata/perfdatawriter.cpp b/lib/perfdata/perfdatawriter.cpp index 94a5c5090..0f9cc664c 100644 --- a/lib/perfdata/perfdatawriter.cpp +++ b/lib/perfdata/perfdatawriter.cpp @@ -22,7 +22,7 @@ #include "icinga/service.hpp" #include "icinga/macroprocessor.hpp" #include "icinga/icingaapplication.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/objectlock.hpp" #include "base/logger.hpp" #include "base/convert.hpp" @@ -42,7 +42,7 @@ void PerfdataWriter::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr&) { Dictionary::Ptr nodes = new Dictionary(); - BOOST_FOREACH(const PerfdataWriter::Ptr& perfdatawriter, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const PerfdataWriter::Ptr& perfdatawriter, ConfigType::GetObjectsByType()) { nodes->Set(perfdatawriter->GetName(), 1); //add more stats } @@ -51,7 +51,7 @@ void PerfdataWriter::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr&) void PerfdataWriter::Start(void) { - DynamicObject::Start(); + ConfigObject::Start(); Checkable::OnNewCheckResult.connect(boost::bind(&PerfdataWriter::CheckResultHandler, this, _1, _2)); diff --git a/lib/perfdata/perfdatawriter.hpp b/lib/perfdata/perfdatawriter.hpp index aa58c7a1b..b5f406296 100644 --- a/lib/perfdata/perfdatawriter.hpp +++ b/lib/perfdata/perfdatawriter.hpp @@ -22,7 +22,7 @@ #include "perfdata/perfdatawriter.thpp" #include "icinga/service.hpp" -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" #include "base/timer.hpp" #include diff --git a/lib/perfdata/perfdatawriter.ti b/lib/perfdata/perfdatawriter.ti index 753dbf0a4..f73d12ec7 100644 --- a/lib/perfdata/perfdatawriter.ti +++ b/lib/perfdata/perfdatawriter.ti @@ -17,7 +17,7 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" #include "base/application.hpp" library perfdata; @@ -25,7 +25,7 @@ library perfdata; namespace icinga { -class PerfdataWriter : DynamicObject +class PerfdataWriter : ConfigObject { [config] String host_perfdata_path { default {{{ return Application::GetLocalStateDir() + "/spool/icinga2/perfdata/host-perfdata"; }}} diff --git a/lib/remote/actionshandler.cpp b/lib/remote/actionshandler.cpp index f9291d492..89ad36910 100644 --- a/lib/remote/actionshandler.cpp +++ b/lib/remote/actionshandler.cpp @@ -57,11 +57,11 @@ bool ActionsHandler::HandleRequest(const ApiUser::Ptr& user, HttpRequest& reques Dictionary::Ptr params = HttpUtility::FetchRequestParameters(request); - std::vector objs = FilterUtility::GetFilterTargets(qd, params); + std::vector objs = FilterUtility::GetFilterTargets(qd, params); Array::Ptr results = new Array(); - BOOST_FOREACH(const DynamicObject::Ptr& obj, objs) { + BOOST_FOREACH(const ConfigObject::Ptr& obj, objs) { try { results->Add(action->Invoke(obj, params)); } catch (const std::exception& ex) { diff --git a/lib/remote/apiaction.cpp b/lib/remote/apiaction.cpp index 3c999d3e7..ba4c4dcff 100644 --- a/lib/remote/apiaction.cpp +++ b/lib/remote/apiaction.cpp @@ -26,7 +26,7 @@ ApiAction::ApiAction(const std::vector& types, const Callback& action) : m_Types(types), m_Callback(action) { } -Value ApiAction::Invoke(const DynamicObject::Ptr& target, const Dictionary::Ptr& params) +Value ApiAction::Invoke(const ConfigObject::Ptr& target, const Dictionary::Ptr& params) { return m_Callback(target, params); } diff --git a/lib/remote/apiaction.hpp b/lib/remote/apiaction.hpp index ff7e92432..e95f67853 100644 --- a/lib/remote/apiaction.hpp +++ b/lib/remote/apiaction.hpp @@ -24,7 +24,7 @@ #include "base/registry.hpp" #include "base/value.hpp" #include "base/dictionary.hpp" -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" #include #include #include @@ -44,11 +44,11 @@ class I2_REMOTE_API ApiAction : public Object public: DECLARE_PTR_TYPEDEFS(ApiAction); - typedef boost::function Callback; + typedef boost::function Callback; ApiAction(const std::vector& registerTypes, const Callback& function); - Value Invoke(const DynamicObject::Ptr& target, const Dictionary::Ptr& params); + Value Invoke(const ConfigObject::Ptr& target, const Dictionary::Ptr& params); const std::vector& GetTypes(void) const; diff --git a/lib/remote/apilistener-sync.cpp b/lib/remote/apilistener-sync.cpp index 920d30985..95edd3ff7 100644 --- a/lib/remote/apilistener-sync.cpp +++ b/lib/remote/apilistener-sync.cpp @@ -20,7 +20,7 @@ #include "remote/apilistener.hpp" #include "remote/apifunction.hpp" #include "config/configcompiler.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/logger.hpp" #include "base/convert.hpp" #include "base/exception.hpp" @@ -154,7 +154,7 @@ void ApiListener::SyncZoneDir(const Zone::Ptr& zone) const void ApiListener::SyncZoneDirs(void) const { - BOOST_FOREACH(const Zone::Ptr& zone, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const Zone::Ptr& zone, ConfigType::GetObjectsByType()) { if (!IsConfigMaster(zone)) continue; @@ -182,7 +182,7 @@ void ApiListener::SendConfigUpdate(const JsonRpcConnection::Ptr& aclient) String zonesDir = Application::GetLocalStateDir() + "/lib/icinga2/api/zones"; - BOOST_FOREACH(const Zone::Ptr& zone, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const Zone::Ptr& zone, ConfigType::GetObjectsByType()) { String zoneDir = zonesDir + "/" + zone->GetName(); if (!zone->IsChildOf(azone) && !zone->IsGlobal()) { diff --git a/lib/remote/apilistener.cpp b/lib/remote/apilistener.cpp index 9fb6ee707..f743daf48 100644 --- a/lib/remote/apilistener.cpp +++ b/lib/remote/apilistener.cpp @@ -26,7 +26,7 @@ #include "base/convert.hpp" #include "base/netstring.hpp" #include "base/json.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/logger.hpp" #include "base/objectlock.hpp" #include "base/stdiostream.hpp" @@ -97,12 +97,12 @@ void ApiListener::Start(void) { SyncZoneDirs(); - if (std::distance(DynamicType::GetObjectsByType().first, DynamicType::GetObjectsByType().second) > 1) { + if (std::distance(ConfigType::GetObjectsByType().first, ConfigType::GetObjectsByType().second) > 1) { Log(LogCritical, "ApiListener", "Only one ApiListener object is allowed."); return; } - DynamicObject::Start(); + ConfigObject::Start(); { boost::mutex::scoped_lock(m_LogLock); @@ -128,7 +128,7 @@ void ApiListener::Start(void) ApiListener::Ptr ApiListener::GetInstance(void) { - BOOST_FOREACH(const ApiListener::Ptr& listener, DynamicType::GetObjectsByType()) + BOOST_FOREACH(const ApiListener::Ptr& listener, ConfigType::GetObjectsByType()) return listener; return ApiListener::Ptr(); @@ -403,7 +403,7 @@ void ApiListener::ApiTimerHandler(void) BOOST_FOREACH(int ts, files) { bool need = false; - BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const Endpoint::Ptr& endpoint, ConfigType::GetObjectsByType()) { if (endpoint->GetName() == GetIdentity()) continue; @@ -426,7 +426,7 @@ void ApiListener::ApiTimerHandler(void) Zone::Ptr my_zone = Zone::GetLocalZone(); - BOOST_FOREACH(const Zone::Ptr& zone, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const Zone::Ptr& zone, ConfigType::GetObjectsByType()) { /* only connect to endpoints in a) the same zone b) our parent zone c) immediate child zones */ if (my_zone != zone && my_zone != zone->GetParent() && zone != my_zone->GetParent()) { Log(LogDebug, "ApiListener") @@ -468,7 +468,7 @@ void ApiListener::ApiTimerHandler(void) } } - BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const Endpoint::Ptr& endpoint, ConfigType::GetObjectsByType()) { if (!endpoint->IsConnected()) continue; @@ -500,7 +500,7 @@ void ApiListener::ApiTimerHandler(void) << "Current zone master: " << master->GetName(); std::vector names; - BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjectsByType()) + BOOST_FOREACH(const Endpoint::Ptr& endpoint, ConfigType::GetObjectsByType()) if (endpoint->IsConnected()) names.push_back(endpoint->GetName() + " (" + Convert::ToString(endpoint->GetClients().size()) + ")"); @@ -508,12 +508,12 @@ void ApiListener::ApiTimerHandler(void) << "Connected endpoints: " << Utility::NaturalJoin(names); } -void ApiListener::RelayMessage(const MessageOrigin::Ptr& origin, const DynamicObject::Ptr& secobj, const Dictionary::Ptr& message, bool log) +void ApiListener::RelayMessage(const MessageOrigin::Ptr& origin, const ConfigObject::Ptr& secobj, const Dictionary::Ptr& message, bool log) { m_RelayQueue.Enqueue(boost::bind(&ApiListener::SyncRelayMessage, this, origin, secobj, message, log)); } -void ApiListener::PersistMessage(const Dictionary::Ptr& message, const DynamicObject::Ptr& secobj) +void ApiListener::PersistMessage(const Dictionary::Ptr& message, const ConfigObject::Ptr& secobj) { double ts = message->Get("ts"); @@ -557,7 +557,7 @@ void ApiListener::SyncSendMessage(const Endpoint::Ptr& endpoint, const Dictionar } -void ApiListener::SyncRelayMessage(const MessageOrigin::Ptr& origin, const DynamicObject::Ptr& secobj, const Dictionary::Ptr& message, bool log) +void ApiListener::SyncRelayMessage(const MessageOrigin::Ptr& origin, const ConfigObject::Ptr& secobj, const Dictionary::Ptr& message, bool log) { double ts = Utility::GetTime(); message->Set("ts", ts); @@ -578,7 +578,7 @@ void ApiListener::SyncRelayMessage(const MessageOrigin::Ptr& origin, const Dynam std::vector skippedEndpoints; std::set finishedZones; - BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const Endpoint::Ptr& endpoint, ConfigType::GetObjectsByType()) { /* don't relay messages to ourselves or disconnected endpoints */ if (endpoint->GetName() == GetIdentity() || !endpoint->IsConnected()) continue; @@ -770,12 +770,12 @@ void ApiListener::ReplayLog(const JsonRpcConnection::Ptr& client) Dictionary::Ptr secname = pmessage->Get("secobj"); if (secname) { - DynamicType::Ptr dtype = DynamicType::GetByName(secname->Get("type")); + ConfigType::Ptr dtype = ConfigType::GetByName(secname->Get("type")); if (!dtype) continue; - DynamicObject::Ptr secobj = dtype->GetObject(secname->Get("name")); + ConfigObject::Ptr secobj = dtype->GetObject(secname->Get("name")); if (!secobj) continue; @@ -856,7 +856,7 @@ std::pair ApiListener::GetStatus(void) Zone::Ptr my_zone = Zone::GetLocalZone(); - BOOST_FOREACH(const Zone::Ptr& zone, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const Zone::Ptr& zone, ConfigType::GetObjectsByType()) { /* only check endpoints in a) the same zone b) our parent zone c) immediate child zones */ if (my_zone != zone && my_zone != zone->GetParent() && zone != my_zone->GetParent()) { Log(LogDebug, "ApiListener") diff --git a/lib/remote/apilistener.hpp b/lib/remote/apilistener.hpp index a7dcd00f6..7368439b1 100644 --- a/lib/remote/apilistener.hpp +++ b/lib/remote/apilistener.hpp @@ -25,7 +25,7 @@ #include "remote/httpconnection.hpp" #include "remote/endpoint.hpp" #include "remote/messageorigin.hpp" -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" #include "base/timer.hpp" #include "base/workqueue.hpp" #include "base/tcpsocket.hpp" @@ -60,7 +60,7 @@ public: static String GetApiDir(void); void SyncSendMessage(const Endpoint::Ptr& endpoint, const Dictionary::Ptr& message); - void RelayMessage(const MessageOrigin::Ptr& origin, const DynamicObject::Ptr& secobj, const Dictionary::Ptr& message, bool log); + void RelayMessage(const MessageOrigin::Ptr& origin, const ConfigObject::Ptr& secobj, const Dictionary::Ptr& message, bool log); static void StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata); std::pair GetStatus(void); @@ -103,8 +103,8 @@ private: Stream::Ptr m_LogFile; size_t m_LogMessageCount; - void SyncRelayMessage(const MessageOrigin::Ptr& origin, const DynamicObject::Ptr& secobj, const Dictionary::Ptr& message, bool log); - void PersistMessage(const Dictionary::Ptr& message, const DynamicObject::Ptr& secobj); + void SyncRelayMessage(const MessageOrigin::Ptr& origin, const ConfigObject::Ptr& secobj, const Dictionary::Ptr& message, bool log); + void PersistMessage(const Dictionary::Ptr& message, const ConfigObject::Ptr& secobj); void OpenLogFile(void); void RotateLogFile(void); diff --git a/lib/remote/apilistener.ti b/lib/remote/apilistener.ti index 8855584ac..2b7e82be2 100644 --- a/lib/remote/apilistener.ti +++ b/lib/remote/apilistener.ti @@ -18,7 +18,7 @@ ******************************************************************************/ #include "remote/i2-remote.hpp" -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" #include "base/application.hpp" library remote; @@ -26,7 +26,7 @@ library remote; namespace icinga { -class ApiListener : DynamicObject +class ApiListener : ConfigObject { [config, required] String cert_path; [config, required] String key_path; diff --git a/lib/remote/apiuser.cpp b/lib/remote/apiuser.cpp index 742710012..0ba44e30e 100644 --- a/lib/remote/apiuser.cpp +++ b/lib/remote/apiuser.cpp @@ -19,7 +19,7 @@ #include "remote/apiuser.hpp" #include "remote/apiuser.tcpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" using namespace icinga; @@ -42,7 +42,7 @@ bool ApiUser::CheckPassword(const String& password) const ApiUser::Ptr ApiUser::GetByClientCN(const String& cn) { - BOOST_FOREACH(const ApiUser::Ptr& user, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const ApiUser::Ptr& user, ConfigType::GetObjectsByType()) { if (user->GetClientCN() == cn) return user; } diff --git a/lib/remote/apiuser.ti b/lib/remote/apiuser.ti index 7f774d565..7007fb265 100644 --- a/lib/remote/apiuser.ti +++ b/lib/remote/apiuser.ti @@ -17,14 +17,14 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" library remote; namespace icinga { -class ApiUser : DynamicObject +class ApiUser : ConfigObject { [config, protected] String password (PasswordRaw); [config] String client_cn (ClientCN); diff --git a/lib/remote/authority.cpp b/lib/remote/authority.cpp index 86db94924..e737a99db 100644 --- a/lib/remote/authority.cpp +++ b/lib/remote/authority.cpp @@ -19,7 +19,7 @@ #include "remote/zone.hpp" #include "remote/apilistener.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/utility.hpp" #include "base/initialize.hpp" #include "base/timer.hpp" @@ -29,7 +29,7 @@ using namespace icinga; static Timer::Ptr l_AuthorityTimer; -static bool ObjectNameLessComparer(const DynamicObject::Ptr& a, const DynamicObject::Ptr& b) +static bool ObjectNameLessComparer(const ConfigObject::Ptr& a, const ConfigObject::Ptr& b) { return a->GetName() < b->GetName(); } @@ -57,8 +57,8 @@ static void AuthorityTimerHandler(void) std::sort(endpoints.begin(), endpoints.end(), ObjectNameLessComparer); - BOOST_FOREACH(const DynamicType::Ptr& type, DynamicType::GetTypes()) { - BOOST_FOREACH(const DynamicObject::Ptr& object, type->GetObjects()) { + BOOST_FOREACH(const ConfigType::Ptr& type, ConfigType::GetTypes()) { + BOOST_FOREACH(const ConfigObject::Ptr& object, type->GetObjects()) { Endpoint::Ptr endpoint = endpoints[Utility::SDBM(object->GetName()) % endpoints.size()]; if (object->GetHAMode() == HARunOnce) diff --git a/lib/remote/deleteobjecthandler.cpp b/lib/remote/deleteobjecthandler.cpp index aa21b7933..fe532dfdf 100644 --- a/lib/remote/deleteobjecthandler.cpp +++ b/lib/remote/deleteobjecthandler.cpp @@ -57,11 +57,11 @@ bool DeleteObjectHandler::HandleRequest(const ApiUser::Ptr& user, HttpRequest& r params->Set(attr, request.RequestUrl->GetPath()[2]); } - std::vector objs = FilterUtility::GetFilterTargets(qd, params); + std::vector objs = FilterUtility::GetFilterTargets(qd, params); Array::Ptr results = new Array(); - BOOST_FOREACH(const DynamicObject::Ptr& obj, objs) { + BOOST_FOREACH(const ConfigObject::Ptr& obj, objs) { Dictionary::Ptr result1 = new Dictionary(); result1->Set("type", type->GetName()); result1->Set("name", obj->GetName()); diff --git a/lib/remote/endpoint.cpp b/lib/remote/endpoint.cpp index 71612c318..29068ac0d 100644 --- a/lib/remote/endpoint.cpp +++ b/lib/remote/endpoint.cpp @@ -22,7 +22,7 @@ #include "remote/apilistener.hpp" #include "remote/jsonrpcconnection.hpp" #include "remote/zone.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/utility.hpp" #include "base/exception.hpp" #include "base/convert.hpp" @@ -37,9 +37,9 @@ boost::signals2::signal()) { + BOOST_FOREACH(const Zone::Ptr& zone, ConfigType::GetObjectsByType()) { const std::set members = zone->GetEndpoints(); if (members.empty()) diff --git a/lib/remote/endpoint.ti b/lib/remote/endpoint.ti index b2b5bc1f6..9625d9b66 100644 --- a/lib/remote/endpoint.ti +++ b/lib/remote/endpoint.ti @@ -17,14 +17,14 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" library remote; namespace icinga { -class Endpoint : DynamicObject +class Endpoint : ConfigObject { [config] String host; [config] String port { diff --git a/lib/remote/filterutility.cpp b/lib/remote/filterutility.cpp index 143939b56..949e027b9 100644 --- a/lib/remote/filterutility.cpp +++ b/lib/remote/filterutility.cpp @@ -22,7 +22,7 @@ #include "config/configcompiler.hpp" #include "config/expression.hpp" #include "base/json.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/logger.hpp" #include #include @@ -34,7 +34,7 @@ Type::Ptr FilterUtility::TypeFromPluralName(const String& pluralName) String uname = pluralName; boost::algorithm::to_lower(uname); - BOOST_FOREACH(const DynamicType::Ptr& dtype, DynamicType::GetTypes()) { + BOOST_FOREACH(const ConfigType::Ptr& dtype, ConfigType::GetTypes()) { Type::Ptr type = Type::GetByName(dtype->GetName()); ASSERT(type); @@ -48,17 +48,17 @@ Type::Ptr FilterUtility::TypeFromPluralName(const String& pluralName) return Type::Ptr(); } -DynamicObject::Ptr FilterUtility::GetObjectByTypeAndName(const String& type, const String& name) +ConfigObject::Ptr FilterUtility::GetObjectByTypeAndName(const String& type, const String& name) { - DynamicType::Ptr dtype = DynamicType::GetByName(type); + ConfigType::Ptr dtype = ConfigType::GetByName(type); ASSERT(dtype); return dtype->GetObject(name); } -std::vector FilterUtility::GetFilterTargets(const QueryDescription& qd, const Dictionary::Ptr& query) +std::vector FilterUtility::GetFilterTargets(const QueryDescription& qd, const Dictionary::Ptr& query) { - std::vector result; + std::vector result; BOOST_FOREACH(const Type::Ptr& type, qd.Types) { String attr = type->GetName(); @@ -66,7 +66,7 @@ std::vector FilterUtility::GetFilterTargets(const QueryDescr if (query->Contains(attr)) { String name = HttpUtility::GetLastParameter(query, attr); - DynamicObject::Ptr obj = GetObjectByTypeAndName(type->GetName(), name); + ConfigObject::Ptr obj = GetObjectByTypeAndName(type->GetName(), name); if (!obj) BOOST_THROW_EXCEPTION(std::invalid_argument("Object does not exist.")); result.push_back(obj); @@ -80,7 +80,7 @@ std::vector FilterUtility::GetFilterTargets(const QueryDescr if (names) { ObjectLock olock(names); BOOST_FOREACH(const String& name, names) { - DynamicObject::Ptr obj = GetObjectByTypeAndName(type->GetName(), name); + ConfigObject::Ptr obj = GetObjectByTypeAndName(type->GetName(), name); if (!obj) BOOST_THROW_EXCEPTION(std::invalid_argument("Object does not exist.")); result.push_back(obj); @@ -111,7 +111,7 @@ std::vector FilterUtility::GetFilterTargets(const QueryDescr if (qd.Types.find(utype) == qd.Types.end()) BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid type specified for this query.")); - DynamicType::Ptr dtype = DynamicType::GetByName(type); + ConfigType::Ptr dtype = ConfigType::GetByName(type); ASSERT(dtype); Expression *ufilter = ConfigCompiler::CompileText("", filter, false); @@ -122,7 +122,7 @@ std::vector FilterUtility::GetFilterTargets(const QueryDescr boost::algorithm::to_lower(varName); try { - BOOST_FOREACH(const DynamicObject::Ptr& object, dtype->GetObjects()) { + BOOST_FOREACH(const ConfigObject::Ptr& object, dtype->GetObjects()) { frame.Locals->Set(varName, object); if (Convert::ToBool(ufilter->Evaluate(frame))) diff --git a/lib/remote/filterutility.hpp b/lib/remote/filterutility.hpp index 42a3d2760..70e0c3e00 100644 --- a/lib/remote/filterutility.hpp +++ b/lib/remote/filterutility.hpp @@ -22,7 +22,7 @@ #include "remote/i2-remote.hpp" #include "base/dictionary.hpp" -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" #include namespace icinga @@ -42,8 +42,8 @@ class I2_REMOTE_API FilterUtility { public: static Type::Ptr TypeFromPluralName(const String& pluralName); - static DynamicObject::Ptr GetObjectByTypeAndName(const String& type, const String& name); - static std::vector GetFilterTargets(const QueryDescription& qd, const Dictionary::Ptr& query); + static ConfigObject::Ptr GetObjectByTypeAndName(const String& type, const String& name); + static std::vector GetFilterTargets(const QueryDescription& qd, const Dictionary::Ptr& query); }; } diff --git a/lib/remote/httpconnection.cpp b/lib/remote/httpconnection.cpp index 8dec67b06..48c1ac663 100644 --- a/lib/remote/httpconnection.cpp +++ b/lib/remote/httpconnection.cpp @@ -23,7 +23,7 @@ #include "remote/apifunction.hpp" #include "remote/jsonrpc.hpp" #include "remote/base64.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/objectlock.hpp" #include "base/utility.hpp" #include "base/logger.hpp" diff --git a/lib/remote/jsonrpcconnection-heartbeat.cpp b/lib/remote/jsonrpcconnection-heartbeat.cpp index c12bccaf0..fdf5400f3 100644 --- a/lib/remote/jsonrpcconnection-heartbeat.cpp +++ b/lib/remote/jsonrpcconnection-heartbeat.cpp @@ -21,7 +21,7 @@ #include "remote/messageorigin.hpp" #include "remote/apifunction.hpp" #include "base/initialize.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/logger.hpp" #include "base/utility.hpp" #include @@ -44,7 +44,7 @@ INITIALIZE_ONCE(StartHeartbeatTimer); void JsonRpcConnection::HeartbeatTimerHandler(void) { - BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const Endpoint::Ptr& endpoint, ConfigType::GetObjectsByType()) { BOOST_FOREACH(const JsonRpcConnection::Ptr& client, endpoint->GetClients()) { if (endpoint->GetSyncing()) { Log(LogInformation, "JsonRpcConnection") diff --git a/lib/remote/jsonrpcconnection.cpp b/lib/remote/jsonrpcconnection.cpp index c0fd1b61f..bb62c4414 100644 --- a/lib/remote/jsonrpcconnection.cpp +++ b/lib/remote/jsonrpcconnection.cpp @@ -21,7 +21,7 @@ #include "remote/apilistener.hpp" #include "remote/apifunction.hpp" #include "remote/jsonrpc.hpp" -#include "base/dynamictype.hpp" +#include "base/configtype.hpp" #include "base/objectlock.hpp" #include "base/utility.hpp" #include "base/logger.hpp" @@ -284,7 +284,7 @@ void JsonRpcConnection::TimeoutTimerHandler(void) client->CheckLiveness(); } - BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjectsByType()) { + BOOST_FOREACH(const Endpoint::Ptr& endpoint, ConfigType::GetObjectsByType()) { BOOST_FOREACH(const JsonRpcConnection::Ptr& client, endpoint->GetClients()) { client->CheckLiveness(); } diff --git a/lib/remote/modifyobjecthandler.cpp b/lib/remote/modifyobjecthandler.cpp index 296392261..f912c2848 100644 --- a/lib/remote/modifyobjecthandler.cpp +++ b/lib/remote/modifyobjecthandler.cpp @@ -56,13 +56,13 @@ bool ModifyObjectHandler::HandleRequest(const ApiUser::Ptr& user, HttpRequest& r params->Set(attr, request.RequestUrl->GetPath()[2]); } - std::vector objs = FilterUtility::GetFilterTargets(qd, params); + std::vector objs = FilterUtility::GetFilterTargets(qd, params); Dictionary::Ptr attrs = params->Get("attrs"); Array::Ptr results = new Array(); - BOOST_FOREACH(const DynamicObject::Ptr& obj, objs) { + BOOST_FOREACH(const ConfigObject::Ptr& obj, objs) { Dictionary::Ptr result1 = new Dictionary(); result1->Set("type", type->GetName()); diff --git a/lib/remote/statusqueryhandler.cpp b/lib/remote/statusqueryhandler.cpp index 8e0773cde..153c86ddf 100644 --- a/lib/remote/statusqueryhandler.cpp +++ b/lib/remote/statusqueryhandler.cpp @@ -57,7 +57,7 @@ bool StatusQueryHandler::HandleRequest(const ApiUser::Ptr& user, HttpRequest& re params->Set(attr, request.RequestUrl->GetPath()[2]); } - std::vector objs = FilterUtility::GetFilterTargets(qd, params); + std::vector objs = FilterUtility::GetFilterTargets(qd, params); Array::Ptr results = new Array(); @@ -71,7 +71,7 @@ bool StatusQueryHandler::HandleRequest(const ApiUser::Ptr& user, HttpRequest& re } } - BOOST_FOREACH(const DynamicObject::Ptr& obj, objs) { + BOOST_FOREACH(const ConfigObject::Ptr& obj, objs) { BOOST_FOREACH(const String& joinType, joinTypes) { String prefix = joinType; boost::algorithm::to_lower(prefix); diff --git a/lib/remote/zone.cpp b/lib/remote/zone.cpp index 3d05cc430..f90a75e77 100644 --- a/lib/remote/zone.cpp +++ b/lib/remote/zone.cpp @@ -54,7 +54,7 @@ std::set Zone::GetEndpoints(void) const return result; } -bool Zone::CanAccessObject(const DynamicObject::Ptr& object) +bool Zone::CanAccessObject(const ConfigObject::Ptr& object) { Zone::Ptr object_zone; diff --git a/lib/remote/zone.hpp b/lib/remote/zone.hpp index d0172df91..9092e26fa 100644 --- a/lib/remote/zone.hpp +++ b/lib/remote/zone.hpp @@ -39,7 +39,7 @@ public: Zone::Ptr GetParent(void) const; std::set GetEndpoints(void) const; - bool CanAccessObject(const DynamicObject::Ptr& object); + bool CanAccessObject(const ConfigObject::Ptr& object); bool IsChildOf(const Zone::Ptr& zone); bool IsGlobal(void) const; diff --git a/lib/remote/zone.ti b/lib/remote/zone.ti index 9ce648037..f6224e406 100644 --- a/lib/remote/zone.ti +++ b/lib/remote/zone.ti @@ -17,14 +17,14 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -#include "base/dynamicobject.hpp" +#include "base/configobject.hpp" library remote; namespace icinga { -class Zone : DynamicObject +class Zone : ConfigObject { [config] name(Zone) parent (ParentRaw); [config] Array::Ptr endpoints (EndpointsRaw); diff --git a/test/base-type.cpp b/test/base-type.cpp index 9b76e06a5..ab704e270 100644 --- a/test/base-type.cpp +++ b/test/base-type.cpp @@ -40,7 +40,7 @@ BOOST_AUTO_TEST_CASE(gettype) BOOST_AUTO_TEST_CASE(assign) { Type::Ptr t1 = Type::GetByName("Application"); - Type::Ptr t2 = Type::GetByName("DynamicObject"); + Type::Ptr t2 = Type::GetByName("ConfigObject"); BOOST_CHECK(t1->IsAssignableFrom(t1)); BOOST_CHECK(t2->IsAssignableFrom(t1)); diff --git a/tools/mkclass/classcompiler.cpp b/tools/mkclass/classcompiler.cpp index fafbcb7b0..4a85acfbc 100644 --- a/tools/mkclass/classcompiler.cpp +++ b/tools/mkclass/classcompiler.cpp @@ -484,13 +484,13 @@ void ClassCompiler::HandleClass(const Klass& klass, const ClassDebugInfo&) else m_Impl << "\t" << "if (value.IsEmpty())" << std::endl; - m_Impl << "\t\t" << "BOOST_THROW_EXCEPTION(ValidationError(dynamic_cast(this), boost::assign::list_of(\"" << field.Name << "\"), \"Attribute must not be empty.\"));" << std::endl << std::endl; + m_Impl << "\t\t" << "BOOST_THROW_EXCEPTION(ValidationError(dynamic_cast(this), boost::assign::list_of(\"" << field.Name << "\"), \"Attribute must not be empty.\"));" << std::endl << std::endl; } if (field.Type.IsName) { m_Impl << "\t" << "String ref = value;" << std::endl << "\t" << "if (!ref.IsEmpty() && !utils.ValidateName(\"" << field.Type.TypeName << "\", ref))" << std::endl - << "\t\t" << "BOOST_THROW_EXCEPTION(ValidationError(dynamic_cast(this), boost::assign::list_of(\"" << field.Name << "\"), \"Object '\" + ref + \"' of type '" << field.Type.TypeName + << "\t\t" << "BOOST_THROW_EXCEPTION(ValidationError(dynamic_cast(this), boost::assign::list_of(\"" << field.Name << "\"), \"Object '\" + ref + \"' of type '" << field.Type.TypeName << "' does not exist.\"));" << std::endl; } } @@ -748,7 +748,7 @@ void ClassCompiler::HandleClass(const Klass& klass, const ClassDebugInfo&) m_Impl << "void ObjectImpl<" << klass.Name << ">::Notify" << it->GetFriendlyName() << "(const Value& cookie)" << std::endl << "{" << std::endl - << "\t" << "DynamicObject *dobj = dynamic_cast(this);" << std::endl; + << "\t" << "ConfigObject *dobj = dynamic_cast(this);" << std::endl; if (it->Name != "active") { m_Impl << "\t" << "if (!dobj || dobj->IsActive())" << std::endl @@ -800,7 +800,7 @@ void ClassCompiler::HandleClass(const Klass& klass, const ClassDebugInfo&) } } - if (klass.Name == "DynamicObject") + if (klass.Name == "ConfigObject") m_Header << "\t" << "friend class ConfigItem;" << std::endl; if (!klass.TypeBase.empty()) @@ -842,7 +842,7 @@ void ClassCompiler::CodeGenValidator(const std::string& name, const std::string& m_Impl << "\t" << "if (!value)" << std::endl; if (required) - m_Impl << "BOOST_THROW_EXCEPTION(ValidationError(dynamic_cast(this), location, \"This attribute must not be empty.\"));" << std::endl; + m_Impl << "BOOST_THROW_EXCEPTION(ValidationError(dynamic_cast(this), location, \"This attribute must not be empty.\"));" << std::endl; else m_Impl << "\t\t" << "return;" << std::endl; @@ -884,7 +884,7 @@ void ClassCompiler::CodeGenValidator(const std::string& name, const std::string& << "\t\t\t" << "if (utils.ValidateName(\"" << rule.Type << "\", value))" << std::endl << "\t\t\t\t" << "return;" << std::endl << "\t\t\t" << "else" << std::endl - << "\t\t\t\t" << "BOOST_THROW_EXCEPTION(ValidationError(dynamic_pointer_cast(object), location, \"Object '\" + value + \"' of type '" << rule.Type << "' does not exist.\"));" << std::endl + << "\t\t\t\t" << "BOOST_THROW_EXCEPTION(ValidationError(dynamic_pointer_cast(object), location, \"Object '\" + value + \"' of type '" << rule.Type << "' does not exist.\"));" << std::endl << "\t\t" << "}" << std::endl; } @@ -963,7 +963,7 @@ void ClassCompiler::CodeGenValidator(const std::string& name, const std::string& if (rule.Type == "Dictionary") { m_Impl << (type_check ? "\t" : "") << "\t\t" << "if (dict.Get(\"" << srule.Pattern << "\").IsEmpty())" << std::endl - << (type_check ? "\t" : "") << "\t\t\t" << "BOOST_THROW_EXCEPTION(ValidationError(dynamic_cast(this), location, \"Required dictionary item '" << srule.Pattern << "' is not set.\"));" << std::endl; + << (type_check ? "\t" : "") << "\t\t\t" << "BOOST_THROW_EXCEPTION(ValidationError(dynamic_cast(this), location, \"Required dictionary item '" << srule.Pattern << "' is not set.\"));" << std::endl; } else if (rule.Type == "Array") { int index = -1; std::stringstream idxbuf; @@ -976,7 +976,7 @@ void ClassCompiler::CodeGenValidator(const std::string& name, const std::string& } m_Impl << (type_check ? "\t" : "") << "\t\t" << "if (arr.GetLength() < " << (index + 1) << ")" << std::endl - << (type_check ? "\t" : "") << "\t\t\t" << "BOOST_THROW_EXCEPTION(ValidationError(dynamic_cast(this), location, \"Required index '" << index << "' is not set.\"));" << std::endl; + << (type_check ? "\t" : "") << "\t\t\t" << "BOOST_THROW_EXCEPTION(ValidationError(dynamic_cast(this), location, \"Required index '" << index << "' is not set.\"));" << std::endl; } } @@ -995,11 +995,11 @@ void ClassCompiler::CodeGenValidator(const std::string& name, const std::string& if (type_check || validatorType != ValidatorField) { if (validatorType != ValidatorField) { m_Impl << "\t" << "if (!known_attribute)" << std::endl - << "\t\t" << "BOOST_THROW_EXCEPTION(ValidationError(dynamic_pointer_cast(object), location, \"Invalid attribute: \" + key));" << std::endl + << "\t\t" << "BOOST_THROW_EXCEPTION(ValidationError(dynamic_pointer_cast(object), location, \"Invalid attribute: \" + key));" << std::endl << "\t" << "else" << std::endl; } - m_Impl << (validatorType != ValidatorField ? "\t" : "") << "\t" << "BOOST_THROW_EXCEPTION(ValidationError(dynamic_pointer_cast(object), location, \"Invalid type.\"));" << std::endl; + m_Impl << (validatorType != ValidatorField ? "\t" : "") << "\t" << "BOOST_THROW_EXCEPTION(ValidationError(dynamic_pointer_cast(object), location, \"Invalid type.\"));" << std::endl; } m_Impl << "}" << std::endl << std::endl;