Update MRI projects for Aluminium
[ovsdb.git] / hwvtepsouthbound / hwvtepsouthbound-impl / src / main / java / org / opendaylight / ovsdb / hwvtepsouthbound / HwvtepSouthboundProviderConfigurator.java
1 /*
2  * Copyright (c) 2020 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.ovsdb.hwvtepsouthbound;
9
10 import java.util.Map;
11 import org.slf4j.Logger;
12 import org.slf4j.LoggerFactory;
13
14 /**
15  * Helper to let Blueprint XML configure {@link HwvtepSouthboundProvider}.
16  *
17  * @author Chandra Shekar S
18  */
19 public class HwvtepSouthboundProviderConfigurator {
20
21     private static final Logger LOG = LoggerFactory.getLogger(HwvtepSouthboundProviderConfigurator.class);
22
23     private static final String SHARD_STATUS_CHECK_RETRY_COUNT = "shard-status-check-retry-count";
24
25     private final HwvtepSouthboundProvider hwvtepSouthboundProvider;
26
27     public HwvtepSouthboundProviderConfigurator(HwvtepSouthboundProvider hwvtepSouthboundProvider) {
28         this.hwvtepSouthboundProvider = hwvtepSouthboundProvider;
29     }
30
31     public void setShardStatusCheckRetryCount(int retryCount) {
32         hwvtepSouthboundProvider.setShardStatusCheckRetryCount(retryCount);
33     }
34
35
36
37     public void updateConfigParameter(Map<String, Object> configParameters) {
38         if (configParameters != null && !configParameters.isEmpty()) {
39             LOG.debug("Config parameters received : {}", configParameters.entrySet());
40             for (Map.Entry<String, Object> paramEntry : configParameters.entrySet()) {
41                 if (paramEntry.getKey().equalsIgnoreCase(SHARD_STATUS_CHECK_RETRY_COUNT)) {
42                     hwvtepSouthboundProvider
43                             .setShardStatusCheckRetryCount(Integer.parseInt((String) paramEntry.getValue()));
44                 }
45             }
46         }
47     }
48 }