diff --git a/htroot/AccessTracker_p.java b/htroot/AccessTracker_p.java
index ee2fc75e4..073091fa5 100644
--- a/htroot/AccessTracker_p.java
+++ b/htroot/AccessTracker_p.java
@@ -99,7 +99,7 @@ public class AccessTracker_p {
while (ii.hasNext()) {
entry = (Map.Entry) ii.next();
prop.putHTML("page_list_" + entCount + "_host", host);
- prop.putHTML("page_list_" + entCount + "_date", serverDate.shortSecondTime(new Date(((Long) entry.getKey()).longValue())));
+ prop.put("page_list_" + entCount + "_date", serverDate.shortSecondTime(new Date(((Long) entry.getKey()).longValue())));
prop.putHTML("page_list_" + entCount + "_path", (String) entry.getValue());
entCount++;
}
@@ -214,7 +214,7 @@ public class AccessTracker_p {
yacySeed remotepeer = yacyCore.seedDB.lookupByIP(natLib.getInetAddress(host), true, true, true);
prop.putHTML("page_list_" + entCount + "_peername", (remotepeer == null) ? "UNKNOWN" : remotepeer.getName());
}
- prop.putHTML("page_list_" + entCount + "_count", new Integer(handles.size()).toString());
+ prop.putNum("page_list_" + entCount + "_count", handles.size());
// next
entCount++;
diff --git a/htroot/BlogComments.java b/htroot/BlogComments.java
index bc245f83f..b83db8a5f 100644
--- a/htroot/BlogComments.java
+++ b/htroot/BlogComments.java
@@ -176,7 +176,7 @@ public class BlogComments {
// finally write notification
File notifierSource = new File(switchboard.getRootPath(), switchboard.getConfig("htRootPath","htroot") + "/env/grafics/message.gif");
- File notifierDest = new File(switchboard.getConfig("htDocsPath", "DATA/HTDOCS"), "notifier.gif");
+ File notifierDest = new File(switchboard.getConfigPath("htDocsPath", "DATA/HTDOCS"), "notifier.gif");
try {
serverFileUtils.copy(notifierSource, notifierDest);
} catch (IOException e) {
diff --git a/htroot/CacheAdmin_p.java b/htroot/CacheAdmin_p.java
index 0e45dc940..ecca55974 100644
--- a/htroot/CacheAdmin_p.java
+++ b/htroot/CacheAdmin_p.java
@@ -210,7 +210,7 @@ public class CacheAdmin_p {
}
// generate sorted dir/file listing
- final String[] list = dir.list(new Filter(new File(switchboard.getConfig(plasmaSwitchboard.HTCACHE_PATH, plasmaSwitchboard.HTCACHE_PATH_DEFAULT))));
+ final String[] list = dir.list(new Filter(switchboard.getConfigPath(plasmaSwitchboard.HTCACHE_PATH, plasmaSwitchboard.HTCACHE_PATH_DEFAULT)));
tree.ensureCapacity((list == null) ? 70 : (list.length + 1) * 256);
linkPathString(prop, ((pathString.length() == 0) ? ("/") : (pathString)), true);
if (list == null) {
diff --git a/htroot/CacheResource_p.java b/htroot/CacheResource_p.java
index 6f7660fe1..4148b9ff8 100644
--- a/htroot/CacheResource_p.java
+++ b/htroot/CacheResource_p.java
@@ -62,7 +62,7 @@ public class CacheResource_p {
String path = ((post == null) ? "" : post.get("path", ""));
// we dont need check the path, because we have do that in plasmaSwitchboard.java - Borg-0300
- File cache = new File(switchboard.getConfig("proxyCache", "DATA/HTCACHE").toString());
+ File cache = switchboard.getConfigPath(plasmaSwitchboard.HTCACHE_PATH, plasmaSwitchboard.HTCACHE_PATH_DEFAULT);
File f = new File(cache, path);
byte[] resource;
diff --git a/htroot/ConfigBasic.java b/htroot/ConfigBasic.java
index 4d3b0ee72..ae7241b21 100644
--- a/htroot/ConfigBasic.java
+++ b/htroot/ConfigBasic.java
@@ -47,7 +47,6 @@
// javac -classpath .:../classes ConfigBasic_p.java
// if the shell's current path is HTROOT
-import java.io.File;
import java.lang.Integer;
import java.util.regex.Pattern;
@@ -80,7 +79,7 @@ public class ConfigBasic {
ConfigBasic config = new ConfigBasic();
plasmaSwitchboard sb = (plasmaSwitchboard) env;
serverObjects prop = new serverObjects();
- String langPath = new File(env.getRootPath(), env.getConfig("locale.work", "DATA/LOCALE/locales")).toString();
+ String langPath = env.getConfigPath("locale.work", "DATA/LOCALE/locales").getAbsolutePath();
String lang = env.getConfig("locale.language", "default");
int authentication = sb.adminAuthenticated(header);
diff --git a/htroot/ConfigLanguage_p.java b/htroot/ConfigLanguage_p.java
index 8ceb1f15d..6ec250d27 100644
--- a/htroot/ConfigLanguage_p.java
+++ b/htroot/ConfigLanguage_p.java
@@ -71,7 +71,7 @@ public class ConfigLanguage_p {
//listManager.switchboard = (plasmaSwitchboard) env;
serverObjects prop = new serverObjects();
plasmaSwitchboard switchboard = (plasmaSwitchboard) env;
- String langPath = new File(env.getRootPath(), env.getConfig("locale.work", "DATA/LOCALE/locales")).toString();
+ String langPath = env.getConfigPath("locale.work", "DATA/LOCALE/locales").getAbsolutePath();
//Fallback
//prop.put("currentlang", ""); //is done by Translationtemplate
diff --git a/htroot/ConfigSkins_p.java b/htroot/ConfigSkins_p.java
index bd4c66193..4f5196b33 100644
--- a/htroot/ConfigSkins_p.java
+++ b/htroot/ConfigSkins_p.java
@@ -78,7 +78,7 @@ public class ConfigSkins_p {
}
private static boolean changeSkin(plasmaSwitchboard sb, String skinPath, String skin){
- File htdocsDir = new File(sb.getRootPath(), sb.getConfig("htDocsPath", "DATA/HTDOCS")+"/env");
+ File htdocsDir = new File(sb.getConfigPath("htDocsPath", "DATA/HTDOCS"), "env");
File styleFile = new File(htdocsDir, "style.css");
File skinFile = new File(skinPath, skin);
@@ -93,7 +93,7 @@ public class ConfigSkins_p {
public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) {
serverObjects prop = new serverObjects();
plasmaSwitchboard switchboard = (plasmaSwitchboard) env;
- String skinPath = new File(env.getRootPath(), env.getConfig("skinsPath", "DATA/SKINS")).toString();
+ String skinPath = new File(env.getRootPath(), env.getConfig("skinPath", "DATA/SKINS")).toString();
//Fallback
prop.put("currentskin", "");
diff --git a/htroot/CrawlURLFetchStack_p.java b/htroot/CrawlURLFetchStack_p.java
index 5f319753c..40e868b4c 100644
--- a/htroot/CrawlURLFetchStack_p.java
+++ b/htroot/CrawlURLFetchStack_p.java
@@ -73,7 +73,7 @@ public class CrawlURLFetchStack_p {
public static URLFetcherStack getURLFetcherStack(serverSwitch env) {
if (stack == null) try {
- stack = new URLFetcherStack(env.getConfig(plasmaSwitchboard.DBPATH, plasmaSwitchboard.DBPATH_DEFAULT));
+ stack = new URLFetcherStack(env.getConfigPath(plasmaSwitchboard.DBPATH, plasmaSwitchboard.DBPATH_DEFAULT));
} catch (IOException e) {
serverLog.logSevere("URLFETCHER", "Couldn't initialize URL stack: " + e.getMessage());
}
diff --git a/htroot/Messages_p.java b/htroot/Messages_p.java
index 5558f48d6..00b4d7721 100644
--- a/htroot/Messages_p.java
+++ b/htroot/Messages_p.java
@@ -114,7 +114,7 @@ public class Messages_p {
// first reset notification
File notifierSource = new File(switchboard.getRootPath(), switchboard.getConfig("htRootPath", "htroot") + "/env/grafics/empty.gif");
- File notifierDest = new File(switchboard.getConfig("htDocsPath", "DATA/HTDOCS"), "notifier.gif");
+ File notifierDest = new File(switchboard.getConfigPath("htDocsPath", "DATA/HTDOCS"), "notifier.gif");
try {
serverFileUtils.copy(notifierSource, notifierDest);
} catch (IOException e) {
diff --git a/htroot/ProxyIndexingMonitor_p.java b/htroot/ProxyIndexingMonitor_p.java
index b62875da1..bf5bdb689 100644
--- a/htroot/ProxyIndexingMonitor_p.java
+++ b/htroot/ProxyIndexingMonitor_p.java
@@ -95,15 +95,15 @@ public class ProxyIndexingMonitor_p {
// added proxyCache, proxyCacheSize - Borg-0300
// proxyCache - check and create the directory
- oldProxyCachePath = env.getConfig("proxyCache", "DATA/HTCACHE");
- newProxyCachePath = post.get("proxyCache", "DATA/HTCACHE");
+ oldProxyCachePath = env.getConfig(plasmaSwitchboard.HTCACHE_PATH, plasmaSwitchboard.HTCACHE_PATH_DEFAULT);
+ newProxyCachePath = post.get("proxyCache", plasmaSwitchboard.HTCACHE_PATH_DEFAULT);
newProxyCachePath = newProxyCachePath.replace('\\', '/');
if (newProxyCachePath.endsWith("/")) {
newProxyCachePath = newProxyCachePath.substring(0, newProxyCachePath.length() - 1);
}
- final File cache = new File(newProxyCachePath);
+ env.setConfig(plasmaSwitchboard.HTCACHE_PATH, newProxyCachePath);
+ final File cache = env.getConfigPath(plasmaSwitchboard.HTCACHE_PATH, oldProxyCachePath);
if (!cache.isDirectory() && !cache.isFile()) cache.mkdirs();
- env.setConfig("proxyCache", newProxyCachePath);
// proxyCacheSize
oldProxyCacheSize = getStringLong(env.getConfig("proxyCacheSize", "64"));
@@ -169,7 +169,7 @@ public class ProxyIndexingMonitor_p {
prop.put("proxyIndexingRemote", env.getConfig("proxyIndexingRemote", "").equals("true") ? "1" : "0");
prop.put("proxyIndexingLocalText", env.getConfig("proxyIndexingLocalText", "").equals("true") ? "1" : "0");
prop.put("proxyIndexingLocalMedia", env.getConfig("proxyIndexingLocalMedia", "").equals("true") ? "1" : "0");
- prop.put("proxyCache", env.getConfig("proxyCache", "DATA/HTCACHE"));
+ prop.put("proxyCache", env.getConfig(plasmaSwitchboard.HTCACHE_PATH, plasmaSwitchboard.HTCACHE_PATH_DEFAULT));
prop.put("proxyCacheSize", env.getConfig("proxyCacheSize", "64"));
// return rewrite properties
return prop;
diff --git a/htroot/htdocsdefault/dir.java b/htroot/htdocsdefault/dir.java
index f334d8e97..72664764c 100644
--- a/htroot/htdocsdefault/dir.java
+++ b/htroot/htdocsdefault/dir.java
@@ -97,7 +97,7 @@ public class dir {
// variables for this path
// File htroot = new File(switchboard.getRootPath(), switchboard.getConfig("htRootPath", "htroot"));
- final File htroot = new File(switchboard.getRootPath(), switchboard.getConfig("htDocsPath", "DATA/HTDOCS"));
+ final File htroot = switchboard.getConfigPath("htDocsPath", "DATA/HTDOCS");
String path = (String) header.get("PATH", "/");
int pos = path.lastIndexOf("/");
if (pos >= 0) { path = path.substring(0, pos + 1); }
diff --git a/htroot/www/welcome.java b/htroot/www/welcome.java
index 6f778790f..3285a9577 100644
--- a/htroot/www/welcome.java
+++ b/htroot/www/welcome.java
@@ -47,6 +47,7 @@ package www;
// javac -classpath .:../classes index.java
// if the shell's current path is HTROOT
+import java.io.File;
import java.net.InetAddress;
import java.net.UnknownHostException;
@@ -83,10 +84,10 @@ public class welcome {
final boolean senior = (peertype.equals(yacySeed.PEERTYPE_SENIOR)) || (peertype.equals(yacySeed.PEERTYPE_PRINCIPAL));
if (senior) { prop.put("couldcan", "can"); } else { prop.put("couldcan", "could"); }
if (senior) { prop.put("seniorinfo", "This peer runs in senior mode which means that your peer can be accessed using the addresses shown above."); } else { prop.putHTML("seniorinfo", "Nobody can access your peer from the outside of your intranet. You must open your firewall and/or set a 'virtual server' in the settings of your router to enable access to the addresses as shown below."); }
- prop.putHTML("wwwpath", "/" + env.getConfig("htDocsPath", "DATA/HTDOCS"));
+ File wwwpath = env.getConfigPath("htDocsPath", "DATA/HTDOCS");
+ prop.putHTML("wwwpath", wwwpath.isAbsolute() ? wwwpath.getAbsolutePath() : "/" + env.getConfig("htDocsPath", "DATA/HTDOCS"));
// return rewrite properties
return prop;
}
-
}
diff --git a/htroot/yacy/list.java b/htroot/yacy/list.java
index b95d0241c..91cccd224 100644
--- a/htroot/yacy/list.java
+++ b/htroot/yacy/list.java
@@ -79,7 +79,7 @@ public final class list {
if (!yacyNetwork.authentifyRequest(post, env)) return prop;
final String col = post.get("col", "");
- final File listsPath = new File(env.getRootPath(),env.getConfig("listsPath", "DATA/LISTS"));
+ final File listsPath = env.getConfigPath(plasmaSwitchboard.LISTS_PATH, plasmaSwitchboard.LISTS_PATH_DEFAULT);
String otherPeerName = null;
if (post.containsKey("iam")) {
diff --git a/htroot/yacy/message.java b/htroot/yacy/message.java
index bb6258e89..197547c60 100644
--- a/htroot/yacy/message.java
+++ b/htroot/yacy/message.java
@@ -159,7 +159,7 @@ public final class message {
// finally write notification
File notifierSource = new File(sb.getRootPath(), sb.getConfig("htRootPath","htroot") + "/env/grafics/message.gif");
- File notifierDest = new File(sb.getConfig("htDocsPath", "DATA/HTDOCS"), "notifier.gif");
+ File notifierDest = new File(sb.getConfigPath("htDocsPath", "DATA/HTDOCS"), "notifier.gif");
try {
serverFileUtils.copy(notifierSource, notifierDest);
} catch (IOException e) {
diff --git a/source/de/anomic/data/URLFetcherStack.java b/source/de/anomic/data/URLFetcherStack.java
index 42703ad0c..5f9234170 100644
--- a/source/de/anomic/data/URLFetcherStack.java
+++ b/source/de/anomic/data/URLFetcherStack.java
@@ -69,10 +69,8 @@ public class URLFetcherStack {
private int popped = 0;
private int pushed = 0;
- public URLFetcherStack(String path) throws IOException {
- this.db = new kelondroStack(
- new File(path + File.separator + DBFILE),
- rowdef);
+ public URLFetcherStack(File path) throws IOException {
+ this.db = new kelondroStack(new File(path, DBFILE), rowdef);
this.log = new serverLog("URLFETCHERSTACK");
}
diff --git a/source/de/anomic/data/translator.java b/source/de/anomic/data/translator.java
index 941cc964c..0c7deacea 100644
--- a/source/de/anomic/data/translator.java
+++ b/source/de/anomic/data/translator.java
@@ -10,7 +10,7 @@
//
// $LastChangedDate$
// $LastChangedRevision$
-// $LastChangedBy: $
+// $LastChangedBy$
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -257,7 +257,7 @@ public class translator {
}
String htRootPath = env.getConfig("htRootPath", "htroot");
File sourceDir = new File(env.getRootPath(), htRootPath);
- File destDir = new File(env.getConfig("locale.translated_html","DATA/LOCALE/htroot"), lang.substring(0, lang.length() - 4));// cut
+ File destDir = new File(env.getConfigPath("locale.translated_html","DATA/LOCALE/htroot"), lang.substring(0, lang.length() - 4));// cut
// .lng
//File destDir = new File(env.getRootPath(), htRootPath + "/locale/" + lang.substring(0, lang.length() - 4));// cut
// .lng
diff --git a/source/de/anomic/http/httpdFileHandler.java b/source/de/anomic/http/httpdFileHandler.java
index b65050250..385d3f88c 100644
--- a/source/de/anomic/http/httpdFileHandler.java
+++ b/source/de/anomic/http/httpdFileHandler.java
@@ -182,21 +182,21 @@ public final class httpdFileHandler {
// create a htDocsPath: user defined pages
if (htDocsPath == null) {
- htDocsPath = new File(switchboard.getRootPath(), switchboard.getConfig("htDocsPath", "htdocs"));
+ htDocsPath = switchboard.getConfigPath(plasmaSwitchboard.HTDOCS_PATH, plasmaSwitchboard.HTDOCS_PATH_DEFAULT);
if (!(htDocsPath.exists())) htDocsPath.mkdir();
}
// create a htTemplatePath
if (htTemplatePath == null) {
- htTemplatePath = new File(switchboard.getRootPath(), switchboard.getConfig("htTemplatePath","htroot/env/templates"));
+ htTemplatePath = switchboard.getConfigPath("htTemplatePath","htroot/env/templates");
if (!(htTemplatePath.exists())) htTemplatePath.mkdir();
}
//This is now handles by #%env/templates/foo%#
//if (templates.size() == 0) templates.putAll(httpTemplate.loadTemplates(htTemplatePath));
// create htLocaleDefault, htLocalePath
- if (htDefaultPath == null) htDefaultPath = new File(switchboard.getRootPath(), switchboard.getConfig("htDefaultPath","htroot"));
- if (htLocalePath == null) htLocalePath = new File(switchboard.getConfig("locale.translated_html","DATA/LOCALE/htroot"));
+ if (htDefaultPath == null) htDefaultPath = switchboard.getConfigPath("htDefaultPath", "htroot");
+ if (htLocalePath == null) htLocalePath = switchboard.getConfigPath("locale.translated_html", "DATA/LOCALE/htroot");
}
}
@@ -217,8 +217,8 @@ public final class httpdFileHandler {
* @param path relative from htroot
* @param localeSelection language of localized file; locale.language from switchboard is used if localeSelection.equals("") */
public static File getLocalizedFile(String path, String localeSelection){
- if (htDefaultPath == null) htDefaultPath = new File(switchboard.getRootPath(), switchboard.getConfig("htDefaultPath","htroot"));
- if (htLocalePath == null) htLocalePath = new File(switchboard.getRootPath(), switchboard.getConfig("locale.translated_html","DATA/LOCALE/htroot"));
+ if (htDefaultPath == null) htDefaultPath = switchboard.getConfigPath("htDefaultPath","htroot");
+ if (htLocalePath == null) htLocalePath = switchboard.getConfigPath("locale.translated_html","DATA/LOCALE/htroot");
if (!(localeSelection.equals("default"))) {
File localePath = new File(htLocalePath, localeSelection + "/" + path);
diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.java
index dea91a33e..838705cb4 100644
--- a/source/de/anomic/plasma/plasmaSwitchboard.java
+++ b/source/de/anomic/plasma/plasmaSwitchboard.java
@@ -964,20 +964,20 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
long startedSeedListAquisition = System.currentTimeMillis();
// load values from configs
- this.plasmaPath = new File(rootPath, getConfig(DBPATH, DBPATH_DEFAULT));
+ this.plasmaPath = getConfigPath(DBPATH, DBPATH_DEFAULT);
this.log.logConfig("Plasma DB Path: " + this.plasmaPath.toString());
- this.indexPrimaryPath = new File(rootPath, getConfig(INDEX_PRIMARY_PATH, INDEX_PATH_DEFAULT));
+ this.indexPrimaryPath = getConfigPath(INDEX_PRIMARY_PATH, INDEX_PATH_DEFAULT);
this.log.logConfig("Index Primary Path: " + this.indexPrimaryPath.toString());
this.indexSecondaryPath = (getConfig(INDEX_SECONDARY_PATH, "").length() == 0) ? indexPrimaryPath : new File(getConfig(INDEX_SECONDARY_PATH, ""));
this.log.logConfig("Index Secondary Path: " + this.indexSecondaryPath.toString());
- this.listsPath = new File(rootPath, getConfig(LISTS_PATH, LISTS_PATH_DEFAULT));
+ this.listsPath = getConfigPath(LISTS_PATH, LISTS_PATH_DEFAULT);
this.log.logConfig("Lists Path: " + this.listsPath.toString());
- this.htDocsPath = new File(rootPath, getConfig(HTDOCS_PATH, HTDOCS_PATH_DEFAULT));
+ this.htDocsPath = getConfigPath(HTDOCS_PATH, HTDOCS_PATH_DEFAULT);
this.log.logConfig("HTDOCS Path: " + this.htDocsPath.toString());
- this.rankingPath = new File(rootPath, getConfig(RANKING_PATH, RANKING_PATH_DEFAULT));
+ this.rankingPath = getConfigPath(RANKING_PATH, RANKING_PATH_DEFAULT);
this.log.logConfig("Ranking Path: " + this.rankingPath.toString());
this.rankingPermissions = new HashMap(); // mapping of permission - to filename.
- this.workPath = new File(rootPath, getConfig(WORK_PATH, WORK_PATH_DEFAULT));
+ this.workPath = getConfigPath(WORK_PATH, WORK_PATH_DEFAULT);
this.log.logConfig("Work Path: " + this.workPath.toString());
// set up local robots.txt
@@ -1002,7 +1002,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
}
// load the black-list / inspired by [AS]
- File blacklistsPath = new File(getRootPath(), getConfig(LISTS_PATH, LISTS_PATH_DEFAULT));
+ File blacklistsPath = getConfigPath(LISTS_PATH, LISTS_PATH_DEFAULT);
String blacklistClassName = getConfig(BLACKLIST_CLASS, BLACKLIST_CLASS_DEFAULT);
this.log.logConfig("Starting blacklist engine ...");
@@ -1099,14 +1099,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
log.logConfig("Starting HT Cache Manager");
// create the cache directory
- String cache = getConfig(HTCACHE_PATH, HTCACHE_PATH_DEFAULT);
- cache = cache.replace('\\', '/');
- if (cache.endsWith("/")) { cache = cache.substring(0, cache.length() - 1); }
- if (new File(cache).isAbsolute()) {
- htCachePath = new File(cache); // don't use rootPath
- } else {
- htCachePath = new File(rootPath, cache);
- }
+ htCachePath = getConfigPath(HTCACHE_PATH, HTCACHE_PATH_DEFAULT);
this.log.logInfo("HTCACHE Path = " + htCachePath.getAbsolutePath());
long maxCacheSize = 1024 * 1024 * Long.parseLong(getConfig(PROXY_CACHE_SIZE, "2")); // this is megabyte
String cacheLayout = getConfig(PROXY_CACHE_LAYOUT, PROXY_CACHE_LAYOUT_TREE);
@@ -1114,14 +1107,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
plasmaHTCache.init(htCachePath, maxCacheSize, ramHTTP_time, cacheLayout, cacheMigration);
// create the release download directory
- String release = getConfig(RELEASE_PATH, RELEASE_PATH_DEFAULT);
- release = release.replace('\\', '/');
- if (release.endsWith("/")) { release = release.substring(0, release.length() - 1); }
- if (new File(release).isAbsolute()) {
- releasePath = new File(release); // don't use rootPath
- } else {
- releasePath = new File(rootPath, release);
- }
+ releasePath = getConfigPath(RELEASE_PATH, RELEASE_PATH_DEFAULT);
releasePath.mkdirs();
this.log.logInfo("RELEASE Path = " + releasePath.getAbsolutePath());
@@ -1235,7 +1221,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
// init messages: clean up message symbol
File notifierSource = new File(getRootPath(), getConfig(HTROOT_PATH, HTROOT_PATH_DEFAULT) + "/env/grafics/empty.gif");
- File notifierDest = new File(getConfig(HTDOCS_PATH, HTDOCS_PATH_DEFAULT), "notifier.gif");
+ File notifierDest = new File(getConfigPath(HTDOCS_PATH, HTDOCS_PATH_DEFAULT), "notifier.gif");
try {
serverFileUtils.copy(notifierSource, notifierDest);
} catch (IOException e) {
@@ -2072,7 +2058,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
* @return a new File instance
*/
public File getOwnSeedFile() {
- return new File(getRootPath(), getConfig(OWN_SEED_FILE, DBFILE_OWN_SEED));
+ return getConfigPath(OWN_SEED_FILE, DBFILE_OWN_SEED);
}
/**
diff --git a/source/de/anomic/plasma/plasmaWordIndex.java b/source/de/anomic/plasma/plasmaWordIndex.java
index bf16f3c00..e17c28812 100644
--- a/source/de/anomic/plasma/plasmaWordIndex.java
+++ b/source/de/anomic/plasma/plasmaWordIndex.java
@@ -210,12 +210,13 @@ public final class plasmaWordIndex implements indexRI {
}
private void flushCache(indexRAMRI ram, int count) {
+ if (count <= 0) return;
+
busyCacheFlush = true;
String wordHash;
ArrayList containerList = new ArrayList();
synchronized (ram) {
count = Math.min(5000, Math.min(count, ram.size()));
- if (count <= 0) return;
boolean collectMax = true;
indexContainer c;
while (collectMax) {
diff --git a/source/de/anomic/server/logging/serverLog.java b/source/de/anomic/server/logging/serverLog.java
index 5ad30b947..608987f27 100644
--- a/source/de/anomic/server/logging/serverLog.java
+++ b/source/de/anomic/server/logging/serverLog.java
@@ -197,8 +197,12 @@ public final class serverLog {
logManager.readConfiguration(fileIn);
// creating the logging directory
- File log = new File(homePath,"./DATA/LOG/");
- if(!log.canRead()) log.mkdir();
+ String logPattern = logManager.getProperty("java.util.logging.FileHandler.pattern");
+ int stripPos = logPattern.lastIndexOf('/');
+ if (stripPos < 0) stripPos = logPattern.lastIndexOf(File.pathSeparatorChar);
+ File log = new File(logPattern.substring(0, stripPos));
+ if (!log.isAbsolute()) log = new File(homePath, log.getPath());
+ if (!log.canRead()) log.mkdir();
// TODO: changing the pattern settings for the file handlers
diff --git a/source/de/anomic/server/serverAbstractSwitch.java b/source/de/anomic/server/serverAbstractSwitch.java
index 1e604c58e..514a62e5d 100644
--- a/source/de/anomic/server/serverAbstractSwitch.java
+++ b/source/de/anomic/server/serverAbstractSwitch.java
@@ -318,6 +318,28 @@ public abstract class serverAbstractSwitch implements serverSwitch {
public boolean getConfigBool(String key, boolean dflt) {
return Boolean.valueOf(getConfig(key, Boolean.toString(dflt))).booleanValue();
}
+
+ /**
+ * Create a File instance for a configuration setting specifying a path.
+ * @param key config key
+ * @param dflt default path value, that is used when there is no value
+ * key
in the configuration.
+ * @return if the value of the setting is an absolute path String, then the
+ * returned File is derived from this setting only. Otherwise the path's file
+ * is constructed from the applications root path + the relative path setting.
+ */
+ public File getConfigPath(String key, String dflt) {
+ File ret;
+ String path = getConfig(key, dflt).replace('\\', '/');
+ File f = new File(path);
+ if (f == null) {
+ ret = null;
+ } else {
+ ret = (f.isAbsolute() ? f : new File(this.rootPath, path));
+ }
+
+ return ret;
+ }
public Iterator configKeys() {
return configProps.keySet().iterator();
diff --git a/source/de/anomic/server/serverSwitch.java b/source/de/anomic/server/serverSwitch.java
index 9818e5123..619b0222e 100644
--- a/source/de/anomic/server/serverSwitch.java
+++ b/source/de/anomic/server/serverSwitch.java
@@ -49,6 +49,7 @@
package de.anomic.server;
+import java.io.File;
import java.net.InetAddress;
import java.util.Iterator;
import java.util.Map;
@@ -102,6 +103,7 @@ public interface serverSwitch {
public String getConfig(String key, String dflt);
public long getConfigLong(String key, long dflt);
public boolean getConfigBool(String key, boolean dflt);
+ public File getConfigPath(String key, String dflt);
public Iterator configKeys();
public Map getRemoved();
diff --git a/source/de/anomic/yacy/yacyCore.java b/source/de/anomic/yacy/yacyCore.java
index 808475772..9b9b6c70b 100644
--- a/source/de/anomic/yacy/yacyCore.java
+++ b/source/de/anomic/yacy/yacyCore.java
@@ -127,7 +127,7 @@ public class yacyCore {
log = new serverLog("YACY");
// create a yacy db
- yacyDBPath = new File(sb.getRootPath(), sb.getConfig("yacyDB", "DATA/YACYDB"));
+ yacyDBPath = sb.getConfigPath("yacyDB", "DATA/YACYDB");
if (!yacyDBPath.exists()) { yacyDBPath.mkdir(); }
// create or init seed cache
diff --git a/source/migration.java b/source/migration.java
index e8994a492..de4cc8ed7 100644
--- a/source/migration.java
+++ b/source/migration.java
@@ -95,7 +95,7 @@ public class migration {
file.delete();
}
public static void installSkins(plasmaSwitchboard sb){
- final File skinsPath = new File(sb.getRootPath(), sb.getConfig("skinsPath", "DATA/SKINS"));
+ final File skinsPath = sb.getConfigPath("skinPath", "DATA/SKINS");
final File defaultSkinsPath = new File(sb.getRootPath(), "skins");
if(defaultSkinsPath.exists()){
final String[] skinFiles = listManager.getDirListing(defaultSkinsPath.getAbsolutePath());
@@ -112,9 +112,9 @@ public class migration {
if(skin.equals("")){
skin="default";
}
- File skinsDir=new File(sb.getRootPath(), sb.getConfig("skinsPath", "DATA/SKINS"));
+ File skinsDir=sb.getConfigPath("skinPath", "DATA/SKINS");
File skinFile=new File(skinsDir, skin+".css");
- File htdocsPath=new File(sb.getRootPath(), sb.getConfig("htdocsPath", "DATA/HTDOCS")+"/env");
+ File htdocsPath=new File(sb.getConfigPath(plasmaSwitchboard.HTDOCS_PATH, plasmaSwitchboard.HTROOT_PATH_DEFAULT), "env");
File styleFile=new File(htdocsPath, "style.css");
if(!skinFile.exists()){
if(styleFile.exists()){
diff --git a/source/yacy.java b/source/yacy.java
index 2d5d6ffbc..1e7500fa7 100644
--- a/source/yacy.java
+++ b/source/yacy.java
@@ -275,7 +275,7 @@ public final class yacy {
// create some directories
final File htRootPath = new File(homePath, sb.getConfig("htRootPath", "htroot"));
- final File htDocsPath = new File(homePath, sb.getConfig("htDocsPath", "DATA/HTDOCS"));
+ final File htDocsPath = sb.getConfigPath(plasmaSwitchboard.HTDOCS_PATH, plasmaSwitchboard.HTDOCS_PATH_DEFAULT);
if (!(htDocsPath.exists())) htDocsPath.mkdir();
//final File htTemplatePath = new File(homePath, sb.getConfig("htTemplatePath","htdocs"));
@@ -343,8 +343,8 @@ public final class yacy {
}
// Copy the shipped locales into DATA, existing files are overwritten
- final File locale_work = new File(homePath, sb.getConfig("locale.work", "DATA/LOCALE/locales"));
- final File locale_source = new File(homePath, sb.getConfig("locale.source", "locales"));
+ final File locale_work = sb.getConfigPath("locale.work", "DATA/LOCALE/locales");
+ final File locale_source = sb.getConfigPath("locale.source", "locales");
try{
final File[] locale_source_files = locale_source.listFiles();
locale_work.mkdirs();
@@ -366,7 +366,7 @@ public final class yacy {
if (!lang.equals("") && !lang.equals("default")) { //locale is used
String currentRev = "";
try{
- final BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(sb.getConfig("locale.translated_html", "DATA/LOCALE/htroot"), lang+"/version" ))));
+ final BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(sb.getConfigPath("locale.translated_html", "DATA/LOCALE/htroot"), lang+"/version" ))));
currentRev = br.readLine();
br.close();
}catch(IOException e){
@@ -375,7 +375,7 @@ public final class yacy {
if (!currentRev.equals(sb.getConfig("svnRevision", ""))) try { //is this another version?!
final File sourceDir = new File(sb.getConfig("htRootPath", "htroot"));
- final File destDir = new File(sb.getConfig("locale.translated_html", "DATA/LOCALE/htroot"), lang);
+ final File destDir = new File(sb.getConfigPath("locale.translated_html", "DATA/LOCALE/htroot"), lang);
if (translator.translateFilesRecursive(sourceDir, destDir, new File(locale_work, lang + ".lng"), "html,template,inc", "locale")){ //translate it
//write the new Versionnumber
final BufferedWriter bw = new BufferedWriter(new PrintWriter(new FileWriter(new File(destDir, "version"))));
diff --git a/yacy.init b/yacy.init
index 6b9f76986..5cb9c397b 100644
--- a/yacy.init
+++ b/yacy.init
@@ -265,6 +265,9 @@ indexSecondaryPath=
# the path to the LISTS files. Most lists are used to filter web content
listsPath=DATA/LISTS
+# path to additional databases, like messages, blog data and bookmarks
+workPath=DATA/WORK
+
# the path to the SKINS files.
skinPath=DATA/SKINS