apache-ignite
71 строка · 2.9 Кб
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 ip_finder(spi) %}
19{% if spi.ip_finder and spi.ip_finder.type == 'VM' %}
20<property name="ipFinder">
21<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
22<property name="addresses">
23<list>
24{% for address in spi.ip_finder.addresses %}
25{% if spi.port_range > 0 %}
26<value>{{ address }}:{{ spi.port }}..{{ spi.port + spi.port_range }}</value>
27{% else %}
28<value>{{ address }}:{{ spi.port }}</value>
29{% endif %}
30{% endfor %}
31</list>
32</property>
33</bean>
34</property>
35{% endif %}
36{% endmacro %}
37
38{% macro zookeeper_discovery_spi(spi) %}
39<bean class="org.apache.ignite.spi.discovery.zk.ZookeeperDiscoverySpi">
40<property name="zkConnectionString" value="{{ spi.connection_string }}"/>
41<property name="zkRootPath" value="{{ spi.root_path }}"/>
42<property name="sessionTimeout" value="{{ spi.session_timeout }}"/>
43</bean>
44{% endmacro %}
45
46{% macro tcp_discovery_spi(spi) %}
47<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
48{% if spi.local_address %}
49<property name="localAddress" value="{{ spi.local_address }}"/>
50{% endif %}
51{% if spi.so_linger is defined %}
52<property name="soLinger" value="{{ spi.so_linger }}"/>
53{% endif %}
54<property name="localPort" value="{{ spi.port }}"/>
55<property name="localPortRange" value="{{ spi.port_range }}"/>
56{% if spi.conn_recovery_timeout is defined %}
57<property name="connectionRecoveryTimeout" value="{{ spi.conn_recovery_timeout }}"/>
58{% endif %}
59{{ ip_finder(spi) }}
60</bean>
61{% endmacro %}
62
63{% macro discovery_spi(spi) %}
64<property name="discoverySpi">
65{% if spi.type == 'TCP' %}
66{{ tcp_discovery_spi(spi) }}
67{% elif spi.type == 'ZOOKEEPER' %}
68{{ zookeeper_discovery_spi(spi) }}
69{% endif %}
70</property>
71{% endmacro %}
72