Merge "Add support for enums as configuration attributes in config and netconf subsys...
[controller.git] / opendaylight / netconf / config-persister-impl / src / main / java / org / opendaylight / controller / netconf / persist / impl / PropertiesProviderAdapterImpl.java
1 /**
2  * @author Tomas Olvecky
3  *
4  * 11 2013
5  *
6  * Copyright (c) 2013 by Cisco Systems, Inc.
7  * All rights reserved.
8  */
9 package org.opendaylight.controller.netconf.persist.impl;
10
11 import org.opendaylight.controller.config.persist.api.PropertiesProvider;
12 import org.opendaylight.controller.netconf.persist.impl.osgi.PropertiesProviderBaseImpl;
13
14 public class PropertiesProviderAdapterImpl implements PropertiesProvider {
15     private final PropertiesProviderBaseImpl inner;
16     private final String index;
17
18     public PropertiesProviderAdapterImpl(PropertiesProviderBaseImpl inner, String index) {
19         this.inner = inner;
20         this.index = index;
21     }
22
23     @Override
24     public String getProperty(String key) {
25         String fullKey = getFullKeyForReporting(key);
26         return inner.getPropertyWithoutPrefix(fullKey);
27     }
28
29     public String getPrefix() {
30         return inner.getPrefix() + "." + index + ".properties";
31     }
32
33     @Override
34     public String getFullKeyForReporting(String key) {
35         return getPrefix()  + "." + key;
36     }
37 }