# 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)
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
} else
ClosePidFile(true);
- DynamicObject::Stop();
+ ConfigObject::Stop();
}
Application::~Application(void)
Log(LogInformation, "Application", "Shutting down...");
- DynamicObject::StopObjects();
+ ConfigObject::StopObjects();
Application::GetInstance()->OnShutdown();
UninitializeBase();
* 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
{
};
* 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"
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;
* 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"
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();
extensions->Set(key, value);
}
-Value DynamicObject::GetExtension(const String& key)
+Value ConfigObject::GetExtension(const String& key)
{
Dictionary::Ptr extensions = GetExtensions();
return extensions->Get(key);
}
-void DynamicObject::ClearExtension(const String& key)
+void ConfigObject::ClearExtension(const String& key)
{
Dictionary::Ptr extensions = GetExtensions();
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;
}
};
-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;
NotifyOriginalAttributes();
}
-void DynamicObject::RestoreAttribute(const String& attr)
+void ConfigObject::RestoreAttribute(const String& attr)
{
Dictionary::Ptr original_attributes = GetOriginalAttributes();
original_attributes->Remove(attr);
}
-bool DynamicObject::IsAttributeModified(const String& attr) const
+bool ConfigObject::IsAttributeModified(const String& attr) const
{
Dictionary::Ptr original_attributes = GetOriginalAttributes();
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);
SetStartCalled(true);
}
-void DynamicObject::Activate(void)
+void ConfigObject::Activate(void)
{
CONTEXT("Activating object '" + GetName() + "' of type '" + GetType()->GetName() + "'");
NotifyActive();
}
-void DynamicObject::Stop(void)
+void ConfigObject::Stop(void)
{
ASSERT(!OwnsLock());
ObjectLock olock(this);
SetStopCalled(true);
}
-void DynamicObject::Deactivate(void)
+void ConfigObject::Deactivate(void)
{
CONTEXT("Deactivating object '" + GetName() + "' of type '" + GetType()->GetName() + "'");
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);
}
}
-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";
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());
}
}
-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");
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;
if (srs != StatusNewItem)
continue;
- upq.Enqueue(boost::bind(&DynamicObject::RestoreObject, message, attributeTypes));
+ upq.Enqueue(boost::bind(&ConfigObject::RestoreObject, message, attributeTypes));
restored++;
}
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);
}
}
- 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)
}
-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);
}
#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"
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;
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);
}
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);
};
\
inline static intrusive_ptr<klass> GetByName(const String& name) \
{ \
- return DynamicObject::GetObject<klass>(name); \
+ return ConfigObject::GetObject<klass>(name); \
}
}
};
}}}
-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
};
}}}
-abstract class DynamicObject : DynamicObjectBase
+abstract class ConfigObject : ConfigObjectBase
{
[config, internal] String __name (Name);
[config] String "name" (ShortName) {
* 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"
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);
}
/**
- * 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();
}
}
-void DynamicType::UnregisterObject(const DynamicObject::Ptr& object)
+void ConfigType::UnregisterObject(const ConfigObject::Ptr& object)
{
String name = object->GetName();
}
}
-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;
#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>
{
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);
};
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)
m_Index += n;
}
- bool equal(const DynamicTypeIterator<T>& other) const
+ bool equal(const ConfigTypeIterator<T>& other) const
{
ASSERT(other.m_Type == m_Type);
if (vex) {
DebugInfo di;
- DynamicObject::Ptr dobj = vex->GetObject();
+ ConfigObject::Ptr dobj = vex->GetObject();
if (dobj)
di = dobj->GetDebugInfo();
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;
return m_What.CStr();
}
-DynamicObject::Ptr ValidationError::GetObject(void) const
+ConfigObject::Ptr ValidationError::GetObject(void) const
{
return m_Object;
}
#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>
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;
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;
#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>
{
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
}
#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"
*/
void Logger::Start(void)
{
- DynamicObject::Start();
+ ConfigObject::Start();
boost::mutex::scoped_lock lock(m_Mutex);
m_Loggers.insert(this);
m_Loggers.erase(this);
}
- DynamicObject::Stop();
+ ConfigObject::Stop();
}
std::set<Logger::Ptr> Logger::GetLoggers(void)
* 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;
};
#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>
return result;
}
-DynamicObject::Ptr ScriptUtils::GetObject(const Value& vtype, const String& name)
+ConfigObject::Ptr ScriptUtils::GetObject(const Value& vtype, const String& name)
{
String typeName;
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;
#include "base/array.hpp"
#include "base/dictionary.hpp"
#include "base/type.hpp"
-#include "base/dynamicobject.hpp"
+#include "base/configobject.hpp"
namespace icinga
{
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);
******************************************************************************/
#include "base/sysloglogger.hpp"
-#include "base/dynamictype.hpp"
+#include "base/configtype.hpp"
#include "base/statsfunction.hpp"
#ifndef _WIN32
{
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
}
#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"
{
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();
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));
m_ResultTimer->Stop();
m_Thread.join();
- DynamicObject::Stop();
+ ConfigObject::Stop();
}
void CheckerComponent::CheckThreadProc(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);
#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>
void AdjustCheckTimer(void);
- void ObjectHandler(const DynamicObject::Ptr& object);
+ void ObjectHandler(const ConfigObject::Ptr& object);
void NextCheckChangedHandler(const Checkable::Ptr& checkable);
void RescheduleCheckTimer(void);
* 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
{
};
#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"
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;
#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"
#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"
#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"
{
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
}
* 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;
namespace icinga
{
-class CheckResultReader : DynamicObject
+class CheckResultReader : ConfigObject
{
[config] String spool_dir {
default {{{ return Application::GetLocalStateDir() + "/lib/icinga2/spool/checkresults/"; }}}
#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"
{
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
}
*/
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));
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();
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;
* 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;
namespace icinga
{
-class CompatLogger : DynamicObject
+class CompatLogger : ConfigObject
{
[config] String log_dir {
default {{{ return Application::GetLocalStateDir() + "/log/icinga2/compat"; }}}
#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"
{
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
}
*/
void ExternalCommandListener::Start(void)
{
- DynamicObject::Start();
+ ConfigObject::Start();
#ifndef _WIN32
m_CommandThread = boost::thread(boost::bind(&ExternalCommandListener::CommandPipeThread, this, GetCommandPath()));
* 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;
namespace icinga
{
-class ExternalCommandListener : DynamicObject
+class ExternalCommandListener : ConfigObject
{
[config] String command_path {
default {{{ return Application::GetRunDir() + "/icinga2/cmd/icinga2.cmd"; }}}
#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"
{
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
}
*/
void StatusDataWriter::Start(void)
{
- DynamicObject::Start();
+ ConfigObject::Start();
m_StatusTimer = new Timer();
m_StatusTimer->SetInterval(GetUpdateInterval());
"# 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);
}
}
- BOOST_FOREACH(const HostGroup::Ptr& hg, DynamicType::GetObjectsByType<HostGroup>()) {
+ BOOST_FOREACH(const HostGroup::Ptr& hg, ConfigType::GetObjectsByType<HostGroup>()) {
std::ostringstream tempobjectfp;
tempobjectfp << std::fixed;
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;
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;
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;
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) {
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);
* 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;
namespace icinga
{
-class StatusDataWriter : DynamicObject
+class StatusDataWriter : ConfigObject
{
[config] String status_path {
default {{{ return Application::GetLocalStateDir() + "/cache/icinga2/status.dat"; }}}
#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>
#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"
};
/**
- * 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());
/* 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);
}
BOOST_FOREACH(const Type::Ptr& type, all_types) {
- if (DynamicObject::TypeInstance->IsAssignableFrom(type))
+ if (ConfigObject::TypeInstance->IsAssignableFrom(type))
types.insert(type->GetName());
}
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);
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));
}
}
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);
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;
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));
}
}
}
#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());
}
}
#include "config/i2-config.hpp"
#include "config/expression.hpp"
-#include "base/dynamicobject.hpp"
+#include "base/configobject.hpp"
#include "base/workqueue.hpp"
namespace icinga
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);
Dictionary::Ptr m_Scope; /**< variable scope. */
String m_Zone; /**< The zone. */
- DynamicObject::Ptr m_Object;
+ ConfigObject::Ptr m_Object;
static boost::mutex m_Mutex;
******************************************************************************/
#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>
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));
#define COMMANDDBOBJECT_H
#include "db_ido/dbobject.hpp"
-#include "base/dynamicobject.hpp"
+#include "base/configobject.hpp"
namespace icinga
{
#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"
void DbConnection::OnConfigLoaded(void)
{
- DynamicObject::OnConfigLoaded();
+ ConfigObject::OnConfigLoaded();
if (!GetEnableHa()) {
Log(LogDebug, "DbConnection")
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();
void DbConnection::Pause(void)
{
- DynamicObject::Pause();
+ ConfigObject::Pause();
Log(LogInformation, "DbConnection")
<< "Pausing IDO connection: " << GetName();
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();
/* Default handler does nothing. */
}
-void DbConnection::UpdateObject(const DynamicObject::Ptr& object)
+void DbConnection::UpdateObject(const ConfigObject::Ptr& object)
{
if (!GetConnected())
return;
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);
}
}
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);
******************************************************************************/
#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_"; }}}
#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"
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;
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 {
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 {
#define DBEVENTS_H
#include "db_ido/dbobject.hpp"
-#include "base/dynamicobject.hpp"
+#include "base/configobject.hpp"
#include "icinga/service.hpp"
namespace icinga
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);
#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"
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;
}
void DbObject::SendVarsConfigUpdate(void)
{
- DynamicObject::Ptr obj = GetObject();
+ ConfigObject::Ptr obj = GetObject();
CustomVarObject::Ptr custom_var_object = dynamic_pointer_cast<CustomVarObject>(obj);
void DbObject::SendVarsStatusUpdate(void)
{
- DynamicObject::Ptr obj = GetObject();
+ ConfigObject::Ptr obj = GetObject();
CustomVarObject::Ptr custom_var_object = dynamic_pointer_cast<CustomVarObject>(obj);
/* 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());
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);
}
return dbobj;
}
-void DbObject::StateChangedHandler(const DynamicObject::Ptr& object)
+void DbObject::StateChangedHandler(const ConfigObject::Ptr& object)
{
DbObject::Ptr dbobj = GetOrCreateByObject(object);
#include "db_ido/dbquery.hpp"
#include "db_ido/dbtype.hpp"
#include "icinga/customvarobject.hpp"
-#include "base/dynamicobject.hpp"
+#include "base/configobject.hpp"
namespace icinga
{
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;
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;
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);
#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
{
#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"
#define ENDPOINTDBOBJECT_H
#include "db_ido/dbobject.hpp"
-#include "base/dynamicobject.hpp"
+#include "base/configobject.hpp"
#include "remote/endpoint.hpp"
namespace icinga
#define HOSTDBOBJECT_H
#include "db_ido/dbobject.hpp"
-#include "base/dynamicobject.hpp"
+#include "base/configobject.hpp"
namespace icinga
{
#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;
#include "db_ido/dbobject.hpp"
#include "icinga/hostgroup.hpp"
-#include "base/dynamicobject.hpp"
+#include "base/configobject.hpp"
namespace icinga
{
#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>
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));
#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>
#define SERVICEDBOBJECT_H
#include "db_ido/dbobject.hpp"
-#include "base/dynamicobject.hpp"
+#include "base/configobject.hpp"
#include "icinga/service.hpp"
namespace icinga
#include "db_ido/dbobject.hpp"
#include "icinga/servicegroup.hpp"
-#include "base/dynamicobject.hpp"
+#include "base/configobject.hpp"
namespace icinga
{
#define TIMEPERIODDBOBJECT_H
#include "db_ido/dbobject.hpp"
-#include "base/dynamicobject.hpp"
+#include "base/configobject.hpp"
namespace icinga
{
#define USERDBOBJECT_H
#include "db_ido/dbobject.hpp"
-#include "base/dynamicobject.hpp"
+#include "base/configobject.hpp"
namespace icinga
{
#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;
#include "db_ido/dbobject.hpp"
#include "icinga/usergroup.hpp"
-#include "base/dynamicobject.hpp"
+#include "base/configobject.hpp"
namespace icinga
{
#define ZONEDBOBJECT_H
#include "db_ido/dbobject.hpp"
-#include "base/dynamicobject.hpp"
+#include "base/configobject.hpp"
#include "remote/zone.hpp"
namespace icinga
#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>
{
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();
Value rawvalue = DbValue::ExtractValue(value);
- if (rawvalue.IsObjectType<DynamicObject>()) {
+ if (rawvalue.IsObjectType<ConfigObject>()) {
DbObject::Ptr dbobjcol = DbObject::GetOrCreateByObject(rawvalue);
if (!dbobjcol) {
#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"
{
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();
Value rawvalue = DbValue::ExtractValue(value);
- if (rawvalue.IsObjectType<DynamicObject>()) {
+ if (rawvalue.IsObjectType<ConfigObject>()) {
DbObject::Ptr dbobjcol = DbObject::GetOrCreateByObject(rawvalue);
if (!dbobjcol) {
#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;
*/
void Demo::Start(void)
{
- DynamicObject::Start();
+ ConfigObject::Start();
m_DemoTimer = new Timer();
m_DemoTimer->SetInterval(5);
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");
}
}
* 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
{
};
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);
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);
#define APIACTIONS_H
#include "icinga/i2-icinga.hpp"
-#include "base/dynamicobject.hpp"
+#include "base/configobject.hpp"
#include "base/dictionary.hpp"
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);
#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"
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());
if (!object)
object = NotificationCommand::GetByName(objectName);
} else {
- DynamicType::Ptr dtype = DynamicType::GetByName(objectType);
+ ConfigType::Ptr dtype = ConfigType::GetByName(objectType);
if (!dtype)
return Empty;
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()) {
******************************************************************************/
#include "icinga/service.hpp"
-#include "base/dynamictype.hpp"
+#include "base/configtype.hpp"
#include "base/objectlock.hpp"
#include "base/timer.hpp"
#include "base/utility.hpp"
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();
}
}
******************************************************************************/
#include "icinga/service.hpp"
-#include "base/dynamictype.hpp"
+#include "base/configtype.hpp"
#include "base/objectlock.hpp"
#include "base/logger.hpp"
#include "base/timer.hpp"
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();
}
}
if (GetNextCheck() < now + 300)
UpdateNextCheck();
- DynamicObject::Start();
+ ConfigObject::Start();
}
void Checkable::OnStateLoaded(void)
#include "icinga/checkcommand.hpp"
#include "icinga/checkcommand.tcpp"
-#include "base/dynamictype.hpp"
+#include "base/configtype.hpp"
using namespace icinga;
#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>
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();
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();
{
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();
{
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()) {
#include "icinga/comment.hpp"
#include "icinga/comment.tcpp"
#include "base/utility.hpp"
-#include "base/dynamictype.hpp"
+#include "base/configtype.hpp"
using namespace icinga;
#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>
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;
{
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();
#include "icinga/i2-icinga.hpp"
#include "icinga/customvarobject.thpp"
-#include "base/dynamicobject.hpp"
+#include "base/configobject.hpp"
#include "remote/messageorigin.hpp"
namespace icinga
* 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;
};
#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"
void Dependency::OnAllConfigLoaded(void)
{
- DynamicObject::OnAllConfigLoaded();
+ ConfigObject::OnAllConfigLoaded();
Host::Ptr childHost = Host::GetByName(GetChildHostName());
void Dependency::Stop(void)
{
- DynamicObject::Stop();
+ ConfigObject::Stop();
GetChild()->RemoveDependency(this);
GetParent()->RemoveReverseDependency(this);
#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"
#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"
{
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());
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)
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");
#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"
{
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
}
*/
void IcingaStatusWriter::Start(void)
{
- DynamicObject::Start();
+ ConfigObject::Start();
m_StatusTimer = new Timer();
m_StatusTimer->SetInterval(GetUpdateInterval());
namespace icinga
{
-class IcingaStatusWriter : DynamicObject
+class IcingaStatusWriter : ConfigObject
{
[config] String status_path {
default {{{ return Application::GetLocalStateDir() + "/cache/icinga2/status.json"; }}}
#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>
#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"
void Notification::Start(void)
{
- DynamicObject::Start();
+ ConfigObject::Start();
Checkable::Ptr obj = GetCheckable();
void Notification::Stop(void)
{
- DynamicObject::Stop();
+ ConfigObject::Stop();
Checkable::Ptr obj = GetCheckable();
#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"
#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"
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();
}
}
#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"
#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"
#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"
void TimePeriod::Start(void)
{
- DynamicObject::Start();
+ ConfigObject::Start();
/* Pre-fill the time period for the next 24 hours. */
double now = Utility::GetTime();
{
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;
{
void User::OnConfigLoaded(void)
{
- DynamicObject::OnConfigLoaded();
+ ConfigObject::OnConfigLoaded();
SetTypeFilter(FilterArrayToInt(GetTypes(), ~0));
SetStateFilter(FilterArrayToInt(GetStates(), ~0));
void User::OnAllConfigLoaded(void)
{
- DynamicObject::OnAllConfigLoaded();
+ ConfigObject::OnAllConfigLoaded();
UserGroup::EvaluateObjectRules(this);
void User::Stop(void)
{
- DynamicObject::Stop();
+ ConfigObject::Stop();
Array::Ptr groups = GetGroups();
#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"
#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>
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;
}
#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>
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);
}
}
- 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);
#include "livestatus/contactgroupstable.hpp"
#include "icinga/usergroup.hpp"
-#include "base/dynamictype.hpp"
+#include "base/configtype.hpp"
#include <boost/foreach.hpp>
using namespace icinga;
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;
}
#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"
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;
}
#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>
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);
}
}
- 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);
#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"
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;
}
#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;
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;
}
#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"
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))
}
}
} 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;
}
#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"
{
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);
*/
void LivestatusListener::Start(void)
{
- DynamicObject::Start();
+ ConfigObject::Start();
if (GetSocketType() == "tcp") {
TcpSocket::Ptr socket = new TcpSocket();
void LivestatusListener::Stop(void)
{
- DynamicObject::Stop();
+ ConfigObject::Stop();
m_Listener->Close();
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
-#include "base/dynamicobject.hpp"
+#include "base/configobject.hpp"
#include "base/application.hpp"
library livestatus;
namespace icinga
{
-class LivestatusListener : DynamicObject {
+class LivestatusListener : ConfigObject {
[config] String socket_type {
default {{{ return "unix"; }}}
};
#include "livestatus/servicegroupstable.hpp"
#include "icinga/servicegroup.hpp"
-#include "base/dynamictype.hpp"
+#include "base/configtype.hpp"
#include <boost/foreach.hpp>
using namespace icinga;
void ServiceGroupsTable::FetchRows(const AddRowFunction& addRowFn)
{
- BOOST_FOREACH(const ServiceGroup::Ptr& sg, DynamicType::GetObjectsByType<ServiceGroup>()) {
+ BOOST_FOREACH(const ServiceGroup::Ptr& sg, ConfigType::GetObjectsByType<ServiceGroup>()) {
if (!addRowFn(sg, LivestatusGroupByNone, Empty))
return;
}
#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"
void ServicesTable::FetchRows(const AddRowFunction& addRowFn)
{
if (GetGroupByType() == LivestatusGroupByServiceGroup) {
- BOOST_FOREACH(const ServiceGroup::Ptr& sg, DynamicType::GetObjectsByType<ServiceGroup>()) {
+ BOOST_FOREACH(const ServiceGroup::Ptr& sg, ConfigType::GetObjectsByType<ServiceGroup>()) {
BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) {
/* the caller must know which groupby type and value are set for this row */
if (!addRowFn(service, LivestatusGroupByServiceGroup, sg))
}
}
} else if (GetGroupByType() == LivestatusGroupByHostGroup) {
- BOOST_FOREACH(const HostGroup::Ptr& hg, DynamicType::GetObjectsByType<HostGroup>()) {
+ BOOST_FOREACH(const HostGroup::Ptr& hg, ConfigType::GetObjectsByType<HostGroup>()) {
ObjectLock ylock(hg);
BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
ObjectLock ylock(host);
}
}
} else {
- BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType<Service>()) {
+ BOOST_FOREACH(const Service::Ptr& service, ConfigType::GetObjectsByType<Service>()) {
if (!addRowFn(service, LivestatusGroupByNone, Empty))
return;
}
#include "icinga/cib.hpp"
#include "icinga/host.hpp"
#include "icinga/service.hpp"
-#include "base/dynamictype.hpp"
+#include "base/configtype.hpp"
#include "base/utility.hpp"
#include "base/application.hpp"
#include <boost/foreach.hpp>
Value StatusTable::NumHostsAccessor(const Value&)
{
- return std::distance(DynamicType::GetObjectsByType<Host>().first, DynamicType::GetObjectsByType<Host>().second);
+ return std::distance(ConfigType::GetObjectsByType<Host>().first, ConfigType::GetObjectsByType<Host>().second);
}
Value StatusTable::NumServicesAccessor(const Value&)
{
- return std::distance(DynamicType::GetObjectsByType<Service>().first, DynamicType::GetObjectsByType<Service>().second);
+ return std::distance(ConfigType::GetObjectsByType<Service>().first, ConfigType::GetObjectsByType<Service>().second);
}
Value StatusTable::ProgramVersionAccessor(const Value&)
#include "livestatus/timeperiodstable.hpp"
#include "icinga/icingaapplication.hpp"
#include "icinga/timeperiod.hpp"
-#include "base/dynamictype.hpp"
+#include "base/configtype.hpp"
#include "base/objectlock.hpp"
#include "base/convert.hpp"
#include "base/utility.hpp"
void TimePeriodsTable::FetchRows(const AddRowFunction& addRowFn)
{
- BOOST_FOREACH(const TimePeriod::Ptr& tp, DynamicType::GetObjectsByType<TimePeriod>()) {
+ BOOST_FOREACH(const TimePeriod::Ptr& tp, ConfigType::GetObjectsByType<TimePeriod>()) {
if (!addRowFn(tp, LivestatusGroupByNone, Empty))
return;
}
#include "livestatus/zonestable.hpp"
#include "remote/zone.hpp"
-#include "base/dynamictype.hpp"
+#include "base/configtype.hpp"
#include <boost/foreach.hpp>
using namespace icinga;
void ZonesTable::FetchRows(const AddRowFunction& addRowFn)
{
- BOOST_FOREACH(const Zone::Ptr& zone, DynamicType::GetObjectsByType<Zone>()) {
+ BOOST_FOREACH(const Zone::Ptr& zone, ConfigType::GetObjectsByType<Zone>()) {
if (!addRowFn(zone, LivestatusGroupByNone, Empty))
return;
}
#include "icinga/checkcommand.hpp"
#include "icinga/macroprocessor.hpp"
#include "icinga/icingaapplication.hpp"
-#include "base/dynamictype.hpp"
+#include "base/configtype.hpp"
#include "base/logger.hpp"
#include "base/function.hpp"
#include "base/utility.hpp"
#include "base/convert.hpp"
#include "base/utility.hpp"
#include "base/function.hpp"
-#include "base/dynamictype.hpp"
+#include "base/configtype.hpp"
#include <boost/algorithm/string/join.hpp>
#include <boost/foreach.hpp>
#include "base/objectlock.hpp"
#include "base/utility.hpp"
#include "base/function.hpp"
-#include "base/dynamictype.hpp"
+#include "base/configtype.hpp"
using namespace icinga;
#include "icinga/checkcommand.hpp"
#include "icinga/macroprocessor.hpp"
#include "icinga/icingaapplication.hpp"
-#include "base/dynamictype.hpp"
+#include "base/configtype.hpp"
#include "base/logger.hpp"
#include "base/function.hpp"
#include "base/utility.hpp"
#include "icinga/macroprocessor.hpp"
#include "icinga/pluginutility.hpp"
#include "icinga/icingaapplication.hpp"
-#include "base/dynamictype.hpp"
+#include "base/configtype.hpp"
#include "base/logger.hpp"
#include "base/function.hpp"
#include "base/utility.hpp"
#include "notification/notificationcomponent.tcpp"
#include "icinga/service.hpp"
#include "icinga/icingaapplication.hpp"
-#include "base/dynamictype.hpp"
+#include "base/configtype.hpp"
#include "base/objectlock.hpp"
#include "base/logger.hpp"
#include "base/utility.hpp"
{
Dictionary::Ptr nodes = new Dictionary();
- BOOST_FOREACH(const NotificationComponent::Ptr& notification_component, DynamicType::GetObjectsByType<NotificationComponent>()) {
+ BOOST_FOREACH(const NotificationComponent::Ptr& notification_component, ConfigType::GetObjectsByType<NotificationComponent>()) {
nodes->Set(notification_component->GetName(), 1); //add more stats
}
*/
void NotificationComponent::Start(void)
{
- DynamicObject::Start();
+ ConfigObject::Start();
Checkable::OnNotificationsRequested.connect(boost::bind(&NotificationComponent::SendNotificationsHandler, this, _1,
_2, _3, _4, _5));
{
double now = Utility::GetTime();
- BOOST_FOREACH(const Notification::Ptr& notification, DynamicType::GetObjectsByType<Notification>()) {
+ BOOST_FOREACH(const Notification::Ptr& notification, ConfigType::GetObjectsByType<Notification>()) {
Checkable::Ptr checkable = notification->GetCheckable();
if (checkable->IsPaused() && GetEnableHA())
#include "notification/notificationcomponent.thpp"
#include "icinga/service.hpp"
-#include "base/dynamicobject.hpp"
+#include "base/configobject.hpp"
#include "base/timer.hpp"
namespace icinga
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
-#include "base/dynamicobject.hpp"
+#include "base/configobject.hpp"
library notification;
namespace icinga
{
-class NotificationComponent : DynamicObject
+class NotificationComponent : ConfigObject
{
[config] bool enable_ha (EnableHA) {
default {{{ return true; }}}
#include "icinga/compatutility.hpp"
#include "icinga/perfdatavalue.hpp"
#include "base/tcpsocket.hpp"
-#include "base/dynamictype.hpp"
+#include "base/configtype.hpp"
#include "base/objectlock.hpp"
#include "base/logger.hpp"
#include "base/utility.hpp"
void GelfWriter::Start(void)
{
- DynamicObject::Start();
+ ConfigObject::Start();
m_ReconnectTimer = new Timer();
m_ReconnectTimer->SetInterval(10);
#include "perfdata/gelfwriter.thpp"
#include "icinga/service.hpp"
-#include "base/dynamicobject.hpp"
+#include "base/configobject.hpp"
#include "base/tcpsocket.hpp"
#include "base/timer.hpp"
#include <fstream>
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
-#include "base/dynamicobject.hpp"
+#include "base/configobject.hpp"
library perfdata;
namespace icinga
{
-class GelfWriter : DynamicObject
+class GelfWriter : ConfigObject
{
[config] String host {
default {{{ return "127.0.0.1"; }}}
#include "icinga/compatutility.hpp"
#include "icinga/perfdatavalue.hpp"
#include "base/tcpsocket.hpp"
-#include "base/dynamictype.hpp"
+#include "base/configtype.hpp"
#include "base/objectlock.hpp"
#include "base/logger.hpp"
#include "base/convert.hpp"
{
Dictionary::Ptr nodes = new Dictionary();
- BOOST_FOREACH(const GraphiteWriter::Ptr& graphitewriter, DynamicType::GetObjectsByType<GraphiteWriter>()) {
+ BOOST_FOREACH(const GraphiteWriter::Ptr& graphitewriter, ConfigType::GetObjectsByType<GraphiteWriter>()) {
nodes->Set(graphitewriter->GetName(), 1); //add more stats
}
void GraphiteWriter::Start(void)
{
- DynamicObject::Start();
+ ConfigObject::Start();
m_ReconnectTimer = new Timer();
m_ReconnectTimer->SetInterval(10);
#include "perfdata/graphitewriter.thpp"
#include "icinga/service.hpp"
-#include "base/dynamicobject.hpp"
+#include "base/configobject.hpp"
#include "base/tcpsocket.hpp"
#include "base/timer.hpp"
#include <fstream>
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
-#include "base/dynamicobject.hpp"
+#include "base/configobject.hpp"
library perfdata;
namespace icinga
{
-class GraphiteWriter : DynamicObject
+class GraphiteWriter : ConfigObject
{
[config] String host {
default {{{ return "127.0.0.1"; }}}
#include "icinga/compatutility.hpp"
#include "icinga/perfdatavalue.hpp"
#include "base/tcpsocket.hpp"
-#include "base/dynamictype.hpp"
+#include "base/configtype.hpp"
#include "base/objectlock.hpp"
#include "base/logger.hpp"
#include "base/convert.hpp"
{
Dictionary::Ptr nodes = new Dictionary();
- BOOST_FOREACH(const OpenTsdbWriter::Ptr& opentsdbwriter, DynamicType::GetObjectsByType<OpenTsdbWriter>()) {
+ BOOST_FOREACH(const OpenTsdbWriter::Ptr& opentsdbwriter, ConfigType::GetObjectsByType<OpenTsdbWriter>()) {
nodes->Set(opentsdbwriter->GetName(), 1); //add more stats
}
void OpenTsdbWriter::Start(void)
{
- DynamicObject::Start();
+ ConfigObject::Start();
m_ReconnectTimer = new Timer();
m_ReconnectTimer->SetInterval(10);
#include "perfdata/opentsdbwriter.thpp"
#include "icinga/service.hpp"
-#include "base/dynamicobject.hpp"
+#include "base/configobject.hpp"
#include "base/tcpsocket.hpp"
#include "base/timer.hpp"
#include <fstream>
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
-#include "base/dynamicobject.hpp"
+#include "base/configobject.hpp"
library perfdata;
namespace icinga
{
-class OpenTsdbWriter : DynamicObject
+class OpenTsdbWriter : ConfigObject
{
[config] String host {
default {{{ return "127.0.0.1"; }}}
#include "icinga/service.hpp"
#include "icinga/macroprocessor.hpp"
#include "icinga/icingaapplication.hpp"
-#include "base/dynamictype.hpp"
+#include "base/configtype.hpp"
#include "base/objectlock.hpp"
#include "base/logger.hpp"
#include "base/convert.hpp"
{
Dictionary::Ptr nodes = new Dictionary();
- BOOST_FOREACH(const PerfdataWriter::Ptr& perfdatawriter, DynamicType::GetObjectsByType<PerfdataWriter>()) {
+ BOOST_FOREACH(const PerfdataWriter::Ptr& perfdatawriter, ConfigType::GetObjectsByType<PerfdataWriter>()) {
nodes->Set(perfdatawriter->GetName(), 1); //add more stats
}
void PerfdataWriter::Start(void)
{
- DynamicObject::Start();
+ ConfigObject::Start();
Checkable::OnNewCheckResult.connect(boost::bind(&PerfdataWriter::CheckResultHandler, this, _1, _2));
#include "perfdata/perfdatawriter.thpp"
#include "icinga/service.hpp"
-#include "base/dynamicobject.hpp"
+#include "base/configobject.hpp"
#include "base/timer.hpp"
#include <fstream>
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
-#include "base/dynamicobject.hpp"
+#include "base/configobject.hpp"
#include "base/application.hpp"
library perfdata;
namespace icinga
{
-class PerfdataWriter : DynamicObject
+class PerfdataWriter : ConfigObject
{
[config] String host_perfdata_path {
default {{{ return Application::GetLocalStateDir() + "/spool/icinga2/perfdata/host-perfdata"; }}}
Dictionary::Ptr params = HttpUtility::FetchRequestParameters(request);
- std::vector<DynamicObject::Ptr> objs = FilterUtility::GetFilterTargets(qd, params);
+ std::vector<ConfigObject::Ptr> objs = FilterUtility::GetFilterTargets(qd, params);
Array::Ptr results = new Array();
- BOOST_FOREACH(const DynamicObject::Ptr& obj, objs) {
+ BOOST_FOREACH(const ConfigObject::Ptr& obj, objs) {
try {
results->Add(action->Invoke(obj, params));
} catch (const std::exception& ex) {
: m_Types(types), m_Callback(action)
{ }
-Value ApiAction::Invoke(const DynamicObject::Ptr& target, const Dictionary::Ptr& params)
+Value ApiAction::Invoke(const ConfigObject::Ptr& target, const Dictionary::Ptr& params)
{
return m_Callback(target, params);
}
#include "base/registry.hpp"
#include "base/value.hpp"
#include "base/dictionary.hpp"
-#include "base/dynamicobject.hpp"
+#include "base/configobject.hpp"
#include <vector>
#include <boost/function.hpp>
#include <boost/algorithm/string/replace.hpp>
public:
DECLARE_PTR_TYPEDEFS(ApiAction);
- typedef boost::function<Value(const DynamicObject::Ptr& target, const Dictionary::Ptr& params)> Callback;
+ typedef boost::function<Value(const ConfigObject::Ptr& target, const Dictionary::Ptr& params)> Callback;
ApiAction(const std::vector<String>& registerTypes, const Callback& function);
- Value Invoke(const DynamicObject::Ptr& target, const Dictionary::Ptr& params);
+ Value Invoke(const ConfigObject::Ptr& target, const Dictionary::Ptr& params);
const std::vector<String>& GetTypes(void) const;
#include "remote/apilistener.hpp"
#include "remote/apifunction.hpp"
#include "config/configcompiler.hpp"
-#include "base/dynamictype.hpp"
+#include "base/configtype.hpp"
#include "base/logger.hpp"
#include "base/convert.hpp"
#include "base/exception.hpp"
void ApiListener::SyncZoneDirs(void) const
{
- BOOST_FOREACH(const Zone::Ptr& zone, DynamicType::GetObjectsByType<Zone>()) {
+ BOOST_FOREACH(const Zone::Ptr& zone, ConfigType::GetObjectsByType<Zone>()) {
if (!IsConfigMaster(zone))
continue;
String zonesDir = Application::GetLocalStateDir() + "/lib/icinga2/api/zones";
- BOOST_FOREACH(const Zone::Ptr& zone, DynamicType::GetObjectsByType<Zone>()) {
+ BOOST_FOREACH(const Zone::Ptr& zone, ConfigType::GetObjectsByType<Zone>()) {
String zoneDir = zonesDir + "/" + zone->GetName();
if (!zone->IsChildOf(azone) && !zone->IsGlobal()) {
#include "base/convert.hpp"
#include "base/netstring.hpp"
#include "base/json.hpp"
-#include "base/dynamictype.hpp"
+#include "base/configtype.hpp"
#include "base/logger.hpp"
#include "base/objectlock.hpp"
#include "base/stdiostream.hpp"
{
SyncZoneDirs();
- if (std::distance(DynamicType::GetObjectsByType<ApiListener>().first, DynamicType::GetObjectsByType<ApiListener>().second) > 1) {
+ if (std::distance(ConfigType::GetObjectsByType<ApiListener>().first, ConfigType::GetObjectsByType<ApiListener>().second) > 1) {
Log(LogCritical, "ApiListener", "Only one ApiListener object is allowed.");
return;
}
- DynamicObject::Start();
+ ConfigObject::Start();
{
boost::mutex::scoped_lock(m_LogLock);
ApiListener::Ptr ApiListener::GetInstance(void)
{
- BOOST_FOREACH(const ApiListener::Ptr& listener, DynamicType::GetObjectsByType<ApiListener>())
+ BOOST_FOREACH(const ApiListener::Ptr& listener, ConfigType::GetObjectsByType<ApiListener>())
return listener;
return ApiListener::Ptr();
BOOST_FOREACH(int ts, files) {
bool need = false;
- BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjectsByType<Endpoint>()) {
+ BOOST_FOREACH(const Endpoint::Ptr& endpoint, ConfigType::GetObjectsByType<Endpoint>()) {
if (endpoint->GetName() == GetIdentity())
continue;
Zone::Ptr my_zone = Zone::GetLocalZone();
- BOOST_FOREACH(const Zone::Ptr& zone, DynamicType::GetObjectsByType<Zone>()) {
+ BOOST_FOREACH(const Zone::Ptr& zone, ConfigType::GetObjectsByType<Zone>()) {
/* only connect to endpoints in a) the same zone b) our parent zone c) immediate child zones */
if (my_zone != zone && my_zone != zone->GetParent() && zone != my_zone->GetParent()) {
Log(LogDebug, "ApiListener")
}
}
- BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjectsByType<Endpoint>()) {
+ BOOST_FOREACH(const Endpoint::Ptr& endpoint, ConfigType::GetObjectsByType<Endpoint>()) {
if (!endpoint->IsConnected())
continue;
<< "Current zone master: " << master->GetName();
std::vector<String> names;
- BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjectsByType<Endpoint>())
+ BOOST_FOREACH(const Endpoint::Ptr& endpoint, ConfigType::GetObjectsByType<Endpoint>())
if (endpoint->IsConnected())
names.push_back(endpoint->GetName() + " (" + Convert::ToString(endpoint->GetClients().size()) + ")");
<< "Connected endpoints: " << Utility::NaturalJoin(names);
}
-void ApiListener::RelayMessage(const MessageOrigin::Ptr& origin, const DynamicObject::Ptr& secobj, const Dictionary::Ptr& message, bool log)
+void ApiListener::RelayMessage(const MessageOrigin::Ptr& origin, const ConfigObject::Ptr& secobj, const Dictionary::Ptr& message, bool log)
{
m_RelayQueue.Enqueue(boost::bind(&ApiListener::SyncRelayMessage, this, origin, secobj, message, log));
}
-void ApiListener::PersistMessage(const Dictionary::Ptr& message, const DynamicObject::Ptr& secobj)
+void ApiListener::PersistMessage(const Dictionary::Ptr& message, const ConfigObject::Ptr& secobj)
{
double ts = message->Get("ts");
}
-void ApiListener::SyncRelayMessage(const MessageOrigin::Ptr& origin, const DynamicObject::Ptr& secobj, const Dictionary::Ptr& message, bool log)
+void ApiListener::SyncRelayMessage(const MessageOrigin::Ptr& origin, const ConfigObject::Ptr& secobj, const Dictionary::Ptr& message, bool log)
{
double ts = Utility::GetTime();
message->Set("ts", ts);
std::vector<Endpoint::Ptr> skippedEndpoints;
std::set<Zone::Ptr> finishedZones;
- BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjectsByType<Endpoint>()) {
+ BOOST_FOREACH(const Endpoint::Ptr& endpoint, ConfigType::GetObjectsByType<Endpoint>()) {
/* don't relay messages to ourselves or disconnected endpoints */
if (endpoint->GetName() == GetIdentity() || !endpoint->IsConnected())
continue;
Dictionary::Ptr secname = pmessage->Get("secobj");
if (secname) {
- DynamicType::Ptr dtype = DynamicType::GetByName(secname->Get("type"));
+ ConfigType::Ptr dtype = ConfigType::GetByName(secname->Get("type"));
if (!dtype)
continue;
- DynamicObject::Ptr secobj = dtype->GetObject(secname->Get("name"));
+ ConfigObject::Ptr secobj = dtype->GetObject(secname->Get("name"));
if (!secobj)
continue;
Zone::Ptr my_zone = Zone::GetLocalZone();
- BOOST_FOREACH(const Zone::Ptr& zone, DynamicType::GetObjectsByType<Zone>()) {
+ BOOST_FOREACH(const Zone::Ptr& zone, ConfigType::GetObjectsByType<Zone>()) {
/* only check endpoints in a) the same zone b) our parent zone c) immediate child zones */
if (my_zone != zone && my_zone != zone->GetParent() && zone != my_zone->GetParent()) {
Log(LogDebug, "ApiListener")
#include "remote/httpconnection.hpp"
#include "remote/endpoint.hpp"
#include "remote/messageorigin.hpp"
-#include "base/dynamicobject.hpp"
+#include "base/configobject.hpp"
#include "base/timer.hpp"
#include "base/workqueue.hpp"
#include "base/tcpsocket.hpp"
static String GetApiDir(void);
void SyncSendMessage(const Endpoint::Ptr& endpoint, const Dictionary::Ptr& message);
- void RelayMessage(const MessageOrigin::Ptr& origin, const DynamicObject::Ptr& secobj, const Dictionary::Ptr& message, bool log);
+ void RelayMessage(const MessageOrigin::Ptr& origin, const ConfigObject::Ptr& secobj, const Dictionary::Ptr& message, bool log);
static void StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata);
std::pair<Dictionary::Ptr, Dictionary::Ptr> GetStatus(void);
Stream::Ptr m_LogFile;
size_t m_LogMessageCount;
- void SyncRelayMessage(const MessageOrigin::Ptr& origin, const DynamicObject::Ptr& secobj, const Dictionary::Ptr& message, bool log);
- void PersistMessage(const Dictionary::Ptr& message, const DynamicObject::Ptr& secobj);
+ void SyncRelayMessage(const MessageOrigin::Ptr& origin, const ConfigObject::Ptr& secobj, const Dictionary::Ptr& message, bool log);
+ void PersistMessage(const Dictionary::Ptr& message, const ConfigObject::Ptr& secobj);
void OpenLogFile(void);
void RotateLogFile(void);
******************************************************************************/
#include "remote/i2-remote.hpp"
-#include "base/dynamicobject.hpp"
+#include "base/configobject.hpp"
#include "base/application.hpp"
library remote;
namespace icinga
{
-class ApiListener : DynamicObject
+class ApiListener : ConfigObject
{
[config, required] String cert_path;
[config, required] String key_path;
#include "remote/apiuser.hpp"
#include "remote/apiuser.tcpp"
-#include "base/dynamictype.hpp"
+#include "base/configtype.hpp"
using namespace icinga;
ApiUser::Ptr ApiUser::GetByClientCN(const String& cn)
{
- BOOST_FOREACH(const ApiUser::Ptr& user, DynamicType::GetObjectsByType<ApiUser>()) {
+ BOOST_FOREACH(const ApiUser::Ptr& user, ConfigType::GetObjectsByType<ApiUser>()) {
if (user->GetClientCN() == cn)
return user;
}
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
-#include "base/dynamicobject.hpp"
+#include "base/configobject.hpp"
library remote;
namespace icinga
{
-class ApiUser : DynamicObject
+class ApiUser : ConfigObject
{
[config, protected] String password (PasswordRaw);
[config] String client_cn (ClientCN);
#include "remote/zone.hpp"
#include "remote/apilistener.hpp"
-#include "base/dynamictype.hpp"
+#include "base/configtype.hpp"
#include "base/utility.hpp"
#include "base/initialize.hpp"
#include "base/timer.hpp"
static Timer::Ptr l_AuthorityTimer;
-static bool ObjectNameLessComparer(const DynamicObject::Ptr& a, const DynamicObject::Ptr& b)
+static bool ObjectNameLessComparer(const ConfigObject::Ptr& a, const ConfigObject::Ptr& b)
{
return a->GetName() < b->GetName();
}
std::sort(endpoints.begin(), endpoints.end(), ObjectNameLessComparer);
- BOOST_FOREACH(const DynamicType::Ptr& type, DynamicType::GetTypes()) {
- BOOST_FOREACH(const DynamicObject::Ptr& object, type->GetObjects()) {
+ BOOST_FOREACH(const ConfigType::Ptr& type, ConfigType::GetTypes()) {
+ BOOST_FOREACH(const ConfigObject::Ptr& object, type->GetObjects()) {
Endpoint::Ptr endpoint = endpoints[Utility::SDBM(object->GetName()) % endpoints.size()];
if (object->GetHAMode() == HARunOnce)
params->Set(attr, request.RequestUrl->GetPath()[2]);
}
- std::vector<DynamicObject::Ptr> objs = FilterUtility::GetFilterTargets(qd, params);
+ std::vector<ConfigObject::Ptr> objs = FilterUtility::GetFilterTargets(qd, params);
Array::Ptr results = new Array();
- BOOST_FOREACH(const DynamicObject::Ptr& obj, objs) {
+ BOOST_FOREACH(const ConfigObject::Ptr& obj, objs) {
Dictionary::Ptr result1 = new Dictionary();
result1->Set("type", type->GetName());
result1->Set("name", obj->GetName());
#include "remote/apilistener.hpp"
#include "remote/jsonrpcconnection.hpp"
#include "remote/zone.hpp"
-#include "base/dynamictype.hpp"
+#include "base/configtype.hpp"
#include "base/utility.hpp"
#include "base/exception.hpp"
#include "base/convert.hpp"
void Endpoint::OnAllConfigLoaded(void)
{
- DynamicObject::OnConfigLoaded();
+ ConfigObject::OnConfigLoaded();
- BOOST_FOREACH(const Zone::Ptr& zone, DynamicType::GetObjectsByType<Zone>()) {
+ BOOST_FOREACH(const Zone::Ptr& zone, ConfigType::GetObjectsByType<Zone>()) {
const std::set<Endpoint::Ptr> members = zone->GetEndpoints();
if (members.empty())
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
-#include "base/dynamicobject.hpp"
+#include "base/configobject.hpp"
library remote;
namespace icinga
{
-class Endpoint : DynamicObject
+class Endpoint : ConfigObject
{
[config] String host;
[config] String port {
#include "config/configcompiler.hpp"
#include "config/expression.hpp"
#include "base/json.hpp"
-#include "base/dynamictype.hpp"
+#include "base/configtype.hpp"
#include "base/logger.hpp"
#include <boost/foreach.hpp>
#include <boost/algorithm/string.hpp>
String uname = pluralName;
boost::algorithm::to_lower(uname);
- BOOST_FOREACH(const DynamicType::Ptr& dtype, DynamicType::GetTypes()) {
+ BOOST_FOREACH(const ConfigType::Ptr& dtype, ConfigType::GetTypes()) {
Type::Ptr type = Type::GetByName(dtype->GetName());
ASSERT(type);
return Type::Ptr();
}
-DynamicObject::Ptr FilterUtility::GetObjectByTypeAndName(const String& type, const String& name)
+ConfigObject::Ptr FilterUtility::GetObjectByTypeAndName(const String& type, const String& name)
{
- DynamicType::Ptr dtype = DynamicType::GetByName(type);
+ ConfigType::Ptr dtype = ConfigType::GetByName(type);
ASSERT(dtype);
return dtype->GetObject(name);
}
-std::vector<DynamicObject::Ptr> FilterUtility::GetFilterTargets(const QueryDescription& qd, const Dictionary::Ptr& query)
+std::vector<ConfigObject::Ptr> FilterUtility::GetFilterTargets(const QueryDescription& qd, const Dictionary::Ptr& query)
{
- std::vector<DynamicObject::Ptr> result;
+ std::vector<ConfigObject::Ptr> result;
BOOST_FOREACH(const Type::Ptr& type, qd.Types) {
String attr = type->GetName();
if (query->Contains(attr)) {
String name = HttpUtility::GetLastParameter(query, attr);
- DynamicObject::Ptr obj = GetObjectByTypeAndName(type->GetName(), name);
+ ConfigObject::Ptr obj = GetObjectByTypeAndName(type->GetName(), name);
if (!obj)
BOOST_THROW_EXCEPTION(std::invalid_argument("Object does not exist."));
result.push_back(obj);
if (names) {
ObjectLock olock(names);
BOOST_FOREACH(const String& name, names) {
- DynamicObject::Ptr obj = GetObjectByTypeAndName(type->GetName(), name);
+ ConfigObject::Ptr obj = GetObjectByTypeAndName(type->GetName(), name);
if (!obj)
BOOST_THROW_EXCEPTION(std::invalid_argument("Object does not exist."));
result.push_back(obj);
if (qd.Types.find(utype) == qd.Types.end())
BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid type specified for this query."));
- DynamicType::Ptr dtype = DynamicType::GetByName(type);
+ ConfigType::Ptr dtype = ConfigType::GetByName(type);
ASSERT(dtype);
Expression *ufilter = ConfigCompiler::CompileText("<API query>", filter, false);
boost::algorithm::to_lower(varName);
try {
- BOOST_FOREACH(const DynamicObject::Ptr& object, dtype->GetObjects()) {
+ BOOST_FOREACH(const ConfigObject::Ptr& object, dtype->GetObjects()) {
frame.Locals->Set(varName, object);
if (Convert::ToBool(ufilter->Evaluate(frame)))
#include "remote/i2-remote.hpp"
#include "base/dictionary.hpp"
-#include "base/dynamicobject.hpp"
+#include "base/configobject.hpp"
#include <set>
namespace icinga
{
public:
static Type::Ptr TypeFromPluralName(const String& pluralName);
- static DynamicObject::Ptr GetObjectByTypeAndName(const String& type, const String& name);
- static std::vector<DynamicObject::Ptr> GetFilterTargets(const QueryDescription& qd, const Dictionary::Ptr& query);
+ static ConfigObject::Ptr GetObjectByTypeAndName(const String& type, const String& name);
+ static std::vector<ConfigObject::Ptr> GetFilterTargets(const QueryDescription& qd, const Dictionary::Ptr& query);
};
}
#include "remote/apifunction.hpp"
#include "remote/jsonrpc.hpp"
#include "remote/base64.hpp"
-#include "base/dynamictype.hpp"
+#include "base/configtype.hpp"
#include "base/objectlock.hpp"
#include "base/utility.hpp"
#include "base/logger.hpp"
#include "remote/messageorigin.hpp"
#include "remote/apifunction.hpp"
#include "base/initialize.hpp"
-#include "base/dynamictype.hpp"
+#include "base/configtype.hpp"
#include "base/logger.hpp"
#include "base/utility.hpp"
#include <boost/foreach.hpp>
void JsonRpcConnection::HeartbeatTimerHandler(void)
{
- BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjectsByType<Endpoint>()) {
+ BOOST_FOREACH(const Endpoint::Ptr& endpoint, ConfigType::GetObjectsByType<Endpoint>()) {
BOOST_FOREACH(const JsonRpcConnection::Ptr& client, endpoint->GetClients()) {
if (endpoint->GetSyncing()) {
Log(LogInformation, "JsonRpcConnection")
#include "remote/apilistener.hpp"
#include "remote/apifunction.hpp"
#include "remote/jsonrpc.hpp"
-#include "base/dynamictype.hpp"
+#include "base/configtype.hpp"
#include "base/objectlock.hpp"
#include "base/utility.hpp"
#include "base/logger.hpp"
client->CheckLiveness();
}
- BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjectsByType<Endpoint>()) {
+ BOOST_FOREACH(const Endpoint::Ptr& endpoint, ConfigType::GetObjectsByType<Endpoint>()) {
BOOST_FOREACH(const JsonRpcConnection::Ptr& client, endpoint->GetClients()) {
client->CheckLiveness();
}
params->Set(attr, request.RequestUrl->GetPath()[2]);
}
- std::vector<DynamicObject::Ptr> objs = FilterUtility::GetFilterTargets(qd, params);
+ std::vector<ConfigObject::Ptr> objs = FilterUtility::GetFilterTargets(qd, params);
Dictionary::Ptr attrs = params->Get("attrs");
Array::Ptr results = new Array();
- BOOST_FOREACH(const DynamicObject::Ptr& obj, objs) {
+ BOOST_FOREACH(const ConfigObject::Ptr& obj, objs) {
Dictionary::Ptr result1 = new Dictionary();
result1->Set("type", type->GetName());
params->Set(attr, request.RequestUrl->GetPath()[2]);
}
- std::vector<DynamicObject::Ptr> objs = FilterUtility::GetFilterTargets(qd, params);
+ std::vector<ConfigObject::Ptr> objs = FilterUtility::GetFilterTargets(qd, params);
Array::Ptr results = new Array();
}
}
- BOOST_FOREACH(const DynamicObject::Ptr& obj, objs) {
+ BOOST_FOREACH(const ConfigObject::Ptr& obj, objs) {
BOOST_FOREACH(const String& joinType, joinTypes) {
String prefix = joinType;
boost::algorithm::to_lower(prefix);
return result;
}
-bool Zone::CanAccessObject(const DynamicObject::Ptr& object)
+bool Zone::CanAccessObject(const ConfigObject::Ptr& object)
{
Zone::Ptr object_zone;
Zone::Ptr GetParent(void) const;
std::set<Endpoint::Ptr> GetEndpoints(void) const;
- bool CanAccessObject(const DynamicObject::Ptr& object);
+ bool CanAccessObject(const ConfigObject::Ptr& object);
bool IsChildOf(const Zone::Ptr& zone);
bool IsGlobal(void) const;
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
-#include "base/dynamicobject.hpp"
+#include "base/configobject.hpp"
library remote;
namespace icinga
{
-class Zone : DynamicObject
+class Zone : ConfigObject
{
[config] name(Zone) parent (ParentRaw);
[config] Array::Ptr endpoints (EndpointsRaw);
BOOST_AUTO_TEST_CASE(assign)
{
Type::Ptr t1 = Type::GetByName("Application");
- Type::Ptr t2 = Type::GetByName("DynamicObject");
+ Type::Ptr t2 = Type::GetByName("ConfigObject");
BOOST_CHECK(t1->IsAssignableFrom(t1));
BOOST_CHECK(t2->IsAssignableFrom(t1));
else
m_Impl << "\t" << "if (value.IsEmpty())" << std::endl;
- m_Impl << "\t\t" << "BOOST_THROW_EXCEPTION(ValidationError(dynamic_cast<DynamicObject *>(this), boost::assign::list_of(\"" << field.Name << "\"), \"Attribute must not be empty.\"));" << std::endl << std::endl;
+ m_Impl << "\t\t" << "BOOST_THROW_EXCEPTION(ValidationError(dynamic_cast<ConfigObject *>(this), boost::assign::list_of(\"" << field.Name << "\"), \"Attribute must not be empty.\"));" << std::endl << std::endl;
}
if (field.Type.IsName) {
m_Impl << "\t" << "String ref = value;" << std::endl
<< "\t" << "if (!ref.IsEmpty() && !utils.ValidateName(\"" << field.Type.TypeName << "\", ref))" << std::endl
- << "\t\t" << "BOOST_THROW_EXCEPTION(ValidationError(dynamic_cast<DynamicObject *>(this), boost::assign::list_of(\"" << field.Name << "\"), \"Object '\" + ref + \"' of type '" << field.Type.TypeName
+ << "\t\t" << "BOOST_THROW_EXCEPTION(ValidationError(dynamic_cast<ConfigObject *>(this), boost::assign::list_of(\"" << field.Name << "\"), \"Object '\" + ref + \"' of type '" << field.Type.TypeName
<< "' does not exist.\"));" << std::endl;
}
}
m_Impl << "void ObjectImpl<" << klass.Name << ">::Notify" << it->GetFriendlyName() << "(const Value& cookie)" << std::endl
<< "{" << std::endl
- << "\t" << "DynamicObject *dobj = dynamic_cast<DynamicObject *>(this);" << std::endl;
+ << "\t" << "ConfigObject *dobj = dynamic_cast<ConfigObject *>(this);" << std::endl;
if (it->Name != "active") {
m_Impl << "\t" << "if (!dobj || dobj->IsActive())" << std::endl
}
}
- if (klass.Name == "DynamicObject")
+ if (klass.Name == "ConfigObject")
m_Header << "\t" << "friend class ConfigItem;" << std::endl;
if (!klass.TypeBase.empty())
m_Impl << "\t" << "if (!value)" << std::endl;
if (required)
- m_Impl << "BOOST_THROW_EXCEPTION(ValidationError(dynamic_cast<DynamicObject *>(this), location, \"This attribute must not be empty.\"));" << std::endl;
+ m_Impl << "BOOST_THROW_EXCEPTION(ValidationError(dynamic_cast<ConfigObject *>(this), location, \"This attribute must not be empty.\"));" << std::endl;
else
m_Impl << "\t\t" << "return;" << std::endl;
<< "\t\t\t" << "if (utils.ValidateName(\"" << rule.Type << "\", value))" << std::endl
<< "\t\t\t\t" << "return;" << std::endl
<< "\t\t\t" << "else" << std::endl
- << "\t\t\t\t" << "BOOST_THROW_EXCEPTION(ValidationError(dynamic_pointer_cast<DynamicObject>(object), location, \"Object '\" + value + \"' of type '" << rule.Type << "' does not exist.\"));" << std::endl
+ << "\t\t\t\t" << "BOOST_THROW_EXCEPTION(ValidationError(dynamic_pointer_cast<ConfigObject>(object), location, \"Object '\" + value + \"' of type '" << rule.Type << "' does not exist.\"));" << std::endl
<< "\t\t" << "}" << std::endl;
}
if (rule.Type == "Dictionary") {
m_Impl << (type_check ? "\t" : "") << "\t\t" << "if (dict.Get(\"" << srule.Pattern << "\").IsEmpty())" << std::endl
- << (type_check ? "\t" : "") << "\t\t\t" << "BOOST_THROW_EXCEPTION(ValidationError(dynamic_cast<DynamicObject *>(this), location, \"Required dictionary item '" << srule.Pattern << "' is not set.\"));" << std::endl;
+ << (type_check ? "\t" : "") << "\t\t\t" << "BOOST_THROW_EXCEPTION(ValidationError(dynamic_cast<ConfigObject *>(this), location, \"Required dictionary item '" << srule.Pattern << "' is not set.\"));" << std::endl;
} else if (rule.Type == "Array") {
int index = -1;
std::stringstream idxbuf;
}
m_Impl << (type_check ? "\t" : "") << "\t\t" << "if (arr.GetLength() < " << (index + 1) << ")" << std::endl
- << (type_check ? "\t" : "") << "\t\t\t" << "BOOST_THROW_EXCEPTION(ValidationError(dynamic_cast<DynamicObject *>(this), location, \"Required index '" << index << "' is not set.\"));" << std::endl;
+ << (type_check ? "\t" : "") << "\t\t\t" << "BOOST_THROW_EXCEPTION(ValidationError(dynamic_cast<ConfigObject *>(this), location, \"Required index '" << index << "' is not set.\"));" << std::endl;
}
}
if (type_check || validatorType != ValidatorField) {
if (validatorType != ValidatorField) {
m_Impl << "\t" << "if (!known_attribute)" << std::endl
- << "\t\t" << "BOOST_THROW_EXCEPTION(ValidationError(dynamic_pointer_cast<DynamicObject>(object), location, \"Invalid attribute: \" + key));" << std::endl
+ << "\t\t" << "BOOST_THROW_EXCEPTION(ValidationError(dynamic_pointer_cast<ConfigObject>(object), location, \"Invalid attribute: \" + key));" << std::endl
<< "\t" << "else" << std::endl;
}
- m_Impl << (validatorType != ValidatorField ? "\t" : "") << "\t" << "BOOST_THROW_EXCEPTION(ValidationError(dynamic_pointer_cast<DynamicObject>(object), location, \"Invalid type.\"));" << std::endl;
+ m_Impl << (validatorType != ValidatorField ? "\t" : "") << "\t" << "BOOST_THROW_EXCEPTION(ValidationError(dynamic_pointer_cast<ConfigObject>(object), location, \"Invalid type.\"));" << std::endl;
}
m_Impl << "}" << std::endl << std::endl;