added self-news; added news in case of wiki update; added crawl announcement on Network page

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@469 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
orbiter 2005-08-01 12:47:47 +00:00
parent cc38c5e77b
commit bcc292ad12
4 changed files with 43 additions and 5 deletions

View File

@ -63,7 +63,9 @@
<tr class="TableCell#(dark)#Light::Dark::Summary#(/dark)#">
<td class="small"><a href="MessageSend_p.html?hash=#[hash]#" class="small">m</a>&nbsp;&nbsp;&nbsp;
<a href="ViewProfile.html?hash=#[hash]#" class="small">p</a>#(updatedProfile)#&nbsp;::*#(/updatedProfile)#&nbsp;&nbsp;
<a href="http://#[fullname]#.yacy/Wiki.html" class="small">w</a></td>
<a href="http://#[fullname]#.yacy/Wiki.html" class="small">w</a>#(updatedWiki)#&nbsp;::*#(/updatedWiki)#&nbsp;&nbsp;
#(isCrawling)#::<a href="#[startURL]#" class="small">crawl</a>#(/isCrawling)#
</td>
<td class="small"><a href="http://www.#[fullname]#.yacy" class="small">#[shortname]#</a></td>
#(complete)#
::

View File

@ -218,6 +218,8 @@ public class Network {
// find updated Information using YaCyNews
HashSet updatedProfile = new HashSet();
HashSet updatedWiki = new HashSet();
HashMap isCrawling = new HashMap();
int availableNews = yacyCore.newsPool.size(yacyNewsPool.INCOMING_DB);
if (availableNews > 500) availableNews = 500;
yacyNewsRecord record;
@ -226,8 +228,11 @@ public class Network {
record = yacyCore.newsPool.get(yacyNewsPool.INCOMING_DB, c);
if (record.category().equals("prfleupd")) {
updatedProfile.add(record.originator());
} else if (record.category().equals("wiki_upd")) {
updatedWiki.add(record.originator());
} else if (record.category().equals("crwlstrt")) {
isCrawling.put(record.originator(), record.attributes().get("startURL"));
}
}
} catch (IOException e) {}
@ -240,6 +245,8 @@ public class Network {
case 2 : e = yacyCore.seedDB.seedsSortedDisconnected(post.get("order", "up").equals("up"), post.get("sort", "LastSeen")); break;
case 3 : e = yacyCore.seedDB.seedsSortedPotential(post.get("order", "up").equals("up"), post.get("sort", "LastSeen")); break;
}
String startURL;
int PPM;
while ((e.hasMoreElements()) && (conCount < maxCount)) {
seed = (yacySeed) e.nextElement();
if (seed != null) {
@ -250,6 +257,20 @@ public class Network {
prop.put("table_list_"+conCount+"_dark", ((dark) ? 1 : 0) ); dark=!dark;
}
prop.put("table_list_"+conCount+"_updatedProfile", (((updatedProfile.contains(seed.hash))) ? 1 : 0) );
prop.put("table_list_"+conCount+"_updatedWiki", (((updatedWiki.contains(seed.hash))) ? 1 : 0) );
try {
PPM = Integer.parseInt(seed.get("ISpeed", "-"));
} catch (NumberFormatException ee) {
PPM = 0;
}
if (((startURL = (String) isCrawling.get(seed.hash)) == null) || (PPM < 10)) {
prop.put("table_list_"+conCount+"_isCrawling", 0);
prop.put("table_list_"+conCount+"_isCrawling_startURL", "");
} else {
prop.put("table_list_"+conCount+"_isCrawling", 1);
prop.put("table_list_"+conCount+"_isCrawling_startURL", startURL);
}
long links, words;
try {
links = Long.parseLong(seed.get("LCount", "0"));
@ -289,7 +310,7 @@ public class Network {
prop.put("table_list_"+conCount+"_sU", seed.get("sU", "-"));
prop.put("table_list_"+conCount+"_rI", seed.get("rI", "-"));
prop.put("table_list_"+conCount+"_rU", seed.get("rU", "-"));
prop.put("table_list_"+conCount+"_ppm", seed.get("ISpeed", "-"));
prop.put("table_list_"+conCount+"_ppm", PPM);
prop.put("table_list_"+conCount+"_seeds", seed.get("SCount", "-"));
prop.put("table_list_"+conCount+"_connects", seed.get("CCount", "-"));
conCount++;

View File

@ -53,6 +53,7 @@ import java.io.UnsupportedEncodingException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import java.util.HashMap;
import de.anomic.data.wikiBoard;
import de.anomic.http.httpHeader;
@ -60,6 +61,9 @@ import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.server.serverCore;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyNewsRecord;
import de.anomic.yacy.yacyNewsPool;
import de.anomic.yacy.yacyCore;
public class Wiki {
@ -95,9 +99,17 @@ public class Wiki {
if (post.containsKey("submit")) {
// store a new page
switchboard.wikiDB.write(switchboard.wikiDB.newEntry(pagename, author, ip,
switchboard.wikiDB.write(switchboard.wikiDB.newEntry(pagename, author, ip,
post.get("reason", "edit"),
((String) post.get("content", "")).getBytes()));
// create a news message
HashMap map = new HashMap();
map.put("page", pagename);
map.put("author", author);
map.put("ip", ip);
try {
yacyCore.newsPool.publishMyNews(new yacyNewsRecord("wiki_upd", map));
} catch (IOException e) {}
}
wikiBoard.entry page = switchboard.wikiDB.read(pagename);

View File

@ -101,7 +101,10 @@ public class yacyNewsPool {
public void publishMyNews(yacyNewsRecord record) throws IOException {
// this shall be called if our peer generated a new news record and wants to publish it
if (newsDB.get(record.id()) == null) outgoingNews.push(record);
if (newsDB.get(record.id()) == null) {
incomingNews.push(record); // we want to see our own news..
outgoingNews.push(record); // .. and put it on the publishing list
}
}
public yacyNewsRecord myPublication() throws IOException {