Skip to content

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

code cleanup

orbiterec2b39c1ceec
diff --git a/source/de/anomic/data/listManager.java b/source/de/anomic/data/listManager.java
index 4106a943c..63a2326ea 100644
--- a/source/de/anomic/data/listManager.java
+++ b/source/de/anomic/data/listManager.java
@@ -242,7 +242,7 @@ public class listManager {
final String f = switchboard.getConfig("proxyBlackListsActive", "");
de.anomic.plasma.plasmaSwitchboard.urlBlacklist.clear();
if (f != "") {
- de.anomic.plasma.plasmaSwitchboard.urlBlacklist.loadLists("black", f, "/");
+ de.anomic.plasma.plasmaSwitchboard.urlBlacklist.loadList(f, "/");
}
// switchboard.urlBlacklist.clear();
// if (f != "") switchboard.urlBlacklist.loadLists("black", f, "/");
diff --git a/source/de/anomic/kelondro/kelondroAbstractRA.java b/source/de/anomic/kelondro/kelondroAbstractRA.java
index 23a070c35..3a36b3c31 100644
--- a/source/de/anomic/kelondro/kelondroAbstractRA.java
+++ b/source/de/anomic/kelondro/kelondroAbstractRA.java
@@ -143,7 +143,8 @@ abstract class kelondroAbstractRA implements kelondroRA {
while (true) {
c = read();
if (c < 0) {
- if (bbsize == 0) return null; else return new String(bb, 0, bbsize);
+ if (bbsize == 0) return null;
+ return new String(bb, 0, bbsize);
}
if (c == cr) continue;
if (c == lf) return new String(bb, 0, bbsize);
diff --git a/source/de/anomic/kelondro/kelondroArray.java b/source/de/anomic/kelondro/kelondroArray.java
index 7a597ff59..98885f19d 100644
--- a/source/de/anomic/kelondro/kelondroArray.java
+++ b/source/de/anomic/kelondro/kelondroArray.java
@@ -95,7 +95,7 @@ public class kelondroArray extends kelondroRecords {
public synchronized int seti(int index, int value) throws IOException {
int before = getHandle(index).hashCode();
- setHandle(index, new Handle(index));
+ setHandle(index, new Handle(value));
return before;
}
diff --git a/source/de/anomic/kelondro/kelondroDynTree.java b/source/de/anomic/kelondro/kelondroDynTree.java
index e29258dc9..bdd822bfb 100644
--- a/source/de/anomic/kelondro/kelondroDynTree.java
+++ b/source/de/anomic/kelondro/kelondroDynTree.java
@@ -170,34 +170,34 @@ public class kelondroDynTree {
protected class treeCache {
private String tablename;
- private Hashtable cache;
+ private Hashtable tcache;
public long timestamp;
treeCache(String tablename) {
this.tablename = tablename;
- this.cache = new Hashtable(); // for key-row relations
+ this.tcache = new Hashtable(); // for key-row relations
this.timestamp = Long.MAX_VALUE; // to flag no-update
}
public byte[][] get(byte[] key) throws IOException {
- byte[][] entry = (byte[][]) cache.get(key);
+ byte[][] entry = (byte[][]) tcache.get(key);
if (entry == null) {
kelondroTree t = getTree(this.tablename);
entry = t.get(key);
t.close();
- this.cache.put(key, entry);
+ this.tcache.put(key, entry);
this.timestamp = System.currentTimeMillis();
}
return entry;
}
protected void put(byte[][] entry) { // this is only used internal
- this.cache.put(entry[0], entry);
+ this.tcache.put(entry[0], entry);
this.timestamp = System.currentTimeMillis();
}
protected void remove(byte[] key) {
- this.cache.remove(key);
+ this.tcache.remove(key);
this.timestamp = System.currentTimeMillis();
}
}
@@ -205,35 +205,35 @@ public class kelondroDynTree {
protected class treeBuffer {
private String tablename;
- private Hashtable buffer;
+ private Hashtable tbuffer;
public long timestamp;
treeBuffer(String tablename) {
this.tablename = tablename;
- this.buffer = new Hashtable(); // for key-row relations
+ this.tbuffer = new Hashtable(); // for key-row relations
this.timestamp = Long.MAX_VALUE; // to flag no-update
}
public void put(byte[][] entry) {
- this.buffer.put(entry[0], entry);
+ this.tbuffer.put(entry[0], entry);
this.timestamp = System.currentTimeMillis();
}
public void remove(byte[] key) {
- this.buffer.remove(key);
+ this.tbuffer.remove(key);
this.timestamp = System.currentTimeMillis();
}
protected void flush() throws IOException {
this.timestamp = System.currentTimeMillis();
- if (this.buffer.size() == 0) return;
- Enumeration e = this.buffer.keys();
+ if (this.tbuffer.size() == 0) return;
+ Enumeration e = this.tbuffer.keys();
kelondroTree t = getTree(this.tablename);
byte[][] entry;
byte[] key;
while (e.hasMoreElements()) {
key = (byte[]) e.nextElement();
- entry = (byte[][]) this.buffer.get(key);
+ entry = (byte[][]) this.tbuffer.get(key);
t.put(entry);
}
t.close();
@@ -327,7 +327,7 @@ public class kelondroDynTree {
tablename = (String) e.nextElement();
tb = (treeBuffer) buffer.get(tablename);
if ((System.currentTimeMillis() - tb.timestamp > this.maxageBuffer) ||
- (tb.buffer.size() > this.maxsizeBuffer) ||
+ (tb.tbuffer.size() > this.maxsizeBuffer) ||
(buffer.size() > this.maxcountBuffer)) {
try {tb.flush();} catch (IOException ee) {}
tb = null;
diff --git a/source/de/anomic/kelondro/kelondroMSetTools.java b/source/de/anomic/kelondro/kelondroMSetTools.java
index 21c0b7594..62fcb764b 100644
--- a/source/de/anomic/kelondro/kelondroMSetTools.java
+++ b/source/de/anomic/kelondro/kelondroMSetTools.java
@@ -356,7 +356,7 @@ public class kelondroMSetTools {
// ------------------------------------------------------------------------------------------------
- public static TreeMap loadMap(String mapname, String filename, String sep) {
+ public static TreeMap loadMap(String filename, String sep) {
TreeMap map = new TreeMap();
BufferedReader br = null;
try {
diff --git a/source/de/anomic/kelondro/kelondroNIOFileRA.java b/source/de/anomic/kelondro/kelondroNIOFileRA.java
index c6ae1b354..91aa02d0c 100644
--- a/source/de/anomic/kelondro/kelondroNIOFileRA.java
+++ b/source/de/anomic/kelondro/kelondroNIOFileRA.java
@@ -91,18 +91,19 @@ public class kelondroNIOFileRA extends kelondroAbstractRA implements kelondroRA
}
private boolean growTail(long newPos) throws IOException {
- if (tailCurrSize >= tailMaxSize) {
+ if (newPos >= tailMaxSize) {
System.out.println("cannot grow " + name);
return false;
}
if (tailCurrSize == 0) {
// first grow
- this.tailCurrSize = tailMaxSize / 10;
+ this.tailCurrSize = newPos;
if (tailCurrSize < 1024) tailCurrSize = 1024;
if (tailCurrSize > tailMaxSize) tailCurrSize = tailMaxSize;
} else {
// next grow
tailCurrSize = tailCurrSize * 2;
+ if (tailCurrSize < newPos) tailCurrSize = newPos;
if (tailCurrSize > tailMaxSize) tailCurrSize = tailMaxSize;
bufferTail.force();
}
diff --git a/source/de/anomic/kelondro/kelondroTree.java b/source/de/anomic/kelondro/kelondroTree.java
index fd08ee181..b12d01011 100644
--- a/source/de/anomic/kelondro/kelondroTree.java
+++ b/source/de/anomic/kelondro/kelondroTree.java
@@ -78,46 +78,44 @@ public class kelondroTree extends kelondroRecords implements Comparator, kelondr
private Search writeSearchObj = new Search();
public kelondroTree(File file, long buffersize, int key, int value) throws IOException {
- this(file, buffersize, new int[] {key, value}, 1, 8);
+ this(file, buffersize, new int[] { key, value }, 1, 8);
}
-
+
public kelondroTree(kelondroRA ra, long buffersize, int key, int value) throws IOException {
- this(ra, buffersize, new int[] {key, value}, 1, 8);
+ this(ra, buffersize, new int[] { key, value }, 1, 8);
}
-
+
public kelondroTree(File file, long buffersize, int[] columns) throws IOException {
- // this creates a new tree file
- this(file, buffersize, columns, columns.length /*txtProps*/, 80 /*txtPropWidth*/);
+ // this creates a new tree file
+ this(file, buffersize, columns, columns.length /* txtProps */, 80 /* txtPropWidth */);
}
- public kelondroTree(File file, long buffersize,
- int[] columns, int txtProps, int txtPropsWidth) throws IOException {
- // this creates a new tree file
- super(file, buffersize,
- thisOHBytes, thisOHHandles,
- columns, thisFHandles, columns.length /*txtProps*/, 80 /*txtPropWidth*/);
- setHandle(root, null); // define the root value
+ public kelondroTree(File file, long buffersize, int[] columns, int txtProps, int txtPropsWidth) throws IOException {
+ // this creates a new tree file
+ super(file, buffersize, thisOHBytes, thisOHHandles, columns, thisFHandles, txtProps, txtPropsWidth);
+ setHandle(root, null); // define the root value
}
public kelondroTree(kelondroRA ra, long buffersize, int[] columns) throws IOException {
- // this creates a new tree within a kelondroRA
- this(ra, buffersize, columns, columns.length /*txtProps*/, 80 /*txtPropWidth*/);
+ // this creates a new tree within a kelondroRA
+ this(ra, buffersize, columns, columns.length /* txtProps */, 80 /* txtPropWidth */);
}
-
+
public kelondroTree(kelondroRA ra, long buffersize, int[] columns, int txtProps, int txtPropsWidth) throws IOException {
- // this creates a new tree within a kelondroRA
- super(ra, buffersize, thisOHBytes, thisOHHandles, columns, thisFHandles, txtProps, txtPropsWidth);
- setHandle(root, null); // define the root value
+ // this creates a new tree within a kelondroRA
+ super(ra, buffersize, thisOHBytes, thisOHHandles, columns,
+ thisFHandles, txtProps, txtPropsWidth);
+ setHandle(root, null); // define the root value
}
-
- public kelondroTree(File file, long buffersize) throws IOException{
- // this opens a file with an existing tree file
- super(file, buffersize);
+
+ public kelondroTree(File file, long buffersize) throws IOException {
+ // this opens a file with an existing tree file
+ super(file, buffersize);
}
- public kelondroTree(kelondroRA ra, long buffersize) throws IOException{
- // this opens a file with an existing tree in a kelondroRA
- super(ra, buffersize);
+ public kelondroTree(kelondroRA ra, long buffersize) throws IOException {
+ // this opens a file with an existing tree in a kelondroRA
+ super(ra, buffersize);
}
public void clear() throws IOException {
diff --git a/source/de/anomic/plasma/plasmaParser.java b/source/de/anomic/plasma/plasmaParser.java
index 37817e8b8..e9c80032d 100644
--- a/source/de/anomic/plasma/plasmaParser.java
+++ b/source/de/anomic/plasma/plasmaParser.java
@@ -443,6 +443,7 @@ public final class plasmaParser {
File tempFile = null;
try {
tempFile = File.createTempFile("parseSource", ".tmp");
+ serverFileUtils.write(source, tempFile);
return parseSource(location, mimeType, tempFile);
} catch (Exception e) {
return null;
diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.java
index ea9c6e503..0abf58cab 100644
--- a/source/de/anomic/plasma/plasmaSwitchboard.java
+++ b/source/de/anomic/plasma/plasmaSwitchboard.java
@@ -266,7 +266,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
urlBlacklist = new plasmaURLPattern(ulrBlackListFile);
String f = getConfig("proxyBlackListsActive", null);
if (f != null) {
- urlBlacklist.loadLists("black", f, "/");
+ urlBlacklist.loadList(f, "/");
this.log.logConfig("loaded black-list from file " + ulrBlackListFile.getName() + ", " +
urlBlacklist.size() + " entries, " +
ppRamString(ulrBlackListFile.length()/1024));
@@ -359,7 +359,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
* initialize switchboard queue
* ====================================================================== */
// create queue
- this.sbQueue = new plasmaSwitchboardQueue(this.cacheManager, this.urlPool.loadedURL, new File(this.plasmaPath, "switchboardQueue1.stack"), 10, this.profiles);
+ this.sbQueue = new plasmaSwitchboardQueue(this.cacheManager, this.urlPool.loadedURL, new File(this.plasmaPath, "switchboardQueue1.stack"), this.profiles);
// setting the indexing queue slots
indexingSlots = (int) getConfigLong("indexer.slots", 100);
diff --git a/source/de/anomic/plasma/plasmaSwitchboardQueue.java b/source/de/anomic/plasma/plasmaSwitchboardQueue.java
index d4cc48519..17499bac4 100644
--- a/source/de/anomic/plasma/plasmaSwitchboardQueue.java
+++ b/source/de/anomic/plasma/plasmaSwitchboardQueue.java
@@ -65,7 +65,7 @@ public class plasmaSwitchboardQueue {
private plasmaHTCache htCache;
private plasmaCrawlLURL lurls;
- public plasmaSwitchboardQueue(plasmaHTCache htCache, plasmaCrawlLURL lurls, File sbQueueStackPath, int bufferkb, plasmaCrawlProfile profiles) throws IOException {
+ public plasmaSwitchboardQueue(plasmaHTCache htCache, plasmaCrawlLURL lurls, File sbQueueStackPath, plasmaCrawlProfile profiles) throws IOException {
this.profiles = profiles;
this.htCache = htCache;
this.lurls = lurls;
diff --git a/source/de/anomic/plasma/plasmaURLPattern.java b/source/de/anomic/plasma/plasmaURLPattern.java
index 30b7092ac..6ae115a5f 100644
--- a/source/de/anomic/plasma/plasmaURLPattern.java
+++ b/source/de/anomic/plasma/plasmaURLPattern.java
@@ -64,13 +64,13 @@ public class plasmaURLPattern {
return hostpaths.size();
}
- public void loadLists(String mapname, String filenames, String sep) {
+ public void loadList(String filenames, String sep) {
// File listsPath = new File(getRootPath(), getConfig("listsPath", "DATA/LISTS"));
final String[] filenamesarray = filenames.split(",");
if( filenamesarray.length > 0) {
for (int i = 0; i < filenamesarray.length; i++) {
- hostpaths.putAll(kelondroMSetTools.loadMap(mapname, (new File(rootPath, filenamesarray[i])).toString(), sep));
+ hostpaths.putAll(kelondroMSetTools.loadMap(new File(rootPath, filenamesarray[i]).toString(), sep));
}
}
}
diff --git a/source/de/anomic/plasma/plasmaWordIndex.java b/source/de/anomic/plasma/plasmaWordIndex.java
index 0b1b60373..67bf819f5 100644
--- a/source/de/anomic/plasma/plasmaWordIndex.java
+++ b/source/de/anomic/plasma/plasmaWordIndex.java
@@ -184,7 +184,7 @@ public final class plasmaWordIndex {
singleHash = (String) i.next();
// retrieve index
- singleEntity = getEntity(singleHash, true, (maxTime < 0) ? -1 : remaining / (wordHashes.size() - entities.size()));
+ singleEntity = getEntity(singleHash, deleteIfEmpty, (maxTime < 0) ? -1 : remaining / (wordHashes.size() - entities.size()));
// check result
if (((singleEntity == null) || (singleEntity.size() == 0)) && (interruptIfEmpty)) return null;
diff --git a/source/de/anomic/plasma/plasmaWordIndexDistribution.java b/source/de/anomic/plasma/plasmaWordIndexDistribution.java
index d353f7d74..3d2f3b86b 100644
--- a/source/de/anomic/plasma/plasmaWordIndexDistribution.java
+++ b/source/de/anomic/plasma/plasmaWordIndexDistribution.java
@@ -489,9 +489,6 @@ public final class plasmaWordIndexDistribution {
}
private class transferIndexWorkerThread extends Thread{
- // connection properties
- private boolean gzipBody = false;
- private int timeout = 60000;
// status fields
private boolean finished = false;
@@ -517,16 +514,12 @@ public final class plasmaWordIndexDistribution {
yacySeed seed,
plasmaWordIndexEntity[] indexEntities,
HashMap urlCache,
- boolean gzipBody,
- int timeout,
long iteration,
int idxCount,
int chunkSize,
String endPointHash,
String startPointHash) {
super(new ThreadGroup("TransferIndexThreadGroup"),"TransferIndexWorker_" + seed.getName());
- this.gzipBody = gzipBody;
- this.timeout = timeout;
this.iteration = iteration;
this.seed = seed;
this.indexEntities = indexEntities;
@@ -592,7 +585,7 @@ public final class plasmaWordIndexDistribution {
// transfering seleted words to remote peer
this.status = "Running: Transfering chunk " + iteration;
- String error = yacyClient.transferIndex(seed, indexEntities, urlCache, this.gzipBody, this.timeout);
+ String error = yacyClient.transferIndex(seed, indexEntities, urlCache, gzipBody, timeout);
if (error == null) {
// words successfully transfered
transferTime = System.currentTimeMillis() - start;
@@ -660,9 +653,6 @@ public final class plasmaWordIndexDistribution {
private yacySeed seed = null;
private boolean delete = false;
private boolean finished = false;
- private boolean gzipBody = false;
- private int timeout = 60000;
- private int maxOpenFiles = 800;
private int transferedEntryCount = 0;
private int transferedEntityCount = 0;
private String status = "Running";
@@ -679,9 +669,9 @@ public final class plasmaWordIndexDistribution {
this.delete = delete;
this.sb = plasmaSwitchboard.getSwitchboard();
this.initialWordsDBSize = sb.wordIndex.size();
- this.gzipBody = "true".equalsIgnoreCase(sb.getConfig("indexTransfer.gzipBody","false"));
- this.timeout = (int) sb.getConfigLong("indexTransfer.timeout",60000);
- this.maxOpenFiles = (int) sb.getConfigLong("indexTransfer.maxOpenFiles",800);
+ //gzipBody = "true".equalsIgnoreCase(sb.getConfig("indexTransfer.gzipBody","false"));
+ //timeout = (int) sb.getConfigLong("indexTransfer.timeout",60000);
+ //this.maxOpenFiles = (int) sb.getConfigLong("indexTransfer.maxOpenFiles",800);
}
public void run() {
@@ -690,7 +680,7 @@ public final class plasmaWordIndexDistribution {
public void stopIt(boolean wait) throws InterruptedException {
this.finished = true;
- this.join();
+ if (wait) this.join();
}
public boolean isFinished() {
@@ -775,7 +765,7 @@ public final class plasmaWordIndexDistribution {
// selecting 500 words to transfer
this.status = "Running: Selecting chunk " + iteration;
- Object[] selectResult = selectTransferIndexes(this.startPointHash, this.chunkSize, this.maxOpenFiles-openedFiles.intValue());
+ Object[] selectResult = selectTransferIndexes(this.startPointHash, this.chunkSize, maxOpenFiles - openedFiles.intValue());
newIndexEntities = (plasmaWordIndexEntity[]) selectResult[0];
HashMap urlCache = (HashMap) selectResult[1]; // String (url-hash) / plasmaCrawlLURL.Entry
openedFiles = (Integer) selectResult[2];
@@ -877,7 +867,7 @@ public final class plasmaWordIndexDistribution {
// handover chunk to transfer worker
if (!((newIndexEntities == null) || (newIndexEntities.length == 0))) {
- worker = new transferIndexWorkerThread(seed,newIndexEntities,urlCache,gzipBody,timeout,iteration,idxCount,idxCount,startPointHash,oldStartingPointHash);
+ worker = new transferIndexWorkerThread(seed,newIndexEntities,urlCache,iteration,idxCount,idxCount,startPointHash,oldStartingPointHash);
worker.start();
}
}
diff --git a/source/de/anomic/server/serverAbstractSwitch.java b/source/de/anomic/server/serverAbstractSwitch.java
index a20fa4e48..86cbd1cf1 100644
--- a/source/de/anomic/server/serverAbstractSwitch.java
+++ b/source/de/anomic/server/serverAbstractSwitch.java
@@ -49,7 +49,7 @@ import java.util.Map;
import java.util.TreeMap;
import de.anomic.server.logging.serverLog;
-import de.anomic.yacy.yacyVersion;
+import de.anomic.server.serverAbstractSwitch;
public abstract class serverAbstractSwitch implements serverSwitch {
@@ -65,64 +65,88 @@ public abstract class serverAbstractSwitch implements serverSwitch {
protected int serverJobs;
public serverAbstractSwitch(String rootPath, String initPath, String configPath) throws IOException {
- // we initialize the switchboard with a property file,
- // but maintain these properties then later in a new 'config' file
- // to reset all changed configs, the config file must
- // be deleted, but not the init file
- // the only attribute that will always be read from the init is the
- // file name of the config file
+ // we initialize the switchboard with a property file,
+ // but maintain these properties then later in a new 'config' file
+ // to reset all changed configs, the config file must
+ // be deleted, but not the init file
+ // the only attribute that will always be read from the init is the
+ // file name of the config file
this.rootPath = rootPath;
- configComment = "This is an automatically generated file, updated by serverAbstractSwitch and initialized by " + initPath;
- File initFile = new File(rootPath, initPath);
- configFile = new File(rootPath, configPath); //propertiesFile(config);
- new File(configFile.getParent()).mkdir();
-
- // predefine init's
- Map initProps, removedProps = new HashMap();
- if (initFile.exists()) initProps = serverFileUtils.loadHashMap(initFile); else initProps = new HashMap();
-
- // load config's from last save
- if (configFile.exists()) configProps = serverFileUtils.loadHashMap(configFile); else configProps = new HashMap();
-
- synchronized (configProps) {
-
- // remove all values from config that do not appear in init (out-dated settings)
- Iterator i = configProps.keySet().iterator();
- String key;
- while (i.hasNext()) {
- key = (String) i.next();
- if (!(initProps.containsKey(key))) {
- removedProps.put(key,this.configProps.get(key));
- i.remove();
+ configComment = "This is an automatically generated file, updated by serverAbstractSwitch and initialized by " + initPath;
+ File initFile = new File(rootPath, initPath);
+ configFile = new File(rootPath, configPath); // propertiesFile(config);
+ new File(configFile.getParent()).mkdir();
+
+ // predefine init's
+ Map initProps, removedProps = new HashMap();
+ if (initFile.exists())
+ initProps = serverFileUtils.loadHashMap(initFile);
+ else
+ initProps = new HashMap();
+
+ // load config's from last save
+ if (configFile.exists())
+ configProps = serverFileUtils.loadHashMap(configFile);
+ else
+ configProps = new HashMap();
+
+ synchronized (configProps) {
+ // remove all values from config that do not appear in init
+ // (out-dated settings)
+ Iterator i = configProps.keySet().iterator();
+ String key;
+ while (i.hasNext()) {
+ key = (String) i.next();
+ 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);
- if(migratedSettings!=null) configProps.putAll(migratedSettings);
-
- // merge new props from init to config
- // this is necessary for migration, when new properties are attached
- initProps.putAll(configProps);
- configProps = initProps;
-
- // save result; this may initially create a config file after initialization
- saveConfig();
- }
+ // doing a config settings migration
+ //HashMap migratedSettings = migrateSwitchConfigSettings((HashMap) removedProps);
+ //if (migratedSettings != null) configProps.putAll(migratedSettings);
+
+ // merge new props from init to config
+ // this is necessary for migration, when new properties are attached
+ initProps.putAll(configProps);
+ configProps = initProps;
+
+ // save result; this may initially create a config file after
+ // initialization
+ saveConfig();
+ }
+
+ // other settings
+ authorization = new HashMap();
- // other settings
- authorization = new HashMap();
-
// init thread control
workerThreads = new TreeMap();
-
+
// init switch actions
- switchActions = new TreeMap();
+ switchActions = new TreeMap();
// init busy state control
serverJobs = 0;
}
+ /*
+ public static HashMap migrateSwitchConfigSettings(HashMap removedSettings) {
+ if ((removedSettings == null) || (removedSettings.size() == 0)) return null;
+ HashMap migratedSettings = new HashMap();
+
+ if (removedSettings.containsKey("parseableMimeTypes")) {
+ String value = (String) removedSettings.get("parseableMimeTypes");
+ migratedSettings.put("parseableMimeTypes.CRAWLER", value);
+ migratedSettings.put("parseableMimeTypes.PROXY", value);
+ migratedSettings.put("parseableMimeTypes.URLREDIRECTOR", value);
+ migratedSettings.put("parseableMimeTypes.ICAP", value);
+ }
+
+ return migratedSettings;
+ }
+ */
+
// a logger for this switchboard
public void setLog(serverLog log) {
this.log = log;
diff --git a/source/de/anomic/yacy/yacyVersion.java b/source/de/anomic/yacy/yacyVersion.java
index 8e053354d..b4f671743 100644
--- a/source/de/anomic/yacy/yacyVersion.java
+++ b/source/de/anomic/yacy/yacyVersion.java
@@ -1,64 +1,7 @@
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 {
public static final float YACY_SUPPORTS_PORT_FORWARDING = (float) 0.383;
public static final float YACY_SUPPORTS_GZIP_POST_REQUESTS = (float) 0.40300772;
public static final float YACY_ACCEPTS_RANKING_TRANSMISSION = (float) 0.414;
-
- public static void migrate(plasmaSwitchboard sb){
- //set preset accounts/passwords
- String acc;
- if ((acc = sb.getConfig("serverAccount", "")).length() > 0) {
- sb.setConfig("serverAccountBase64MD5", de.anomic.server.serverCodings.encodeMD5Hex(serverCodings.standardCoder.encodeBase64String(acc)));
- sb.setConfig("serverAccount", "");
- }
- if ((acc = sb.getConfig("adminAccount", "")).length() > 0) {
- sb.setConfig("adminAccountBase64MD5", de.anomic.server.serverCodings.encodeMD5Hex(serverCodings.standardCoder.encodeBase64String(acc)));
- sb.setConfig("adminAccount", "");
- }
-
- // fix unsafe old passwords
- if ((acc = sb.getConfig("proxyAccountBase64", "")).length() > 0) {
- sb.setConfig("proxyAccountBase64MD5", de.anomic.server.serverCodings.encodeMD5Hex(acc));
- sb.setConfig("proxyAccountBase64", "");
- }
- if ((acc = sb.getConfig("serverAccountBase64", "")).length() > 0) {
- sb.setConfig("serverAccountBase64MD5", de.anomic.server.serverCodings.encodeMD5Hex(acc));
- sb.setConfig("serverAccountBase64", "");
- }
- if ((acc = sb.getConfig("adminAccountBase64", "")).length() > 0) {
- sb.setConfig("adminAccountBase64MD5", de.anomic.server.serverCodings.encodeMD5Hex(acc));
- sb.setConfig("adminAccountBase64", "");
- }
- if ((acc = sb.getConfig("uploadAccountBase64", "")).length() > 0) {
- sb.setConfig("uploadAccountBase64MD5", de.anomic.server.serverCodings.encodeMD5Hex(acc));
- sb.setConfig("uploadAccountBase64", "");
- }
- if ((acc = sb.getConfig("downloadAccountBase64", "")).length() > 0) {
- sb.setConfig("downloadAccountBase64MD5", de.anomic.server.serverCodings.encodeMD5Hex(acc));
- sb.setConfig("downloadAccountBase64", "");
- }
- }
-
- public static HashMap migrateSwitchboardConfigSettings(serverAbstractSwitch sb, HashMap removedSettings) {
- if ((removedSettings == null)||(removedSettings.size() == 0)) return null;
- HashMap migratedSettings = new HashMap();
-
- if (removedSettings.containsKey("parseableMimeTypes")) {
- String value = (String) removedSettings.get("parseableMimeTypes");
- migratedSettings.put("parseableMimeTypes.CRAWLER", value);
- migratedSettings.put("parseableMimeTypes.PROXY", value);
- migratedSettings.put("parseableMimeTypes.URLREDIRECTOR", value);
- migratedSettings.put("parseableMimeTypes.ICAP", value);
- }
-
- return migratedSettings;
-
- }
}
diff --git a/source/de/anomic/ymage/ymagePNGEncoderJDE.java b/source/de/anomic/ymage/ymagePNGEncoderJDE.java
index 6284a8d0d..62d5c0087 100644
--- a/source/de/anomic/ymage/ymagePNGEncoderJDE.java
+++ b/source/de/anomic/ymage/ymagePNGEncoderJDE.java
@@ -93,7 +93,7 @@ public class ymagePNGEncoderJDE extends Object
* @param encodeAlpha boolean false=no alpha, true=encode alpha
* @return an array of bytes, or null if there was a problem
*/
- public byte[] pngEncode( boolean encodeAlpha )
+ public byte[] pngEncode()
{
byte[] pngIdBytes = { -119, 80, 78, 71, 13, 10, 26, 10 };
@@ -131,17 +131,6 @@ public class ymagePNGEncoderJDE extends Object
return pngBytes;
}
- /**
- * Creates an array of bytes that is the PNG equivalent of the current image.
- * Alpha encoding is determined by its setting in the constructor.
- *
- * @return an array of bytes, or null if there was a problem
- */
- public byte[] pngEncode()
- {
- return pngEncode( encodeAlpha );
- }
-
/**
* Set the alpha encoding on or off.
*
diff --git a/source/yacy.java b/source/yacy.java
index 013c600b8..b6ef7c732 100644
--- a/source/yacy.java
+++ b/source/yacy.java
@@ -76,6 +76,7 @@ import de.anomic.plasma.plasmaWordIndexClassicDB;
import de.anomic.plasma.plasmaWordIndexEntity;
import de.anomic.plasma.plasmaWordIndexEntry;
import de.anomic.plasma.plasmaWordIndexEntryContainer;
+import de.anomic.server.serverCodings;
import de.anomic.server.serverCore;
import de.anomic.server.serverDate;
import de.anomic.server.serverFileUtils;
@@ -84,7 +85,6 @@ import de.anomic.server.logging.serverLog;
import de.anomic.tools.enumerateFiles;
import de.anomic.yacy.yacyClient;
import de.anomic.yacy.yacyCore;
-import de.anomic.yacy.yacyVersion;
/**
* This is the main class of the proxy. Several threads are started from here:
@@ -164,6 +164,41 @@ public final class yacy {
return (float) (((double) v * 100000000.0 + ((double) svn)) / 100000000.0);
}
+ public static void presetPasswords(plasmaSwitchboard sb) {
+ // set preset accounts/passwords
+ String acc;
+ if ((acc = sb.getConfig("serverAccount", "")).length() > 0) {
+ sb.setConfig("serverAccountBase64MD5", de.anomic.server.serverCodings.encodeMD5Hex(serverCodings.standardCoder.encodeBase64String(acc)));
+ sb.setConfig("serverAccount", "");
+ }
+ if ((acc = sb.getConfig("adminAccount", "")).length() > 0) {
+ sb.setConfig("adminAccountBase64MD5", de.anomic.server.serverCodings.encodeMD5Hex(serverCodings.standardCoder.encodeBase64String(acc)));
+ sb.setConfig("adminAccount", "");
+ }
+
+ // fix unsafe old passwords
+ if ((acc = sb.getConfig("proxyAccountBase64", "")).length() > 0) {
+ sb.setConfig("proxyAccountBase64MD5", de.anomic.server.serverCodings.encodeMD5Hex(acc));
+ sb.setConfig("proxyAccountBase64", "");
+ }
+ if ((acc = sb.getConfig("serverAccountBase64", "")).length() > 0) {
+ sb.setConfig("serverAccountBase64MD5", de.anomic.server.serverCodings.encodeMD5Hex(acc));
+ sb.setConfig("serverAccountBase64", "");
+ }
+ if ((acc = sb.getConfig("adminAccountBase64", "")).length() > 0) {
+ sb.setConfig("adminAccountBase64MD5", de.anomic.server.serverCodings.encodeMD5Hex(acc));
+ sb.setConfig("adminAccountBase64", "");
+ }
+ if ((acc = sb.getConfig("uploadAccountBase64", "")).length() > 0) {
+ sb.setConfig("uploadAccountBase64MD5", de.anomic.server.serverCodings.encodeMD5Hex(acc));
+ sb.setConfig("uploadAccountBase64", "");
+ }
+ if ((acc = sb.getConfig("downloadAccountBase64", "")).length() > 0) {
+ sb.setConfig("downloadAccountBase64MD5", de.anomic.server.serverCodings.encodeMD5Hex(acc));
+ sb.setConfig("downloadAccountBase64", "");
+ }
+ }
+
/**
* Starts up the whole application. Sets up all datastructures and starts
* the main threads.
@@ -323,8 +358,8 @@ public final class yacy {
serverFileUtils.copy(new File(htRootPath, "htdocsdefault/dir.html"), new File(shareDefaultPath, "dir.html"));
//} catch (IOException e) {}
-
- yacyVersion.migrate(sb);
+ presetPasswords(sb);
+
// start main threads
try {
final httpd protocolHandler = new httpd(sb, new httpdFileHandler(sb), new httpdProxyHandler(sb));