blob: cce30459310a567a5b6764c639d187a085e782cd [file] [log] [blame]
William Kurkianbde6fc92018-07-13 17:19:58 -04001/*
William Kurkian1bedb412018-07-19 12:55:41 -04002* Copyright 2018- Cisco
3*
4* Licensed under the Apache License, Version 2.0 (the "License");
5* you may not use this file except in compliance with the License.
6* You may obtain a copy of the License at
7*
8* http://www.apache.org/licenses/LICENSE-2.0
9*
10* Unless required by applicable law or agreed to in writing, software
11* distributed under the License is distributed on an "AS IS" BASIS,
12* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13* See the License for the specific language governing permissions and
14* limitations under the License.
15*/
William Kurkianbde6fc92018-07-13 17:19:58 -040016package config;
17
18import java.util.Properties;
19import java.io.FileInputStream;
20
21import org.slf4j.Logger;
22import org.slf4j.LoggerFactory;
23
24public class Config {
25
William Kurkian1bedb412018-07-19 12:55:41 -040026 private static Properties properties;
William Kurkianbde6fc92018-07-13 17:19:58 -040027
William Kurkian1bedb412018-07-19 12:55:41 -040028 private final static Logger logger = LoggerFactory.getLogger("VolthaKafkaConsumer");
William Kurkianbde6fc92018-07-13 17:19:58 -040029
William Kurkian1bedb412018-07-19 12:55:41 -040030 public static void loadProperties(String file) {
31 // create application properties with default
32 try {
33 properties = new Properties();
William Kurkianbde6fc92018-07-13 17:19:58 -040034
William Kurkian1bedb412018-07-19 12:55:41 -040035 // now load properties
36 // from last invocation
37 FileInputStream in = new FileInputStream(file);
38 properties.load(in);
39 in.close();
40 } catch (Exception e) {
41 logger.error(e.getMessage());
42 }
William Kurkianbde6fc92018-07-13 17:19:58 -040043 }
William Kurkianbde6fc92018-07-13 17:19:58 -040044
William Kurkian1bedb412018-07-19 12:55:41 -040045 public static String get(String key) {
46 return (String)properties.get(key);
47 }
William Kurkianbde6fc92018-07-13 17:19:58 -040048
William Kurkian1bedb412018-07-19 12:55:41 -040049 public static String getVesAddress() {
50 return get("onap_ves_address");
51 }
William Kurkianbde6fc92018-07-13 17:19:58 -040052
William Kurkian1bedb412018-07-19 12:55:41 -040053 public static String getVesPort() {
54 return get("onap_ves_port");
55 }
William Kurkianbde6fc92018-07-13 17:19:58 -040056
William Kurkian1bedb412018-07-19 12:55:41 -040057 public static String getKafkaAddress() {
58 return get("kafka_address");
59 }
William Kurkianbde6fc92018-07-13 17:19:58 -040060
William Kurkian1bedb412018-07-19 12:55:41 -040061 public static String getKafkaPort() {
62 return get("kafka_port");
William Kurkian18ec3442018-09-10 16:27:37 -040063 }
64
65 public static String getKafkaAlarmsTopic() {
66 return get("kafka_alarms_topic");
William Kurkian1bedb412018-07-19 12:55:41 -040067 }
William Kurkianbde6fc92018-07-13 17:19:58 -040068
William Kurkian18ec3442018-09-10 16:27:37 -040069 public static String getKafkaKpisTopic() {
70 return get("kafka_kpis_topic");
William Kurkian1bedb412018-07-19 12:55:41 -040071 }
William Kurkian7180b942018-08-15 15:26:17 -040072
73 public static String getCoId() {
74 return get("co_id");
75 }
76
77 public static String getPodId() {
78 return get("pod_id");
79 }
William Kurkian18ec3442018-09-10 16:27:37 -040080}