From c93f4dda7299b72b38699c5e877a19163edb6b40 Mon Sep 17 00:00:00 2001 From: orbiter Date: Wed, 12 Jan 2011 00:00:14 +0000 Subject: [PATCH] - cleaned up yacy news - removed unused methods - avoid news generation in case that the peer runs in robinson mode git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7431 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/Blog.java | 12 ++-- htroot/Bookmarks.java | 1 + htroot/Crawler_p.java | 2 +- htroot/Network.html | 4 +- htroot/Network.java | 9 --- htroot/Network.xml | 4 +- htroot/Supporter.java | 12 ++-- htroot/Surftips.java | 12 ++-- htroot/Wiki.java | 2 +- htroot/api/bookmarks/posts/add_p.java | 1 + htroot/yacysearch.java | 12 ++-- source/de/anomic/search/Switchboard.java | 4 +- source/de/anomic/yacy/yacyNewsDB.java | 49 +++---------- source/de/anomic/yacy/yacyNewsPool.java | 90 +++++++++--------------- source/de/anomic/yacy/yacyNewsQueue.java | 25 +++---- source/de/anomic/yacy/yacySeed.java | 22 ------ source/de/anomic/yacy/yacyVersion.java | 1 - 17 files changed, 91 insertions(+), 171 deletions(-) diff --git a/htroot/Blog.java b/htroot/Blog.java index 9fa8c0391..43c2a5c15 100644 --- a/htroot/Blog.java +++ b/htroot/Blog.java @@ -170,11 +170,13 @@ public class Blog { sb.blogDB.writeBlogEntry(sb.blogDB.newEntry(pagename, subject, author, ip, date, content, comments, commentMode)); // create a news message - final Map map = new HashMap(); - 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); + if (!sb.isRobinsonMode()) { + final Map map = new HashMap(); + 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); + } } page = sb.blogDB.readBlogEntry(pagename); //maybe "if(page == null)" diff --git a/htroot/Bookmarks.java b/htroot/Bookmarks.java index b195d9937..9eafe9126 100644 --- a/htroot/Bookmarks.java +++ b/htroot/Bookmarks.java @@ -447,6 +447,7 @@ public class Bookmarks { private static void publishNews(final String url, final String title, final String description, final String tagsString) { // create a news message + if (sb.isRobinsonMode()) return; final Map map = new HashMap(); map.put("url", url.replace(',', '|')); map.put("title", title.replace(',', ' ')); diff --git a/htroot/Crawler_p.java b/htroot/Crawler_p.java index daa18ea13..f44388e47 100644 --- a/htroot/Crawler_p.java +++ b/htroot/Crawler_p.java @@ -339,7 +339,7 @@ public class Crawler_p { prop.putHTML("info_crawlingURL", (post.get("crawlingURL"))); // generate a YaCyNews if the global flag was set - if (crawlOrder) { + if (!sb.isRobinsonMode() && crawlOrder) { final Map m = new HashMap(pe); // must be cloned m.remove("specificDepth"); m.remove("indexText"); diff --git a/htroot/Network.html b/htroot/Network.html index 8a7495225..b8e19ff98 100644 --- a/htroot/Network.html +++ b/htroot/Network.html @@ -140,7 +140,7 @@ To see a list of all APIs, please visit the Crawl#(/isCrawling)# #[shortname]# - #(type)##(direct)#Junior passive::Junior direct::Junior offline#(/direct)#::#(direct)#senior passive::Senior direct::Senior offline#(/direct)#::#(direct)#Principal passive::Principal active::Principal offline#(/direct)##(/type)##(acceptcrawl)#no crawl::crawl possible::crawl possible#(/acceptcrawl)##(dhtreceive)#no DHT receive::DHT receive enabled::DHT receive enabled#(/dhtreceive)##(rankingreceive)#no ranking receive::Ranking receive enabled::ranking collects#(/rankingreceive)# + #(type)##(direct)#Junior passive::Junior direct::Junior offline#(/direct)#::#(direct)#senior passive::Senior direct::Senior offline#(/direct)#::#(direct)#Principal passive::Principal active::Principal offline#(/direct)##(/type)##(acceptcrawl)#no crawl::crawl possible::crawl possible#(/acceptcrawl)##(dhtreceive)#no DHT receive::DHT receive enabled::DHT receive enabled#(/dhtreceive)# #[version]# #[ppm]# #[qph]# @@ -301,7 +301,7 @@ To see a list of all APIs, please visit the #[my-name]# - #(my-info)#Virgin::Junior::Senior::Principal#(/my-info)##(my-acceptcrawl)#no crawl::Crawl enabled#(/my-acceptcrawl)##(my-dhtreceive)#no DHT receive::DHT Receive enabled#(/my-dhtreceive)##(my-rankingreceive)#no ranking receive::Ranking receive enabled#(/my-rankingreceive)# + #(my-info)#Virgin::Junior::Senior::Principal#(/my-info)##(my-acceptcrawl)#no crawl::Crawl enabled#(/my-acceptcrawl)##(my-dhtreceive)#no DHT receive::DHT Receive enabled#(/my-dhtreceive)# #[my-version]# #[my-utc]# #[my-uptime]# diff --git a/htroot/Network.java b/htroot/Network.java index 03caf3ca5..26d5d17f9 100644 --- a/htroot/Network.java +++ b/htroot/Network.java @@ -124,7 +124,6 @@ public class Network { } prop.put("table_my-acceptcrawl", seed.getFlagAcceptRemoteCrawl() ? 1 : 0); prop.put("table_my-dhtreceive", seed.getFlagAcceptRemoteIndex() ? 1 : 0); - prop.put("table_my-rankingreceive", seed.getFlagAcceptCitationReference() ? 1 : 0); myppm = sb.currentPPM(); @@ -408,7 +407,6 @@ public class Network { if (page == 1) { prop.put(STR_TABLE_LIST + conCount + "_acceptcrawl", seed.getFlagAcceptRemoteCrawl() ? 1 : 0); // green=on or red=off prop.put(STR_TABLE_LIST + conCount + "_dhtreceive", seed.getFlagAcceptRemoteIndex() ? 1 : 0); // green=on or red=off - prop.put(STR_TABLE_LIST + conCount + "_rankingreceive", (seed.getVersion() >= yacyVersion.YACY_ACCEPTS_RANKING_TRANSMISSION) ? 1 : 0); } else { // Passive, Potential Peers if (seed.getFlagAcceptRemoteCrawl()) { prop.put(STR_TABLE_LIST + conCount + "_acceptcrawl", 2); // red/green: offline, was on @@ -420,13 +418,6 @@ public class Network { } else { prop.put(STR_TABLE_LIST + conCount + "_dhtreceive", 0); // red/red; offline was off } - - if (seed.getVersion() >= yacyVersion.YACY_ACCEPTS_RANKING_TRANSMISSION && - seed.getFlagAcceptCitationReference()) { - prop.put(STR_TABLE_LIST + conCount + "_rankingreceive", 1); - } else { - prop.put(STR_TABLE_LIST + conCount + "_rankingreceive", 0); - } } if (seed.getFlagAcceptRemoteIndex()) { prop.put(STR_TABLE_LIST + conCount + "_dhtreceive_peertags", ""); diff --git a/htroot/Network.xml b/htroot/Network.xml index 2426df5ed..35da906b8 100644 --- a/htroot/Network.xml +++ b/htroot/Network.xml @@ -20,8 +20,7 @@ #(type)#junior::senior::principal#(/type)# #(type_direct)#direct::passive#(/type_direct)# #[acceptcrawl]# - #[dhtreceive]# - #[rankingreceive]# + #[dhtreceive]# #[location]# #[type_url]# #(complete)# @@ -74,7 +73,6 @@ #[my-RCount]# #[my-acceptcrawl]# #[my-dhtreceive]# - #[my-rankingreceive]# #[my-sI]# #[my-sU]# #[my-rI]# diff --git a/htroot/Supporter.java b/htroot/Supporter.java index b6ae9ce26..5d3cebb45 100644 --- a/htroot/Supporter.java +++ b/htroot/Supporter.java @@ -76,11 +76,13 @@ public class Supporter { return prop; } // make new news message with voting - final HashMap map = new HashMap(); - 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); + if (!sb.isRobinsonMode()) { + final HashMap map = new HashMap(); + 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); + } } if ((post != null) && ((hash = post.get("votePositive", null)) != null)) { if (!sb.verifyAuthentication(header, false)) { diff --git a/htroot/Surftips.java b/htroot/Surftips.java index 63b32ec81..04ddc5693 100644 --- a/htroot/Surftips.java +++ b/htroot/Surftips.java @@ -84,11 +84,13 @@ public class Surftips { return prop; } // make new news message with voting - final HashMap map = new HashMap(); - 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); + if (sb.isRobinsonMode()) { + final HashMap map = new HashMap(); + 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); + } } if ((post != null) && ((hash = post.get("votePositive", null)) != null)) { if (!sb.verifyAuthentication(header, false)) { diff --git a/htroot/Wiki.java b/htroot/Wiki.java index 420f06de1..c0d070dd1 100644 --- a/htroot/Wiki.java +++ b/htroot/Wiki.java @@ -124,7 +124,7 @@ public class Wiki { final Map map = new HashMap(); map.put("page", pagename); map.put("author", author.replace(',', ' ')); - if (post.get("content", "").trim().length() > 0 && !new String(page.page()).equals(new String(content))) { + if (!sb.isRobinsonMode() && post.get("content", "").trim().length() > 0 && !new String(page.page()).equals(new String(content))) { sb.peers.newsPool.publishMyNews(sb.peers.mySeed(), yacyNewsPool.CATEGORY_WIKI_UPDATE, map); } page = newEntry; diff --git a/htroot/api/bookmarks/posts/add_p.java b/htroot/api/bookmarks/posts/add_p.java index 642137b45..96853a857 100755 --- a/htroot/api/bookmarks/posts/add_p.java +++ b/htroot/api/bookmarks/posts/add_p.java @@ -79,6 +79,7 @@ public class add_p { } private static void publishNews(final String url, final String title, final String description, final String tagsString) { // create a news message + if (sb.isRobinsonMode()) return; final Map map = new HashMap(8); map.put("url", url.replace(',', '|')); map.put("title", title.replace(',', ' ')); diff --git a/htroot/yacysearch.java b/htroot/yacysearch.java index 1ce8b8cff..e351bdf5d 100644 --- a/htroot/yacysearch.java +++ b/htroot/yacysearch.java @@ -425,11 +425,13 @@ public class yacysearch { indexSegment.termIndex().remove(Word.words2hashesHandles(query[0]), delHash.getBytes()); // make new news message with negative voting - final HashMap map = new HashMap(); - map.put("urlhash", delHash); - map.put("vote", "negative"); - map.put("refid", ""); - sb.peers.newsPool.publishMyNews(sb.peers.mySeed(), yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, map); + if (!sb.isRobinsonMode()) { + final HashMap map = new HashMap(); + map.put("urlhash", delHash); + map.put("vote", "negative"); + map.put("refid", ""); + sb.peers.newsPool.publishMyNews(sb.peers.mySeed(), yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, map); + } } catch (IOException e) { Log.logException(e); } diff --git a/source/de/anomic/search/Switchboard.java b/source/de/anomic/search/Switchboard.java index 9d4721e66..48f723823 100644 --- a/source/de/anomic/search/Switchboard.java +++ b/source/de/anomic/search/Switchboard.java @@ -1017,7 +1017,7 @@ public final class Switchboard extends serverSwitch { // we are in robinson mode, if we do not exchange index by dht distribution // we need to take care that search requests and remote indexing requests go only // to the peers in the same cluster, if we run a robinson cluster. - return !getConfigBool(SwitchboardConstants.INDEX_DIST_ALLOW, false) && !getConfigBool(SwitchboardConstants.INDEX_RECEIVE_ALLOW, false); + return (this.peers != null && this.peers.sizeConnected() == 0) || (!getConfigBool(SwitchboardConstants.INDEX_DIST_ALLOW, false) && !getConfigBool(SwitchboardConstants.INDEX_RECEIVE_ALLOW, false)); } public boolean isPublicRobinson() { @@ -1649,7 +1649,7 @@ public final class Switchboard extends serverSwitch { } // initiate broadcast about peer startup to spread supporter url - if (this.peers.newsPool.size(yacyNewsPool.OUTGOING_DB) == 0) { + if (!this.isRobinsonMode() && this.peers.newsPool.size(yacyNewsPool.OUTGOING_DB) == 0) { // read profile final Properties profile = new Properties(); FileInputStream fileIn = null; diff --git a/source/de/anomic/yacy/yacyNewsDB.java b/source/de/anomic/yacy/yacyNewsDB.java index 1b197b917..631fae78e 100644 --- a/source/de/anomic/yacy/yacyNewsDB.java +++ b/source/de/anomic/yacy/yacyNewsDB.java @@ -10,16 +10,16 @@ // $LastChangedBy$ // // 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 +// it under the terms of the GNU General private 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. +// GNU General private License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU General private License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // @@ -72,11 +72,11 @@ public class yacyNewsDB { private final File path; private final Row rowdef; - protected final int attributesMaxLength; - protected Index news; + private final int attributesMaxLength; + private Index news; private static final int categoryStringLength = 8; - public static final int idLength = GenericFormatter.PATTERN_SHORT_SECOND.length() + Word.commonHashLength; + public static final int idLength = GenericFormatter.PATTERN_SHORT_SECOND.length() + Word.commonHashLength; public yacyNewsDB( final File path, @@ -148,33 +148,6 @@ public class yacyNewsDB { } } - public synchronized Iterator news() throws IOException { - // the iteration iterates yacyNewsRecord - type objects - return new recordIterator(); - } - - public class recordIterator implements Iterator { - - Iterator rowIterator; - - public recordIterator() throws IOException { - rowIterator = news.rows(); - } - - public boolean hasNext() { - return rowIterator.hasNext(); - } - - public Record next() { - return b2r(rowIterator.next()); - } - - public void remove() { - rowIterator.remove(); - } - - } - public synchronized Record get(final String id) throws IOException { try { return b2r(news.get(id.getBytes())); @@ -184,7 +157,7 @@ public class yacyNewsDB { } } - protected Record b2r(final Row.Entry b) { + private Record b2r(final Row.Entry b) { if (b == null) return null; return new yacyNewsDB.Record( b.getColString(0, null), @@ -195,7 +168,7 @@ public class yacyNewsDB { ); } - protected final Row.Entry r2b(final Record r) { + private final Row.Entry r2b(final Record r) { if (r == null) return null; try { String attributes = r.attributes().toString(); @@ -260,7 +233,7 @@ public class yacyNewsDB { private final Map attributes; // elements of the news for a special category - protected Record(final String newsString) { + private Record(final String newsString) { this.attributes = MapTools.string2map(newsString, ","); if (attributes.toString().length() > attributesMaxLength) throw new IllegalArgumentException("attributes length (" + attributes.toString().length() + ") exceeds maximum (" + attributesMaxLength + ")"); this.category = (attributes.containsKey("cat")) ? attributes.get("cat") : ""; @@ -272,7 +245,7 @@ public class yacyNewsDB { removeStandards(); } - protected Record(final yacySeed mySeed, final String category, final Map attributes) { + private Record(final yacySeed mySeed, final String category, final Map attributes) { if (category.length() > yacyNewsDB.categoryStringLength) throw new IllegalArgumentException("category length (" + category.length() + ") exceeds maximum (" + yacyNewsDB.categoryStringLength + ")"); if (attributes.toString().length() > attributesMaxLength) throw new IllegalArgumentException("attributes length (" + attributes.toString().length() + ") exceeds maximum (" + attributesMaxLength + ")"); this.attributes = attributes; @@ -284,7 +257,7 @@ public class yacyNewsDB { removeStandards(); } - protected Record(final String id, final String category, final Date received, final int distributed, final Map attributes) { + private Record(final String id, final String category, final Date received, final int distributed, final Map attributes) { if (category.length() > yacyNewsDB.categoryStringLength) throw new IllegalArgumentException("category length (" + category.length() + ") exceeds maximum (" + yacyNewsDB.categoryStringLength + ")"); if (attributes.toString().length() > attributesMaxLength) throw new IllegalArgumentException("attributes length (" + attributes.toString().length() + ") exceeds maximum (" + attributesMaxLength + ")"); this.attributes = attributes; diff --git a/source/de/anomic/yacy/yacyNewsPool.java b/source/de/anomic/yacy/yacyNewsPool.java index 56c0a0e55..dffd38ee2 100644 --- a/source/de/anomic/yacy/yacyNewsPool.java +++ b/source/de/anomic/yacy/yacyNewsPool.java @@ -10,16 +10,16 @@ // $LastChangedBy$ // // 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 +// it under the terms of the GNU General private 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. +// GNU General private License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU General private License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // @@ -71,7 +71,6 @@ public class yacyNewsPool { /* ------------------------------------------------------------------------ * PROFILE related CATEGORIES * ------------------------------------------------------------------------ */ - public static final String CATEGORY_PROFILE = "prfl"; /** * a profile entry was updated (implemented) */ @@ -84,71 +83,67 @@ public class yacyNewsPool { * a peer has done something good (i.e. served good search results) * and gets a positive vote so it can rise on the supporter page */ - public static final String CATEGORY_PROFILE_VOTE_GOOD = "prflegvt"; + private static final String CATEGORY_PROFILE_VOTE_GOOD = "prflegvt"; /** * a peer has done something bad (i.e. spammed) and gets a negative vote */ - public static final String CATEGORY_PROFILE_VOTE_BAD = "prflebvt"; + private static final String CATEGORY_PROFILE_VOTE_BAD = "prflebvt"; /* ------------------------------------------------------------------------ * CRAWLING related CATEGORIES * ------------------------------------------------------------------------ */ - public static final String CATEGORY_CRAWL = "crwl"; /** - * a crawl with remote indexing was startet + * a crawl with remote indexing was started */ public static final String CATEGORY_CRAWL_START = "crwlstrt"; /** * a crawl with remote indexing was stopped */ - public static final String CATEGORY_CRAWL_STOP = "crwlstop"; + private static final String CATEGORY_CRAWL_STOP = "crwlstop"; /** * a comment on a crawl with remote indexing */ - public static final String CATEGORY_CRAWL_COMMENT = "crwlcomm"; + private static final String CATEGORY_CRAWL_COMMENT = "crwlcomm"; /* ------------------------------------------------------------------------ * BLACKLIST related CATEGORIES * ------------------------------------------------------------------------ */ - public static final String CATEGORY_BLACKLIST = "blckl"; /** - * a public blacklist entry was added + * a private blacklist entry was added */ - public static final String CATEGORY_BLACKLIST_ADD = "blckladd"; + private static final String CATEGORY_BLACKLIST_ADD = "blckladd"; /** - * a vote and comment on a public blacklist add + * a vote and comment on a private blacklist add */ - public static final String CATEGORY_BLACKLIST_VOTE_ADD = "blcklavt"; + private static final String CATEGORY_BLACKLIST_VOTE_ADD = "blcklavt"; /** - * a public blacklist entry was deleted + * a private blacklist entry was deleted */ - public static final String CATEGORY_BLACKLIST_DELETE = "blckldel"; + private static final String CATEGORY_BLACKLIST_DELETE = "blckldel"; /** - * a vote and comment on a public blacklist delete + * a vote and comment on a private blacklist delete */ - public static final String CATEGORY_BLACKLIST_VOTE_DEL = "blckldvt"; + private static final String CATEGORY_BLACKLIST_VOTE_DEL = "blckldvt"; /* ------------------------------------------------------------------------ * FLIE-SHARE related CATEGORIES * ------------------------------------------------------------------------ */ - public static final String CATEGORY_FILESHARE = "flshr"; /** * a file was added to the file share */ - public static final String CATEGORY_FILESHARE_ADD = "flshradd"; + private static final String CATEGORY_FILESHARE_ADD = "flshradd"; /** * a file was added to the file share */ - public static final String CATEGORY_FILESHARE_DEL = "flshrdel"; + private static final String CATEGORY_FILESHARE_DEL = "flshrdel"; /** * a comment to a file share entry */ - public static final String CATEGORY_FILESHARE_COMMENT = "flshrcom"; + private static final String CATEGORY_FILESHARE_COMMENT = "flshrcom"; /* ------------------------------------------------------------------------ * BOOKMARK related CATEGORIES - * ------------------------------------------------------------------------ */ - public static final String CATEGORY_BOOKMARK = "bkmrk"; + * ------------------------------------------------------------------------ */ /** * a bookmark was added/created */ @@ -156,41 +151,39 @@ public class yacyNewsPool { /** * a vote and comment on a bookmark add */ - public static final String CATEGORY_BOOKMARK_VOTE_ADD = "bkmrkavt"; + private static final String CATEGORY_BOOKMARK_VOTE_ADD = "bkmrkavt"; /** * a bookmark was moved */ - public static final String CATEGORY_BOOKMARK_MOVE = "bkmrkmov"; + private static final String CATEGORY_BOOKMARK_MOVE = "bkmrkmov"; /** * a vote and comment on a bookmark move */ - public static final String CATEGORY_BOOKMARK_VOTE_MOVE = "bkmrkmvt"; + private static final String CATEGORY_BOOKMARK_VOTE_MOVE = "bkmrkmvt"; /** * a bookmark was deleted */ - public static final String CATEGORY_BOOKMARK_DEL = "bkmrkdel"; + private static final String CATEGORY_BOOKMARK_DEL = "bkmrkdel"; /** * a vote and comment on a bookmark delete */ - public static final String CATEGORY_BOOKMARK_VOTE_DEL = "bkmrkdvt"; + private static final String CATEGORY_BOOKMARK_VOTE_DEL = "bkmrkdvt"; /* ------------------------------------------------------------------------ * SURFTIPP related CATEGORIES * ------------------------------------------------------------------------ */ - public static final String CATEGORY_SURFTIPP = "stipp"; /** * a surf tipp was added */ - public static final String CATEGORY_SURFTIPP_ADD = "stippadd"; + public static final String CATEGORY_SURFTIPP_ADD = "stippadd"; /** * a vote and comment on a surf tipp */ - public static final String CATEGORY_SURFTIPP_VOTE_ADD = "stippavt"; + public static final String CATEGORY_SURFTIPP_VOTE_ADD = "stippavt"; /* ------------------------------------------------------------------------ * WIKI related CATEGORIES * ------------------------------------------------------------------------ */ - public static final String CATEGORY_WIKI = "wiki"; /** * a wiki page was updated */ @@ -198,12 +191,11 @@ public class yacyNewsPool { /** * a wiki page das deleted */ - public static final String CATEGORY_WIKI_DEL = "wiki_del"; + private static final String CATEGORY_WIKI_DEL = "wiki_del"; /* ------------------------------------------------------------------------ * BLOG related CATEGORIES - * ------------------------------------------------------------------------ */ - public static final String CATEGORY_BLOG = "blog"; + * ------------------------------------------------------------------------ */ /** * a blog entry was added */ @@ -211,12 +203,12 @@ public class yacyNewsPool { /** * a blog page das deleted */ - public static final String CATEGORY_BLOG_DEL = "blog_del"; + private static final String CATEGORY_BLOG_DEL = "blog_del"; /* ======================================================================== * ARRAY of valid CATEGORIES * ======================================================================== */ - public static final String[] category = { + private static final String[] category = { // PROFILE related CATEGORIES CATEGORY_PROFILE_UPDATE, CATEGORY_PROFILE_BROADCAST, @@ -259,7 +251,7 @@ public class yacyNewsPool { CATEGORY_BLOG_ADD, CATEGORY_BLOG_DEL }; - public static final HashSet categories = new HashSet(); + private static final HashSet categories = new HashSet(); static { for (int i = 0; i < category.length; i++) categories.add(category[i]); } @@ -288,10 +280,6 @@ public class yacyNewsPool { processedNews.close(); } - public int dbSize() { - return newsDB.size(); - } - public Iterator recordIterator(final int dbKey, final boolean up) { // returns an iterator of yacyNewsRecord-type objects final yacyNewsQueue queue = switchQueue(dbKey); @@ -310,7 +298,7 @@ public class yacyNewsPool { publishMyNews(newsDB.newRecord(mySeed, category, attributes)); } - public void publishMyNews(final yacyNewsDB.Record record) { + private void publishMyNews(final yacyNewsDB.Record record) { // this shall be called if our peer generated a new news record and wants to publish it if (record == null) return; try { @@ -447,18 +435,6 @@ public class yacyNewsPool { } return null; } -/* - * java.io.FileNotFoundException: /home/administrator/yacy/DATA/INDEX/webportal/NETWORK/newsOut.table (Too many open files) - at java.io.FileInputStream.open(Native Method) - at java.io.FileInputStream.(FileInputStream.java:137) - at net.yacy.kelondro.table.ChunkIterator.(ChunkIterator.java:63) - at net.yacy.kelondro.table.Table$rowIteratorNoOrder.(Table.java:832) - at net.yacy.kelondro.table.Table.rows(Table.java:825) - at de.anomic.yacy.yacyNewsQueue$newsIterator.(yacyNewsQueue.java:193) - at de.anomic.yacy.yacyNewsQueue.records(yacyNewsQueue.java:183) - at de.anomic.yacy.yacyNewsPool.getSpecific(yacyNewsPool.java:440) - at yacysearchitem.respond(yacysearchitem.java:119) - */ public synchronized yacyNewsDB.Record getByOriginator(final int dbKey, final String category, final String originatorHash) { final yacyNewsQueue queue = switchQueue(dbKey); diff --git a/source/de/anomic/yacy/yacyNewsQueue.java b/source/de/anomic/yacy/yacyNewsQueue.java index ca2c43058..c5cce975a 100644 --- a/source/de/anomic/yacy/yacyNewsQueue.java +++ b/source/de/anomic/yacy/yacyNewsQueue.java @@ -10,16 +10,16 @@ // $LastChangedBy$ // // 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 +// it under the terms of the GNU General private 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. +// GNU General private License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU General private License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // @@ -63,10 +63,10 @@ import net.yacy.kelondro.util.FileUtils; public class yacyNewsQueue { private final File path; - Table queueStack; + private Table queueStack; private final yacyNewsDB newsDB; - public static final Row rowdef = new Row(new Column[]{ + 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("last touched", Column.celltype_string, Column.encoder_bytes, GenericFormatter.PATTERN_SHORT_SECOND.length(), "") }, @@ -121,7 +121,7 @@ public class yacyNewsQueue { Log.logSevere("yacyNewsQueue", "reset of table " + this.path); queueStack.clear(); } - queueStack.addUnique(r2b(entry, true)); + queueStack.addUnique(r2b(entry)); } public synchronized yacyNewsDB.Record pop() throws IOException { @@ -163,14 +163,9 @@ public class yacyNewsQueue { return newsDB.get(id); } - private Row.Entry r2b(final yacyNewsDB.Record r, final boolean updateDB) throws IOException, RowSpaceExceededException { + private Row.Entry r2b(final yacyNewsDB.Record r) throws IOException, RowSpaceExceededException { if (r == null) return null; - if (updateDB) { - newsDB.put(r); - } else { - final yacyNewsDB.Record r1 = newsDB.get(r.id()); - if (r1 == null) newsDB.put(r); - } + newsDB.put(r); final Row.Entry b = queueStack.row().newEntry(new byte[][]{ r.id().getBytes(), GenericFormatter.SHORT_SECOND_FORMATTER.format(new Date()).getBytes()}); @@ -183,12 +178,12 @@ public class yacyNewsQueue { return new newsIterator(up); } - public class newsIterator implements Iterator { + private class newsIterator implements Iterator { // iterates yacyNewsRecord-type objects Iterator stackNodeIterator; - public newsIterator(final boolean up) { + private newsIterator(final boolean up) { try { stackNodeIterator = queueStack.rows(); } catch (IOException e) { diff --git a/source/de/anomic/yacy/yacySeed.java b/source/de/anomic/yacy/yacySeed.java index 10d763674..0e3f0f238 100644 --- a/source/de/anomic/yacy/yacySeed.java +++ b/source/de/anomic/yacy/yacySeed.java @@ -157,7 +157,6 @@ public class yacySeed implements Cloneable { private static final int FLAG_DIRECT_CONNECT = 0; private static final int FLAG_ACCEPT_REMOTE_CRAWL = 1; private static final int FLAG_ACCEPT_REMOTE_INDEX = 2; - private static final int FLAG_ACCEPT_CITATION_REFERENCE = 3; public static final String DFLT_NETWORK_UNIT = "freeworld"; public static final String DFLT_NETWORK_GROUP = ""; @@ -218,7 +217,6 @@ public class yacySeed implements Cloneable { setFlagDirectConnect(false); setFlagAcceptRemoteCrawl(true); setFlagAcceptRemoteIndex(true); - setFlagAcceptCitationReference(true); setUnusedFlags(); // index transfer @@ -473,22 +471,6 @@ public class yacySeed implements Cloneable { return Integer.parseInt(port); } - /** - * To synchronize peer pings the local time differential must be included in calculations. - * @return the difference to UTC (universal time coordinated) in milliseconds of this yacySeed, - * the difference to +0130 if not present or 0 if an error occured during conversion - */ - /* - public final long getUTCDiff() { - String utc = this.dna.get(yacySeed.UTC); - if (utc == null) { utc = "+0130"; } - try { - return DateFormatter.UTCDiff(utc); - } catch (final IllegalArgumentException e) { - return 0; - } - } - */ /** puts the current time into the lastseen field and cares about the time differential to UTC */ public final void setLastSeenUTC() { // because java thinks it must apply the UTC offset to the current time, @@ -607,7 +589,6 @@ public class yacySeed implements Cloneable { public final void setFlagDirectConnect(final boolean value) { setFlag(FLAG_DIRECT_CONNECT, value); } public final void setFlagAcceptRemoteCrawl(final boolean value) { setFlag(FLAG_ACCEPT_REMOTE_CRAWL, value); } public final void setFlagAcceptRemoteIndex(final boolean value) { setFlag(FLAG_ACCEPT_REMOTE_INDEX, value); } - public final void setFlagAcceptCitationReference(final boolean value) { setFlag(FLAG_ACCEPT_CITATION_REFERENCE, value); } public final boolean getFlagDirectConnect() { return getFlag(0); } public final boolean getFlagAcceptRemoteCrawl() { //if (getVersion() < 0.300) return false; @@ -618,9 +599,6 @@ public class yacySeed implements Cloneable { //if (getVersion() < 0.335) return false; return getFlag(2); } - public final boolean getFlagAcceptCitationReference() { - return getFlag(3); - } public final void setUnusedFlags() { for (int i = 4; i < 24; i++) { setFlag(i, true); } } diff --git a/source/de/anomic/yacy/yacyVersion.java b/source/de/anomic/yacy/yacyVersion.java index 5a775bb1c..c3cf2ff36 100644 --- a/source/de/anomic/yacy/yacyVersion.java +++ b/source/de/anomic/yacy/yacyVersion.java @@ -12,7 +12,6 @@ public class yacyVersion implements Comparator, Comparable