2 * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.controller.config.persist.impl.osgi;
10 import org.opendaylight.controller.config.persist.api.PropertiesProvider;
11 import org.osgi.framework.BundleContext;
12 import org.slf4j.Logger;
13 import org.slf4j.LoggerFactory;
15 public class PropertiesProviderBaseImpl implements PropertiesProvider {
17 private static final Logger LOG = LoggerFactory.getLogger(PropertiesProviderBaseImpl.class);
18 private final BundleContext bundleContext;
20 public PropertiesProviderBaseImpl(final BundleContext bundleContext) {
21 this.bundleContext = bundleContext;
25 public String getProperty(final String key) {
26 String fullKey = getFullKeyForReporting(key);
27 return getPropertyWithoutPrefix(fullKey);
30 public String getPropertyWithoutPrefix(final String fullKey){
31 LOG.trace("Full key {}", fullKey);
32 return bundleContext.getProperty(fullKey);
35 public String getPrefix(){
36 return ConfigPersisterActivator.NETCONF_CONFIG_PERSISTER;
40 public String getFullKeyForReporting(final String key) {
41 return getPrefix() + "." + key;