Move the apply rule handler to the Service class.

Refs #5878
This commit is contained in:
Gunnar Beutner 2014-03-28 18:26:46 +01:00 committed by Gunnar Beutner
parent fa11e5a97e
commit adce8e95bc
4 changed files with 10 additions and 10 deletions

View File

@ -43,12 +43,12 @@ add_library(icinga SHARED
api.cpp api.h checkcommand.cpp checkcommand.th checkresult.cpp checkresult.th api.cpp api.h checkcommand.cpp checkcommand.th checkresult.cpp checkresult.th
cib.cpp command.cpp command.th comment.cpp comment.th compatutility.cpp dependency.cpp dependency.th cib.cpp command.cpp command.th comment.cpp comment.th compatutility.cpp dependency.cpp dependency.th
domain.cpp domain.th downtime.cpp downtime.th eventcommand.cpp eventcommand.th domain.cpp domain.th downtime.cpp downtime.th eventcommand.cpp eventcommand.th
externalcommandprocessor.cpp host.cpp host.th host-apply.cpp hostgroup.cpp hostgroup.th externalcommandprocessor.cpp host.cpp host.th hostgroup.cpp hostgroup.th
icingaapplication.cpp icingaapplication.th icingastatuswriter.cpp icingaapplication.cpp icingaapplication.th icingastatuswriter.cpp
icingastatuswriter.th legacytimeperiod.cpp icingastatuswriter.th legacytimeperiod.cpp
macroprocessor.cpp macroresolver.cpp notificationcommand.cpp notificationcommand.th macroprocessor.cpp macroresolver.cpp notificationcommand.cpp notificationcommand.th
notification.cpp notification.th perfdatavalue.cpp perfdatavalue.th notification.cpp notification.th perfdatavalue.cpp perfdatavalue.th
pluginutility.cpp scheduleddowntime.cpp scheduleddowntime.th service-check.cpp pluginutility.cpp scheduleddowntime.cpp scheduleddowntime.th service-apply.cpp service-check.cpp
service-comment.cpp service.cpp service-dependency.cpp service-downtime.cpp service-event.cpp service-comment.cpp service.cpp service-dependency.cpp service-downtime.cpp service-event.cpp
service-flapping.cpp service.th servicegroup.cpp servicegroup.th service-flapping.cpp service.th servicegroup.cpp servicegroup.th
service-notification.cpp timeperiod.cpp timeperiod.th user.cpp user.th service-notification.cpp timeperiod.cpp timeperiod.th user.cpp user.th

View File

@ -102,9 +102,6 @@ public:
virtual bool ResolveMacro(const String& macro, const CheckResult::Ptr& cr, String *result) const; virtual bool ResolveMacro(const String& macro, const CheckResult::Ptr& cr, String *result) const;
static void RegisterApplyRuleHandler(void);
static void EvaluateApplyRules(const std::vector<ApplyRule>& rules);
protected: protected:
virtual void Stop(void); virtual void Stop(void);

View File

@ -17,7 +17,7 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/ ******************************************************************************/
#include "icinga/host.h" #include "icinga/service.h"
#include "config/configitembuilder.h" #include "config/configitembuilder.h"
#include "base/initialize.h" #include "base/initialize.h"
#include "base/dynamictype.h" #include "base/dynamictype.h"
@ -28,14 +28,14 @@
using namespace icinga; using namespace icinga;
INITIALIZE_ONCE(&Host::RegisterApplyRuleHandler); INITIALIZE_ONCE(&Service::RegisterApplyRuleHandler);
void Host::RegisterApplyRuleHandler(void) void Service::RegisterApplyRuleHandler(void)
{ {
ApplyRule::RegisterType("Service", &Host::EvaluateApplyRules, 1); ApplyRule::RegisterType("Service", &Service::EvaluateApplyRules, 1);
} }
void Host::EvaluateApplyRules(const std::vector<ApplyRule>& rules) void Service::EvaluateApplyRules(const std::vector<ApplyRule>& rules)
{ {
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects<Host>()) { BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects<Host>()) {
CONTEXT("Evaluating 'apply' rules for Host '" + host->GetName() + "'"); CONTEXT("Evaluating 'apply' rules for Host '" + host->GetName() + "'");

View File

@ -280,6 +280,9 @@ public:
void RemoveReverseDependency(const shared_ptr<Dependency>& dep); void RemoveReverseDependency(const shared_ptr<Dependency>& dep);
std::set<shared_ptr<Dependency> > GetReverseDependencies(void) const; std::set<shared_ptr<Dependency> > GetReverseDependencies(void) const;
static void RegisterApplyRuleHandler(void);
static void EvaluateApplyRules(const std::vector<ApplyRule>& rules);
protected: protected:
virtual void Start(void); virtual void Start(void);