2 * Copyright © 2020 Orange, 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.transportpce.nbinotifications.utils;
10 import java.io.IOException;
11 import java.io.InputStream;
12 import java.util.Properties;
13 import org.slf4j.Logger;
14 import org.slf4j.LoggerFactory;
16 public final class NbiNotificationsUtils {
18 private static final Logger LOG = LoggerFactory.getLogger(NbiNotificationsUtils.class);
20 private NbiNotificationsUtils() {
23 public static Properties loadProperties(String propertyFileName) {
24 Properties props = new Properties();
25 InputStream inputStream = NbiNotificationsUtils.class.getClassLoader()
26 .getResourceAsStream(propertyFileName);
28 if (inputStream != null) {
29 props.load(inputStream);
31 LOG.warn("Kafka property file '{}' is empty", propertyFileName);
33 } catch (IOException e) {
34 LOG.warn("Kafka property file '{}' was not found in the classpath", propertyFileName);