void DynamicObject::OnAttributeChanged(const String&, const Value&)
{ }
-void DynamicObject::OnInitCompleted(void)
-{ }
-
DynamicObject::Ptr DynamicObject::GetObject(const String& type, const String& name)
{
DynamicType::Ptr dtype = DynamicType::GetByName(type);
protected:
virtual void OnAttributeChanged(const String& name, const Value& oldValue);
- virtual void OnInitCompleted(void);
private:
void InternalSetAttribute(const String& name, const Value& data, double tx, bool allowEditConfig = false);
/* This has to be a set of raw pointers because the DynamicObject
* constructor has to be able to insert objects into this list. */
static set<DynamicObject *> m_ModifiedObjects;
-
- friend class DynamicType; /* for OnInitCompleted */
};
}
/* apply the object's non-config attributes */
obj->ApplyUpdate(serializedUpdate, Attribute_All & ~Attribute_Config);
- /* notify the object that it's "ready" */
- obj->OnInitCompleted();
-
return obj;
}
REGISTER_SCRIPTFUNCTION("native::ValidateServiceDictionary", &Host::ValidateServiceDictionary);
static AttributeDescription hostAttributes[] = {
- { "convenience_services", Attribute_Transient }
+ { "slave_services", Attribute_Transient }
};
REGISTER_TYPE(Host, hostAttributes);
: DynamicObject(properties)
{ }
-void Host::OnInitCompleted(void)
-{
- HostGroup::InvalidateMembersCache();
-
- UpdateSlaveServices();
-}
-
Host::~Host(void)
{
HostGroup::InvalidateMembersCache();
- Dictionary::Ptr services = Get("convenience_services");
+ Dictionary::Ptr services = Get("slave_services");
if (services) {
ConfigItem::Ptr service;
typedef weak_ptr<Host> WeakPtr;
Host(const Dictionary::Ptr& properties);
- void OnInitCompleted(void);
~Host(void);
static bool Exists(const String& name);
REGISTER_TYPE(HostGroup, NULL);
+HostGroup::HostGroup(const Dictionary::Ptr& properties)
+ : DynamicObject(properties)
+{ }
+
String HostGroup::GetDisplayName(void) const
{
String value = Get("alias");
m_MembersCacheValid = true;
}
-
typedef shared_ptr<HostGroup> Ptr;
typedef weak_ptr<HostGroup> WeakPtr;
- HostGroup(const Dictionary::Ptr& properties)
- : DynamicObject(properties)
- { }
+ HostGroup(const Dictionary::Ptr& properties);;
static bool Exists(const String& name);
static HostGroup::Ptr GetByName(const String& name);
Logger::Write(LogWarning, "icinga", message);
}
}
+
+void Notification::OnAttributeChanged(const String& name, const Value& oldValue)
+{
+ if (name == "host_name" || name == "service")
+ Service::InvalidateNotificationsCache();
+}
void SendNotification(NotificationType type);
+protected:
+ void OnAttributeChanged(const String& name, const Value& oldValue);
+
private:
set<ScriptTask::Ptr> m_Tasks;
Service::Service(const Dictionary::Ptr& serializedObject)
: DynamicObject(serializedObject)
-{
- ServiceGroup::InvalidateMembersCache();
- Host::InvalidateServicesCache();
- Service::InvalidateDowntimeCache();
- Service::InvalidateCommentCache();
-}
+{ }
Service::~Service(void)
{
REGISTER_TYPE(ServiceGroup, NULL);
+ServiceGroup::ServiceGroup(const Dictionary::Ptr& properties)
+ : DynamicObject(properties)
+{ }
+
String ServiceGroup::GetDisplayName(void) const
{
String value = Get("alias");
m_MembersCacheValid = true;
}
-
typedef shared_ptr<ServiceGroup> Ptr;
typedef weak_ptr<ServiceGroup> WeakPtr;
- ServiceGroup(const Dictionary::Ptr& properties)
- : DynamicObject(properties)
- { }
+ ServiceGroup(const Dictionary::Ptr& properties);
static bool Exists(const String& name);
static ServiceGroup::Ptr GetByName(const String& name);