*) Adding possibility to do a settings migration on yacy startup

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1149 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
theli 20 years ago
parent eb9daccfd2
commit b604654c25

@ -49,6 +49,7 @@ import java.util.Map;
import java.util.TreeMap;
import de.anomic.server.logging.serverLog;
import de.anomic.yacy.yacyVersion;
public abstract class serverAbstractSwitch implements serverSwitch {
@ -77,7 +78,7 @@ public abstract class serverAbstractSwitch implements serverSwitch {
new File(configFile.getParent()).mkdir();
// predefine init's
Map initProps;
Map initProps, removedProps = new HashMap();
if (initFile.exists()) initProps = serverFileUtils.loadHashMap(initFile); else initProps = new HashMap();
// load config's from last save
@ -90,8 +91,15 @@ public abstract class serverAbstractSwitch implements serverSwitch {
String key;
while (i.hasNext()) {
key = (String) i.next();
if (!(initProps.containsKey(key))) i.remove();
if (!(initProps.containsKey(key))) {
removedProps.put(key,this.configProps.get(key));
i.remove();
}
}
// doing a config settings migration
HashMap migratedSettings = yacyVersion.migrateSwitchboardConfigSettings(this,(HashMap) removedProps);
configProps.putAll(migratedSettings);
// merge new props from init to config
// this is necessary for migration, when new properties are attached

@ -1,6 +1,9 @@
package de.anomic.yacy;
import java.util.HashMap;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.server.serverAbstractSwitch;
import de.anomic.server.serverCodings;
public final class yacyVersion {
@ -42,4 +45,12 @@ public final class yacyVersion {
sb.setConfig("downloadAccountBase64", "");
}
}
public static HashMap migrateSwitchboardConfigSettings(serverAbstractSwitch sb, HashMap removedSettings) {
if ((removedSettings == null)||(removedSettings.size() == 0)) return null;
HashMap migratedSettings = new HashMap();
return migratedSettings;
}
}

Loading…
Cancel
Save