Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
refactoring
orbitera7df70221e44
diff --git a/htroot/AccessTracker_p.java b/htroot/AccessTracker_p.javaindex 1b536c773..8aea5239a 100644--- a/htroot/AccessTracker_p.java+++ b/htroot/AccessTracker_p.java@@ -38,7 +38,7 @@ import java.text.SimpleDateFormat;import net.yacy.cora.protocol.Domains;import net.yacy.cora.protocol.HeaderFramework;import net.yacy.cora.protocol.RequestHeader;-import net.yacy.peers.yacySeed;+import net.yacy.peers.Seed;import net.yacy.search.Switchboard;import net.yacy.search.query.AccessTracker;import net.yacy.search.query.QueryParams;@@ -267,7 +267,7 @@ public class AccessTracker_p {prop.put("page_list_" + m + "_dark", ((dark) ? 1 : 0) ); dark =! dark;prop.putHTML("page_list_" + m + "_host", host);if (page == 5) {- final yacySeed remotepeer = sb.peers.lookupByIP(Domains.dnsResolve(host), true, true, true);+ final Seed remotepeer = sb.peers.lookupByIP(Domains.dnsResolve(host), true, true, true);prop.putHTML("page_list_" + m + "_peername", (remotepeer == null) ? "UNKNOWN" : remotepeer.getName());}prop.putNum("page_list_" + m + "_count", handles.size());diff --git a/htroot/Banner.java b/htroot/Banner.javaindex ab2ed2b6a..8b95d6ea4 100644--- a/htroot/Banner.java+++ b/htroot/Banner.java@@ -32,7 +32,7 @@ import java.io.IOException;import javax.imageio.ImageIO;import net.yacy.cora.protocol.RequestHeader;-import net.yacy.peers.yacySeed;+import net.yacy.peers.Seed;import net.yacy.peers.graphics.NetworkGraph;import net.yacy.search.Switchboard;import net.yacy.search.SwitchboardConstants;@@ -74,9 +74,9 @@ public class Banner {long nppm = sb.peers.countActivePPM();double nqph = 0;- final yacySeed seed = sb.peers.mySeed();+ final Seed seed = sb.peers.mySeed();if (seed != null){- name = seed.get(yacySeed.NAME, "-").toUpperCase();+ name = seed.get(Seed.NAME, "-").toUpperCase();links = seed.getLinkCount();words = seed.getWordCount();myppm = seed.getPPM();diff --git a/htroot/BlacklistImpExp_p.java b/htroot/BlacklistImpExp_p.javaindex bc6e7d985..7822c7f15 100644--- a/htroot/BlacklistImpExp_p.java+++ b/htroot/BlacklistImpExp_p.java@@ -40,7 +40,7 @@ import java.util.List;import net.yacy.cora.protocol.RequestHeader;import net.yacy.kelondro.util.FileUtils;-import net.yacy.peers.yacySeed;+import net.yacy.peers.Seed;import net.yacy.search.Switchboard;public class BlacklistImpExp_p {@@ -70,10 +70,10 @@ public class BlacklistImpExp_p {int peerCount = 0;try {final TreeMap<String, String> hostList = new TreeMap<String, String>();- final Iterator<yacySeed> e = sb.peers.seedsConnected(true, false, null, (float) 0.0);+ final Iterator<Seed> e = sb.peers.seedsConnected(true, false, null, (float) 0.0);while (e.hasNext()) {- final yacySeed seed = e.next();- if (seed != null) hostList.put(seed.get(yacySeed.NAME, "nameless"),seed.hash);+ final Seed seed = e.next();+ if (seed != null) hostList.put(seed.get(Seed.NAME, "nameless"),seed.hash);}String peername;diff --git a/htroot/Blog.java b/htroot/Blog.javaindex 7c6a5c3d0..7ee5a0c3f 100644--- a/htroot/Blog.java+++ b/htroot/Blog.java@@ -39,7 +39,7 @@ import java.util.Locale;import net.yacy.cora.document.UTF8;import net.yacy.cora.protocol.HeaderFramework;import net.yacy.cora.protocol.RequestHeader;-import net.yacy.peers.yacyNewsPool;+import net.yacy.peers.NewsPool;import net.yacy.search.Switchboard;import de.anomic.data.BlogBoard;@@ -163,7 +163,7 @@ public class Blog {map.put("page", pagename);map.put("subject", StrSubject.replace(',', ' '));map.put("author", StrAuthor.replace(',', ' '));- sb.peers.newsPool.publishMyNews(sb.peers.mySeed(), yacyNewsPool.CATEGORY_BLOG_ADD, map);+ sb.peers.newsPool.publishMyNews(sb.peers.mySeed(), NewsPool.CATEGORY_BLOG_ADD, map);}}diff --git a/htroot/BlogComments.java b/htroot/BlogComments.javaindex fa0706c77..4e08a02da 100644--- a/htroot/BlogComments.java+++ b/htroot/BlogComments.java@@ -42,7 +42,7 @@ import net.yacy.cora.protocol.HeaderFramework;import net.yacy.cora.protocol.RequestHeader;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.util.FileUtils;-import net.yacy.peers.yacyCore;+import net.yacy.peers.Network;import net.yacy.search.Switchboard;import de.anomic.data.BlogBoard;@@ -322,7 +322,7 @@ public class BlogComments {email.print(new String(emailTxt));email.close();} catch (final Exception e) {- yacyCore.log.logWarning("message: message forwarding via email failed. ",e);+ Network.log.logWarning("message: message forwarding via email failed. ",e);}}}diff --git a/htroot/Bookmarks.java b/htroot/Bookmarks.javaindex 4e03d8625..a4150627b 100644--- a/htroot/Bookmarks.java+++ b/htroot/Bookmarks.java@@ -48,7 +48,7 @@ import net.yacy.document.Parser;import net.yacy.kelondro.data.meta.DigestURI;import net.yacy.kelondro.data.meta.URIMetadataRow;import net.yacy.kelondro.logging.Log;-import net.yacy.peers.yacyNewsPool;+import net.yacy.peers.NewsPool;import net.yacy.search.Switchboard;import net.yacy.search.index.Segments;import de.anomic.data.BookmarkHelper;@@ -458,7 +458,7 @@ public class Bookmarks {map.put("title", title.replace(',', ' '));map.put("description", description.replace(',', ' '));map.put("tags", tagsString.replace(',', ' '));- sb.peers.newsPool.publishMyNews(sb.peers.mySeed(), yacyNewsPool.CATEGORY_BOOKMARK_ADD, map);+ sb.peers.newsPool.publishMyNews(sb.peers.mySeed(), NewsPool.CATEGORY_BOOKMARK_ADD, map);}}diff --git a/htroot/ConfigBasic.java b/htroot/ConfigBasic.javaindex c0772dcc3..0be220281 100644--- a/htroot/ConfigBasic.java+++ b/htroot/ConfigBasic.java@@ -37,7 +37,7 @@ import net.yacy.cora.protocol.Domains;import net.yacy.cora.protocol.HeaderFramework;import net.yacy.cora.protocol.RequestHeader;import net.yacy.kelondro.workflow.InstantBusyThread;-import net.yacy.peers.yacySeed;+import net.yacy.peers.Seed;import net.yacy.search.Switchboard;import net.yacy.search.SwitchboardConstants;@@ -101,7 +101,7 @@ public class ConfigBasic {}// check if peer name already exists- final yacySeed oldSeed = sb.peers.lookupByName(peerName);+ final Seed oldSeed = sb.peers.lookupByName(peerName);if (oldSeed == null &&!peerName.equals(sb.peers.mySeed().getName()) &&Pattern.compile("[A-Za-z0-9\\-_]{3,80}").matcher(peerName).matches()) {@@ -218,7 +218,7 @@ public class ConfigBasic {// check if values are properfinal boolean properPassword = (sb.getConfig(SwitchboardConstants.ADMIN_ACCOUNT_B64MD5, "").length() > 0) || sb.getConfigBool("adminAccountForLocalhost", false);- final boolean properName = (sb.peers.mySeed().getName().length() >= 3) && (!(yacySeed.isDefaultPeerName(sb.peers.mySeed().getName())));+ final boolean properName = (sb.peers.mySeed().getName().length() >= 3) && (!(Seed.isDefaultPeerName(sb.peers.mySeed().getName())));final boolean properPort = (sb.peers.mySeed().isSenior()) || (sb.peers.mySeed().isPrincipal());if ((env.getConfig("defaultFiles", "").startsWith("ConfigBasic.html,"))) {diff --git a/htroot/ConfigProfile_p.java b/htroot/ConfigProfile_p.javaindex a9e134156..0cb66916f 100644--- a/htroot/ConfigProfile_p.java+++ b/htroot/ConfigProfile_p.java@@ -36,7 +36,7 @@ import java.io.IOException;import java.util.Properties;import net.yacy.cora.protocol.RequestHeader;-import net.yacy.peers.yacyNewsPool;+import net.yacy.peers.NewsPool;import net.yacy.search.Switchboard;import de.anomic.server.serverObjects;@@ -94,7 +94,7 @@ public class ConfigProfile_p {// generate a news messagefinal Properties news = profile;news.remove("comment");- sb.peers.newsPool.publishMyNews(sb.peers.mySeed(), yacyNewsPool.CATEGORY_PROFILE_UPDATE, news);+ sb.peers.newsPool.publishMyNews(sb.peers.mySeed(), NewsPool.CATEGORY_PROFILE_UPDATE, news);//yacyCore.newsPool.publishMyNews(new yacyNewsRecord(yacyNewsRecord.CATEGORY_PROFILE_UPDATE, profile));} catch(final IOException e) {} finally {diff --git a/htroot/Connections_p.java b/htroot/Connections_p.javaindex 0be61ccc0..524db3d89 100644--- a/htroot/Connections_p.java+++ b/htroot/Connections_p.java@@ -36,8 +36,8 @@ import net.yacy.cora.protocol.ConnectionInfo;import net.yacy.cora.protocol.RequestHeader;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.workflow.WorkflowThread;-import net.yacy.peers.yacyPeerActions;-import net.yacy.peers.yacySeed;+import net.yacy.peers.PeerActions;+import net.yacy.peers.Seed;import net.yacy.search.Switchboard;//import de.anomic.http.client.ConnectionInfo;@@ -96,11 +96,11 @@ public final class Connections_p {String prot = "http"; // only httpd sessions listed// determining if the source is a yacy host- yacySeed seed = null;+ Seed seed = null;if (doNameLookup) {seed = sb.peers.lookupByIP(userAddress,true,false,false);if (seed != null && (seed.hash.equals(sb.peers.mySeed().hash)) &&- (!seed.get(yacySeed.PORT,"").equals(Integer.toString(userPort)))) {+ (!seed.get(Seed.PORT,"").equals(Integer.toString(userPort)))) {seed = null;}}@@ -117,7 +117,7 @@ public final class Connections_p {prop.put("list_" + idx + "_proto", prot);if (sessionTime > 1000*60) {prop.put("list_" + idx + "_ms", "0");- prop.put("list_" + idx + "_ms_duration",yacyPeerActions.formatInterval(sessionTime));+ prop.put("list_" + idx + "_ms_duration",PeerActions.formatInterval(sessionTime));} else {prop.put("list_" + idx + "_ms", "1");prop.putNum("list_" + idx + "_ms_duration", sessionTime);diff --git a/htroot/CrawlMonitorRemoteStart.java b/htroot/CrawlMonitorRemoteStart.javaindex dc48cc84b..48352e218 100644--- a/htroot/CrawlMonitorRemoteStart.java+++ b/htroot/CrawlMonitorRemoteStart.java@@ -27,9 +27,9 @@import java.util.Iterator;import net.yacy.cora.protocol.RequestHeader;-import net.yacy.peers.yacyNewsDB;-import net.yacy.peers.yacyNewsPool;-import net.yacy.peers.yacySeed;+import net.yacy.peers.NewsDB;+import net.yacy.peers.NewsPool;+import net.yacy.peers.Seed;import net.yacy.search.Switchboard;import de.anomic.server.serverObjects;@@ -45,17 +45,17 @@ public class CrawlMonitorRemoteStart {boolean dark = true;// create other peer crawl table using YaCyNews- Iterator<yacyNewsDB.Record> recordIterator = sb.peers.newsPool.recordIterator(yacyNewsPool.INCOMING_DB, true);+ Iterator<NewsDB.Record> recordIterator = sb.peers.newsPool.recordIterator(NewsPool.INCOMING_DB, true);int showedCrawl = 0;- yacyNewsDB.Record record;- yacySeed peer;+ NewsDB.Record record;+ Seed peer;String peername;while (recordIterator.hasNext()) {record = recordIterator.next();if (record == null) {continue;}- if (record.category().equals(yacyNewsPool.CATEGORY_CRAWL_START)) {+ if (record.category().equals(NewsPool.CATEGORY_CRAWL_START)) {peer = sb.peers.get(record.originator());peername = (peer == null) ? record.originator() : peer.getName();@@ -75,14 +75,14 @@ public class CrawlMonitorRemoteStart {prop.put("otherCrawlStartInProgress", showedCrawl);// finished remote crawls- recordIterator = sb.peers.newsPool.recordIterator(yacyNewsPool.PROCESSED_DB, true);+ recordIterator = sb.peers.newsPool.recordIterator(NewsPool.PROCESSED_DB, true);showedCrawl = 0;while (recordIterator.hasNext()) {record = recordIterator.next();if (record == null) {continue;}- if (record.category().equals(yacyNewsPool.CATEGORY_CRAWL_START)) {+ if (record.category().equals(NewsPool.CATEGORY_CRAWL_START)) {peer = sb.peers.get(record.originator());peername = (peer == null) ? record.originator() : peer.getName();diff --git a/htroot/CrawlResults.java b/htroot/CrawlResults.javaindex 405729118..7dc454943 100644--- a/htroot/CrawlResults.java+++ b/htroot/CrawlResults.java@@ -37,7 +37,7 @@ import net.yacy.cora.protocol.RequestHeader;import net.yacy.kelondro.data.meta.DigestURI;import net.yacy.kelondro.data.meta.URIMetadataRow;import net.yacy.kelondro.logging.Log;-import net.yacy.peers.yacySeed;+import net.yacy.peers.Seed;import net.yacy.search.Switchboard;import net.yacy.search.index.Segments;import de.anomic.crawler.ResultURLs;@@ -178,7 +178,7 @@ public class CrawlResults {boolean dark = true;String urlstr, urltxt;- yacySeed initiatorSeed, executorSeed;+ Seed initiatorSeed, executorSeed;URIMetadataRow urle;URIMetadataRow.Components metadata;diff --git a/htroot/Crawler_p.java b/htroot/Crawler_p.javaindex 8298bcae1..a67ffd613 100644--- a/htroot/Crawler_p.java+++ b/htroot/Crawler_p.java@@ -47,7 +47,7 @@ import net.yacy.document.parser.html.TransformerWriter;import net.yacy.kelondro.data.meta.DigestURI;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.util.FileUtils;-import net.yacy.peers.yacyNewsPool;+import net.yacy.peers.NewsPool;import net.yacy.search.Switchboard;import net.yacy.search.SwitchboardConstants;import net.yacy.search.index.Segment;@@ -383,7 +383,7 @@ public class Crawler_p {m.remove("generalFilter");m.remove("specificFilter");m.put("intention", post.get("intention", "").replace(',', '/'));- sb.peers.newsPool.publishMyNews(sb.peers.mySeed(), yacyNewsPool.CATEGORY_CRAWL_START, m);+ sb.peers.newsPool.publishMyNews(sb.peers.mySeed(), NewsPool.CATEGORY_CRAWL_START, m);}} else {prop.put("info", "5"); //Crawling faileddiff --git a/htroot/IndexControlRWIs_p.java b/htroot/IndexControlRWIs_p.javaindex 473e4ef5a..9ed49367b 100644--- a/htroot/IndexControlRWIs_p.java+++ b/htroot/IndexControlRWIs_p.java@@ -55,8 +55,8 @@ import net.yacy.kelondro.rwi.ReferenceContainer;import net.yacy.kelondro.rwi.ReferenceContainerCache;import net.yacy.kelondro.util.ByteBuffer;import net.yacy.kelondro.util.FileUtils;-import net.yacy.peers.yacyClient;-import net.yacy.peers.yacySeed;+import net.yacy.peers.Protocol;+import net.yacy.peers.Seed;import net.yacy.peers.dht.PeerSelection;import net.yacy.repository.Blacklist;import net.yacy.search.Switchboard;@@ -252,7 +252,7 @@ public class IndexControlRWIs_p {// find host & peerString host = post.get("host", ""); // get host from input field- yacySeed seed = null;+ Seed seed = null;if (host.length() != 0) {if (host.length() == 12) {// the host string is a peer hash@@ -302,7 +302,7 @@ public class IndexControlRWIs_p {// transport to other peerfinal boolean gzipBody = sb.getConfigBool("indexControl.gzipBody", false);final int timeout = (int) sb.getConfigLong("indexControl.timeout", 60000);- final String error = yacyClient.transferIndex(+ final String error = Protocol.transferIndex(seed,icc,knownURLs,@@ -542,15 +542,15 @@ public class IndexControlRWIs_p {public static void listHosts(final serverObjects prop, final byte[] startHash, final Switchboard sb) {// list known hosts- yacySeed seed;+ Seed seed;int hc = 0;prop.put("searchresult_keyhash", startHash);- final Iterator<yacySeed> e = PeerSelection.getAcceptRemoteIndexSeeds(sb.peers, startHash, sb.peers.sizeConnected(), true);+ final Iterator<Seed> e = PeerSelection.getAcceptRemoteIndexSeeds(sb.peers, startHash, sb.peers.sizeConnected(), true);while (e.hasNext()) {seed = e.next();if (seed != null) {prop.put("searchresult_hosts_" + hc + "_hosthash", seed.hash);- prop.putHTML("searchresult_hosts_" + hc + "_hostname", seed.hash + " " + seed.get(yacySeed.NAME, "nameless"));+ prop.putHTML("searchresult_hosts_" + hc + "_hostname", seed.hash + " " + seed.get(Seed.NAME, "nameless"));hc++;}}diff --git a/htroot/IndexCreateLoaderQueue_p.java b/htroot/IndexCreateLoaderQueue_p.javaindex 46adb3fe4..d5a824967 100644--- a/htroot/IndexCreateLoaderQueue_p.java+++ b/htroot/IndexCreateLoaderQueue_p.java@@ -29,7 +29,7 @@import net.yacy.cora.document.ASCII;import net.yacy.cora.protocol.RequestHeader;-import net.yacy.peers.yacySeed;+import net.yacy.peers.Seed;import net.yacy.search.Switchboard;import de.anomic.crawler.retrieval.Request;import de.anomic.server.serverObjects;@@ -49,7 +49,7 @@ public class IndexCreateLoaderQueue_p {prop.put("loader-set", "1");boolean dark = true;final Request[] w = sb.crawlQueues.activeWorkerEntries();- yacySeed initiator;+ Seed initiator;int count = 0;for (int i = 0; i < w.length; i++) {if (w[i] == null) continue;diff --git a/htroot/IndexCreateParserErrors_p.java b/htroot/IndexCreateParserErrors_p.javaindex cb6e983fd..efbc613ab 100644--- a/htroot/IndexCreateParserErrors_p.java+++ b/htroot/IndexCreateParserErrors_p.java@@ -28,7 +28,7 @@ import java.util.ArrayList;import net.yacy.cora.document.ASCII;import net.yacy.cora.protocol.RequestHeader;import net.yacy.kelondro.data.meta.DigestURI;-import net.yacy.peers.yacySeed;+import net.yacy.peers.Seed;import net.yacy.search.Switchboard;import de.anomic.crawler.ZURL;import de.anomic.server.serverObjects;@@ -72,7 +72,7 @@ public class IndexCreateParserErrors_p {dark = true;DigestURI url;byte[] initiatorHash, executorHash;- yacySeed initiatorSeed, executorSeed;+ Seed initiatorSeed, executorSeed;int j=0;ArrayList<ZURL.Entry> l = sb.crawlQueues.errorURL.list(showRejectedCount);ZURL.Entry entry;diff --git a/htroot/IndexCreateWWWGlobalQueue_p.java b/htroot/IndexCreateWWWGlobalQueue_p.javaindex 86e6d1074..efa3222e3 100644--- a/htroot/IndexCreateWWWGlobalQueue_p.java+++ b/htroot/IndexCreateWWWGlobalQueue_p.java@@ -34,7 +34,7 @@ import java.util.Locale;import net.yacy.cora.document.ASCII;import net.yacy.cora.protocol.RequestHeader;-import net.yacy.peers.yacySeed;+import net.yacy.peers.Seed;import net.yacy.search.Switchboard;import de.anomic.crawler.CrawlProfile;@@ -90,7 +90,7 @@ public class IndexCreateWWWGlobalQueue_p {Request urle;boolean dark = true;- yacySeed initiator;+ Seed initiator;String profileHandle;CrawlProfile profileEntry;int i, showNum = 0;diff --git a/htroot/IndexCreateWWWLocalQueue_p.java b/htroot/IndexCreateWWWLocalQueue_p.javaindex 873006f43..cb109a155 100644--- a/htroot/IndexCreateWWWLocalQueue_p.java+++ b/htroot/IndexCreateWWWLocalQueue_p.java@@ -39,7 +39,7 @@ import java.util.regex.PatternSyntaxException;import net.yacy.cora.document.ASCII;import net.yacy.cora.protocol.RequestHeader;import net.yacy.kelondro.logging.Log;-import net.yacy.peers.yacySeed;+import net.yacy.peers.Seed;import net.yacy.search.Switchboard;import de.anomic.crawler.CrawlProfile;@@ -156,7 +156,7 @@ public class IndexCreateWWWLocalQueue_p {Request urle;boolean dark = true;- yacySeed initiator;+ Seed initiator;String profileHandle;CrawlProfile profileEntry;int i;diff --git a/htroot/IndexCreateWWWRemoteQueue_p.java b/htroot/IndexCreateWWWRemoteQueue_p.javaindex 0eb43a667..a82ee5221 100644--- a/htroot/IndexCreateWWWRemoteQueue_p.java+++ b/htroot/IndexCreateWWWRemoteQueue_p.java@@ -31,7 +31,7 @@ import java.util.Locale;import net.yacy.cora.document.ASCII;import net.yacy.cora.protocol.RequestHeader;-import net.yacy.peers.yacySeed;+import net.yacy.peers.Seed;import net.yacy.search.Switchboard;import de.anomic.crawler.CrawlProfile;@@ -87,7 +87,7 @@ public class IndexCreateWWWRemoteQueue_p {Request urle;boolean dark = true;- yacySeed initiator;+ Seed initiator;String profileHandle;CrawlProfile profileEntry;int i, showNum = 0;diff --git a/htroot/MessageSend_p.java b/htroot/MessageSend_p.javaindex 59d04179f..2908c9b6a 100644--- a/htroot/MessageSend_p.java+++ b/htroot/MessageSend_p.java@@ -32,8 +32,8 @@ import java.util.Map;import net.yacy.cora.document.UTF8;import net.yacy.cora.protocol.RequestHeader;-import net.yacy.peers.yacyClient;-import net.yacy.peers.yacySeed;+import net.yacy.peers.Protocol;+import net.yacy.peers.Seed;import net.yacy.search.Switchboard;import de.anomic.server.serverObjects;@@ -69,18 +69,18 @@ public class MessageSend_p {// open an editor page for the message// first ask if the other peer is online, and also what kind of document it accepts- final Map<String, String> result = yacyClient.permissionMessage(sb.peers, hash);+ final Map<String, String> result = Protocol.permissionMessage(sb.peers, hash);//System.out.println("DEBUG: permission request result = " + result.toString());String peerName;- yacySeed targetPeer = null;+ Seed targetPeer = null;if (hash.equals(sb.peers.mySeed().hash)) {- peerName = sb.peers.mySeed().get(yacySeed.NAME,"nameless");+ peerName = sb.peers.mySeed().get(Seed.NAME,"nameless");} else {targetPeer = sb.peers.getConnected(hash);if (targetPeer == null)peerName = "nameless";else- peerName = targetPeer.get(yacySeed.NAME,"nameless");+ peerName = targetPeer.get(Seed.NAME,"nameless");}prop.putXML("mode_permission_peerName", peerName);@@ -128,7 +128,7 @@ public class MessageSend_p {if (subject.length() > 100) subject = subject.substring(0, 100);if (message.length() > messagesize) message = message.substring(0, messagesize);final byte[] mb = UTF8.getBytes(message);- final Map<String, String> result = yacyClient.postMessage(sb.peers, hash, subject, mb);+ final Map<String, String> result = Protocol.postMessage(sb.peers, hash, subject, mb);//message has been sentprop.put("mode_status_response", result.get("response"));diff --git a/htroot/Messages_p.java b/htroot/Messages_p.javaindex a499700f8..5af5162f6 100644--- a/htroot/Messages_p.java+++ b/htroot/Messages_p.java@@ -36,7 +36,7 @@ import net.yacy.cora.document.UTF8;import net.yacy.cora.protocol.HeaderFramework;import net.yacy.cora.protocol.RequestHeader;import net.yacy.kelondro.util.FileUtils;-import net.yacy.peers.yacySeed;+import net.yacy.peers.Seed;import net.yacy.search.Switchboard;import de.anomic.data.MessageBoard;@@ -68,10 +68,10 @@ public class Messages_p {int peerCount = 0;try {final TreeMap<String, String> hostList = new TreeMap<String, String>();- final Iterator<yacySeed> e = sb.peers.seedsConnected(true, false, null, (float) 0.0);+ final Iterator<Seed> e = sb.peers.seedsConnected(true, false, null, (float) 0.0);while (e.hasNext()) {- final yacySeed seed = e.next();- if (seed != null) hostList.put(seed.get(yacySeed.NAME, "nameless"),seed.hash);+ final Seed seed = e.next();+ if (seed != null) hostList.put(seed.get(Seed.NAME, "nameless"),seed.hash);}String peername;diff --git a/htroot/Network.java b/htroot/Network.javaindex 6a1b8d925..7179b620b 100644--- a/htroot/Network.java+++ b/htroot/Network.java@@ -41,11 +41,11 @@ import net.yacy.cora.protocol.ClientIdentification;import net.yacy.cora.protocol.HeaderFramework;import net.yacy.cora.protocol.RequestHeader;import net.yacy.kelondro.util.MapTools;-import net.yacy.peers.yacyClient;-import net.yacy.peers.yacyNewsDB;-import net.yacy.peers.yacyNewsPool;-import net.yacy.peers.yacyPeerActions;-import net.yacy.peers.yacySeed;+import net.yacy.peers.Protocol;+import net.yacy.peers.NewsDB;+import net.yacy.peers.NewsPool;+import net.yacy.peers.PeerActions;+import net.yacy.peers.Seed;import net.yacy.peers.operation.yacyVersion;import net.yacy.search.Switchboard;import net.yacy.search.SwitchboardConstants;@@ -70,8 +70,8 @@ public class Network {prop.putHTML("page_networkName", sb.getConfig(SwitchboardConstants.NETWORK_NAME, "unspecified"));final boolean overview = (post == null) || (post.get("page", "0").equals("0"));- final String mySeedType = sb.peers.mySeed().get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_VIRGIN);- final boolean iAmActive = (mySeedType.equals(yacySeed.PEERTYPE_SENIOR) || mySeedType.equals(yacySeed.PEERTYPE_PRINCIPAL));+ final String mySeedType = sb.peers.mySeed().get(Seed.PEERTYPE, Seed.PEERTYPE_VIRGIN);+ final boolean iAmActive = (mySeedType.equals(Seed.PEERTYPE_SENIOR) || mySeedType.equals(Seed.PEERTYPE_PRINCIPAL));if (overview) {long accActLinks = sb.peers.countActiveURL();@@ -92,17 +92,17 @@ public class Network {double myqph = 0d;// create own peer info- final yacySeed seed = sb.peers.mySeed();+ final Seed seed = sb.peers.mySeed();if (sb.peers.mySeed() != null){ //our Peer// update seed infosb.updateMySeed();final long LCount = seed.getLinkCount();final long ICount = seed.getWordCount();- final long RCount = seed.getLong(yacySeed.RCOUNT, 0L);+ final long RCount = seed.getLong(Seed.RCOUNT, 0L);// my-info- prop.putHTML("table_my-name", seed.get(yacySeed.NAME, "-") );+ prop.putHTML("table_my-name", seed.get(Seed.NAME, "-") );prop.put("table_my-hash", seed.hash );if (sb.peers.mySeed().isVirgin()) {prop.put("table_my-info", 0);@@ -125,30 +125,30 @@ public class Network {myppm = sb.currentPPM();myqph = 60d * sb.averageQPM();- prop.put("table_my-version", seed.get(yacySeed.VERSION, "-"));- prop.put("table_my-utc", seed.get(yacySeed.UTC, "-"));- prop.put("table_my-uptime", yacyPeerActions.formatInterval(60000 * seed.getLong(yacySeed.UPTIME, 0)));+ prop.put("table_my-version", seed.get(Seed.VERSION, "-"));+ prop.put("table_my-utc", seed.get(Seed.UTC, "-"));+ prop.put("table_my-uptime", PeerActions.formatInterval(60000 * seed.getLong(Seed.UPTIME, 0)));prop.putNum("table_my-LCount", LCount);prop.putNum("table_my-ICount", ICount);prop.putNum("table_my-RCount", RCount);- prop.putNum("table_my-sI", seed.getLong(yacySeed.INDEX_OUT, 0L));- prop.putNum("table_my-sU", seed.getLong(yacySeed.URL_OUT, 0L));- prop.putNum("table_my-rI", seed.getLong(yacySeed.INDEX_IN, 0L));- prop.putNum("table_my-rU", seed.getLong(yacySeed.URL_IN, 0L));+ prop.putNum("table_my-sI", seed.getLong(Seed.INDEX_OUT, 0L));+ prop.putNum("table_my-sU", seed.getLong(Seed.URL_OUT, 0L));+ prop.putNum("table_my-rI", seed.getLong(Seed.INDEX_IN, 0L));+ prop.putNum("table_my-rU", seed.getLong(Seed.URL_IN, 0L));prop.putNum("table_my-ppm", myppm);prop.putNum("table_my-qph", Math.round(100d * myqph) / 100d);prop.putNum("table_my-qph-publocal", Math.round(6000d * sb.averageQPMPublicLocal()) / 100d);prop.putNum("table_my-qph-pubremote", Math.round(6000d * sb.averageQPMGlobal()) / 100d);- prop.putNum("table_my-seeds", seed.getLong(yacySeed.SCOUNT, 0L));- prop.putNum("table_my-connects", seed.getFloat(yacySeed.CCOUNT, 0F));- prop.put("table_my-url", seed.get(yacySeed.SEEDLISTURL, ""));+ prop.putNum("table_my-seeds", seed.getLong(Seed.SCOUNT, 0L));+ prop.putNum("table_my-connects", seed.getFloat(Seed.CCOUNT, 0F));+ prop.put("table_my-url", seed.get(Seed.SEEDLISTURL, ""));// generating the location stringprop.putHTML("table_my-location", ClientIdentification.generateLocation());}// overall results: Network statistics- if (iAmActive) conCount++; else if (mySeedType.equals(yacySeed.PEERTYPE_JUNIOR)) potCount++;+ if (iAmActive) conCount++; else if (mySeedType.equals(Seed.PEERTYPE_JUNIOR)) potCount++;final int activeLastMonth = sb.peers.sizeActiveSince(30 * 1440);final int activeLastWeek = sb.peers.sizeActiveSince(7 * 1440);final int activeLastDay = sb.peers.sizeActiveSince(1440);@@ -196,12 +196,12 @@ public class Network {}final ConcurrentMap<String, String> map = new ConcurrentHashMap<String, String>();- map.put(yacySeed.IP, post.get("peerIP"));- map.put(yacySeed.PORT, post.get("peerPort"));- yacySeed peer = new yacySeed(post.get("peerHash"), map);+ map.put(Seed.IP, post.get("peerIP"));+ map.put(Seed.PORT, post.get("peerPort"));+ Seed peer = new Seed(post.get("peerHash"), map);sb.updateMySeed();- final int added = yacyClient.hello(sb.peers.mySeed(), sb.peers.peerActions, peer.getPublicAddress(), peer.hash, peer.getName());+ final int added = Protocol.hello(sb.peers.mySeed(), sb.peers.peerActions, peer.getPublicAddress(), peer.hash, peer.getName());if (added <= 0) {prop.put("table_comment",1);@@ -213,7 +213,7 @@ public class Network {prop.putHTML("table_comment_status","publish: disconnected peer 'UNKNOWN/" + post.get("peerHash") + "' from UNKNOWN");} else {prop.put("table_comment",2);- prop.putHTML("table_comment_status","publish: handshaked " + peer.get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_SENIOR) + " peer '" + peer.getName() + "' at " + peer.getPublicAddress());+ prop.putHTML("table_comment_status","publish: handshaked " + peer.get(Seed.PEERTYPE, Seed.PEERTYPE_SENIOR) + " peer '" + peer.getName() + "' at " + peer.getPublicAddress());prop.putHTML("table_comment_details",peer.toString());}}@@ -257,33 +257,33 @@ public class Network {final HashMap<String, Map<String, String>> updatedWiki = new HashMap<String, Map<String, String>>();final HashMap<String, Map<String, String>> updatedBlog = new HashMap<String, Map<String, String>>();final HashMap<String, String> isCrawling = new HashMap<String, String>();- yacyNewsDB.Record record;- final Iterator<yacyNewsDB.Record> recordIterator = sb.peers.newsPool.recordIterator(yacyNewsPool.INCOMING_DB, true);+ NewsDB.Record record;+ final Iterator<NewsDB.Record> recordIterator = sb.peers.newsPool.recordIterator(NewsPool.INCOMING_DB, true);while (recordIterator.hasNext()) {record = recordIterator.next();if (record == null) {continue;- } else if (record.category().equals(yacyNewsPool.CATEGORY_PROFILE_UPDATE)) {+ } else if (record.category().equals(NewsPool.CATEGORY_PROFILE_UPDATE)) {updatedProfile.add(record.originator());- } else if (record.category().equals(yacyNewsPool.CATEGORY_WIKI_UPDATE)) {+ } else if (record.category().equals(NewsPool.CATEGORY_WIKI_UPDATE)) {updatedWiki.put(record.originator(), record.attributes());- } else if (record.category().equals(yacyNewsPool.CATEGORY_BLOG_ADD)) {+ } else if (record.category().equals(NewsPool.CATEGORY_BLOG_ADD)) {updatedBlog.put(record.originator(), record.attributes());- } else if (record.category().equals(yacyNewsPool.CATEGORY_CRAWL_START)) {+ } else if (record.category().equals(NewsPool.CATEGORY_CRAWL_START)) {isCrawling.put(record.originator(), record.attributes().get("startURL"));}}boolean dark = true;- yacySeed seed;+ Seed seed;final boolean complete = (post != null && post.containsKey("ip"));- Iterator<yacySeed> e = null;+ Iterator<Seed> e = null;final boolean order = (post != null && post.get("order", "down").equals("up"));final String sort = (post == null ? null : post.get("sort", null));switch (page) {- case 1 : e = sb.peers.seedsSortedConnected(order, (sort == null ? yacySeed.LCOUNT : sort)); break;- case 2 : e = sb.peers.seedsSortedDisconnected(order, (sort == null ? yacySeed.LASTSEEN : sort)); break;- case 3 : e = sb.peers.seedsSortedPotential(order, (sort == null ? yacySeed.LASTSEEN : sort)); break;+ case 1 : e = sb.peers.seedsSortedConnected(order, (sort == null ? Seed.LCOUNT : sort)); break;+ case 2 : e = sb.peers.seedsSortedDisconnected(order, (sort == null ? Seed.LASTSEEN : sort)); break;+ case 3 : e = sb.peers.seedsSortedPotential(order, (sort == null ? Seed.LASTSEEN : sort)); break;default: break;}String startURL;@@ -356,12 +356,12 @@ public class Network {prop.put(STR_TABLE_LIST + conCount + "_isCrawling_page", startURL);}prop.put(STR_TABLE_LIST + conCount + "_hash", seed.hash);- String shortname = seed.get(yacySeed.NAME, "deadlink");+ String shortname = seed.get(Seed.NAME, "deadlink");if (shortname.length() > 20) {shortname = shortname.substring(0, 20) + "...";}prop.putHTML(STR_TABLE_LIST + conCount + "_shortname", shortname);- prop.putHTML(STR_TABLE_LIST + conCount + "_fullname", seed.get(yacySeed.NAME, "deadlink"));+ prop.putHTML(STR_TABLE_LIST + conCount + "_fullname", seed.get(Seed.NAME, "deadlink"));userAgent = null;if (seed.hash != null && seed.hash.equals(sb.peers.mySeed().hash)) {userAgent = ClientIdentification.getUserAgent();@@ -374,11 +374,11 @@ public class Network {if (complete) {prop.put(STR_TABLE_LIST + conCount + "_complete", 1);prop.put(STR_TABLE_LIST + conCount + "_complete_ip", seed.getIP() );- prop.put(STR_TABLE_LIST + conCount + "_complete_port", seed.get(yacySeed.PORT, "-") );+ prop.put(STR_TABLE_LIST + conCount + "_complete_port", seed.get(Seed.PORT, "-") );prop.put(STR_TABLE_LIST + conCount + "_complete_hash", seed.hash);prop.put(STR_TABLE_LIST + conCount + "_complete_age", seed.getAge());- prop.putNum(STR_TABLE_LIST + conCount + "_complete_seeds", seed.getLong(yacySeed.SCOUNT, 0L));- prop.putNum(STR_TABLE_LIST + conCount + "_complete_connects", seed.getFloat(yacySeed.CCOUNT, 0F));+ prop.putNum(STR_TABLE_LIST + conCount + "_complete_seeds", seed.getLong(Seed.SCOUNT, 0L));+ prop.putNum(STR_TABLE_LIST + conCount + "_complete_connects", seed.getFloat(Seed.CCOUNT, 0F));prop.putHTML(STR_TABLE_LIST + conCount + "_complete_userAgent", userAgent);} else {prop.put(STR_TABLE_LIST + conCount + "_complete", 0);@@ -392,7 +392,7 @@ public class Network {} else if(seed.isPrincipal()) {prop.put(STR_TABLE_LIST + conCount + "_type", 2);}- prop.putHTML(STR_TABLE_LIST + conCount + "_type_url", seed.get(yacySeed.SEEDLISTURL, "http://nowhere/"));+ prop.putHTML(STR_TABLE_LIST + conCount + "_type_url", seed.get(Seed.SEEDLISTURL, "http://nowhere/"));final long lastseen = Math.abs((System.currentTimeMillis() - seed.getLastSeenUTC()) / 1000 / 60);if (page == 1 && lastseen > 720) {@@ -428,17 +428,17 @@ public class Network {final String peertags = MapTools.set2string(seed.getPeerTags(), ",", false);prop.putHTML(STR_TABLE_LIST + conCount + "_dhtreceive_peertags", ((peertags == null) || (peertags.length() == 0)) ? "no tags given" : ("tags = " + peertags));}- prop.putHTML(STR_TABLE_LIST + conCount + "_version", yacyVersion.combined2prettyVersion(seed.get(yacySeed.VERSION, "0.1"), shortname));+ prop.putHTML(STR_TABLE_LIST + conCount + "_version", yacyVersion.combined2prettyVersion(seed.get(Seed.VERSION, "0.1"), shortname));prop.putNum(STR_TABLE_LIST + conCount + "_lastSeen", /*seed.getLastSeenString() + " " +*/ lastseen);- prop.put(STR_TABLE_LIST + conCount + "_utc", seed.get(yacySeed.UTC, "-"));- prop.putHTML(STR_TABLE_LIST + conCount + "_uptime", yacyPeerActions.formatInterval(60000 * seed.getLong(yacySeed.UPTIME, 0)));+ prop.put(STR_TABLE_LIST + conCount + "_utc", seed.get(Seed.UTC, "-"));+ prop.putHTML(STR_TABLE_LIST + conCount + "_uptime", PeerActions.formatInterval(60000 * seed.getLong(Seed.UPTIME, 0)));prop.putNum(STR_TABLE_LIST + conCount + "_LCount", seed.getLinkCount());prop.putNum(STR_TABLE_LIST + conCount + "_ICount", seed.getWordCount());- prop.putNum(STR_TABLE_LIST + conCount + "_RCount", seed.getLong(yacySeed.RCOUNT, 0));- prop.putNum(STR_TABLE_LIST + conCount + "_sI", seed.getLong(yacySeed.INDEX_OUT, 0));- prop.putNum(STR_TABLE_LIST + conCount + "_sU", seed.getLong(yacySeed.URL_OUT, 0));- prop.putNum(STR_TABLE_LIST + conCount + "_rI", seed.getLong(yacySeed.INDEX_IN, 0));- prop.putNum(STR_TABLE_LIST + conCount + "_rU", seed.getLong(yacySeed.URL_IN, 0));+ prop.putNum(STR_TABLE_LIST + conCount + "_RCount", seed.getLong(Seed.RCOUNT, 0));+ prop.putNum(STR_TABLE_LIST + conCount + "_sI", seed.getLong(Seed.INDEX_OUT, 0));+ prop.putNum(STR_TABLE_LIST + conCount + "_sU", seed.getLong(Seed.URL_OUT, 0));+ prop.putNum(STR_TABLE_LIST + conCount + "_rI", seed.getLong(Seed.INDEX_IN, 0));+ prop.putNum(STR_TABLE_LIST + conCount + "_rU", seed.getLong(Seed.URL_IN, 0));prop.putNum(STR_TABLE_LIST + conCount + "_ppm", PPM);prop.putNum(STR_TABLE_LIST + conCount + "_qph", Math.round(6000d * QPM) / 100d);conCount++;@@ -459,7 +459,7 @@ public class Network {switch (page) {case 1 : prop.putHTML("table_peertype", "senior/principal"); break;case 2 : prop.putHTML("table_peertype", "senior/principal"); break;- case 3 : prop.putHTML("table_peertype", yacySeed.PEERTYPE_JUNIOR); break;+ case 3 : prop.putHTML("table_peertype", Seed.PEERTYPE_JUNIOR); break;default: break;}}diff --git a/htroot/News.java b/htroot/News.javaindex d3402d293..e51c2f000 100644--- a/htroot/News.java+++ b/htroot/News.java@@ -32,9 +32,9 @@ import net.yacy.cora.date.GenericFormatter;import net.yacy.cora.protocol.HeaderFramework;import net.yacy.cora.protocol.RequestHeader;import net.yacy.kelondro.logging.Log;-import net.yacy.peers.yacyNewsDB;-import net.yacy.peers.yacyNewsPool;-import net.yacy.peers.yacySeed;+import net.yacy.peers.NewsDB;+import net.yacy.peers.NewsPool;+import net.yacy.peers.Seed;import net.yacy.search.Switchboard;import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;@@ -75,7 +75,7 @@ public class News {return prop; // this button needs authentication, force log-in}try {- if ((tableID == yacyNewsPool.PROCESSED_DB) || (tableID == yacyNewsPool.PUBLISHED_DB)) {+ if ((tableID == NewsPool.PROCESSED_DB) || (tableID == NewsPool.PUBLISHED_DB)) {sb.peers.newsPool.clear(tableID);} else {sb.peers.newsPool.moveOffAll(tableID);@@ -91,10 +91,10 @@ public class News {// show overviewprop.put("table", "0");prop.put("page", "0");- prop.putNum("table_insize", sb.peers.newsPool.size(yacyNewsPool.INCOMING_DB));- prop.putNum("table_prsize", sb.peers.newsPool.size(yacyNewsPool.PROCESSED_DB));- prop.putNum("table_ousize", sb.peers.newsPool.size(yacyNewsPool.OUTGOING_DB));- prop.putNum("table_pusize", sb.peers.newsPool.size(yacyNewsPool.PUBLISHED_DB));+ prop.putNum("table_insize", sb.peers.newsPool.size(NewsPool.INCOMING_DB));+ prop.putNum("table_prsize", sb.peers.newsPool.size(NewsPool.PROCESSED_DB));+ prop.putNum("table_ousize", sb.peers.newsPool.size(NewsPool.OUTGOING_DB));+ prop.putNum("table_pusize", sb.peers.newsPool.size(NewsPool.PUBLISHED_DB));} else {// generate tableprop.put("table", "1");@@ -103,9 +103,9 @@ public class News {if (sb.peers != null) {final int maxCount = Math.min(1000, sb.peers.newsPool.size(tableID));- final Iterator<yacyNewsDB.Record> recordIterator = sb.peers.newsPool.recordIterator(tableID, false);- yacyNewsDB.Record record;- yacySeed seed;+ final Iterator<NewsDB.Record> recordIterator = sb.peers.newsPool.recordIterator(tableID, false);+ NewsDB.Record record;+ Seed seed;int i = 0;while ((recordIterator.hasNext()) && (i < maxCount)) {record = recordIterator.next();@@ -136,31 +136,31 @@ public class News {// generating link / title / description (taken over from Surftips.java)String link, title, description;- if (category.equals(yacyNewsPool.CATEGORY_CRAWL_START)) {+ if (category.equals(NewsPool.CATEGORY_CRAWL_START)) {link = record.attribute("startURL", "");title = (record.attribute("intention", "").isEmpty()) ? link : record.attribute("intention", "");description = "Crawl Start Point";- } else if (category.equals(yacyNewsPool.CATEGORY_PROFILE_UPDATE)) {+ } else if (category.equals(NewsPool.CATEGORY_PROFILE_UPDATE)) {link = record.attribute("homepage", "");title = "Home Page of " + record.attribute("nickname", "");description = "Profile Update";- } else if (category.equals(yacyNewsPool.CATEGORY_BOOKMARK_ADD)) {+ } else if (category.equals(NewsPool.CATEGORY_BOOKMARK_ADD)) {link = record.attribute("url", "");title = record.attribute("title", "");description = "Bookmark: " + record.attribute("description", "");- } else if (category.equals(yacyNewsPool.CATEGORY_SURFTIPP_ADD)) {+ } else if (category.equals(NewsPool.CATEGORY_SURFTIPP_ADD)) {link = record.attribute("url", "");title = record.attribute("title", "");description = "Surf Tipp: " + record.attribute("description", "");- } else if (category.equals(yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD)) {+ } else if (category.equals(NewsPool.CATEGORY_SURFTIPP_VOTE_ADD)) {link = record.attribute("url", "");title = record.attribute("title", "");description = record.attribute("url", "");- } else if (category.equals(yacyNewsPool.CATEGORY_WIKI_UPDATE)) {+ } else if (category.equals(NewsPool.CATEGORY_WIKI_UPDATE)) {link = (seed == null)? "" : "http://" + seed.getPublicAddress() + "/Wiki.html?page=" + record.attribute("page", "");title = record.attribute("author", "Anonymous") + ": " + record.attribute("page", "");description = "Wiki Update: " + record.attribute("description", "");- } else if (category.equals(yacyNewsPool.CATEGORY_BLOG_ADD)) {+ } else if (category.equals(NewsPool.CATEGORY_BLOG_ADD)) {link = (seed == null)? "" : "http://" + seed.getPublicAddress() + "/Blog.html?page=" + record.attribute("page", "");title = record.attribute("author", "Anonymous") + ": " + record.attribute("page", "");description = "Blog Entry: " + record.attribute("subject", "");diff --git a/htroot/RemoteCrawl_p.java b/htroot/RemoteCrawl_p.javaindex ce93880dc..b9216ab17 100644--- a/htroot/RemoteCrawl_p.java+++ b/htroot/RemoteCrawl_p.java@@ -31,8 +31,8 @@ import java.util.regex.Matcher;import java.util.regex.Pattern;import net.yacy.cora.protocol.RequestHeader;-import net.yacy.peers.yacyPeerActions;-import net.yacy.peers.yacySeed;+import net.yacy.peers.PeerActions;+import net.yacy.peers.Seed;import net.yacy.peers.operation.yacyVersion;import net.yacy.search.Switchboard;import net.yacy.search.SwitchboardConstants;@@ -85,9 +85,9 @@ public class RemoteCrawl_p {int conCount = 0;boolean dark = true;- yacySeed seed;- Iterator<yacySeed> e = null;- e = sb.peers.seedsSortedConnected(false, yacySeed.RCOUNT);+ Seed seed;+ Iterator<Seed> e = null;+ e = sb.peers.seedsSortedConnected(false, Seed.RCOUNT);//e = sb.peers.seedsSortedConnected(false, yacySeed.LCOUNT);Pattern peerSearchPattern = null;while (e.hasNext() && conCount < 300) {@@ -96,7 +96,7 @@ public class RemoteCrawl_p {if (seed != null) {final long lastseen = Math.abs((System.currentTimeMillis() - seed.getLastSeenUTC()) / 1000 / 60);if (lastseen > 720) continue;- long rcount = seed.getLong(yacySeed.RCOUNT, 0);+ long rcount = seed.getLong(Seed.RCOUNT, 0);if (rcount == 0) continue;if ((post != null && post.containsKey("search")) && peerSearchPattern != null /*(wrongregex == null)*/) {boolean abort = true;@@ -111,15 +111,15 @@ public class RemoteCrawl_p {if (abort) continue;}prop.put(STR_TABLE_LIST + conCount + "_dark", ((dark) ? 1 : 0) ); dark=!dark;- String shortname = seed.get(yacySeed.NAME, "deadlink");+ String shortname = seed.get(Seed.NAME, "deadlink");if (shortname.length() > 20) shortname = shortname.substring(0, 20) + "...";prop.putHTML(STR_TABLE_LIST + conCount + "_shortname", shortname);- prop.putHTML(STR_TABLE_LIST + conCount + "_fullname", seed.get(yacySeed.NAME, "deadlink"));+ prop.putHTML(STR_TABLE_LIST + conCount + "_fullname", seed.get(Seed.NAME, "deadlink"));prop.put(STR_TABLE_LIST + conCount + "_age", seed.getAge());- prop.putHTML(STR_TABLE_LIST + conCount + "_version", yacyVersion.combined2prettyVersion(seed.get(yacySeed.VERSION, "0.1"), shortname));+ prop.putHTML(STR_TABLE_LIST + conCount + "_version", yacyVersion.combined2prettyVersion(seed.get(Seed.VERSION, "0.1"), shortname));prop.putNum(STR_TABLE_LIST + conCount + "_lastSeen", /*seed.getLastSeenString() + " " +*/ lastseen);- prop.put(STR_TABLE_LIST + conCount + "_utc", seed.get(yacySeed.UTC, "-"));- prop.putHTML(STR_TABLE_LIST + conCount + "_uptime", yacyPeerActions.formatInterval(60000 * seed.getLong(yacySeed.UPTIME, 0L)));+ prop.put(STR_TABLE_LIST + conCount + "_utc", seed.get(Seed.UTC, "-"));+ prop.putHTML(STR_TABLE_LIST + conCount + "_uptime", PeerActions.formatInterval(60000 * seed.getLong(Seed.UPTIME, 0L)));prop.putNum(STR_TABLE_LIST + conCount + "_LCount", seed.getLinkCount());prop.putNum(STR_TABLE_LIST + conCount + "_ICount", seed.getWordCount());prop.putNum(STR_TABLE_LIST + conCount + "_RCount", rcount);diff --git a/htroot/SettingsAck_p.java b/htroot/SettingsAck_p.javaindex c98fc7134..93ff7cb93 100644--- a/htroot/SettingsAck_p.java+++ b/htroot/SettingsAck_p.java@@ -41,9 +41,9 @@ import net.yacy.cora.protocol.RequestHeader;import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.order.Digest;import net.yacy.kelondro.util.Formatter;-import net.yacy.peers.yacyCore;-import net.yacy.peers.yacyPeerActions;-import net.yacy.peers.yacySeed;+import net.yacy.peers.Network;+import net.yacy.peers.PeerActions;+import net.yacy.peers.Seed;import net.yacy.peers.operation.yacySeedUploader;import net.yacy.search.Switchboard;import net.yacy.search.SwitchboardConstants;@@ -225,7 +225,7 @@ public class SettingsAck_p {} else {serverCore.useStaticIP = true;}- if (yacySeed.isProperIP(staticIP) == null) sb.peers.mySeed().setIP(staticIP);+ if (Seed.isProperIP(staticIP) == null) sb.peers.mySeed().setIP(staticIP);env.setConfig("staticIP", staticIP);// server access data@@ -319,7 +319,7 @@ public class SettingsAck_p {if (post.containsKey("seedUploadRetry")) {String error;- if ((error = yacyCore.saveSeedList(sb)) == null) {+ if ((error = Network.saveSeedList(sb)) == null) {// trying to upload the seed-list fileprop.put("info", "13");prop.put("info_success", "1");@@ -335,22 +335,22 @@ public class SettingsAck_p {// get the currently used uploading methodfinal String oldSeedUploadMethod = env.getConfig("seedUploadMethod","none");final String newSeedUploadMethod = post.get("seedUploadMethod");- final String oldSeedURLStr = sb.peers.mySeed().get(yacySeed.SEEDLISTURL, "");+ final String oldSeedURLStr = sb.peers.mySeed().get(Seed.SEEDLISTURL, "");final String newSeedURLStr = post.get("seedURL");final boolean seedUrlChanged = !oldSeedURLStr.equals(newSeedURLStr);boolean uploadMethodChanged = !oldSeedUploadMethod.equals(newSeedUploadMethod);if (uploadMethodChanged) {- uploadMethodChanged = yacyCore.changeSeedUploadMethod(newSeedUploadMethod);+ uploadMethodChanged = Network.changeSeedUploadMethod(newSeedUploadMethod);}if (seedUrlChanged || uploadMethodChanged) {env.setConfig("seedUploadMethod", newSeedUploadMethod);- sb.peers.mySeed().put(yacySeed.SEEDLISTURL, newSeedURLStr);+ sb.peers.mySeed().put(Seed.SEEDLISTURL, newSeedURLStr);// try an uploadString error;- if ((error = yacyCore.saveSeedList(sb)) == null) {+ if ((error = Network.saveSeedList(sb)) == null) {// we have successfully uploaded the seed-list fileprop.put("info_seedUploadMethod", newSeedUploadMethod);prop.putHTML("info_seedURL",newSeedURLStr);@@ -369,7 +369,7 @@ public class SettingsAck_p {* Loop through the available seed uploaders to see if the* configuration of one of them has changed*/- final HashMap<String, String> uploaders = yacyCore.getSeedUploadMethods();+ final HashMap<String, String> uploaders = Network.getSeedUploadMethods();final Iterator<String> uploaderKeys = uploaders.keySet().iterator();while (uploaderKeys.hasNext()) {// get the uploader module name@@ -379,7 +379,7 @@ public class SettingsAck_p {// determining if the user has reconfigured the settings of this uploaderif (post.containsKey("seed" + uploaderName + "Settings")) {nothingChanged = true;- final yacySeedUploader theUploader = yacyCore.getSeedUploader(uploaderName);+ final yacySeedUploader theUploader = Network.getSeedUploader(uploaderName);final String[] configOptions = theUploader.getConfigurationOptions();if (configOptions != null) {for (final String configOption : configOptions) {@@ -397,7 +397,7 @@ public class SettingsAck_p {// were changed, we now try to upload the seed list with the new settingsif (env.getConfig("seedUploadMethod","none").equalsIgnoreCase(uploaderName)) {String error;- if ((error = yacyCore.saveSeedList(sb)) == null) {+ if ((error = Network.saveSeedList(sb)) == null) {// we have successfully uploaded the seed fileprop.put("info", "13");@@ -512,7 +512,7 @@ public class SettingsAck_p {}// everything is ok- prop.put("info_crawler.clientTimeout",(crawlerTimeout==0) ? "0" :yacyPeerActions.formatInterval(crawlerTimeout));+ prop.put("info_crawler.clientTimeout",(crawlerTimeout==0) ? "0" :PeerActions.formatInterval(crawlerTimeout));prop.put("info_crawler.http.maxFileSize",(maxHttpSize==-1)? "-1":Formatter.bytesToString(maxHttpSize));prop.put("info_crawler.ftp.maxFileSize", (maxFtpSize==-1) ? "-1":Formatter.bytesToString(maxFtpSize));prop.put("info_crawler.smb.maxFileSize", (maxSmbSize==-1) ? "-1":Formatter.bytesToString(maxSmbSize));diff --git a/htroot/Settings_p.java b/htroot/Settings_p.javaindex 49235e2dc..ca3db690e 100644--- a/htroot/Settings_p.java+++ b/htroot/Settings_p.java@@ -27,8 +27,8 @@ import java.util.Iterator;import net.yacy.cora.protocol.HeaderFramework;import net.yacy.cora.protocol.RequestHeader;-import net.yacy.peers.yacyCore;-import net.yacy.peers.yacySeed;+import net.yacy.peers.Network;+import net.yacy.peers.Seed;import net.yacy.peers.operation.yacySeedUploader;import net.yacy.search.Switchboard;@@ -148,7 +148,7 @@ public final class Settings_p {env.setConfig("seedUploadMethod",enabledUploader);}- final HashMap<String, String> uploaders = yacyCore.getSeedUploadMethods();+ final HashMap<String, String> uploaders = Network.getSeedUploadMethods();prop.put("seedUploadMethods", uploaders.size() + 1);prop.put("seedUploadMethods_0_name", "none");prop.put("seedUploadMethods_0_selected", enabledUploader.equals("none") ? "1" : "0");@@ -163,7 +163,7 @@ public final class Settings_p {prop.put("seedUploadMethods_" +count+ "_selected", uploaderName.equals(enabledUploader) ? "1" : "0");prop.put("seedUploadMethods_" +count+ "_file", "Settings_Seed_Upload" + uploaderName + ".inc");- final yacySeedUploader theUploader = yacyCore.getSeedUploader(uploaderName);+ final yacySeedUploader theUploader = Network.getSeedUploader(uploaderName);final String[] configOptions = theUploader.getConfigurationOptions();if (configOptions != null) {for (int i=0; i<configOptions.length; i++) {@@ -174,7 +174,7 @@ public final class Settings_p {}// general settings- prop.put("seedURL", sb.peers.mySeed().get(yacySeed.SEEDLISTURL, ""));+ prop.put("seedURL", sb.peers.mySeed().get(Seed.SEEDLISTURL, ""));/** Message forwarding configurationdiff --git a/htroot/Status.java b/htroot/Status.javaindex 36ee096cf..e10a7aaae 100644--- a/htroot/Status.java+++ b/htroot/Status.java@@ -37,8 +37,8 @@ import net.yacy.kelondro.util.Formatter;import net.yacy.kelondro.util.MemoryControl;import net.yacy.kelondro.util.OS;import net.yacy.kelondro.workflow.WorkflowProcessor;-import net.yacy.peers.yacyPeerActions;-import net.yacy.peers.yacySeed;+import net.yacy.peers.PeerActions;+import net.yacy.peers.Seed;import net.yacy.peers.operation.yacyBuildProperties;import net.yacy.search.Switchboard;import net.yacy.search.SwitchboardConstants;@@ -61,7 +61,7 @@ public class Status {prop.put("forwardToConfigBasic", 0);if ((post == null || !post.containsKey("noforward")) &&sb.getConfig("server.servlets.submitted", "").indexOf("ConfigBasic.html") < 0 &&- yacySeed.isDefaultPeerName(sb.peers.mySeed().getName())) {+ Seed.isDefaultPeerName(sb.peers.mySeed().getName())) {// forward to ConfigBasicprop.put("forwardToConfigBasic", 1);}@@ -197,15 +197,15 @@ public class Status {prop.put("peerAddress", "0"); // not assignedprop.put("peerStatistics", "0"); // unknown} else {- final long uptime = 60000 * sb.peers.mySeed().getLong(yacySeed.UPTIME, 0L);+ final long uptime = 60000 * sb.peers.mySeed().getLong(Seed.UPTIME, 0L);prop.put("peerStatistics", "1");- prop.put("peerStatistics_uptime", yacyPeerActions.formatInterval(uptime));+ prop.put("peerStatistics_uptime", PeerActions.formatInterval(uptime));prop.putNum("peerStatistics_pagesperminute", sb.peers.mySeed().getPPM());prop.putNum("peerStatistics_queriesperhour", Math.round(6000d * sb.peers.mySeed().getQPM()) / 100d);prop.putNum("peerStatistics_links", sb.peers.mySeed().getLinkCount());prop.put("peerStatistics_words", Formatter.number(sb.peers.mySeed().getWordCount()));prop.putNum("peerStatistics_disconnects", sb.peers.peerActions.disconnects);- prop.put("peerStatistics_connects", Formatter.number(sb.peers.mySeed().get(yacySeed.CCOUNT, "0")));+ prop.put("peerStatistics_connects", Formatter.number(sb.peers.mySeed().get(Seed.CCOUNT, "0")));thisHash = sb.peers.mySeed().hash;if (sb.peers.mySeed().getPublicAddress() == null) {prop.put("peerAddress", "0"); // not assigned + instructions@@ -216,20 +216,20 @@ public class Status {prop.putXML("peerAddress_peername", sb.peers.mySeed().getName().toLowerCase());}}- final String peerStatus = ((sb.peers.mySeed() == null) ? yacySeed.PEERTYPE_VIRGIN : sb.peers.mySeed().get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_VIRGIN));- if (yacySeed.PEERTYPE_VIRGIN.equals(peerStatus) && "freeworld".equals(sb.getConfig(SwitchboardConstants.NETWORK_NAME, ""))) {+ final String peerStatus = ((sb.peers.mySeed() == null) ? Seed.PEERTYPE_VIRGIN : sb.peers.mySeed().get(Seed.PEERTYPE, Seed.PEERTYPE_VIRGIN));+ if (Seed.PEERTYPE_VIRGIN.equals(peerStatus) && "freeworld".equals(sb.getConfig(SwitchboardConstants.NETWORK_NAME, ""))) {prop.put(PEERSTATUS, "0");prop.put("urgentStatusVirgin", "1");- } else if (yacySeed.PEERTYPE_JUNIOR.equals(peerStatus) && "freeworld".equals(sb.getConfig(SwitchboardConstants.NETWORK_NAME, ""))) {+ } else if (Seed.PEERTYPE_JUNIOR.equals(peerStatus) && "freeworld".equals(sb.getConfig(SwitchboardConstants.NETWORK_NAME, ""))) {prop.put(PEERSTATUS, "1");prop.put("warningStatusJunior", "1");- } else if (yacySeed.PEERTYPE_SENIOR.equals(peerStatus)) {+ } else if (Seed.PEERTYPE_SENIOR.equals(peerStatus)) {prop.put(PEERSTATUS, "2");prop.put("hintStatusSenior", "1");- } else if (yacySeed.PEERTYPE_PRINCIPAL.equals(peerStatus)) {+ } else if (Seed.PEERTYPE_PRINCIPAL.equals(peerStatus)) {prop.put(PEERSTATUS, "3");prop.put("hintStatusPrincipal", "1");- prop.put("hintStatusPrincipal_seedURL", sb.peers.mySeed().get(yacySeed.SEEDLISTURL, "?"));+ prop.put("hintStatusPrincipal_seedURL", sb.peers.mySeed().get(Seed.SEEDLISTURL, "?"));}prop.putHTML("peerName", thisName);prop.put("hash", thisHash);@@ -258,7 +258,7 @@ public class Status {prop.putHTML("seedServer_seedFile", sb.getConfig("seedFilePath", ""));}prop.put("seedServer_lastUpload",- yacyPeerActions.formatInterval(System.currentTimeMillis() - sb.peers.lastSeedUpload_timeStamp));+ PeerActions.formatInterval(System.currentTimeMillis() - sb.peers.lastSeedUpload_timeStamp));} else {prop.put(SEEDSERVER, "0"); // disabled}diff --git a/htroot/Supporter.java b/htroot/Supporter.javaindex 8e1433444..9470e1284 100644--- a/htroot/Supporter.java+++ b/htroot/Supporter.java@@ -40,9 +40,9 @@ import net.yacy.kelondro.data.meta.DigestURI;import net.yacy.kelondro.index.Row;import net.yacy.kelondro.index.Row.Entry;import net.yacy.kelondro.order.NaturalOrder;-import net.yacy.peers.yacyNewsDB;-import net.yacy.peers.yacyNewsPool;-import net.yacy.peers.yacySeed;+import net.yacy.peers.NewsDB;+import net.yacy.peers.NewsPool;+import net.yacy.peers.Seed;import net.yacy.repository.Blacklist;import net.yacy.search.Switchboard;import de.anomic.server.serverObjects;@@ -81,7 +81,7 @@ public class Supporter {map.put("urlhash", hash);map.put("vote", "negative");map.put("refid", post.get("refid", ""));- sb.peers.newsPool.publishMyNews(sb.peers.mySeed(), yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, map);+ sb.peers.newsPool.publishMyNews(sb.peers.mySeed(), NewsPool.CATEGORY_SURFTIPP_VOTE_ADD, map);}}if ((post != null) && ((hash = post.get("votePositive", null)) != null)) {@@ -98,19 +98,19 @@ public class Supporter {map.put("vote", "positive");map.put("refid", post.get("refid", ""));map.put("comment", post.get("comment", ""));- sb.peers.newsPool.publishMyNews(sb.peers.mySeed(), yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, map);+ sb.peers.newsPool.publishMyNews(sb.peers.mySeed(), NewsPool.CATEGORY_SURFTIPP_VOTE_ADD, map);}// create Supporterfinal HashMap<String, Integer> negativeHashes = new HashMap<String, Integer>(); // a mapping from an url hash to Integer (count of votes)final HashMap<String, Integer> positiveHashes = new HashMap<String, Integer>(); // a mapping from an url hash to Integer (count of votes)- accumulateVotes(sb, negativeHashes, positiveHashes, yacyNewsPool.INCOMING_DB);+ accumulateVotes(sb, negativeHashes, positiveHashes, NewsPool.INCOMING_DB);//accumulateVotes(negativeHashes, positiveHashes, yacyNewsPool.OUTGOING_DB);//accumulateVotes(negativeHashes, positiveHashes, yacyNewsPool.PUBLISHED_DB);final ScoreMap<String> ranking = new ConcurrentScoreMap<String>(); // score cluster for url hashesfinal Row rowdef = new Row("String url-255, String title-120, String description-120, String refid-" + (GenericFormatter.PATTERN_SHORT_SECOND.length() + 12), NaturalOrder.naturalOrder);final HashMap<String, Entry> Supporter = new HashMap<String, Entry>(); // a mapping from an url hash to a kelondroRow.Entry with display properties- accumulateSupporter(sb, Supporter, ranking, rowdef, negativeHashes, positiveHashes, yacyNewsPool.INCOMING_DB);+ accumulateSupporter(sb, Supporter, ranking, rowdef, negativeHashes, positiveHashes, NewsPool.INCOMING_DB);//accumulateSupporter(Supporter, ranking, rowdef, negativeHashes, positiveHashes, yacyNewsPool.OUTGOING_DB);//accumulateSupporter(Supporter, ranking, rowdef, negativeHashes, positiveHashes, yacyNewsPool.PUBLISHED_DB);@@ -135,8 +135,8 @@ public class Supporter {description = row.getColUTF8(2);if ((url == null) || (title == null) || (description == null)) continue;refid = row.getColUTF8(3);- voted = (sb.peers.newsPool.getSpecific(yacyNewsPool.OUTGOING_DB, yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, "refid", refid) != null) ||- (sb.peers.newsPool.getSpecific(yacyNewsPool.PUBLISHED_DB, yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, "refid", refid) != null);+ voted = (sb.peers.newsPool.getSpecific(NewsPool.OUTGOING_DB, NewsPool.CATEGORY_SURFTIPP_VOTE_ADD, "refid", refid) != null) ||+ (sb.peers.newsPool.getSpecific(NewsPool.PUBLISHED_DB, NewsPool.CATEGORY_SURFTIPP_VOTE_ADD, "refid", refid) != null);prop.put("supporter_results_" + i + "_authorized", authenticated ? "1" : "0");prop.put("supporter_results_" + i + "_authorized_recommend", voted ? "0" : "1");@@ -173,17 +173,17 @@ public class Supporter {private static void accumulateVotes(final Switchboard sb, final HashMap<String, Integer> negativeHashes, final HashMap<String, Integer> positiveHashes, final int dbtype) {final int maxCount = Math.min(1000, sb.peers.newsPool.size(dbtype));- yacyNewsDB.Record record;- final Iterator<yacyNewsDB.Record> recordIterator = sb.peers.newsPool.recordIterator(dbtype, true);+ NewsDB.Record record;+ final Iterator<NewsDB.Record> recordIterator = sb.peers.newsPool.recordIterator(dbtype, true);int j = 0;while ((recordIterator.hasNext()) && (j++ < maxCount)) {record = recordIterator.next();if (record == null) continue;- if (record.category().equals(yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD)) {+ if (record.category().equals(NewsPool.CATEGORY_SURFTIPP_VOTE_ADD)) {final String urlhash = record.attribute("urlhash", "");final String vote = record.attribute("vote", "");- final int factor = ((dbtype == yacyNewsPool.OUTGOING_DB) || (dbtype == yacyNewsPool.PUBLISHED_DB)) ? 2 : 1;+ final int factor = ((dbtype == NewsPool.OUTGOING_DB) || (dbtype == NewsPool.PUBLISHED_DB)) ? 2 : 1;if (vote.equals("negative")) {final Integer i = negativeHashes.get(urlhash);if (i == null) negativeHashes.put(urlhash, Integer.valueOf(factor));@@ -203,20 +203,20 @@ public class Supporter {final HashMap<String, Entry> Supporter, final ScoreMap<String> ranking, final Row rowdef,final HashMap<String, Integer> negativeHashes, final HashMap<String, Integer> positiveHashes, final int dbtype) {final int maxCount = Math.min(1000, sb.peers.newsPool.size(dbtype));- yacyNewsDB.Record record;- final Iterator<yacyNewsDB.Record> recordIterator = sb.peers.newsPool.recordIterator(dbtype, true);+ NewsDB.Record record;+ final Iterator<NewsDB.Record> recordIterator = sb.peers.newsPool.recordIterator(dbtype, true);int j = 0;String url = "", urlhash;Row.Entry entry;int score = 0;Integer vote;- yacySeed seed;+ Seed seed;while ((recordIterator.hasNext()) && (j++ < maxCount)) {record = recordIterator.next();if (record == null) continue;entry = null;- if ((record.category().equals(yacyNewsPool.CATEGORY_PROFILE_UPDATE)) &&+ if ((record.category().equals(NewsPool.CATEGORY_PROFILE_UPDATE)) &&((seed = sb.peers.getConnected(record.originator())) != null)) {url = record.attribute("homepage", "");if (url.length() < 12) continue;@@ -229,7 +229,7 @@ public class Supporter {score = 1 + timeFactor(record.created());}- if ((record.category().equals(yacyNewsPool.CATEGORY_PROFILE_BROADCAST)) &&+ if ((record.category().equals(NewsPool.CATEGORY_PROFILE_BROADCAST)) &&((seed = sb.peers.getConnected(record.originator())) != null)) {url = record.attribute("homepage", "");if (url.length() < 12) continue;diff --git a/htroot/Surftips.java b/htroot/Surftips.javaindex 5d93eb3c9..b019494ab 100644--- a/htroot/Surftips.java+++ b/htroot/Surftips.java@@ -39,9 +39,9 @@ import net.yacy.kelondro.data.meta.DigestURI;import net.yacy.kelondro.index.Row;import net.yacy.kelondro.index.Row.Entry;import net.yacy.kelondro.order.NaturalOrder;-import net.yacy.peers.yacyNewsDB;-import net.yacy.peers.yacyNewsPool;-import net.yacy.peers.yacySeed;+import net.yacy.peers.NewsDB;+import net.yacy.peers.NewsPool;+import net.yacy.peers.Seed;import net.yacy.repository.Blacklist;import net.yacy.search.Switchboard;import de.anomic.server.serverObjects;@@ -88,7 +88,7 @@ public class Surftips {map.put("urlhash", hash);map.put("vote", "negative");map.put("refid", post.get("refid", ""));- sb.peers.newsPool.publishMyNews(sb.peers.mySeed(), yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, map);+ sb.peers.newsPool.publishMyNews(sb.peers.mySeed(), NewsPool.CATEGORY_SURFTIPP_VOTE_ADD, map);}}if ((post != null) && ((hash = post.get("votePositive", null)) != null)) {@@ -105,19 +105,19 @@ public class Surftips {map.put("vote", "positive");map.put("refid", post.get("refid", ""));map.put("comment", post.get("comment", ""));- sb.peers.newsPool.publishMyNews(sb.peers.mySeed(), yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, map);+ sb.peers.newsPool.publishMyNews(sb.peers.mySeed(), NewsPool.CATEGORY_SURFTIPP_VOTE_ADD, map);}// create surftipsfinal HashMap<String, Integer> negativeHashes = new HashMap<String, Integer>(); // a mapping from an url hash to Integer (count of votes)final HashMap<String, Integer> positiveHashes = new HashMap<String, Integer>(); // a mapping from an url hash to Integer (count of votes)- accumulateVotes(sb , negativeHashes, positiveHashes, yacyNewsPool.INCOMING_DB);+ accumulateVotes(sb , negativeHashes, positiveHashes, NewsPool.INCOMING_DB);//accumulateVotes(negativeHashes, positiveHashes, yacyNewsPool.OUTGOING_DB);//accumulateVotes(negativeHashes, positiveHashes, yacyNewsPool.PUBLISHED_DB);final ScoreMap<String> ranking = new ConcurrentScoreMap<String>(); // score cluster for url hashesfinal Row rowdef = new Row("String url-255, String title-120, String description-120, String refid-" + (GenericFormatter.PATTERN_SHORT_SECOND.length() + 12), NaturalOrder.naturalOrder);final HashMap<String, Entry> surftips = new HashMap<String, Entry>(); // a mapping from an url hash to a kelondroRow.Entry with display properties- accumulateSurftips(sb, surftips, ranking, rowdef, negativeHashes, positiveHashes, yacyNewsPool.INCOMING_DB);+ accumulateSurftips(sb, surftips, ranking, rowdef, negativeHashes, positiveHashes, NewsPool.INCOMING_DB);//accumulateSurftips(surftips, ranking, rowdef, negativeHashes, positiveHashes, yacyNewsPool.OUTGOING_DB);//accumulateSurftips(surftips, ranking, rowdef, negativeHashes, positiveHashes, yacyNewsPool.PUBLISHED_DB);@@ -143,8 +143,8 @@ public class Surftips {description = row.getColUTF8(2);if ((url == null) || (title == null) || (description == null)) continue;refid = row.getColUTF8(3);- voted = (sb.peers.newsPool.getSpecific(yacyNewsPool.OUTGOING_DB, yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, "refid", refid) != null) ||- (sb.peers.newsPool.getSpecific(yacyNewsPool.PUBLISHED_DB, yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, "refid", refid) != null);+ voted = (sb.peers.newsPool.getSpecific(NewsPool.OUTGOING_DB, NewsPool.CATEGORY_SURFTIPP_VOTE_ADD, "refid", refid) != null) ||+ (sb.peers.newsPool.getSpecific(NewsPool.PUBLISHED_DB, NewsPool.CATEGORY_SURFTIPP_VOTE_ADD, "refid", refid) != null);prop.put("surftips_results_" + i + "_authorized", (authenticated) ? "1" : "0");prop.put("surftips_results_" + i + "_authorized_recommend", (voted) ? "0" : "1");@@ -181,17 +181,17 @@ public class Surftips {private static void accumulateVotes(final Switchboard sb, final HashMap<String, Integer> negativeHashes, final HashMap<String, Integer> positiveHashes, final int dbtype) {final int maxCount = Math.min(1000, sb.peers.newsPool.size(dbtype));- yacyNewsDB.Record record;- final Iterator<yacyNewsDB.Record> recordIterator = sb.peers.newsPool.recordIterator(dbtype, true);+ NewsDB.Record record;+ final Iterator<NewsDB.Record> recordIterator = sb.peers.newsPool.recordIterator(dbtype, true);int j = 0;while ((recordIterator.hasNext()) && (j++ < maxCount)) {record = recordIterator.next();if (record == null) continue;- if (record.category().equals(yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD)) {+ if (record.category().equals(NewsPool.CATEGORY_SURFTIPP_VOTE_ADD)) {final String urlhash = record.attribute("urlhash", "");final String vote = record.attribute("vote", "");- final int factor = ((dbtype == yacyNewsPool.OUTGOING_DB) || (dbtype == yacyNewsPool.PUBLISHED_DB)) ? 2 : 1;+ final int factor = ((dbtype == NewsPool.OUTGOING_DB) || (dbtype == NewsPool.PUBLISHED_DB)) ? 2 : 1;if (vote.equals("negative")) {final Integer i = negativeHashes.get(urlhash);if (i == null) negativeHashes.put(urlhash, Integer.valueOf(factor));@@ -211,8 +211,8 @@ public class Surftips {final HashMap<String, Entry> surftips, final ScoreMap<String> ranking, final Row rowdef,final HashMap<String, Integer> negativeHashes, final HashMap<String, Integer> positiveHashes, final int dbtype) {final int maxCount = Math.min(1000, sb.peers.newsPool.size(dbtype));- yacyNewsDB.Record record;- final Iterator<yacyNewsDB.Record> recordIterator = sb.peers.newsPool.recordIterator(dbtype, true);+ NewsDB.Record record;+ final Iterator<NewsDB.Record> recordIterator = sb.peers.newsPool.recordIterator(dbtype, true);int j = 0;String url = "", urlhash;Row.Entry entry;@@ -223,7 +223,7 @@ public class Surftips {if (record == null) continue;entry = null;- if (record.category().equals(yacyNewsPool.CATEGORY_CRAWL_START)) {+ if (record.category().equals(NewsPool.CATEGORY_CRAWL_START)) {final String intention = record.attribute("intention", "");url = record.attribute("startURL", "");if (url.length() < 12) continue;@@ -236,7 +236,7 @@ public class Surftips {score = 2 + Math.min(10, intention.length() / 4) + timeFactor(record.created());}- if (record.category().equals(yacyNewsPool.CATEGORY_BOOKMARK_ADD)) {+ if (record.category().equals(NewsPool.CATEGORY_BOOKMARK_ADD)) {url = record.attribute("url", "");if (url.length() < 12) continue;entry = rowdef.newEntry(new byte[][]{@@ -248,7 +248,7 @@ public class Surftips {score = 8 + timeFactor(record.created());}- if (record.category().equals(yacyNewsPool.CATEGORY_SURFTIPP_ADD)) {+ if (record.category().equals(NewsPool.CATEGORY_SURFTIPP_ADD)) {url = record.attribute("url", "");if (url.length() < 12) continue;entry = rowdef.newEntry(new byte[][]{@@ -260,7 +260,7 @@ public class Surftips {score = 5 + timeFactor(record.created());}- if (record.category().equals(yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD)) {+ if (record.category().equals(NewsPool.CATEGORY_SURFTIPP_VOTE_ADD)) {if (!(record.attribute("vote", "negative").equals("positive"))) continue;url = record.attribute("url", "");if (url.length() < 12) continue;@@ -273,8 +273,8 @@ public class Surftips {score = 5 + timeFactor(record.created());}- if (record.category().equals(yacyNewsPool.CATEGORY_WIKI_UPDATE)) {- yacySeed seed = sb.peers.getConnected(record.originator());+ if (record.category().equals(NewsPool.CATEGORY_WIKI_UPDATE)) {+ Seed seed = sb.peers.getConnected(record.originator());if (seed == null) seed = sb.peers.getDisconnected(record.originator());if (seed != null) {url = "http://" + seed.getPublicAddress() + "/Wiki.html?page=" + record.attribute("page", "");@@ -288,8 +288,8 @@ public class Surftips {}}- if (record.category().equals(yacyNewsPool.CATEGORY_BLOG_ADD)) {- yacySeed seed = sb.peers.getConnected(record.originator());+ if (record.category().equals(NewsPool.CATEGORY_BLOG_ADD)) {+ Seed seed = sb.peers.getConnected(record.originator());if (seed == null) seed = sb.peers.getDisconnected(record.originator());if (seed != null) {url = "http://" + seed.getPublicAddress() + "/Blog.html?page=" + record.attribute("page", "");diff --git a/htroot/ViewProfile.java b/htroot/ViewProfile.javaindex bb81df8c1..4b358b8d0 100644--- a/htroot/ViewProfile.java+++ b/htroot/ViewProfile.java@@ -43,11 +43,11 @@ import java.util.Properties;import net.yacy.cora.protocol.RequestHeader;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;-import net.yacy.peers.yacyClient;-import net.yacy.peers.yacyCore;-import net.yacy.peers.yacyNewsDB;-import net.yacy.peers.yacyNewsPool;-import net.yacy.peers.yacySeed;+import net.yacy.peers.Protocol;+import net.yacy.peers.Network;+import net.yacy.peers.NewsDB;+import net.yacy.peers.NewsPool;+import net.yacy.peers.Seed;import net.yacy.search.Switchboard;import de.anomic.server.serverObjects;@@ -91,28 +91,28 @@ public class ViewProfile {prop.put("success_peerhash", sb.peers.mySeed().hash);} else {// read the profile from remote peer- yacySeed seed = sb.peers.getConnected(hash);+ Seed seed = sb.peers.getConnected(hash);if (seed == null) seed = sb.peers.getDisconnected(hash);if (seed == null) {prop.put("success", "1"); // peer unknown} else {// process news if existenttry {- final yacyNewsDB.Record record = sb.peers.newsPool.getByOriginator(yacyNewsPool.INCOMING_DB, yacyNewsPool.CATEGORY_PROFILE_UPDATE, seed.hash);- if (record != null) sb.peers.newsPool.moveOff(yacyNewsPool.INCOMING_DB, record.id());+ final NewsDB.Record record = sb.peers.newsPool.getByOriginator(NewsPool.INCOMING_DB, NewsPool.CATEGORY_PROFILE_UPDATE, seed.hash);+ if (record != null) sb.peers.newsPool.moveOff(NewsPool.INCOMING_DB, record.id());} catch (final Exception e) {Log.logException(e);}// try to get the profile from remote peerif (sb.clusterhashes != null) seed.setAlternativeAddress(sb.clusterhashes.get(seed.hash.getBytes()));- profile = yacyClient.getProfile(seed);+ profile = Protocol.getProfile(seed);// if profile did not arrive, say that peer is disconnectedif (profile == null) {prop.put("success", "2"); // peer known, but disconnected} else {- yacyCore.log.logInfo("fetched profile:" + profile);+ Network.log.logInfo("fetched profile:" + profile);prop.put("success", "3"); // everything ok}prop.putHTML("success_peername", seed.getName());diff --git a/htroot/Wiki.java b/htroot/Wiki.javaindex 3da502dd5..6a718807d 100644--- a/htroot/Wiki.java+++ b/htroot/Wiki.java@@ -41,7 +41,7 @@ import net.yacy.cora.document.UTF8;import net.yacy.cora.protocol.HeaderFramework;import net.yacy.cora.protocol.RequestHeader;import net.yacy.kelondro.util.ByteBuffer;-import net.yacy.peers.yacyNewsPool;+import net.yacy.peers.NewsPool;import net.yacy.search.Switchboard;import de.anomic.data.Diff;@@ -120,7 +120,7 @@ public class Wiki {map.put("page", pagename);map.put("author", author.replace(',', ' '));if (!sb.isRobinsonMode() && post.get("content", "").trim().length() > 0 && !ByteBuffer.equals(page.page(), content)) {- sb.peers.newsPool.publishMyNews(sb.peers.mySeed(), yacyNewsPool.CATEGORY_WIKI_UPDATE, map);+ sb.peers.newsPool.publishMyNews(sb.peers.mySeed(), NewsPool.CATEGORY_WIKI_UPDATE, map);}page = newEntry;prop.putHTML("LOCATION", "/Wiki.html?page=" + pagename);diff --git a/htroot/api/bookmarks/posts/add_p.java b/htroot/api/bookmarks/posts/add_p.javaindex cb49dcd02..8a98ca284 100755--- a/htroot/api/bookmarks/posts/add_p.java+++ b/htroot/api/bookmarks/posts/add_p.java@@ -4,7 +4,7 @@ import java.util.Map;import java.util.Set;import net.yacy.cora.protocol.RequestHeader;-import net.yacy.peers.yacyNewsPool;+import net.yacy.peers.NewsPool;import net.yacy.search.Switchboard;import de.anomic.data.BookmarkHelper;@@ -85,6 +85,6 @@ public class add_p {map.put("title", title.replace(',', ' '));map.put("description", description.replace(',', ' '));map.put("tags", tagsString.replace(',', ' '));- sb.peers.newsPool.publishMyNews(sb.peers.mySeed(), yacyNewsPool.CATEGORY_BOOKMARK_ADD, map);+ sb.peers.newsPool.publishMyNews(sb.peers.mySeed(), NewsPool.CATEGORY_BOOKMARK_ADD, map);}}\ No newline at end of filediff --git a/htroot/api/feed.java b/htroot/api/feed.javaindex 5588c66ed..c8150304a 100755--- a/htroot/api/feed.java+++ b/htroot/api/feed.java@@ -5,7 +5,7 @@ import java.util.Date;import net.yacy.cora.document.RSSFeed;import net.yacy.cora.document.RSSMessage;import net.yacy.cora.protocol.RequestHeader;-import net.yacy.peers.yacyChannel;+import net.yacy.peers.EventChannel;import net.yacy.search.Switchboard;import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;@@ -35,10 +35,10 @@ public class feed {channelIteration: for (final String channelName: channels) {// prevent that unauthorized access to this servlet get results from private data- final yacyChannel channel = yacyChannel.valueOf(channelName);+ final EventChannel channel = EventChannel.valueOf(channelName);if (channel == null) continue channelIteration;- if (!authorized && yacyChannel.privateChannels.contains(channel)) continue channelIteration; // allow only public channels if not authorized+ if (!authorized && EventChannel.privateChannels.contains(channel)) continue channelIteration; // allow only public channels if not authorizedif ("TEST".equals(channelName)) {// for interface testing return at least one single result@@ -56,7 +56,7 @@ public class feed {}// read the channel- final RSSFeed feed = yacyChannel.channels(channel);+ final RSSFeed feed = EventChannel.channels(channel);if (feed == null || feed.isEmpty()) continue channelIteration;RSSMessage message = feed.getChannel();diff --git a/htroot/api/queues_p.java b/htroot/api/queues_p.javaindex 23c51feb2..8e355e0ce 100755--- a/htroot/api/queues_p.java+++ b/htroot/api/queues_p.java@@ -6,7 +6,7 @@ import java.util.Locale;import net.yacy.cora.document.ASCII;import net.yacy.cora.document.UTF8;import net.yacy.cora.protocol.RequestHeader;-import net.yacy.peers.yacySeed;+import net.yacy.peers.Seed;import net.yacy.search.Switchboard;import net.yacy.search.SwitchboardConstants;import net.yacy.search.index.Segment;@@ -43,7 +43,7 @@ public class queues_p {prop.put("rejected", "0");//int showRejectedCount = 10;- yacySeed initiator;+ Seed initiator;// index sizeprop.putNum("urlpublictextSize", segment.urlMetadata().size());@@ -99,7 +99,7 @@ public class queues_p {public static final void addNTable(final Switchboard sb, final serverObjects prop, final String tableName, final List<Request> crawlerList) {int showNum = 0;- yacySeed initiator;+ Seed initiator;for (final Request urle : crawlerList) {if ((urle != null) && (urle.url() != null)) {initiator = sb.peers.getConnected((urle.initiator() == null) ? "" : UTF8.String(urle.initiator()));diff --git a/htroot/api/timeline.java b/htroot/api/timeline.javaindex ba461c608..43d59bc3b 100644--- a/htroot/api/timeline.java+++ b/htroot/api/timeline.java@@ -38,7 +38,7 @@ import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.rwi.ReferenceContainer;import net.yacy.kelondro.rwi.TermSearch;import net.yacy.kelondro.util.ISO639;-import net.yacy.peers.yacyCore;+import net.yacy.peers.Network;import net.yacy.search.Switchboard;import net.yacy.search.index.Segment;import net.yacy.search.index.Segments;@@ -119,7 +119,7 @@ public final class timeline {prop.put("event", c);// log- yacyCore.log.logInfo("EXIT TIMELINE SEARCH: " ++ Network.log.logInfo("EXIT TIMELINE SEARCH: " +QueryParams.anonymizedQueryHashes(q) + " - " + joincount + " links found, " +prop.get("linkcount", "?") + " links selected, " +indexabstractContainercount + " index abstracts, " +diff --git a/htroot/rct_p.java b/htroot/rct_p.javaindex 2939738dc..120e813b6 100644--- a/htroot/rct_p.java+++ b/htroot/rct_p.java@@ -33,8 +33,8 @@ import net.yacy.cora.document.RSSFeed;import net.yacy.cora.document.Hit;import net.yacy.cora.protocol.RequestHeader;import net.yacy.kelondro.data.meta.DigestURI;-import net.yacy.peers.yacyClient;-import net.yacy.peers.yacySeed;+import net.yacy.peers.Protocol;+import net.yacy.peers.Seed;import net.yacy.peers.dht.PeerSelection;import net.yacy.search.Switchboard;@@ -52,8 +52,8 @@ public class rct_p {if (post != null) {if (post.containsKey("retrieve")) {final String peerhash = post.get("peer", null);- final yacySeed seed = (peerhash == null) ? null : sb.peers.getConnected(peerhash);- final RSSFeed feed = (seed == null) ? null : yacyClient.queryRemoteCrawlURLs(sb.peers, seed, 20, 60000);+ final Seed seed = (peerhash == null) ? null : sb.peers.getConnected(peerhash);+ final RSSFeed feed = (seed == null) ? null : Protocol.queryRemoteCrawlURLs(sb.peers, seed, 20, 60000);if (feed != null) {for (final Hit item: feed) {//System.out.println("URL=" + item.getLink() + ", desc=" + item.getDescription() + ", pubDate=" + item.getPubDate());@@ -108,15 +108,15 @@ public class rct_p {private static void listHosts(final Switchboard sb, final serverObjects prop) {// list known hosts- yacySeed seed;+ Seed seed;int hc = 0;if (sb.peers != null && sb.peers.sizeConnected() > 0) {- final Iterator<yacySeed> e = PeerSelection.getProvidesRemoteCrawlURLs(sb.peers);+ final Iterator<Seed> e = PeerSelection.getProvidesRemoteCrawlURLs(sb.peers);while (e.hasNext()) {seed = e.next();if (seed != null) {prop.put("hosts_" + hc + "_hosthash", seed.hash);- prop.putHTML("hosts_" + hc + "_hostname", seed.hash + " " + seed.get(yacySeed.NAME, "nameless") + " (" + seed.getLong(yacySeed.RCOUNT, 0) + ")");+ prop.putHTML("hosts_" + hc + "_hostname", seed.hash + " " + seed.get(Seed.NAME, "nameless") + " (" + seed.getLong(Seed.RCOUNT, 0) + ")");hc++;}}diff --git a/htroot/sharedBlacklist_p.java b/htroot/sharedBlacklist_p.javaindex 6da4e5723..8a2473dfe 100644--- a/htroot/sharedBlacklist_p.java+++ b/htroot/sharedBlacklist_p.java@@ -51,7 +51,7 @@ import net.yacy.cora.protocol.RequestHeader;import net.yacy.document.parser.html.CharacterCoding;import net.yacy.kelondro.data.meta.DigestURI;import net.yacy.kelondro.util.FileUtils;-import net.yacy.peers.yacySeed;+import net.yacy.peers.Seed;import net.yacy.repository.Blacklist;import net.yacy.search.Switchboard;import net.yacy.search.query.SearchEventCache;@@ -121,11 +121,11 @@ public class sharedBlacklist_p {// generate the download URLString downloadURLOld = null;if( sb.peers != null ){ //no nullpointer error..- final yacySeed seed = sb.peers.getConnected(hash);+ final Seed seed = sb.peers.getConnected(hash);if (seed != null) {final String IP = seed.getIP();- final String Port = seed.get(yacySeed.PORT, "8090");- final String peerName = seed.get(yacySeed.NAME, "<" + IP + ":" + Port + ">");+ final String Port = seed.get(Seed.PORT, "8090");+ final String peerName = seed.get(Seed.NAME, "<" + IP + ":" + Port + ">");prop.putHTML("page_source", peerName);downloadURLOld = "http://" + IP + ":" + Port + "/yacy/list.html?col=black";} else {diff --git a/htroot/www/welcome.java b/htroot/www/welcome.javaindex d8a162e96..b43e6040e 100644--- a/htroot/www/welcome.java+++ b/htroot/www/welcome.java@@ -32,7 +32,7 @@ import java.io.File;import net.yacy.cora.protocol.Domains;import net.yacy.cora.protocol.HeaderFramework;import net.yacy.cora.protocol.RequestHeader;-import net.yacy.peers.yacySeed;+import net.yacy.peers.Seed;import net.yacy.search.Switchboard;import de.anomic.server.serverCore;@@ -58,8 +58,8 @@ public class welcome {prop.put("port", serverCore.getPortNr(env.getConfig("port","8090")));prop.put("clientip", header.get(HeaderFramework.CONNECTION_PROP_CLIENTIP, ""));- final String peertype = (sb.peers.mySeed() == null) ? yacySeed.PEERTYPE_JUNIOR : sb.peers.mySeed().get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_VIRGIN);- final boolean senior = (peertype.equals(yacySeed.PEERTYPE_SENIOR)) || (peertype.equals(yacySeed.PEERTYPE_PRINCIPAL));+ final String peertype = (sb.peers.mySeed() == null) ? Seed.PEERTYPE_JUNIOR : sb.peers.mySeed().get(Seed.PEERTYPE, Seed.PEERTYPE_VIRGIN);+ final boolean senior = (peertype.equals(Seed.PEERTYPE_SENIOR)) || (peertype.equals(Seed.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", "<b>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.</b>"); }final File wwwpath = env.getDataPath("htDocsPath", "DATA/HTDOCS");diff --git a/htroot/yacy/crawlReceipt.java b/htroot/yacy/crawlReceipt.javaindex 2a8770ef6..a4567cfa4 100644--- a/htroot/yacy/crawlReceipt.java+++ b/htroot/yacy/crawlReceipt.java@@ -1,4 +1,4 @@-// crawlReceipt.java+// crawlReceipt.java// -----------------------// part of the AnomicHTTPD caching proxy// (C) by Michael Peter Christen; [email protected]@@ -33,11 +33,10 @@ import net.yacy.cora.document.ASCII;import net.yacy.cora.protocol.RequestHeader;import net.yacy.kelondro.data.meta.URIMetadataRow;import net.yacy.kelondro.logging.Log;-import net.yacy.peers.yacyNetwork;-import net.yacy.peers.yacySeed;+import net.yacy.peers.Seed;+import net.yacy.peers.Protocol;import net.yacy.search.Switchboard;import net.yacy.search.index.Segments;-import de.anomic.crawler.ResultURLs;import de.anomic.crawler.ResultURLs.EventOrigin;import de.anomic.crawler.ZURL.FailCategory;@@ -47,7 +46,7 @@ import de.anomic.tools.crypt;public final class crawlReceipt {-+/** this is used to respond on a remote crawling request*/@@ -56,10 +55,10 @@ public final class crawlReceipt {// return variable that accumulates replacementsfinal Switchboard sb = (Switchboard) env;final serverObjects prop = new serverObjects();- if ((post == null) || (env == null) || !yacyNetwork.authentifyRequest(post, env)) {+ if ((post == null) || (env == null) || !Protocol.authentifyRequest(post, env)) {return prop;}-+final Log log = sb.getLog();//int proxyPrefetchDepth = Integer.parseInt(env.getConfig("proxyPrefetchDepth", "0"));@@ -75,7 +74,7 @@ public final class crawlReceipt {final String reason = post.get("reason", ""); // the reason for that result//String words = post.get("wordh", ""); // priority word hashesfinal String propStr = crypt.simpleDecode(post.get("lurlEntry", ""), key);-+/*the result can have one of the following values:negative cases, no retry@@ -86,38 +85,38 @@ public final class crawlReceipt {negative cases, retry possiblerejected - the peer has rejected to load the resourcedequeue - peer too busy - rejected to crawl-+positive cases with crawlingfill - the resource was loaded and processedupdate - the resource was already in database but re-loaded and processed-- positive cases without crawling++ positive cases without crawlingknown - the resource is already in database, believed to be fresh and not reloadedstale - the resource was reloaded but not processed because source had no changes*/-- final yacySeed otherPeer = sb.peers.get(iam);- final String otherPeerName = iam + ":" + ((otherPeer == null) ? "NULL" : (otherPeer.getName() + "/" + otherPeer.getVersion()));++ final Seed otherPeer = sb.peers.get(iam);+ final String otherPeerName = iam + ":" + ((otherPeer == null) ? "NULL" : (otherPeer.getName() + "/" + otherPeer.getVersion()));if ((sb.peers.mySeed() == null) || (!(sb.peers.mySeed().hash.equals(youare)))) {// no yacy connection / unknown peersprop.put("delay", "3600");return prop;}-+if (propStr == null) {// error with url / wrong keyprop.put("delay", "3600");return prop;}-+if ((sb.isRobinsonMode()) && (!sb.isInMyCluster(otherPeer))) {// we reject urls that are from outside our clusterprop.put("delay", "9999");return prop;}-+// generating a new loaded URL entryfinal URIMetadataRow entry = URIMetadataRow.importEntry(propStr);if (entry == null) {@@ -125,14 +124,14 @@ public final class crawlReceipt {prop.put("delay", "3600");return prop;}-+final URIMetadataRow.Components metadata = entry.metadata();if (metadata.url() == null) {if (log.isWarning()) log.logWarning("crawlReceipt: RECEIVED wrong RECEIPT (url null) for hash " + ASCII.String(entry.hash()) + " from peer " + iam + "\n\tURL properties: "+ propStr);prop.put("delay", "3600");return prop;}-+// check if the entry is in our network domainfinal String urlRejectReason = sb.crawlStacker.urlInAcceptedDomain(metadata.url());if (urlRejectReason != null) {@@ -140,7 +139,7 @@ public final class crawlReceipt {prop.put("delay", "9999");return prop;}-+if ("fill".equals(result)) try {// put new entry into databasesb.indexSegments.urlMetadata(Segments.Process.RECEIPTS).store(entry);@@ -168,9 +167,9 @@ public final class crawlReceipt {//switchboard.noticeURL.remove(receivedUrlhash);prop.put("delay", "3600");return prop;-+// return rewrite properties-+}}diff --git a/htroot/yacy/hello.java b/htroot/yacy/hello.javaindex de76b82b6..91cc9c7bc 100644--- a/htroot/yacy/hello.java+++ b/htroot/yacy/hello.java@@ -38,10 +38,9 @@ import net.yacy.cora.protocol.HeaderFramework;import net.yacy.cora.protocol.RequestHeader;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.util.EventTracker;-import net.yacy.peers.yacyClient;-import net.yacy.peers.yacyCore;-import net.yacy.peers.yacyNetwork;-import net.yacy.peers.yacySeed;+import net.yacy.peers.Seed;+import net.yacy.peers.Protocol;+import net.yacy.peers.Network;import net.yacy.peers.dht.PeerSelection;import net.yacy.peers.graphics.ProfilingGraph;import net.yacy.peers.operation.yacyVersion;@@ -64,7 +63,7 @@ public final class hello {prop.put("message", "no post or no enviroment");return prop;}- if (!yacyNetwork.authentifyRequest(post, env)) {+ if (!Protocol.authentifyRequest(post, env)) {prop.put("message", "not in my network");return prop;}@@ -81,26 +80,26 @@ public final class hello {final InetAddress ias = Domains.dnsResolve(clientip);final long time_dnsResolve = System.currentTimeMillis() - time;if (ias == null) {- yacyCore.log.logInfo("hello/server: failed contacting seed; clientip not resolvable (clientip=" + clientip + ", time_dnsResolve=" + time_dnsResolve + ")");+ Network.log.logInfo("hello/server: failed contacting seed; clientip not resolvable (clientip=" + clientip + ", time_dnsResolve=" + time_dnsResolve + ")");prop.put("message", "cannot resolve your IP from your reported location " + clientip);return prop;}- if (seed.length() > yacySeed.maxsize) {- yacyCore.log.logInfo("hello/server: rejected contacting seed; too large (" + seed.length() + " > " + yacySeed.maxsize + ", time_dnsResolve=" + time_dnsResolve + ")");+ if (seed.length() > Seed.maxsize) {+ Network.log.logInfo("hello/server: rejected contacting seed; too large (" + seed.length() + " > " + Seed.maxsize + ", time_dnsResolve=" + time_dnsResolve + ")");prop.put("message", "your seed is too long (" + seed.length() + ")");return prop;}- yacySeed remoteSeed;+ Seed remoteSeed;try {- remoteSeed = yacySeed.genRemoteSeed(seed, key, true, ias.getHostAddress());+ remoteSeed = Seed.genRemoteSeed(seed, key, true, ias.getHostAddress());} catch (final IOException e) {- yacyCore.log.logInfo("hello/server: bad seed: " + e.getMessage() + ", time_dnsResolve=" + time_dnsResolve);+ Network.log.logInfo("hello/server: bad seed: " + e.getMessage() + ", time_dnsResolve=" + time_dnsResolve);prop.put("message", "bad seed: " + e.getMessage());return prop;}if (remoteSeed == null || remoteSeed.hash == null) {- yacyCore.log.logInfo("hello/server: bad seed: null, time_dnsResolve=" + time_dnsResolve);+ Network.log.logInfo("hello/server: bad seed: null, time_dnsResolve=" + time_dnsResolve);prop.put("message", "cannot parse your seed");return prop;}@@ -112,7 +111,7 @@ public final class hello {// we easily know the caller's IP:final String userAgent = header.get(HeaderFramework.USER_AGENT, "<unknown>");final String reportedip = remoteSeed.getIP();- final String reportedPeerType = remoteSeed.get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_JUNIOR);+ final String reportedPeerType = remoteSeed.get(Seed.PEERTYPE, Seed.PEERTYPE_JUNIOR);final float clientversion = remoteSeed.getVersion();if (sb.isRobinsonMode() && !sb.isPublicRobinson()) {@@ -139,7 +138,7 @@ public final class hello {// try first the reportedip, since this may be a connect from a port-forwarding hostprop.put("yourip", reportedip);remoteSeed.setIP(reportedip);- callback = yacyClient.queryUrlCount(remoteSeed);+ callback = Protocol.queryUrlCount(remoteSeed);time_backping = System.currentTimeMillis() - time;backping_method = "reportedip=" + reportedip;} else {@@ -162,7 +161,7 @@ public final class hello {prop.put("yourip", clientip);remoteSeed.setIP(clientip);- callback = yacyClient.queryUrlCount(remoteSeed);+ callback = Protocol.queryUrlCount(remoteSeed);time_backping = System.currentTimeMillis() - time;backping_method = "clientip=" + clientip;}@@ -175,22 +174,22 @@ public final class hello {// assign statusfinal int connectedBefore = sb.peers.sizeConnected();if (callback[0] >= 0) {- if (remoteSeed.get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_SENIOR) == null) {- prop.put(yacySeed.YOURTYPE, yacySeed.PEERTYPE_SENIOR);- remoteSeed.put(yacySeed.PEERTYPE, yacySeed.PEERTYPE_SENIOR);- } else if (remoteSeed.get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_PRINCIPAL).equals(yacySeed.PEERTYPE_PRINCIPAL)) {- prop.put(yacySeed.YOURTYPE, yacySeed.PEERTYPE_PRINCIPAL);+ if (remoteSeed.get(Seed.PEERTYPE, Seed.PEERTYPE_SENIOR) == null) {+ prop.put(Seed.YOURTYPE, Seed.PEERTYPE_SENIOR);+ remoteSeed.put(Seed.PEERTYPE, Seed.PEERTYPE_SENIOR);+ } else if (remoteSeed.get(Seed.PEERTYPE, Seed.PEERTYPE_PRINCIPAL).equals(Seed.PEERTYPE_PRINCIPAL)) {+ prop.put(Seed.YOURTYPE, Seed.PEERTYPE_PRINCIPAL);} else {- prop.put(yacySeed.YOURTYPE, yacySeed.PEERTYPE_SENIOR);- remoteSeed.put(yacySeed.PEERTYPE, yacySeed.PEERTYPE_SENIOR);+ prop.put(Seed.YOURTYPE, Seed.PEERTYPE_SENIOR);+ remoteSeed.put(Seed.PEERTYPE, Seed.PEERTYPE_SENIOR);}// connect the seed- yacyCore.log.logInfo("hello/server: responded remote senior peer '" + remoteSeed.getName() + "' from " + reportedip + ", time_dnsResolve=" + time_dnsResolve + ", time_backping=" + time_backping + ", method=" + backping_method + ", urls=" + callback[0]);+ Network.log.logInfo("hello/server: responded remote senior peer '" + remoteSeed.getName() + "' from " + reportedip + ", time_dnsResolve=" + time_dnsResolve + ", time_backping=" + time_backping + ", method=" + backping_method + ", urls=" + callback[0]);sb.peers.peerActions.peerArrival(remoteSeed, true);} else {- prop.put(yacySeed.YOURTYPE, yacySeed.PEERTYPE_JUNIOR);- remoteSeed.put(yacySeed.PEERTYPE, yacySeed.PEERTYPE_JUNIOR);- yacyCore.log.logInfo("hello/server: responded remote junior peer '" + remoteSeed.getName() + "' from " + reportedip + ", time_dnsResolve=" + time_dnsResolve + ", time_backping=" + time_backping + ", method=" + backping_method + ", urls=" + callback[0]);+ prop.put(Seed.YOURTYPE, Seed.PEERTYPE_JUNIOR);+ remoteSeed.put(Seed.PEERTYPE, Seed.PEERTYPE_JUNIOR);+ Network.log.logInfo("hello/server: responded remote junior peer '" + remoteSeed.getName() + "' from " + reportedip + ", time_dnsResolve=" + time_dnsResolve + ", time_backping=" + time_backping + ", method=" + backping_method + ", urls=" + callback[0]);// no connection here, instead store junior in connection cacheif ((remoteSeed.hash != null) && (remoteSeed.isProper(false) == null)) {sb.peers.peerActions.peerPing(remoteSeed);@@ -202,11 +201,11 @@ public final class hello {EventTracker.update(EventTracker.EClass.PEERPING, new ProfilingGraph.EventPing(remoteSeed.getName(), sb.peers.myName(), false, connectedAfter - connectedBefore), false);sb.peers.peerActions.setUserAgent(clientip, userAgent);- if (!(prop.get(yacySeed.YOURTYPE)).equals(reportedPeerType)) {- yacyCore.log.logInfo("hello/server: changing remote peer '" + remoteSeed.getName() ++ if (!(prop.get(Seed.YOURTYPE)).equals(reportedPeerType)) {+ Network.log.logInfo("hello/server: changing remote peer '" + remoteSeed.getName() +"' [" + reportedip +"] peerType from '" + reportedPeerType +- "' to '" + prop.get(yacySeed.YOURTYPE) + "'.");+ "' to '" + prop.get(Seed.YOURTYPE) + "'.");}serverCore.checkInterruption();@@ -217,7 +216,7 @@ public final class hello {if (count > 100) { count = 100; }// latest seeds- final Map<String, yacySeed> ySeeds = PeerSelection.seedsByAge(sb.peers, true, count); // peerhash/yacySeed relation+ final Map<String, Seed> ySeeds = PeerSelection.seedsByAge(sb.peers, true, count); // peerhash/yacySeed relation// attach also my own seedseeds.append("seed0=").append(sb.peers.mySeed().genSeedStr(key)).append(serverCore.CRLF_STRING);@@ -226,8 +225,8 @@ public final class hello {// attach other seedsif (ySeeds != null) {seeds.ensureCapacity((ySeeds.size() + 1) * 768);- final Iterator<yacySeed> si = ySeeds.values().iterator();- yacySeed s;+ final Iterator<Seed> si = ySeeds.values().iterator();+ Seed s;String seedString;while (si.hasNext()) {s = si.next();@@ -250,7 +249,7 @@ public final class hello {prop.put("seedlist", seeds.toString());// return rewrite propertiesprop.put("message", "ok " + seed.length());- yacyCore.log.logInfo("hello/server: responded remote peer '" + remoteSeed.getName() + "' [" + reportedip + "] in " + (System.currentTimeMillis() - start) + " milliseconds");+ Network.log.logInfo("hello/server: responded remote peer '" + remoteSeed.getName() + "' [" + reportedip + "] in " + (System.currentTimeMillis() - start) + " milliseconds");return prop;}diff --git a/htroot/yacy/idx.java b/htroot/yacy/idx.javaindex 65b0a3ed0..6384a5cf3 100644--- a/htroot/yacy/idx.java+++ b/htroot/yacy/idx.java@@ -11,12 +11,12 @@* modify it under the terms of the GNU Lesser General Public* License as published by the Free Software Foundation; either* version 2.1 of the License, or (at your option) any later version.- *+ ** This library is distributed in the hope that it will be useful,* but WITHOUT ANY WARRANTY; without even the implied warranty of* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU* Lesser General Public License for more details.- *+ ** You should have received a copy of the GNU Lesser General Public License* along with this program in the file lgpl21.txt* If not, see <http://www.gnu.org/licenses/>.@@ -28,7 +28,7 @@ import net.yacy.cora.document.ASCII;import net.yacy.cora.protocol.RequestHeader;import net.yacy.kelondro.rwi.ReferenceContainer;import net.yacy.kelondro.rwi.ReferenceContainerCache;-import net.yacy.peers.yacyNetwork;+import net.yacy.peers.Protocol;import net.yacy.peers.graphics.WebStructureGraph;import net.yacy.peers.graphics.WebStructureGraph.HostReference;import net.yacy.search.Switchboard;@@ -39,7 +39,7 @@ public final class idx {// example:// http://localhost:8090/yacy/idx.json?object=host-+public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {final serverObjects prop = new serverObjects();@@ -50,20 +50,20 @@ public final class idx {// return variable that accumulates replacementsfinal Switchboard sb = (Switchboard) env;-- if (sb.adminAuthenticated(header) < 2 && !yacyNetwork.authentifyRequest(post, env)) {++ if (sb.adminAuthenticated(header) < 2 && !Protocol.authentifyRequest(post, env)) {return prop;}-+if (post.get("object", "").equals("host")) {prop.put("name","host");- ReferenceContainerCache<HostReference> idx = sb.webStructure.incomingReferences();+ final ReferenceContainerCache<HostReference> idx = sb.webStructure.incomingReferences();prop.put("rowdef", WebStructureGraph.hostReferenceFactory.getRow().toString());int count = 0;- for (ReferenceContainer<HostReference> references: idx) {+ for (final ReferenceContainer<HostReference> references: idx) {prop.put("list_" + count + "_term", ASCII.String(references.getTermHash()));- Iterator<HostReference> referenceIterator = references.entries();- StringBuilder s = new StringBuilder();+ final Iterator<HostReference> referenceIterator = references.entries();+ final StringBuilder s = new StringBuilder();HostReference reference;while (referenceIterator.hasNext()) {reference = referenceIterator.next();diff --git a/htroot/yacy/list.java b/htroot/yacy/list.javaindex 94196bffc..3fd57c521 100644--- a/htroot/yacy/list.java+++ b/htroot/yacy/list.java@@ -1,4 +1,4 @@-// list.java+// list.java// -----------------------// (C) 2004 by Michael Peter Christen; [email protected], Frankfurt a. M., Germany// first published 2004 on http://yacy.net@@ -10,7 +10,7 @@// $LastChangedBy: orbiter $//// LICENSE-//+//// 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// the Free Software Foundation; either version 2 of the License, or@@ -31,11 +31,10 @@ import java.io.File;import net.yacy.cora.protocol.HeaderFramework;import net.yacy.cora.protocol.RequestHeader;import net.yacy.kelondro.util.FileUtils;-import net.yacy.peers.yacyNetwork;-import net.yacy.peers.yacySeed;+import net.yacy.peers.Seed;+import net.yacy.peers.Protocol;import net.yacy.search.Switchboard;import net.yacy.search.SwitchboardConstants;-import de.anomic.server.serverCore;import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;@@ -52,23 +51,23 @@ public final class list {// return variable that accumulates replacementsfinal serverObjects prop = new serverObjects();if ((post == null) || (env == null)) return prop;- if (!yacyNetwork.authentifyRequest(post, env)) return prop;-+ if (!Protocol.authentifyRequest(post, env)) return prop;+final String col = post.get("col", "");final File listsPath = env.getDataPath(SwitchboardConstants.LISTS_PATH, SwitchboardConstants.LISTS_PATH_DEFAULT);-+String otherPeerName = null;if (post.containsKey("iam")) {- final yacySeed bla = sb.peers.get(post.get("iam", ""));+ final Seed bla = sb.peers.get(post.get("iam", ""));if (bla != null) otherPeerName = bla.getName();}if (otherPeerName == null) otherPeerName = header.get(HeaderFramework.CONNECTION_PROP_CLIENTIP);-+if ((sb.isRobinsonMode()) && (!sb.isInMyCluster(otherPeerName))) {// if we are a robinson cluster, answer only if this client is known by our network definitionreturn null;}-+if (col.equals("black")) {final StringBuilder out = new StringBuilder(10000);@@ -76,9 +75,8 @@ public final class list {final String[] filenamesarray = filenames.split(",");if (filenamesarray.length > 0){- for (int i = 0;i < filenamesarray.length; i++) {- if (blackListName.equals("") || filenamesarray[i].equals(blackListName)) {- final String filename = filenamesarray[i];+ for (final String filename : filenamesarray) {+ if (blackListName.equals("") || filename.equals(blackListName)) {final File fileObj = new File(listsPath,filename);out.append(FileUtils.getListString(fileObj, false)).append(serverCore.CRLF_STRING);}@@ -89,7 +87,7 @@ public final class list {} else {prop.put("list","");}-+return prop;}}\ No newline at end of filediff --git a/htroot/yacy/message.java b/htroot/yacy/message.javaindex a56712b37..f4446f997 100644--- a/htroot/yacy/message.java+++ b/htroot/yacy/message.java@@ -1,4 +1,4 @@-// message.java+// message.java// -----------------------// part of the AnomicHTTPD caching proxy// (C) by Michael Peter Christen; [email protected]@@ -41,11 +41,10 @@ import net.yacy.cora.protocol.HeaderFramework;import net.yacy.cora.protocol.RequestHeader;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.util.FileUtils;-import net.yacy.peers.yacyCore;-import net.yacy.peers.yacyNetwork;-import net.yacy.peers.yacySeed;+import net.yacy.peers.Seed;+import net.yacy.peers.Protocol;+import net.yacy.peers.Network;import net.yacy.search.Switchboard;-import de.anomic.data.MessageBoard;import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;@@ -65,13 +64,13 @@ public final class message {final Switchboard sb = (Switchboard) env;final serverObjects prop = new serverObjects();if ((post == null) || (env == null)) return prop;- if (!yacyNetwork.authentifyRequest(post, env)) return prop;+ if (!Protocol.authentifyRequest(post, env)) return prop;final String process = post.get("process", "permission");final String key = post.get("key", "");final String clientip = header.get(HeaderFramework.CONNECTION_PROP_CLIENTIP, "<unknown>"); // read an artificial header addendumfinal InetAddress ias = Domains.dnsResolve(clientip);-+final int messagesize = 10240;final int attachmentsize = 0;@@ -93,7 +92,7 @@ public final class message {prop.put("response", "-1"); // request rejectedreturn prop;}-+prop.put("messagesize", Integer.toString(messagesize));prop.put("attachmentsize", Integer.toString(attachmentsize));@@ -112,10 +111,10 @@ public final class message {return prop;}//Date remoteTime = yacyCore.parseUniversalDate((String) post.get(yacySeed.MYTIME)); // read remote time- yacySeed otherSeed;+ Seed otherSeed;try {- otherSeed = yacySeed.genRemoteSeed(otherSeedString, key, false, ias.getHostAddress());- } catch (IOException e) {+ otherSeed = Seed.genRemoteSeed(otherSeedString, key, false, ias.getHostAddress());+ } catch (final IOException e) {prop.put("response", "-1"); // don't accept messages for bad seedsreturn prop;}@@ -132,7 +131,7 @@ public final class message {prop.put("response", "-1"); // don't accept empty messagesreturn prop;}-+prop.put("response", "Thank you!");// save message@@ -141,7 +140,7 @@ public final class message {mb = UTF8.getBytes(message);sb.messageDB.write(msgEntry = sb.messageDB.newEntry("remote",- otherSeed.get(yacySeed.NAME, "anonymous"), otherSeed.hash,+ otherSeed.get(Seed.NAME, "anonymous"), otherSeed.hash,sb.peers.mySeed().getName(), sb.peers.mySeed().hash,subject, mb));@@ -154,7 +153,7 @@ public final class message {FileUtils.copy(notifierSource, notifierDest);} catch (final IOException e) {Log.logSevere("MESSAGE", "NEW MESSAGE ARRIVED! (error: " + e.getMessage() + ")");-+}}// System.out.println("respond = " + prop.toString());@@ -177,7 +176,7 @@ public final class message {// get the recipient addressfinal String sendMailTo = sb.getConfig("msgForwardingTo","root@localhost").trim();-+// get the sendmail configurationfinal String sendMailStr = sb.getConfig("msgForwardingCmd","/usr/bin/sendmail")+" "+sendMailTo;final String[] sendMail = sendMailStr.trim().split(" ");@@ -199,7 +198,7 @@ public final class message {.append("/").append(msgEntry.authorHash()).append("\nMessage to: ")- .append(msgEntry.recipient())+ .append(msgEntry.recipient()).append("/").append(msgEntry.recipientHash()).append("\nCategory: ")@@ -210,15 +209,15 @@ public final class message {final Process process=Runtime.getRuntime().exec(sendMail);final PrintWriter email = new PrintWriter(process.getOutputStream());email.print(emailTxt.toString());- email.close();+ email.close();} catch (final Exception e) {- yacyCore.log.logWarning("message: message forwarding via email failed. ",e);+ Network.log.logWarning("message: message forwarding via email failed. ",e);}}/*- on 83+ on 83DEBUG: message post values = {youare=Ty2F86ekSWM5, key=pPQSZaXD, iam=WSjicAx1hRio, process=permission}von 93 wurde gesendet:DEBUG: PUT BODY=------------1090394265522diff --git a/htroot/yacy/profile.java b/htroot/yacy/profile.javaindex d3b1a5280..6f9f85be2 100644--- a/htroot/yacy/profile.java+++ b/htroot/yacy/profile.java@@ -1,4 +1,4 @@-// profile.java+// profile.java// -----------------------// part of YaCy// (C) by Michael Peter Christen; [email protected]@@ -37,9 +37,8 @@ import java.util.Properties;import net.yacy.cora.protocol.HeaderFramework;import net.yacy.cora.protocol.RequestHeader;-import net.yacy.peers.yacyNetwork;+import net.yacy.peers.Protocol;import net.yacy.search.Switchboard;-import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;@@ -50,7 +49,7 @@ public final class profile {final serverObjects prop = new serverObjects();final Switchboard sb = (Switchboard) env;if ((post == null) || (env == null)) return prop;- if (!yacyNetwork.authentifyRequest(post, env)) return prop;+ if (!Protocol.authentifyRequest(post, env)) return prop;if ((sb.isRobinsonMode()) &&(!sb.isPublicRobinson()) &&@@ -59,7 +58,7 @@ public final class profile {prop.put("list", "0");return prop;}-+final Properties profile = new Properties();int count=0;String key="";@@ -68,7 +67,7 @@ public final class profile {FileInputStream fileIn = null;try {fileIn = new FileInputStream(new File("DATA/SETTINGS/profile.txt"));- profile.load(fileIn);+ profile.load(fileIn);} catch(final IOException e) {} finally {if (fileIn != null) try { fileIn.close(); fileIn = null; } catch (final Exception e) {}diff --git a/htroot/yacy/query.java b/htroot/yacy/query.javaindex 591cbf57c..6fbc23a8b 100644--- a/htroot/yacy/query.java+++ b/htroot/yacy/query.java@@ -28,12 +28,13 @@// if the shell's current path is HTROOTimport java.io.IOException;+import net.yacy.cora.date.GenericFormatter;import net.yacy.cora.protocol.HeaderFramework;import net.yacy.cora.protocol.RequestHeader;import net.yacy.kelondro.logging.Log;-import net.yacy.peers.yacyCore;-import net.yacy.peers.yacyNetwork;+import net.yacy.peers.Protocol;+import net.yacy.peers.Network;import net.yacy.search.Switchboard;import net.yacy.search.index.Segments;import de.anomic.server.serverObjects;@@ -43,7 +44,7 @@ public final class query {// example:// http://localhost:8090/yacy/query.html?youare=sCJ6Tq8T0N9x&object=lurlcount-+public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch ss) {if (post == null || ss == null) { return null; }@@ -51,13 +52,13 @@ public final class query {final Switchboard sb = (Switchboard) ss;final serverObjects prop = new serverObjects();- prop.put("magic", yacyCore.magic);-- if ((post == null) || (ss == null) || !yacyNetwork.authentifyRequest(post, ss)) {+ prop.put("magic", Network.magic);++ if ((post == null) || (ss == null) || !Protocol.authentifyRequest(post, ss)) {prop.put("response", "-1"); // request rejectedreturn prop;}-+if ((sb.isRobinsonMode()) &&(!sb.isPublicRobinson()) &&(!sb.isInMyCluster(header.get(HeaderFramework.CONNECTION_PROP_CLIENTIP)))) {@@ -68,7 +69,7 @@ public final class query {prop.put("response", "-1"); // request rejectedreturn prop;}-+// System.out.println("YACYQUERY: RECEIVED POST = " + ((post == null) ? "NULL" : post.toString()));// final String iam = post.get("iam", ""); // complete seed of the requesting peer@@ -92,7 +93,7 @@ public final class query {// <env> shall contain a word hash, the number of assigned lurls to this hash is returnedprop.put("response", sb.indexSegments.termIndex(Segments.Process.PUBLIC).get(env.getBytes(), null).size());return prop;- } catch (IOException e) {+ } catch (final IOException e) {Log.logException(e);}diff --git a/htroot/yacy/search.java b/htroot/yacy/search.javaindex b89d940ec..0be2946ad 100644--- a/htroot/yacy/search.java+++ b/htroot/yacy/search.java@@ -56,10 +56,10 @@ import net.yacy.kelondro.util.ByteBuffer;import net.yacy.kelondro.util.EventTracker;import net.yacy.kelondro.util.ISO639;import net.yacy.kelondro.util.MemoryControl;-import net.yacy.peers.yacyChannel;-import net.yacy.peers.yacyCore;-import net.yacy.peers.yacyNetwork;-import net.yacy.peers.yacySeed;+import net.yacy.peers.Seed;+import net.yacy.peers.EventChannel;+import net.yacy.peers.Protocol;+import net.yacy.peers.Network;import net.yacy.peers.graphics.ProfilingGraph;import net.yacy.search.Switchboard;import net.yacy.search.SwitchboardConstants;@@ -86,7 +86,7 @@ public final class search {final serverObjects prop = new serverObjects();if ((post == null) || (env == null)) return prop;- if (!yacyNetwork.authentifyRequest(post, env)) return prop;+ if (!Protocol.authentifyRequest(post, env)) return prop;final String client = header.get(HeaderFramework.CONNECTION_PROP_CLIENTIP);//System.out.println("yacy: search received request = " + post.toString());@@ -183,15 +183,15 @@ public final class search {final HandleSet abstractSet = (abstracts.length() == 0 || abstracts.equals("auto")) ? null : QueryParams.hashes2Set(abstracts);// store accessing peer- yacySeed remoteSeed;+ Seed remoteSeed;try {- remoteSeed = yacySeed.genRemoteSeed(oseed, key, false, client);+ remoteSeed = Seed.genRemoteSeed(oseed, key, false, client);} catch (final IOException e) {- yacyCore.log.logInfo("yacy.search: access with bad seed: " + e.getMessage());+ Network.log.logInfo("yacy.search: access with bad seed: " + e.getMessage());remoteSeed = null;}if (sb.peers == null) {- yacyCore.log.logSevere("yacy.search: seed cache not initialized");+ Network.log.logSevere("yacy.search: seed cache not initialized");} else {sb.peers.peerActions.peerArrival(remoteSeed, true);}@@ -244,7 +244,7 @@ public final class search {header.get(RequestHeader.USER_AGENT, ""),false);- yacyCore.log.logInfo("INIT HASH SEARCH (abstracts only): " + QueryParams.anonymizedQueryHashes(theQuery.queryHashes) + " - " + theQuery.displayResults() + " links");+ Network.log.logInfo("INIT HASH SEARCH (abstracts only): " + QueryParams.anonymizedQueryHashes(theQuery.queryHashes) + " - " + theQuery.displayResults() + " links");final long timer = System.currentTimeMillis();//final Map<byte[], ReferenceContainer<WordReference>>[] containers = sb.indexSegment.index().searchTerm(theQuery.queryHashes, theQuery.excludeHashes, plasmaSearchQuery.hashes2StringSet(urls));@@ -304,8 +304,8 @@ public final class search {header.get(RequestHeader.USER_AGENT, ""),false);- yacyCore.log.logInfo("INIT HASH SEARCH (query-" + abstracts + "): " + QueryParams.anonymizedQueryHashes(theQuery.queryHashes) + " - " + theQuery.displayResults() + " links");- yacyChannel.channels(yacyChannel.REMOTESEARCH).addMessage(new RSSMessage("Remote Search Request from " + ((remoteSeed == null) ? "unknown" : remoteSeed.getName()), QueryParams.anonymizedQueryHashes(theQuery.queryHashes), ""));+ Network.log.logInfo("INIT HASH SEARCH (query-" + abstracts + "): " + QueryParams.anonymizedQueryHashes(theQuery.queryHashes) + " - " + theQuery.displayResults() + " links");+ EventChannel.channels(EventChannel.REMOTESEARCH).addMessage(new RSSMessage("Remote Search Request from " + ((remoteSeed == null) ? "unknown" : remoteSeed.getName()), QueryParams.anonymizedQueryHashes(theQuery.queryHashes), ""));// make eventtheSearch = SearchEventCache.getEvent(theQuery, sb.peers, sb.tables, null, abstracts.length() > 0, sb.loader, count, maxtime, (int) sb.getConfigLong(SwitchboardConstants.DHT_BURST_ROBINSON, 0), (int) sb.getConfigLong(SwitchboardConstants.DHT_BURST_MULTIWORD, 0));@@ -427,7 +427,7 @@ public final class search {if (MemoryControl.shortStatus()) sb.remoteSearchTracker.clear();// log- yacyCore.log.logInfo("EXIT HASH SEARCH: " ++ Network.log.logInfo("EXIT HASH SEARCH: " +QueryParams.anonymizedQueryHashes(theQuery.queryHashes) + " - " + joincount + " links found, " +prop.get("linkcount", "?") + " links selected, " +indexabstractContainercount + " index abstracts, " +diff --git a/htroot/yacy/transferRWI.java b/htroot/yacy/transferRWI.javaindex 9839af250..3ad19f7b7 100644--- a/htroot/yacy/transferRWI.java+++ b/htroot/yacy/transferRWI.java@@ -41,10 +41,10 @@ import net.yacy.kelondro.index.HandleSet;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.rwi.IndexCell;import net.yacy.kelondro.util.FileUtils;-import net.yacy.peers.yacyChannel;-import net.yacy.peers.yacyCore;-import net.yacy.peers.yacyNetwork;-import net.yacy.peers.yacySeed;+import net.yacy.peers.Seed;+import net.yacy.peers.EventChannel;+import net.yacy.peers.Protocol;+import net.yacy.peers.Network;import net.yacy.peers.dht.FlatWordPartitionScheme;import net.yacy.repository.Blacklist;import net.yacy.search.Switchboard;@@ -66,7 +66,7 @@ public final class transferRWI {logWarning(contentType, "post or env is null!");return prop;}- if (!yacyNetwork.authentifyRequest(post, env)) {+ if (!Protocol.authentifyRequest(post, env)) {logWarning(contentType, "not authentified");return prop;}@@ -89,7 +89,7 @@ public final class transferRWI {boolean granted = sb.getConfigBool("allowReceiveIndex", false);final boolean blockBlacklist = sb.getConfigBool("indexReceiveBlockBlacklist", false);final long cachelimit = sb.getConfigLong(SwitchboardConstants.WORDCACHE_MAX_COUNT, 100000);- final yacySeed otherPeer = sb.peers.get(iam);+ final Seed otherPeer = sb.peers.get(iam);final String otherPeerName = iam + ":" + ((otherPeer == null) ? "NULL" : (otherPeer.getName() + "/" + otherPeer.getVersion()));// response values@@ -170,7 +170,7 @@ public final class transferRWI {// block blacklisted entriesif ((blockBlacklist) && (Switchboard.urlBlacklist.hashInBlacklistedCache(Blacklist.BLACKLIST_DHT, urlHash))) {- if (yacyCore.log.isFine()) yacyCore.log.logFine("transferRWI: blocked blacklisted URLHash '" + ASCII.String(urlHash) + "' from peer " + otherPeerName);+ if (Network.log.isFine()) Network.log.logFine("transferRWI: blocked blacklisted URLHash '" + ASCII.String(urlHash) + "' from peer " + otherPeerName);blocked++;continue;}@@ -178,7 +178,7 @@ public final class transferRWI {// check if the entry is in our network domainfinal String urlRejectReason = sb.crawlStacker.urlInAcceptedDomainHash(urlHash);if (urlRejectReason != null) {- yacyCore.log.logWarning("transferRWI: blocked URL hash '" + ASCII.String(urlHash) + "' (" + urlRejectReason + ") from peer " + otherPeerName + "; peer is suspected to be a spam-peer (or something is wrong)");+ Network.log.logWarning("transferRWI: blocked URL hash '" + ASCII.String(urlHash) + "' (" + urlRejectReason + ") from peer " + otherPeerName + "; peer is suspected to be a spam-peer (or something is wrong)");//if (yacyCore.log.isFine()) yacyCore.log.logFine("transferRWI: blocked URL hash '" + urlHash + "' (" + urlRejectReason + ") from peer " + otherPeerName);blocked++;continue;@@ -223,7 +223,7 @@ public final class transferRWI {final String lastHash = wordhashes.get(wordhashes.size() - 1);final long avdist = (FlatWordPartitionScheme.std.dhtDistance(firstHash.getBytes(), null, sb.peers.mySeed()) + FlatWordPartitionScheme.std.dhtDistance(lastHash.getBytes(), null, sb.peers.mySeed())) / 2;sb.getLog().logInfo("Received " + received + " RWIs, " + wordc + " Words [" + firstHash + " .. " + lastHash + "], processed in " + (System.currentTimeMillis() - startProcess) + " milliseconds, " + avdist + ", blocked " + blocked + ", requesting " + unknownURL.size() + "/" + receivedURL + " URLs from " + otherPeerName);- yacyChannel.channels(yacyChannel.DHTRECEIVE).addMessage(new RSSMessage("Received " + received + " RWIs, " + wordc + " Words [" + firstHash + " .. " + lastHash + "], processed in " + (System.currentTimeMillis() - startProcess) + " milliseconds, " + avdist + ", blocked " + blocked + ", requesting " + unknownURL.size() + "/" + receivedURL + " URLs from " + otherPeerName, "", otherPeer.hash));+ EventChannel.channels(EventChannel.DHTRECEIVE).addMessage(new RSSMessage("Received " + received + " RWIs, " + wordc + " Words [" + firstHash + " .. " + lastHash + "], processed in " + (System.currentTimeMillis() - startProcess) + " milliseconds, " + avdist + ", blocked " + blocked + ", requesting " + unknownURL.size() + "/" + receivedURL + " URLs from " + otherPeerName, "", otherPeer.hash));}result = "ok";diff --git a/htroot/yacy/transferURL.java b/htroot/yacy/transferURL.javaindex 9f9257736..fa8ab98e2 100644--- a/htroot/yacy/transferURL.java+++ b/htroot/yacy/transferURL.java@@ -34,14 +34,13 @@ import net.yacy.cora.document.RSSMessage;import net.yacy.cora.protocol.RequestHeader;import net.yacy.kelondro.data.meta.URIMetadataRow;import net.yacy.kelondro.logging.Log;-import net.yacy.peers.yacyChannel;-import net.yacy.peers.yacyCore;-import net.yacy.peers.yacyNetwork;-import net.yacy.peers.yacySeed;+import net.yacy.peers.Seed;+import net.yacy.peers.EventChannel;+import net.yacy.peers.Protocol;+import net.yacy.peers.Network;import net.yacy.repository.Blacklist;import net.yacy.search.Switchboard;import net.yacy.search.index.Segments;-import de.anomic.crawler.ResultURLs;import de.anomic.crawler.ResultURLs.EventOrigin;import de.anomic.server.serverCore;@@ -49,17 +48,17 @@ import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;public final class transferURL {-+public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) throws InterruptedException {final long start = System.currentTimeMillis();long freshdate = 0;try {freshdate = GenericFormatter.SHORT_DAY_FORMATTER.parse("20061101").getTime();} catch (final ParseException e1) {}-+// return variable that accumulates replacementsfinal Switchboard sb = (Switchboard) env;final serverObjects prop = new serverObjects();if ((post == null) || (env == null)) return prop;- if (!yacyNetwork.authentifyRequest(post, env)) return prop;+ if (!Protocol.authentifyRequest(post, env)) return prop;// request valuesfinal String iam = post.get("iam", ""); // seed hash of requester@@ -73,14 +72,14 @@ public final class transferURL {String result = "";String doublevalues = "0";- final yacySeed otherPeer = sb.peers.get(iam);+ final Seed otherPeer = sb.peers.get(iam);final String otherPeerName = iam + ":" + ((otherPeer == null) ? "NULL" : (otherPeer.getName() + "/" + otherPeer.getVersion()));if ((youare == null) || (!youare.equals(sb.peers.mySeed().hash))) {- yacyCore.log.logInfo("Rejecting URLs from peer " + otherPeerName + ". Wrong target. Wanted peer=" + youare + ", iam=" + sb.peers.mySeed().hash);+ Network.log.logInfo("Rejecting URLs from peer " + otherPeerName + ". Wrong target. Wanted peer=" + youare + ", iam=" + sb.peers.mySeed().hash);result = "wrong_target";} else if ((!granted) || (sb.isRobinsonMode())) {- yacyCore.log.logInfo("Rejecting URLs from peer " + otherPeerName + ". Not granted.");+ Network.log.logInfo("Rejecting URLs from peer " + otherPeerName + ". Not granted.");result = "error_not_granted";} else {int received = 0;@@ -91,11 +90,11 @@ public final class transferURL {URIMetadataRow lEntry;for (int i = 0; i < urlc; i++) {serverCore.checkInterruption();-+// read new lurl-entryurls = post.get("url" + i);if (urls == null) {- if (yacyCore.log.isFine()) yacyCore.log.logFine("transferURL: got null URL-string from peer " + otherPeerName);+ if (Network.log.isFine()) Network.log.logFine("transferURL: got null URL-string from peer " + otherPeerName);blocked++;continue;}@@ -103,49 +102,49 @@ public final class transferURL {// parse new lurl-entrylEntry = URIMetadataRow.importEntry(urls);if (lEntry == null) {- yacyCore.log.logWarning("transferURL: received invalid URL (entry null) from peer " + otherPeerName + "\n\tURL Property: " + urls);+ Network.log.logWarning("transferURL: received invalid URL (entry null) from peer " + otherPeerName + "\n\tURL Property: " + urls);blocked++;continue;}-+// check if entry is well-formedfinal URIMetadataRow.Components metadata = lEntry.metadata();if (metadata == null || metadata.url() == null) {- yacyCore.log.logWarning("transferURL: received invalid URL from peer " + otherPeerName + "\n\tURL Property: " + urls);+ Network.log.logWarning("transferURL: received invalid URL from peer " + otherPeerName + "\n\tURL Property: " + urls);blocked++;continue;}-+// check whether entry is too oldif (lEntry.freshdate().getTime() <= freshdate) {- if (yacyCore.log.isFine()) yacyCore.log.logFine("transerURL: received too old URL from peer " + otherPeerName + ": " + lEntry.freshdate());+ if (Network.log.isFine()) Network.log.logFine("transerURL: received too old URL from peer " + otherPeerName + ": " + lEntry.freshdate());blocked++;continue;}-+// check if the entry is blacklistedif ((blockBlacklist) && (Switchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_DHT, metadata.url()))) {- if (yacyCore.log.isFine()) yacyCore.log.logFine("transferURL: blocked blacklisted URL '" + metadata.url().toNormalform(false, true) + "' from peer " + otherPeerName);+ if (Network.log.isFine()) Network.log.logFine("transferURL: blocked blacklisted URL '" + metadata.url().toNormalform(false, true) + "' from peer " + otherPeerName);lEntry = null;blocked++;continue;}-+// check if the entry is in our network domainfinal String urlRejectReason = sb.crawlStacker.urlInAcceptedDomain(metadata.url());if (urlRejectReason != null) {- if (yacyCore.log.isFine()) yacyCore.log.logFine("transferURL: blocked URL '" + metadata.url() + "' (" + urlRejectReason + ") from peer " + otherPeerName);+ if (Network.log.isFine()) Network.log.logFine("transferURL: blocked URL '" + metadata.url() + "' (" + urlRejectReason + ") from peer " + otherPeerName);lEntry = null;blocked++;continue;}-+// write entry to database- if (yacyCore.log.isFine()) yacyCore.log.logFine("Accepting URL " + i + "/" + urlc + " from peer " + otherPeerName + ": " + lEntry.metadata().url().toNormalform(true, false));+ if (Network.log.isFine()) Network.log.logFine("Accepting URL " + i + "/" + urlc + " from peer " + otherPeerName + ": " + lEntry.metadata().url().toNormalform(true, false));try {sb.indexSegments.urlMetadata(Segments.Process.DHTIN).store(lEntry);ResultURLs.stack(lEntry, iam.getBytes(), iam.getBytes(), EventOrigin.DHT_TRANSFER);- if (yacyCore.log.isFine()) yacyCore.log.logFine("transferURL: received URL '" + metadata.url().toNormalform(false, true) + "' from peer " + otherPeerName);+ if (Network.log.isFine()) Network.log.logFine("transferURL: received URL '" + metadata.url().toNormalform(false, true) + "' from peer " + otherPeerName);received++;} catch (final IOException e) {Log.logException(e);@@ -157,9 +156,9 @@ public final class transferURL {// return rewrite propertiesfinal int more = sb.indexSegments.urlMetadata(Segments.Process.DHTIN).size() - sizeBefore;doublevalues = Integer.toString(received - more);- yacyCore.log.logInfo("Received " + received + " URLs from peer " + otherPeerName + " in " + (System.currentTimeMillis() - start) + " ms, blocked " + blocked + " URLs");- yacyChannel.channels(yacyChannel.DHTRECEIVE).addMessage(new RSSMessage("Received " + received + ", blocked " + blocked + " URLs from peer " + otherPeerName, "", otherPeer.hash));- if ((received - more) > 0) yacyCore.log.logSevere("Received " + doublevalues + " double URLs from peer " + otherPeerName);+ Network.log.logInfo("Received " + received + " URLs from peer " + otherPeerName + " in " + (System.currentTimeMillis() - start) + " ms, blocked " + blocked + " URLs");+ EventChannel.channels(EventChannel.DHTRECEIVE).addMessage(new RSSMessage("Received " + received + ", blocked " + blocked + " URLs from peer " + otherPeerName, "", otherPeer.hash));+ if ((received - more) > 0) Network.log.logSevere("Received " + doublevalues + " double URLs from peer " + otherPeerName);result = "ok";}diff --git a/htroot/yacy/urls.java b/htroot/yacy/urls.javaindex 6aba13e78..eb1493f04 100644--- a/htroot/yacy/urls.java+++ b/htroot/yacy/urls.java@@ -9,7 +9,7 @@// $LastChangedBy: orbiter $//// LICENSE-//+//// 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// the Free Software Foundation; either version 2 of the License, or@@ -32,7 +32,7 @@ import net.yacy.cora.document.ASCII;import net.yacy.cora.protocol.RequestHeader;import net.yacy.kelondro.data.meta.DigestURI;import net.yacy.kelondro.data.meta.URIMetadataRow;-import net.yacy.peers.yacyNetwork;+import net.yacy.peers.Protocol;import net.yacy.search.Switchboard;import net.yacy.search.index.Segments;import de.anomic.crawler.NoticedURL;@@ -42,10 +42,10 @@ import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;public class urls {-+public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {final Switchboard sb = (Switchboard) env;-+// insert default valuesfinal serverObjects prop = new serverObjects();prop.put("iam", sb.peers.mySeed().hash);@@ -54,16 +54,16 @@ public class urls {prop.put("channel_description", "");prop.put("channel_pubDate", "");prop.put("item", "0");-+if ((post == null) || (env == null)) return prop;- if (!yacyNetwork.authentifyRequest(post, env)) return prop;-+ if (!Protocol.authentifyRequest(post, env)) return prop;+if (post.get("call", "").equals("remotecrawl")) {// perform a remote crawl url handoverfinal NoticedURL.StackType stackType = NoticedURL.StackType.LIMIT;int maxCount = Math.min(100, post.getInt("count", 10));- long maxTime = Math.min(20000, Math.max(1000, post.getInt("time", 10000)));- long timeout = System.currentTimeMillis() + maxTime;+ final long maxTime = Math.min(20000, Math.max(1000, post.getInt("time", 10000)));+ final long timeout = System.currentTimeMillis() + maxTime;int c = 0;Request entry;DigestURI referrer;@@ -76,10 +76,10 @@ public class urls {break;}if (entry == null) break;-+// find referrer, if there is onereferrer = sb.getURL(Segments.Process.PUBLIC, entry.referrerhash());-+// place url to notice-url dbsb.crawlQueues.delegatedURL.push(entry,@@ -89,7 +89,7 @@ public class urls {FailCategory.FINAL_PROCESS_CONTEXT,"client=____________",-1);-+// create RSS entryprop.put("item_" + c + "_title", "");prop.putXML("item_" + c + "_link", entry.url().toNormalform(true, false));@@ -104,7 +104,7 @@ public class urls {prop.put("item", c);prop.putXML("response", "ok");}-+if (post.get("call", "").equals("urlhashlist")) {// retrieve a list of urls from the LURL-db by a given list of url hashesfinal String urlhashes = post.get("hashes", "");@@ -137,5 +137,5 @@ public class urls {// return rewrite propertiesreturn prop;}-+}diff --git a/htroot/yacysearch.java b/htroot/yacysearch.javaindex 024be3dee..8e5ea534f 100644--- a/htroot/yacysearch.java+++ b/htroot/yacysearch.java@@ -60,8 +60,8 @@ import net.yacy.kelondro.util.Formatter;import net.yacy.kelondro.util.ISO639;import net.yacy.kelondro.util.MemoryControl;import net.yacy.kelondro.util.SetTools;-import net.yacy.peers.yacyChannel;-import net.yacy.peers.yacyNewsPool;+import net.yacy.peers.EventChannel;+import net.yacy.peers.NewsPool;import net.yacy.peers.graphics.ProfilingGraph;import net.yacy.search.Switchboard;import net.yacy.search.SwitchboardConstants;@@ -510,7 +510,7 @@ public class yacysearch {map.put("urlhash", delHash);map.put("vote", "negative");map.put("refid", "");- sb.peers.newsPool.publishMyNews(sb.peers.mySeed(), yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, map);+ sb.peers.newsPool.publishMyNews(sb.peers.mySeed(), NewsPool.CATEGORY_SURFTIPP_VOTE_ADD, map);}} catch (final IOException e) {Log.logException(e);@@ -541,7 +541,7 @@ public class yacysearch {map.put("description", documents[0].dc_title().replace(',', ' '));map.put("author", documents[0].dc_creator());map.put("tags", documents[0].dc_subject(' '));- sb.peers.newsPool.publishMyNews(sb.peers.mySeed(), yacyNewsPool.CATEGORY_SURFTIPP_ADD, map);+ sb.peers.newsPool.publishMyNews(sb.peers.mySeed(), NewsPool.CATEGORY_SURFTIPP_ADD, map);documents[0].close();}}@@ -614,7 +614,7 @@ public class yacysearch {// logLog.logInfo("LOCAL_SEARCH", "INIT WORD SEARCH: " + theQuery.queryString + ":" + QueryParams.hashSet2hashString(theQuery.queryHashes) + " - " + theQuery.neededResults() + " links to be computed, " + theQuery.displayResults() + " lines to be displayed");- yacyChannel.channels(yacyChannel.LOCALSEARCH).addMessage(new RSSMessage("Local Search Request", theQuery.queryString, ""));+ EventChannel.channels(EventChannel.LOCALSEARCH).addMessage(new RSSMessage("Local Search Request", theQuery.queryString, ""));final long timestamp = System.currentTimeMillis();// create a new search eventdiff --git a/htroot/yacysearchitem.java b/htroot/yacysearchitem.javaindex 6b5765146..75f531ee6 100644--- a/htroot/yacysearchitem.java+++ b/htroot/yacysearchitem.java@@ -36,8 +36,8 @@ import net.yacy.kelondro.data.meta.DigestURI;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.util.EventTracker;import net.yacy.kelondro.util.Formatter;-import net.yacy.peers.yacyNewsPool;-import net.yacy.peers.yacySeed;+import net.yacy.peers.NewsPool;+import net.yacy.peers.Seed;import net.yacy.peers.graphics.ProfilingGraph;import net.yacy.search.Switchboard;import net.yacy.search.SwitchboardConstants;@@ -128,7 +128,7 @@ public class yacysearchitem {prop.put("content_showParser", sb.getConfigBool("search.result.show.parser", true) ? 1 : 0);prop.put("content_showPictures", sb.getConfigBool("search.result.show.pictures", true) ? 1 : 0);prop.put("content_authorized", authenticated ? "1" : "0");- prop.put("content_authorized_recommend", (sb.peers.newsPool.getSpecific(yacyNewsPool.OUTGOING_DB, yacyNewsPool.CATEGORY_SURFTIPP_ADD, "url", result.urlstring()) == null) ? "1" : "0");+ prop.put("content_authorized_recommend", (sb.peers.newsPool.getSpecific(NewsPool.OUTGOING_DB, NewsPool.CATEGORY_SURFTIPP_ADD, "url", result.urlstring()) == null) ? "1" : "0");prop.putHTML("content_authorized_recommend_deletelink", "/yacysearch.html?query=" + theQuery.queryString.replace(' ', '+') + "&Enter=Search&count=" + theQuery.displayResults() + "&offset=" + (theQuery.neededResults() - theQuery.displayResults()) + "&order=" + crypt.simpleEncode(theQuery.ranking.toExternalString()) + "&resource=local&time=3&deleteref=" + ASCII.String(result.hash()) + "&urlmaskfilter=.*");prop.putHTML("content_authorized_recommend_recommendlink", "/yacysearch.html?query=" + theQuery.queryString.replace(' ', '+') + "&Enter=Search&count=" + theQuery.displayResults() + "&offset=" + (theQuery.neededResults() - theQuery.displayResults()) + "&order=" + crypt.simpleEncode(theQuery.ranking.toExternalString()) + "&resource=local&time=3&recommendref=" + ASCII.String(result.hash()) + "&urlmaskfilter=.*");prop.put("content_authorized_urlhash", ASCII.String(result.hash()));@@ -145,7 +145,7 @@ public class yacysearchitem {prop.put("content_ranking", result.ranking);prop.put("content_showMetadata_urlhash", resulthashString);prop.put("content_showParser_urlhash", resulthashString);- prop.put("content_urlhexhash", yacySeed.b64Hash2hexHash(resulthashString));+ prop.put("content_urlhexhash", Seed.b64Hash2hexHash(resulthashString));prop.putHTML("content_urlname", nxTools.shortenURLString(result.urlname(), MAX_URL_LENGTH));prop.put("content_showDate_date", GenericFormatter.RFC1123_SHORT_FORMATTER.format(result.modified()));prop.put("content_date822", HeaderFramework.formatRFC1123(result.modified()));diff --git a/source/de/anomic/crawler/CrawlQueues.java b/source/de/anomic/crawler/CrawlQueues.javaindex 2bdce5c45..ed2d7daa3 100644--- a/source/de/anomic/crawler/CrawlQueues.java+++ b/source/de/anomic/crawler/CrawlQueues.java@@ -46,8 +46,8 @@ import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.util.FileUtils;import net.yacy.kelondro.workflow.WorkflowJob;-import net.yacy.peers.yacyClient;-import net.yacy.peers.yacySeed;+import net.yacy.peers.Protocol;+import net.yacy.peers.Seed;import net.yacy.peers.dht.PeerSelection;import net.yacy.search.Switchboard;import net.yacy.search.SwitchboardConstants;@@ -408,10 +408,10 @@ public class CrawlQueues {}// check if we have an entry in the provider list, otherwise fill the list- yacySeed seed;+ Seed seed;if (this.remoteCrawlProviderHashes.isEmpty()) {if (this.sb.peers != null && this.sb.peers.sizeConnected() > 0) {- final Iterator<yacySeed> e = PeerSelection.getProvidesRemoteCrawlURLs(this.sb.peers);+ final Iterator<Seed> e = PeerSelection.getProvidesRemoteCrawlURLs(this.sb.peers);while (e.hasNext()) {seed = e.next();if (seed != null) this.remoteCrawlProviderHashes.add(seed.hash);@@ -437,7 +437,7 @@ public class CrawlQueues {if (seed == null) return false;// we know a peer which should provide remote crawl entries. load them now.- final RSSFeed feed = yacyClient.queryRemoteCrawlURLs(this.sb.peers, seed, 60, 8000);+ final RSSFeed feed = Protocol.queryRemoteCrawlURLs(this.sb.peers, seed, 60, 8000);if (feed == null || feed.isEmpty()) {// something is wrong with this provider. To prevent that we get not stuck with this peer// we remove it from the peer listdiff --git a/source/de/anomic/crawler/CrawlStacker.java b/source/de/anomic/crawler/CrawlStacker.javaindex 149e01632..0e00ca4c2 100644--- a/source/de/anomic/crawler/CrawlStacker.java+++ b/source/de/anomic/crawler/CrawlStacker.java@@ -50,7 +50,7 @@ import net.yacy.kelondro.data.meta.URIMetadataRow;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.workflow.WorkflowProcessor;-import net.yacy.peers.yacySeedDB;+import net.yacy.peers.SeedDB;import net.yacy.repository.Blacklist;import net.yacy.repository.FilterEngine;import net.yacy.search.Switchboard;@@ -71,7 +71,7 @@ public final class CrawlStacker {private final CrawlQueues nextQueue;private final CrawlSwitchboard crawler;private final Segment indexSegment;- private final yacySeedDB peers;+ private final SeedDB peers;private final boolean acceptLocalURLs, acceptGlobalURLs;private final FilterEngine domainList;@@ -100,7 +100,7 @@ public final class CrawlStacker {final CrawlQueues cq,final CrawlSwitchboard cs,final Segment indexSegment,- final yacySeedDB peers,+ final SeedDB peers,final boolean acceptLocalURLs,final boolean acceptGlobalURLs,final FilterEngine domainList) {diff --git a/source/de/anomic/http/server/HTTPDFileHandler.java b/source/de/anomic/http/server/HTTPDFileHandler.javaindex 24a58bba8..3f082de7a 100644--- a/source/de/anomic/http/server/HTTPDFileHandler.java+++ b/source/de/anomic/http/server/HTTPDFileHandler.java@@ -104,7 +104,7 @@ import net.yacy.kelondro.order.Digest;import net.yacy.kelondro.util.ByteBuffer;import net.yacy.kelondro.util.FileUtils;import net.yacy.kelondro.util.MemoryControl;-import net.yacy.peers.yacySeed;+import net.yacy.peers.Seed;import net.yacy.peers.graphics.EncodedImage;import net.yacy.peers.operation.yacyBuildProperties;import net.yacy.search.Switchboard;@@ -885,7 +885,7 @@ public final class HTTPDFileHandler {templatePatterns.putHTML(servletProperties.PEER_STAT_CLIENTNAME, sb.peers.mySeed().getName());templatePatterns.putHTML(servletProperties.PEER_STAT_CLIENTID, ((Switchboard) switchboard).peers.myID());templatePatterns.put(servletProperties.PEER_STAT_MYTIME, GenericFormatter.SHORT_SECOND_FORMATTER.format());- final yacySeed myPeer = sb.peers.mySeed();+ final Seed myPeer = sb.peers.mySeed();templatePatterns.put("newpeer", myPeer.getAge() >= 1 ? 0 : 1);templatePatterns.putHTML("newpeer_peerhash", myPeer.hash);//System.out.println("respond props: " + ((tp == null) ? "null" : tp.toString())); // debugdiff --git a/source/de/anomic/http/server/HTTPDProxyHandler.java b/source/de/anomic/http/server/HTTPDProxyHandler.javaindex a71cb9a7b..e05859078 100644--- a/source/de/anomic/http/server/HTTPDProxyHandler.java+++ b/source/de/anomic/http/server/HTTPDProxyHandler.java@@ -296,7 +296,7 @@ public final class HTTPDProxyHandler {// remembering the starting time of the requestfinal Date requestDate = new Date(); // remember the time...conProp.put(HeaderFramework.CONNECTION_PROP_REQUEST_START, Long.valueOf(requestDate.getTime()));- if (yacyTrigger) net.yacy.peers.yacyCore.triggerOnlineAction();+ if (yacyTrigger) net.yacy.peers.Network.triggerOnlineAction();sb.proxyLastAccess = System.currentTimeMillis();// using an ByteCount OutputStream to count the send bytes (needed for the logfile)@@ -739,7 +739,7 @@ public final class HTTPDProxyHandler {// remembering the starting time of the requestfinal Date requestDate = new Date(); // remember the time...conProp.put(HeaderFramework.CONNECTION_PROP_REQUEST_START, Long.valueOf(requestDate.getTime()));- if (yacyTrigger) net.yacy.peers.yacyCore.triggerOnlineAction();+ if (yacyTrigger) net.yacy.peers.Network.triggerOnlineAction();sb.proxyLastAccess = System.currentTimeMillis();// using an ByteCount OutputStream to count the send bytes@@ -856,7 +856,7 @@ public final class HTTPDProxyHandler {// remembering the starting time of the requestfinal Date requestDate = new Date(); // remember the time...conProp.put(HeaderFramework.CONNECTION_PROP_REQUEST_START, Long.valueOf(requestDate.getTime()));- if (yacyTrigger) net.yacy.peers.yacyCore.triggerOnlineAction();+ if (yacyTrigger) net.yacy.peers.Network.triggerOnlineAction();sb.proxyLastAccess = System.currentTimeMillis();// using an ByteCount OutputStream to count the send bytesdiff --git a/source/net/yacy/peers/yacyAccessible.java b/source/net/yacy/peers/Accessible.javasimilarity index 95%rename from source/net/yacy/peers/yacyAccessible.javarename to source/net/yacy/peers/Accessible.javaindex 022a3eeaa..15f47d1d0 100644--- a/source/net/yacy/peers/yacyAccessible.java+++ b/source/net/yacy/peers/Accessible.java@@ -35,7 +35,7 @@ import net.yacy.kelondro.util.FileUtils;import net.yacy.search.Switchboard;-public class yacyAccessible {+public class Accessible {public long lastUpdated;public boolean IWasAccessed;diff --git a/source/net/yacy/peers/yacyChannel.java b/source/net/yacy/peers/EventChannel.javasimilarity index 84%rename from source/net/yacy/peers/yacyChannel.javarename to source/net/yacy/peers/EventChannel.javaindex b9bc8bd8e..c21a7d151 100644--- a/source/net/yacy/peers/yacyChannel.java+++ b/source/net/yacy/peers/EventChannel.java@@ -32,7 +32,7 @@ import java.util.concurrent.ConcurrentMap;import net.yacy.cora.document.RSSFeed;import net.yacy.cora.document.RSSMessage;-public enum yacyChannel {+public enum EventChannel {TEST,PEERNEWS,REMOTESEARCH,@@ -51,14 +51,14 @@ public enum yacyChannel {* the following private channels are declared to prevent that an access to the feed servlet* gets results from news channels that are not for the public*/- public static final Set<yacyChannel> privateChannels = EnumSet.of(yacyChannel.LOCALSEARCH, yacyChannel.LOCALINDEXING, yacyChannel.PROXY);+ public static final Set<EventChannel> privateChannels = EnumSet.of(EventChannel.LOCALSEARCH, EventChannel.LOCALINDEXING, EventChannel.PROXY);/*** the following static channels object is used to organize a storage array for RSS feeds*/- private static final ConcurrentMap<yacyChannel, RSSFeed> channels = new ConcurrentHashMap<yacyChannel, RSSFeed>();+ private static final ConcurrentMap<EventChannel, RSSFeed> channels = new ConcurrentHashMap<EventChannel, RSSFeed>();- public static RSSFeed channels(final yacyChannel channel) {+ public static RSSFeed channels(final EventChannel channel) {RSSFeed feed = channels.get(channel);if (feed != null) return feed;feed = new RSSFeed(200);diff --git a/source/net/yacy/peers/yacyCore.java b/source/net/yacy/peers/Network.javasimilarity index 82%rename from source/net/yacy/peers/yacyCore.javarename to source/net/yacy/peers/Network.javaindex 4a2c47517..51a827ddf 100644--- a/source/net/yacy/peers/yacyCore.java+++ b/source/net/yacy/peers/Network.java@@ -63,7 +63,7 @@ import net.yacy.peers.operation.yacySeedUploader;import net.yacy.search.Switchboard;import de.anomic.server.serverCore;-public class yacyCore {+public class Network {// staticspublic static final ThreadGroup publishThreadGroup = new ThreadGroup("publishThreadGroup");@@ -73,7 +73,7 @@ public class yacyCore {/** pseudo-random key derived from a time-interval while YaCy startup*/public static long speedKey = 0;public static long magic = System.currentTimeMillis();- public static final Map<String, yacyAccessible> amIAccessibleDB = new ConcurrentHashMap<String, yacyAccessible>(); // Holds PeerHash / yacyAccessible Relations+ public static final Map<String, Accessible> amIAccessibleDB = new ConcurrentHashMap<String, Accessible>(); // Holds PeerHash / yacyAccessible Relations// constants for PeerPing behaviorprivate static final int PING_INITIAL = 10;private static final int PING_MAX_RUNNING = 3;@@ -93,19 +93,19 @@ public class yacyCore {return Math.max(0, (int) ((System.currentTimeMillis() - serverCore.startupTime) / 1000));}- public yacyCore(final Switchboard sb) {+ public Network(final Switchboard sb) {final long time = System.currentTimeMillis();this.sb = sb;sb.setConfig("yacyStatus", "");// create a peer news channel- final RSSFeed peernews = yacyChannel.channels(yacyChannel.PEERNEWS);+ final RSSFeed peernews = EventChannel.channels(EventChannel.PEERNEWS);peernews.addMessage(new RSSMessage("YaCy started", "", ""));// ensure that correct IP is usedfinal String staticIP = sb.getConfig("staticIP", "");- if (staticIP.length() != 0 && yacySeed.isProperIP(staticIP) == null) {+ if (staticIP.length() != 0 && Seed.isProperIP(staticIP) == null) {serverCore.useStaticIP = true;sb.peers.mySeed().setIP(staticIP);log.logInfo("staticIP set to "+ staticIP);@@ -203,7 +203,7 @@ public class yacyCore {private boolean canReachMyself() { // TODO: check if this method is necessary - depending on the used router it will not work// returns true if we can reach ourself under our known peer address// if we cannot reach ourself, we call a forced publishMySeed and return false- final long[] callback = yacyClient.queryUrlCount(this.sb.peers.mySeed());+ final long[] callback = Protocol.queryUrlCount(this.sb.peers.mySeed());if (callback[0] >= 0 && callback[1] == magic) {this.sb.peers.mySeed().setLastSeenUTC();return true;@@ -219,11 +219,11 @@ public class yacyCore {protected class publishThread extends Thread {int added;- private final yacySeed seed;+ private final Seed seed;private final Semaphore sync;private final List<Thread> syncList;- public publishThread(final ThreadGroup tg, final yacySeed seed,+ public publishThread(final ThreadGroup tg, final Seed seed,final Semaphore sync, final List<Thread> syncList) throws InterruptedException {super(tg, "PublishSeed_" + seed.getName());@@ -237,44 +237,44 @@ public class yacyCore {public final void run() {try {- this.added = yacyClient.hello(yacyCore.this.sb.peers.mySeed(), yacyCore.this.sb.peers.peerActions, this.seed.getClusterAddress(), this.seed.hash, this.seed.getName());+ this.added = Protocol.hello(Network.this.sb.peers.mySeed(), Network.this.sb.peers.peerActions, this.seed.getClusterAddress(), this.seed.hash, this.seed.getName());if (this.added < 0) {// no or wrong response, delete that addressfinal String cause = "peer ping to peer resulted in error response (added < 0)";- log.logInfo("publish: disconnected " + this.seed.get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_SENIOR) + " peer '" + this.seed.getName() + "' from " + this.seed.getPublicAddress() + ": " + cause);- yacyCore.this.sb.peers.peerActions.peerDeparture(this.seed, cause);+ log.logInfo("publish: disconnected " + this.seed.get(Seed.PEERTYPE, Seed.PEERTYPE_SENIOR) + " peer '" + this.seed.getName() + "' from " + this.seed.getPublicAddress() + ": " + cause);+ Network.this.sb.peers.peerActions.peerDeparture(this.seed, cause);} else {// success! we have published our peer to a senior peer// update latest news from the other peer- log.logInfo("publish: handshaked " + this.seed.get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_SENIOR) + " peer '" + this.seed.getName() + "' at " + this.seed.getPublicAddress());+ log.logInfo("publish: handshaked " + this.seed.get(Seed.PEERTYPE, Seed.PEERTYPE_SENIOR) + " peer '" + this.seed.getName() + "' at " + this.seed.getPublicAddress());// check if seed's lastSeen has been updated- final yacySeed newSeed = yacyCore.this.sb.peers.getConnected(this.seed.hash);+ final Seed newSeed = Network.this.sb.peers.getConnected(this.seed.hash);if (newSeed != null) {if (!newSeed.isOnline()) {- if (log.isFine()) log.logFine("publish: recently handshaked " + this.seed.get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_SENIOR) ++ if (log.isFine()) log.logFine("publish: recently handshaked " + this.seed.get(Seed.PEERTYPE, Seed.PEERTYPE_SENIOR) +" peer '" + this.seed.getName() + "' at " + this.seed.getPublicAddress() + " is not online." +" Removing Peer from connected");- yacyCore.this.sb.peers.peerActions.peerDeparture(newSeed, "peer not online");+ Network.this.sb.peers.peerActions.peerDeparture(newSeed, "peer not online");} elseif (newSeed.getLastSeenUTC() < (System.currentTimeMillis() - 10000)) {// update last seed dateif (newSeed.getLastSeenUTC() >= this.seed.getLastSeenUTC()) {- if (log.isFine()) log.logFine("publish: recently handshaked " + this.seed.get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_SENIOR) ++ if (log.isFine()) log.logFine("publish: recently handshaked " + this.seed.get(Seed.PEERTYPE, Seed.PEERTYPE_SENIOR) +" peer '" + this.seed.getName() + "' at " + this.seed.getPublicAddress() + " with old LastSeen: '" +my_SHORT_SECOND_FORMATTER.format(new Date(newSeed.getLastSeenUTC())) + "'");newSeed.setLastSeenUTC();- yacyCore.this.sb.peers.peerActions.peerArrival(newSeed, true);+ Network.this.sb.peers.peerActions.peerArrival(newSeed, true);} else {- if (log.isFine()) log.logFine("publish: recently handshaked " + this.seed.get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_SENIOR) ++ if (log.isFine()) log.logFine("publish: recently handshaked " + this.seed.get(Seed.PEERTYPE, Seed.PEERTYPE_SENIOR) +" peer '" + this.seed.getName() + "' at " + this.seed.getPublicAddress() + " with old LastSeen: '" +my_SHORT_SECOND_FORMATTER.format(new Date(newSeed.getLastSeenUTC())) + "', this is more recent: '" +my_SHORT_SECOND_FORMATTER.format(new Date(this.seed.getLastSeenUTC())) + "'");this.seed.setLastSeenUTC();- yacyCore.this.sb.peers.peerActions.peerArrival(this.seed, true);+ Network.this.sb.peers.peerActions.peerArrival(this.seed, true);}}} else {- if (log.isFine()) log.logFine("publish: recently handshaked " + this.seed.get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_SENIOR) + " peer '" + this.seed.getName() + "' at " + this.seed.getPublicAddress() + " not in connectedDB");+ if (log.isFine()) log.logFine("publish: recently handshaked " + this.seed.get(Seed.PEERTYPE, Seed.PEERTYPE_SENIOR) + " peer '" + this.seed.getName() + "' at " + this.seed.getPublicAddress() + " not in connectedDB");}}} catch (final Exception e) {@@ -305,12 +305,12 @@ public class yacyCore {// probed until we get a valid response.// init yacyHello-process- Map<String, yacySeed> seeds; // hash/yacySeed relation+ Map<String, Seed> seeds; // hash/yacySeed relationint attempts = this.sb.peers.sizeConnected();// getting a list of peers to contact- if (this.sb.peers.mySeed().get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_VIRGIN).equals(yacySeed.PEERTYPE_VIRGIN)) {+ if (this.sb.peers.mySeed().get(Seed.PEERTYPE, Seed.PEERTYPE_VIRGIN).equals(Seed.PEERTYPE_VIRGIN)) {if (attempts > PING_INITIAL) { attempts = PING_INITIAL; }final Map<byte[], String> ch = Switchboard.getSwitchboard().clusterhashes;seeds = PeerSelection.seedsByAge(this.sb.peers, true, attempts - ((ch == null) ? 0 : ch.size())); // best for fast connection@@ -319,7 +319,7 @@ public class yacyCore {final Iterator<Map.Entry<byte[], String>> i = ch.entrySet().iterator();String hash;Map.Entry<byte[], String> entry;- yacySeed seed;+ Seed seed;while (i.hasNext()) {entry = i.next();hash = ASCII.String(entry.getKey());@@ -347,12 +347,12 @@ public class yacyCore {if (seeds.size() < attempts) { attempts = seeds.size(); }// This will try to get Peers that are not currently in amIAccessibleDB- final Iterator<yacySeed> si = seeds.values().iterator();- yacySeed seed;+ final Iterator<Seed> si = seeds.values().iterator();+ Seed seed;// include a YaCyNews record to my seedtry {- final yacyNewsDB.Record record = this.sb.peers.newsPool.myPublication();+ final NewsDB.Record record = this.sb.peers.newsPool.myPublication();if (record == null) {this.sb.peers.mySeed().put("news", "");} else {@@ -380,7 +380,7 @@ public class yacyCore {i++;final String address = seed.getClusterAddress();- if (log.isFine()) log.logFine("HELLO #" + i + " to peer '" + seed.get(yacySeed.NAME, "") + "' at " + address); // debug+ if (log.isFine()) log.logFine("HELLO #" + i + " to peer '" + seed.get(Seed.NAME, "") + "' at " + address); // debugfinal String seederror = seed.isProper(false);if ((address == null) || (seederror != null)) {// we don't like that address, delete it@@ -389,7 +389,7 @@ public class yacyCore {} else {// starting a new publisher threadcontactedSeedCount++;- (new publishThread(yacyCore.publishThreadGroup, seed, sync, syncList)).start();+ (new publishThread(Network.publishThreadGroup, seed, sync, syncList)).start();}}@@ -427,7 +427,7 @@ public class yacyCore {dbSize = amIAccessibleDB.size();final Iterator<String> ai = amIAccessibleDB.keySet().iterator();while (ai.hasNext()) {- final yacyAccessible ya = amIAccessibleDB.get(ai.next());+ final Accessible ya = amIAccessibleDB.get(ai.next());if (ya.lastUpdated < cutofftime) {ai.remove();} else {@@ -450,19 +450,19 @@ public class yacyCore {(accessible >= notaccessible)) {// We can be reached from a majority of other Peersif (this.sb.peers.mySeed().isPrincipal()) {- newPeerType = yacySeed.PEERTYPE_PRINCIPAL;+ newPeerType = Seed.PEERTYPE_PRINCIPAL;} else {- newPeerType = yacySeed.PEERTYPE_SENIOR;+ newPeerType = Seed.PEERTYPE_SENIOR;}} else {// We cannot be reached from the outside- newPeerType = yacySeed.PEERTYPE_JUNIOR;+ newPeerType = Seed.PEERTYPE_JUNIOR;}if (this.sb.peers.mySeed().orVirgin().equals(newPeerType)) {log.logInfo("PeerPing: myType is " + this.sb.peers.mySeed().orVirgin());} else {log.logInfo("PeerPing: changing myType from '" + this.sb.peers.mySeed().orVirgin() + "' to '" + newPeerType + "'");- this.sb.peers.mySeed().put(yacySeed.PEERTYPE, newPeerType);+ this.sb.peers.mySeed().put(Seed.PEERTYPE, newPeerType);}} else {log.logInfo("PeerPing: No data, staying at myType: " + this.sb.peers.mySeed().orVirgin());@@ -484,9 +484,9 @@ public class yacyCore {//if (ip.equals("")) ip = natLib.retrieveIP(DI604use, DI604pw);// yacyCore.log.logDebug("DEBUG: new IP=" + ip);- if (yacySeed.isProperIP(ip) == null) this.sb.peers.mySeed().setIP(ip);- if (this.sb.peers.mySeed().get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_JUNIOR).equals(yacySeed.PEERTYPE_JUNIOR)) // ???????????????- this.sb.peers.mySeed().put(yacySeed.PEERTYPE, yacySeed.PEERTYPE_SENIOR); // to start bootstraping, we need to be recognised as PEERTYPE_SENIOR peer+ if (Seed.isProperIP(ip) == null) this.sb.peers.mySeed().setIP(ip);+ if (this.sb.peers.mySeed().get(Seed.PEERTYPE, Seed.PEERTYPE_JUNIOR).equals(Seed.PEERTYPE_JUNIOR)) // ???????????????+ this.sb.peers.mySeed().put(Seed.PEERTYPE, Seed.PEERTYPE_SENIOR); // to start bootstraping, we need to be recognised as PEERTYPE_SENIOR peerlog.logInfo("publish: no recipient found, our address is " +((this.sb.peers.mySeed().getPublicAddress() == null) ? "unknown" : this.sb.peers.mySeed().getPublicAddress()));this.sb.peers.saveMySeed();@@ -499,19 +499,19 @@ public class yacyCore {Thread.interrupted();// interrupt all already started publishThreads- log.logInfo("publish: Signaling shutdown to " + yacyCore.publishThreadGroup.activeCount() + " remaining publishing threads ...");- yacyCore.publishThreadGroup.interrupt();+ log.logInfo("publish: Signaling shutdown to " + Network.publishThreadGroup.activeCount() + " remaining publishing threads ...");+ Network.publishThreadGroup.interrupt();// waiting some time for the publishThreads to finish executiontry { Thread.sleep(500); } catch (final InterruptedException ex) {}// getting the amount of remaining publishing threads- int threadCount = yacyCore.publishThreadGroup.activeCount();+ int threadCount = Network.publishThreadGroup.activeCount();final Thread[] threadList = new Thread[threadCount];- threadCount = yacyCore.publishThreadGroup.enumerate(threadList);+ threadCount = Network.publishThreadGroup.enumerate(threadList);// we need to use a timeout here because of missing interruptable session threads ...- if (log.isFine()) log.logFine("publish: Waiting for " + yacyCore.publishThreadGroup.activeCount() + " remaining publishing threads to finish shutdown ...");+ if (log.isFine()) log.logFine("publish: Waiting for " + Network.publishThreadGroup.activeCount() + " remaining publishing threads to finish shutdown ...");for (int currentThreadIdx = 0; currentThreadIdx < threadCount; currentThreadIdx++) {final Thread currentThread = threadList[currentThreadIdx];@@ -533,16 +533,16 @@ public class yacyCore {@SuppressWarnings("unchecked")public static HashMap<String, String> getSeedUploadMethods() {- synchronized (yacyCore.seedUploadMethods) {- return (HashMap<String, String>) yacyCore.seedUploadMethods.clone();+ synchronized (Network.seedUploadMethods) {+ return (HashMap<String, String>) Network.seedUploadMethods.clone();}}public static yacySeedUploader getSeedUploader(final String methodname) {String className = null;- synchronized (yacyCore.seedUploadMethods) {- if (yacyCore.seedUploadMethods.containsKey(methodname)) {- className = yacyCore.seedUploadMethods.get(methodname);+ synchronized (Network.seedUploadMethods) {+ if (Network.seedUploadMethods.containsKey(methodname)) {+ className = Network.seedUploadMethods.get(methodname);}}@@ -559,11 +559,11 @@ public class yacyCore {public static void loadSeedUploadMethods() {yacySeedUploader uploader;uploader = new yacySeedUploadFile();- yacyCore.seedUploadMethods.put(uploader.getClass().getSimpleName().substring("yacySeedUpload".length()), uploader.getClass().getCanonicalName());+ Network.seedUploadMethods.put(uploader.getClass().getSimpleName().substring("yacySeedUpload".length()), uploader.getClass().getCanonicalName());uploader = new yacySeedUploadFtp();- yacyCore.seedUploadMethods.put(uploader.getClass().getSimpleName().substring("yacySeedUpload".length()), uploader.getClass().getCanonicalName());+ Network.seedUploadMethods.put(uploader.getClass().getSimpleName().substring("yacySeedUpload".length()), uploader.getClass().getCanonicalName());uploader = new yacySeedUploadScp();- yacyCore.seedUploadMethods.put(uploader.getClass().getSimpleName().substring("yacySeedUpload".length()), uploader.getClass().getCanonicalName());+ Network.seedUploadMethods.put(uploader.getClass().getSimpleName().substring("yacySeedUpload".length()), uploader.getClass().getCanonicalName());}public static boolean changeSeedUploadMethod(final String method) {@@ -571,8 +571,8 @@ public class yacyCore {if (method.equalsIgnoreCase("none")) { return true; }- synchronized (yacyCore.seedUploadMethods) {- return yacyCore.seedUploadMethods.containsKey(method);+ synchronized (Network.seedUploadMethods) {+ return Network.seedUploadMethods.containsKey(method);}}@@ -620,7 +620,7 @@ public class yacyCore {// ensure that the seed file url is configured properlyDigestURI seedURL;try {- final String seedURLStr = sb.peers.mySeed().get(yacySeed.SEEDLISTURL, "");+ final String seedURLStr = sb.peers.mySeed().get(Seed.SEEDLISTURL, "");if (seedURLStr.length() == 0) { throw new MalformedURLException("The seed-file url must not be empty."); }if (!(seedURLStr.toLowerCase().startsWith("http://") ||@@ -630,25 +630,25 @@ public class yacyCore {}seedURL = new DigestURI(seedURLStr);} catch (final MalformedURLException e) {- final String errorMsg = "Malformed seed file URL '" + sb.peers.mySeed().get(yacySeed.SEEDLISTURL, "") + "'. " + e.getMessage();+ final String errorMsg = "Malformed seed file URL '" + sb.peers.mySeed().get(Seed.SEEDLISTURL, "") + "'. " + e.getMessage();log.logWarning("SaveSeedList: " + errorMsg);return errorMsg;}// upload the seed-list using the configured uploader class- String prevStatus = sb.peers.mySeed().get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_JUNIOR);- if (prevStatus.equals(yacySeed.PEERTYPE_PRINCIPAL)) { prevStatus = yacySeed.PEERTYPE_SENIOR; }+ String prevStatus = sb.peers.mySeed().get(Seed.PEERTYPE, Seed.PEERTYPE_JUNIOR);+ if (prevStatus.equals(Seed.PEERTYPE_PRINCIPAL)) { prevStatus = Seed.PEERTYPE_SENIOR; }try {- sb.peers.mySeed().put(yacySeed.PEERTYPE, yacySeed.PEERTYPE_PRINCIPAL); // this information shall also be uploaded+ sb.peers.mySeed().put(Seed.PEERTYPE, Seed.PEERTYPE_PRINCIPAL); // this information shall also be uploadedif (log.isFine()) log.logFine("SaveSeedList: Using seed uploading method '" + seedUploadMethod + "' for seed-list uploading." +- "\n\tPrevious peerType is '" + sb.peers.mySeed().get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_JUNIOR) + "'.");+ "\n\tPrevious peerType is '" + sb.peers.mySeed().get(Seed.PEERTYPE, Seed.PEERTYPE_JUNIOR) + "'.");logt = sb.peers.uploadSeedList(uploader, sb, sb.peers, seedURL);if (logt != null) {if (logt.indexOf("Error") >= 0) {- sb.peers.mySeed().put(yacySeed.PEERTYPE, prevStatus);+ sb.peers.mySeed().put(Seed.PEERTYPE, prevStatus);final String errorMsg = "SaveSeedList: seed upload failed using " + uploader.getClass().getName() + " (error): " + logt.substring(logt.indexOf("Error") + 6);log.logSevere(errorMsg);return errorMsg;@@ -657,10 +657,10 @@ public class yacyCore {}// finally, set the principal status- sb.setConfig("yacyStatus", yacySeed.PEERTYPE_PRINCIPAL);+ sb.setConfig("yacyStatus", Seed.PEERTYPE_PRINCIPAL);return null;} catch (final Exception e) {- sb.peers.mySeed().put(yacySeed.PEERTYPE, prevStatus);+ sb.peers.mySeed().put(Seed.PEERTYPE, prevStatus);sb.setConfig("yacyStatus", prevStatus);final String errorMsg = "SaveSeedList: Seed upload failed (IO error): " + e.getMessage();log.logInfo(errorMsg, e);diff --git a/source/net/yacy/peers/yacyNewsDB.java b/source/net/yacy/peers/NewsDB.javasimilarity index 83%rename from source/net/yacy/peers/yacyNewsDB.javarename to source/net/yacy/peers/NewsDB.javaindex ae16d6d01..0f5ff7aec 100644--- a/source/net/yacy/peers/yacyNewsDB.java+++ b/source/net/yacy/peers/NewsDB.java@@ -68,7 +68,7 @@ import net.yacy.kelondro.util.MapTools;import net.yacy.kelondro.util.kelondroException;-public class yacyNewsDB {+public class NewsDB {private final File path;private final Row rowdef;@@ -78,7 +78,7 @@ public class yacyNewsDB {private static final int categoryStringLength = 8;public static final int idLength = GenericFormatter.PATTERN_SHORT_SECOND.length() + Word.commonHashLength;- public yacyNewsDB(+ public NewsDB(final File path,final int maxNewsRecordLength,final boolean useTailCache,@@ -163,7 +163,7 @@ public class yacyNewsDB {private Record b2r(final Row.Entry b) {if (b == null) return null;- return new yacyNewsDB.Record(+ return new NewsDB.Record(b.getPrimaryKeyASCII(),b.getColUTF8(1),(b.empty(2)) ? null : my_SHORT_SECOND_FORMATTER.parse(b.getColASCII(2), GenericFormatter.UTCDiffString()),@@ -188,7 +188,7 @@ public class yacyNewsDB {return entry;}- public Record newRecord(final yacySeed mySeed, final String category, final Properties attributes) {+ public Record newRecord(final Seed mySeed, final String category, final Properties attributes) {try {final Map<String, String> m = new HashMap<String, String>();final Iterator<Entry<Object, Object>> e = attributes.entrySet().iterator();@@ -199,16 +199,16 @@ public class yacyNewsDB {}return new Record(mySeed, category, m);} catch (final IllegalArgumentException e) {- yacyCore.log.logWarning("rejected bad yacy news record (1): " + e.getMessage());+ Network.log.logWarning("rejected bad yacy news record (1): " + e.getMessage());return null;}}- public Record newRecord(final yacySeed mySeed, final String category, final Map<String, String> attributes) {+ public Record newRecord(final Seed mySeed, final String category, final Map<String, String> attributes) {try {return new Record(mySeed, category, attributes);} catch (final IllegalArgumentException e) {- yacyCore.log.logWarning("rejected bad yacy news record (2): " + e.getMessage());+ Network.log.logWarning("rejected bad yacy news record (2): " + e.getMessage());return null;}}@@ -217,7 +217,7 @@ public class yacyNewsDB {try {return new Record(external);} catch (final IllegalArgumentException e) {- yacyCore.log.logWarning("rejected bad yacy news record (3): " + e.getMessage());+ Network.log.logWarning("rejected bad yacy news record (3): " + e.getMessage());return null;}}@@ -234,9 +234,9 @@ public class yacyNewsDB {private Record(final String newsString) {this.attributes = MapTools.string2map(newsString, ",");- if (this.attributes.toString().length() > yacyNewsDB.this.attributesMaxLength) throw new IllegalArgumentException("attributes length (" + this.attributes.toString().length() + ") exceeds maximum (" + yacyNewsDB.this.attributesMaxLength + ")");+ if (this.attributes.toString().length() > NewsDB.this.attributesMaxLength) throw new IllegalArgumentException("attributes length (" + this.attributes.toString().length() + ") exceeds maximum (" + NewsDB.this.attributesMaxLength + ")");this.category = (this.attributes.containsKey("cat")) ? this.attributes.get("cat") : "";- if (this.category.length() > yacyNewsDB.categoryStringLength) throw new IllegalArgumentException("category length (" + this.category.length() + ") exceeds maximum (" + yacyNewsDB.categoryStringLength + ")");+ if (this.category.length() > NewsDB.categoryStringLength) throw new IllegalArgumentException("category length (" + this.category.length() + ") exceeds maximum (" + NewsDB.categoryStringLength + ")");this.received = (this.attributes.containsKey("rec")) ? my_SHORT_SECOND_FORMATTER.parse(this.attributes.get("rec"), GenericFormatter.UTCDiffString()) : new Date();this.created = (this.attributes.containsKey("cre")) ? my_SHORT_SECOND_FORMATTER.parse(this.attributes.get("cre"), GenericFormatter.UTCDiffString()) : new Date();this.distributed = (this.attributes.containsKey("dis")) ? Integer.parseInt(this.attributes.get("dis")) : 0;@@ -244,9 +244,9 @@ public class yacyNewsDB {removeStandards();}- private Record(final yacySeed mySeed, final String category, final Map<String, String> attributes) {- if (category.length() > yacyNewsDB.categoryStringLength) throw new IllegalArgumentException("category length (" + category.length() + ") exceeds maximum (" + yacyNewsDB.categoryStringLength + ")");- if (attributes.toString().length() > yacyNewsDB.this.attributesMaxLength) throw new IllegalArgumentException("attributes length (" + attributes.toString().length() + ") exceeds maximum (" + yacyNewsDB.this.attributesMaxLength + ")");+ private Record(final Seed mySeed, final String category, final Map<String, String> attributes) {+ if (category.length() > NewsDB.categoryStringLength) throw new IllegalArgumentException("category length (" + category.length() + ") exceeds maximum (" + NewsDB.categoryStringLength + ")");+ if (attributes.toString().length() > NewsDB.this.attributesMaxLength) throw new IllegalArgumentException("attributes length (" + attributes.toString().length() + ") exceeds maximum (" + NewsDB.this.attributesMaxLength + ")");this.attributes = attributes;this.received = null;this.created = new Date();@@ -257,8 +257,8 @@ public class yacyNewsDB {}private Record(final String id, final String category, final Date received, final int distributed, final Map<String, String> attributes) {- if (category.length() > yacyNewsDB.categoryStringLength) throw new IllegalArgumentException("category length (" + category.length() + ") exceeds maximum (" + yacyNewsDB.categoryStringLength + ")");- if (attributes.toString().length() > yacyNewsDB.this.attributesMaxLength) throw new IllegalArgumentException("attributes length (" + attributes.toString().length() + ") exceeds maximum (" + yacyNewsDB.this.attributesMaxLength + ")");+ if (category.length() > NewsDB.categoryStringLength) throw new IllegalArgumentException("category length (" + category.length() + ") exceeds maximum (" + NewsDB.categoryStringLength + ")");+ if (attributes.toString().length() > NewsDB.this.attributesMaxLength) throw new IllegalArgumentException("attributes length (" + attributes.toString().length() + ") exceeds maximum (" + NewsDB.this.attributesMaxLength + ")");this.attributes = attributes;this.received = received;this.created = my_SHORT_SECOND_FORMATTER.parse(id.substring(0, GenericFormatter.PATTERN_SHORT_SECOND.length()), GenericFormatter.UTCDiffString());diff --git a/source/net/yacy/peers/yacyNewsPool.java b/source/net/yacy/peers/NewsPool.javasimilarity index 83%rename from source/net/yacy/peers/yacyNewsPool.javarename to source/net/yacy/peers/NewsPool.javaindex a79f5922f..f639efefc 100644--- a/source/net/yacy/peers/yacyNewsPool.java+++ b/source/net/yacy/peers/NewsPool.java@@ -59,7 +59,7 @@ import net.yacy.kelondro.logging.Log;import net.yacy.repository.Blacklist;import net.yacy.search.Switchboard;-public class yacyNewsPool {+public class NewsPool {public static final int INCOMING_DB = 0;public static final int PROCESSED_DB = 1;@@ -259,19 +259,19 @@ public class yacyNewsPool {private final static long MILLISECONDS_PER_DAY = 1000 * 60 * 60 * 24;- private final yacyNewsDB newsDB;- private final yacyNewsQueue outgoingNews, publishedNews, incomingNews, processedNews;+ private final NewsDB newsDB;+ private final NewsQueue outgoingNews, publishedNews, incomingNews, processedNews;private final int maxDistribution;- public yacyNewsPool(+ public NewsPool(final File yacyDBPath,final boolean useTailCache,final boolean exceed134217727) {- this.newsDB = new yacyNewsDB(new File(yacyDBPath, "news1024.db"), 1024, useTailCache, exceed134217727);- this.outgoingNews = new yacyNewsQueue(new File(yacyDBPath, "newsOut.table"), this.newsDB);- this.publishedNews = new yacyNewsQueue(new File(yacyDBPath, "newsPublished.table"), this.newsDB);- this.incomingNews = new yacyNewsQueue(new File(yacyDBPath, "newsIn.table"), this.newsDB);- this.processedNews = new yacyNewsQueue(new File(yacyDBPath, "newsProcessed.table"), this.newsDB);+ this.newsDB = new NewsDB(new File(yacyDBPath, "news1024.db"), 1024, useTailCache, exceed134217727);+ this.outgoingNews = new NewsQueue(new File(yacyDBPath, "newsOut.table"), this.newsDB);+ this.publishedNews = new NewsQueue(new File(yacyDBPath, "newsPublished.table"), this.newsDB);+ this.incomingNews = new NewsQueue(new File(yacyDBPath, "newsIn.table"), this.newsDB);+ this.processedNews = new NewsQueue(new File(yacyDBPath, "newsProcessed.table"), this.newsDB);this.maxDistribution = 30;}@@ -283,25 +283,25 @@ public class yacyNewsPool {this.processedNews.close();}- public Iterator<yacyNewsDB.Record> recordIterator(final int dbKey, final boolean up) {+ public Iterator<NewsDB.Record> recordIterator(final int dbKey, final boolean up) {// returns an iterator of yacyNewsRecord-type objects- final yacyNewsQueue queue = switchQueue(dbKey);+ final NewsQueue queue = switchQueue(dbKey);return queue.records(up);}- public yacyNewsDB.Record parseExternal(final String external) {+ public NewsDB.Record parseExternal(final String external) {return this.newsDB.newRecord(external);}- public void publishMyNews(final yacySeed mySeed, final String category, final Map<String, String> attributes) {+ public void publishMyNews(final Seed mySeed, final String category, final Map<String, String> attributes) {publishMyNews(this.newsDB.newRecord(mySeed, category, attributes));}- public void publishMyNews(final yacySeed mySeed, final String category, final Properties attributes) {+ public void publishMyNews(final Seed mySeed, final String category, final Properties attributes) {publishMyNews(this.newsDB.newRecord(mySeed, category, attributes));}- private void publishMyNews(final yacyNewsDB.Record record) {+ private void publishMyNews(final NewsDB.Record record) {// this shall be called if our peer generated a new news record and wants to publish itif (record == null) return;try {@@ -314,10 +314,10 @@ public class yacyNewsPool {}}- public yacyNewsDB.Record myPublication() throws IOException, RowSpaceExceededException {+ public NewsDB.Record myPublication() throws IOException, RowSpaceExceededException {// generate a record for next peer-pingif (this.outgoingNews.isEmpty()) return null;- final yacyNewsDB.Record record = this.outgoingNews.pop();+ final NewsDB.Record record = this.outgoingNews.pop();if (record == null) return null;record.incDistribution();@@ -331,12 +331,12 @@ public class yacyNewsPool {return record;}- public void enqueueIncomingNews(final yacyNewsDB.Record record) throws IOException, RowSpaceExceededException {+ public void enqueueIncomingNews(final NewsDB.Record record) throws IOException, RowSpaceExceededException {// called if a news is attached to a seed// check consistencyif (record.id() == null) return;- if (record.id().length() != yacyNewsDB.idLength) return;+ if (record.id().length() != NewsDB.idLength) return;if (record.category() == null) return;if (!(categories.contains(record.category()))) return;if (record.created().getTime() == 0) return;@@ -366,13 +366,13 @@ public class yacyNewsPool {return switchQueue(dbKey).size();}- public int automaticProcess(final yacySeedDB seedDB) throws IOException, InterruptedException, RowSpaceExceededException {+ public int automaticProcess(final SeedDB seedDB) throws IOException, InterruptedException, RowSpaceExceededException {// processes news in the incoming-db// returns number of processes- yacyNewsDB.Record record;+ NewsDB.Record record;int pc = 0;synchronized (this.incomingNews) {- final Iterator<yacyNewsDB.Record> i = this.incomingNews.records(true);+ final Iterator<NewsDB.Record> i = this.incomingNews.records(true);final Set<String> removeIDs = new HashSet<String>();// this loop should not run too long! This may happen if the incoming news are long and not deleted after processingfinal long start = System.currentTimeMillis();@@ -390,14 +390,14 @@ public class yacyNewsPool {if (System.currentTimeMillis() - start > 100) break; // time-out for this to avoid deadlocks during concurrent peer-pings}for (final String id: removeIDs) {- final yacyNewsDB.Record deletedRecord = this.incomingNews.remove(id);+ final NewsDB.Record deletedRecord = this.incomingNews.remove(id);assert deletedRecord != null;}}return pc;}- private boolean automaticProcessP(final yacySeedDB seedDB, final yacyNewsDB.Record record) {+ private boolean automaticProcessP(final SeedDB seedDB, final NewsDB.Record record) {if (record == null) return false;if (record.category() == null) return true;final long created = record.created().getTime();@@ -419,10 +419,10 @@ public class yacyNewsPool {}if ((record.category().equals(CATEGORY_CRAWL_START)) &&((System.currentTimeMillis() - created) > (3L * MILLISECONDS_PER_DAY))) {- final yacySeed seed = seedDB.get(record.originator());+ final Seed seed = seedDB.get(record.originator());if (seed == null) return true;try {- return (Integer.parseInt(seed.get(yacySeed.ISPEED, "-")) < 10);+ return (Integer.parseInt(seed.get(Seed.ISPEED, "-")) < 10);} catch (final NumberFormatException ee) {return true;}@@ -430,11 +430,11 @@ public class yacyNewsPool {return false;}- public synchronized yacyNewsDB.Record getSpecific(final int dbKey, final String category, final String key, final String value) {- final yacyNewsQueue queue = switchQueue(dbKey);- yacyNewsDB.Record record;+ public synchronized NewsDB.Record getSpecific(final int dbKey, final String category, final String key, final String value) {+ final NewsQueue queue = switchQueue(dbKey);+ NewsDB.Record record;String s;- final Iterator<yacyNewsDB.Record> i = queue.records(true);+ final Iterator<NewsDB.Record> i = queue.records(true);while (i.hasNext()) {record = i.next();if ((record != null) && (record.category().equals(category))) {@@ -445,10 +445,10 @@ public class yacyNewsPool {return null;}- public synchronized yacyNewsDB.Record getByOriginator(final int dbKey, final String category, final String originatorHash) {- final yacyNewsQueue queue = switchQueue(dbKey);- yacyNewsDB.Record record;- final Iterator<yacyNewsDB.Record> i = queue.records(true);+ public synchronized NewsDB.Record getByOriginator(final int dbKey, final String category, final String originatorHash) {+ final NewsQueue queue = switchQueue(dbKey);+ NewsDB.Record record;+ final Iterator<NewsDB.Record> i = queue.records(true);while (i.hasNext()) {record = i.next();if ((record != null) &&@@ -460,7 +460,7 @@ public class yacyNewsPool {return null;}- public synchronized yacyNewsDB.Record getByID(final int dbKey, final String id) {+ public synchronized NewsDB.Record getByID(final int dbKey, final String id) {switch (dbKey) {case INCOMING_DB: return this.incomingNews.get(id);case PROCESSED_DB: return this.processedNews.get(id);@@ -470,7 +470,7 @@ public class yacyNewsPool {return null;}- private yacyNewsQueue switchQueue(final int dbKey) {+ private NewsQueue switchQueue(final int dbKey) {switch (dbKey) {case INCOMING_DB: return this.incomingNews;case PROCESSED_DB: return this.processedNews;@@ -501,9 +501,9 @@ public class yacyNewsPool {}}- private boolean moveOff(final yacyNewsQueue fromqueue, final yacyNewsQueue toqueue, final String id) throws IOException, RowSpaceExceededException {+ private boolean moveOff(final NewsQueue fromqueue, final NewsQueue toqueue, final String id) throws IOException, RowSpaceExceededException {// called if a published news shall be removed- final yacyNewsDB.Record record = fromqueue.remove(id);+ final NewsDB.Record record = fromqueue.remove(id);if (record == null) {return false;}@@ -526,10 +526,10 @@ public class yacyNewsPool {}}- private int moveOffAll(final yacyNewsQueue fromqueue, final yacyNewsQueue toqueue) throws IOException, RowSpaceExceededException {+ private int moveOffAll(final NewsQueue fromqueue, final NewsQueue toqueue) throws IOException, RowSpaceExceededException {// move off all news from a specific queue to another queue- final Iterator<yacyNewsDB.Record> i = fromqueue.records(true);- yacyNewsDB.Record record;+ final Iterator<NewsDB.Record> i = fromqueue.records(true);+ NewsDB.Record record;if (toqueue == null) return 0;int c = 0;while (i.hasNext()) {diff --git a/source/net/yacy/peers/yacyNewsQueue.java b/source/net/yacy/peers/NewsQueue.javasimilarity index 82%rename from source/net/yacy/peers/yacyNewsQueue.javarename to source/net/yacy/peers/NewsQueue.javaindex 2de984749..328c856ba 100644--- a/source/net/yacy/peers/yacyNewsQueue.java+++ b/source/net/yacy/peers/NewsQueue.java@@ -60,20 +60,20 @@ import net.yacy.kelondro.table.Table;import net.yacy.kelondro.util.FileUtils;-public class yacyNewsQueue {+public class NewsQueue {private final File path;private Table queueStack;- private final yacyNewsDB newsDB;+ private final NewsDB newsDB;private static final Row rowdef = new Row(new Column[]{- new Column("newsid", Column.celltype_string, Column.encoder_bytes, yacyNewsDB.idLength, "id = created + originator"),+ new Column("newsid", Column.celltype_string, Column.encoder_bytes, NewsDB.idLength, "id = created + originator"),new Column("last touched", Column.celltype_string, Column.encoder_bytes, GenericFormatter.PATTERN_SHORT_SECOND.length(), "")},NaturalOrder.naturalOrder);- public yacyNewsQueue(final File path, final yacyNewsDB newsDB) {+ public NewsQueue(final File path, final NewsDB newsDB) {this.path = path;this.newsDB = newsDB;try {@@ -117,7 +117,7 @@ public class yacyNewsQueue {return this.queueStack.isEmpty();}- public synchronized void push(final yacyNewsDB.Record entry) throws IOException, RowSpaceExceededException {+ public synchronized void push(final NewsDB.Record entry) throws IOException, RowSpaceExceededException {if (!this.queueStack.consistencyCheck()) {Log.logSevere("yacyNewsQueue", "reset of table " + this.path);this.queueStack.clear();@@ -125,14 +125,14 @@ public class yacyNewsQueue {this.queueStack.addUnique(r2b(entry));}- public synchronized yacyNewsDB.Record pop() throws IOException {+ public synchronized NewsDB.Record pop() throws IOException {if (this.queueStack.isEmpty()) return null;return b2r(this.queueStack.removeOne());}- public synchronized yacyNewsDB.Record get(final String id) {- yacyNewsDB.Record record;- final Iterator<yacyNewsDB.Record> i = records(true);+ public synchronized NewsDB.Record get(final String id) {+ NewsDB.Record record;+ final Iterator<NewsDB.Record> i = records(true);while (i.hasNext()) {record = i.next();if ((record != null) && (record.id().equals(id))) return record;@@ -140,9 +140,9 @@ public class yacyNewsQueue {return null;}- public synchronized yacyNewsDB.Record remove(final String id) {- yacyNewsDB.Record record;- final Iterator<yacyNewsDB.Record> i = records(true);+ public synchronized NewsDB.Record remove(final String id) {+ NewsDB.Record record;+ final Iterator<NewsDB.Record> i = records(true);while (i.hasNext()) {record = i.next();if ((record != null) && (record.id().equals(id))) {@@ -157,14 +157,14 @@ public class yacyNewsQueue {return null;}- yacyNewsDB.Record b2r(final Row.Entry b) throws IOException {+ NewsDB.Record b2r(final Row.Entry b) throws IOException {if (b == null) return null;final String id = b.getPrimaryKeyASCII();//Date touched = yacyCore.parseUniversalDate(UTF8.String(b[1]));return this.newsDB.get(id);}- private Row.Entry r2b(final yacyNewsDB.Record r) throws IOException, RowSpaceExceededException {+ private Row.Entry r2b(final NewsDB.Record r) throws IOException, RowSpaceExceededException {if (r == null) return null;this.newsDB.put(r);final Row.Entry b = this.queueStack.row().newEntry(new byte[][]{@@ -173,20 +173,20 @@ public class yacyNewsQueue {return b;}- public Iterator<yacyNewsDB.Record> records(final boolean up) {+ public Iterator<NewsDB.Record> records(final boolean up) {// iterates yacyNewsRecord-type objects- if (this.queueStack == null) return new HashSet<yacyNewsDB.Record>().iterator();+ if (this.queueStack == null) return new HashSet<NewsDB.Record>().iterator();return new newsIterator(up);}- private class newsIterator implements Iterator<yacyNewsDB.Record> {+ private class newsIterator implements Iterator<NewsDB.Record> {// iterates yacyNewsRecord-type objectsIterator<Row.Entry> stackNodeIterator;private newsIterator(final boolean up) {try {- this.stackNodeIterator = yacyNewsQueue.this.queueStack.rows();+ this.stackNodeIterator = NewsQueue.this.queueStack.rows();} catch (final IOException e) {Log.logException(e);this.stackNodeIterator = null;@@ -197,7 +197,7 @@ public class yacyNewsQueue {return this.stackNodeIterator != null && this.stackNodeIterator.hasNext();}- public yacyNewsDB.Record next() {+ public NewsDB.Record next() {if (this.stackNodeIterator == null) return null;final Row.Entry row = this.stackNodeIterator.next();try {diff --git a/source/net/yacy/peers/yacyPeerActions.java b/source/net/yacy/peers/PeerActions.javasimilarity index 67%rename from source/net/yacy/peers/yacyPeerActions.javarename to source/net/yacy/peers/PeerActions.javaindex 14688b9fe..354c4d5f8 100644--- a/source/net/yacy/peers/yacyPeerActions.java+++ b/source/net/yacy/peers/PeerActions.java@@ -34,14 +34,14 @@ import net.yacy.kelondro.util.MapTools;import net.yacy.peers.operation.yacyVersion;-public class yacyPeerActions {+public class PeerActions {- private final yacySeedDB seedDB;+ private final SeedDB seedDB;private Map<String, String> userAgents;public long disconnects;- private final yacyNewsPool newsPool;+ private final NewsPool newsPool;- public yacyPeerActions(final yacySeedDB seedDB, final yacyNewsPool newsPool) {+ public PeerActions(final SeedDB seedDB, final NewsPool newsPool) {this.seedDB = seedDB;this.newsPool = newsPool;this.userAgents = new ConcurrentHashMap<String, String>();@@ -54,46 +54,46 @@ public class yacyPeerActions {this.userAgents = null;}- public boolean connectPeer(final yacySeed seed, final boolean direct) {+ public boolean connectPeer(final Seed seed, final boolean direct) {// store a remote peer's seed// returns true if the peer is new and previously unknownif (seed == null) {- yacyCore.log.logSevere("connect: WRONG seed (NULL)");+ Network.log.logSevere("connect: WRONG seed (NULL)");return false;}final String error = seed.isProper(false);if (error != null) {- yacyCore.log.logSevere("connect: WRONG seed (" + seed.getName() + "/" + seed.hash + "): " + error);+ Network.log.logSevere("connect: WRONG seed (" + seed.getName() + "/" + seed.hash + "): " + error);return false;}if ((this.seedDB.mySeedIsDefined()) && (seed.hash.equals(this.seedDB.mySeed().hash))) {- yacyCore.log.logInfo("connect: SELF reference " + seed.getPublicAddress());+ Network.log.logInfo("connect: SELF reference " + seed.getPublicAddress());return false;}- final String peerType = seed.get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_VIRGIN);+ final String peerType = seed.get(Seed.PEERTYPE, Seed.PEERTYPE_VIRGIN);- if ((peerType.equals(yacySeed.PEERTYPE_VIRGIN)) || (peerType.equals(yacySeed.PEERTYPE_JUNIOR))) {+ if ((peerType.equals(Seed.PEERTYPE_VIRGIN)) || (peerType.equals(Seed.PEERTYPE_JUNIOR))) {// reject unqualified seeds- if (yacyCore.log.isFine()) yacyCore.log.logFine("connect: rejecting NOT QUALIFIED " + peerType + " seed " + seed.getName());+ if (Network.log.isFine()) Network.log.logFine("connect: rejecting NOT QUALIFIED " + peerType + " seed " + seed.getName());return false;}- if (!(peerType.equals(yacySeed.PEERTYPE_SENIOR) || peerType.equals(yacySeed.PEERTYPE_PRINCIPAL))) {+ if (!(peerType.equals(Seed.PEERTYPE_SENIOR) || peerType.equals(Seed.PEERTYPE_PRINCIPAL))) {// reject unqualified seeds- if (yacyCore.log.isFine()) yacyCore.log.logFine("connect: rejecting NOT QUALIFIED " + peerType + " seed " + seed.getName());+ if (Network.log.isFine()) Network.log.logFine("connect: rejecting NOT QUALIFIED " + peerType + " seed " + seed.getName());return false;}- final yacySeed doubleSeed = this.seedDB.lookupByIP(seed.getInetAddress(), true, false, false);+ final Seed doubleSeed = this.seedDB.lookupByIP(seed.getInetAddress(), true, false, false);if ((doubleSeed != null) && (doubleSeed.getPort() == seed.getPort()) && (!(doubleSeed.hash.equals(seed.hash)))) {// a user frauds with his peer different peer hashes- if (yacyCore.log.isFine()) yacyCore.log.logFine("connect: rejecting FRAUD (double hashes " + doubleSeed.hash + "/" + seed.hash + " on same port " + seed.getPort() + ") peer " + seed.getName());+ if (Network.log.isFine()) Network.log.logFine("connect: rejecting FRAUD (double hashes " + doubleSeed.hash + "/" + seed.hash + " on same port " + seed.getPort() + ") peer " + seed.getName());return false;}- if (seed.get(yacySeed.LASTSEEN, "").length() != 14) {+ if (seed.get(Seed.LASTSEEN, "").length() != 14) {// hack for peers that do not have a LastSeen dateseed.setLastSeenUTC();- if (yacyCore.log.isFine()) yacyCore.log.logFine("connect: reset wrong date (" + seed.getName() + "/" + seed.hash + ")");+ if (Network.log.isFine()) Network.log.logFine("connect: reset wrong date (" + seed.getName() + "/" + seed.hash + ")");}// connection time@@ -108,13 +108,13 @@ public class yacyPeerActions {}if (Math.abs(nowUTC0Time - ctimeUTC0) / 1000 / 60 > 60 * 6 ) {// the new connection is out-of-age, we reject the connection- if (yacyCore.log.isFine()) yacyCore.log.logFine("connect: rejecting out-dated peer '" + seed.getName() + "' from " + seed.getPublicAddress() + "; nowUTC0=" + nowUTC0Time + ", seedUTC0=" + ctimeUTC0 + ", TimeDiff=" + formatInterval(Math.abs(nowUTC0Time - ctimeUTC0)));+ if (Network.log.isFine()) Network.log.logFine("connect: rejecting out-dated peer '" + seed.getName() + "' from " + seed.getPublicAddress() + "; nowUTC0=" + nowUTC0Time + ", seedUTC0=" + ctimeUTC0 + ", TimeDiff=" + formatInterval(Math.abs(nowUTC0Time - ctimeUTC0)));return false;}// disconnection timelong dtimeUTC0;- final yacySeed disconnectedSeed = this.seedDB.getDisconnected(seed.hash);+ final Seed disconnectedSeed = this.seedDB.getDisconnected(seed.hash);if (disconnectedSeed == null) {dtimeUTC0 = 0; // never disconnected: virtually disconnected maximum time ago} else {@@ -145,24 +145,24 @@ public class yacyPeerActions {if (!direct) {if (ctimeUTC0 < dtimeUTC0) {// the disconnection was later, we reject the connection- if (yacyCore.log.isFine()) yacyCore.log.logFine("connect: rejecting disconnected peer '" + seed.getName() + "' from " + seed.getPublicAddress());+ if (Network.log.isFine()) Network.log.logFine("connect: rejecting disconnected peer '" + seed.getName() + "' from " + seed.getPublicAddress());return false;}}// this is a return of a lost peer- if (yacyCore.log.isFine()) yacyCore.log.logFine("connect: returned KNOWN " + peerType + " peer '" + seed.getName() + "' from " + seed.getPublicAddress());+ if (Network.log.isFine()) Network.log.logFine("connect: returned KNOWN " + peerType + " peer '" + seed.getName() + "' from " + seed.getPublicAddress());this.seedDB.addConnected(seed);return true;}- final yacySeed connectedSeed = this.seedDB.getConnected(seed.hash);+ final Seed connectedSeed = this.seedDB.getConnected(seed.hash);if (connectedSeed != null) {// the seed is known: this is an updatetry {// if the old LastSeen date is later then the other// info, then we reject the infoif ((ctimeUTC0 < (connectedSeed.getLastSeenUTC())) && (!direct)) {- if (yacyCore.log.isFine()) yacyCore.log.logFine("connect: rejecting old info about peer '" + seed.getName() + "'");+ if (Network.log.isFine()) Network.log.logFine("connect: rejecting old info about peer '" + seed.getName() + "'");return false;}@@ -170,10 +170,10 @@ public class yacyPeerActions {// TODO: update seed name lookup cache}*/} catch (final NumberFormatException e) {- if (yacyCore.log.isFine()) yacyCore.log.logFine("connect: rejecting wrong peer '" + seed.getName() + "' from " + seed.getPublicAddress() + ". Cause: " + e.getMessage());+ if (Network.log.isFine()) Network.log.logFine("connect: rejecting wrong peer '" + seed.getName() + "' from " + seed.getPublicAddress() + ". Cause: " + e.getMessage());return false;}- if (yacyCore.log.isFine()) yacyCore.log.logFine("connect: updated KNOWN " + ((direct) ? "direct " : "") + peerType + " peer '" + seed.getName() + "' from " + seed.getPublicAddress());+ if (Network.log.isFine()) Network.log.logFine("connect: updated KNOWN " + ((direct) ? "direct " : "") + peerType + " peer '" + seed.getName() + "' from " + seed.getPublicAddress());this.seedDB.addConnected(seed);return true;}@@ -182,53 +182,53 @@ public class yacyPeerActions {if ((this.seedDB.mySeedIsDefined()) && (seed.getIP().equals(this.seedDB.mySeed().getIP()))) {// seed from the same IP as the calling client: can be// the case if there runs another one over a NAT- if (yacyCore.log.isFine()) yacyCore.log.logFine("connect: saved NEW seed (myself IP) " + seed.getPublicAddress());+ if (Network.log.isFine()) Network.log.logFine("connect: saved NEW seed (myself IP) " + seed.getPublicAddress());} else {// completely new seed- if (yacyCore.log.isFine()) yacyCore.log.logFine("connect: saved NEW " + peerType + " peer '" + seed.getName() + "' from " + seed.getPublicAddress());+ if (Network.log.isFine()) Network.log.logFine("connect: saved NEW " + peerType + " peer '" + seed.getName() + "' from " + seed.getPublicAddress());}this.seedDB.addConnected(seed);return true;}- public boolean peerArrival(final yacySeed peer, final boolean direct) {+ public boolean peerArrival(final Seed peer, final boolean direct) {if (peer == null) return false;final boolean res = connectPeer(peer, direct);if (res) {// perform all actions if peer is effective newprocessPeerArrival(peer);- yacyChannel.channels(yacyChannel.PEERNEWS).addMessage(new RSSMessage(peer.getName() + " joined the network", "", ""));+ EventChannel.channels(EventChannel.PEERNEWS).addMessage(new RSSMessage(peer.getName() + " joined the network", "", ""));}return res;}- public void peerDeparture(final yacySeed peer, final String cause) {+ public void peerDeparture(final Seed peer, final String cause) {if (peer == null) return;// we do this if we did not get contact with the other peer- if (yacyCore.log.isFine()) yacyCore.log.logFine("connect: no contact to a " + peer.get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_VIRGIN) + " peer '" + peer.getName() + "' at " + peer.getPublicAddress() + ". Cause: " + cause);+ if (Network.log.isFine()) Network.log.logFine("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()));this.seedDB.addDisconnected(peer); // update info}- yacyChannel.channels(yacyChannel.PEERNEWS).addMessage(new RSSMessage(peer.getName() + " left the network", "", ""));+ EventChannel.channels(EventChannel.PEERNEWS).addMessage(new RSSMessage(peer.getName() + " left the network", "", ""));}- public void peerPing(final yacySeed peer) {+ public void peerPing(final Seed peer) {if (peer == null) return;// this is called only if the peer has junior statusthis.seedDB.addPotential(peer);// perform all actionsprocessPeerArrival(peer);- yacyChannel.channels(yacyChannel.PEERNEWS).addMessage(new RSSMessage(peer.getName() + " sent me a ping", "", ""));+ EventChannel.channels(EventChannel.PEERNEWS).addMessage(new RSSMessage(peer.getName() + " sent me a ping", "", ""));}- private void processPeerArrival(final yacySeed peer) {+ private void processPeerArrival(final Seed peer) {final String recordString = peer.get("news", null);//System.out.println("### triggered news arrival from peer " + peer.getName() + ", news " + ((recordString == null) ? "empty" : "attached"));if ((recordString == null) || (recordString.length() == 0)) return;final String decodedString = de.anomic.tools.crypt.simpleDecode(recordString, "");- final yacyNewsDB.Record record = this.newsPool.parseExternal(decodedString);+ final NewsDB.Record record = this.newsPool.parseExternal(decodedString);if (record != null) {//System.out.println("### news arrival from peer " + peer.getName() + ", decoded=" + decodedString + ", record=" + recordString + ", news=" + record.toString());final String cre1 = MapTools.string2map(decodedString, ",").get("cre");diff --git a/source/net/yacy/peers/yacyClient.java b/source/net/yacy/peers/Protocol.javasimilarity index 75%rename from source/net/yacy/peers/yacyClient.javarename to source/net/yacy/peers/Protocol.javaindex efc4f589d..621f53ce4 100644--- a/source/net/yacy/peers/yacyClient.java+++ b/source/net/yacy/peers/Protocol.java@@ -60,6 +60,7 @@ import java.util.TreeMap;import java.util.regex.Pattern;import net.yacy.migration;+import net.yacy.cora.date.GenericFormatter;import net.yacy.cora.document.ASCII;import net.yacy.cora.document.JSONArray;import net.yacy.cora.document.JSONException;@@ -83,6 +84,7 @@ import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.order.Bitfield;+import net.yacy.kelondro.order.Digest;import net.yacy.kelondro.rwi.Reference;import net.yacy.kelondro.rwi.ReferenceContainer;import net.yacy.kelondro.rwi.ReferenceContainerCache;@@ -95,6 +97,7 @@ import net.yacy.peers.graphics.WebStructureGraph.HostReference;import net.yacy.peers.operation.yacyVersion;import net.yacy.repository.Blacklist;import net.yacy.search.Switchboard;+import net.yacy.search.SwitchboardConstants;import net.yacy.search.index.Segment;import net.yacy.search.query.QueryParams;import net.yacy.search.query.RWIProcess;@@ -108,20 +111,22 @@ import org.apache.http.entity.mime.content.ContentBody;import de.anomic.crawler.ResultURLs;import de.anomic.crawler.ResultURLs.EventOrigin;import de.anomic.server.serverCore;+import de.anomic.server.serverObjects;+import de.anomic.server.serverSwitch;import de.anomic.tools.crypt;-public final class yacyClient {+public final class Protocol {- private static byte[] postToFile(final yacySeed target, final String filename, final Map<String,ContentBody> parts, final int timeout) throws IOException {+ private static byte[] postToFile(final Seed target, final String filename, final Map<String,ContentBody> parts, final int timeout) throws IOException {return postToFile(target.getClusterAddress(), target.hash, filename, parts, timeout);}- private static byte[] postToFile(final yacySeedDB seedDB, final String targetHash, final String filename, final Map<String,ContentBody> parts, final int timeout) throws IOException {+ private static byte[] postToFile(final SeedDB seedDB, final String targetHash, final String filename, final Map<String,ContentBody> parts, final int timeout) throws IOException {return postToFile(seedDB.targetAddress(targetHash), targetHash, filename, parts, timeout);}private static byte[] postToFile(final String targetAddress, final String targetPeerHash, final String filename, final Map<String,ContentBody> parts, final int timeout) throws IOException {final HTTPClient httpClient = new HTTPClient(ClientIdentification.getUserAgent(), timeout);- return httpClient.POSTbytes(new MultiProtocolURI("http://" + targetAddress + "/yacy/" + filename), yacySeed.b64Hash2hexHash(targetPeerHash) + ".yacyh", parts, false);+ return httpClient.POSTbytes(new MultiProtocolURI("http://" + targetAddress + "/yacy/" + filename), Seed.b64Hash2hexHash(targetPeerHash) + ".yacyh", parts, false);}/**@@ -146,59 +151,59 @@ public final class yacyClient {** @return the number of new seeds*/- public static int hello(final yacySeed mySeed, final yacyPeerActions peerActions, final String address, final String otherHash, final String otherName) {+ public static int hello(final Seed mySeed, final PeerActions peerActions, final String address, final String otherHash, final String otherName) {Map<String, String> result = null;final String salt = crypt.randomSalt();try {// generate request- final Map<String,ContentBody> parts = yacyNetwork.basicRequestParts(Switchboard.getSwitchboard(), null, salt);+ final Map<String,ContentBody> parts = basicRequestParts(Switchboard.getSwitchboard(), null, salt);parts.put("count", UTF8.StringBody("20"));- parts.put("magic", UTF8.StringBody(Long.toString(yacyCore.magic)));+ parts.put("magic", UTF8.StringBody(Long.toString(Network.magic)));parts.put("seed", UTF8.StringBody(mySeed.genSeedStr(salt)));// send requestfinal long start = System.currentTimeMillis();// final byte[] content = HTTPConnector.getConnector(MultiProtocolURI.yacybotUserAgent).post(new MultiProtocolURI("http://" + address + "/yacy/hello.html"), 30000, yacySeed.b64Hash2hexHash(otherHash) + ".yacyh", parts);final HTTPClient httpClient = new HTTPClient(ClientIdentification.getUserAgent(), 30000);- final byte[] content = httpClient.POSTbytes(new MultiProtocolURI("http://" + address + "/yacy/hello.html"), yacySeed.b64Hash2hexHash(otherHash) + ".yacyh", parts, false);- yacyCore.log.logInfo("yacyClient.hello thread '" + Thread.currentThread().getName() + "' contacted peer at " + address + ", received " + ((content == null) ? "null" : content.length) + " bytes, time = " + (System.currentTimeMillis() - start) + " milliseconds");+ final byte[] content = httpClient.POSTbytes(new MultiProtocolURI("http://" + address + "/yacy/hello.html"), Seed.b64Hash2hexHash(otherHash) + ".yacyh", parts, false);+ Network.log.logInfo("yacyClient.hello thread '" + Thread.currentThread().getName() + "' contacted peer at " + address + ", received " + ((content == null) ? "null" : content.length) + " bytes, time = " + (System.currentTimeMillis() - start) + " milliseconds");result = FileUtils.table(content);} catch (final Exception e) {if (Thread.currentThread().isInterrupted()) {- yacyCore.log.logInfo("yacyClient.hello thread '" + Thread.currentThread().getName() + "' interrupted.");+ Network.log.logInfo("yacyClient.hello thread '" + Thread.currentThread().getName() + "' interrupted.");return -1;}- yacyCore.log.logInfo("yacyClient.hello thread '" + Thread.currentThread().getName() + "', peer " + address + "; exception: " + e.getMessage());+ Network.log.logInfo("yacyClient.hello thread '" + Thread.currentThread().getName() + "', peer " + address + "; exception: " + e.getMessage());// try again (go into loop)result = null;}if (result == null) {- yacyCore.log.logInfo("yacyClient.hello result error: " ++ Network.log.logInfo("yacyClient.hello result error: " +((result == null) ? "result null" : ("result=" + result.toString())));return -1;}// check consistency with expectation- yacySeed otherPeer = null;+ Seed otherPeer = null;String seed;if ((otherHash != null) &&(otherHash.length() > 0) &&((seed = result.get("seed0")) != null)) {- if (seed.length() > yacySeed.maxsize) {- yacyCore.log.logInfo("hello/client 0: rejected contacting seed; too large (" + seed.length() + " > " + yacySeed.maxsize + ")");+ if (seed.length() > Seed.maxsize) {+ Network.log.logInfo("hello/client 0: rejected contacting seed; too large (" + seed.length() + " > " + Seed.maxsize + ")");} else {try {final int p = address.indexOf(':');if (p < 0) return -1;final String host = Domains.dnsResolve(address.substring(0, p)).getHostAddress();- otherPeer = yacySeed.genRemoteSeed(seed, salt, false, host);+ otherPeer = Seed.genRemoteSeed(seed, salt, false, host);if (!otherPeer.hash.equals(otherHash)) {- yacyCore.log.logInfo("yacyClient.hello: consistency error: otherPeer.hash = " + otherPeer.hash + ", otherHash = " + otherHash);+ Network.log.logInfo("yacyClient.hello: consistency error: otherPeer.hash = " + otherPeer.hash + ", otherHash = " + otherHash);return -1; // no success}} catch (final IOException e) {- yacyCore.log.logInfo("yacyClient.hello: consistency error: other seed bad:" + e.getMessage() + ", seed=" + seed);+ Network.log.logInfo("yacyClient.hello: consistency error: other seed bad:" + e.getMessage() + ", seed=" + seed);return -1; // no success}}@@ -210,45 +215,45 @@ public final class yacyClient {mySeed.setIP(Switchboard.getSwitchboard().myPublicIP());} else {final String myIP = result.get("yourip");- final String properIP = yacySeed.isProperIP(myIP);+ final String properIP = Seed.isProperIP(myIP);if (properIP == null) mySeed.setIP(myIP);}// change our seed-type- String mytype = result.get(yacySeed.YOURTYPE);+ String mytype = result.get(Seed.YOURTYPE);if (mytype == null) { mytype = ""; }- final yacyAccessible accessible = new yacyAccessible();- if (mytype.equals(yacySeed.PEERTYPE_SENIOR)||mytype.equals(yacySeed.PEERTYPE_PRINCIPAL)) {+ final Accessible accessible = new Accessible();+ if (mytype.equals(Seed.PEERTYPE_SENIOR)||mytype.equals(Seed.PEERTYPE_PRINCIPAL)) {accessible.IWasAccessed = true;if (mySeed.isPrincipal()) {- mytype = yacySeed.PEERTYPE_PRINCIPAL;+ mytype = Seed.PEERTYPE_PRINCIPAL;}} else {accessible.IWasAccessed = false;}accessible.lastUpdated = System.currentTimeMillis();- yacyCore.amIAccessibleDB.put(otherHash, accessible);+ Network.amIAccessibleDB.put(otherHash, accessible);/** If we were reported as junior we have to check if your port forwarding channel is broken* If this is true we try to reconnect the sch channel to the remote server now.*/- if (mytype.equalsIgnoreCase(yacySeed.PEERTYPE_JUNIOR)) {- yacyCore.log.logInfo("yacyClient.hello: Peer '" + ((otherPeer==null)?"unknown":otherPeer.getName()) + "' reported us as junior.");- } else if ((mytype.equalsIgnoreCase(yacySeed.PEERTYPE_SENIOR)) ||- (mytype.equalsIgnoreCase(yacySeed.PEERTYPE_PRINCIPAL))) {- if (yacyCore.log.isFine()) yacyCore.log.logFine("yacyClient.hello: Peer '" + ((otherPeer==null)?"unknown":otherPeer.getName()) + "' reported us as " + mytype + ", accepted other peer.");+ if (mytype.equalsIgnoreCase(Seed.PEERTYPE_JUNIOR)) {+ Network.log.logInfo("yacyClient.hello: Peer '" + ((otherPeer==null)?"unknown":otherPeer.getName()) + "' reported us as junior.");+ } else if ((mytype.equalsIgnoreCase(Seed.PEERTYPE_SENIOR)) ||+ (mytype.equalsIgnoreCase(Seed.PEERTYPE_PRINCIPAL))) {+ if (Network.log.isFine()) Network.log.logFine("yacyClient.hello: Peer '" + ((otherPeer==null)?"unknown":otherPeer.getName()) + "' reported us as " + mytype + ", accepted other peer.");} else {// wrong type report- if (yacyCore.log.isFine()) yacyCore.log.logFine("yacyClient.hello: Peer '" + ((otherPeer==null)?"unknown":otherPeer.getName()) + "' reported us as " + mytype + ", rejecting other peer.");+ if (Network.log.isFine()) Network.log.logFine("yacyClient.hello: Peer '" + ((otherPeer==null)?"unknown":otherPeer.getName()) + "' reported us as " + mytype + ", rejecting other peer.");return -1;}- if (mySeed.orVirgin().equals(yacySeed.PEERTYPE_VIRGIN))- mySeed.put(yacySeed.PEERTYPE, mytype);+ if (mySeed.orVirgin().equals(Seed.PEERTYPE_VIRGIN))+ mySeed.put(Seed.PEERTYPE, mytype);final String error = mySeed.isProper(true);if (error != null) {- yacyCore.log.logWarning("yacyClient.hello mySeed error - not proper: " + error);+ Network.log.logWarning("yacyClient.hello mySeed error - not proper: " + error);return -1;}@@ -258,26 +263,26 @@ public final class yacyClient {int i = 0;int count = 0;String seedStr;- yacySeed s;+ Seed s;final int connectedBefore = peerActions.sizeConnected();while ((seedStr = result.get("seed" + i++)) != null) {// integrate new seed into own database// the first seed, "seed0" is the seed of the responding peer- if (seedStr.length() > yacySeed.maxsize) {- yacyCore.log.logInfo("hello/client: rejected contacting seed; too large (" + seedStr.length() + " > " + yacySeed.maxsize + ")");+ if (seedStr.length() > Seed.maxsize) {+ Network.log.logInfo("hello/client: rejected contacting seed; too large (" + seedStr.length() + " > " + Seed.maxsize + ")");} else {try {if (i == 1) {final int p = address.indexOf(':');if (p < 0) return -1;final String host = Domains.dnsResolve(address.substring(0, p)).getHostAddress();- s = yacySeed.genRemoteSeed(seedStr, salt, false, host);+ s = Seed.genRemoteSeed(seedStr, salt, false, host);} else {- s = yacySeed.genRemoteSeed(seedStr, salt, false, null);+ s = Seed.genRemoteSeed(seedStr, salt, false, null);}if (peerActions.peerArrival(s, (i == 1))) count++;} catch (final IOException e) {- yacyCore.log.logInfo("hello/client: rejected contacting seed; bad (" + e.getMessage() + ")");+ Network.log.logInfo("hello/client: rejected contacting seed; bad (" + e.getMessage() + ")");}}}@@ -289,13 +294,13 @@ public final class yacyClient {return count;}- public static yacySeed querySeed(final yacySeed target, final String seedHash) {+ public static Seed querySeed(final Seed target, final String seedHash) {// prepare requestfinal String salt = crypt.randomSalt();// send requesttry {- final Map<String,ContentBody> parts = yacyNetwork.basicRequestParts(Switchboard.getSwitchboard(), target.hash, salt);+ final Map<String,ContentBody> parts = basicRequestParts(Switchboard.getSwitchboard(), target.hash, salt);parts.put("object", UTF8.StringBody("seed"));parts.put("env", UTF8.StringBody(seedHash));final byte[] content = postToFile(target, "query.html", parts, 10000);@@ -303,20 +308,20 @@ public final class yacyClient {if (result == null || result.isEmpty()) { return null; }//final Date remoteTime = yacyCore.parseUniversalDate((String) result.get(yacySeed.MYTIME)); // read remote time- return yacySeed.genRemoteSeed(result.get("response"), salt, false, target.getIP());+ return Seed.genRemoteSeed(result.get("response"), salt, false, target.getIP());} catch (final Exception e) {- yacyCore.log.logWarning("yacyClient.querySeed error:" + e.getMessage());+ Network.log.logWarning("yacyClient.querySeed error:" + e.getMessage());return null;}}- public static int queryRWICount(final yacySeed target, final String wordHash) {+ public static int queryRWICount(final Seed target, final String wordHash) {// prepare requestfinal String salt = crypt.randomSalt();// send requesttry {- final Map<String,ContentBody> parts = yacyNetwork.basicRequestParts(Switchboard.getSwitchboard(), target.hash, salt);+ final Map<String,ContentBody> parts = basicRequestParts(Switchboard.getSwitchboard(), target.hash, salt);parts.put("object", UTF8.StringBody("rwicount"));parts.put("ttl", UTF8.StringBody("0"));parts.put("env", UTF8.StringBody(wordHash));@@ -326,7 +331,7 @@ public final class yacyClient {if (result == null || result.isEmpty()) { return -1; }return Integer.parseInt(result.get("response"));} catch (final Exception e) {- yacyCore.log.logWarning("yacyClient.queryRWICount error:" + e.getMessage());+ Network.log.logWarning("yacyClient.queryRWICount error:" + e.getMessage());return -1;}}@@ -336,7 +341,7 @@ public final class yacyClient {* @param target* @return an array of two long: [0] is the count of urls, [1] is a magic*/- public static long[] queryUrlCount(final yacySeed target) {+ public static long[] queryUrlCount(final Seed target) {if (target == null) return new long[]{-1, -1};// prepare request@@ -344,7 +349,7 @@ public final class yacyClient {// send requesttry {- final Map<String,ContentBody> parts = yacyNetwork.basicRequestParts(Switchboard.getSwitchboard(), target.hash, salt);+ final Map<String,ContentBody> parts = basicRequestParts(Switchboard.getSwitchboard(), target.hash, salt);parts.put("object", UTF8.StringBody("lurlcount"));parts.put("ttl", UTF8.StringBody("0"));parts.put("env", UTF8.StringBody(""));@@ -361,17 +366,17 @@ public final class yacyClient {return new long[]{-1, -1};}} catch (final IOException e) {- if (yacyCore.log.isFine()) yacyCore.log.logFine("yacyClient.queryUrlCount error asking peer '" + target.getName() + "':" + e.toString());+ if (Network.log.isFine()) Network.log.logFine("yacyClient.queryUrlCount error asking peer '" + target.getName() + "':" + e.toString());return new long[]{-1, -1};}}- public static RSSFeed queryRemoteCrawlURLs(final yacySeedDB seedDB, final yacySeed target, final int maxCount, final long maxTime) {+ public static RSSFeed queryRemoteCrawlURLs(final SeedDB seedDB, final Seed target, final int maxCount, final long maxTime) {// returns a list ofif (target == null) { return null; }- final int targetCount = Integer.parseInt(target.get(yacySeed.RCOUNT, "0"));+ final int targetCount = Integer.parseInt(target.get(Seed.RCOUNT, "0"));if (targetCount <= 0) {- yacyCore.log.logWarning("yacyClient.queryRemoteCrawlURLs wrong peer '" + target.getName() + "' selected: not enough links available");+ Network.log.logWarning("yacyClient.queryRemoteCrawlURLs wrong peer '" + target.getName() + "' selected: not enough links available");return null;}// prepare request@@ -380,7 +385,7 @@ public final class yacyClient {// send requesttry {/* a long time-out is needed */- final Map<String,ContentBody> parts = yacyNetwork.basicRequestParts(Switchboard.getSwitchboard(), target.hash, salt);+ final Map<String,ContentBody> parts = basicRequestParts(Switchboard.getSwitchboard(), target.hash, salt);parts.put("call", UTF8.StringBody("remotecrawl"));parts.put("count", UTF8.StringBody(Integer.toString(maxCount)));parts.put("time", UTF8.StringBody(Long.toString(maxTime)));@@ -389,8 +394,8 @@ public final class yacyClient {final byte[] result = httpClient.POSTbytes(new MultiProtocolURI("http://" + target.getClusterAddress() + "/yacy/urls.xml"), target.getHexHash() + ".yacyh", parts, false);final RSSReader reader = RSSReader.parse(RSSFeed.DEFAULT_MAXSIZE, result);if (reader == null) {- yacyCore.log.logWarning("yacyClient.queryRemoteCrawlURLs failed asking peer '" + target.getName() + "': probably bad response from remote peer (1), reader == null");- target.put(yacySeed.RCOUNT, "0");+ Network.log.logWarning("yacyClient.queryRemoteCrawlURLs failed asking peer '" + target.getName() + "': probably bad response from remote peer (1), reader == null");+ target.put(Seed.RCOUNT, "0");seedDB.update(target.hash, target); // overwrite number of remote-available number to avoid that this peer is called again (until update is done by peer ping)//Log.logException(e);return null;@@ -398,24 +403,24 @@ public final class yacyClient {final RSSFeed feed = reader.getFeed();if (feed == null) {// case where the rss reader does not understand the content- yacyCore.log.logWarning("yacyClient.queryRemoteCrawlURLs failed asking peer '" + target.getName() + "': probably bad response from remote peer (2)");+ Network.log.logWarning("yacyClient.queryRemoteCrawlURLs failed asking peer '" + target.getName() + "': probably bad response from remote peer (2)");//System.out.println("***DEBUG*** rss input = " + UTF8.String(result));- target.put(yacySeed.RCOUNT, "0");+ target.put(Seed.RCOUNT, "0");seedDB.update(target.hash, target); // overwrite number of remote-available number to avoid that this peer is called again (until update is done by peer ping)//Log.logException(e);return null;}// update number of remotely available links in seed- target.put(yacySeed.RCOUNT, Integer.toString(Math.max(0, targetCount - feed.size())));+ target.put(Seed.RCOUNT, Integer.toString(Math.max(0, targetCount - feed.size())));seedDB.update(target.hash, target);return feed;} catch (final IOException e) {- yacyCore.log.logWarning("yacyClient.queryRemoteCrawlURLs error asking peer '" + target.getName() + "':" + e.toString());+ Network.log.logWarning("yacyClient.queryRemoteCrawlURLs error asking peer '" + target.getName() + "':" + e.toString());return null;}}- public static RSSFeed search(final yacySeed targetSeed, final String query, final CacheStrategy verify, final boolean global, final long timeout, final int startRecord, final int maximumRecords) throws IOException {+ public static RSSFeed search(final Seed targetSeed, final String query, final CacheStrategy verify, final boolean global, final long timeout, final int startRecord, final int maximumRecords) throws IOException {final String address = (targetSeed == null || targetSeed == Switchboard.getSwitchboard().peers.mySeed()) ? "localhost:" + Switchboard.getSwitchboard().getConfig("port", "8090") : targetSeed.getClusterAddress();final String urlBase = "http://" + address + "/yacysearch.rss";return SRURSSConnector.loadSRURSS(urlBase, query, timeout, startRecord, maximumRecords, verify, global, null);@@ -423,7 +428,7 @@ public final class yacyClient {@SuppressWarnings("unchecked")public static int search(- final yacySeed mySeed,+ final Seed mySeed,final String wordhashes,final String excludehashes,final String urlhashes,@@ -438,7 +443,7 @@ public final class yacyClient {final int maxDistance,final boolean global,final int partitions,- final yacySeed target,+ final Seed target,final Segment indexSegment,final RWIProcess containerCache,final SearchEvent.SecondarySearchSuperviser secondarySearchSuperviser,@@ -465,12 +470,12 @@ public final class yacyClient {SearchResult result;try {result = new SearchResult(- yacyNetwork.basicRequestParts(Switchboard.getSwitchboard(), target.hash, crypt.randomSalt()),+ basicRequestParts(Switchboard.getSwitchboard(), target.hash, crypt.randomSalt()),mySeed, wordhashes, excludehashes, urlhashes, prefer, filter, snippet, language,sitehash, authorhash, count, time, maxDistance, global, partitions, target.getHexHash() + ".yacyh", target.getClusterAddress(),secondarySearchSuperviser, rankingProfile, constraint);} catch (final IOException e) {- yacyCore.log.logInfo("SEARCH failed, Peer: " + target.hash + ":" + target.getName() + " (" + e.getMessage() + ")");+ Network.log.logInfo("SEARCH failed, Peer: " + target.hash + ":" + target.getName() + " (" + e.getMessage() + ")");//yacyCore.peerActions.peerDeparture(target, "search request to peer created io exception: " + e.getMessage());return -1;}@@ -501,26 +506,26 @@ public final class yacyClient {final URIMetadataRow.Components metadata = urlEntry.metadata();if (metadata == null) continue;if (blacklist.isListed(Blacklist.BLACKLIST_SEARCH, metadata.url())) {- if (yacyCore.log.isInfo()) yacyCore.log.logInfo("remote search: filtered blacklisted url " + metadata.url() + " from peer " + target.getName());+ if (Network.log.isInfo()) Network.log.logInfo("remote search: filtered blacklisted url " + metadata.url() + " from peer " + target.getName());continue; // block with backlist}final String urlRejectReason = Switchboard.getSwitchboard().crawlStacker.urlInAcceptedDomain(metadata.url());if (urlRejectReason != null) {- if (yacyCore.log.isInfo()) yacyCore.log.logInfo("remote search: rejected url '" + metadata.url() + "' (" + urlRejectReason + ") from peer " + target.getName());+ if (Network.log.isInfo()) Network.log.logInfo("remote search: rejected url '" + metadata.url() + "' (" + urlRejectReason + ") from peer " + target.getName());continue; // reject url outside of our domain}// save the url entryfinal Reference entry = urlEntry.word();if (entry == null) {- if (yacyCore.log.isWarning()) yacyCore.log.logWarning("remote search: no word attached from peer " + target.getName() + ", version " + target.getVersion());+ if (Network.log.isWarning()) Network.log.logWarning("remote search: no word attached from peer " + target.getName() + ", version " + target.getVersion());continue; // no word attached}// the search-result-url transports all the attributes of word indexesif (!Base64Order.enhancedCoder.equal(entry.urlhash(), urlEntry.hash())) {- yacyCore.log.logInfo("remote search: url-hash " + ASCII.String(urlEntry.hash()) + " does not belong to word-attached-hash " + ASCII.String(entry.urlhash()) + "; url = " + metadata.url() + " from peer " + target.getName());+ Network.log.logInfo("remote search: url-hash " + ASCII.String(urlEntry.hash()) + " does not belong to word-attached-hash " + ASCII.String(entry.urlhash()) + "; url = " + metadata.url() + " from peer " + target.getName());continue; // spammed}@@ -529,7 +534,7 @@ public final class yacyClient {indexSegment.urlMetadata().store(urlEntry);ResultURLs.stack(urlEntry, mySeed.hash.getBytes(), UTF8.getBytes(target.hash), EventOrigin.QUERIES);} catch (final IOException e) {- yacyCore.log.logWarning("could not store search result", e);+ Network.log.logWarning("could not store search result", e);continue; // db-error}@@ -566,11 +571,11 @@ public final class yacyClient {final boolean thisIsASecondarySearch = urlhashes.length() > 0;assert !thisIsASecondarySearch || secondarySearchSuperviser == null;- yacyCore.log.logInfo("remote search: peer " + target.getName() + " sent " + container[0].size() + "/" + result.joincount + " references for " + (thisIsASecondarySearch ? "a secondary search" : "joined word queries"));+ Network.log.logInfo("remote search: peer " + target.getName() + " sent " + container[0].size() + "/" + result.joincount + " references for " + (thisIsASecondarySearch ? "a secondary search" : "joined word queries"));// integrate remote top-words/topicsif (result.references != null && result.references.length > 0) {- yacyCore.log.logInfo("remote search: peer " + target.getName() + " sent " + result.references.length + " topics");+ Network.log.logInfo("remote search: peer " + target.getName() + " sent " + result.references.length + " topics");// add references twice, so they can be counted (must have at least 2 entries)synchronized (containerCache) {containerCache.addTopic(result.references);@@ -599,12 +604,12 @@ public final class yacyClient {}if (ac > 0) {secondarySearchSuperviser.commitAbstract();- yacyCore.log.logInfo("remote search: peer " + target.getName() + " sent " + ac + " index abstracts for words "+ whacc);+ Network.log.logInfo("remote search: peer " + target.getName() + " sent " + ac + " index abstracts for words "+ whacc);}}// generate statistics- if (yacyCore.log.isFine()) yacyCore.log.logFine(+ if (Network.log.isFine()) Network.log.logFine("SEARCH " + result.urlcount +" URLS FROM " + target.hash + ":" + target.getName() +", searchtime=" + result.searchtime +@@ -630,7 +635,7 @@ public final class yacyClient {public SearchResult(final Map<String,ContentBody> parts,- final yacySeed mySeed,+ final Seed mySeed,final String wordhashes,final String excludehashes,final String urlhashes,@@ -744,7 +749,7 @@ public final class yacyClient {}}- public static Map<String, String> permissionMessage(final yacySeedDB seedDB, final String targetHash) {+ public static Map<String, String> permissionMessage(final SeedDB seedDB, final String targetHash) {// ask for allowed message size and attachement size// if this replies null, the peer does not answer@@ -753,19 +758,19 @@ public final class yacyClient {// send requesttry {- final Map<String,ContentBody> parts = yacyNetwork.basicRequestParts(Switchboard.getSwitchboard(), targetHash, salt);+ final Map<String,ContentBody> parts = basicRequestParts(Switchboard.getSwitchboard(), targetHash, salt);parts.put("process", UTF8.StringBody("permission"));final byte[] content = postToFile(seedDB, targetHash, "message.html", parts, 5000);final Map<String, String> result = FileUtils.table(content);return result;} catch (final Exception e) {// most probably a network time-out exception- yacyCore.log.logWarning("yacyClient.permissionMessage error:" + e.getMessage());+ Network.log.logWarning("yacyClient.permissionMessage error:" + e.getMessage());return null;}}- public static Map<String, String> postMessage(final yacySeedDB seedDB, final String targetHash, final String subject, final byte[] message) {+ public static Map<String, String> postMessage(final SeedDB seedDB, final String targetHash, final String subject, final byte[] message) {// this post a message to the remote message board// prepare request@@ -773,7 +778,7 @@ public final class yacyClient {// send requesttry {- final Map<String,ContentBody> parts = yacyNetwork.basicRequestParts(Switchboard.getSwitchboard(), targetHash, salt);+ final Map<String,ContentBody> parts = basicRequestParts(Switchboard.getSwitchboard(), targetHash, salt);parts.put("process", UTF8.StringBody("post"));parts.put("myseed", UTF8.StringBody(seedDB.mySeed().genSeedStr(salt)));parts.put("subject", UTF8.StringBody(subject));@@ -782,12 +787,12 @@ public final class yacyClient {final Map<String, String> result = FileUtils.table(content);return result;} catch (final Exception e) {- yacyCore.log.logWarning("yacyClient.postMessage error:" + e.getMessage());+ Network.log.logWarning("yacyClient.postMessage error:" + e.getMessage());return null;}}- public static Map<String, String> crawlReceipt(final yacySeed mySeed, final yacySeed target, final String process, final String result, final String reason, final URIMetadataRow entry, final String wordhashes) {+ public static Map<String, String> crawlReceipt(final Seed mySeed, final Seed target, final String process, final String result, final String reason, final URIMetadataRow entry, final String wordhashes) {assert (target != null);assert (mySeed != null);assert (mySeed != target);@@ -822,7 +827,7 @@ public final class yacyClient {// send requesttry {// prepare request- final Map<String,ContentBody> parts = yacyNetwork.basicRequestParts(Switchboard.getSwitchboard(), target.hash, salt);+ final Map<String,ContentBody> parts = basicRequestParts(Switchboard.getSwitchboard(), target.hash, salt);parts.put("process", UTF8.StringBody(process));parts.put("urlhash", UTF8.StringBody(((entry == null) ? "" : ASCII.String(entry.hash()))));parts.put("result", UTF8.StringBody(result));@@ -836,7 +841,7 @@ public final class yacyClient {return FileUtils.table(content);} catch (final Exception e) {// most probably a network time-out exception- yacyCore.log.logWarning("yacyClient.crawlReceipt error:" + e.getMessage());+ Network.log.logWarning("yacyClient.crawlReceipt error:" + e.getMessage());return null;}}@@ -852,7 +857,7 @@ public final class yacyClient {* @return*/public static String transferIndex(- final yacySeed targetSeed,+ final Seed targetSeed,final ReferenceContainerCache<WordReference> indexes,final SortedMap<byte[], URIMetadataRow> urlCache,final boolean gzipBody,@@ -866,7 +871,7 @@ public final class yacyClient {while (eenum.hasNext()) {entry = eenum.next();if (urlCache.get(entry.urlhash()) == null) {- if (yacyCore.log.isFine()) yacyCore.log.logFine("DEBUG transferIndex: to-send url hash '" + ASCII.String(entry.urlhash()) + "' is not contained in urlCache");+ if (Network.log.isFine()) Network.log.logFine("DEBUG transferIndex: to-send url hash '" + ASCII.String(entry.urlhash()) + "' is not contained in urlCache");}}}@@ -892,7 +897,7 @@ public final class yacyClient {if (uhss == null) {return "no unknownURL tag in response";}- yacyChannel.channels(yacyChannel.DHTSEND).addMessage(new RSSMessage("Sent " + indexes.size() + " RWIs to " + targetSeed.getName(), "", targetSeed.hash));+ EventChannel.channels(EventChannel.DHTSEND).addMessage(new RSSMessage("Sent " + indexes.size() + " RWIs to " + targetSeed.getName(), "", targetSeed.hash));uhss = uhss.trim();if (uhss.length() == 0 || uhss.equals(",")) { return null; } // all url's known, we are ready here@@ -905,7 +910,7 @@ public final class yacyClient {for (int i = 0; i < uhs.length; i++) {urls[i] = urlCache.get(ASCII.getBytes(uhs[i]));if (urls[i] == null) {- if (yacyCore.log.isFine()) yacyCore.log.logFine("DEBUG transferIndex: requested url hash '" + uhs[i] + "', unknownURL='" + uhss + "'");+ if (Network.log.isFine()) Network.log.logFine("DEBUG transferIndex: requested url hash '" + uhs[i] + "', unknownURL='" + uhss + "'");}}@@ -923,18 +928,18 @@ public final class yacyClient {if (!result.equals("ok")) {return result;}- yacyChannel.channels(yacyChannel.DHTSEND).addMessage(new RSSMessage("Sent " + uhs.length + " URLs to peer " + targetSeed.getName(), "", targetSeed.hash));+ EventChannel.channels(EventChannel.DHTSEND).addMessage(new RSSMessage("Sent " + uhs.length + " URLs to peer " + targetSeed.getName(), "", targetSeed.hash));return null;}private static Map<String, String> transferRWI(- final yacySeed targetSeed,+ final Seed targetSeed,final ReferenceContainerCache<WordReference> indexes,boolean gzipBody,final int timeout) {final String address = targetSeed.getPublicAddress();- if (address == null) { yacyCore.log.logWarning("no address for transferRWI"); return null; }+ if (address == null) { Network.log.logWarning("no address for transferRWI"); return null; }// prepare post valuesfinal String salt = crypt.randomSalt();@@ -967,7 +972,7 @@ public final class yacyClient {return result;}try {- final Map<String,ContentBody> parts = yacyNetwork.basicRequestParts(Switchboard.getSwitchboard(), targetSeed.hash, salt);+ final Map<String,ContentBody> parts = basicRequestParts(Switchboard.getSwitchboard(), targetSeed.hash, salt);parts.put("wordc", UTF8.StringBody(Integer.toString(indexes.size())));parts.put("entryc", UTF8.StringBody(Integer.toString(indexcount)));parts.put("indexes", UTF8.StringBody(entrypost.toString()));@@ -982,19 +987,19 @@ public final class yacyClient {result.put("indexPayloadSize", Integer.toString(entrypost.length()));return result;} catch (final Exception e) {- yacyCore.log.logInfo("yacyClient.transferRWI to " + address + " error: " + e.getMessage());+ Network.log.logInfo("yacyClient.transferRWI to " + address + " error: " + e.getMessage());return null;}}- private static Map<String, String> transferURL(final yacySeed targetSeed, final URIMetadataRow[] urls, boolean gzipBody, final int timeout) {+ private static Map<String, String> transferURL(final Seed targetSeed, final URIMetadataRow[] urls, boolean gzipBody, final int timeout) {// this post a message to the remote message boardfinal String address = targetSeed.getPublicAddress();if (address == null) { return null; }// prepare post valuesfinal String salt = crypt.randomSalt();- final Map<String,ContentBody> parts = yacyNetwork.basicRequestParts(Switchboard.getSwitchboard(), targetSeed.hash, salt);+ final Map<String,ContentBody> parts = basicRequestParts(Switchboard.getSwitchboard(), targetSeed.hash, salt);// enabling gzip compression for post request bodyif (gzipBody && (targetSeed.getVersion() < yacyVersion.YACY_SUPPORTS_GZIP_POST_REQUESTS_CHUNKED)) {@@ -1027,12 +1032,12 @@ public final class yacyClient {result.put("urlPayloadSize", Integer.toString(urlPayloadSize));return result;} catch (final Exception e) {- yacyCore.log.logWarning("yacyClient.transferURL to " + address + " error: " + e.getMessage());+ Network.log.logWarning("yacyClient.transferURL to " + address + " error: " + e.getMessage());return null;}}- public static Map<String, String> getProfile(final yacySeed targetSeed) {+ public static Map<String, String> getProfile(final Seed targetSeed) {// ReferenceContainerCache<HostReference> ref = loadIDXHosts(targetSeed);// this post a message to the remote message board@@ -1041,18 +1046,18 @@ public final class yacyClient {String address = targetSeed.getClusterAddress();if (address == null) { address = "localhost:8090"; }try {- final Map<String,ContentBody> parts = yacyNetwork.basicRequestParts(Switchboard.getSwitchboard(), targetSeed.hash, salt);+ final Map<String,ContentBody> parts = basicRequestParts(Switchboard.getSwitchboard(), targetSeed.hash, salt);// final byte[] content = HTTPConnector.getConnector(MultiProtocolURI.yacybotUserAgent).post(new MultiProtocolURI("http://" + address + "/yacy/profile.html"), 5000, targetSeed.getHexHash() + ".yacyh", parts);final HTTPClient httpclient = new HTTPClient(ClientIdentification.getUserAgent(), 5000);final byte[] content = httpclient.POSTbytes(new MultiProtocolURI("http://" + address + "/yacy/profile.html"), targetSeed.getHexHash() + ".yacyh", parts, false);return FileUtils.table(content);} catch (final Exception e) {- yacyCore.log.logWarning("yacyClient.getProfile error:" + e.getMessage());+ Network.log.logWarning("yacyClient.getProfile error:" + e.getMessage());return null;}}- public static ReferenceContainerCache<HostReference> loadIDXHosts(final yacySeed target) {+ public static ReferenceContainerCache<HostReference> loadIDXHosts(final Seed target) {final ReferenceContainerCache<HostReference> index = new ReferenceContainerCache<HostReference>(WebStructureGraph.hostReferenceFactory, Base64Order.enhancedCoder, 6);// check if the host supports this protocolif (target.getRevision() < migration.IDX_HOST) {@@ -1065,11 +1070,11 @@ public final class yacyClient {// send requesttry {- final Map<String,ContentBody> parts = yacyNetwork.basicRequestParts(Switchboard.getSwitchboard(), target.hash, salt);+ final Map<String,ContentBody> parts = basicRequestParts(Switchboard.getSwitchboard(), target.hash, salt);parts.put("object", UTF8.StringBody("host"));final byte[] content = postToFile(target, "idx.json", parts, 30000);if (content == null || content.length == 0) {- yacyCore.log.logWarning("yacyClient.loadIDXHosts error: empty result");+ Network.log.logWarning("yacyClient.loadIDXHosts error: empty result");return null;}final JSONObject json = new JSONObject(new JSONTokener(new InputStreamReader(new ByteArrayInputStream(content))));@@ -1106,7 +1111,7 @@ public final class yacyClient {}return index;} catch (final Exception e) {- yacyCore.log.logWarning("yacyClient.loadIDXHosts error:" + e.getMessage());+ Network.log.logWarning("yacyClient.loadIDXHosts error:" + e.getMessage());return index;}}@@ -1141,7 +1146,7 @@ public final class yacyClient {SearchResult result;try {result = new SearchResult(- yacyNetwork.basicRequestParts((String) null, (String) null, "freeworld"),+ basicRequestParts((String) null, (String) null, "freeworld"),null, // sb.peers.mySeed(),ASCII.String(wordhashe),"", // excludehashes,@@ -1209,4 +1214,77 @@ public final class yacyClient {}}+ public static final boolean authentifyRequest(final serverObjects post, final serverSwitch env) {+ if (post == null || env == null) return false;++ // identify network+ final String unitName = post.get(SwitchboardConstants.NETWORK_NAME, Seed.DFLT_NETWORK_UNIT); // the network unit+ if (!unitName.equals(env.getConfig(SwitchboardConstants.NETWORK_NAME, Seed.DFLT_NETWORK_UNIT))) {+ return false;+ }++ // check authentication method+ final String authenticationControl = env.getConfig("network.unit.protocol.control", "uncontrolled");+ if (authenticationControl.equals("uncontrolled")) return true;+ final String authenticationMethod = env.getConfig("network.unit.protocol.request.authentication.method", "");+ if (authenticationMethod.length() == 0) {+ return false;+ }+ if (authenticationMethod.equals("salted-magic-sim")) {+ // authorize the peer using the md5-magic+ final String salt = post.get("key", "");+ final String iam = post.get("iam", "");+ final String magic = env.getConfig("network.unit.protocol.request.authentication.essentials", "");+ final String md5 = Digest.encodeMD5Hex(salt + iam + magic);+ return post.get("magicmd5", "").equals(md5);+ }++ // unknown authentication method+ return false;+ }++ public static final LinkedHashMap<String,ContentBody> basicRequestParts(final Switchboard sb, final String targetHash, final String salt) {+ // put in all the essentials for routing and network authentication+ // generate a session key+ final LinkedHashMap<String,ContentBody> parts = basicRequestParts(sb.peers.mySeed().hash, targetHash, Switchboard.getSwitchboard().getConfig(SwitchboardConstants.NETWORK_NAME, Seed.DFLT_NETWORK_UNIT));+ parts.put("key", UTF8.StringBody(salt));++ // authentication essentials+ final String authenticationControl = sb.getConfig("network.unit.protocol.control", "uncontrolled");+ final String authenticationMethod = sb.getConfig("network.unit.protocol.request.authentication.method", "");+ if ((authenticationControl.equals("controlled")) && (authenticationMethod.length() > 0)) {+ if (authenticationMethod.equals("salted-magic-sim")) {+ // generate an authentication essential using the salt, the iam-hash and the network magic+ final String magic = sb.getConfig("network.unit.protocol.request.authentication.essentials", "");+ final String md5 = Digest.encodeMD5Hex(salt + sb.peers.mySeed().hash + magic);+ parts.put("magicmd5", UTF8.StringBody(md5));+ }+ }++ return parts;+ }++ public static final LinkedHashMap<String,ContentBody> basicRequestParts(final String myHash, final String targetHash, final String networkName) {+ // put in all the essentials for routing and network authentication+ // generate a session key+ final LinkedHashMap<String,ContentBody> parts = new LinkedHashMap<String,ContentBody>();++ // just standard identification essentials+ if (myHash != null) {+ parts.put("iam", UTF8.StringBody(myHash));+ if (targetHash != null) parts.put("youare", UTF8.StringBody(targetHash));++ // time information for synchronization+ // use our own formatter to prevent concurrency locks with other processes+ final GenericFormatter my_SHORT_SECOND_FORMATTER = new GenericFormatter(GenericFormatter.FORMAT_SHORT_SECOND, GenericFormatter.time_second);+ parts.put("mytime", UTF8.StringBody(my_SHORT_SECOND_FORMATTER.format()));+ parts.put("myUTC", UTF8.StringBody(Long.toString(System.currentTimeMillis())));++ // network identification+ parts.put(SwitchboardConstants.NETWORK_NAME, UTF8.StringBody(networkName));+ }++ return parts;+ }+}diff --git a/source/net/yacy/peers/yacySearch.java b/source/net/yacy/peers/RemoteSearch.javasimilarity index 83%rename from source/net/yacy/peers/yacySearch.javarename to source/net/yacy/peers/RemoteSearch.javaindex d0c69f932..3ed52d57d 100644--- a/source/net/yacy/peers/yacySearch.java+++ b/source/net/yacy/peers/RemoteSearch.java@@ -41,7 +41,7 @@ import net.yacy.search.query.SearchEvent;import net.yacy.search.ranking.RankingProfile;-public class yacySearch extends Thread {+public class RemoteSearch extends Thread {private static final ThreadGroup ysThreadGroup = new ThreadGroup("yacySearchThreadGroup");@@ -52,7 +52,7 @@ public class yacySearch extends Thread {final private RWIProcess containerCache;final private SearchEvent.SecondarySearchSuperviser secondarySearchSuperviser;final private Blacklist blacklist;- final private yacySeed targetPeer;+ final private Seed targetPeer;private int urls;private final int count, maxDistance;private final long time;@@ -60,9 +60,9 @@ public class yacySearch extends Thread {final private Pattern prefer, filter, snippet;final private String language;final private Bitfield constraint;- final private yacySeedDB peers;+ final private SeedDB peers;- public yacySearch(+ public RemoteSearch(final String wordhashes, final String excludehashes,final String urlhashes,final Pattern prefer,@@ -72,9 +72,9 @@ public class yacySearch extends Thread {final String sitehash, final String authorhash,final int count, final long time, final int maxDistance,final boolean global, final int partitions,- final yacySeed targetPeer,+ final Seed targetPeer,final Segment indexSegment,- final yacySeedDB peers,+ final SeedDB peers,final RWIProcess containerCache,final SearchEvent.SecondarySearchSuperviser secondarySearchSuperviser,final Blacklist blacklist,@@ -111,7 +111,7 @@ public class yacySearch extends Thread {@Overridepublic void run() {try {- this.urls = yacyClient.search(+ this.urls = Protocol.search(peers.mySeed(),wordhashes, excludehashes, urlhashes,prefer, filter, snippet,@@ -121,11 +121,11 @@ public class yacySearch extends Thread {blacklist, rankingProfile, constraint);if (urls >= 0) {// urls is an array of url hashes. this is only used for log output- if (urlhashes != null && urlhashes.length() > 0) yacyCore.log.logInfo("SECONDARY REMOTE SEARCH - remote peer " + targetPeer.hash + ":" + targetPeer.getName() + " contributed " + this.urls + " links for word hash " + wordhashes);+ if (urlhashes != null && urlhashes.length() > 0) Network.log.logInfo("SECONDARY REMOTE SEARCH - remote peer " + targetPeer.hash + ":" + targetPeer.getName() + " contributed " + this.urls + " links for word hash " + wordhashes);peers.mySeed().incRI(urls);peers.mySeed().incRU(urls);} else {- yacyCore.log.logInfo("REMOTE SEARCH - no answer from remote peer " + targetPeer.hash + ":" + targetPeer.getName());+ Network.log.logInfo("REMOTE SEARCH - no answer from remote peer " + targetPeer.hash + ":" + targetPeer.getName());}} catch (final Exception e) {Log.logException(e);@@ -149,11 +149,11 @@ public class yacySearch extends Thread {return this.count;}- public yacySeed target() {+ public Seed target() {return targetPeer;}- public static yacySearch[] primaryRemoteSearches(+ public static RemoteSearch[] primaryRemoteSearches(final String wordhashes, final String excludehashes,final Pattern prefer, final Pattern filter, final Pattern snippet,final String language,@@ -161,7 +161,7 @@ public class yacySearch extends Thread {final String authorhash,final int count, long time, final int maxDist,final Segment indexSegment,- final yacySeedDB peers,+ final SeedDB peers,final RWIProcess containerCache,final SearchEvent.SecondarySearchSuperviser secondarySearchSuperviser,final Blacklist blacklist,@@ -176,7 +176,7 @@ public class yacySearch extends Thread {// prepare seed targets and threadsassert language != null;assert wordhashes.length() >= 12 : "wordhashes = " + wordhashes;- final yacySeed[] targetPeers =+ final Seed[] targetPeers =(clusterselection == null) ?PeerSelection.selectSearchTargets(peers,@@ -185,14 +185,14 @@ public class yacySearch extends Thread {burstRobinsonPercent,burstMultiwordPercent): PeerSelection.selectClusterPeers(peers, clusterselection);- if (targetPeers == null) return new yacySearch[0];+ if (targetPeers == null) return new RemoteSearch[0];int targets = targetPeers.length;- if (targets == 0) return new yacySearch[0];- final yacySearch[] searchThreads = new yacySearch[targets];+ if (targets == 0) return new RemoteSearch[0];+ final RemoteSearch[] searchThreads = new RemoteSearch[targets];for (int i = 0; i < targets; i++) {if (targetPeers[i] == null || targetPeers[i].hash == null) continue;try {- searchThreads[i] = new yacySearch(+ searchThreads[i] = new RemoteSearch(wordhashes, excludehashes, "", prefer, filter, snippet,language, sitehash, authorhash,count, time, maxDist, true, targets, targetPeers[i],@@ -206,11 +206,11 @@ public class yacySearch extends Thread {return searchThreads;}- public static yacySearch secondaryRemoteSearch(+ public static RemoteSearch secondaryRemoteSearch(final String wordhashes, final String urlhashes,final long time,final Segment indexSegment,- final yacySeedDB peers,+ final SeedDB peers,final RWIProcess containerCache,final String targethash, final Blacklist blacklist,final RankingProfile rankingProfile,@@ -223,28 +223,28 @@ public class yacySearch extends Thread {assert urlhashes.length() > 0;// prepare seed targets and threads- final yacySeed targetPeer = peers.getConnected(targethash);+ final Seed targetPeer = peers.getConnected(targethash);if (targetPeer == null || targetPeer.hash == null) return null;if (clusterselection != null) targetPeer.setAlternativeAddress(clusterselection.get(ASCII.getBytes(targetPeer.hash)));- final yacySearch searchThread = new yacySearch(+ final RemoteSearch searchThread = new RemoteSearch(wordhashes, "", urlhashes, QueryParams.matchnothing_pattern, QueryParams.catchall_pattern, QueryParams.catchall_pattern, "", "", "", 20, time, 9999, true, 0, targetPeer,indexSegment, peers, containerCache, null, blacklist, rankingProfile, constraint);searchThread.start();return searchThread;}- public static int remainingWaiting(final yacySearch[] searchThreads) {+ public static int remainingWaiting(final RemoteSearch[] searchThreads) {if (searchThreads == null) return 0;int alive = 0;- for (final yacySearch searchThread : searchThreads) {+ for (final RemoteSearch searchThread : searchThreads) {if (searchThread.isAlive()) alive++;}return alive;}- public static int collectedLinks(final yacySearch[] searchThreads) {+ public static int collectedLinks(final RemoteSearch[] searchThreads) {int links = 0;- for (final yacySearch searchThread : searchThreads) {+ for (final RemoteSearch searchThread : searchThreads) {if (!(searchThread.isAlive()) && searchThread.urls > 0) {links += searchThread.urls;}@@ -252,8 +252,8 @@ public class yacySearch extends Thread {return links;}- public static void interruptAlive(final yacySearch[] searchThreads) {- for (final yacySearch searchThread : searchThreads) {+ public static void interruptAlive(final RemoteSearch[] searchThreads) {+ for (final RemoteSearch searchThread : searchThreads) {if (searchThread.isAlive()) searchThread.interrupt();}}diff --git a/source/net/yacy/peers/yacySeed.java b/source/net/yacy/peers/Seed.javasimilarity index 79%rename from source/net/yacy/peers/yacySeed.javarename to source/net/yacy/peers/Seed.javaindex d5210b574..a5426f9e4 100644--- a/source/net/yacy/peers/yacySeed.java+++ b/source/net/yacy/peers/Seed.java@@ -75,7 +75,7 @@ import net.yacy.search.Switchboard;import de.anomic.tools.bitfield;import de.anomic.tools.crypt;-public class yacySeed implements Cloneable, Comparable<yacySeed>, Comparator<yacySeed> {+public class Seed implements Cloneable, Comparable<Seed>, Comparator<Seed> {public static String ANON_PREFIX = "_anon";@@ -178,63 +178,63 @@ public class yacySeed implements Cloneable, Comparable<yacySeed>, Comparator<yacprivate String alternativeIP = null;private long birthdate; // keep this value in ram since it is often used and may cause lockings in concurrent situations.- public yacySeed(final String theHash, final ConcurrentMap<String, String> theDna) {+ public Seed(final String theHash, final ConcurrentMap<String, String> theDna) {// create a seed with a pre-defined hash mapassert theHash != null;this.hash = theHash;this.dna = theDna;- final String flags = this.dna.get(yacySeed.FLAGS);- if ((flags == null) || (flags.length() != 4)) { this.dna.put(yacySeed.FLAGS, yacySeed.FLAGSZERO); }- this.dna.put(yacySeed.NAME, checkPeerName(get(yacySeed.NAME, "∅")));+ final String flags = this.dna.get(Seed.FLAGS);+ if ((flags == null) || (flags.length() != 4)) { this.dna.put(Seed.FLAGS, Seed.FLAGSZERO); }+ this.dna.put(Seed.NAME, checkPeerName(get(Seed.NAME, "∅")));this.birthdate = -1; // this means 'not yet parsed', parse that later when it is used}- private yacySeed(final String theHash) {+ private Seed(final String theHash) {this.dna = new ConcurrentHashMap<String, String>();// settings that can only be computed by originating peer:// at first startup -this.hash = theHash; // the hash key of the peer - very important. should be static somehow, even after restart- this.dna.put(yacySeed.NAME, defaultPeerName());+ this.dna.put(Seed.NAME, defaultPeerName());// later during operation -- this.dna.put(yacySeed.ISPEED, yacySeed.ZERO);- this.dna.put(yacySeed.RSPEED, yacySeed.ZERO);- this.dna.put(yacySeed.UPTIME, yacySeed.ZERO);- this.dna.put(yacySeed.LCOUNT, yacySeed.ZERO);- this.dna.put(yacySeed.NCOUNT, yacySeed.ZERO);- this.dna.put(yacySeed.RCOUNT, yacySeed.ZERO);- this.dna.put(yacySeed.ICOUNT, yacySeed.ZERO);- this.dna.put(yacySeed.SCOUNT, yacySeed.ZERO);- this.dna.put(yacySeed.CCOUNT, yacySeed.ZERO);- this.dna.put(yacySeed.VERSION, yacySeed.ZERO);+ this.dna.put(Seed.ISPEED, Seed.ZERO);+ this.dna.put(Seed.RSPEED, Seed.ZERO);+ this.dna.put(Seed.UPTIME, Seed.ZERO);+ this.dna.put(Seed.LCOUNT, Seed.ZERO);+ this.dna.put(Seed.NCOUNT, Seed.ZERO);+ this.dna.put(Seed.RCOUNT, Seed.ZERO);+ this.dna.put(Seed.ICOUNT, Seed.ZERO);+ this.dna.put(Seed.SCOUNT, Seed.ZERO);+ this.dna.put(Seed.CCOUNT, Seed.ZERO);+ this.dna.put(Seed.VERSION, Seed.ZERO);// settings that is created during the 'hello' phase - in first contact- this.dna.put(yacySeed.IP, ""); // 123.234.345.456- this.dna.put(yacySeed.PORT, "∅");- this.dna.put(yacySeed.IPTYPE, "∅");+ this.dna.put(Seed.IP, ""); // 123.234.345.456+ this.dna.put(Seed.PORT, "∅");+ this.dna.put(Seed.IPTYPE, "∅");// settings that can only be computed by visiting peer- this.dna.put(yacySeed.USPEED, yacySeed.ZERO); // the computated uplink speed of the peer+ this.dna.put(Seed.USPEED, Seed.ZERO); // the computated uplink speed of the peer// settings that are needed to organize the seed round-trip- this.dna.put(yacySeed.FLAGS, yacySeed.FLAGSZERO);+ this.dna.put(Seed.FLAGS, Seed.FLAGSZERO);setFlagDirectConnect(false);setFlagAcceptRemoteCrawl(true);setFlagAcceptRemoteIndex(true);setUnusedFlags();// index transfer- this.dna.put(yacySeed.INDEX_OUT, yacySeed.ZERO); // send index- this.dna.put(yacySeed.INDEX_IN, yacySeed.ZERO); // received index- this.dna.put(yacySeed.URL_OUT, yacySeed.ZERO); // send URLs- this.dna.put(yacySeed.URL_IN, yacySeed.ZERO); // received URLs+ this.dna.put(Seed.INDEX_OUT, Seed.ZERO); // send index+ this.dna.put(Seed.INDEX_IN, Seed.ZERO); // received index+ this.dna.put(Seed.URL_OUT, Seed.ZERO); // send URLs+ this.dna.put(Seed.URL_IN, Seed.ZERO); // received URLs// default first filling- this.dna.put(yacySeed.BDATE, GenericFormatter.SHORT_SECOND_FORMATTER.format());- this.dna.put(yacySeed.LASTSEEN, this.dna.get(yacySeed.BDATE)); // just as initial setting- this.dna.put(yacySeed.UTC, GenericFormatter.UTCDiffString());- this.dna.put(yacySeed.PEERTYPE, yacySeed.PEERTYPE_VIRGIN); // virgin/junior/senior/principal+ this.dna.put(Seed.BDATE, GenericFormatter.SHORT_SECOND_FORMATTER.format());+ this.dna.put(Seed.LASTSEEN, this.dna.get(Seed.BDATE)); // just as initial setting+ this.dna.put(Seed.UTC, GenericFormatter.UTCDiffString());+ this.dna.put(Seed.PEERTYPE, Seed.PEERTYPE_VIRGIN); // virgin/junior/senior/principalthis.birthdate = System.currentTimeMillis();}@@ -257,7 +257,7 @@ public class yacySeed implements Cloneable, Comparable<yacySeed>, Comparator<yac* @return*/private static String defaultPeerName() {- return ANON_PREFIX + OS.infoKey() + "-" + (System.currentTimeMillis() % 77777777L) + "-" + yacyCore.speedKey;+ return ANON_PREFIX + OS.infoKey() + "-" + (System.currentTimeMillis() % 77777777L) + "-" + Network.speedKey;}/**@@ -285,34 +285,34 @@ public class yacySeed implements Cloneable, Comparable<yacySeed>, Comparator<yac* @return the IP or null*/public final String getIP() {- final String ip = get(yacySeed.IP, "127.0.0.1");+ final String ip = get(Seed.IP, "127.0.0.1");return (ip == null || ip.length() == 0) ? "127.0.0.1" : ip;}/*** try to get the peertype<br>* @return the peertype or null*/- public final String getPeerType() { return get(yacySeed.PEERTYPE, ""); }+ public final String getPeerType() { return get(Seed.PEERTYPE, ""); }/*** try to get the peertype<br>* @return the peertype or "virgin"*/- public final String orVirgin() { return get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_VIRGIN); }+ public final String orVirgin() { return get(Seed.PEERTYPE, Seed.PEERTYPE_VIRGIN); }/*** try to get the peertype<br>* @return the peertype or "junior"*/- public final String orJunior() { return get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_JUNIOR); }+ public final String orJunior() { return get(Seed.PEERTYPE, Seed.PEERTYPE_JUNIOR); }/*** try to get the peertype<br>* @return the peertype or "senior"*/- public final String orSenior() { return get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_SENIOR); }+ public final String orSenior() { return get(Seed.PEERTYPE, Seed.PEERTYPE_SENIOR); }/*** try to get the peertype<br>* @return the peertype or "principal"*/- public final String orPrincipal() { return get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_PRINCIPAL); }+ public final String orPrincipal() { return get(Seed.PEERTYPE, Seed.PEERTYPE_PRINCIPAL); }/*** Get a value from the peer's DNA (its set of peer defining values, e.g. IP, name, version, ...)@@ -351,12 +351,12 @@ public class yacySeed implements Cloneable, Comparable<yacySeed>, Comparator<yac} else return dflt;}- public final void setIP(final String ip) { this.dna.put(yacySeed.IP, ip); }- public final void setPort(final String port) { this.dna.put(yacySeed.PORT, port); }- public final void setType(final String type) { this.dna.put(yacySeed.PEERTYPE, type); }- public final void setJunior() { this.dna.put(yacySeed.PEERTYPE, yacySeed.PEERTYPE_JUNIOR); }- public final void setSenior() { this.dna.put(yacySeed.PEERTYPE, yacySeed.PEERTYPE_SENIOR); }- public final void setPrincipal() { this.dna.put(yacySeed.PEERTYPE, yacySeed.PEERTYPE_PRINCIPAL); }+ public final void setIP(final String ip) { this.dna.put(Seed.IP, ip); }+ public final void setPort(final String port) { this.dna.put(Seed.PORT, port); }+ public final void setType(final String type) { this.dna.put(Seed.PEERTYPE, type); }+ public final void setJunior() { this.dna.put(Seed.PEERTYPE, Seed.PEERTYPE_JUNIOR); }+ public final void setSenior() { this.dna.put(Seed.PEERTYPE, Seed.PEERTYPE_SENIOR); }+ public final void setPrincipal() { this.dna.put(Seed.PEERTYPE, Seed.PEERTYPE_PRINCIPAL); }public final void put(final String key, final String value) {synchronized (this.dna) {@@ -371,12 +371,12 @@ public class yacySeed implements Cloneable, Comparable<yacySeed>, Comparator<yacpublic final void setName(final String name) {synchronized (this.dna) {- this.dna.put(yacySeed.NAME, checkPeerName(name));+ this.dna.put(Seed.NAME, checkPeerName(name));}}public final String getName() {- return checkPeerName(get(yacySeed.NAME, "∅"));+ return checkPeerName(get(Seed.NAME, "∅"));}public final String getHexHash() {@@ -384,34 +384,34 @@ public class yacySeed implements Cloneable, Comparable<yacySeed>, Comparator<yac}public final void incSI(final int count) {- String v = this.dna.get(yacySeed.INDEX_OUT);- if (v == null) { v = yacySeed.ZERO; }- this.dna.put(yacySeed.INDEX_OUT, Long.toString(Long.parseLong(v) + count));+ String v = this.dna.get(Seed.INDEX_OUT);+ if (v == null) { v = Seed.ZERO; }+ this.dna.put(Seed.INDEX_OUT, Long.toString(Long.parseLong(v) + count));}public final void incRI(final int count) {- String v = this.dna.get(yacySeed.INDEX_IN);- if (v == null) { v = yacySeed.ZERO; }- this.dna.put(yacySeed.INDEX_IN, Long.toString(Long.parseLong(v) + count));+ String v = this.dna.get(Seed.INDEX_IN);+ if (v == null) { v = Seed.ZERO; }+ this.dna.put(Seed.INDEX_IN, Long.toString(Long.parseLong(v) + count));}public final void incSU(final int count) {- String v = this.dna.get(yacySeed.URL_OUT);- if (v == null) { v = yacySeed.ZERO; }- this.dna.put(yacySeed.URL_OUT, Long.toString(Long.parseLong(v) + count));+ String v = this.dna.get(Seed.URL_OUT);+ if (v == null) { v = Seed.ZERO; }+ this.dna.put(Seed.URL_OUT, Long.toString(Long.parseLong(v) + count));}public final void incRU(final int count) {- String v = this.dna.get(yacySeed.URL_IN);- if (v == null) { v = yacySeed.ZERO; }- this.dna.put(yacySeed.URL_IN, Long.toString(Long.parseLong(v) + count));+ String v = this.dna.get(Seed.URL_IN);+ if (v == null) { v = Seed.ZERO; }+ this.dna.put(Seed.URL_IN, Long.toString(Long.parseLong(v) + count));}public final void resetCounters(){- this.dna.put(yacySeed.INDEX_OUT, yacySeed.ZERO);- this.dna.put(yacySeed.INDEX_IN, yacySeed.ZERO);- this.dna.put(yacySeed.URL_OUT, yacySeed.ZERO);- this.dna.put(yacySeed.URL_IN, yacySeed.ZERO);+ this.dna.put(Seed.INDEX_OUT, Seed.ZERO);+ this.dna.put(Seed.INDEX_IN, Seed.ZERO);+ this.dna.put(Seed.URL_OUT, Seed.ZERO);+ this.dna.put(Seed.URL_IN, Seed.ZERO);}/**@@ -453,7 +453,7 @@ public class yacySeed implements Cloneable, Comparable<yacySeed>, Comparator<yac*/public final float getVersion() {try {- return Float.parseFloat(get(yacySeed.VERSION, yacySeed.ZERO));+ return Float.parseFloat(get(Seed.VERSION, Seed.ZERO));} catch (final NumberFormatException e) {return 0;}@@ -464,7 +464,7 @@ public class yacySeed implements Cloneable, Comparable<yacySeed>, Comparator<yac* @return*/public final int getRevision() {- return yacyVersion.revision(get(yacySeed.VERSION, yacySeed.ZERO));+ return yacyVersion.revision(get(Seed.VERSION, Seed.ZERO));}/**@@ -475,7 +475,7 @@ public class yacySeed implements Cloneable, Comparable<yacySeed>, Comparator<yacString ip = getIP();if (ip == null || ip.length() < 8 || ip.length() > 60) ip = "127.0.0.1";- final String port = this.dna.get(yacySeed.PORT);+ final String port = this.dna.get(Seed.PORT);if (port == null || port.length() < 2 || port.length() > 5) return null;final StringBuilder sb = new StringBuilder(ip.length() + port.length() + 1);@@ -495,7 +495,7 @@ public class yacySeed implements Cloneable, Comparable<yacySeed>, Comparator<yacpublic final String getClusterAddress() {if (this.alternativeIP == null) return getPublicAddress();- final String port = this.dna.get(yacySeed.PORT);+ final String port = this.dna.get(Seed.PORT);if ((port == null) || (port.length() < 2)) return null;return this.alternativeIP + ":" + port;@@ -510,7 +510,7 @@ public class yacySeed implements Cloneable, Comparable<yacySeed>, Comparator<yac/** @return the portnumber of this seed or <code>-1</code> if not present */public final int getPort() {- final String port = this.dna.get(yacySeed.PORT);+ final String port = this.dna.get(Seed.PORT);if (port == null) return -1;/*if (port.length() < 2) return -1; It is possible to use port 0-9*/return Integer.parseInt(port);@@ -524,7 +524,7 @@ public class yacySeed implements Cloneable, Comparable<yacySeed>, Comparator<yacfinal GenericFormatter my_SHORT_SECOND_FORMATTER = new GenericFormatter(GenericFormatter.FORMAT_SHORT_SECOND, GenericFormatter.time_second); // use our own formatter to prevent concurrency locks with other processesfinal String ls = my_SHORT_SECOND_FORMATTER.format(new Date(System.currentTimeMillis() /*- DateFormatter.UTCDiff()*/));//System.out.println("SETTING LAST-SEEN of " + this.getName() + " to " + ls);- this.dna.put(yacySeed.LASTSEEN, ls );+ this.dna.put(Seed.LASTSEEN, ls );}/**@@ -533,7 +533,7 @@ public class yacySeed implements Cloneable, Comparable<yacySeed>, Comparator<yacpublic final long getLastSeenUTC() {try {final GenericFormatter my_SHORT_SECOND_FORMATTER = new GenericFormatter(GenericFormatter.FORMAT_SHORT_SECOND, GenericFormatter.time_second); // use our own formatter to prevent concurrency locks with other processes- final long t = my_SHORT_SECOND_FORMATTER.parse(get(yacySeed.LASTSEEN, "20040101000000")).getTime();+ final long t = my_SHORT_SECOND_FORMATTER.parse(get(Seed.LASTSEEN, "20040101000000")).getTime();// getTime creates a UTC time number. But in this case java thinks, that the given// time string is a local time, which has a local UTC offset applied.// Therefore java subtracts the local UTC offset, to get a UTC number.@@ -563,7 +563,7 @@ public class yacySeed implements Cloneable, Comparable<yacySeed>, Comparator<yaclong b;try {final GenericFormatter my_SHORT_SECOND_FORMATTER = new GenericFormatter(GenericFormatter.FORMAT_SHORT_SECOND, GenericFormatter.time_second); // use our own formatter to prevent concurrency locks with other processes- b = my_SHORT_SECOND_FORMATTER.parse(get(yacySeed.BDATE, "20040101000000")).getTime();+ b = my_SHORT_SECOND_FORMATTER.parse(get(Seed.BDATE, "20040101000000")).getTime();} catch (final ParseException e) {b = System.currentTimeMillis();}@@ -597,7 +597,7 @@ public class yacySeed implements Cloneable, Comparable<yacySeed>, Comparator<yacpublic int getPPM() {try {- return Integer.parseInt(get(yacySeed.ISPEED, yacySeed.ZERO));+ return Integer.parseInt(get(Seed.ISPEED, Seed.ZERO));} catch (final NumberFormatException e) {return 0;}@@ -605,7 +605,7 @@ public class yacySeed implements Cloneable, Comparable<yacySeed>, Comparator<yacpublic float getQPM() {try {- return Float.parseFloat(get(yacySeed.RSPEED, yacySeed.ZERO));+ return Float.parseFloat(get(Seed.RSPEED, Seed.ZERO));} catch (final NumberFormatException e) {return 0f;}@@ -613,7 +613,7 @@ public class yacySeed implements Cloneable, Comparable<yacySeed>, Comparator<yacpublic final long getLinkCount() {try {- return getLong(yacySeed.LCOUNT, 0);+ return getLong(Seed.LCOUNT, 0);} catch (final NumberFormatException e) {return 0;}@@ -621,23 +621,23 @@ public class yacySeed implements Cloneable, Comparable<yacySeed>, Comparator<yacpublic final long getWordCount() {try {- return getLong(yacySeed.ICOUNT, 0);+ return getLong(Seed.ICOUNT, 0);} catch (final NumberFormatException e) {return 0;}}private boolean getFlag(final int flag) {- final String flags = get(yacySeed.FLAGS, yacySeed.FLAGSZERO);+ final String flags = get(Seed.FLAGS, Seed.FLAGSZERO);return (new bitfield(UTF8.getBytes(flags))).get(flag);}private void setFlag(final int flag, final boolean value) {- String flags = get(yacySeed.FLAGS, yacySeed.FLAGSZERO);- if (flags.length() != 4) { flags = yacySeed.FLAGSZERO; }+ String flags = get(Seed.FLAGS, Seed.FLAGSZERO);+ if (flags.length() != 4) { flags = Seed.FLAGSZERO; }final bitfield f = new bitfield(UTF8.getBytes(flags));f.set(flag, value);- this.dna.put(yacySeed.FLAGS, UTF8.String(f.getBytes()));+ this.dna.put(Seed.FLAGS, UTF8.String(f.getBytes()));}public final void setFlagDirectConnect(final boolean value) { setFlag(FLAG_DIRECT_CONNECT, value); }@@ -657,19 +657,19 @@ public class yacySeed implements Cloneable, Comparable<yacySeed>, Comparator<yacfor (int i = 4; i < 24; i++) { setFlag(i, true); }}public final boolean isType(final String type) {- return get(yacySeed.PEERTYPE, "").equals(type);+ return get(Seed.PEERTYPE, "").equals(type);}public final boolean isVirgin() {- return get(yacySeed.PEERTYPE, "").equals(yacySeed.PEERTYPE_VIRGIN);+ return get(Seed.PEERTYPE, "").equals(Seed.PEERTYPE_VIRGIN);}public final boolean isJunior() {- return get(yacySeed.PEERTYPE, "").equals(yacySeed.PEERTYPE_JUNIOR);+ return get(Seed.PEERTYPE, "").equals(Seed.PEERTYPE_JUNIOR);}public final boolean isSenior() {- return get(yacySeed.PEERTYPE, "").equals(yacySeed.PEERTYPE_SENIOR);+ return get(Seed.PEERTYPE, "").equals(Seed.PEERTYPE_SENIOR);}public final boolean isPrincipal() {- return get(yacySeed.PEERTYPE, "").equals(yacySeed.PEERTYPE_PRINCIPAL);+ return get(Seed.PEERTYPE, "").equals(Seed.PEERTYPE_PRINCIPAL);}public final boolean isPotential() {return isVirgin() || isJunior();@@ -681,14 +681,14 @@ public class yacySeed implements Cloneable, Comparable<yacySeed>, Comparator<yacreturn isSenior() || isPrincipal();}public final boolean isOnline(final String type) {- return type.equals(yacySeed.PEERTYPE_SENIOR) || type.equals(yacySeed.PEERTYPE_PRINCIPAL);+ return type.equals(Seed.PEERTYPE_SENIOR) || type.equals(Seed.PEERTYPE_PRINCIPAL);}public long nextLong(final Random random, final long n) {return Math.abs(random.nextLong()) % n;}- private static byte[] bestGap(final yacySeedDB seedDB) {+ private static byte[] bestGap(final SeedDB seedDB) {final byte[] randomHash = randomHash();if ((seedDB == null) || (seedDB.sizeConnected() <= 2)) {// use random hash@@ -727,13 +727,13 @@ public class yacySeed implements Cloneable, Comparable<yacySeed>, Comparator<yacreturn combined;}- private static TreeMap<Long, String> hashGaps(final yacySeedDB seedDB) {+ private static TreeMap<Long, String> hashGaps(final SeedDB seedDB) {final TreeMap<Long, String>gaps = new TreeMap<Long, String>();if (seedDB == null) return gaps;- final Iterator<yacySeed> i = seedDB.seedsConnected(true, false, null, (float) 0.0);+ final Iterator<Seed> i = seedDB.seedsConnected(true, false, null, (float) 0.0);long l;- yacySeed s0 = null, s1, first = null;+ Seed s0 = null, s1, first = null;while (i.hasNext()) {s1 = i.next();if (s0 == null) {@@ -757,22 +757,22 @@ public class yacySeed implements Cloneable, Comparable<yacySeed>, Comparator<yacreturn gaps;}- public static yacySeed genLocalSeed(final yacySeedDB db) {+ public static Seed genLocalSeed(final SeedDB db) {return genLocalSeed(db, 0, null); // an anonymous peer}- public static yacySeed genLocalSeed(final yacySeedDB db, final int port, final String name) {+ public static Seed genLocalSeed(final SeedDB db, final int port, final String name) {// generate a seed for the local peer// this is the birthplace of a seed, that then will start to travel to other peersfinal String hashs = ASCII.String(bestGap(db));- yacyCore.log.logInfo("init: OWN SEED = " + hashs);+ Network.log.logInfo("init: OWN SEED = " + hashs);- final yacySeed newSeed = new yacySeed(hashs);+ final Seed newSeed = new Seed(hashs);// now calculate other information about the host- newSeed.dna.put(yacySeed.NAME, (name) == null ? defaultPeerName() : name);- newSeed.dna.put(yacySeed.PORT, Integer.toString((port <= 0) ? 8090 : port));+ newSeed.dna.put(Seed.NAME, (name) == null ? defaultPeerName() : name);+ newSeed.dna.put(Seed.PORT, Integer.toString((port <= 0) ? 8090 : port));return newSeed;}@@ -785,7 +785,7 @@ public class yacySeed implements Cloneable, Comparable<yacySeed>, Comparator<yacreturn ASCII.getBytes(hash);}- public static yacySeed genRemoteSeed(final String seedStr, final String key, final boolean ownSeed, final String patchIP) throws IOException {+ public static Seed genRemoteSeed(final String seedStr, final String key, final boolean ownSeed, final String patchIP) throws IOException {// this method is used to convert the external representation of a seed into a seed object// yacyCore.log.logFinest("genRemoteSeed: seedStr=" + seedStr + " key=" + key);@@ -798,9 +798,9 @@ public class yacySeed implements Cloneable, Comparable<yacySeed>, Comparator<yac// extract hashfinal ConcurrentHashMap<String, String> dna = MapTools.string2map(seed, ",");- final String hash = dna.remove(yacySeed.HASH);+ final String hash = dna.remove(Seed.HASH);if (hash == null) throw new IOException("hash == null");- final yacySeed resultSeed = new yacySeed(hash, dna);+ final Seed resultSeed = new Seed(hash, dna);// check semantics of contentString testResult = resultSeed.isProper(ownSeed);@@ -826,15 +826,15 @@ public class yacySeed implements Cloneable, Comparable<yacySeed>, Comparator<yacif (this.hash.length() != Word.commonHashLength) return "wrong hash length (" + this.hash.length() + ")";// name- final String peerName = this.dna.get(yacySeed.NAME);+ final String peerName = this.dna.get(Seed.NAME);if (peerName == null) return "no peer name given";- this.dna.put(yacySeed.NAME, checkPeerName(peerName));+ this.dna.put(Seed.NAME, checkPeerName(peerName));// typefinal String peerType = getPeerType();if ((peerType == null) ||- !(peerType.equals(yacySeed.PEERTYPE_VIRGIN) || peerType.equals(yacySeed.PEERTYPE_JUNIOR)- || peerType.equals(yacySeed.PEERTYPE_SENIOR) || peerType.equals(yacySeed.PEERTYPE_PRINCIPAL)))+ !(peerType.equals(Seed.PEERTYPE_VIRGIN) || peerType.equals(Seed.PEERTYPE_JUNIOR)+ || peerType.equals(Seed.PEERTYPE_SENIOR) || peerType.equals(Seed.PEERTYPE_PRINCIPAL)))return "invalid peerType '" + peerType + "'";// check IP@@ -874,7 +874,7 @@ public class yacySeed implements Cloneable, Comparable<yacySeed>, Comparator<yacpublic final String toString() {final ConcurrentMap<String, String> copymap = new ConcurrentHashMap<String, String>();copymap.putAll(this.dna);- copymap.put(yacySeed.HASH, this.hash); // set hash into seed code structure+ copymap.put(Seed.HASH, this.hash); // set hash into seed code structurereturn MapTools.map2string(copymap, ",", true); // generate string representation}@@ -895,26 +895,26 @@ public class yacySeed implements Cloneable, Comparable<yacySeed>, Comparator<yacfw.close();}- public static yacySeed load(final File f) throws IOException {+ public static Seed load(final File f) throws IOException {final FileReader fr = new FileReader(f);final char[] b = new char[(int) f.length()];fr.read(b, 0, b.length);fr.close();- final yacySeed mySeed = genRemoteSeed(new String(b), null, true, null);+ final Seed mySeed = genRemoteSeed(new String(b), null, true, null);assert mySeed != null; // in case of an error, an IOException is thrown- mySeed.dna.put(yacySeed.IP, ""); // set own IP as unknown+ mySeed.dna.put(Seed.IP, ""); // set own IP as unknownreturn mySeed;}@Override- public final yacySeed clone() {+ public final Seed clone() {final ConcurrentHashMap<String, String> ndna = new ConcurrentHashMap<String, String>();ndna.putAll(this.dna);- return new yacySeed(this.hash, ndna);+ return new Seed(this.hash, ndna);}@Override- public int compareTo(final yacySeed arg0) {+ public int compareTo(final Seed arg0) {// TODO Auto-generated method stubfinal int o1 = hashCode();final int o2 = arg0.hashCode();@@ -929,7 +929,7 @@ public class yacySeed implements Cloneable, Comparable<yacySeed>, Comparator<yac}@Override- public int compare(final yacySeed o1, final yacySeed o2) {+ public int compare(final Seed o1, final Seed o2) {return o1.compareTo(o2);}diff --git a/source/net/yacy/peers/yacySeedDB.java b/source/net/yacy/peers/SeedDB.javasimilarity index 82%rename from source/net/yacy/peers/yacySeedDB.javarename to source/net/yacy/peers/SeedDB.javaindex 4d7336ca9..21e5ee02e 100644--- a/source/net/yacy/peers/yacySeedDB.java+++ b/source/net/yacy/peers/SeedDB.java@@ -66,7 +66,7 @@ import de.anomic.http.server.HTTPDemon;import de.anomic.server.serverCore;import de.anomic.server.serverSwitch;-public final class yacySeedDB implements AlternativeDomainNames {+public final class SeedDB implements AlternativeDomainNames {// global statics@@ -78,9 +78,9 @@ public final class yacySeedDB implements AlternativeDomainNames {*/public static final String DBFILE_OWN_SEED = "mySeed.txt";- public static final String[] sortFields = new String[] {yacySeed.LCOUNT, yacySeed.RCOUNT, yacySeed.ICOUNT, yacySeed.UPTIME, yacySeed.VERSION, yacySeed.LASTSEEN};- public static final String[] longaccFields = new String[] {yacySeed.LCOUNT, yacySeed.ICOUNT, yacySeed.ISPEED};- public static final String[] doubleaccFields = new String[] {yacySeed.RSPEED};+ public static final String[] sortFields = new String[] {Seed.LCOUNT, Seed.RCOUNT, Seed.ICOUNT, Seed.UPTIME, Seed.VERSION, Seed.LASTSEEN};+ public static final String[] longaccFields = new String[] {Seed.LCOUNT, Seed.ICOUNT, Seed.ISPEED};+ public static final String[] doubleaccFields = new String[] {Seed.RSPEED};// class objectsprivate File seedActiveDBFile, seedPassiveDBFile, seedPotentialDBFile;@@ -91,18 +91,18 @@ public final class yacySeedDB implements AlternativeDomainNames {public long lastSeedUpload_timeStamp = System.currentTimeMillis();protected String lastSeedUpload_myIP = "";- public yacyPeerActions peerActions;- public yacyNewsPool newsPool;+ public PeerActions peerActions;+ public NewsPool newsPool;private int netRedundancy;public PartitionScheme scheme;- private yacySeed mySeed; // my own seed+ private Seed mySeed; // my own seedprivate final Set<String> myBotIDs; // list of id's that this bot accepts as robots.txt identificationprivate final Hashtable<String, String> nameLookupCache; // a name-to-hash relation- private final Hashtable<InetAddress, SoftReference<yacySeed>> ipLookupCache;+ private final Hashtable<InetAddress, SoftReference<Seed>> ipLookupCache;- public yacySeedDB(+ public SeedDB(final File networkRoot,final String seedActiveDBFileName,final String seedPassiveDBFileName,@@ -133,7 +133,7 @@ public final class yacySeedDB implements AlternativeDomainNames {this.nameLookupCache = new Hashtable<String, String>();// cache for reverse name lookup- this.ipLookupCache = new Hashtable<InetAddress, SoftReference<yacySeed>>();+ this.ipLookupCache = new Hashtable<InetAddress, SoftReference<Seed>>();// check if we are in the seedCaches: this can happen if someone else published our seedremoveMySeed();@@ -144,10 +144,10 @@ public final class yacySeedDB implements AlternativeDomainNames {HTTPDemon.setAlternativeResolver(this);// create or init news database- this.newsPool = new yacyNewsPool(networkRoot, useTailCache, exceed134217727);+ this.newsPool = new NewsPool(networkRoot, useTailCache, exceed134217727);// deploy peer actions- this.peerActions = new yacyPeerActions(this, this.newsPool);+ this.peerActions = new PeerActions(this, this.newsPool);}public void relocate(@@ -173,7 +173,7 @@ public final class yacySeedDB implements AlternativeDomainNames {// but keep the seed namefinal String peername = myName();this.mySeed = null; // my own seed- this.myOwnSeedFile = new File(newNetworkRoot, yacySeedDB.DBFILE_OWN_SEED);+ this.myOwnSeedFile = new File(newNetworkRoot, SeedDB.DBFILE_OWN_SEED);initMySeed();this.mySeed.setName(peername);@@ -200,10 +200,10 @@ public final class yacySeedDB implements AlternativeDomainNames {HTTPDemon.setAlternativeResolver(this);// create or init news database- this.newsPool = new yacyNewsPool(newNetworkRoot, useTailCache, exceed134217727);+ this.newsPool = new NewsPool(newNetworkRoot, useTailCache, exceed134217727);// deploy peer actions- this.peerActions = new yacyPeerActions(this, this.newsPool);+ this.peerActions = new PeerActions(this, this.newsPool);}private synchronized void initMySeed() {@@ -212,12 +212,12 @@ public final class yacySeedDB implements AlternativeDomainNames {// create or init own seedif (this.myOwnSeedFile.length() > 0) try {// load existing identity- this.mySeed = yacySeed.load(this.myOwnSeedFile);+ this.mySeed = Seed.load(this.myOwnSeedFile);if (this.mySeed == null) throw new IOException("current seed is null");} catch (final IOException e) {// create new identityLog.logSevere("SEEDDB", "could not load stored mySeed.txt from " + this.myOwnSeedFile.toString() + ": " + e.getMessage() + ". creating new seed.", e);- this.mySeed = yacySeed.genLocalSeed(this);+ this.mySeed = Seed.genLocalSeed(this);try {this.mySeed.save(this.myOwnSeedFile);} catch (final IOException ee) {@@ -228,7 +228,7 @@ public final class yacySeedDB implements AlternativeDomainNames {} else {// create new identityLog.logInfo("SEEDDB", "could not find stored mySeed.txt at " + this.myOwnSeedFile.toString() + ": " + ". creating new seed.");- this.mySeed = yacySeed.genLocalSeed(this);+ this.mySeed = Seed.genLocalSeed(this);try {this.mySeed.save(this.myOwnSeedFile);} catch (final IOException ee) {@@ -240,7 +240,7 @@ public final class yacySeedDB implements AlternativeDomainNames {this.myBotIDs.add(this.mySeed.getName() + ".yacy");this.myBotIDs.add(this.mySeed.hash + ".yacyh");this.mySeed.setIP(""); // we delete the old information to see what we have now- this.mySeed.put(yacySeed.PEERTYPE, yacySeed.PEERTYPE_VIRGIN); // markup startup condition+ this.mySeed.put(Seed.PEERTYPE, Seed.PEERTYPE_VIRGIN); // markup startup condition}public Set<String> myBotIDs() {@@ -256,7 +256,7 @@ public final class yacySeedDB implements AlternativeDomainNames {return this.mySeed != null;}- public yacySeed mySeed() {+ public Seed mySeed() {if (this.mySeed == null) {if (sizeConnected() == 0) try {Thread.sleep(5000);} catch (final InterruptedException e) {} // wait for initinitMySeed();@@ -340,7 +340,7 @@ public final class yacySeedDB implements AlternativeDomainNames {private synchronized MapDataMining resetSeedTable(MapDataMining seedDB, final File seedDBFile) {// this is an emergency function that should only be used if any problem with the// seed.db is detected- yacyCore.log.logWarning("seed-db " + seedDBFile.toString() + " reset (on-the-fly)");+ Network.log.logWarning("seed-db " + seedDBFile.toString() + " reset (on-the-fly)");seedDB.close();FileUtils.deletedelete(seedDBFile);if (seedDBFile.exists())@@ -362,17 +362,17 @@ public final class yacySeedDB implements AlternativeDomainNames {this.peerActions.close();}- public Iterator<yacySeed> seedsSortedConnected(final boolean up, final String field) {+ public Iterator<Seed> seedsSortedConnected(final boolean up, final String field) {// enumerates seed-type objects: all seeds sequentially ordered by fieldreturn new seedEnum(up, field, this.seedActiveDB);}- public Iterator<yacySeed> seedsSortedDisconnected(final boolean up, final String field) {+ public Iterator<Seed> seedsSortedDisconnected(final boolean up, final String field) {// enumerates seed-type objects: all seeds sequentially ordered by fieldreturn new seedEnum(up, field, this.seedPassiveDB);}- public Iterator<yacySeed> seedsSortedPotential(final boolean up, final String field) {+ public Iterator<Seed> seedsSortedPotential(final boolean up, final String field) {// enumerates seed-type objects: all seeds sequentially ordered by fieldreturn new seedEnum(up, field, this.seedPotentialDB);}@@ -388,7 +388,7 @@ public final class yacySeedDB implements AlternativeDomainNames {// clusterdef ::= {address}{','address}*final String[] addresses = (clusterdefinition.length() == 0) ? new String[0] : clusterdefinition.split(",");final TreeMap<byte[], String> clustermap = new TreeMap<byte[], String>(Base64Order.enhancedCoder);- yacySeed seed;+ Seed seed;String hash, yacydom, ipport;int p;for (final String addresse : addresses) {@@ -402,10 +402,10 @@ public final class yacySeedDB implements AlternativeDomainNames {}if (yacydom.endsWith(".yacyh")) {// find a peer with its hexhash- hash = yacySeed.hexHash2b64Hash(yacydom.substring(0, yacydom.length() - 6));+ hash = Seed.hexHash2b64Hash(yacydom.substring(0, yacydom.length() - 6));seed = get(hash);if (seed == null) {- yacyCore.log.logWarning("cluster peer '" + yacydom + "' was not found.");+ Network.log.logWarning("cluster peer '" + yacydom + "' was not found.");} else {clustermap.put(ASCII.getBytes(hash), ipport);}@@ -413,35 +413,35 @@ public final class yacySeedDB implements AlternativeDomainNames {// find a peer with its nameseed = lookupByName(yacydom.substring(0, yacydom.length() - 5));if (seed == null) {- yacyCore.log.logWarning("cluster peer '" + yacydom + "' was not found.");+ Network.log.logWarning("cluster peer '" + yacydom + "' was not found.");} else {clustermap.put(ASCII.getBytes(seed.hash), ipport);}} else {- yacyCore.log.logWarning("cluster peer '" + addresse + "' has wrong syntax. the name must end with .yacy or .yacyh");+ Network.log.logWarning("cluster peer '" + addresse + "' has wrong syntax. the name must end with .yacy or .yacyh");}}return clustermap;}- public Iterator<yacySeed> seedsConnected(final boolean up, final boolean rot, final byte[] firstHash, final float minVersion) {+ public Iterator<Seed> seedsConnected(final boolean up, final boolean rot, final byte[] firstHash, final float minVersion) {// enumerates seed-type objects: all seeds sequentially without orderreturn new seedEnum(up, rot, (firstHash == null) ? null : firstHash, null, this.seedActiveDB, minVersion);}- private Iterator<yacySeed> seedsDisconnected(final boolean up, final boolean rot, final byte[] firstHash, final float minVersion) {+ private Iterator<Seed> seedsDisconnected(final boolean up, final boolean rot, final byte[] firstHash, final float minVersion) {// enumerates seed-type objects: all seeds sequentially without orderreturn new seedEnum(up, rot, (firstHash == null) ? null : firstHash, null, this.seedPassiveDB, minVersion);}- private Iterator<yacySeed> seedsPotential(final boolean up, final boolean rot, final byte[] firstHash, final float minVersion) {+ private Iterator<Seed> seedsPotential(final boolean up, final boolean rot, final byte[] firstHash, final float minVersion) {// enumerates seed-type objects: all seeds sequentially without orderreturn new seedEnum(up, rot, (firstHash == null) ? null : firstHash, null, this.seedPotentialDB, minVersion);}- public yacySeed anySeedVersion(final float minVersion) {+ public Seed anySeedVersion(final float minVersion) {// return just any seed that has a specific minimum version number- final Iterator<yacySeed> e = seedsConnected(true, true, yacySeed.randomHash(), minVersion);+ final Iterator<Seed> e = seedsConnected(true, true, Seed.randomHash(), minVersion);return e.next();}@@ -452,8 +452,8 @@ public final class yacySeedDB implements AlternativeDomainNames {*/public int sizeActiveSince(final long limit) {int c = this.seedActiveDB.size();- yacySeed seed;- Iterator<yacySeed> i = seedsSortedDisconnected(false, yacySeed.LASTSEEN);+ Seed seed;+ Iterator<Seed> i = seedsSortedDisconnected(false, Seed.LASTSEEN);while (i.hasNext()) {seed = i.next();if (seed != null) {@@ -461,7 +461,7 @@ public final class yacySeedDB implements AlternativeDomainNames {c++;}}- i = seedsSortedPotential(false, yacySeed.LASTSEEN);+ i = seedsSortedPotential(false, Seed.LASTSEEN);while (i.hasNext()) {seed = i.next();if (seed != null) {@@ -484,16 +484,16 @@ public final class yacySeedDB implements AlternativeDomainNames {return this.seedPotentialDB.size();}- public long countActiveURL() { return this.seedActiveDB.getLongAcc(yacySeed.LCOUNT); }- public long countActiveRWI() { return this.seedActiveDB.getLongAcc(yacySeed.ICOUNT); }- public long countActivePPM() { return this.seedActiveDB.getLongAcc(yacySeed.ISPEED); }- public float countActiveQPM() { return this.seedActiveDB.getFloatAcc(yacySeed.RSPEED); }- public long countPassiveURL() { return this.seedPassiveDB.getLongAcc(yacySeed.LCOUNT); }- public long countPassiveRWI() { return this.seedPassiveDB.getLongAcc(yacySeed.ICOUNT); }- public long countPotentialURL() { return this.seedPotentialDB.getLongAcc(yacySeed.LCOUNT); }- public long countPotentialRWI() { return this.seedPotentialDB.getLongAcc(yacySeed.ICOUNT); }+ public long countActiveURL() { return this.seedActiveDB.getLongAcc(Seed.LCOUNT); }+ public long countActiveRWI() { return this.seedActiveDB.getLongAcc(Seed.ICOUNT); }+ public long countActivePPM() { return this.seedActiveDB.getLongAcc(Seed.ISPEED); }+ public float countActiveQPM() { return this.seedActiveDB.getFloatAcc(Seed.RSPEED); }+ public long countPassiveURL() { return this.seedPassiveDB.getLongAcc(Seed.LCOUNT); }+ public long countPassiveRWI() { return this.seedPassiveDB.getLongAcc(Seed.ICOUNT); }+ public long countPotentialURL() { return this.seedPotentialDB.getLongAcc(Seed.LCOUNT); }+ public long countPotentialRWI() { return this.seedPotentialDB.getLongAcc(Seed.ICOUNT); }- public void addConnected(final yacySeed seed) {+ public void addConnected(final Seed seed) {if (seed.isProper(false) != null) return;//seed.put(yacySeed.LASTSEEN, yacyCore.shortFormatter.format(new Date(yacyCore.universalTime())));synchronized (this) {@@ -504,13 +504,13 @@ public final class yacySeedDB implements AlternativeDomainNames {this.seedPassiveDB.delete(ASCII.getBytes(seed.hash));this.seedPotentialDB.delete(ASCII.getBytes(seed.hash));} catch (final Exception e) {- yacyCore.log.logSevere("ERROR add: seed.db corrupt (" + e.getMessage() + "); resetting seed.db", e);+ Network.log.logSevere("ERROR add: seed.db corrupt (" + e.getMessage() + "); resetting seed.db", e);resetActiveTable();}}}- protected void addDisconnected(final yacySeed seed) {+ protected void addDisconnected(final Seed seed) {if (seed.isProper(false) != null) return;synchronized (this) {try {@@ -523,13 +523,13 @@ public final class yacySeedDB implements AlternativeDomainNames {final ConcurrentMap<String, String> seedPropMap = seed.getMap();this.seedPassiveDB.insert(ASCII.getBytes(seed.hash), seedPropMap);} catch (final Exception e) {- yacyCore.log.logSevere("ERROR add: seed.db corrupt (" + e.getMessage() + "); resetting seed.db", e);+ Network.log.logSevere("ERROR add: seed.db corrupt (" + e.getMessage() + "); resetting seed.db", e);resetPassiveTable();}}}- protected void addPotential(final yacySeed seed) {+ protected void addPotential(final Seed seed) {if (seed.isProper(false) != null) return;synchronized (this) {try {@@ -542,7 +542,7 @@ public final class yacySeedDB implements AlternativeDomainNames {final ConcurrentMap<String, String> seedPropMap = seed.getMap();this.seedPotentialDB.insert(ASCII.getBytes(seed.hash), seedPropMap);} catch (final Exception e) {- yacyCore.log.logSevere("ERROR add: seed.db corrupt (" + e.getMessage() + "); resetting seed.db", e);+ Network.log.logSevere("ERROR add: seed.db corrupt (" + e.getMessage() + "); resetting seed.db", e);resetPotentialTable();}}@@ -574,7 +574,7 @@ public final class yacySeedDB implements AlternativeDomainNames {return this.seedPotentialDB.containsKey(hash);}- private yacySeed get(final String hash, final MapDataMining database) {+ private Seed get(final String hash, final MapDataMining database) {if (hash == null || hash.length() == 0) return null;if ((this.mySeed != null) && (hash.equals(this.mySeed.hash))) return this.mySeed;final ConcurrentHashMap<String, String> entry = new ConcurrentHashMap<String, String>();@@ -589,36 +589,36 @@ public final class yacySeedDB implements AlternativeDomainNames {Log.logException(e);return null;}- return new yacySeed(hash, entry);+ return new Seed(hash, entry);}- public yacySeed getConnected(final String hash) {+ public Seed getConnected(final String hash) {return get(hash, this.seedActiveDB);}- public yacySeed getDisconnected(final String hash) {+ public Seed getDisconnected(final String hash) {return get(hash, this.seedPassiveDB);}- public yacySeed getPotential(final String hash) {+ public Seed getPotential(final String hash) {return get(hash, this.seedPotentialDB);}- public yacySeed get(final String hash) {- yacySeed seed = getConnected(hash);+ public Seed get(final String hash) {+ Seed seed = getConnected(hash);if (seed == null) seed = getDisconnected(hash);if (seed == null) seed = getPotential(hash);return seed;}- public void update(final String hash, final yacySeed seed) {+ public void update(final String hash, final Seed seed) {if (this.mySeed == null) initMySeed();if (hash.equals(this.mySeed.hash)) {this.mySeed = seed;return;}final byte[] hashb = ASCII.getBytes(hash);- yacySeed s = get(hash, this.seedActiveDB);+ Seed s = get(hash, this.seedActiveDB);if (s != null) try { this.seedActiveDB.insert(hashb, seed.getMap()); return;} catch (final Exception e) {Log.logException(e);}s = get(hash, this.seedPassiveDB);@@ -628,7 +628,7 @@ public final class yacySeedDB implements AlternativeDomainNames {if (s != null) try { this.seedPotentialDB.insert(hashb, seed.getMap()); return;} catch (final Exception e) {Log.logException(e);}}- public yacySeed lookupByName(String peerName) {+ public Seed lookupByName(String peerName) {// reads a seed by searching by nameif (peerName.endsWith(".yacy")) peerName = peerName.substring(0, peerName.length() - 5);@@ -640,7 +640,7 @@ public final class yacySeedDB implements AlternativeDomainNames {// then try to use the cachefinal String seedhash = this.nameLookupCache.get(peerName);- yacySeed seed;+ Seed seed;if (seedhash != null) {seed = this.get(seedhash);if (seed != null) return seed;@@ -649,7 +649,7 @@ public final class yacySeedDB implements AlternativeDomainNames {// enumerate the cache and simultanous insert valuesString name;for (int table = 0; table < 2; table++) {- final Iterator<yacySeed> e = (table == 0) ? seedsConnected(true, false, null, (float) 0.0) : seedsDisconnected(true, false, null, (float) 0.0);+ final Iterator<Seed> e = (table == 0) ? seedsConnected(true, false, null, (float) 0.0) : seedsDisconnected(true, false, null, (float) 0.0);while (e.hasNext()) {seed = e.next();if (seed != null) {@@ -668,7 +668,7 @@ public final class yacySeedDB implements AlternativeDomainNames {return null;}- public yacySeed lookupByIP(+ public Seed lookupByIP(final InetAddress peerIP,final boolean lookupConnected,final boolean lookupDisconnected,@@ -676,7 +676,7 @@ public final class yacySeedDB implements AlternativeDomainNames {) {if (peerIP == null) return null;- yacySeed seed = null;+ Seed seed = null;// local peer?if (Domains.isThisHostIP(peerIP)) {@@ -685,7 +685,7 @@ public final class yacySeedDB implements AlternativeDomainNames {}// then try to use the cache- final SoftReference<yacySeed> ref = this.ipLookupCache.get(peerIP);+ final SoftReference<Seed> ref = this.ipLookupCache.get(peerIP);if (ref != null) {seed = ref.get();if (seed != null) return seed;@@ -698,7 +698,7 @@ public final class yacySeedDB implements AlternativeDomainNames {if (lookupConnected) {// enumerate the cache and simultanous insert values- final Iterator<yacySeed> e = seedsConnected(true, false, null, (float) 0.0);+ final Iterator<Seed> e = seedsConnected(true, false, null, (float) 0.0);while (e.hasNext()) {seed = e.next();if (seed != null) {@@ -718,7 +718,7 @@ public final class yacySeedDB implements AlternativeDomainNames {}seedIPAddress = Domains.dnsResolve(addressStr);if (seedIPAddress == null) continue;- if (seed.isProper(false) == null) this.ipLookupCache.put(seedIPAddress, new SoftReference<yacySeed>(seed));+ if (seed.isProper(false) == null) this.ipLookupCache.put(seedIPAddress, new SoftReference<Seed>(seed));if (seedIPAddress.equals(peerIP)) return seed;}}@@ -730,7 +730,7 @@ public final class yacySeedDB implements AlternativeDomainNames {if (lookupDisconnected) {// enumerate the cache and simultanous insert values- final Iterator<yacySeed>e = seedsDisconnected(true, false, null, (float) 0.0);+ final Iterator<Seed>e = seedsDisconnected(true, false, null, (float) 0.0);while (e.hasNext()) {seed = e.next();@@ -751,7 +751,7 @@ public final class yacySeedDB implements AlternativeDomainNames {}seedIPAddress = Domains.dnsResolve(addressStr);if (seedIPAddress == null) continue;- if (seed.isProper(false) == null) this.ipLookupCache.put(seedIPAddress, new SoftReference<yacySeed>(seed));+ if (seed.isProper(false) == null) this.ipLookupCache.put(seedIPAddress, new SoftReference<Seed>(seed));if (seedIPAddress.equals(peerIP)) return seed;}}@@ -763,7 +763,7 @@ public final class yacySeedDB implements AlternativeDomainNames {if (lookupPotential) {// enumerate the cache and simultanous insert values- final Iterator<yacySeed> e = seedsPotential(true, false, null, (float) 0.0);+ final Iterator<Seed> e = seedsPotential(true, false, null, (float) 0.0);while (e.hasNext()) {seed = e.next();@@ -773,7 +773,7 @@ public final class yacySeedDB implements AlternativeDomainNames {}seedIPAddress = Domains.dnsResolve(addressStr);if (seedIPAddress == null) continue;- if (seed.isProper(false) == null) this.ipLookupCache.put(seedIPAddress, new SoftReference<yacySeed>(seed));+ if (seed.isProper(false) == null) this.ipLookupCache.put(seedIPAddress, new SoftReference<Seed>(seed));if (seedIPAddress.equals(peerIP)) return seed;}}@@ -788,7 +788,7 @@ public final class yacySeedDB implements AlternativeDomainNames {}seedIPAddress = Domains.dnsResolve(addressStr);if (seedIPAddress == null) return null;- if (this.mySeed.isProper(false) == null) this.ipLookupCache.put(seedIPAddress, new SoftReference<yacySeed>(this.mySeed));+ if (this.mySeed.isProper(false) == null) this.ipLookupCache.put(seedIPAddress, new SoftReference<Seed>(this.mySeed));if (seedIPAddress.equals(peerIP)) return this.mySeed;// nothing foundreturn null;@@ -811,8 +811,8 @@ public final class yacySeedDB implements AlternativeDomainNames {}// store active peer seeds- yacySeed ys;- Iterator<yacySeed> se = seedsConnected(true, false, null, (float) 0.0);+ Seed ys;+ Iterator<Seed> se = seedsConnected(true, false, null, (float) 0.0);while (se.hasNext()) {ys = se.next();if (ys != null) {@@ -843,7 +843,7 @@ public final class yacySeedDB implements AlternativeDomainNames {protected String uploadSeedList(final yacySeedUploader uploader,final serverSwitch sb,- final yacySeedDB seedDB,+ final SeedDB seedDB,final DigestURI seedURL) throws Exception {// upload a seed file, if possible@@ -939,7 +939,7 @@ public final class yacySeedDB implements AlternativeDomainNames {* resolve a yacy address*/public String resolve(String host) {- yacySeed seed;+ Seed seed;int p;String subdom = null;if (host.endsWith(".yacyh")) {@@ -954,7 +954,7 @@ public final class yacySeedDB implements AlternativeDomainNames {String hash = host.substring(0, host.length() - 6);if (hash.length() > Word.commonHashLength) {// this is probably a hex-hash- hash = yacySeed.hexHash2b64Hash(hash);+ hash = Seed.hexHash2b64Hash(hash);}// check remote seedsseed = getConnected(hash); // checks only remote, not local@@ -994,7 +994,7 @@ public final class yacySeedDB implements AlternativeDomainNames {if (targetHash.equals(mySeed().hash)) {address = mySeed().getClusterAddress();} else {- final yacySeed targetSeed = getConnected(targetHash);+ final Seed targetSeed = getConnected(targetHash);if (targetSeed == null) { return null; }address = targetSeed.getClusterAddress();}@@ -1002,10 +1002,10 @@ public final class yacySeedDB implements AlternativeDomainNames {return address;}- private class seedEnum implements Iterator<yacySeed> {+ private class seedEnum implements Iterator<Seed> {private MapDataMining.mapIterator it;- private yacySeed nextSeed;+ private Seed nextSeed;private final MapDataMining database;private float minVersion;@@ -1023,15 +1023,15 @@ public final class yacySeedDB implements AlternativeDomainNames {}} catch (final IOException e) {Log.logException(e);- yacyCore.log.logSevere("ERROR seedLinEnum: seed.db corrupt (" + e.getMessage() + "); resetting seed.db", e);- if (database == yacySeedDB.this.seedActiveDB) yacySeedDB.this.seedActiveDB = resetSeedTable(yacySeedDB.this.seedActiveDB, yacySeedDB.this.seedActiveDBFile);- if (database == yacySeedDB.this.seedPassiveDB) yacySeedDB.this.seedPassiveDB = resetSeedTable(yacySeedDB.this.seedPassiveDB, yacySeedDB.this.seedPassiveDBFile);+ Network.log.logSevere("ERROR seedLinEnum: seed.db corrupt (" + e.getMessage() + "); resetting seed.db", e);+ if (database == SeedDB.this.seedActiveDB) SeedDB.this.seedActiveDB = resetSeedTable(SeedDB.this.seedActiveDB, SeedDB.this.seedActiveDBFile);+ if (database == SeedDB.this.seedPassiveDB) SeedDB.this.seedPassiveDB = resetSeedTable(SeedDB.this.seedPassiveDB, SeedDB.this.seedPassiveDBFile);this.it = null;} catch (final kelondroException e) {Log.logException(e);- yacyCore.log.logSevere("ERROR seedLinEnum: seed.db corrupt (" + e.getMessage() + "); resetting seed.db", e);- if (database == yacySeedDB.this.seedActiveDB) yacySeedDB.this.seedActiveDB = resetSeedTable(yacySeedDB.this.seedActiveDB, yacySeedDB.this.seedActiveDBFile);- if (database == yacySeedDB.this.seedPassiveDB) yacySeedDB.this.seedPassiveDB = resetSeedTable(yacySeedDB.this.seedPassiveDB, yacySeedDB.this.seedPassiveDBFile);+ Network.log.logSevere("ERROR seedLinEnum: seed.db corrupt (" + e.getMessage() + "); resetting seed.db", e);+ if (database == SeedDB.this.seedActiveDB) SeedDB.this.seedActiveDB = resetSeedTable(SeedDB.this.seedActiveDB, SeedDB.this.seedActiveDBFile);+ if (database == SeedDB.this.seedPassiveDB) SeedDB.this.seedPassiveDB = resetSeedTable(SeedDB.this.seedPassiveDB, SeedDB.this.seedPassiveDBFile);this.it = null;}}@@ -1043,10 +1043,10 @@ public final class yacySeedDB implements AlternativeDomainNames {this.nextSeed = internalNext();} catch (final kelondroException e) {Log.logException(e);- yacyCore.log.logSevere("ERROR seedLinEnum: seed.db corrupt (" + e.getMessage() + "); resetting seed.db", e);- if (database == yacySeedDB.this.seedActiveDB) yacySeedDB.this.seedActiveDB = resetSeedTable(yacySeedDB.this.seedActiveDB, yacySeedDB.this.seedActiveDBFile);- if (database == yacySeedDB.this.seedPassiveDB) yacySeedDB.this.seedPassiveDB = resetSeedTable(yacySeedDB.this.seedPassiveDB, yacySeedDB.this.seedPassiveDBFile);- if (database == yacySeedDB.this.seedPotentialDB) yacySeedDB.this.seedPotentialDB = resetSeedTable(yacySeedDB.this.seedPotentialDB, yacySeedDB.this.seedPotentialDBFile);+ Network.log.logSevere("ERROR seedLinEnum: seed.db corrupt (" + e.getMessage() + "); resetting seed.db", e);+ if (database == SeedDB.this.seedActiveDB) SeedDB.this.seedActiveDB = resetSeedTable(SeedDB.this.seedActiveDB, SeedDB.this.seedActiveDBFile);+ if (database == SeedDB.this.seedPassiveDB) SeedDB.this.seedPassiveDB = resetSeedTable(SeedDB.this.seedPassiveDB, SeedDB.this.seedPassiveDBFile);+ if (database == SeedDB.this.seedPotentialDB) SeedDB.this.seedPotentialDB = resetSeedTable(SeedDB.this.seedPotentialDB, SeedDB.this.seedPotentialDBFile);this.it = null;}}@@ -1055,7 +1055,7 @@ public final class yacySeedDB implements AlternativeDomainNames {return (this.nextSeed != null);}- private yacySeed internalNext() {+ private Seed internalNext() {if (this.it == null || !(this.it.hasNext())) return null;try {Map<String, String> dna0;@@ -1078,21 +1078,21 @@ public final class yacySeedDB implements AlternativeDomainNames {final String hash = dna.remove("key");//assert hash != null;if (hash == null) continue; // bad seed- return new yacySeed(hash, dna);+ return new Seed(hash, dna);}return null;} catch (final Exception e) {Log.logException(e);- yacyCore.log.logSevere("ERROR internalNext: seed.db corrupt (" + e.getMessage() + "); resetting seed.db", e);- if (this.database == yacySeedDB.this.seedActiveDB) yacySeedDB.this.seedActiveDB = resetSeedTable(yacySeedDB.this.seedActiveDB, yacySeedDB.this.seedActiveDBFile);- if (this.database == yacySeedDB.this.seedPassiveDB) yacySeedDB.this.seedPassiveDB = resetSeedTable(yacySeedDB.this.seedPassiveDB, yacySeedDB.this.seedPassiveDBFile);- if (this.database == yacySeedDB.this.seedPotentialDB) yacySeedDB.this.seedPotentialDB = resetSeedTable(yacySeedDB.this.seedPotentialDB, yacySeedDB.this.seedPotentialDBFile);+ Network.log.logSevere("ERROR internalNext: seed.db corrupt (" + e.getMessage() + "); resetting seed.db", e);+ if (this.database == SeedDB.this.seedActiveDB) SeedDB.this.seedActiveDB = resetSeedTable(SeedDB.this.seedActiveDB, SeedDB.this.seedActiveDBFile);+ if (this.database == SeedDB.this.seedPassiveDB) SeedDB.this.seedPassiveDB = resetSeedTable(SeedDB.this.seedPassiveDB, SeedDB.this.seedPassiveDBFile);+ if (this.database == SeedDB.this.seedPotentialDB) SeedDB.this.seedPotentialDB = resetSeedTable(SeedDB.this.seedPotentialDB, SeedDB.this.seedPotentialDBFile);return null;}}- public yacySeed next() {- final yacySeed seed = this.nextSeed;+ public Seed next() {+ final Seed seed = this.nextSeed;float version;try {while (true) {this.nextSeed = internalNext();@@ -1102,7 +1102,7 @@ public final class yacySeedDB implements AlternativeDomainNames {}} catch (final kelondroException e) {Log.logException(e);// emergency reset- yacyCore.log.logSevere("seed-db emergency reset", e);+ Network.log.logSevere("seed-db emergency reset", e);this.database.clear();this.nextSeed = null;return null;diff --git a/source/net/yacy/peers/dht/Dispatcher.java b/source/net/yacy/peers/dht/Dispatcher.javaindex c67fe1a4f..0098eb785 100755--- a/source/net/yacy/peers/dht/Dispatcher.java+++ b/source/net/yacy/peers/dht/Dispatcher.java@@ -42,8 +42,8 @@ import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.rwi.ReferenceContainer;import net.yacy.kelondro.util.ByteArray;import net.yacy.kelondro.workflow.WorkflowProcessor;-import net.yacy.peers.yacySeed;-import net.yacy.peers.yacySeedDB;+import net.yacy.peers.Seed;+import net.yacy.peers.SeedDB;import net.yacy.search.index.Segment;public class Dispatcher {@@ -88,7 +88,7 @@ public class Dispatcher {private final Segment segment;// the seed database- private final yacySeedDB seeds;+ private final SeedDB seeds;// the logprivate final Log log;@@ -101,7 +101,7 @@ public class Dispatcher {public Dispatcher(final Segment segment,- final yacySeedDB seeds,+ final SeedDB seeds,final boolean gzipBody,final int timeout) {@@ -285,7 +285,7 @@ public class Dispatcher {// get or make a entry objectentry = this.transmissionCloud.get(pTArray); // if this is not null, the entry is extended here- final List<yacySeed> targets = PeerSelection.getAcceptRemoteIndexSeedsList(+ final List<Seed> targets = PeerSelection.getAcceptRemoteIndexSeedsList(this.seeds,primaryTarget,this.seeds.redundancy() * 3,diff --git a/source/net/yacy/peers/dht/FlatWordPartitionScheme.java b/source/net/yacy/peers/dht/FlatWordPartitionScheme.javaindex 32154d6ff..40036ef26 100755--- a/source/net/yacy/peers/dht/FlatWordPartitionScheme.java+++ b/source/net/yacy/peers/dht/FlatWordPartitionScheme.java@@ -34,7 +34,7 @@ import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.util.MemoryControl;-import net.yacy.peers.yacySeed;+import net.yacy.peers.Seed;/*** A flat word partition scheme is a metric for words on the range of a distributed@@ -60,7 +60,7 @@ public class FlatWordPartitionScheme implements PartitionScheme {return Base64Order.enhancedCoder.cardinal(wordHash);}- public final long dhtDistance(final byte[] word, final String urlHash, final yacySeed peer) {+ public final long dhtDistance(final byte[] word, final String urlHash, final Seed peer) {return dhtDistance(word, urlHash, ASCII.getBytes(peer.hash));}diff --git a/source/net/yacy/peers/dht/PartitionScheme.java b/source/net/yacy/peers/dht/PartitionScheme.javaindex 540eb4366..d55b621de 100755--- a/source/net/yacy/peers/dht/PartitionScheme.java+++ b/source/net/yacy/peers/dht/PartitionScheme.java@@ -25,7 +25,7 @@package net.yacy.peers.dht;-import net.yacy.peers.yacySeed;+import net.yacy.peers.Seed;/*** A PartitionScheme is a calculation of index storage positions in the network of peers.@@ -68,7 +68,7 @@ public interface PartitionScheme {public long[] dhtPositions(final byte[] wordHash);- public long dhtDistance(final byte[] word, final String urlHash, final yacySeed peer);+ public long dhtDistance(final byte[] word, final String urlHash, final Seed peer);}diff --git a/source/net/yacy/peers/dht/PeerSelection.java b/source/net/yacy/peers/dht/PeerSelection.javaindex 7552d6039..cd5cd32a7 100755--- a/source/net/yacy/peers/dht/PeerSelection.java+++ b/source/net/yacy/peers/dht/PeerSelection.java@@ -44,9 +44,9 @@ import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.order.Digest;import net.yacy.kelondro.util.kelondroException;-import net.yacy.peers.yacyCore;-import net.yacy.peers.yacySeed;-import net.yacy.peers.yacySeedDB;+import net.yacy.peers.Network;+import net.yacy.peers.Seed;+import net.yacy.peers.SeedDB;import net.yacy.peers.operation.yacyVersion;@@ -58,11 +58,11 @@ import net.yacy.peers.operation.yacyVersion;public class PeerSelection {- public static yacySeed[] selectClusterPeers(final yacySeedDB seedDB, final SortedMap<byte[], String> peerhashes) {+ public static Seed[] selectClusterPeers(final SeedDB seedDB, final SortedMap<byte[], String> peerhashes) {final Iterator<Map.Entry<byte[], String>> i = peerhashes.entrySet().iterator();- final List<yacySeed> l = new ArrayList<yacySeed>();+ final List<Seed> l = new ArrayList<Seed>();Map.Entry<byte[], String> entry;- yacySeed s;+ Seed s;while (i.hasNext()) {entry = i.next();s = seedDB.get(ASCII.String(entry.getKey())); // should be getConnected; get only during testing time@@ -71,11 +71,11 @@ public class PeerSelection {l.add(s);}}- return l.toArray(new yacySeed[l.size()]);+ return l.toArray(new Seed[l.size()]);}- public static yacySeed[] selectSearchTargets(- final yacySeedDB seedDB,+ public static Seed[] selectSearchTargets(+ final SeedDB seedDB,final HandleSet wordhashes,int redundancy,int burstRobinsonPercent,@@ -86,9 +86,9 @@ public class PeerSelection {if (seedDB == null) { return null; }// put in seeds according to dht- final Map<String, yacySeed> regularSeeds = new HashMap<String, yacySeed>(); // dht position seeds- yacySeed seed;- Iterator<yacySeed> dhtEnum;+ final Map<String, Seed> regularSeeds = new HashMap<String, Seed>(); // dht position seeds+ Seed seed;+ Iterator<Seed> dhtEnum;Iterator<byte[]> iter = wordhashes.iterator();while (iter.hasNext()) {selectDHTPositions(seedDB, iter.next(), redundancy, regularSeeds);@@ -98,7 +98,7 @@ public class PeerSelection {// put in some seeds according to size of peer.// But not all, that would produce too much load on the largest peers- dhtEnum = seedDB.seedsSortedConnected(false, yacySeed.ICOUNT);+ dhtEnum = seedDB.seedsSortedConnected(false, Seed.ICOUNT);int c = Math.max(Math.min(5, seedDB.sizeConnected()), wordhashes.size() > 1 ? seedDB.sizeConnected() * burstMultiwordPercent / 100 : 0);while (dhtEnum.hasNext() && c-- > 0) {seed = dhtEnum.next();@@ -118,7 +118,7 @@ public class PeerSelection {// create a set that contains only robinson peers because these get a special handlingdhtEnum = seedDB.seedsConnected(true, false, null, 0.50f);- Set<yacySeed> robinson = new HashSet<yacySeed>();+ Set<Seed> robinson = new HashSet<Seed>();while (dhtEnum.hasNext()) {seed = dhtEnum.next();if (seed == null) continue;@@ -161,22 +161,22 @@ public class PeerSelection {}// produce return set- yacySeed[] result = new yacySeed[regularSeeds.size()];+ Seed[] result = new Seed[regularSeeds.size()];result = regularSeeds.values().toArray(result);return result;}private static void selectDHTPositions(- final yacySeedDB seedDB,+ final SeedDB seedDB,byte[] wordhash,int redundancy,- Map<String, yacySeed> regularSeeds) {+ Map<String, Seed> regularSeeds) {// this method is called from the search target computationfinal long[] dhtVerticalTargets = seedDB.scheme.dhtPositions(wordhash);- yacySeed seed;+ Seed seed;for (long dhtVerticalTarget : dhtVerticalTargets) {wordhash = FlatWordPartitionScheme.positionToHash(dhtVerticalTarget);- Iterator<yacySeed> dhtEnum = getAcceptRemoteIndexSeeds(seedDB, wordhash, redundancy, false);+ Iterator<Seed> dhtEnum = getAcceptRemoteIndexSeeds(seedDB, wordhash, redundancy, false);int c = Math.min(seedDB.sizeConnected(), redundancy);int cc = 2; // select a maximum of 3, this is enough redundancywhile (dhtEnum.hasNext() && c > 0 && cc-- > 0) {@@ -194,19 +194,19 @@ public class PeerSelection {return ASCII.getBytes(Base64Order.enhancedCoder.encode(Digest.encodeMD5Raw(Long.toString(System.currentTimeMillis()))).substring(2, 2 + Word.commonHashLength));}- public static byte[] limitOver(final yacySeedDB seedDB, final byte[] startHash) {- final Iterator<yacySeed> seeds = getAcceptRemoteIndexSeeds(seedDB, startHash, 1, false);+ public static byte[] limitOver(final SeedDB seedDB, final byte[] startHash) {+ final Iterator<Seed> seeds = getAcceptRemoteIndexSeeds(seedDB, startHash, 1, false);if (seeds.hasNext()) return ASCII.getBytes(seeds.next().hash);return null;}- protected static List<yacySeed> getAcceptRemoteIndexSeedsList(- yacySeedDB seedDB,+ protected static List<Seed> getAcceptRemoteIndexSeedsList(+ SeedDB seedDB,final byte[] starthash,int max,boolean alsoMyOwn) {- final Iterator<yacySeed> seedIter = getAcceptRemoteIndexSeeds(seedDB, starthash, max, alsoMyOwn);- final ArrayList<yacySeed> targets = new ArrayList<yacySeed>();+ final Iterator<Seed> seedIter = getAcceptRemoteIndexSeeds(seedDB, starthash, max, alsoMyOwn);+ final ArrayList<Seed> targets = new ArrayList<Seed>();while (seedIter.hasNext() && max-- > 0) targets.add(seedIter.next());return targets;}@@ -220,20 +220,20 @@ public class PeerSelection {* @param alsoMyOwn* @return*/- public static Iterator<yacySeed> getAcceptRemoteIndexSeeds(final yacySeedDB seedDB, final byte[] starthash, final int max, final boolean alsoMyOwn) {+ public static Iterator<Seed> getAcceptRemoteIndexSeeds(final SeedDB seedDB, final byte[] starthash, final int max, final boolean alsoMyOwn) {return new acceptRemoteIndexSeedEnum(seedDB, starthash, Math.min(max, seedDB.sizeConnected()), alsoMyOwn);}- private static class acceptRemoteIndexSeedEnum implements Iterator<yacySeed> {+ private static class acceptRemoteIndexSeedEnum implements Iterator<Seed> {- private final Iterator<yacySeed> se;- private yacySeed nextSeed;- private final yacySeedDB seedDB;+ private final Iterator<Seed> se;+ private Seed nextSeed;+ private final SeedDB seedDB;private final HandleSet doublecheck;private int remaining;private boolean alsoMyOwn;- private acceptRemoteIndexSeedEnum(yacySeedDB seedDB, final byte[] starthash, int max, boolean alsoMyOwn) {+ private acceptRemoteIndexSeedEnum(SeedDB seedDB, final byte[] starthash, int max, boolean alsoMyOwn) {this.seedDB = seedDB;this.se = getDHTSeeds(seedDB, starthash, yacyVersion.YACY_HANDLES_COLLECTION_INDEX);this.remaining = max;@@ -246,9 +246,9 @@ public class PeerSelection {return nextSeed != null;}- private yacySeed nextInternal() {+ private Seed nextInternal() {if (this.remaining <= 0) return null;- yacySeed s;+ Seed s;try {while (se.hasNext()) {s = se.next();@@ -268,20 +268,20 @@ public class PeerSelection {}} catch (final kelondroException e) {System.out.println("DEBUG acceptRemoteIndexSeedEnum:" + e.getMessage());- yacyCore.log.logSevere("database inconsistency (" + e.getMessage() + "), re-set of db.");+ Network.log.logSevere("database inconsistency (" + e.getMessage() + "), re-set of db.");seedDB.resetActiveTable();return null;}return null;}- public yacySeed next() {+ public Seed next() {if (alsoMyOwn && Base64Order.enhancedCoder.compare(ASCII.getBytes(seedDB.mySeed().hash), ASCII.getBytes(nextSeed.hash)) < 0) {// take my own seed hash instead the enumeration resultalsoMyOwn = false;return seedDB.mySeed();} else {- final yacySeed next = nextSeed;+ final Seed next = nextSeed;nextSeed = nextInternal();return next;}@@ -300,19 +300,19 @@ public class PeerSelection {* @param minVersion* @return*/- protected static Iterator<yacySeed> getDHTSeeds(final yacySeedDB seedDB, final byte[] firstHash, final float minVersion) {+ protected static Iterator<Seed> getDHTSeeds(final SeedDB seedDB, final byte[] firstHash, final float minVersion) {// enumerates seed-type objects: all seeds with starting point in the middle, rotating at the end/beginningreturn new seedDHTEnum(seedDB, firstHash, minVersion);}- private static class seedDHTEnum implements Iterator<yacySeed> {+ private static class seedDHTEnum implements Iterator<Seed> {- private Iterator<yacySeed> e1, e2;+ private Iterator<Seed> e1, e2;private int steps;private float minVersion;- private yacySeedDB seedDB;+ private SeedDB seedDB;- private seedDHTEnum(final yacySeedDB seedDB, final byte[] firstHash, final float minVersion) {+ private seedDHTEnum(final SeedDB seedDB, final byte[] firstHash, final float minVersion) {this.seedDB = seedDB;this.steps = seedDB.sizeConnected();this.minVersion = minVersion;@@ -324,7 +324,7 @@ public class PeerSelection {return (steps > 0) && ((e2 == null) || (e2.hasNext()));}- public yacySeed next() {+ public Seed next() {if (steps == 0) return null;steps--;@@ -336,7 +336,7 @@ public class PeerSelection {return e2.next();}- final yacySeed n = e1.next();+ final Seed n = e1.next();if (!(e1.hasNext())) {e1 = null;e2 = seedDB.seedsConnected(true, false, null, minVersion);@@ -354,17 +354,17 @@ public class PeerSelection {* @param seedDB* @return an iterator of seed objects*/- public static Iterator<yacySeed> getProvidesRemoteCrawlURLs(final yacySeedDB seedDB) {+ public static Iterator<Seed> getProvidesRemoteCrawlURLs(final SeedDB seedDB) {return new providesRemoteCrawlURLsEnum(seedDB);}- private static class providesRemoteCrawlURLsEnum implements Iterator<yacySeed> {+ private static class providesRemoteCrawlURLsEnum implements Iterator<Seed> {- private Iterator<yacySeed> se;- private yacySeed nextSeed;- private yacySeedDB seedDB;+ private Iterator<Seed> se;+ private Seed nextSeed;+ private SeedDB seedDB;- private providesRemoteCrawlURLsEnum(final yacySeedDB seedDB) {+ private providesRemoteCrawlURLsEnum(final SeedDB seedDB) {this.seedDB = seedDB;se = getDHTSeeds(seedDB, null, yacyVersion.YACY_POVIDES_REMOTECRAWL_LISTS);nextSeed = nextInternal();@@ -374,25 +374,25 @@ public class PeerSelection {return nextSeed != null;}- private yacySeed nextInternal() {- yacySeed s;+ private Seed nextInternal() {+ Seed s;try {while (se.hasNext()) {s = se.next();if (s == null) return null;- if (s.getLong(yacySeed.RCOUNT, 0) > 0) return s;+ if (s.getLong(Seed.RCOUNT, 0) > 0) return s;}} catch (final kelondroException e) {System.out.println("DEBUG providesRemoteCrawlURLsEnum:" + e.getMessage());- yacyCore.log.logSevere("database inconsistency (" + e.getMessage() + "), re-set of db.");+ Network.log.logSevere("database inconsistency (" + e.getMessage() + "), re-set of db.");seedDB.resetActiveTable();return null;}return null;}- public yacySeed next() {- final yacySeed next = nextSeed;+ public Seed next() {+ final Seed next = nextSeed;nextSeed = nextInternal();return next;}@@ -410,21 +410,21 @@ public class PeerSelection {* @param count number of wanted peers* @return a hash map of peer hashes to seed object*/- public static Map<String, yacySeed> seedsByAge(final yacySeedDB seedDB, final boolean up, int count) {+ public static Map<String, Seed> seedsByAge(final SeedDB seedDB, final boolean up, int count) {if (count > seedDB.sizeConnected()) count = seedDB.sizeConnected();// fill a score objectfinal ScoreMap<String> seedScore = new ConcurrentScoreMap<String>();- yacySeed ys;+ Seed ys;long absage;- final Iterator<yacySeed> s = seedDB.seedsConnected(true, false, null, (float) 0.0);+ final Iterator<Seed> s = seedDB.seedsConnected(true, false, null, (float) 0.0);int searchcount = 1000;if (searchcount > seedDB.sizeConnected()) searchcount = seedDB.sizeConnected();try {while ((s.hasNext()) && (searchcount-- > 0)) {ys = s.next();- if ((ys != null) && (ys.get(yacySeed.LASTSEEN, "").length() > 10)) try {+ if ((ys != null) && (ys.get(Seed.LASTSEEN, "").length() > 10)) try {absage = Math.abs(System.currentTimeMillis() + AbstractFormatter.dayMillis - ys.getLastSeenUTC()) / 1000 / 60;if (absage > Integer.MAX_VALUE) absage = Integer.MAX_VALUE;seedScore.inc(ys.hash, (int) absage); // the higher absage, the older is the peer@@ -432,7 +432,7 @@ public class PeerSelection {}// result is now in the score object; create a result vector- final Map<String, yacySeed> result = new HashMap<String, yacySeed>();+ final Map<String, Seed> result = new HashMap<String, Seed>();final Iterator<String> it = seedScore.keys(up);int c = 0;while ((c < count) && (it.hasNext())) {@@ -442,7 +442,7 @@ public class PeerSelection {}return result;} catch (final kelondroException e) {- yacyCore.log.logSevere("Internal Error at yacySeedDB.seedsByAge: " + e.getMessage(), e);+ Network.log.logSevere("Internal Error at yacySeedDB.seedsByAge: " + e.getMessage(), e);return null;}}diff --git a/source/net/yacy/peers/dht/Transmission.java b/source/net/yacy/peers/dht/Transmission.javaindex 0ce4a4c47..57c62e95d 100644--- a/source/net/yacy/peers/dht/Transmission.java+++ b/source/net/yacy/peers/dht/Transmission.java@@ -40,9 +40,9 @@ import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.rwi.ReferenceContainer;import net.yacy.kelondro.rwi.ReferenceContainerCache;import net.yacy.kelondro.workflow.WorkflowJob;-import net.yacy.peers.yacyClient;-import net.yacy.peers.yacySeed;-import net.yacy.peers.yacySeedDB;+import net.yacy.peers.Protocol;+import net.yacy.peers.Seed;+import net.yacy.peers.SeedDB;import net.yacy.search.index.Segment;import java.util.List;@@ -52,14 +52,14 @@ public class Transmission {protected Log log;protected Segment segment;- protected yacySeedDB seeds;+ protected SeedDB seeds;protected boolean gzipBody4Transfer;protected int timeout4Transfer;public Transmission(Log log,Segment segment,- yacySeedDB seeds,+ SeedDB seeds,boolean gzipBody4Transfer,int timeout4Transfer) {this.log = log;@@ -69,7 +69,7 @@ public class Transmission {this.timeout4Transfer = timeout4Transfer;}- public Chunk newChunk(byte[] primaryTarget, final List<yacySeed> targets) {+ public Chunk newChunk(byte[] primaryTarget, final List<Seed> targets) {return new Chunk(primaryTarget, targets);}@@ -88,7 +88,7 @@ public class Transmission {private final ReferenceContainerCache<WordReference> containers;private final SortedMap<byte[], URIMetadataRow> references;private final HandleSet badReferences;- private final List<yacySeed> targets;+ private final List<Seed> targets;private int hit, miss;/**@@ -98,7 +98,7 @@ public class Transmission {* @param primaryTarget* @param targets*/- public Chunk(byte[] primaryTarget, final List<yacySeed> targets) {+ public Chunk(byte[] primaryTarget, final List<Seed> targets) {super();this.primaryTarget = primaryTarget;this.containers = new ReferenceContainerCache<WordReference>(Segment.wordReferenceFactory, Segment.wordOrder, Word.commonHashLength);@@ -184,7 +184,7 @@ public class Transmission {public boolean transmit() {if (this.targets.isEmpty()) return false;- yacySeed target = this.targets.remove(0);+ Seed target = this.targets.remove(0);// transferring selected words to remote peerif (target == seeds.mySeed() || target.hash.equals(seeds.mySeed().hash)) {// target is my own peer. This is easy. Just restore the indexContainer@@ -195,7 +195,7 @@ public class Transmission {}log.logInfo("starting new index transmission request to " + ASCII.String(this.primaryTarget));long start = System.currentTimeMillis();- final String error = yacyClient.transferIndex(target, this.containers, this.references, gzipBody4Transfer, timeout4Transfer);+ final String error = Protocol.transferIndex(target, this.containers, this.references, gzipBody4Transfer, timeout4Transfer);if (error == null) {// words successfully transferedlong transferTime = System.currentTimeMillis() - start;@@ -220,7 +220,7 @@ public class Transmission {// write information that peer does not receive index transmissionslog.logInfo("Transfer failed of chunk to target " + target.hash + "/" + target.getName() + ": " + error);// get possibly newer target Info- yacySeed newTarget = seeds.get(target.hash);+ Seed newTarget = seeds.get(target.hash);if (newTarget != null) {String oldAddress = target.getPublicAddress();if ((oldAddress != null) && (oldAddress.equals(newTarget.getPublicAddress()))) {diff --git a/source/net/yacy/peers/dht/VerticalWordPartitionScheme.java b/source/net/yacy/peers/dht/VerticalWordPartitionScheme.javaindex 6314f6080..85e41adbc 100755--- a/source/net/yacy/peers/dht/VerticalWordPartitionScheme.java+++ b/source/net/yacy/peers/dht/VerticalWordPartitionScheme.java@@ -27,7 +27,7 @@ package net.yacy.peers.dht;import net.yacy.cora.document.ASCII;import net.yacy.cora.document.UTF8;-import net.yacy.peers.yacySeed;+import net.yacy.peers.Seed;public class VerticalWordPartitionScheme implements PartitionScheme {@@ -108,7 +108,7 @@ public class VerticalWordPartitionScheme implements PartitionScheme {return l;}- public final long dhtDistance(final byte[] word, final String urlHash, final yacySeed peer) {+ public final long dhtDistance(final byte[] word, final String urlHash, final Seed peer) {return dhtDistance(word, urlHash, ASCII.getBytes(peer.hash));}diff --git a/source/net/yacy/peers/graphics/NetworkGraph.java b/source/net/yacy/peers/graphics/NetworkGraph.javaindex 9e1513674..7e6f99977 100644--- a/source/net/yacy/peers/graphics/NetworkGraph.java+++ b/source/net/yacy/peers/graphics/NetworkGraph.java@@ -37,10 +37,10 @@ import net.yacy.cora.document.ASCII;import net.yacy.cora.document.Hit;import net.yacy.cora.document.UTF8;import net.yacy.kelondro.logging.Log;-import net.yacy.peers.yacyChannel;-import net.yacy.peers.yacySearch;-import net.yacy.peers.yacySeed;-import net.yacy.peers.yacySeedDB;+import net.yacy.peers.EventChannel;+import net.yacy.peers.RemoteSearch;+import net.yacy.peers.Seed;+import net.yacy.peers.SeedDB;import net.yacy.peers.dht.FlatWordPartitionScheme;import net.yacy.search.Switchboard;import net.yacy.search.SwitchboardConstants;@@ -114,11 +114,11 @@ public class NetworkGraph {private static BufferedImage logo = null;private static long bannerPictureDate = 0;- public static RasterPlotter getSearchEventPicture(final yacySeedDB seedDB, final String eventID, final int coronaangle, final int cyc) {+ public static RasterPlotter getSearchEventPicture(final SeedDB seedDB, final String eventID, final int coronaangle, final int cyc) {final SearchEvent event = SearchEventCache.getEvent(eventID);if (event == null) return null;- final yacySearch[] primarySearches = event.getPrimarySearchThreads();- final yacySearch[] secondarySearches = event.getSecondarySearchThreads();+ final RemoteSearch[] primarySearches = event.getPrimarySearchThreads();+ final RemoteSearch[] secondarySearches = event.getSecondarySearchThreads();if (primarySearches == null) return null; // this was a local search and there are no threads// get a copy of a recent network picture@@ -134,7 +134,7 @@ public class NetworkGraph {int angle;// draw in the primary search peers- for (final yacySearch primarySearche : primarySearches) {+ for (final RemoteSearch primarySearche : primarySearches) {if (primarySearche == null) continue;eventPicture.setColor((primarySearche.isAlive()) ? RasterPlotter.RED : RasterPlotter.GREEN);angle = cyc + (int) (360.0 * (((double) FlatWordPartitionScheme.std.dhtPosition(UTF8.getBytes(primarySearche.target().hash), null)) / ((double) Long.MAX_VALUE)));@@ -143,7 +143,7 @@ public class NetworkGraph {// draw in the secondary search peersif (secondarySearches != null) {- for (final yacySearch secondarySearche : secondarySearches) {+ for (final RemoteSearch secondarySearche : secondarySearches) {if (secondarySearche == null) continue;eventPicture.setColor((secondarySearche.isAlive()) ? RasterPlotter.RED : RasterPlotter.GREEN);angle = cyc + (int) (360.0 * (((double) FlatWordPartitionScheme.std.dhtPosition(UTF8.getBytes(secondarySearche.target().hash), null)) / ((double) Long.MAX_VALUE)));@@ -167,12 +167,12 @@ public class NetworkGraph {return eventPicture;}- public static RasterPlotter getNetworkPicture(final yacySeedDB seedDB, final long maxAge, final int width, final int height, final int passiveLimit, final int potentialLimit, final int maxCount, final int coronaangle, final long communicationTimeout, final String networkName, final String networkTitle, final String bgcolor, final int cyc) {+ public static RasterPlotter getNetworkPicture(final SeedDB seedDB, final long maxAge, final int width, final int height, final int passiveLimit, final int potentialLimit, final int maxCount, final int coronaangle, final long communicationTimeout, final String networkName, final String networkTitle, final String bgcolor, final int cyc) {return drawNetworkPicture(seedDB, width, height, passiveLimit, potentialLimit, maxCount, coronaangle, communicationTimeout, networkName, networkTitle, bgcolor, cyc);}private static RasterPlotter drawNetworkPicture(- final yacySeedDB seedDB, final int width, final int height,+ final SeedDB seedDB, final int width, final int height,final int passiveLimit, final int potentialLimit,final int maxCount, final int coronaangle,final long communicationTimeout,@@ -194,13 +194,13 @@ public class NetworkGraph {//System.out.println("Seed Maximum distance is " + yacySeed.maxDHTDistance);//System.out.println("Seed Minimum distance is " + yacySeed.minDHTNumber);- yacySeed seed;+ Seed seed;long lastseen;// draw connected senior and principalsint count = 0;int totalCount = 0;- Iterator<yacySeed> e = seedDB.seedsConnected(true, false, null, (float) 0.0);+ Iterator<Seed> e = seedDB.seedsConnected(true, false, null, (float) 0.0);while (e.hasNext() && count < maxCount) {seed = e.next();if (seed == null) {@@ -215,7 +215,7 @@ public class NetworkGraph {// draw disconnected senior and principals that have been seen latelycount = 0;- e = seedDB.seedsSortedDisconnected(false, yacySeed.LASTSEEN);+ e = seedDB.seedsSortedDisconnected(false, Seed.LASTSEEN);while (e.hasNext() && count < maxCount) {seed = e.next();if (seed == null) {@@ -233,7 +233,7 @@ public class NetworkGraph {// draw juniors that have been seen latelycount = 0;- e = seedDB.seedsSortedPotential(false, yacySeed.LASTSEEN);+ e = seedDB.seedsSortedPotential(false, Seed.LASTSEEN);while (e.hasNext() && count < maxCount) {seed = e.next();if (seed == null) {@@ -255,14 +255,14 @@ public class NetworkGraph {// draw DHT activityif (communicationTimeout >= 0) {final Date horizon = new Date(System.currentTimeMillis() - communicationTimeout);- for (final Hit event: yacyChannel.channels(yacyChannel.DHTRECEIVE)) {+ for (final Hit event: EventChannel.channels(EventChannel.DHTRECEIVE)) {if (event == null || event.getPubDate() == null) continue;if (event.getPubDate().after(horizon)) {//System.out.println("*** NETWORK-DHTRECEIVE: " + event.getLink());drawNetworkPictureDHT(networkPicture, width / 2, height / 2, innerradius, seedDB.mySeed(), seedDB.get(event.getLink()), COL_DHTIN, coronaangle, false, cyc);}}- for (final Hit event: yacyChannel.channels(yacyChannel.DHTSEND)) {+ for (final Hit event: EventChannel.channels(EventChannel.DHTSEND)) {if (event == null || event.getPubDate() == null) continue;if (event.getPubDate().after(horizon)) {//System.out.println("*** NETWORK-DHTSEND: " + event.getLink());@@ -281,7 +281,7 @@ public class NetworkGraph {return networkPicture;}- private static void drawNetworkPictureDHT(final RasterPlotter img, final int centerX, final int centerY, final int innerradius, final yacySeed mySeed, final yacySeed otherSeed, final String colorLine, final int coronaangle, final boolean out, final int cyc) {+ private static void drawNetworkPictureDHT(final RasterPlotter img, final int centerX, final int centerY, final int innerradius, final Seed mySeed, final Seed otherSeed, final String colorLine, final int coronaangle, final boolean out, final int cyc) {final int angleMy = cyc + (int) (360.0 * (((double) FlatWordPartitionScheme.std.dhtPosition(ASCII.getBytes(mySeed.hash), null)) / ((double) Long.MAX_VALUE)));final int angleOther = cyc + (int) (360.0 * (((double) FlatWordPartitionScheme.std.dhtPosition(ASCII.getBytes(otherSeed.hash), null)) / ((double) Long.MAX_VALUE)));// draw line@@ -296,7 +296,7 @@ public class NetworkGraph {private static void drawNetworkPicturePeer(final RasterPlotter img, final int centerX, final int centerY,final int innerradius, final int outerradius,- final yacySeed seed,+ final Seed seed,final String colorDot, final String colorLine, final String colorText,final int coronaangle,final int cyc) {diff --git a/source/net/yacy/peers/operation/yacyRelease.java b/source/net/yacy/peers/operation/yacyRelease.javaindex 91d71cd74..00d0601ce 100644--- a/source/net/yacy/peers/operation/yacyRelease.java+++ b/source/net/yacy/peers/operation/yacyRelease.java@@ -59,7 +59,7 @@ import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.util.FileUtils;import net.yacy.kelondro.util.OS;-import net.yacy.peers.yacyCore;+import net.yacy.peers.Network;import net.yacy.search.Switchboard;import de.anomic.server.serverCore;import de.anomic.tools.CryptoLib;@@ -107,14 +107,14 @@ public final class yacyRelease extends yacyVersion {// check if release was installed by packagemanagerif (yacyBuildProperties.isPkgManager()) {- yacyCore.log.logInfo("rulebasedUpdateInfo: package manager is used for update");+ Network.log.logInfo("rulebasedUpdateInfo: package manager is used for update");return null;}// check if update process allows update retrievefinal String process = sb.getConfig("update.process", "manual");if ((!manual) && (!process.equals("auto"))) {- yacyCore.log.logInfo("rulebasedUpdateInfo: not an automatic update selected");+ Network.log.logInfo("rulebasedUpdateInfo: not an automatic update selected");return null; // no, its a manual or guided process}@@ -122,7 +122,7 @@ public final class yacyRelease extends yacyVersion {final long cycle = Math.max(1, sb.getConfigLong("update.cycle", 168)) * 60 * 60 * 1000; // update.cycle is hoursfinal long timeLookup = sb.getConfigLong("update.time.lookup", System.currentTimeMillis());if ((!manual) && (timeLookup + cycle > System.currentTimeMillis())) {- yacyCore.log.logInfo("rulebasedUpdateInfo: too early for a lookup for a new release (timeLookup = " + timeLookup + ", cycle = " + cycle + ", now = " + System.currentTimeMillis() + ")");+ Network.log.logInfo("rulebasedUpdateInfo: too early for a lookup for a new release (timeLookup = " + timeLookup + ", cycle = " + cycle + ", now = " + System.currentTimeMillis() + ")");return null; // no we have recently made a lookup}@@ -145,7 +145,7 @@ public final class yacyRelease extends yacyVersion {(!(Float.toString(latestdev.getReleaseNr()).matches(blacklist)))) {// consider a dev-releaseif (latestdev.compareTo(thisVersion()) <= 0) {- yacyCore.log.logInfo(+ Network.log.logInfo("rulebasedUpdateInfo: latest dev " + latestdev.getName() +" is not more recent than installed release " + thisVersion().getName());return null;@@ -155,13 +155,13 @@ public final class yacyRelease extends yacyVersion {if (latestmain != null) {// consider a main releaseif ((Float.toString(latestmain.getReleaseNr()).matches(blacklist))) {- yacyCore.log.logInfo(+ Network.log.logInfo("rulebasedUpdateInfo: latest dev " + (latestdev == null ? "null" : latestdev.getName()) +" matches with blacklist '" + blacklist + "'");return null;}if (latestmain.compareTo(thisVersion()) <= 0) {- yacyCore.log.logInfo(+ Network.log.logInfo("rulebasedUpdateInfo: latest main " + latestmain.getName() +" is not more recent than installed release (1) " + thisVersion().getName());return null;@@ -172,20 +172,20 @@ public final class yacyRelease extends yacyVersion {if ((concept.equals("main")) && (latestmain != null)) {// return a main-releaseif ((Float.toString(latestmain.getReleaseNr()).matches(blacklist))) {- yacyCore.log.logInfo(+ Network.log.logInfo("rulebasedUpdateInfo: latest main " + latestmain.getName() +" matches with blacklist'" + blacklist + "'");return null;}if (latestmain.compareTo(thisVersion()) <= 0) {- yacyCore.log.logInfo(+ Network.log.logInfo("rulebasedUpdateInfo: latest main " + latestmain.getName() +" is not more recent than installed release (2) " + thisVersion().getName());return null;}return latestmain;}- yacyCore.log.logInfo("rulebasedUpdateInfo: failed to find more recent release");+ Network.log.logInfo("rulebasedUpdateInfo: failed to find more recent release");return null;}diff --git a/source/net/yacy/peers/yacyNetwork.java b/source/net/yacy/peers/yacyNetwork.javadeleted file mode 100644index a426d89cf..000000000--- a/source/net/yacy/peers/yacyNetwork.java+++ /dev/null@@ -1,117 +0,0 @@-// yacyNetwork.java-// -----------------// (C) 2007 by Michael Peter Christen; [email protected], Frankfurt a. M., Germany-// first published 04.07.2007 on http://yacy.net-//-// This is a part of YaCy, a peer-to-peer based web search engine-//-// $LastChangedDate$-// $LastChangedRevision$-// $LastChangedBy$-//-// LICENSE-//-// 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-// the Free Software Foundation; either version 2 of the License, or-// (at your option) any later version.-//-// This program is distributed in the hope that it will be useful,-// but WITHOUT ANY WARRANTY; without even the implied warranty of-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-// GNU General Public License for more details.-//-// You should have received a copy of the GNU General Public License-// along with this program; if not, write to the Free Software-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA--package net.yacy.peers;--import java.util.LinkedHashMap;--import net.yacy.cora.date.GenericFormatter;-import net.yacy.cora.document.UTF8;-import net.yacy.kelondro.order.Digest;-import net.yacy.search.Switchboard;-import net.yacy.search.SwitchboardConstants;--import org.apache.http.entity.mime.content.ContentBody;--import de.anomic.server.serverObjects;-import de.anomic.server.serverSwitch;--public class yacyNetwork {-- public static final boolean authentifyRequest(final serverObjects post, final serverSwitch env) {- if (post == null || env == null) return false;-- // identify network- final String unitName = post.get(SwitchboardConstants.NETWORK_NAME, yacySeed.DFLT_NETWORK_UNIT); // the network unit- if (!unitName.equals(env.getConfig(SwitchboardConstants.NETWORK_NAME, yacySeed.DFLT_NETWORK_UNIT))) {- return false;- }-- // check authentication method- final String authenticationControl = env.getConfig("network.unit.protocol.control", "uncontrolled");- if (authenticationControl.equals("uncontrolled")) return true;- final String authenticationMethod = env.getConfig("network.unit.protocol.request.authentication.method", "");- if (authenticationMethod.length() == 0) {- return false;- }- if (authenticationMethod.equals("salted-magic-sim")) {- // authorize the peer using the md5-magic- final String salt = post.get("key", "");- final String iam = post.get("iam", "");- final String magic = env.getConfig("network.unit.protocol.request.authentication.essentials", "");- final String md5 = Digest.encodeMD5Hex(salt + iam + magic);- return post.get("magicmd5", "").equals(md5);- }-- // unknown authentication method- return false;- }-- public static final LinkedHashMap<String,ContentBody> basicRequestParts(final Switchboard sb, final String targetHash, final String salt) {- // put in all the essentials for routing and network authentication- // generate a session key- final LinkedHashMap<String,ContentBody> parts = basicRequestParts(sb.peers.mySeed().hash, targetHash, Switchboard.getSwitchboard().getConfig(SwitchboardConstants.NETWORK_NAME, yacySeed.DFLT_NETWORK_UNIT));- parts.put("key", UTF8.StringBody(salt));-- // authentication essentials- final String authenticationControl = sb.getConfig("network.unit.protocol.control", "uncontrolled");- final String authenticationMethod = sb.getConfig("network.unit.protocol.request.authentication.method", "");- if ((authenticationControl.equals("controlled")) && (authenticationMethod.length() > 0)) {- if (authenticationMethod.equals("salted-magic-sim")) {- // generate an authentication essential using the salt, the iam-hash and the network magic- final String magic = sb.getConfig("network.unit.protocol.request.authentication.essentials", "");- final String md5 = Digest.encodeMD5Hex(salt + sb.peers.mySeed().hash + magic);- parts.put("magicmd5", UTF8.StringBody(md5));- }- }-- return parts;- }-- public static final LinkedHashMap<String,ContentBody> basicRequestParts(String myHash, String targetHash, String networkName) {- // put in all the essentials for routing and network authentication- // generate a session key- final LinkedHashMap<String,ContentBody> parts = new LinkedHashMap<String,ContentBody>();-- // just standard identification essentials- if (myHash != null) {- parts.put("iam", UTF8.StringBody(myHash));- if (targetHash != null) parts.put("youare", UTF8.StringBody(targetHash));-- // time information for synchronization- // use our own formatter to prevent concurrency locks with other processes- GenericFormatter my_SHORT_SECOND_FORMATTER = new GenericFormatter(GenericFormatter.FORMAT_SHORT_SECOND, GenericFormatter.time_second);- parts.put("mytime", UTF8.StringBody(my_SHORT_SECOND_FORMATTER.format()));- parts.put("myUTC", UTF8.StringBody(Long.toString(System.currentTimeMillis())));-- // network identification- parts.put(SwitchboardConstants.NETWORK_NAME, UTF8.StringBody(networkName));- }-- return parts;- }-}diff --git a/source/net/yacy/search/Switchboard.java b/source/net/yacy/search/Switchboard.javaindex 72bd822df..f3fe45ca3 100644--- a/source/net/yacy/search/Switchboard.java+++ b/source/net/yacy/search/Switchboard.java@@ -128,12 +128,12 @@ import net.yacy.kelondro.workflow.InstantBusyThread;import net.yacy.kelondro.workflow.WorkflowJob;import net.yacy.kelondro.workflow.WorkflowProcessor;import net.yacy.kelondro.workflow.WorkflowThread;-import net.yacy.peers.yacyChannel;-import net.yacy.peers.yacyClient;-import net.yacy.peers.yacyCore;-import net.yacy.peers.yacyNewsPool;-import net.yacy.peers.yacySeed;-import net.yacy.peers.yacySeedDB;+import net.yacy.peers.EventChannel;+import net.yacy.peers.Network;+import net.yacy.peers.NewsPool;+import net.yacy.peers.Protocol;+import net.yacy.peers.Seed;+import net.yacy.peers.SeedDB;import net.yacy.peers.dht.Dispatcher;import net.yacy.peers.dht.PeerSelection;import net.yacy.peers.graphics.WebStructureGraph;@@ -225,7 +225,7 @@ public final class Switchboard extends serverSwitch {public RobotsTxt robots;public Map<String, Object[]> outgoingCookies, incomingCookies;public volatile long proxyLastAccess, localSearchLastAccess, remoteSearchLastAccess;- public yacyCore yc;+ public Network yc;public ResourceObserver observer;public UserDB userDB;public BookmarksDB bookmarksDB;@@ -241,7 +241,7 @@ public final class Switchboard extends serverSwitch {public FilterEngine domainList;private Dispatcher dhtDispatcher;public LinkedBlockingQueue<String> trail;- public yacySeedDB peers;+ public SeedDB peers;public WorkTables tables;public WorkflowProcessor<indexingQueueEntry> indexingDocumentProcessor;@@ -282,7 +282,7 @@ public final class Switchboard extends serverSwitch {setLog(new Log("YACY_SEARCH"));// set default peer name- yacySeed.ANON_PREFIX = getConfig("peernameprefix", "_anon");+ Seed.ANON_PREFIX = getConfig("peernameprefix", "_anon");// UPnP port mappingif (getConfigBool(SwitchboardConstants.UPNP_ENABLED, false)) {@@ -355,8 +355,8 @@ public final class Switchboard extends serverSwitch {this.queuesRoot = new File(new File(indexPath, networkName), "QUEUES");this.networkRoot.mkdirs();this.queuesRoot.mkdirs();- final File mySeedFile = new File(this.networkRoot, yacySeedDB.DBFILE_OWN_SEED);- this.peers = new yacySeedDB(+ final File mySeedFile = new File(this.networkRoot, SeedDB.DBFILE_OWN_SEED);+ this.peers = new SeedDB(this.networkRoot,"seed.new.heap","seed.old.heap",@@ -404,8 +404,8 @@ public final class Switchboard extends serverSwitch {// start yacy corethis.log.logConfig("Starting YaCy Protocol Core");- this.yc = new yacyCore(this);- InstantBusyThread.oneTimeJob(this, "loadSeedLists", yacyCore.log, 0);+ this.yc = new Network(this);+ InstantBusyThread.oneTimeJob(this, "loadSeedLists", Network.log, 0);//final long startedSeedListAquisition = System.currentTimeMillis();// init a DHT transmission dispatcher@@ -1171,7 +1171,7 @@ public final class Switchboard extends serverSwitch {}}- public boolean isInMyCluster(final yacySeed seed) {+ public boolean isInMyCluster(final Seed seed) {// check if the given peer is in the own network, if this is a robinson cluster// if this robinson mode does not define a cluster membership, false is returnedif (seed == null) return false;@@ -1730,24 +1730,24 @@ public final class Switchboard extends serverSwitch {checkInterruption();try {if (this.log.isFine()) {- this.log.logFine("Cleaning Incoming News, " + this.peers.newsPool.size(yacyNewsPool.INCOMING_DB) + " entries on stack");+ this.log.logFine("Cleaning Incoming News, " + this.peers.newsPool.size(NewsPool.INCOMING_DB) + " entries on stack");}this.peers.newsPool.automaticProcess(this.peers);} catch (final Exception e) {Log.logException(e);}if (getConfigBool("cleanup.deletionProcessedNews", true)) {- this.peers.newsPool.clear(yacyNewsPool.PROCESSED_DB);+ this.peers.newsPool.clear(NewsPool.PROCESSED_DB);}if (getConfigBool("cleanup.deletionPublishedNews", true)) {- this.peers.newsPool.clear(yacyNewsPool.PUBLISHED_DB);+ this.peers.newsPool.clear(NewsPool.PUBLISHED_DB);}// clean up seed-dbsif (getConfigBool("routing.deleteOldSeeds.permission",true)) {final long deleteOldSeedsTime = getConfigLong("routing.deleteOldSeeds.time",7)*24*3600000;- Iterator<yacySeed> e = this.peers.seedsSortedDisconnected(true,yacySeed.LASTSEEN);- yacySeed seed = null;+ Iterator<Seed> e = this.peers.seedsSortedDisconnected(true,Seed.LASTSEEN);+ Seed seed = null;final List<String> deleteQueue = new ArrayList<String>();checkInterruption();// clean passive seeds@@ -1761,7 +1761,7 @@ public final class Switchboard extends serverSwitch {}for (int i = 0; i < deleteQueue.size(); ++i) this.peers.removeDisconnected(deleteQueue.get(i));deleteQueue.clear();- e = this.peers.seedsSortedPotential(true,yacySeed.LASTSEEN);+ e = this.peers.seedsSortedPotential(true,Seed.LASTSEEN);checkInterruption();// clean potential seedswhile (e.hasNext()) {@@ -1795,7 +1795,7 @@ public final class Switchboard extends serverSwitch {}// initiate broadcast about peer startup to spread supporter url- if (!isRobinsonMode() && this.peers.newsPool.size(yacyNewsPool.OUTGOING_DB) == 0) {+ if (!isRobinsonMode() && this.peers.newsPool.size(NewsPool.OUTGOING_DB) == 0) {// read profilefinal Properties profile = new Properties();FileInputStream fileIn = null;@@ -1814,7 +1814,7 @@ public final class Switchboard extends serverSwitch {if ((homepage != null) && (homepage.length() > 10)) {final Properties news = new Properties();news.put("homepage", profile.get("homepage"));- this.peers.newsPool.publishMyNews(this.peers.mySeed(), yacyNewsPool.CATEGORY_PROFILE_BROADCAST, news);+ this.peers.newsPool.publishMyNews(this.peers.mySeed(), NewsPool.CATEGORY_PROFILE_BROADCAST, news);}}@@ -2123,7 +2123,7 @@ public final class Switchboard extends serverSwitch {condenser,searchEvent,sourceName);- final RSSFeed feed = yacyChannel.channels(queueEntry.initiator() == null ? yacyChannel.PROXY : Base64Order.enhancedCoder.equal(queueEntry.initiator(), ASCII.getBytes(this.peers.mySeed().hash)) ? yacyChannel.LOCALINDEXING : yacyChannel.REMOTEINDEXING);+ final RSSFeed feed = EventChannel.channels(queueEntry.initiator() == null ? EventChannel.PROXY : Base64Order.enhancedCoder.equal(queueEntry.initiator(), ASCII.getBytes(this.peers.mySeed().hash)) ? EventChannel.LOCALINDEXING : EventChannel.REMOTEINDEXING);feed.addMessage(new RSSMessage("Indexed web page", dc_title, queueEntry.url().toNormalform(true, false)));} catch (final IOException e) {//if (this.log.isFine()) log.logFine("Not Indexed Resource '" + queueEntry.url().toNormalform(false, true) + "': process case=" + processCase);@@ -2167,7 +2167,7 @@ public final class Switchboard extends serverSwitch {// if this was performed for a remote crawl request, notify requesterif ((processCase == EventOrigin.GLOBAL_CRAWLING) && (queueEntry.initiator() != null)) {- final yacySeed initiatorPeer = this.peers.get(ASCII.String(queueEntry.initiator()));+ final Seed initiatorPeer = this.peers.get(ASCII.String(queueEntry.initiator()));if (initiatorPeer != null) {if (this.clusterhashes != null) {initiatorPeer.setAlternativeAddress(this.clusterhashes.get(queueEntry.initiator()));@@ -2270,16 +2270,16 @@ public final class Switchboard extends serverSwitch {}public class receiptSending implements Runnable {- private final yacySeed initiatorPeer;+ private final Seed initiatorPeer;private final URIMetadataRow reference;- public receiptSending(final yacySeed initiatorPeer, final URIMetadataRow reference) {+ public receiptSending(final Seed initiatorPeer, final URIMetadataRow reference) {this.initiatorPeer = initiatorPeer;this.reference = reference;}public void run() {final long t = System.currentTimeMillis();- final Map<String, String> response = yacyClient.crawlReceipt(Switchboard.this.peers.mySeed(), this.initiatorPeer, "crawl", "fill", "indexed", this.reference, "");+ final Map<String, String> response = Protocol.crawlReceipt(Switchboard.this.peers.mySeed(), this.initiatorPeer, "crawl", "fill", "indexed", this.reference, "");if (response == null) {Switchboard.this.log.logInfo("Sending crawl receipt for '" + this.reference.metadata().url().toNormalform(false, true) + "' to " + this.initiatorPeer.getName() + " FAILED, send time = " + (System.currentTimeMillis() - t));return;@@ -2680,23 +2680,23 @@ public final class Switchboard extends serverSwitch {}public void updateMySeed() {- this.peers.mySeed().put(yacySeed.PORT, Integer.toString(serverCore.getPortNr(getConfig("port", "8090"))));+ this.peers.mySeed().put(Seed.PORT, Integer.toString(serverCore.getPortNr(getConfig("port", "8090"))));//the speed of indexing (pages/minute) of the peerfinal long uptime = (System.currentTimeMillis() - serverCore.startupTime) / 1000;- this.peers.mySeed().put(yacySeed.ISPEED, Integer.toString(currentPPM()));- this.peers.mySeed().put(yacySeed.RSPEED, Float.toString(averageQPM()));- this.peers.mySeed().put(yacySeed.UPTIME, Long.toString(uptime/60)); // the number of minutes that the peer is up in minutes/day (moving average MA30)- this.peers.mySeed().put(yacySeed.LCOUNT, Long.toString(this.indexSegments.URLCount())); // the number of links that the peer has stored (LURL's)- this.peers.mySeed().put(yacySeed.NCOUNT, Integer.toString(this.crawlQueues.noticeURL.size())); // the number of links that the peer has noticed, but not loaded (NURL's)- this.peers.mySeed().put(yacySeed.RCOUNT, Integer.toString(this.crawlQueues.noticeURL.stackSize(NoticedURL.StackType.LIMIT))); // the number of links that the peer provides for remote crawling (ZURL's)- this.peers.mySeed().put(yacySeed.ICOUNT, Long.toString(this.indexSegments.RWICount())); // the minimum number of words that the peer has indexed (as it says)- this.peers.mySeed().put(yacySeed.SCOUNT, Integer.toString(this.peers.sizeConnected())); // the number of seeds that the peer has stored- this.peers.mySeed().put(yacySeed.CCOUNT, Float.toString(((int) ((this.peers.sizeConnected() + this.peers.sizeDisconnected() + this.peers.sizePotential()) * 60.0f / (uptime + 1.01f)) * 100.0f) / 100.0f)); // the number of clients that the peer connects (as connects/hour)- this.peers.mySeed().put(yacySeed.VERSION, yacyBuildProperties.getLongVersion());+ this.peers.mySeed().put(Seed.ISPEED, Integer.toString(currentPPM()));+ this.peers.mySeed().put(Seed.RSPEED, Float.toString(averageQPM()));+ this.peers.mySeed().put(Seed.UPTIME, Long.toString(uptime/60)); // the number of minutes that the peer is up in minutes/day (moving average MA30)+ this.peers.mySeed().put(Seed.LCOUNT, Long.toString(this.indexSegments.URLCount())); // the number of links that the peer has stored (LURL's)+ this.peers.mySeed().put(Seed.NCOUNT, Integer.toString(this.crawlQueues.noticeURL.size())); // the number of links that the peer has noticed, but not loaded (NURL's)+ this.peers.mySeed().put(Seed.RCOUNT, Integer.toString(this.crawlQueues.noticeURL.stackSize(NoticedURL.StackType.LIMIT))); // the number of links that the peer provides for remote crawling (ZURL's)+ this.peers.mySeed().put(Seed.ICOUNT, Long.toString(this.indexSegments.RWICount())); // the minimum number of words that the peer has indexed (as it says)+ this.peers.mySeed().put(Seed.SCOUNT, Integer.toString(this.peers.sizeConnected())); // the number of seeds that the peer has stored+ this.peers.mySeed().put(Seed.CCOUNT, Float.toString(((int) ((this.peers.sizeConnected() + this.peers.sizeDisconnected() + this.peers.sizePotential()) * 60.0f / (uptime + 1.01f)) * 100.0f) / 100.0f)); // the number of clients that the peer connects (as connects/hour)+ this.peers.mySeed().put(Seed.VERSION, yacyBuildProperties.getLongVersion());this.peers.mySeed().setFlagDirectConnect(true);this.peers.mySeed().setLastSeenUTC();- this.peers.mySeed().put(yacySeed.UTC, GenericFormatter.UTCDiffString());+ this.peers.mySeed().put(Seed.UTC, GenericFormatter.UTCDiffString());this.peers.mySeed().setFlagAcceptRemoteCrawl(getConfig("crawlResponse", "").equals("true"));this.peers.mySeed().setFlagAcceptRemoteIndex(getConfig("allowReceiveIndex", "").equals("true"));//mySeed.setFlagAcceptRemoteIndex(true);@@ -2705,7 +2705,7 @@ public final class Switchboard extends serverSwitch {public void loadSeedLists() {// uses the superseed to initialize the database with known seeds- yacySeed ys;+ Seed ys;String seedListFileURL;DigestURI url;Iterator<String> enu;@@ -2721,7 +2721,7 @@ public final class Switchboard extends serverSwitch {client.setHeader(reqHeader.entrySet());client.setTimout((int) getConfigLong("bootstrapLoadTimeout", 20000));- yacyCore.log.logInfo("BOOTSTRAP: " + sc + " seeds known from previous run");+ Network.log.logInfo("BOOTSTRAP: " + sc + " seeds known from previous run");// - use the superseed to further fill up the seedDBint ssc = 0, c = 0;@@ -2753,9 +2753,9 @@ public final class Switchboard extends serverSwitch {yacyCore.log.logWarning("BOOTSTRAP: seed-list URL " + seedListFileURL + " not available, no content");}} else*/ if (header.lastModified() == null) {- yacyCore.log.logWarning("BOOTSTRAP: seed-list URL " + seedListFileURL + " not usable, last-modified is missing");+ Network.log.logWarning("BOOTSTRAP: seed-list URL " + seedListFileURL + " not usable, last-modified is missing");} else if ((header.age() > 86400000) && (ssc > 0)) {- yacyCore.log.logInfo("BOOTSTRAP: seed-list URL " + seedListFileURL + " too old (" + (header.age() / 86400000) + " days)");+ Network.log.logInfo("BOOTSTRAP: seed-list URL " + seedListFileURL + " too old (" + (header.age() / 86400000) + " days)");} else {ssc++;final byte[] content = client.GETbytes(url);@@ -2763,7 +2763,7 @@ public final class Switchboard extends serverSwitch {lc = 0;while (enu.hasNext()) {try {- ys = yacySeed.genRemoteSeed(enu.next(), null, false, null);+ ys = Seed.genRemoteSeed(enu.next(), null, false, null);if ((ys != null) &&(!this.peers.mySeedIsDefined() || !this.peers.mySeed().hash.equals(ys.hash))) {final long lastseen = Math.abs((System.currentTimeMillis() - ys.getLastSeenUTC()) / 1000 / 60);@@ -2774,22 +2774,22 @@ public final class Switchboard extends serverSwitch {}}} catch (final IOException e) {- yacyCore.log.logInfo("BOOTSTRAP: bad seed: " + e.getMessage());+ Network.log.logInfo("BOOTSTRAP: bad seed: " + e.getMessage());}}- yacyCore.log.logInfo("BOOTSTRAP: " + lc + " seeds from seed-list URL " + seedListFileURL + ", AGE=" + (header.age() / 3600000) + "h");+ Network.log.logInfo("BOOTSTRAP: " + lc + " seeds from seed-list URL " + seedListFileURL + ", AGE=" + (header.age() / 3600000) + "h");}} catch (final IOException e) {// this is when wget fails, commonly because of timeout- yacyCore.log.logWarning("BOOTSTRAP: failed (1) to load seeds from seed-list URL " + seedListFileURL + ": " + e.getMessage());+ Network.log.logWarning("BOOTSTRAP: failed (1) to load seeds from seed-list URL " + seedListFileURL + ": " + e.getMessage());} catch (final Exception e) {// this is when wget fails; may be because of missing internet connection- yacyCore.log.logSevere("BOOTSTRAP: failed (2) to load seeds from seed-list URL " + seedListFileURL + ": " + e.getMessage(), e);+ Network.log.logSevere("BOOTSTRAP: failed (2) to load seeds from seed-list URL " + seedListFileURL + ": " + e.getMessage(), e);}}}- yacyCore.log.logInfo("BOOTSTRAP: " + (this.peers.sizeConnected() - sc) + " new seeds while bootstraping.");+ Network.log.logInfo("BOOTSTRAP: " + (this.peers.sizeConnected() - sc) + " new seeds while bootstraping.");}public void initRemoteProxy() {diff --git a/source/net/yacy/search/query/QueryParams.java b/source/net/yacy/search/query/QueryParams.javaindex 97f9c6b95..349675fee 100644--- a/source/net/yacy/search/query/QueryParams.java+++ b/source/net/yacy/search/query/QueryParams.java@@ -54,7 +54,7 @@ import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.order.Bitfield;import net.yacy.kelondro.order.NaturalOrder;import net.yacy.kelondro.util.SetTools;-import net.yacy.peers.yacySeed;+import net.yacy.peers.Seed;import net.yacy.search.index.Segment;import net.yacy.search.ranking.RankingProfile;import net.yacy.search.snippet.ContentDomain;@@ -102,7 +102,7 @@ public final class QueryParams {public final String sitehash; // this is a domain hash, 6 bytes long or nullpublic final String authorhash;public final String tenant;- public yacySeed remotepeer;+ public Seed remotepeer;public final Long time;// values that are set after a search:public int resultcount; // number of found resultsdiff --git a/source/net/yacy/search/query/SearchEvent.java b/source/net/yacy/search/query/SearchEvent.javaindex 3594ee92b..3460a5c14 100644--- a/source/net/yacy/search/query/SearchEvent.java+++ b/source/net/yacy/search/query/SearchEvent.java@@ -47,8 +47,8 @@ import net.yacy.kelondro.rwi.ReferenceContainer;import net.yacy.kelondro.util.EventTracker;import net.yacy.kelondro.util.MemoryControl;import net.yacy.kelondro.util.SetTools;-import net.yacy.peers.yacySearch;-import net.yacy.peers.yacySeedDB;+import net.yacy.peers.RemoteSearch;+import net.yacy.peers.SeedDB;import net.yacy.peers.dht.FlatWordPartitionScheme;import net.yacy.peers.graphics.ProfilingGraph;import net.yacy.repository.LoaderDispatcher;@@ -70,7 +70,7 @@ public final class SearchEvent {// class variables that may be implemented with an abstract classprivate long eventTime;private QueryParams query;- private final yacySeedDB peers;+ private final SeedDB peers;private final WorkTables workTables;private RWIProcess rankingProcess; // ordered search results, grows dynamically as all the query threads enrich this containerprivate SnippetProcess resultFetcher;@@ -78,7 +78,7 @@ public final class SearchEvent {private final SecondarySearchSuperviser secondarySearchSuperviser;// class variables for remote searches- private yacySearch[] primarySearchThreads, secondarySearchThreads;+ private RemoteSearch[] primarySearchThreads, secondarySearchThreads;private final SortedMap<byte[], String> preselectedPeerHashes;private final Thread localSearchThread;private final SortedMap<byte[], Integer> IACount;@@ -88,7 +88,7 @@ public final class SearchEvent {private final ReferenceOrder order;protected SearchEvent(final QueryParams query,- final yacySeedDB peers,+ final SeedDB peers,final WorkTables workTables,final SortedMap<byte[], String> preselectedPeerHashes,final boolean generateAbstracts,@@ -128,7 +128,7 @@ public final class SearchEvent {// start global searchesfinal long timer = System.currentTimeMillis();- this.primarySearchThreads = (query.queryHashes.isEmpty()) ? null : yacySearch.primaryRemoteSearches(+ this.primarySearchThreads = (query.queryHashes.isEmpty()) ? null : RemoteSearch.primaryRemoteSearches(QueryParams.hashSet2hashString(query.queryHashes),QueryParams.hashSet2hashString(query.excludeHashes),query.prefer,@@ -245,14 +245,14 @@ public final class SearchEvent {// stop all threadsif (this.primarySearchThreads != null) {- for (final yacySearch search : this.primarySearchThreads) {+ for (final RemoteSearch search : this.primarySearchThreads) {if (search != null) synchronized (search) {if (search.isAlive()) search.interrupt();}}}if (this.secondarySearchThreads != null) {- for (final yacySearch search : this.secondarySearchThreads) {+ for (final RemoteSearch search : this.secondarySearchThreads) {if (search != null) synchronized (search) {if (search.isAlive()) search.interrupt();}@@ -308,24 +308,24 @@ public final class SearchEvent {boolean anyRemoteSearchAlive() {// check primary search threadsif ((this.primarySearchThreads != null) && (this.primarySearchThreads.length != 0)) {- for (final yacySearch primarySearchThread : this.primarySearchThreads) {+ for (final RemoteSearch primarySearchThread : this.primarySearchThreads) {if ((primarySearchThread != null) && (primarySearchThread.isAlive())) return true;}}// maybe a secondary search thread is alive, check thisif ((this.secondarySearchThreads != null) && (this.secondarySearchThreads.length != 0)) {- for (final yacySearch secondarySearchThread : this.secondarySearchThreads) {+ for (final RemoteSearch secondarySearchThread : this.secondarySearchThreads) {if ((secondarySearchThread != null) && (secondarySearchThread.isAlive())) return true;}}return false;}- public yacySearch[] getPrimarySearchThreads() {+ public RemoteSearch[] getPrimarySearchThreads() {return this.primarySearchThreads;}- public yacySearch[] getSecondarySearchThreads() {+ public RemoteSearch[] getSecondarySearchThreads() {return this.secondarySearchThreads;}@@ -548,7 +548,7 @@ public final class SearchEvent {// compute words for secondary search and start the secondary searchesString words;- SearchEvent.this.secondarySearchThreads = new yacySearch[(mypeerinvolved) ? secondarySearchURLs.size() - 1 : secondarySearchURLs.size()];+ SearchEvent.this.secondarySearchThreads = new RemoteSearch[(mypeerinvolved) ? secondarySearchURLs.size() - 1 : secondarySearchURLs.size()];int c = 0;for (final Map.Entry<String, StringBuilder> entry: secondarySearchURLs.entrySet()) {peer = entry.getKey();@@ -561,7 +561,7 @@ public final class SearchEvent {//System.out.println("DEBUG-INDEXABSTRACT ***: peer " + peer + " has urls: " + urls + " from words: " + words);SearchEvent.this.rankingProcess.moreFeeders(1);this.checkedPeers.add(peer);- SearchEvent.this.secondarySearchThreads[c++] = yacySearch.secondaryRemoteSearch(+ SearchEvent.this.secondarySearchThreads[c++] = RemoteSearch.secondaryRemoteSearch(words, urls.toString(), 6000, SearchEvent.this.query.getSegment(), SearchEvent.this.peers, SearchEvent.this.rankingProcess, peer, Switchboard.urlBlacklist,SearchEvent.this.query.ranking, SearchEvent.this.query.constraint, SearchEvent.this.preselectedPeerHashes);}diff --git a/source/net/yacy/search/query/SearchEventCache.java b/source/net/yacy/search/query/SearchEventCache.javaindex 8e5a6e1e2..40afda8ef 100644--- a/source/net/yacy/search/query/SearchEventCache.java+++ b/source/net/yacy/search/query/SearchEventCache.java@@ -34,7 +34,7 @@ import java.util.concurrent.ConcurrentMap;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.util.MemoryControl;-import net.yacy.peers.yacySeedDB;+import net.yacy.peers.SeedDB;import net.yacy.repository.LoaderDispatcher;import net.yacy.search.Switchboard;import net.yacy.search.index.Segment;@@ -115,7 +115,7 @@ public class SearchEventCache {public static SearchEvent getEvent(final QueryParams query,- final yacySeedDB peers,+ final SeedDB peers,final WorkTables workTables,final SortedMap<byte[], String> preselectedPeerHashes,final boolean generateAbstracts,diff --git a/source/net/yacy/search/query/SnippetProcess.java b/source/net/yacy/search/query/SnippetProcess.javaindex cca0e5eef..913924b12 100644--- a/source/net/yacy/search/query/SnippetProcess.java+++ b/source/net/yacy/search/query/SnippetProcess.java@@ -47,7 +47,7 @@ import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.util.EventTracker;import net.yacy.kelondro.util.MemoryControl;-import net.yacy.peers.yacySeedDB;+import net.yacy.peers.SeedDB;import net.yacy.peers.graphics.ProfilingGraph;import net.yacy.repository.LoaderDispatcher;import net.yacy.search.Switchboard;@@ -67,7 +67,7 @@ public class SnippetProcess {// input valuesfinal RWIProcess rankingProcess; // ordered search results, grows dynamically as all the query threads enrich this containerQueryParams query;- private final yacySeedDB peers;+ private final SeedDB peers;private final WorkTables workTables;// result values@@ -86,7 +86,7 @@ public class SnippetProcess {final LoaderDispatcher loader,final RWIProcess rankedCache,final QueryParams query,- final yacySeedDB peers,+ final SeedDB peers,final WorkTables workTables,final int taketimeout,final boolean deleteIfSnippetFail) {diff --git a/source/net/yacy/search/ranking/BlockRank.java b/source/net/yacy/search/ranking/BlockRank.javaindex 79fc98f28..536215667 100644--- a/source/net/yacy/search/ranking/BlockRank.java+++ b/source/net/yacy/search/ranking/BlockRank.java@@ -44,9 +44,9 @@ import net.yacy.kelondro.rwi.ReferenceContainer;import net.yacy.kelondro.rwi.ReferenceContainerCache;import net.yacy.kelondro.rwi.ReferenceIterator;import net.yacy.kelondro.util.FileUtils;-import net.yacy.peers.yacyClient;-import net.yacy.peers.yacySeed;-import net.yacy.peers.yacySeedDB;+import net.yacy.peers.Protocol;+import net.yacy.peers.Seed;+import net.yacy.peers.SeedDB;import net.yacy.peers.graphics.WebStructureGraph;import net.yacy.peers.graphics.WebStructureGraph.HostReference;import net.yacy.search.index.Segment;@@ -64,12 +64,12 @@ public class BlockRank {* @param seeds* @return a merged host index from all peers*/- public static ReferenceContainerCache<HostReference> collect(final yacySeedDB seeds, final WebStructureGraph myGraph) {+ public static ReferenceContainerCache<HostReference> collect(final SeedDB seeds, final WebStructureGraph myGraph) {ReferenceContainerCache<HostReference> index = new ReferenceContainerCache<HostReference>(WebStructureGraph.hostReferenceFactory, Base64Order.enhancedCoder, 6);// start all jobs- Iterator<yacySeed> si = seeds.seedsConnected(true, false, null, 0.99f);+ Iterator<Seed> si = seeds.seedsConnected(true, false, null, 0.99f);ArrayList<IndexRetrieval> jobs = new ArrayList<IndexRetrieval>();while (si.hasNext()) {IndexRetrieval loader = new IndexRetrieval(index, si.next());@@ -98,15 +98,15 @@ public class BlockRank {public static class IndexRetrieval extends Thread {ReferenceContainerCache<HostReference> index;- yacySeed seed;+ Seed seed;- public IndexRetrieval(ReferenceContainerCache<HostReference> index, yacySeed seed) {+ public IndexRetrieval(ReferenceContainerCache<HostReference> index, Seed seed) {this.index = index;this.seed = seed;}public void run() {- ReferenceContainerCache<HostReference> partialIndex = yacyClient.loadIDXHosts(this.seed);+ ReferenceContainerCache<HostReference> partialIndex = Protocol.loadIDXHosts(this.seed);if (partialIndex == null || partialIndex.size() == 0) return;Log.logInfo("BlockRank", "loaded " + partialIndex.size() + " host indexes from peer " + this.seed.getName());try {diff --git a/source/net/yacy/search/snippet/ResultEntry.java b/source/net/yacy/search/snippet/ResultEntry.javaindex b392e1ed6..0afcac18d 100644--- a/source/net/yacy/search/snippet/ResultEntry.java+++ b/source/net/yacy/search/snippet/ResultEntry.java@@ -42,8 +42,8 @@ import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.order.Bitfield;import net.yacy.kelondro.rwi.Reference;import net.yacy.kelondro.util.ByteArray;-import net.yacy.peers.yacySeed;-import net.yacy.peers.yacySeedDB;+import net.yacy.peers.Seed;+import net.yacy.peers.SeedDB;import net.yacy.search.index.Segment;@@ -62,7 +62,7 @@ public class ResultEntry implements Comparable<ResultEntry>, Comparator<ResultEnpublic ResultEntry(final URIMetadataRow urlentry,final Segment indexSegment,- yacySeedDB peers,+ SeedDB peers,final TextSnippet textSnippet,final List<MediaSnippet> mediaSnippets,final long dbRetrievalTime, final long snippetComputationTime) {@@ -78,8 +78,8 @@ public class ResultEntry implements Comparable<ResultEntry>, Comparator<ResultEnif (host != null && host.endsWith(".yacyh")) {// translate host into current IPint p = host.indexOf('.');- final String hash = yacySeed.hexHash2b64Hash(host.substring(p + 1, host.length() - 6));- final yacySeed seed = peers.getConnected(hash);+ final String hash = Seed.hexHash2b64Hash(host.substring(p + 1, host.length() - 6));+ final Seed seed = peers.getConnected(hash);final String filename = urlcomps.url().getFile();String address = null;if ((seed == null) || ((address = seed.getPublicAddress()) == null)) {diff --git a/source/net/yacy/search/snippet/TextSnippet.java b/source/net/yacy/search/snippet/TextSnippet.javaindex 06dd5a576..1c3a13e14 100644--- a/source/net/yacy/search/snippet/TextSnippet.java+++ b/source/net/yacy/search/snippet/TextSnippet.java@@ -50,7 +50,7 @@ import net.yacy.kelondro.index.HandleSet;import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.util.ByteArray;import net.yacy.kelondro.util.ByteBuffer;-import net.yacy.peers.yacySearch;+import net.yacy.peers.RemoteSearch;import net.yacy.repository.LoaderDispatcher;import net.yacy.search.Switchboard;import de.anomic.crawler.retrieval.Response;@@ -160,7 +160,7 @@ public class TextSnippet implements Comparable<TextSnippet>, Comparator<TextSnip// try to get snippet from snippetCachefinal ResultClass source = ResultClass.SOURCE_CACHE;- final String wordhashes = yacySearch.set2string(queryhashes);+ final String wordhashes = RemoteSearch.set2string(queryhashes);final String urls = ASCII.String(url.hash());String snippetLine = snippetsCache.get(wordhashes, urls);if (snippetLine != null) {diff --git a/source/net/yacy/yacy.java b/source/net/yacy/yacy.javaindex 506bcecc6..1555a7cdf 100644--- a/source/net/yacy/yacy.java+++ b/source/net/yacy/yacy.java@@ -68,7 +68,7 @@ import net.yacy.kelondro.util.FileUtils;import net.yacy.kelondro.util.Formatter;import net.yacy.kelondro.util.MemoryControl;import net.yacy.kelondro.util.OS;-import net.yacy.peers.yacySeedDB;+import net.yacy.peers.SeedDB;import net.yacy.peers.operation.yacyBuildProperties;import net.yacy.peers.operation.yacyRelease;import net.yacy.peers.operation.yacyVersion;@@ -897,7 +897,7 @@ public final class yacy {final String[] dbFileNames = {"seed.new.db","seed.old.db","seed.pot.db"};for (final String dbFileName : dbFileNames) {final File dbFile = new File(yacyDBPath,dbFileName);- final MapDataMining db = new MapDataMining(dbFile, Word.commonHashLength, Base64Order.enhancedCoder, 1024 * 512, 500, yacySeedDB.sortFields, yacySeedDB.longaccFields, yacySeedDB.doubleaccFields, null);+ final MapDataMining db = new MapDataMining(dbFile, Word.commonHashLength, Base64Order.enhancedCoder, 1024 * 512, 500, SeedDB.sortFields, SeedDB.longaccFields, SeedDB.doubleaccFields, null);MapDataMining.mapIterator it;it = db.maps(true, false);