root / trunk / src / java / org / lidar / Config.java @ 12
History | View | Annotate | Download (851 Bytes)
1 |
package org.lidar; |
---|---|
2 |
|
3 |
import org.apache.commons.configuration.XMLConfiguration; |
4 |
import org.apache.commons.configuration.reloading.FileChangedReloadingStrategy; |
5 |
|
6 |
/**
|
7 |
*
|
8 |
* @author Andrej Cimpersek
|
9 |
*/
|
10 |
public class Config { |
11 |
|
12 |
private static XMLConfiguration configuration; |
13 |
|
14 |
public static XMLConfiguration getConfiguration() { |
15 |
if (configuration == null) { |
16 |
try {
|
17 |
configuration = new XMLConfiguration("/etc/lidar/config.xml"); |
18 |
configuration.setAutoSave(true);
|
19 |
configuration.setReloadingStrategy(new FileChangedReloadingStrategy());
|
20 |
} catch (Exception e) { |
21 |
} |
22 |
} |
23 |
|
24 |
return configuration;
|
25 |
} |
26 |
|
27 |
public static void save() { |
28 |
try {
|
29 |
configuration.save("/etc/lidar/config.xml");
|
30 |
} catch (Exception e) { |
31 |
} |
32 |
} |
33 |
} |