| 596 | } |
| 597 | |
| 598 | bool ConfigItem::CommitItems(const ActivationContext::Ptr& context, WorkQueue& upq, std::vector<ConfigItem::Ptr>& newItems, bool silent) |
| 599 | { |
| 600 | if (!silent) |
| 601 | Log(LogInformation, "ConfigItem", "Committing config item(s)."); |
| 602 | |
| 603 | if (!CommitNewItems(context, upq, newItems)) { |
| 604 | upq.ReportExceptions("config"); |
| 605 | |
| 606 | for (const ConfigItem::Ptr& item : newItems) { |
| 607 | item->Unregister(); |
| 608 | } |
| 609 | |
| 610 | return false; |
| 611 | } |
| 612 | |
| 613 | ApplyRule::CheckMatches(silent); |
| 614 | |
| 615 | if (!silent) { |
| 616 | /* log stats for external parsers */ |
| 617 | typedef std::map<Type::Ptr, int> ItemCountMap; |
| 618 | ItemCountMap itemCounts; |
| 619 | for (const ConfigItem::Ptr& item : newItems) { |
| 620 | if (!item->m_Object) |
| 621 | continue; |
| 622 | |
| 623 | itemCounts[item->m_Object->GetReflectionType()]++; |
| 624 | } |
| 625 | |
| 626 | for (const ItemCountMap::value_type& kv : itemCounts) { |
| 627 | Log(LogInformation, "ConfigItem") |
| 628 | << "Instantiated " << kv.second << " " << (kv.second != 1 ? kv.first->GetPluralName() : kv.first->GetName()) << "."; |
| 629 | } |
| 630 | } |
| 631 | |
| 632 | return true; |
| 633 | } |
| 634 | |
| 635 | /** |
| 636 | * ActivateItems activates new config items. |
nothing calls this directly
no test coverage detected