2014-10-17 19:44:31 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* Icinga 2 *
|
2017-01-10 15:54:22 +01:00
|
|
|
* Copyright (C) 2012-2017 Icinga Development Team (https://www.icinga.com/) *
|
2014-10-17 19:44:31 +02:00
|
|
|
* *
|
|
|
|
* 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. *
|
|
|
|
******************************************************************************/
|
|
|
|
|
2015-03-28 11:04:42 +01:00
|
|
|
#include "base/debuginfo.hpp"
|
2016-08-16 11:02:10 +02:00
|
|
|
#include "base/configtype.hpp"
|
2015-03-28 11:04:42 +01:00
|
|
|
|
2015-08-04 14:47:44 +02:00
|
|
|
library base;
|
|
|
|
|
2013-10-26 09:41:45 +02:00
|
|
|
namespace icinga
|
|
|
|
{
|
|
|
|
|
2014-04-05 22:17:20 +02:00
|
|
|
code {{{
|
2014-08-13 20:30:28 +02:00
|
|
|
enum HAMode
|
|
|
|
{
|
|
|
|
HARunOnce,
|
|
|
|
HARunEverywhere
|
|
|
|
};
|
|
|
|
|
2016-08-09 09:00:19 +02:00
|
|
|
class I2_BASE_API NameComposer
|
|
|
|
{
|
2014-04-05 22:17:20 +02:00
|
|
|
public:
|
2016-08-09 09:00:19 +02:00
|
|
|
virtual ~NameComposer(void);
|
|
|
|
|
2014-11-06 19:35:47 +01:00
|
|
|
virtual String MakeName(const String& shortName, const Object::Ptr& context) const = 0;
|
2015-08-13 09:02:52 +02:00
|
|
|
virtual Dictionary::Ptr ParseName(const String& name) const = 0;
|
2014-04-05 22:17:20 +02:00
|
|
|
};
|
|
|
|
}}}
|
|
|
|
|
2015-08-15 20:28:05 +02:00
|
|
|
abstract class ConfigObjectBase
|
2014-11-30 23:32:13 +01:00
|
|
|
{ };
|
|
|
|
|
|
|
|
code {{{
|
2015-08-15 20:28:05 +02:00
|
|
|
class I2_BASE_API ConfigObjectBase : public ObjectImpl<ConfigObjectBase>
|
2014-11-30 23:32:13 +01:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
inline DebugInfo GetDebugInfo(void) const
|
|
|
|
{
|
|
|
|
return m_DebugInfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetDebugInfo(const DebugInfo& di)
|
|
|
|
{
|
|
|
|
m_DebugInfo = di;
|
|
|
|
}
|
|
|
|
|
2016-08-24 19:59:13 +02:00
|
|
|
inline virtual void Start(bool /* runtimeCreated */)
|
2015-08-25 13:53:43 +02:00
|
|
|
{ }
|
|
|
|
|
2016-08-24 19:59:13 +02:00
|
|
|
inline virtual void Stop(bool /* runtimeRemoved */)
|
2015-08-25 13:53:43 +02:00
|
|
|
{ }
|
|
|
|
|
2014-11-30 23:32:13 +01:00
|
|
|
private:
|
|
|
|
DebugInfo m_DebugInfo;
|
|
|
|
};
|
2016-08-16 11:02:10 +02:00
|
|
|
|
2014-11-30 23:32:13 +01:00
|
|
|
}}}
|
|
|
|
|
2016-08-16 11:02:10 +02:00
|
|
|
abstract class ConfigObject : ConfigObjectBase < ConfigType
|
2013-10-26 09:41:45 +02:00
|
|
|
{
|
2015-10-20 08:20:35 +02:00
|
|
|
[config, no_user_modify] String __name (Name);
|
|
|
|
[config, no_user_modify] String "name" (ShortName) {
|
2014-04-05 09:15:40 +02:00
|
|
|
get {{{
|
|
|
|
if (m_ShortName.IsEmpty())
|
|
|
|
return GetName();
|
|
|
|
else
|
|
|
|
return m_ShortName;
|
|
|
|
}}}
|
|
|
|
};
|
2017-04-12 09:25:28 +02:00
|
|
|
[config, no_user_modify] name(Zone) zone (ZoneName);
|
2015-10-20 08:20:35 +02:00
|
|
|
[config, no_user_modify] String package;
|
|
|
|
[config, get_protected, no_user_modify] Array::Ptr templates;
|
2017-04-19 15:30:11 +02:00
|
|
|
[config, no_storage, no_user_modify] Dictionary::Ptr source_location {
|
|
|
|
get;
|
|
|
|
};
|
2015-10-20 08:20:35 +02:00
|
|
|
[get_protected, no_user_modify] bool active;
|
|
|
|
[get_protected, no_user_modify] bool paused {
|
2014-05-09 13:02:30 +02:00
|
|
|
default {{{ return true; }}}
|
|
|
|
};
|
2015-10-20 08:20:35 +02:00
|
|
|
[get_protected, no_user_view, no_user_modify] bool start_called;
|
|
|
|
[get_protected, no_user_view, no_user_modify] bool stop_called;
|
|
|
|
[get_protected, no_user_view, no_user_modify] bool pause_called;
|
|
|
|
[get_protected, no_user_view, no_user_modify] bool resume_called;
|
2014-08-13 20:30:28 +02:00
|
|
|
[enum] HAMode ha_mode (HAMode);
|
2015-10-20 08:20:35 +02:00
|
|
|
[protected, no_user_view, no_user_modify] Dictionary::Ptr extensions;
|
2014-04-15 17:33:56 +02:00
|
|
|
|
2015-10-20 08:20:35 +02:00
|
|
|
[protected, no_user_view, no_user_modify] bool state_loaded;
|
|
|
|
[no_user_modify] Dictionary::Ptr original_attributes;
|
|
|
|
[state, no_user_modify] double version {
|
2015-09-30 16:58:18 +02:00
|
|
|
default {{{ return 0; }}}
|
2015-08-20 16:43:03 +02:00
|
|
|
};
|
2013-10-26 09:41:45 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|