Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

copy work tables from defaults/data/work if exist there and not in DATA/WORK This can be used to create start-up behavior work scripts in the api.bheap table

Michael Peter Christen99271ffd1310
diff --git a/source/net/yacy/data/WorkTables.java b/source/net/yacy/data/WorkTables.java
index 4fe3013e1..6069ce98b 100644
--- a/source/net/yacy/data/WorkTables.java
+++ b/source/net/yacy/data/WorkTables.java
@@ -35,7 +35,6 @@ import java.util.Collection;
import java.util.Date;
import java.util.Iterator;
import java.util.LinkedHashMap;
-import java.util.Locale;
import java.util.Map;
import java.util.TreeMap;
diff --git a/source/net/yacy/search/Switchboard.java b/source/net/yacy/search/Switchboard.java
index 480a56c29..0464ee970 100644
--- a/source/net/yacy/search/Switchboard.java
+++ b/source/net/yacy/search/Switchboard.java
@@ -115,7 +115,6 @@ import net.yacy.cora.protocol.TimeoutRequest;
import net.yacy.cora.protocol.http.HTTPClient;
import net.yacy.cora.protocol.http.ProxySettings;
import net.yacy.cora.storage.HandleSet;
-import net.yacy.cora.util.SpaceExceededException;
import net.yacy.crawler.CrawlStacker;
import net.yacy.crawler.CrawlSwitchboard;
import net.yacy.crawler.HarvestProcess;
@@ -338,6 +337,15 @@ public final class Switchboard extends serverSwitch {
this.log.logConfig("HTDOCS Path: " + this.htDocsPath.toString());
this.workPath = getDataPath(SwitchboardConstants.WORK_PATH, SwitchboardConstants.WORK_PATH_DEFAULT);
this.workPath.mkdirs();
+ // if default work files exist, copy them (don't overwrite existing!)
+ File defaultWorkPath = new File("defaults/data/work");
+ for (String fs: defaultWorkPath.list()) {
+ File wf = new File(this.workPath, fs);
+ if (!wf.exists()) {
+ Files.copy(new File(defaultWorkPath, fs), wf);
+ }
+ }
+
this.log.logConfig("Work Path: " + this.workPath.toString());
this.dictionariesPath =
getDataPath(