diff options
Diffstat (limited to 'src/uk/ac/ox/cs/pagoda/util/PagodaProperties.java')
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/util/PagodaProperties.java | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/uk/ac/ox/cs/pagoda/util/PagodaProperties.java b/src/uk/ac/ox/cs/pagoda/util/PagodaProperties.java index 0f9ad4e..2b52a89 100644 --- a/src/uk/ac/ox/cs/pagoda/util/PagodaProperties.java +++ b/src/uk/ac/ox/cs/pagoda/util/PagodaProperties.java | |||
| @@ -13,6 +13,7 @@ public class PagodaProperties { | |||
| 13 | 13 | ||
| 14 | public enum SkolemUpperBoundOptions {DISABLED, BEFORE_SUMMARISATION, AFTER_SUMMARISATION} | 14 | public enum SkolemUpperBoundOptions {DISABLED, BEFORE_SUMMARISATION, AFTER_SUMMARISATION} |
| 15 | 15 | ||
| 16 | public static final String DEFAULT_CONFIG_FILE = "_default_pagoda.properties"; | ||
| 16 | public static final String CONFIG_FILE = "pagoda.properties"; | 17 | public static final String CONFIG_FILE = "pagoda.properties"; |
| 17 | public static final boolean DEFAULT_DEBUG = false; | 18 | public static final boolean DEFAULT_DEBUG = false; |
| 18 | private static final boolean DEFAULT_USE_ALWAYS_SIMPLE_UPPER_BOUND; | 19 | private static final boolean DEFAULT_USE_ALWAYS_SIMPLE_UPPER_BOUND; |
| @@ -26,6 +27,8 @@ public class PagodaProperties { | |||
| 26 | private static boolean debug = DEFAULT_DEBUG; | 27 | private static boolean debug = DEFAULT_DEBUG; |
| 27 | 28 | ||
| 28 | static { | 29 | static { |
| 30 | Logger logger = Logger.getLogger("PagodaProperties"); | ||
| 31 | |||
| 29 | boolean defaultUseAlwaysSimpleUpperBound = false; | 32 | boolean defaultUseAlwaysSimpleUpperBound = false; |
| 30 | SkolemUpperBoundOptions defaultSkolemUpperBound = SkolemUpperBoundOptions.DISABLED; | 33 | SkolemUpperBoundOptions defaultSkolemUpperBound = SkolemUpperBoundOptions.DISABLED; |
| 31 | int defaultSkolemDepth = 1; | 34 | int defaultSkolemDepth = 1; |
| @@ -33,11 +36,19 @@ public class PagodaProperties { | |||
| 33 | Path defaultStatisticsDir = null; | 36 | Path defaultStatisticsDir = null; |
| 34 | long defaultMaxTriplesInSkolemStore = 1000000; | 37 | long defaultMaxTriplesInSkolemStore = 1000000; |
| 35 | 38 | ||
| 36 | try (InputStream in = PagodaProperties.class.getClassLoader().getResourceAsStream(CONFIG_FILE)) { | 39 | InputStream configStream = PagodaProperties.class.getClassLoader().getResourceAsStream(CONFIG_FILE); |
| 40 | |||
| 41 | if(configStream == null) { | ||
| 42 | logger.info("Unable to find user-defined configuration file (\"" + CONFIG_FILE + "\" in classpath)"); | ||
| 43 | logger.info("Using default configuration"); | ||
| 44 | configStream = PagodaProperties.class.getClassLoader().getResourceAsStream(DEFAULT_CONFIG_FILE); | ||
| 45 | } | ||
| 46 | |||
| 47 | try { | ||
| 37 | Properties config = new Properties(); | 48 | Properties config = new Properties(); |
| 38 | config.load(in); | 49 | config.load(configStream); |
| 39 | in.close(); | 50 | configStream.close(); |
| 40 | Logger logger = Logger.getLogger("PagodaProperties"); | 51 | |
| 41 | if (config.containsKey("debug")) { | 52 | if (config.containsKey("debug")) { |
| 42 | debug = Boolean.parseBoolean(config.getProperty("debug")); | 53 | debug = Boolean.parseBoolean(config.getProperty("debug")); |
| 43 | logger.info("Debugging mode is enabled"); | 54 | logger.info("Debugging mode is enabled"); |
