2 * Copyright (c) 2013 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
9 package org.opendaylight.controller.config.stat;
11 import org.osgi.framework.BundleContext;
14 * Subset of {@link org.osgi.framework.BundleContext}
16 public interface ConfigProvider {
18 * Returns the value of the specified property. If the key is not found in
19 * the Framework properties, the system properties are then searched. The
20 * method returns {@code null} if the property is not found.
23 * All bundles must have permission to read properties whose names start
24 * with "org.osgi.".
27 * The name of the requested property.
28 * @return The value of the requested property, or {@code null} if the
29 * property is undefined.
30 * @throws SecurityException
31 * If the caller does not have the appropriate
32 * {@code PropertyPermission} to read the property, and the Java
33 * Runtime Environment supports permissions.
35 String getProperty(String key);
37 public static class ConfigProviderImpl implements ConfigProvider {
38 private final BundleContext context;
40 public ConfigProviderImpl(BundleContext context) {
41 this.context = context;
45 public String getProperty(String key) {
46 return context.getProperty(key);
50 public String toString() {
51 return "ConfigProviderImpl{" + "context=" + context + '}';