Rename DynamicObject/DynamicType to ConfigObject/ConfigType

fixes #9914
This commit is contained in:
Gunnar Beutner 2015-08-15 20:28:05 +02:00
parent 827de21907
commit 071d2f18fb
151 changed files with 520 additions and 520 deletions

View File

@ -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

View File

@ -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();

View File

@ -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
{
};

View File

@ -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;

View File

@ -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<void (const DynamicObject::Ptr&)> DynamicObject::OnStateChanged;
boost::signals2::signal<void (const ConfigObject::Ptr&)> 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<void(const DynamicObject::Ptr&, const String&, const Value&)>& callback)
void ConfigObject::DumpModifiedAttributes(const boost::function<void(const ConfigObject::Ptr&, const String&, const Value&)>& 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::function<void(const Dyna
}
DynamicObject::Ptr DynamicObject::GetObject(const String& type, const String& name)
ConfigObject::Ptr ConfigObject::GetObject(const String& type, const String& name)
{
DynamicType::Ptr dtype = DynamicType::GetByName(type);
ConfigType::Ptr dtype = ConfigType::GetByName(type);
return dtype->GetObject(name);
}

View File

@ -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<DynamicObject>
class I2_BASE_API ConfigObject : public ObjectImpl<ConfigObject>
{
public:
DECLARE_OBJECT(DynamicObject);
DECLARE_OBJECT(ConfigObject);
static boost::signals2::signal<void (const DynamicObject::Ptr&)> OnStateChanged;
static boost::signals2::signal<void (const ConfigObject::Ptr&)> OnStateChanged;
intrusive_ptr<DynamicType> GetType(void) const;
intrusive_ptr<ConfigType> GetType(void) const;
bool IsActive(void) const;
bool IsPaused(void) const;
@ -78,7 +78,7 @@ public:
template<typename T>
static intrusive_ptr<T> GetObject(const String& name)
{
DynamicObject::Ptr object = GetObject(T::GetTypeName(), name);
ConfigObject::Ptr object = GetObject(T::GetTypeName(), name);
return static_pointer_cast<T>(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<void(const DynamicObject::Ptr&, const String&, const Value&)>& callback);
static void DumpModifiedAttributes(const boost::function<void(const ConfigObject::Ptr&, const String&, const Value&)>& 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<klass> GetByName(const String& name) \
{ \
return DynamicObject::GetObject<klass>(name); \
return ConfigObject::GetObject<klass>(name); \
}
}

View File

@ -38,11 +38,11 @@ public:
};
}}}
abstract class DynamicObjectBase
abstract class ConfigObjectBase
{ };
code {{{
class I2_BASE_API DynamicObjectBase : public ObjectImpl<DynamicObjectBase>
class I2_BASE_API ConfigObjectBase : public ObjectImpl<ConfigObjectBase>
{
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) {

View File

@ -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<DynamicObject>, DynamicTypeIterator<DynamicObject> > DynamicType::GetObjects(void)
std::pair<ConfigTypeIterator<ConfigObject>, ConfigTypeIterator<ConfigObject> > ConfigType::GetObjects(void)
{
return std::make_pair(
DynamicTypeIterator<DynamicObject>(this, 0),
DynamicTypeIterator<DynamicObject>(this, -1)
ConfigTypeIterator<ConfigObject>(this, 0),
ConfigTypeIterator<ConfigObject>(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;

View File

@ -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 <map>
# include <boost/iterator/iterator_facade.hpp>
@ -30,50 +30,50 @@ namespace icinga
{
template<typename T>
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<DynamicType::Ptr> GetTypes(void);
std::pair<DynamicTypeIterator<DynamicObject>, DynamicTypeIterator<DynamicObject> > GetObjects(void);
static std::vector<ConfigType::Ptr> GetTypes(void);
std::pair<ConfigTypeIterator<ConfigObject>, ConfigTypeIterator<ConfigObject> > GetObjects(void);
template<typename T>
static std::pair<DynamicTypeIterator<T>, DynamicTypeIterator<T> > GetObjectsByType(void)
static std::pair<ConfigTypeIterator<T>, ConfigTypeIterator<T> > GetObjectsByType(void)
{
DynamicType::Ptr type = GetByName(T::GetTypeName());
ConfigType::Ptr type = GetByName(T::GetTypeName());
return std::make_pair(
DynamicTypeIterator<T>(type, 0),
DynamicTypeIterator<T>(type, UINT_MAX)
ConfigTypeIterator<T>(type, 0),
ConfigTypeIterator<T>(type, UINT_MAX)
);
}
private:
template<typename T> friend class DynamicTypeIterator;
template<typename T> friend class ConfigTypeIterator;
String m_Name;
typedef std::map<String, DynamicObject::Ptr> ObjectMap;
typedef std::vector<DynamicObject::Ptr> ObjectVector;
typedef std::map<String, ConfigObject::Ptr> ObjectMap;
typedef std::vector<ConfigObject::Ptr> ObjectVector;
ObjectMap m_ObjectMap;
ObjectVector m_ObjectVector;
typedef std::map<String, DynamicType::Ptr> TypeMap;
typedef std::vector<DynamicType::Ptr> TypeVector;
typedef std::map<String, ConfigType::Ptr> TypeMap;
typedef std::vector<ConfigType::Ptr> TypeVector;
static TypeMap& InternalGetTypeMap(void);
static TypeVector& InternalGetTypeVector(void);
@ -81,18 +81,18 @@ private:
};
template<typename T>
class DynamicTypeIterator : public boost::iterator_facade<DynamicTypeIterator<T>, const intrusive_ptr<T>, boost::forward_traversal_tag>
class ConfigTypeIterator : public boost::iterator_facade<ConfigTypeIterator<T>, const intrusive_ptr<T>, 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<T> m_Current;
void increment(void)
@ -110,7 +110,7 @@ private:
m_Index += n;
}
bool equal(const DynamicTypeIterator<T>& other) const
bool equal(const ConfigTypeIterator<T>& other) const
{
ASSERT(other.m_Type == m_Type);

View File

@ -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<String>& attributePath, const String& message)
ValidationError::ValidationError(const ConfigObject::Ptr& object, const std::vector<String>& 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;
}

View File

@ -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 <sstream>
#include <boost/exception/errinfo_api_function.hpp>
#include <boost/exception/errinfo_errno.hpp>
@ -72,12 +72,12 @@ private:
class I2_BASE_API ValidationError : virtual public user_error
{
public:
ValidationError(const DynamicObject::Ptr& object, const std::vector<String>& attributePath, const String& message);
ValidationError(const ConfigObject::Ptr& object, const std::vector<String>& 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<String> 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<String> m_AttributePath;
String m_Message;
String m_What;

View File

@ -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 <fstream>
@ -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<FileLogger>()) {
BOOST_FOREACH(const FileLogger::Ptr& filelogger, ConfigType::GetObjectsByType<FileLogger>()) {
nodes->Set(filelogger->GetName(), 1); //add more stats
}

View File

@ -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::Ptr> Logger::GetLoggers(void)

View File

@ -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;
};

View File

@ -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 <boost/foreach.hpp>
#include <boost/regex.hpp>
@ -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;

View File

@ -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<Value>& 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);

View File

@ -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<SyslogLogger>()) {
BOOST_FOREACH(const SyslogLogger::Ptr& sysloglogger, ConfigType::GetObjectsByType<SyslogLogger>()) {
nodes->Set(sysloglogger->GetName(), 1); //add more stats
}

View File

@ -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<CheckerComponent>()) {
BOOST_FOREACH(const CheckerComponent::Ptr& checker, ConfigType::GetObjectsByType<CheckerComponent>()) {
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<Checkable>(object);

View File

@ -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 <boost/thread/thread.hpp>
@ -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);

View File

@ -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
{
};

View File

@ -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"

View File

@ -236,7 +236,7 @@ bool RepositoryUtility::AddObject(const std::vector<String>& object_paths, const
Deserialize(object, attrs, false, FAConfig);
RepositoryValidationUtils utils;
static_pointer_cast<DynamicObject>(object)->Validate(FAConfig, utils);
static_pointer_cast<ConfigObject>(object)->Validate(FAConfig, utils);
} catch (const ScriptError& ex) {
Log(LogCritical, "config", DiagnosticInformation(ex));
return false;

View File

@ -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"

View File

@ -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"

View File

@ -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<CheckResultReader>()) {
BOOST_FOREACH(const CheckResultReader::Ptr& checkresultreader, ConfigType::GetObjectsByType<CheckResultReader>()) {
nodes->Set(checkresultreader->GetName(), 1); //add more stats
}

View File

@ -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/"; }}}

View File

@ -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<CompatLogger>()) {
BOOST_FOREACH(const CompatLogger::Ptr& compat_logger, ConfigType::GetObjectsByType<CompatLogger>()) {
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<Host>()) {
BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType<Host>()) {
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<Service>()) {
BOOST_FOREACH(const Service::Ptr& service, ConfigType::GetObjectsByType<Service>()) {
Host::Ptr host = service->GetHost();
String output;

View File

@ -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"; }}}

View File

@ -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<ExternalCommandListener>()) {
BOOST_FOREACH(const ExternalCommandListener::Ptr& externalcommandlistener, ConfigType::GetObjectsByType<ExternalCommandListener>()) {
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()));

View File

@ -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"; }}}

View File

@ -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<StatusDataWriter>()) {
BOOST_FOREACH(const StatusDataWriter::Ptr& statusdatawriter, ConfigType::GetObjectsByType<StatusDataWriter>()) {
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<Host>()) {
BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType<Host>()) {
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<HostGroup>()) {
BOOST_FOREACH(const HostGroup::Ptr& hg, ConfigType::GetObjectsByType<HostGroup>()) {
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<ServiceGroup>()) {
BOOST_FOREACH(const ServiceGroup::Ptr& sg, ConfigType::GetObjectsByType<ServiceGroup>()) {
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<User>()) {
BOOST_FOREACH(const User::Ptr& user, ConfigType::GetObjectsByType<User>()) {
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<UserGroup>()) {
BOOST_FOREACH(const UserGroup::Ptr& ug, ConfigType::GetObjectsByType<UserGroup>()) {
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<CheckCommand>()) {
BOOST_FOREACH(const Command::Ptr& command, ConfigType::GetObjectsByType<CheckCommand>()) {
DumpCommand(objectfp, command);
}
BOOST_FOREACH(const Command::Ptr& command, DynamicType::GetObjectsByType<NotificationCommand>()) {
BOOST_FOREACH(const Command::Ptr& command, ConfigType::GetObjectsByType<NotificationCommand>()) {
DumpCommand(objectfp, command);
}
BOOST_FOREACH(const Command::Ptr& command, DynamicType::GetObjectsByType<EventCommand>()) {
BOOST_FOREACH(const Command::Ptr& command, ConfigType::GetObjectsByType<EventCommand>()) {
DumpCommand(objectfp, command);
}
BOOST_FOREACH(const TimePeriod::Ptr& tp, DynamicType::GetObjectsByType<TimePeriod>()) {
BOOST_FOREACH(const TimePeriod::Ptr& tp, ConfigType::GetObjectsByType<TimePeriod>()) {
DumpTimePeriod(objectfp, tp);
}
BOOST_FOREACH(const Dependency::Ptr& dep, DynamicType::GetObjectsByType<Dependency>()) {
BOOST_FOREACH(const Dependency::Ptr& dep, ConfigType::GetObjectsByType<Dependency>()) {
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<Host>()) {
BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType<Host>()) {
std::ostringstream tempstatusfp;
tempstatusfp << std::fixed;
DumpHostStatus(tempstatusfp, host);

View File

@ -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"; }}}

View File

@ -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 <sstream>
#include <stack>

View File

@ -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<DynamicObject>(type->Instantiate());
ConfigObject::Ptr dobj = static_pointer_cast<ConfigObject>(type->Instantiate());
dobj->SetDebugInfo(m_DebugInfo);
dobj->SetTypeNameV(m_Type);
@ -374,7 +374,7 @@ bool ConfigItem::CommitNewItems(WorkQueue& upq, std::vector<ConfigItem::Ptr>& 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<ConfigItem::Ptr>& 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<ConfigItem::Ptr>& 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());
}
}

View File

@ -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<Expression> GetExpression(void) const;
boost::shared_ptr<Expression> 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;

View File

@ -18,7 +18,7 @@
******************************************************************************/
#include "config/configitembuilder.hpp"
#include "base/dynamictype.hpp"
#include "base/configtype.hpp"
#include <sstream>
#include <boost/foreach.hpp>
#include <boost/smart_ptr/make_shared.hpp>
@ -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));

View File

@ -21,7 +21,7 @@
#define COMMANDDBOBJECT_H
#include "db_ido/dbobject.hpp"
#include "base/dynamicobject.hpp"
#include "base/configobject.hpp"
namespace icinga
{

View File

@ -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<Service>().first, DynamicType::GetObjectsByType<Service>().second));
InsertRuntimeVariable("total_scheduled_services", std::distance(DynamicType::GetObjectsByType<Service>().first, DynamicType::GetObjectsByType<Service>().second));
InsertRuntimeVariable("total_hosts", std::distance(DynamicType::GetObjectsByType<Host>().first, DynamicType::GetObjectsByType<Host>().second));
InsertRuntimeVariable("total_scheduled_hosts", std::distance(DynamicType::GetObjectsByType<Host>().first, DynamicType::GetObjectsByType<Host>().second));
InsertRuntimeVariable("total_services", std::distance(ConfigType::GetObjectsByType<Service>().first, ConfigType::GetObjectsByType<Service>().second));
InsertRuntimeVariable("total_scheduled_services", std::distance(ConfigType::GetObjectsByType<Service>().first, ConfigType::GetObjectsByType<Service>().second));
InsertRuntimeVariable("total_hosts", std::distance(ConfigType::GetObjectsByType<Host>().first, ConfigType::GetObjectsByType<Host>().second));
InsertRuntimeVariable("total_scheduled_hosts", std::distance(ConfigType::GetObjectsByType<Host>().first, ConfigType::GetObjectsByType<Host>().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);
}
}

View File

@ -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);

View File

@ -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_"; }}}

View File

@ -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<long>(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 {

View File

@ -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);

View File

@ -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<DbType>& 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<CustomVarObject>(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<CustomVarObject>(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<Command>(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);

View File

@ -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<void (const DbQuery&)> OnQuery;
@ -100,11 +100,11 @@ private:
String m_Name1;
String m_Name2;
intrusive_ptr<DbType> 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);

View File

@ -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
{

View File

@ -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"

View File

@ -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

View File

@ -21,7 +21,7 @@
#define HOSTDBOBJECT_H
#include "db_ido/dbobject.hpp"
#include "base/dynamicobject.hpp"
#include "base/configobject.hpp"
namespace icinga
{

View File

@ -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 <boost/foreach.hpp>
using namespace icinga;

View File

@ -22,7 +22,7 @@
#include "db_ido/dbobject.hpp"
#include "icinga/hostgroup.hpp"
#include "base/dynamicobject.hpp"
#include "base/configobject.hpp"
namespace icinga
{

View File

@ -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 <boost/foreach.hpp>
@ -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<DbConnection>(dtype->GetObject(idoName));

View File

@ -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 <boost/foreach.hpp>

View File

@ -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

View File

@ -22,7 +22,7 @@
#include "db_ido/dbobject.hpp"
#include "icinga/servicegroup.hpp"
#include "base/dynamicobject.hpp"
#include "base/configobject.hpp"
namespace icinga
{

View File

@ -21,7 +21,7 @@
#define TIMEPERIODDBOBJECT_H
#include "db_ido/dbobject.hpp"
#include "base/dynamicobject.hpp"
#include "base/configobject.hpp"
namespace icinga
{

View File

@ -21,7 +21,7 @@
#define USERDBOBJECT_H
#include "db_ido/dbobject.hpp"
#include "base/dynamicobject.hpp"
#include "base/configobject.hpp"
namespace icinga
{

View File

@ -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 <boost/foreach.hpp>
using namespace icinga;

View File

@ -22,7 +22,7 @@
#include "db_ido/dbobject.hpp"
#include "icinga/usergroup.hpp"
#include "base/dynamicobject.hpp"
#include "base/configobject.hpp"
namespace icinga
{

View File

@ -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

View File

@ -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 <boost/tuple/tuple.hpp>
@ -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<IdoMysqlConnection>()) {
BOOST_FOREACH(const IdoMysqlConnection::Ptr& idomysqlconnection, ConfigType::GetObjectsByType<IdoMysqlConnection>()) {
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<DynamicObject>()) {
if (rawvalue.IsObjectType<ConfigObject>()) {
DbObject::Ptr dbobjcol = DbObject::GetOrCreateByObject(rawvalue);
if (!dbobjcol) {

View File

@ -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<IdoPgsqlConnection>()) {
BOOST_FOREACH(const IdoPgsqlConnection::Ptr& idopgsqlconnection, ConfigType::GetObjectsByType<IdoPgsqlConnection>()) {
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<DynamicObject>()) {
if (rawvalue.IsObjectType<ConfigObject>()) {
DbObject::Ptr dbobjcol = DbObject::GetOrCreateByObject(rawvalue);
if (!dbobjcol) {

View File

@ -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");
}
}

View File

@ -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
{
};

View File

@ -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<Checkable>(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<Checkable>(object);

View File

@ -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);

View File

@ -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<Host>()) {
BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType<Host>()) {
Array::Ptr services = new Array();
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {

View File

@ -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<Host>()) {
BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType<Host>()) {
host->RemoveExpiredComments();
}
BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType<Service>()) {
BOOST_FOREACH(const Service::Ptr& service, ConfigType::GetObjectsByType<Service>()) {
service->RemoveExpiredComments();
}
}

View File

@ -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<Host>()) {
BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType<Host>()) {
host->RemoveExpiredDowntimes();
}
BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType<Service>()) {
BOOST_FOREACH(const Service::Ptr& service, ConfigType::GetObjectsByType<Service>()) {
service->RemoveExpiredDowntimes();
}
}

View File

@ -47,7 +47,7 @@ void Checkable::Start(void)
if (GetNextCheck() < now + 300)
UpdateNextCheck();
DynamicObject::Start();
ConfigObject::Start();
}
void Checkable::OnStateLoaded(void)

View File

@ -19,7 +19,7 @@
#include "icinga/checkcommand.hpp"
#include "icinga/checkcommand.tcpp"
#include "base/dynamictype.hpp"
#include "base/configtype.hpp"
using namespace icinga;

View File

@ -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 <boost/foreach.hpp>
@ -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<Host>()) {
BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType<Host>()) {
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<Service>()) {
BOOST_FOREACH(const Service::Ptr& service, ConfigType::GetObjectsByType<Service>()) {
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<Service>()) {
BOOST_FOREACH(const Service::Ptr& service, ConfigType::GetObjectsByType<Service>()) {
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<Host>()) {
BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType<Host>()) {
ObjectLock olock(host);
if (host->IsReachable()) {

View File

@ -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;

View File

@ -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 <boost/foreach.hpp>
@ -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();

View File

@ -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

View File

@ -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;
};

View File

@ -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"

View File

@ -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);

View File

@ -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"

View File

@ -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<IcingaApplication>()) {
BOOST_FOREACH(const IcingaApplication::Ptr& icingaapplication, ConfigType::GetObjectsByType<IcingaApplication>()) {
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");

View File

@ -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<IcingaStatusWriter>()) {
BOOST_FOREACH(const IcingaStatusWriter::Ptr& icingastatuswriter, ConfigType::GetObjectsByType<IcingaStatusWriter>()) {
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());

View File

@ -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"; }}}

View File

@ -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 <boost/foreach.hpp>
#include <boost/algorithm/string/split.hpp>

View File

@ -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"

View File

@ -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();

View File

@ -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"

View File

@ -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<ScheduledDowntime>()) {
BOOST_FOREACH(const ScheduledDowntime::Ptr& sd, ConfigType::GetObjectsByType<ScheduledDowntime>()) {
sd->CreateNextDowntime();
}
}

View File

@ -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"

View File

@ -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"

View File

@ -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<TimePeriod>()) {
BOOST_FOREACH(const TimePeriod::Ptr& tp, ConfigType::GetObjectsByType<TimePeriod>()) {
double valid_end;
{

View File

@ -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();

View File

@ -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"

View File

@ -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 <boost/foreach.hpp>
@ -60,17 +60,17 @@ String CommandsTable::GetPrefix(void) const
void CommandsTable::FetchRows(const AddRowFunction& addRowFn)
{
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjectsByType<CheckCommand>()) {
BOOST_FOREACH(const ConfigObject::Ptr& object, ConfigType::GetObjectsByType<CheckCommand>()) {
if (!addRowFn(object, LivestatusGroupByNone, Empty))
return;
}
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjectsByType<EventCommand>()) {
BOOST_FOREACH(const ConfigObject::Ptr& object, ConfigType::GetObjectsByType<EventCommand>()) {
if (!addRowFn(object, LivestatusGroupByNone, Empty))
return;
}
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjectsByType<NotificationCommand>()) {
BOOST_FOREACH(const ConfigObject::Ptr& object, ConfigType::GetObjectsByType<NotificationCommand>()) {
if (!addRowFn(object, LivestatusGroupByNone, Empty))
return;
}

View File

@ -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 <boost/tuple/tuple.hpp>
#include <boost/foreach.hpp>
@ -65,7 +65,7 @@ String CommentsTable::GetPrefix(void) const
void CommentsTable::FetchRows(const AddRowFunction& addRowFn)
{
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType<Host>()) {
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<Service>()) {
BOOST_FOREACH(const Service::Ptr& service, ConfigType::GetObjectsByType<Service>()) {
Dictionary::Ptr comments = service->GetComments();
ObjectLock olock(comments);

View File

@ -19,7 +19,7 @@
#include "livestatus/contactgroupstable.hpp"
#include "icinga/usergroup.hpp"
#include "base/dynamictype.hpp"
#include "base/configtype.hpp"
#include <boost/foreach.hpp>
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<UserGroup>()) {
BOOST_FOREACH(const UserGroup::Ptr& ug, ConfigType::GetObjectsByType<UserGroup>()) {
if (!addRowFn(ug, LivestatusGroupByNone, Empty))
return;
}

View File

@ -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<User>()) {
BOOST_FOREACH(const User::Ptr& user, ConfigType::GetObjectsByType<User>()) {
if (!addRowFn(user, LivestatusGroupByNone, Empty))
return;
}

View File

@ -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 <boost/tuple/tuple.hpp>
#include <boost/foreach.hpp>
@ -65,7 +65,7 @@ String DowntimesTable::GetPrefix(void) const
void DowntimesTable::FetchRows(const AddRowFunction& addRowFn)
{
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType<Host>()) {
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<Service>()) {
BOOST_FOREACH(const Service::Ptr& service, ConfigType::GetObjectsByType<Service>()) {
Dictionary::Ptr downtimes = service->GetDowntimes();
ObjectLock olock(downtimes);

View File

@ -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<Endpoint>()) {
BOOST_FOREACH(const Endpoint::Ptr& endpoint, ConfigType::GetObjectsByType<Endpoint>()) {
if (!addRowFn(endpoint, LivestatusGroupByNone, Empty))
return;
}

View File

@ -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 <boost/foreach.hpp>
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<HostGroup>()) {
BOOST_FOREACH(const HostGroup::Ptr& hg, ConfigType::GetObjectsByType<HostGroup>()) {
if (!addRowFn(hg, LivestatusGroupByNone, Empty))
return;
}

View File

@ -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<HostGroup>()) {
BOOST_FOREACH(const HostGroup::Ptr& hg, ConfigType::GetObjectsByType<HostGroup>()) {
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<Host>()) {
BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType<Host>()) {
if (!addRowFn(host, LivestatusGroupByNone, Empty))
return;
}

View File

@ -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<LivestatusListener>()) {
BOOST_FOREACH(const LivestatusListener::Ptr& livestatuslistener, ConfigType::GetObjectsByType<LivestatusListener>()) {
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();

Some files were not shown because too many files have changed in this diff Show More