From db032fb6de659bf635df32d1257273deac0ea28a Mon Sep 17 00:00:00 2001 From: orbiter Date: Tue, 13 May 2008 11:46:20 +0000 Subject: [PATCH] - added RWI transmissions to the event terminal - fixed bug in Collage - added 'embedded mode' to collage - integrated Collage to terminal_p as iframe in embedded mode (Pictures now visible in terminal_p) git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4797 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/Collage.html | 11 +++++- htroot/Collage.java | 38 ++++++++++++------- htroot/Status.html | 2 +- htroot/terminal_p.html | 10 +++-- htroot/yacy/transferRWI.java | 3 ++ htroot/yacy/transferURL.java | 5 ++- .../kelondro/kelondroCollectionIndex.java | 1 + source/de/anomic/xml/RSSFeed.java | 3 +- source/de/anomic/yacy/yacyPeerActions.java | 6 +-- 9 files changed, 55 insertions(+), 24 deletions(-) diff --git a/htroot/Collage.html b/htroot/Collage.html index 61d2b1821..f47cbacef 100755 --- a/htroot/Collage.html +++ b/htroot/Collage.html @@ -18,7 +18,12 @@ form dd { - + +#(emb)# + +:: #%env/templates/header.template%# #%env/templates/submenuWebStructure.template%#

Collage

@@ -33,13 +38,15 @@ form dd { - +#(/emb)# #(imgurl)# :: #{list}# #[url]# #{/list}# #(/imgurl)# +#(emb)#:: #%env/templates/footer.template%# +#(/emb)# \ No newline at end of file diff --git a/htroot/Collage.java b/htroot/Collage.java index 1f01cfc6a..80594db11 100755 --- a/htroot/Collage.java +++ b/htroot/Collage.java @@ -46,9 +46,7 @@ import de.anomic.server.serverObjects; import de.anomic.server.serverSwitch; public class Collage { - private static final int fifoMax = 20; - private static final int posXMax = 800; - private static final int posYMax = 500; + private static int fifoMax = 20; private static int fifoPos = -1; private static int fifoSize = 0; @@ -65,12 +63,24 @@ public class Collage { public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) { final serverObjects prop = new serverObjects(); final plasmaSwitchboard sb = (plasmaSwitchboard) env; - final boolean authenticated = sb.adminAuthenticated(header) >= 2; + final boolean authenticated = sb.verifyAuthentication(header, false); ResultImages.OriginEntry nextOrigin = ResultImages.next(!authenticated); + int posXMax = 800; + int posYMax = 500; + boolean embed = false; + + if (post != null) { + embed = post.containsKey("emb"); + posXMax = post.getInt("width", posXMax); + posYMax = post.getInt("height", posYMax); + if (post.containsKey("max")) fifoMax = post.getInt("max", fifoMax); + } + prop.put("emb", (embed) ? "0" : "1"); if (nextOrigin != null) { + System.out.println("NEXTORIGIN=" + nextOrigin.imageEntry.url().toNormalform(true, false)); if (fifoSize == 0 || origins[fifoPos] != nextOrigin) { - fifoPos = fifoPos + 1 == fifoMax ? 0 : fifoPos + 1; + fifoPos = fifoPos + 1 >= fifoMax ? 0 : fifoPos + 1; fifoSize = fifoSize + 1 > fifoMax ? fifoMax : fifoSize + 1; origins[fifoPos] = nextOrigin; @@ -78,8 +88,8 @@ public class Collage { imgWidth[fifoPos] = (int) (((float)nextOrigin.imageEntry.width()) / scale); imgHeight[fifoPos] = (int) (((float)nextOrigin.imageEntry.height()) / scale); - imgPosX[fifoPos] = rand.nextInt(posXMax); - imgPosY[fifoPos] = rand.nextInt(posYMax); + imgPosX[fifoPos] = rand.nextInt((imgWidth[fifoPos] == 0) ? posXMax / 2 : Math.max(1, posXMax - imgWidth[fifoPos])); + imgPosY[fifoPos] = rand.nextInt((imgHeight[fifoPos] == 0) ? posYMax / 2 : Math.max(1, posYMax - imgHeight[fifoPos])); imgZIndex[fifoPos] = zIndex; zIndex += 1; @@ -92,11 +102,13 @@ public class Collage { for (int i = 0; i < fifoSize; i++) prop.put("imgurl_list_" + i + "_url", "" - + "" + + "px;z-index:" + imgZIndex[i] + "\"" + + "title=\"" + origins[i].baseURL.toNormalform(true, false) + "\">" + "
"); prop.put("imgurl_list", fifoSize); @@ -105,8 +117,8 @@ public class Collage { } prop.putNum("refresh", Math.max(2, Math.min(5, 500 / (1 + ResultImages.queueSize(!authenticated))))); - prop.put("privateQueueSize", ResultImages.privateQueueHighSize() + "+" + ResultImages.privateQueueLowSize()); - prop.put("publicQueueSize", ResultImages.publicQueueHighSize() + "+" + ResultImages.publicQueueLowSize()); + prop.put("emb_privateQueueSize", ResultImages.privateQueueHighSize() + "+" + ResultImages.privateQueueLowSize()); + prop.put("emb_publicQueueSize", ResultImages.publicQueueHighSize() + "+" + ResultImages.publicQueueLowSize()); return prop; } } \ No newline at end of file diff --git a/htroot/Status.html b/htroot/Status.html index f1f1fc190..4e3563edc 100644 --- a/htroot/Status.html +++ b/htroot/Status.html @@ -37,7 +37,7 @@

Welcome to YaCy!


-
banner diff --git a/htroot/terminal_p.html b/htroot/terminal_p.html index 716e8b6b3..9781af388 100755 --- a/htroot/terminal_p.html +++ b/htroot/terminal_p.html @@ -46,15 +46,19 @@ function init() {
- +

Image Terminal

+
diff --git a/htroot/yacy/transferRWI.java b/htroot/yacy/transferRWI.java index 297637c7e..ace2ed616 100644 --- a/htroot/yacy/transferRWI.java +++ b/htroot/yacy/transferRWI.java @@ -58,6 +58,8 @@ import de.anomic.server.serverCore; import de.anomic.server.serverObjects; import de.anomic.server.serverSwitch; import de.anomic.tools.nxTools; +import de.anomic.xml.RSSFeed; +import de.anomic.xml.RSSMessage; import de.anomic.yacy.yacyCore; import de.anomic.yacy.yacyDHTAction; import de.anomic.yacy.yacyNetwork; @@ -198,6 +200,7 @@ public final class transferRWI { } else { final double avdist = (yacyDHTAction.dhtDistance(sb.wordIndex.seedDB.mySeed().hash, wordhashes[0]) + yacyDHTAction.dhtDistance(sb.wordIndex.seedDB.mySeed().hash, wordhashes[received - 1])) / 2.0; sb.getLog().logInfo("Received " + received + " Entries " + wordc + " Words [" + wordhashes[0] + " .. " + wordhashes[received - 1] + "]/" + avdist + " from " + otherPeerName + ", processed in " + (System.currentTimeMillis() - startProcess) + " milliseconds, requesting " + unknownURL.size() + "/" + receivedURL + " URLs, blocked " + blocked + " RWIs"); + RSSFeed.channels(RSSFeed.INDEXRECEIVE).addMessage(new RSSMessage("Received " + received + " RWIs [" + wordhashes[0] + " .. " + wordhashes[received - 1] + "]/" + avdist + " from " + otherPeerName + ", requesting " + unknownURL.size() + " URLs, blocked " + blocked, "", "")); } result = "ok"; diff --git a/htroot/yacy/transferURL.java b/htroot/yacy/transferURL.java index d88f6303e..535f50a23 100644 --- a/htroot/yacy/transferURL.java +++ b/htroot/yacy/transferURL.java @@ -56,6 +56,8 @@ import de.anomic.server.serverCore; import de.anomic.server.serverObjects; import de.anomic.server.serverSwitch; import de.anomic.server.serverDate; +import de.anomic.xml.RSSFeed; +import de.anomic.xml.RSSMessage; import de.anomic.yacy.yacyCore; import de.anomic.yacy.yacyNetwork; import de.anomic.yacy.yacySeed; @@ -169,7 +171,8 @@ public final class transferURL { // return rewrite properties final int more = sb.wordIndex.countURL() - sizeBefore; doublevalues = Integer.toString(received - more); - sb.getLog().logInfo("Received " + received + " URLs from peer " + otherPeerName + " in " + (System.currentTimeMillis() - start) + " ms, Blocked " + blocked + " URLs"); + sb.getLog().logInfo("Received " + received + " URLs from peer " + otherPeerName + " in " + (System.currentTimeMillis() - start) + " ms, blocked " + blocked + " URLs"); + RSSFeed.channels(RSSFeed.INDEXRECEIVE).addMessage(new RSSMessage("Received " + received + " URLs from peer " + otherPeerName + ", blocked " + blocked, "", "")); if ((received - more) > 0) sb.getLog().logSevere("Received " + doublevalues + " double URLs from peer " + otherPeerName); result = "ok"; } diff --git a/source/de/anomic/kelondro/kelondroCollectionIndex.java b/source/de/anomic/kelondro/kelondroCollectionIndex.java index caa67cf78..bac921118 100644 --- a/source/de/anomic/kelondro/kelondroCollectionIndex.java +++ b/source/de/anomic/kelondro/kelondroCollectionIndex.java @@ -312,6 +312,7 @@ public class kelondroCollectionIndex { try { array = openArrayFile(partitionNumber, serialNumber, indexOrder, true); } catch (IOException e) { + e.printStackTrace(); return null; } arrays.put(accessKey, array); diff --git a/source/de/anomic/xml/RSSFeed.java b/source/de/anomic/xml/RSSFeed.java index 72ff795d9..df0395159 100644 --- a/source/de/anomic/xml/RSSFeed.java +++ b/source/de/anomic/xml/RSSFeed.java @@ -39,6 +39,7 @@ public class RSSFeed implements Iterable { public static final String LOCALSEARCH = "LOCALSEARCH"; public static final String REMOTEINDEXING = "REMOTEINDEXING"; public static final String LOCALINDEXING = "LOCALINDEXING"; + public static final String INDEXRECEIVE = "INDEXRECEIVE"; // test: // http://localhost:8080/xml/feed.rss?set=PEERNEWS,REMOTESEARCH,LOCALSEARCH,REMOTEINDEXING,LOCALINDEXING @@ -157,10 +158,10 @@ public class RSSFeed implements Iterable { public static RSSFeed channels(String channelName) { ConcurrentHashMap channelss = channels; RSSFeed feed = channelss.get(channelName); - if (feed == null) System.out.println("channel " + channelName + " is new"); if (feed != null) return feed; feed = new RSSFeed(); feed.setChannel(new RSSMessage(channelName, "", "")); + feed.maxsize = 100; channels.put(channelName, feed); return feed; } diff --git a/source/de/anomic/yacy/yacyPeerActions.java b/source/de/anomic/yacy/yacyPeerActions.java index fd4a0ddf6..13dd715c6 100644 --- a/source/de/anomic/yacy/yacyPeerActions.java +++ b/source/de/anomic/yacy/yacyPeerActions.java @@ -354,7 +354,7 @@ public class yacyPeerActions { // perform all actions if peer is effective new dhtAction.processPeerArrival(peer, direct); this.processPeerArrival(peer, direct); - RSSFeed.channels(RSSFeed.PEERNEWS).addMessage(new RSSMessage(peer.getName() + " has joined the network", "", "")); + RSSFeed.channels(RSSFeed.PEERNEWS).addMessage(new RSSMessage(peer.getName() + " joined the network", "", "")); } return res; } @@ -370,7 +370,7 @@ public class yacyPeerActions { } // perform all actions dhtAction.processPeerDeparture(peer); - RSSFeed.channels(RSSFeed.PEERNEWS).addMessage(new RSSMessage(peer.getName() + " has left the network", "", "")); + RSSFeed.channels(RSSFeed.PEERNEWS).addMessage(new RSSMessage(peer.getName() + " left the network", "", "")); } public void peerPing(yacySeed peer) { @@ -379,7 +379,7 @@ public class yacyPeerActions { seedDB.addPotential(peer); // perform all actions processPeerArrival(peer, true); - RSSFeed.channels(RSSFeed.PEERNEWS).addMessage(new RSSMessage(peer.getName() + " has sent me a ping", "", "")); + RSSFeed.channels(RSSFeed.PEERNEWS).addMessage(new RSSMessage(peer.getName() + " sent me a ping", "", "")); } private void processPeerArrival(yacySeed peer, boolean direct) {