You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by wi...@apache.org on 2013/02/28 08:40:38 UTC
[2/2] git commit: improved the support for the old home properties
Updated Branches:
refs/heads/master f72ba3645 -> fa53eb5dd
improved the support for the old home properties
Project: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/commit/fa53eb5d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/tree/fa53eb5d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/diff/fa53eb5d
Branch: refs/heads/master
Commit: fa53eb5dd763f87d58887e655d4cbaf7361c1f25
Parents: 31bd1ae
Author: Sergio Fernández <wi...@apache.org>
Authored: Thu Feb 28 08:39:59 2013 +0100
Committer: Sergio Fernández <wi...@apache.org>
Committed: Thu Feb 28 08:39:59 2013 +0100
----------------------------------------------------------------------
.../services/config/ConfigurationServiceImpl.java | 24 ++++++++++----
1 files changed, 17 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/fa53eb5d/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/config/ConfigurationServiceImpl.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/config/ConfigurationServiceImpl.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/config/ConfigurationServiceImpl.java
index 59c4f67..9cb52f8 100644
--- a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/config/ConfigurationServiceImpl.java
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/config/ConfigurationServiceImpl.java
@@ -31,6 +31,7 @@ import org.apache.marmotta.platform.core.events.ConfigurationChangedEvent;
import org.apache.marmotta.platform.core.events.ConfigurationServiceInitEvent;
import org.apache.marmotta.platform.core.util.FallbackConfiguration;
import org.apache.commons.configuration.*;
+import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -161,8 +162,7 @@ public class ConfigurationServiceImpl implements ConfigurationService {
}
}
-
- // the save configuration will be in the LMF home directory
+ // the save configuration will be in the home directory
try {
if (getLMFHome() != null) {
configFile = getLMFHome() + File.separator + "system-config.properties";
@@ -176,7 +176,6 @@ public class ConfigurationServiceImpl implements ConfigurationService {
} else {
log.error("error while initialising configuration: no marmotta.home property given; creating memory-only configuration");
saveConfiguration = new MapConfiguration(new HashMap<String, Object>());
-
}
} catch (Exception e) {
log.error("error while initialising configuration file {}: {}; creating memory-only configuration", configFile, e.getMessage());
@@ -876,14 +875,25 @@ public class ConfigurationServiceImpl implements ConfigurationService {
}
/**
- * The work directory of the Sesame 2 native store. Sesame will create its own subdirectory
- * beneath this directory called "triples" and store the native database there.
+ * The work directory for marmotta, where all applications will create their own subdirectories
*/
@Override
public String getWorkDir() {
- final String value = getStringConfiguration("marmotta.home");
- return value != null ? value : new File(System.getProperty("java.io.tmpdir", "/tmp"), "lmf").getAbsolutePath();
+ String value = getStringConfiguration("marmotta.home");
+ if (StringUtils.isBlank(value)) {
+ log.warn("property 'marmotta.home' not given, trying with the old 'lmf.home'...");
+ value = getStringConfiguration("lmf.home");
+ }
+ if (StringUtils.isBlank(value)) {
+ log.warn("property 'lmf.home' not given neither, trying with the pretty old 'kiwi.home'...");
+ value = getStringConfiguration("kiwi.home");
+ }
+ if (StringUtils.isBlank(value)) {
+ value = new File(System.getProperty("java.io.tmpdir", "/tmp"), "marmotta").getAbsolutePath();
+ log.warn("no property found pointing a home, so creating it in the temporal one: " + value);
+ }
+ return value;
}
public void save() {