apache-ignite
95 строк · 3.7 Кб
1{#
2Licensed to the Apache Software Foundation (ASF) under one or more
3contributor license agreements. See the NOTICE file distributed with
4this work for additional information regarding copyright ownership.
5The ASF licenses this file to You under the Apache License, Version 2.0
6(the "License"); you may not use this file except in compliance with
7the License. You may obtain a copy of the License at
8
9http://www.apache.org/licenses/LICENSE-2.0
10
11Unless required by applicable law or agreed to in writing, software
12distributed under the License is distributed on an "AS IS" BASIS,
13WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14See the License for the specific language governing permissions and
15limitations under the License.
16#}
17
18{% macro cluster_state(state, version) %}
19{% if version > "2.9.0" %}
20<property name="clusterStateOnStart" value="{{ state }}"/>
21{% else %}
22<property name="activeOnStart" value="{{ 'false' if state == 'INACTIVE' else 'true'}}"/>
23{% endif %}
24{% endmacro %}
25
26{% macro plugins(config) %}
27{% if config.plugins %}
28<property name="pluginProviders">
29<list>
30{% for plugin in config.plugins %}
31{% import plugin[0] as plugin_template -%}
32{{ plugin_template.apply(config, plugin[1]) }}
33{% endfor %}
34</list>
35</property>
36{% endif %}
37{% endmacro %}
38
39{% macro ext_beans(config) %}
40{% if config.ext_beans %}
41{% for ext_bean in config.ext_beans %}
42{% import ext_bean[0] as bean_template -%}
43{{ bean_template.apply(config, ext_bean[1]) }}
44{% endfor %}
45{% endif %}
46{% endmacro %}
47
48{% macro event_types(config) %}
49{% if config.include_event_types | length > 0 %}
50<util:list id="eventTypes" value-type="java.lang.Integer">
51{% for event_type in config.include_event_types %}
52<value>{{ event_type }}</value>
53{% endfor %}
54</util:list>
55{% endif %}
56{% endmacro %}
57
58{% macro bean(bean_object) %}
59{% if bean_object.properties | length > 0 or bean_object.constructor_args | length > 0 %}
60{% if bean_object.id != "" %}
61<bean id="{{ bean_object.id }}" class="{{ bean_object }}">
62{% else %}
63<bean class="{{ bean_object }}">
64{% endif %}
65{% for name, value in bean_object.properties.items() %}
66{% if value is string or value is number or value is boolean %}
67<property name="{{ name | snake_to_camel }}" value="{{ value }}"/>
68{% elif value is iterable and value is not mapping %}
69<property name="{{ name | snake_to_camel }}">
70<list>
71{% for v in value %}
72{% if v is string or v is number or v is boolean %}
73<value>{{ v }}</value>
74{% else %}
75{{ bean(v) }}
76{% endif %}
77{% endfor %}
78</list>
79</property>
80{% elif value.ref | length > 0 %}
81<property name="{{ name | snake_to_camel }}" ref="{{ value.ref }}"/>
82{% else %}
83<property name="{{ name | snake_to_camel }}">
84{{ bean(value) }}
85</property>
86{% endif %}
87{% endfor %}
88{% for value in bean_object.constructor_args %}
89<constructor-arg value="{{ value }}"/>
90{% endfor %}
91</bean>
92{% else %}
93<bean id="{{ bean_object.id }}" class="{{ bean_object }}"/>
94{% endif %}
95{% endmacro %}
96