[icinga-checkins] icinga.org: icinga2/master: custom attr: move into DynamicObject using GetCustom()

git at icinga.org git at icinga.org
Fri Jul 12 16:46:09 CEST 2013


Module: icinga2
Branch: master
Commit: 36e9e9adbd624eaff13624fd56047e67cd593b7e
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=36e9e9adbd624eaff13624fd56047e67cd593b7e

Author: Michael Friedrich <michael.friedrich at netways.de>
Date:   Fri Jul 12 15:13:05 2013 +0200

custom attr: move into DynamicObject using GetCustom()

---

 components/compat/compatcomponent.cpp |    2 +-
 lib/base/dynamicobject.cpp            |    6 ++++++
 lib/base/dynamicobject.h              |    3 +++
 lib/icinga/host.cpp                   |    6 ------
 lib/icinga/host.h                     |    2 --
 lib/icinga/service.cpp                |    6 ------
 lib/icinga/service.h                  |    2 --
 7 files changed, 10 insertions(+), 17 deletions(-)

diff --git a/components/compat/compatcomponent.cpp b/components/compat/compatcomponent.cpp
index 683d8dd..695a9f6 100644
--- a/components/compat/compatcomponent.cpp
+++ b/components/compat/compatcomponent.cpp
@@ -624,7 +624,7 @@ void CompatComponent::DumpServiceObject(std::ostream& fp, const Service::Ptr& se
 
 void CompatComponent::DumpCustomAttributes(std::ostream& fp, const DynamicObject::Ptr& object)
 {
-	Dictionary::Ptr custom = object->Get("custom");
+	Dictionary::Ptr custom = object->GetCustom();
 
 	if (!custom)
 		return;
diff --git a/lib/base/dynamicobject.cpp b/lib/base/dynamicobject.cpp
index ed38d13..6482a8b 100644
--- a/lib/base/dynamicobject.cpp
+++ b/lib/base/dynamicobject.cpp
@@ -56,6 +56,7 @@ DynamicObject::DynamicObject(const Dictionary::Ptr& serializedObject)
 	RegisterAttribute("__local", Attribute_Config, &m_Local);
 	RegisterAttribute("__source", Attribute_Local, &m_Source);
 	RegisterAttribute("methods", Attribute_Config, &m_Methods);
+	RegisterAttribute("custom", Attribute_Config, &m_Custom);
 
 	if (!serializedObject->Contains("configTx"))
 		BOOST_THROW_EXCEPTION(std::invalid_argument("Serialized object must contain a config snapshot."));
@@ -616,3 +617,8 @@ const DynamicObject::AttributeMap& DynamicObject::GetAttributes(void) const
 
 	return m_Attributes;
 }
+
+Dictionary::Ptr DynamicObject::GetCustom(void) const
+{
+	return m_Custom;
+}
diff --git a/lib/base/dynamicobject.h b/lib/base/dynamicobject.h
index 1308ab0..2b3e452 100644
--- a/lib/base/dynamicobject.h
+++ b/lib/base/dynamicobject.h
@@ -101,6 +101,8 @@ public:
 
 	static double GetCurrentTx(void);
 
+	Dictionary::Ptr GetCustom(void) const;
+
 protected:
 	explicit DynamicObject(const Dictionary::Ptr& serializedObject);
 
@@ -125,6 +127,7 @@ private:
 	Attribute<bool> m_Local;
 	Attribute<String> m_Source;
 	Attribute<Dictionary::Ptr> m_Methods;
+	Attribute<Dictionary::Ptr> m_Custom;
 
 	bool m_Registered;	/**< protected by the type mutex */
 
diff --git a/lib/icinga/host.cpp b/lib/icinga/host.cpp
index 8ca6738..d41de55 100644
--- a/lib/icinga/host.cpp
+++ b/lib/icinga/host.cpp
@@ -51,7 +51,6 @@ Host::Host(const Dictionary::Ptr& serializedUpdate)
 	RegisterAttribute("display_name", Attribute_Config, &m_DisplayName);
 	RegisterAttribute("hostgroups", Attribute_Config, &m_HostGroups);
 	RegisterAttribute("macros", Attribute_Config, &m_Macros);
-	RegisterAttribute("custom", Attribute_Config, &m_Custom);
 	RegisterAttribute("hostdependencies", Attribute_Config, &m_HostDependencies);
 	RegisterAttribute("servicedependencies", Attribute_Config, &m_ServiceDependencies);
 	RegisterAttribute("hostcheck", Attribute_Config, &m_HostCheck);
@@ -105,11 +104,6 @@ Dictionary::Ptr Host::GetMacros(void) const
 	return m_Macros;
 }
 
