]> granicus.if.org Git - icinga2/commitdiff
Removed obsolete timeperiod code.
authorGunnar Beutner <gunnar.beutner@netways.de>
Wed, 6 Feb 2013 11:55:20 +0000 (12:55 +0100)
committerGunnar Beutner <gunnar.beutner@netways.de>
Wed, 6 Feb 2013 11:59:56 +0000 (12:59 +0100)
lib/base/dynamicobject.h
lib/icinga/Makefile.am
lib/icinga/i2-icinga.h
lib/icinga/icinga.vcxproj
lib/icinga/timeperiod.cpp [deleted file]
lib/icinga/timeperiod.h [deleted file]

index e99841fd65e16d4cd0766754f606b450e52a0896..3f9a8246a404dba62d86a2f575337308ed914e9d 100644 (file)
@@ -97,20 +97,6 @@ public:
        static boost::signal<void (const DynamicObject::Ptr&)> OnUnregistered;
        static boost::signal<void (const set<DynamicObject::Ptr>&)> OnTransactionClosing;
 
-       /**
-        * Synchronously invokes a method. The method must not return before it's finished.
-        *
-        * @param method The name of the method.
-        * @param arguments Arguments for the method.
-        */
-       template<typename T>
-       T InvokeMethodSync(const String& method, const vector<Value>& arguments)
-       {
-               ScriptTask::Ptr task = InvokeMethod(method, arguments, ScriptTask::CompletionCallback());
-               assert(task->IsFinished());
-               return task->GetResult();
-       }
-
        ScriptTask::Ptr InvokeMethod(const String& method,
            const vector<Value>& arguments, ScriptTask::CompletionCallback callback);
 
index 3ffcb01430b2e42ee92f55a6d1132dab2c79e7f9..20c3a3a4c5695a833391c16d456ec5d200dee0dc 100644 (file)
@@ -32,9 +32,7 @@ libicinga_la_SOURCES =  \
        service.cpp \
        servicegroup.cpp \
        servicegroup.h \
-       service.h \
-       timeperiod.cpp \
-       timeperiod.h
+       service.h
 
 libicinga_la_CPPFLAGS = \
        -DI2_ICINGA_BUILD \
index c9a55652eb65d4c7c121ba3acc6e1b951bfd7c1a..cb40679ce2ac299872691092ac737fdbcf85ea0b 100644 (file)
@@ -46,8 +46,6 @@ using boost::algorithm::is_any_of;
 #include "endpointmanager.h"
 #include "icingaapplication.h"
 
-#include "timeperiod.h"
-
 #include "acknowledgement.h"
 #include "downtimeprocessor.h"
 #include "commentprocessor.h"
index b5575f9ca84ea6566295243adfe93e1a425fb97b..ca28caf60981b45548c56da5b3c2698ee48e14ed 100644 (file)
@@ -38,7 +38,6 @@
     <ClCompile Include="nullchecktask.cpp" />
     <ClCompile Include="service.cpp" />
     <ClCompile Include="servicegroup.cpp" />
-    <ClCompile Include="timeperiod.cpp" />
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="acknowledgement.h" />
@@ -56,7 +55,6 @@
     <ClInclude Include="nullchecktask.h" />
     <ClInclude Include="service.h" />
     <ClInclude Include="servicegroup.h" />
-    <ClInclude Include="timeperiod.h" />
   </ItemGroup>
   <PropertyGroup Label="Globals">
     <ProjectGuid>{C1FC77E1-04A4-481B-A78B-2F7AF489C2F8}</ProjectGuid>
