void DynamicObject::Deserialize(const Dictionary::Ptr& update, int attributeTypes)
{
ASSERT(!OwnsLock());
- ObjectLock olock(this);
- InternalDeserialize(update, attributeTypes);
+ {
+ ObjectLock olock(this);
+ InternalDeserialize(update, attributeTypes);
+ }
+
+ if (attributeTypes & Attribute_Config)
+ OnConfigLoaded();
+
+ if (attributeTypes & Attribute_State)
+ OnStateLoaded();
}
void DynamicObject::InternalSerialize(const Dictionary::Ptr& bag, int attributeTypes) const
OnStopped(GetSelf());
}
+void DynamicObject::OnConfigLoaded(void)
+{
+ /* Nothing to do here. */
+}
+
+void DynamicObject::OnStateLoaded(void)
+{
+ /* Nothing to do here. */
+}
+
Value DynamicObject::InvokeMethod(const String& method,
const std::vector<Value>& arguments)
{
virtual void InternalSerialize(const Dictionary::Ptr& bag, int attributeTypes) const;
virtual void InternalDeserialize(const Dictionary::Ptr& bag, int attributeTypes);
+ virtual void OnConfigLoaded(void);
+ virtual void OnStateLoaded(void);
+
private:
String m_Name;
String m_Type;
hg->AddMember(GetSelf());
}
}
+}
+void Host::OnConfigLoaded(void)
+{
UpdateSlaveServices();
}
virtual void Start(void);
virtual void Stop(void);
+ virtual void OnConfigLoaded(void);
+
virtual void InternalSerialize(const Dictionary::Ptr& bag, int attributeTypes) const;
virtual void InternalDeserialize(const Dictionary::Ptr& bag, int attributeTypes);
SetSchedulingOffset(rand());
UpdateNextCheck();
+ AddDowntimesToCache();
+ AddCommentsToCache();
+}
+
+void Service::OnConfigLoaded(void)
+{
Array::Ptr groups = GetGroups();
if (groups) {
}
}
- AddDowntimesToCache();
- AddCommentsToCache();
-
Host::Ptr host = GetHost();
if (host)
host->AddService(GetSelf());
+
+ UpdateSlaveNotifications();
}
String Service::GetDisplayName(void) const
protected:
virtual void Start(void);
+ virtual void OnConfigLoaded(void);
+
virtual void InternalSerialize(const Dictionary::Ptr& bag, int attributeTypes) const;
virtual void InternalDeserialize(const Dictionary::Ptr& bag, int attributeTypes);
REGISTER_TYPE(User);
-void User::Start(void)
+void User::OnConfigLoaded(void)
{
- DynamicObject::Start();
-
Array::Ptr groups = GetGroups();
if (groups) {
virtual bool ResolveMacro(const String& macro, const Dictionary::Ptr& cr, String *result) const;
protected:
- virtual void Start(void);
virtual void Stop(void);
+ virtual void OnConfigLoaded(void);
+
virtual void InternalSerialize(const Dictionary::Ptr& bag, int attributeTypes) const;
virtual void InternalDeserialize(const Dictionary::Ptr& bag, int attributeTypes);