Rename __name and __type properties.

Refs #5870
This commit is contained in:
Gunnar Beutner 2014-03-28 13:52:29 +01:00
parent 7ee1278118
commit 54063f0b9f
20 changed files with 232 additions and 232 deletions

View File

@ -17,5 +17,5 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
type CheckerComponent {
%type CheckerComponent {
}

View File

@ -17,22 +17,22 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
type ClusterListener {
%attribute string "cert_path",
%type ClusterListener {
%attribute %string "cert_path",
%require "cert_path",
%attribute string "key_path",
%attribute %string "key_path",
%require "key_path",
%attribute string "ca_path",
%attribute %string "ca_path",
%require "ca_path",
%attribute string "crl_path",
%attribute %string "crl_path",
%attribute string "bind_host",
%attribute string "bind_port",
%attribute %string "bind_host",
%attribute %string "bind_port",
%attribute array "peers" {
%attribute %array "peers" {
%attribute name(Endpoint) "*"
}
}

View File

@ -17,23 +17,23 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
type StatusDataWriter {
%attribute string "status_path",
%attribute string "objects_path",
%attribute number "update_interval"
%type StatusDataWriter {
%attribute %string "status_path",
%attribute %string "objects_path",
%attribute %number "update_interval"
}
type ExternalCommandListener {
%attribute string "command_path"
%type ExternalCommandListener {
%attribute %string "command_path"
}
type CompatLogger {
%type CompatLogger {
%validator "ValidateRotationMethod",
%attribute string "log_dir",
%attribute string "rotation_method"
%attribute %string "log_dir",
%attribute %string "rotation_method"
}
type CheckResultReader {
%attribute string "spool_dir"
%type CheckResultReader {
%attribute %string "spool_dir"
}

View File

@ -17,15 +17,15 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
type IdoMysqlConnection inherits DbConnection {
%attribute string "host",
%attribute number "port",
%type IdoMysqlConnection %inherits DbConnection {
%attribute %string "host",
%attribute %number "port",
%attribute string "user",
%attribute string "password",
%attribute %string "user",
%attribute %string "password",
%attribute string "database",
%attribute %string "database",
%attribute string "instance_name",
%attribute string "instance_description"
%attribute %string "instance_name",
%attribute %string "instance_description"
}

View File

@ -17,15 +17,15 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
type IdoPgsqlConnection inherits DbConnection {
%attribute string "host",
%attribute number "port",
%type IdoPgsqlConnection %inherits DbConnection {
%attribute %string "host",
%attribute %number "port",
%attribute string "user",
%attribute string "password",
%attribute %string "user",
%attribute %string "password",
%attribute string "database",
%attribute %string "database",
%attribute string "instance_name",
%attribute string "instance_description"
%attribute %string "instance_name",
%attribute %string "instance_description"
}

View File

@ -17,5 +17,5 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
type Demo {
%type Demo {
}

View File

@ -17,14 +17,14 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
type LivestatusListener {
%type LivestatusListener {
%validator "ValidateSocketType",
%attribute string "socket_type",
%attribute %string "socket_type",
%attribute string "socket_path",
%attribute string "bind_host",
%attribute string "bind_port",
%attribute %string "socket_path",
%attribute %string "bind_host",
%attribute %string "bind_port",
%attribute string "compat_log_path",
%attribute %string "compat_log_path",
}

View File

@ -17,5 +17,5 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
type NotificationComponent {
%type NotificationComponent {
}

View File

@ -17,13 +17,13 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
type PerfdataWriter {
%attribute string "perfdata_path",
%attribute string "format_template",
%attribute number "rotation_interval"
%type PerfdataWriter {
%attribute %string "perfdata_path",
%attribute %string "format_template",
%attribute %number "rotation_interval"
}
type GraphiteWriter {
%attribute string "host",
%attribute string "port",
%type GraphiteWriter {
%attribute %string "host",
%attribute %string "port",
}

View File

@ -3,8 +3,8 @@ namespace icinga
abstract class DynamicObject
{
[config] String __name (Name);
[config, get_protected] String __type (TypeName);
[config] String name (Name);
[config, get_protected] String type (TypeName);
[config] Dictionary::Ptr methods;
[config] Dictionary::Ptr custom;
[config] Array::Ptr domains;

View File

@ -113,7 +113,7 @@ static Object::Ptr SerializeObject(const Object::Ptr& input, int attributeTypes)
fields->Set(field.Name, Serialize(input->GetField(i), attributeTypes));
}
fields->Set("__type", type->GetName());
fields->Set("type", type->GetName());
return fields;
}
@ -151,7 +151,7 @@ static Object::Ptr DeserializeObject(const Object::Ptr& object, const Dictionary
if (object)
type = object->GetReflectionType();
else
type = Type::GetByName(input->Get("__type"));
type = Type::GetByName(input->Get("type"));
if (!type)
return object;
@ -230,7 +230,7 @@ Value icinga::Deserialize(const Object::Ptr& object, const Value& value, bool sa
ASSERT(dict != NULL);
if (!dict->Contains("__type"))
if (!dict->Contains("type"))
return DeserializeDictionary(dict, safe_mode, attributeTypes);
return DeserializeObject(object, dict, safe_mode, attributeTypes);

View File

@ -17,40 +17,40 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
type DynamicObject {
%require "__name",
%attribute string "__name",
%type DynamicObject {
%require "name",
%attribute %string "name",
%require "__type",
%attribute string "__type",
%require "type",
%attribute %string "type",
%attribute dictionary "methods",
%attribute %dictionary "methods",
%attribute dictionary "custom" {
%attribute string "*"
%attribute %dictionary "custom" {
%attribute %string "*"
},
%attribute array "domains" {
%attribute string "*"
%attribute %array "domains" {
%attribute %string "*"
}
}
type Logger {
%attribute string "severity"
%type Logger {
%attribute %string "severity"
}
type FileLogger inherits Logger {
%type FileLogger %inherits Logger {
%require "path",
%attribute string "path"
%attribute %string "path"
}
type SyslogLogger inherits Logger {
%type SyslogLogger %inherits Logger {
}
type Script {
%type Script {
%require "language",
%attribute string "language",
%attribute %string "language",
%require "code",
%attribute string "code"
%attribute %string "code"
}

View File

@ -197,23 +197,23 @@ static char *lb_steal(lex_buf *lb)
[ \t\r\n] /* ignore whitespace */
<INITIAL>{
type return T_TYPE;
dictionary { yylval->type = TypeDictionary; return T_TYPE_DICTIONARY; }
array { yylval->type = TypeArray; return T_TYPE_ARRAY; }
number { yylval->type = TypeNumber; return T_TYPE_NUMBER; }
string { yylval->type = TypeString; return T_TYPE_STRING; }
scalar { yylval->type = TypeScalar; return T_TYPE_SCALAR; }
any { yylval->type = TypeAny; return T_TYPE_ANY; }
name { yylval->type = TypeName; return T_TYPE_NAME; }
%type return T_TYPE;
%dictionary { yylval->type = TypeDictionary; return T_TYPE_DICTIONARY; }
%array { yylval->type = TypeArray; return T_TYPE_ARRAY; }
%number { yylval->type = TypeNumber; return T_TYPE_NUMBER; }
%string { yylval->type = TypeString; return T_TYPE_STRING; }
%scalar { yylval->type = TypeScalar; return T_TYPE_SCALAR; }
%any { yylval->type = TypeAny; return T_TYPE_ANY; }
%name { yylval->type = TypeName; return T_TYPE_NAME; }
%validator { return T_VALIDATOR; }
%require { return T_REQUIRE; }
%attribute { return T_ATTRIBUTE; }
%inherits return T_INHERITS;
object return T_OBJECT;
template return T_TEMPLATE;
include return T_INCLUDE;
include_recursive return T_INCLUDE_RECURSIVE;
library return T_LIBRARY;
inherits return T_INHERITS;
null return T_NULL;
partial return T_PARTIAL;
true { yylval->num = 1; return T_NUMBER; }

View File

@ -549,7 +549,7 @@ lterm: identifier lbinary_op rterm
}
| T_IMPORT rterm
{
AExpression::Ptr avar = make_shared<AExpression>(&AExpression::OpVariable, "__type", DebugInfoRange(@1, @2));
AExpression::Ptr avar = make_shared<AExpression>(&AExpression::OpVariable, "type", DebugInfoRange(@1, @2));
AExpression::Ptr aexpr = static_cast<AExpression::Ptr>(*$2);
delete $2;
$$ = new Value(make_shared<AExpression>(&AExpression::OpImport, avar, aexpr, DebugInfoRange(@1, @2)));

View File

@ -120,7 +120,7 @@ Dictionary::Ptr ConfigItem::GetProperties(void)
GetExpressionList()->Evaluate(m_Properties);
m_Properties->Remove("__parent");
VERIFY(m_Properties->Get("__type") == GetType() && m_Properties->Get("__name") == GetName());
VERIFY(m_Properties->Get("type") == GetType() && m_Properties->Get("name") == GetName());
}
return m_Properties;

View File

@ -86,9 +86,9 @@ ConfigItem::Ptr ConfigItemBuilder::Compile(void)
}
Array::Ptr exprs = make_shared<Array>();
exprs->Add(make_shared<AExpression>(&AExpression::OpSet, "__type", make_shared<AExpression>(&AExpression::OpLiteral, m_Type, m_DebugInfo), m_DebugInfo));
exprs->Add(make_shared<AExpression>(&AExpression::OpSet, "type", make_shared<AExpression>(&AExpression::OpLiteral, m_Type, m_DebugInfo), m_DebugInfo));
exprs->Add(make_shared<AExpression>(&AExpression::OpDict, m_Expressions, true, m_DebugInfo));
exprs->Add(make_shared<AExpression>(&AExpression::OpSet, "__name", make_shared<AExpression>(&AExpression::OpLiteral, m_Name, m_DebugInfo), m_DebugInfo));
exprs->Add(make_shared<AExpression>(&AExpression::OpSet, "name", make_shared<AExpression>(&AExpression::OpLiteral, m_Name, m_DebugInfo), m_DebugInfo));
AExpression::Ptr exprl = make_shared<AExpression>(&AExpression::OpDict, exprs, true, m_DebugInfo);

View File

@ -17,26 +17,26 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
type DbConnection {
%attribute string "table_prefix",
%type DbConnection {
%attribute %string "table_prefix",
%attribute dictionary "cleanup" {
%attribute number "acknowledgements_age",
%attribute number "commenthistory_age",
%attribute number "contactnotifications_age",
%attribute number "contactnotificationmethods_age",
%attribute number "downtimehistory_age",
%attribute number "eventhandlers_age",
%attribute number "externalcommands_age",
%attribute number "flappinghistory_age",
%attribute number "hostchecks_age",
%attribute number "logentries_age",
%attribute number "notifications_age",
%attribute number "processevents_age",
%attribute number "statehistory_age",
%attribute number "servicechecks_age",
%attribute number "systemcommands_age",
%attribute %dictionary "cleanup" {
%attribute %number "acknowledgements_age",
%attribute %number "commenthistory_age",
%attribute %number "contactnotifications_age",
%attribute %number "contactnotificationmethods_age",
%attribute %number "downtimehistory_age",
%attribute %number "eventhandlers_age",
%attribute %number "externalcommands_age",
%attribute %number "flappinghistory_age",
%attribute %number "hostchecks_age",
%attribute %number "logentries_age",
%attribute %number "notifications_age",
%attribute %number "processevents_age",
%attribute %number "statehistory_age",
%attribute %number "servicechecks_age",
%attribute %number "systemcommands_age",
},
%attribute number "categories"
%attribute %number "categories"
}

View File

@ -17,5 +17,5 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
type Hello {
%type Hello {
}

View File

@ -17,228 +17,228 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
type Host {
%attribute string "display_name",
%attribute string "check",
%attribute array "groups" {
%attribute name(HostGroup) "*"
%type Host {
%attribute %string "display_name",
%attribute %string "check",
%attribute %array "groups" {
%attribute %name(HostGroup) "*"
},
%attribute dictionary "macros" {
%attribute string "*"
%attribute %dictionary "macros" {
%attribute %string "*"
}
}
type HostGroup {
%attribute string "display_name"
%type HostGroup {
%attribute %string "display_name"
}
type IcingaApplication {
%type IcingaApplication {
}
type IcingaStatusWriter {
%attribute string "status_path",
%attribute number "update_interval"
%type IcingaStatusWriter {
%attribute %string "status_path",
%attribute %number "update_interval"
}
type Service {
%type Service {
%require "host",
%attribute name(Host) "host",
%attribute %name(Host) "host",
%attribute string "short_name",
%attribute %string "short_name",
%attribute string "display_name",
%attribute %string "display_name",
%attribute dictionary "macros" {
%attribute string "*"
%attribute %dictionary "macros" {
%attribute %string "*"
},
%require "check_command",
%attribute name(CheckCommand) "check_command",
%attribute number "max_check_attempts",
%attribute name(TimePeriod) "check_period",
%attribute number "check_interval",
%attribute number "retry_interval",
%attribute %name(CheckCommand) "check_command",
%attribute %number "max_check_attempts",
%attribute %name(TimePeriod) "check_period",
%attribute %number "check_interval",
%attribute %number "retry_interval",
%attribute number "enable_notifications",
%attribute number "enable_active_checks",
%attribute number "enable_passive_checks",
%attribute number "enable_event_handler",
%attribute %number "enable_notifications",
%attribute %number "enable_active_checks",
%attribute %number "enable_passive_checks",
%attribute %number "enable_event_handler",
%attribute name(EventCommand) "event_command",
%attribute %name(EventCommand) "event_command",
%attribute number "enable_flapping",
%attribute number "flapping_threshold",
%attribute %number "enable_flapping",
%attribute %number "flapping_threshold",
%attribute number "enable_perfdata",
%attribute %number "enable_perfdata",
%attribute number "volatile",
%attribute %number "volatile",
%attribute array "groups" {
%attribute name(ServiceGroup) "*"
%attribute %array "groups" {
%attribute %name(ServiceGroup) "*"
},
%attribute array "authorities" {
%attribute name(Endpoint) "*"
%attribute %array "authorities" {
%attribute %name(Endpoint) "*"
},
}
type ServiceGroup {
%attribute string "display_name"
%type ServiceGroup {
%attribute %string "display_name"
}
type Notification {
%type Notification {
%require "host",
%attribute name(Host) "host",
%attribute %name(Host) "host",
%require "service",
%attribute string "service",
%attribute %string "service",
%attribute dictionary "macros" {
%attribute string "*"
%attribute %dictionary "macros" {
%attribute %string "*"
},
%attribute array "users" {
%attribute name(User) "*"
%attribute %array "users" {
%attribute %name(User) "*"
},
%attribute array "user_groups" {
%attribute name(UserGroup) "*"
%attribute %array "user_groups" {
%attribute %name(UserGroup) "*"
},
%attribute dictionary "times" {
%attribute number "begin",
%attribute number "end",
%attribute %dictionary "times" {
%attribute %number "begin",
%attribute %number "end",
},
%require "notification_command",
%attribute name(NotificationCommand) "notification_command",
%attribute %name(NotificationCommand) "notification_command",
%attribute number "notification_interval",
%attribute name(TimePeriod) "notification_period",
%attribute %number "notification_interval",
%attribute %name(TimePeriod) "notification_period",
%attribute number "notification_type_filter",
%attribute number "notification_state_filter",
%attribute %number "notification_%type_filter",
%attribute %number "notification_state_filter",
%attribute array "authorities" {
%attribute name(Endpoint) "*"
%attribute %array "authorities" {
%attribute %name(Endpoint) "*"
},
}
type User {
%attribute string "display_name",
%type User {
%attribute %string "display_name",
%attribute dictionary "macros" {
%attribute string "*"
%attribute %dictionary "macros" {
%attribute %string "*"
},
%attribute array "groups" {
%attribute name(UserGroup) "*"
%attribute %array "groups" {
%attribute %name(UserGroup) "*"
},
%attribute number "enable_notifications",
%attribute number "notification_type_filter",
%attribute number "notification_state_filter",
%attribute name(TimePeriod) "notification_period"
%attribute %number "enable_notifications",
%attribute %number "notification_%type_filter",
%attribute %number "notification_state_filter",
%attribute %name(TimePeriod) "notification_period"
}
type UserGroup {
%attribute string "display_name"
%type UserGroup {
%attribute %string "display_name"
}
type TimePeriod {
%attribute string "display_name",
%type TimePeriod {
%attribute %string "display_name",
%require "methods",
%attribute dictionary "methods" {
%attribute %dictionary "methods" {
%require "update",
%attribute string "update"
%attribute %string "update"
},
/* %if (methods.update == "LegacyTimePeriod") { */
// %require "ranges",
%attribute dictionary "ranges" {
%attribute string "*"
%attribute %dictionary "ranges" {
%attribute %string "*"
}
/* } */
}
type Command {
%type Command {
%require "methods",
%attribute dictionary "methods" {
%attribute %dictionary "methods" {
%require "execute",
%attribute string "execute"
%attribute %string "execute"
},
/* %if (methods.execute == "PluginNotification" || methods.execute == "PluginCheck" || methods.execute == "PluginEvent") { */
// %require "command",
%attribute string "command",
%attribute array "command" {
%attribute string "*"
%attribute %string "command",
%attribute %array "command" {
%attribute %string "*"
},
%attribute array "export_macros" {
%attribute string "*"
%attribute %array "export_macros" {
%attribute %string "*"
},
%attribute array "escape_macros" {
%attribute string "*"
%attribute %array "escape_macros" {
%attribute %string "*"
},
%attribute dictionary "macros" {
%attribute string "*"
%attribute %dictionary "macros" {
%attribute %string "*"
},
%attribute number "timeout"
%attribute %number "timeout"
/* } */
}
type CheckCommand inherits Command {
%type CheckCommand %inherits Command {
}
type NotificationCommand inherits Command {
%type NotificationCommand %inherits Command {
}
type EventCommand inherits Command {
%type EventCommand %inherits Command {
}
type Domain {
%attribute dictionary "acl" {
%attribute number "*"
%type Domain {
%attribute %dictionary "acl" {
%attribute %number "*"
}
}
type ScheduledDowntime {
%type ScheduledDowntime {
%require "host",
%attribute name(Host) "host",
%attribute %name(Host) "host",
%require "service",
%attribute string "service",
%attribute %string "service",
%require "author",
%attribute string "author",
%attribute %string "author",
%require "comment",
%attribute string "comment",
%attribute %string "comment",
%attribute number "duration",
%attribute number "fixed",
%attribute %number "duration",
%attribute %number "fixed",
%require "ranges",
%attribute dictionary "ranges" {
%attribute string "*"
%attribute %dictionary "ranges" {
%attribute %string "*"
},
}
type Dependency {
%type Dependency {
%require "parent_host",
%attribute name(Host) "parent_host",
%attribute string "parent_service",
%attribute %name(Host) "parent_host",
%attribute %string "parent_service",
%require "child_host",
%attribute name(Host) "child_host",
%attribute string "child_service",
%attribute %name(Host) "child_host",
%attribute %string "child_service",
%attribute name(TimePeriod) "period",
%attribute %name(TimePeriod) "period",
%attribute number "state_filter",
%attribute number "disable_checks",
%attribute number "disable_notifications"
%attribute %number "state_filter",
%attribute %number "disable_checks",
%attribute %number "disable_notifications"
}

View File

@ -17,26 +17,26 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
type Endpoint {
%type Endpoint {
%require "host",
%attribute string "host",
%attribute %string "host",
%require "port",
%attribute string "port",
%attribute %string "port",
%attribute array "config_files" {
%attribute string "*"
%attribute %array "config_files" {
%attribute %string "*"
},
%attribute array "config_files_recursive" {
%attribute string "*",
%attribute dictionary "*" {
%attribute string "path",
%attribute string "pattern"
%attribute %array "config_files_recursive" {
%attribute %string "*",
%attribute %dictionary "*" {
%attribute %string "path",
%attribute %string "pattern"
}
},
%attribute array "accept_config" {
%attribute name(Endpoint) "*"
%attribute %array "accept_config" {
%attribute %name(Endpoint) "*"
}
}