2 * @author Tomas Olvecky
6 * Copyright (c) 2013 by Cisco Systems, Inc.
9 package org.opendaylight.controller.netconf.persist.impl.osgi;
11 import org.opendaylight.controller.config.persist.api.PropertiesProvider;
12 import org.osgi.framework.BundleContext;
13 import org.slf4j.Logger;
14 import org.slf4j.LoggerFactory;
16 public class PropertiesProviderBaseImpl implements PropertiesProvider {
18 private static final Logger logger = LoggerFactory.getLogger(PropertiesProviderBaseImpl.class);
19 private final BundleContext bundleContext;
21 public PropertiesProviderBaseImpl(BundleContext bundleContext) {
22 this.bundleContext = bundleContext;
26 public String getProperty(String key) {
27 String fullKey = getFullKeyForReporting(key);
28 return getPropertyWithoutPrefix(fullKey);
31 public String getPropertyWithoutPrefix(String fullKey){
32 logger.trace("Full key {}", fullKey);
33 return bundleContext.getProperty(fullKey);
36 public String getPrefix(){
37 return ConfigPersisterActivator.NETCONF_CONFIG_PERSISTER;
41 public String getFullKeyForReporting(String key) {
42 return getPrefix() + "." + key;