1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package net.sourceforge.acelogger.configuration.parser;
16
17 import java.io.IOException;
18 import java.io.InputStream;
19 import java.util.Properties;
20 import java.util.Map.Entry;
21
22 import net.sourceforge.acelogger.configuration.BaseConfigurationLoader;
23 import net.sourceforge.acelogger.execution.LogController;
24
25
26
27
28
29
30
31
32
33 public class PropertiesConfigurationLoader extends BaseConfigurationLoader {
34
35
36 public void configureFrom(InputStream source) {
37 Properties configurationProperties = new Properties();
38 try {
39 configurationProperties.load(source);
40 for (Entry<Object, Object> currentEntry : configurationProperties.entrySet()) {
41 if (String.class.isAssignableFrom(currentEntry.getKey().getClass())) {
42 String keyName = currentEntry.getKey().toString();
43
44
45
46
47
48 } else {
49 LogController.getInternalLogger().error(
50 "This Loader supports only strings as keys, but a an"
51 + " instance of {0} was received", currentEntry.getClass()
52 );
53 }
54 }
55 source.close();
56 } catch (IOException e) {
57 LogController.getInternalLogger().error("Stream error during configuration", e);
58 }
59 }
60
61 }