MCPcopy Create free account
hub / github.com/ddf-project/DDF / ConfigHandler

Class ConfigHandler

core/src/main/java/io/ddf/util/ConfigHandler.java:24–257  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22/**
23 */
24public class ConfigHandler extends ALoggable implements IHandleConfig {
25
26 public ConfigHandler(String configDir, String configFileName) {
27 mConfigDir = configDir;
28 mConfigFileName = configFileName;
29 }
30
31
32 private String mConfigDir;
33 private String mConfigFileName;
34
35
36 public String getConfigDir() {
37 return mConfigDir;
38 }
39
40 public String getConfigFileName() {
41 return mConfigFileName;
42 }
43
44
45 private Configuration mConfig;
46
47
48 @Override
49 public Configuration getConfig() {
50 if (mConfig == null) try {
51 mConfig = this.loadConfig();
52
53 } catch (Exception e) {
54 mLog.error("Unable to initialize configuration", e);
55 }
56
57 return mConfig;
58 }
59
60
61 /**
62 * Stores DDF configuration information from ddf.ini
63 */
64 public static class Configuration {
65
66 public static class Section {
67 private Map<String, String> mEntries = new HashMap<String, String>();
68
69
70 public Map<String, String> getEntries() {
71 return mEntries;
72 }
73
74 public String get(String key) {
75 return mEntries.get(safeToLower(key));
76 }
77
78 public Section set(String key, String value) {
79 mEntries.put(safeToLower(key), value);
80 return this;
81 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected