| /* |
| * Copyright 2018- Cisco |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| package config;
|
|
|
| import java.util.Properties;
|
| import java.io.FileInputStream;
|
|
|
| import org.slf4j.Logger;
|
| import org.slf4j.LoggerFactory;
|
|
|
| public class Config {
|
|
|
| private static Properties properties;
|
|
|
| private final static Logger logger = LoggerFactory.getLogger("VolthaKafkaConsumer");
|
|
|
| public static void loadProperties(String file) {
|
| // create application properties with default
|
| try {
|
| properties = new Properties();
|
|
|
| // now load properties
|
| // from last invocation
|
| FileInputStream in = new FileInputStream(file);
|
| properties.load(in);
|
| in.close();
|
| } catch (Exception e) {
|
| logger.error(e.getMessage());
|
| }
|
| }
|
|
|
| public static String get(String key) {
|
| return (String)properties.get(key);
|
| }
|
|
|
| public static String getVesAddress() {
|
| return get("onap_ves_address");
|
| }
|
|
|
| public static String getVesPort() {
|
| return get("onap_ves_port");
|
| }
|
|
|
| public static String getKafkaAddress() {
|
| return get("kafka_address");
|
| }
|
|
|
| public static String getKafkaPort() {
|
| return get("kafka_port");
|
| } |
| |
| public static String getKafkaAlarmsTopic() {
|
| return get("kafka_alarms_topic");
|
| }
|
|
|
| public static String getKafkaKpisTopic() {
|
| return get("kafka_kpis_topic");
|
| }
|
|
|
| public static String getCoId() {
|
| return get("co_id");
|
| }
|
|
|
| public static String getPodId() {
|
| return get("pod_id");
|
| }
|
| } |