diff --git a/lib/icinga/timeperiod.cpp b/lib/icinga/timeperiod.cpp
deleted file mode 100644 (file)
index c68c67c..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/******************************************************************************
- * Icinga 2                                                                   *
- * Copyright (C) 2012 Icinga Development Team (http://www.icinga.org/)        *
- *                                                                            *
- * This program is free software; you can redistribute it and/or              *
- * modify it under the terms of the GNU General Public License                *
- * as published by the Free Software Foundation; either version 2             *
- * of the License, or (at your option) any later version.                     *
- *                                                                            *
- * This program is distributed in the hope that it will be useful,            *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
- * GNU General Public License for more details.                               *
- *                                                                            *
- * You should have received a copy of the GNU General Public License          *
- * along with this program; if not, write to the Free Software Foundation     *
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
- ******************************************************************************/
-
-#include "i2-icinga.h"
-
-using namespace icinga;
-
-static AttributeDescription timePeriodAttributes[] = {
-       { "cached_state", Attribute_Transient },
-       { "cached_next_change", Attribute_Transient }
-};
-
-REGISTER_TYPE(TimePeriod, timePeriodAttributes);
-
-String TimePeriod::GetAlias(void) const
-{
-       String value = Get("alias");
-
-       if (!value.IsEmpty())
-               return value;
-       else
-               return GetName();
-}
-
-bool TimePeriod::Exists(const String& name)
-{
-       return (DynamicObject::GetObject("TimePeriod", name));
-}
-
-TimePeriod::Ptr TimePeriod::GetByName(const String& name)
-{
-       DynamicObject::Ptr configObject = DynamicObject::GetObject("TimePeriod", name);
-
-       if (!configObject)
-               BOOST_THROW_EXCEPTION(invalid_argument("TimePeriod '" + name + "' does not exist."));
-
-       return dynamic_pointer_cast<TimePeriod>(configObject);
-}
-
-bool TimePeriod::IsActive(void) {
-       if (GetNextChange() > Utility::GetTime()) {
-               vector<Value> args;
-               args.push_back(static_cast<TimePeriod::Ptr>(GetSelf()));
-               return InvokeMethodSync<bool>("is_active", args);
-       } else {
-               return Get("cached_state");
-       }
-}
-
-double TimePeriod::GetNextChange(void) {
-       double next_change = Get("cached_next_change");
-
-       if (next_change < Utility::GetTime()) {
-               vector<Value> args;
-               args.push_back(static_cast<TimePeriod::Ptr>(GetSelf()));
-               next_change = InvokeMethodSync<bool>("is_active", args);
-               // TODO: figure out next_change by calling method
-
-               Set("cached_next_change", next_change);
-       }
-
-       return next_change;
-}
diff --git a/lib/icinga/timeperiod.h b/lib/icinga/timeperiod.h
deleted file mode 100644 (file)
index 481e794..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/******************************************************************************
- * Icinga 2                                                                   *
- * Copyright (C) 2012 Icinga Development Team (http://www.icinga.org/)        *
- *                                                                            *
- * This program is free software; you can redistribute it and/or              *
- * modify it under the terms of the GNU General Public License                *
- * as published by the Free Software Foundation; either version 2             *
- * of the License, or (at your option) any later version.                     *
- *                                                                            *
- * This program is distributed in the hope that it will be useful,            *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
- * GNU General Public License for more details.                               *
- *                                                                            *
- * You should have received a copy of the GNU General Public License          *
- * along with this program; if not, write to the Free Software Foundation     *
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
- ******************************************************************************/
-
-#ifndef TIMEPERIOD_H
-#define TIMEPERIOD_H
-
-namespace icinga
-{
-       
-class I2_ICINGA_API TimePeriod : public DynamicObject {
-public:
-       typedef shared_ptr<TimePeriod> Ptr;
-       typedef weak_ptr<TimePeriod> WeakPtr;
-
-       TimePeriod(const Dictionary::Ptr& properties)
-               : DynamicObject(properties)
-       { }
-
-       static bool Exists(const String& name);
-       static TimePeriod::Ptr GetByName(const String& name);
-
-       String GetAlias(void) const;
-
-       bool IsActive(void);
-       double GetNextChange(void);
-};
-
-}
-
-#endif /* TIMEPERIOD_H */