return m_ExpressionList;
}
-void ConfigItem::Link(void)
+ExpressionList::Ptr ConfigItem::GetLinkedExpressionList(void)
{
ASSERT(OwnsLock());
if (m_LinkedExpressionList)
- return;
+ return m_LinkedExpressionList;
m_LinkedExpressionList = make_shared<ExpressionList>();
" exist (" << m_DebugInfo << ")";
ConfigCompilerContext::GetInstance()->AddMessage(true, message.str());
} else {
- parent->Link();
+ ExpressionList::Ptr pexprl;
+
+ {
+ ObjectLock olock(parent);
+ pexprl = parent->GetLinkedExpressionList();
+ }
- ExpressionList::Ptr pexprl = parent->m_LinkedExpressionList;
m_LinkedExpressionList->AddExpression(Expression("", OperatorExecute, pexprl, m_DebugInfo));
}
}
m_LinkedExpressionList->AddExpression(Expression("", OperatorExecute, m_ExpressionList, m_DebugInfo));
-}
-
-ExpressionList::Ptr ConfigItem::GetLinkedExpressionList(void)
-{
- ASSERT(OwnsLock());
-
- if (!m_LinkedExpressionList)
- Link();
return m_LinkedExpressionList;
}
Dictionary::Ptr ConfigItem::GetProperties(void)
{
- ASSERT(!OwnsLock());
-
- ObjectLock olock(this);
+ ASSERT(OwnsLock());
if (!m_Properties) {
m_Properties = make_shared<Dictionary>();
if (IsAbstract())
return DynamicObject::Ptr();
- Dictionary::Ptr properties = GetProperties();
+ Dictionary::Ptr properties;
+
+ {
+ ObjectLock olock(this);
+
+ properties = GetProperties();
+ }
DynamicObject::Ptr dobj = dtype->CreateObject(properties);
dobj->Register();
static void DiscardItems(void);
private:
- void Link(void);
ExpressionList::Ptr GetExpressionList(void) const;
String m_Type; /**< The object type. */
if (item->IsAbstract())
return;
- Dictionary::Ptr attrs = item->GetProperties();
+ Dictionary::Ptr attrs;
+ DebugInfo debugInfo;
+ String type, name;
+
+ {
+ ObjectLock olock(item);
+
+ attrs = item->GetProperties();
+ debugInfo = item->GetDebugInfo();
+ type = item->GetType();
+ name = item->GetName();
+ }
std::vector<String> locations;
- DebugInfo debugInfo = item->GetDebugInfo();
- locations.push_back("Object '" + item->GetName() + "' (Type: '" + item->GetType() + "') at " + debugInfo.Path + ":" + Convert::ToString(debugInfo.FirstLine));
+ locations.push_back("Object '" + name + "' (Type: '" + type + "') at " + debugInfo.Path + ":" + Convert::ToString(debugInfo.FirstLine));
std::vector<TypeRuleList::Ptr> ruleLists;
AddParentRules(ruleLists, GetSelf());
path.push_back("services");
path.push_back(kv.first);
+ ExpressionList::Ptr exprl;
+
+ {
+ ObjectLock ilock(item);
+
+ exprl = item->GetLinkedExpressionList();
+ }
+
DebugInfo di;
- item->GetLinkedExpressionList()->FindDebugInfoPath(path, di);
+ exprl->FindDebugInfoPath(path, di);
if (di.Path.IsEmpty())
di = item->GetDebugInfo();
/* Clone attributes from the service expression list. */
ExpressionList::Ptr svc_exprl = make_shared<ExpressionList>();
- item->GetLinkedExpressionList()->ExtractPath(path, svc_exprl);
+ exprl->ExtractPath(path, svc_exprl);
builder->AddExpressionList(svc_exprl);
path.push_back("scheduled_downtimes");
path.push_back(kv.first);
+ ExpressionList::Ptr exprl;
+
+ {
+ ObjectLock ilock(item);
+
+ exprl = item->GetLinkedExpressionList();
+ }
+
DebugInfo di;
- item->GetLinkedExpressionList()->FindDebugInfoPath(path, di);
+ exprl->FindDebugInfoPath(path, di);
if (di.Path.IsEmpty())
di = item->GetDebugInfo();
/* Clone attributes from the scheduled downtime expression list. */
ExpressionList::Ptr sd_exprl = make_shared<ExpressionList>();
- item->GetLinkedExpressionList()->ExtractPath(path, sd_exprl);
+ exprl->ExtractPath(path, sd_exprl);
builder->AddExpressionList(sd_exprl);
path.push_back("notifications");
path.push_back(kv.first);
+ ExpressionList::Ptr exprl;
+
+ {
+ ObjectLock ilock(exprl);
+
+ exprl = item->GetLinkedExpressionList();
+ }
+
DebugInfo di;
- item->GetLinkedExpressionList()->FindDebugInfoPath(path, di);
+ exprl->FindDebugInfoPath(path, di);
if (di.Path.IsEmpty())
di = item->GetDebugInfo();
/* Clone attributes from the notification expression list. */
ExpressionList::Ptr nfc_exprl = make_shared<ExpressionList>();
- item->GetLinkedExpressionList()->ExtractPath(path, nfc_exprl);
+ exprl->ExtractPath(path, nfc_exprl);
builder->AddExpressionList(nfc_exprl);