2 * Copyright (C) 2014 Red Hat, Inc.
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 * Authors : Flavio Fernandes, Sam Hague, Srini Seetharaman
11 package org.opendaylight.ovsdb.utils.config;
13 import org.osgi.framework.Bundle;
14 import org.osgi.framework.BundleContext;
15 import org.osgi.framework.FrameworkUtil;
17 public class ConfigProperties {
19 private ConfigProperties() {
23 public static String getProperty(Class<?> classParam, final String propertyStr) {
24 return getProperty(classParam, propertyStr, null);
27 public static String getProperty(Class<?> classParam, final String propertyStr, final String defaultValue) {
29 Bundle bundle = FrameworkUtil.getBundle(classParam);
32 BundleContext bundleContext = bundle.getBundleContext();
33 if (bundleContext != null) {
34 value = bundleContext.getProperty(propertyStr);
38 value = System.getProperty(propertyStr, defaultValue);