use annotations instead of XML for Blueprint
[ovsdb.git] / southbound / southbound-impl / src / main / java / org / opendaylight / ovsdb / southbound / SouthboundProviderConfigurator.java
1 /*
2  * Copyright (c) 2019 Red Hat, Inc. 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.southbound;
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 SouthboundProvider}.
16  *
17  * @author Michael Vorburger.ch
18  */
19 public class SouthboundProviderConfigurator {
20
21     private static final Logger LOG = LoggerFactory.getLogger(SouthboundProviderConfigurator.class);
22
23     private static final String SKIP_MONITORING_MANAGER_STATUS_PARAM = "skip-monitoring-manager-status";
24
25     private final SouthboundProvider southboundProvider;
26
27     public SouthboundProviderConfigurator(SouthboundProvider southboundProvider) {
28         this.southboundProvider = southboundProvider;
29     }
30
31     public void setSkipMonitoringManagerStatus(boolean flag) {
32         southboundProvider.setSkipMonitoringManagerStatus(flag);
33     }
34
35     public void updateConfigParameter(Map<String, Object> configParameters) {
36         if (configParameters != null && !configParameters.isEmpty()) {
37             LOG.debug("Config parameters received : {}", configParameters.entrySet());
38             for (Map.Entry<String, Object> paramEntry : configParameters.entrySet()) {
39                 if (paramEntry.getKey().equalsIgnoreCase(SKIP_MONITORING_MANAGER_STATUS_PARAM)) {
40                     southboundProvider
41                             .setSkipMonitoringManagerStatus(Boolean.parseBoolean((String) paramEntry.getValue()));
42                     break;
43                 }
44             }
45         }
46     }
47 }