-Dictionary::Ptr Host::GetCustom(void) const
-{
-	return m_Custom;
-}
-
 Array::Ptr Host::GetHostDependencies(void) const
 {
 	return m_HostDependencies;;
diff --git a/lib/icinga/host.h b/lib/icinga/host.h
index 954380e..85b6469 100644
--- a/lib/icinga/host.h
+++ b/lib/icinga/host.h
@@ -88,7 +88,6 @@ public:
 	Array::Ptr GetGroups(void) const;
 
 	Dictionary::Ptr GetMacros(void) const;
-	Dictionary::Ptr GetCustom(void) const;
 	Array::Ptr GetHostDependencies(void) const;
 	Array::Ptr GetServiceDependencies(void) const;
 	String GetHostCheck(void) const;
@@ -128,7 +127,6 @@ private:
 	Attribute<String> m_DisplayName;
 	Attribute<Array::Ptr> m_HostGroups;
 	Attribute<Dictionary::Ptr> m_Macros;
-	Attribute<Dictionary::Ptr> m_Custom;
 	Attribute<Array::Ptr> m_HostDependencies;
 	Attribute<Array::Ptr> m_ServiceDependencies;
 	Attribute<String> m_HostCheck;
diff --git a/lib/icinga/service.cpp b/lib/icinga/service.cpp
index f70e29a..495e52d 100644
--- a/lib/icinga/service.cpp
+++ b/lib/icinga/service.cpp
@@ -44,7 +44,6 @@ Service::Service(const Dictionary::Ptr& serializedObject)
 
 	RegisterAttribute("display_name", Attribute_Config, &m_DisplayName);
 	RegisterAttribute("macros", Attribute_Config, &m_Macros);
-	RegisterAttribute("custom", Attribute_Config, &m_Custom);
 	RegisterAttribute("hostdependencies", Attribute_Config, &m_HostDependencies);
 	RegisterAttribute("servicedependencies", Attribute_Config, &m_ServiceDependencies);
 	RegisterAttribute("servicegroups", Attribute_Config, &m_ServiceGroups);
@@ -167,11 +166,6 @@ Dictionary::Ptr Service::GetMacros(void) const
 	return m_Macros;
 }
 
-Dictionary::Ptr Service::GetCustom(void) const
-{
-	return m_Custom;
-}
-
 Array::Ptr Service::GetHostDependencies(void) const
 {
 	return m_HostDependencies;
diff --git a/lib/icinga/service.h b/lib/icinga/service.h
index 1535947..9da59e9 100644
--- a/lib/icinga/service.h
+++ b/lib/icinga/service.h
@@ -112,7 +112,6 @@ public:
 	String GetDisplayName(void) const;
 	Host::Ptr GetHost(void) const;
 	Dictionary::Ptr GetMacros(void) const;
-	Dictionary::Ptr GetCustom(void) const;
 	Array::Ptr GetHostDependencies(void) const;
 	Array::Ptr GetServiceDependencies(void) const;
 	Array::Ptr GetGroups(void) const;
@@ -311,7 +310,6 @@ private:
 
 	Attribute<String> m_DisplayName;
 	Attribute<Dictionary::Ptr> m_Macros;
-	Attribute<Dictionary::Ptr> m_Custom;
 	Attribute<Array::Ptr> m_HostDependencies;
 	Attribute<Array::Ptr> m_ServiceDependencies;
 	Attribute<Array::Ptr> m_ServiceGroups;





More information about the icinga-checkins mailing list