blob: abf5d7317a7b710832d334498d338fe97cd5d5fc [file] [log] [blame]
William Kurkianbde6fc92018-07-13 17:19:58 -04001/*
2 * 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 */
16package config;
17
18import java.util.Properties;
19import java.io.FileInputStream;
20
21import org.slf4j.Logger;
22import org.slf4j.LoggerFactory;
23
24public class Config {
25
26 private static Properties properties;
27
28 private final static Logger logger = LoggerFactory.getLogger("VolthaKafkaConsumer");
29
30 public static void loadProperties(String file) {
31 // create application properties with default
32 try {
33 properties = new Properties();
34
35 // 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 }
43 }
44
45 public static String get(String key) {
46 return (String)properties.get(key);
47 }
48
49 public static String getVesAddress() {
50 return get("onap_ves_address");
51 }
52
53 public static String getVesPort() {
54 return get("onap_ves_port");
55 }
56
57 public static String getKafkaAddress() {
58 return get("kafka_address");
59 }
60
61 public static String getKafkaPort() {
62 return get("kafka_port");
63 }
64
65 public static String getKafkaTopic() {
66 return get("kafka_topic");
67 }
68}