Encapsulate OpenFlowPlugin configuration
[openflowplugin.git] / openflowplugin-api / src / main / java / org / opendaylight / openflowplugin / api / openflow / configuration / ConfigurationService.java
1 /*
2  * Copyright (c) 2017 Pantheon Technologies s.r.o. 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
9 package org.opendaylight.openflowplugin.api.openflow.configuration;
10
11 import java.util.Map;
12 import java.util.function.Function;
13 import javax.annotation.Nonnull;
14
15 /**
16  * Manages OpenFlowPlugin configuration
17  */
18 public interface ConfigurationService extends AutoCloseable {
19
20     /**
21      * Update map of properties.
22      *
23      * @param properties properties
24      */
25     void update(@Nonnull Map<String, String> properties);
26
27     /**
28      * Register listener for configuration changes.
29      *
30      * @param listener the listener
31      * @return the auto closeable listener registration
32      */
33     @Nonnull
34     AutoCloseable registerListener(@Nonnull ConfigurationListener listener);
35
36     /**
37      * Get single property from configuration service.
38      *
39      * @param <T>         property type
40      * @param key         property key
41      * @param transformer property type transformer
42      * @return property property
43      */
44     @Nonnull
45     <T> T getProperty(@Nonnull String key, @Nonnull Function<String, T> transformer);
46
47 }