d9466ff00b6d6a0d1e9c034d43ad310600407dd3
[controller.git] / opendaylight / netconf / config-persister-impl / src / main / java / org / opendaylight / controller / netconf / persist / impl / PropertiesProviderAdapterImpl.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, 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.controller.netconf.persist.impl;
9
10 import org.opendaylight.controller.config.persist.api.PropertiesProvider;
11 import org.opendaylight.controller.netconf.persist.impl.osgi.PropertiesProviderBaseImpl;
12
13 public class PropertiesProviderAdapterImpl implements PropertiesProvider {
14     private final PropertiesProviderBaseImpl inner;
15     private final String index;
16
17     public PropertiesProviderAdapterImpl(PropertiesProviderBaseImpl inner, String index) {
18         this.inner = inner;
19         this.index = index;
20     }
21
22     @Override
23     public String getProperty(String key) {
24         String fullKey = getFullKeyForReporting(key);
25         return inner.getPropertyWithoutPrefix(fullKey);
26     }
27
28     public String getPrefix() {
29         return inner.getPrefix() + "." + index + ".properties";
30     }
31
32     @Override
33     public String getFullKeyForReporting(String key) {
34         return getPrefix()  + "." + key;
35     }
36 }