1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.select.testing;
17
18 import org.springframework.core.io.ClassPathResource;
19
20 import java.util.Enumeration;
21 import java.util.Properties;
22
23 public class PropertyManager {
24 static PropertyManager propManager;
25 static Properties prop;
26
27 public static PropertyManager getInstance() {
28 if (propManager == null) {
29 propManager = new PropertyManager();
30 propManager.loadProperties();
31 }
32 return propManager;
33 }
34
35 public static String getProperty(String key) {
36 String value = prop.getProperty(key);
37 return value;
38 }
39
40 private void loadProperties() {
41 ClassPathResource classPathResource = new ClassPathResource("org/kuali/ole/select/testing/webservice.properties");
42 prop = new Properties();
43 try {
44 prop.load(classPathResource.getInputStream());
45 Enumeration keys = prop.propertyNames();
46 while (keys.hasMoreElements()) {
47 String key = (String) keys.nextElement();
48 prop.put(key, prop.getProperty((String) key));
49 }
50 } catch (Exception e) {
51 e.printStackTrace();
52 }
53 }
54 }