Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
refactoring of seed attributes (introduced more constants)
Michael Peter Christenccf2f4e43bdf
diff --git a/htroot/Blog.java b/htroot/Blog.javaindex 9ddbef9ee..1a2ab6eea 100644--- a/htroot/Blog.java+++ b/htroot/Blog.java@@ -45,6 +45,7 @@ import net.yacy.cora.protocol.RequestHeader;import net.yacy.data.BlogBoard;import net.yacy.data.UserDB;import net.yacy.peers.NewsPool;+import net.yacy.peers.Seed;import net.yacy.search.Switchboard;import net.yacy.server.serverObjects;import net.yacy.server.serverSwitch;@@ -112,7 +113,7 @@ public class Blog {if (sb.peers.mySeed() == null) {strAuthor = "anonymous";} else {- strAuthor = sb.peers.mySeed().get("Name", "anonymous");+ strAuthor = sb.peers.mySeed().get(Seed.NAME, "anonymous");}}}diff --git a/htroot/BlogComments.java b/htroot/BlogComments.javaindex d51bb6ff0..7e21a1528 100644--- a/htroot/BlogComments.java+++ b/htroot/BlogComments.java@@ -46,6 +46,7 @@ import net.yacy.data.MessageBoard;import net.yacy.data.UserDB;import net.yacy.data.BlogBoard.BlogEntry;import net.yacy.peers.Network;+import net.yacy.peers.Seed;import net.yacy.search.Switchboard;import net.yacy.server.serverObjects;import net.yacy.server.serverSwitch;@@ -95,7 +96,7 @@ public class BlogComments {if (sb.peers.mySeed() == null) {strAuthor = "anonymous";} else {- strAuthor = sb.peers.mySeed().get("Name", "anonymous");+ strAuthor = sb.peers.mySeed().get(Seed.NAME, "anonymous");}}}diff --git a/htroot/Wiki.java b/htroot/Wiki.javaindex 25a6ea225..b74c76140 100644--- a/htroot/Wiki.java+++ b/htroot/Wiki.java@@ -46,6 +46,7 @@ import net.yacy.cora.util.ByteBuffer;import net.yacy.data.Diff;import net.yacy.data.wiki.WikiBoard;import net.yacy.peers.NewsPool;+import net.yacy.peers.Seed;import net.yacy.search.Switchboard;import net.yacy.server.serverObjects;import net.yacy.server.serverSwitch;@@ -79,7 +80,7 @@ public class Wiki {if (author.equals(ANONYMOUS)) {author = WikiBoard.guessAuthor(ip);if (author == null) {- author = (sb.peers.mySeed() == null) ? ANONYMOUS : sb.peers.mySeed().get("Name", ANONYMOUS);+ author = (sb.peers.mySeed() == null) ? ANONYMOUS : sb.peers.mySeed().get(Seed.NAME, ANONYMOUS);}}diff --git a/source/net/yacy/peers/Network.java b/source/net/yacy/peers/Network.javaindex 2b4935205..502851e51 100644--- a/source/net/yacy/peers/Network.java+++ b/source/net/yacy/peers/Network.java@@ -427,9 +427,9 @@ public class Networktry {final NewsDB.Record record = this.sb.peers.newsPool.myPublication();if ( record == null ) {- this.sb.peers.mySeed().put("news", "");+ this.sb.peers.mySeed().put(Seed.NEWS, "");} else {- this.sb.peers.mySeed().put("news", net.yacy.utils.crypt.simpleEncode(record.toString()));+ this.sb.peers.mySeed().put(Seed.NEWS, net.yacy.utils.crypt.simpleEncode(record.toString()));}} catch (final Exception e ) {log.severe("publishMySeed: problem with news encoding", e);diff --git a/source/net/yacy/peers/PeerActions.java b/source/net/yacy/peers/PeerActions.javaindex c7bc831b4..845b10946 100644--- a/source/net/yacy/peers/PeerActions.java+++ b/source/net/yacy/peers/PeerActions.java@@ -207,7 +207,7 @@ public class PeerActions {if (Network.log.isFine()) Network.log.fine("connect: no contact to a " + peer.get(Seed.PEERTYPE, Seed.PEERTYPE_VIRGIN) + " peer '" + peer.getName() + "' at " + peer.getPublicAddress() + ". Cause: " + cause);synchronized (this.seedDB) {if (!this.seedDB.hasDisconnected(ASCII.getBytes(peer.hash))) { this.disconnects++; }- peer.put("dct", Long.toString(System.currentTimeMillis()));+ peer.put(Seed.DCT, Long.toString(System.currentTimeMillis()));this.seedDB.addDisconnected(peer); // update info}EventChannel.channels(EventChannel.PEERNEWS).addMessage(new RSSMessage(peer.getName() + " left the network", "", ""));@@ -223,7 +223,7 @@ public class PeerActions {}private void processPeerArrival(final Seed peer) {- final String recordString = peer.get("news", null);+ final String recordString = peer.get(Seed.NEWS, null);//System.out.println("### triggered news arrival from peer " + peer.getName() + ", news " + ((recordString == null) ? "empty" : "attached"));if ((recordString == null) || (recordString.isEmpty())) return;final String decodedString = net.yacy.utils.crypt.simpleDecode(recordString);diff --git a/source/net/yacy/peers/Seed.java b/source/net/yacy/peers/Seed.javaindex da2b847f1..2061e1ebd 100644--- a/source/net/yacy/peers/Seed.java+++ b/source/net/yacy/peers/Seed.java@@ -141,7 +141,7 @@ public class Seed implements Cloneable, Comparable<Seed>, Comparator<Seed>/** the name of the peer (user-set) */public static final String NAME = "Name";- private static final String HASH = "Hash";+ public static final String HASH = "Hash";/** Birthday - first startup */private static final String BDATE = "BDate";/** UTC-Offset */@@ -169,6 +169,9 @@ public class Seed implements Cloneable, Comparable<Seed>, Comparator<Seed>public static final String IP = "IP";public static final String PORT = "Port";public static final String SEEDLISTURL = "seedURL";+ public static final String NEWS = "news"; // news attachment+ public static final String DCT = "dct"; // disconnect time+/** zero-value */private static final String ZERO = "0";