Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
THE GRID is coming to YaCy .. see new animated graphics on http://localhost:8090/AccessGrid_p.html showing incoming and outgoing connections in an animated way
orbitera80ee9a03d99
diff --git a/htroot/AccessGrid_p.html b/htroot/AccessGrid_p.htmlnew file mode 100644index 000000000..45023795e--- /dev/null+++ b/htroot/AccessGrid_p.html@@ -0,0 +1,62 @@+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">+<html xmlns="http://www.w3.org/1999/xhtml">+ <head>+ <title>YaCy '#[clientname]#': YaCy Network Access</title>+ #%env/templates/metas.template%#+ <style type="text/css">+ .left {+ float: left;+ }+ </style>++ <script type="text/javascript">+ <!--+ imagestub = "AccessPicture_p.png?width=1024&height=576&bgcolor=FFFFFF&ct=5000&coronaangle=";+ imageanimindex = 0;+ imageloadindex = 0;+ imagecycles = 0;+ imagearray = new Array(6);+ setTimeout("initanimation()", 100);+ setTimeout("doanimation()", 1000);+ function initanimation() {+ handle = new Date().getTime();+ for (j = 0; j < 6; j++) initanimationphase(j, handle);+ }+ function initanimationphase(phase, handle) {+ imagearray[phase] = new Image(1024, 576);+ angle = phase * 60;+ imagearray[phase].src = imagestub + angle + "&handle=" + handle;+ }+ function doanimation() {+ var accessPicture = document.getElementById("AccessPicture");+ if (accessPicture != null) {+ accessPicture.src = imagearray[imageanimindex].src;+ imageanimindex++;+ if (imageanimindex == 6) { imageanimindex = 0; }+ imagecycles++;+ if (imagecycles == 25) {+ initanimationphase(imageloadindex, new Date().getTime());+ imageloadindex++;+ if (imageloadindex == 6) { imageloadindex = 0; }+ imagecycles = 0;+ }+ setTimeout("doanimation()", 100);+ }+ }+ -->+ </script>+ </head>+ <body id="Network">+ #%env/templates/header.template%#+ #%env/templates/submenuAccessTracker.template%#+ <h2>Server Access Grid</h2>++ <div class="left">+ <p>+ <a href="AccessPicture_p.png?width=1024&height=576&bgcolor=FFFFFF"><img id="AccessPicture" src="AccessPicture_p.png?width=1024&height=576&bgcolor=FFFFFF&coronaangle=0" alt="The YaCy Network" width="1024" height="576" /></a>+ </p>+ </div>++ #%env/templates/footer.template%#+ </body>+</html>\ No newline at end of filediff --git a/htroot/AccessGrid_p.java b/htroot/AccessGrid_p.javanew file mode 100644index 000000000..f13712c9c--- /dev/null+++ b/htroot/AccessGrid_p.java@@ -0,0 +1,37 @@+/**+ * AccessGrid_p+ * Copyright 2011 by Michael Peter Christen; [email protected], Frankfurt a. M., Germany+ * First released 18.02.2010 at http://yacy.net+ *+ * $LastChangedDate: 2010-06-16 17:11:21 +0200 (Mi, 16 Jun 2010) $+ * $LastChangedRevision: 6922 $+ * $LastChangedBy: orbiter $+ *+ * This library is free software; you can redistribute it and/or+ * 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/>.+ */++import net.yacy.cora.protocol.RequestHeader;+import de.anomic.server.serverObjects;+import de.anomic.server.serverSwitch;+++public class AccessGrid_p {++ public static serverObjects respond(final RequestHeader requestHeader, final serverObjects post, final serverSwitch switchboard) {+ final serverObjects prop = new serverObjects();+ return prop;+ }++}diff --git a/htroot/AccessPicture_p.java b/htroot/AccessPicture_p.javanew file mode 100644index 000000000..9a8b43c00--- /dev/null+++ b/htroot/AccessPicture_p.java@@ -0,0 +1,184 @@+/**+ * AccessPicture_p+ * Copyright 2011 by Michael Peter Christen; [email protected], Frankfurt a. M., Germany+ * First released 18.02.2010 at http://yacy.net+ *+ * $LastChangedDate: 2010-06-16 17:11:21 +0200 (Mi, 16 Jun 2010) $+ * $LastChangedRevision: 6922 $+ * $LastChangedBy: orbiter $+ *+ * This library is free software; you can redistribute it and/or+ * 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/>.+ */++import java.util.ConcurrentModificationException;+import java.util.Date;+import java.util.Iterator;+import java.util.Set;++import net.yacy.cora.protocol.ConnectionInfo;+import net.yacy.cora.protocol.RequestHeader;+import net.yacy.visualization.HexGridPlotter;+import net.yacy.visualization.PrintTool;+import net.yacy.visualization.RasterPlotter;+import net.yacy.visualization.RasterPlotter.DrawMode;+import de.anomic.search.Switchboard;+import de.anomic.server.serverObjects;+import de.anomic.server.serverSwitch;++public class AccessPicture_p {++ private static int[] times = new int[]{60000, 50000, 40000, 30000, 20000, 10000, 1000};++ public static RasterPlotter respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {+ final Switchboard sb = (Switchboard) env;++ String color_text = "AAAAAA";+ String color_back = "FFFFFF";+ String color_grid = "333333";+ String color_dot = "33CC33";+ String color_line = "555555";++ int width = 1024;+ int height = 576;+ int cellsize = 18;++ if (post != null) {+ width = post.getInt("width", 1024);+ height = post.getInt("height", 576);+ cellsize = post.getInt("cellsize", cellsize);+ color_text = post.get("colortext", color_text);+ color_back = post.get("colorback", color_back);+ color_grid = post.get("colorgrid", color_grid);+ color_dot = post.get("colordot", color_dot);+ color_line = post.get("colorline", color_line);+ }++ // too small values lead to an error, too big to huge CPU/memory consumption, resulting in possible DOS.+ if (width < 32 ) width = 32;+ if (width > 10000) width = 10000;+ if (height < 24) height = 24;+ if (height > 10000) height = 10000;++ final HexGridPlotter picture = new HexGridPlotter(width, height, DrawMode.MODE_SUB, color_back, cellsize);+ picture.drawGrid(color_grid);++ // calculate dimensions for left and right column+ int gridLeft = 0;+ int gridRight = picture.gridWidth() - 2;+ if ((gridRight & 1) == 0) gridRight--;++ // draw home peer+ int centerx = (picture.gridWidth() >> 1) - 1;+ int centery = picture.gridHeight() >> 1;+ picture.setColor(color_dot);+ picture.gridDot(centerx, centery, 5, true);+ //picture.gridDot(centerx, centery, 50, false);+ //picture.gridDot(centerx, centery, 31, false);+ picture.setColor(color_text);+ picture.gridPrint(centerx, centery, 5, "THIS YACY PEER", "\"" + sb.peers.myName().toUpperCase() + "\"", 0);++ // left column: collect data for access from outside+ int verticalSlots = (picture.gridHeight() >> 1) - 1;+ String[] hosts = new String[verticalSlots];+ int[] time = new int[verticalSlots];+ int[] count = new int[verticalSlots];+ for (int i = 0; i < verticalSlots; i++) {hosts[i] = null; time[i] = 0; count[i] = 0;}++ String host;+ int c, h;+ for (int j = 0; j < times.length; j++) {+ Iterator<String> i = sb.accessHosts();+ try {+ while (i.hasNext()) {+ host = i.next();+ c = sb.latestAccessCount(host, times[j]);+ if (c > 0) {+ h = (Math.abs(host.hashCode())) % hosts.length;+ hosts[h] = host;+ count[h] = c;+ time[h] = times[j];+ }+ }+ } catch (final ConcurrentModificationException e) {} // we don't want to synchronize this+ }++ // draw left column: access from outside+ for (int i = 0; i < hosts.length; i++) {+ if (hosts[i] != null) {+ picture.setColor(color_dot);+ picture.gridDot(gridLeft, i * 2 + 1, 7, false);+ picture.gridDot(gridLeft, i * 2 + 1, 8, false);+ picture.setColor(color_text);+ picture.gridPrint(gridLeft, i * 2 + 1, 8, hosts[i].toUpperCase(), "COUNT = " + count[i] + ", TIME > " + ((time[i] >= 60000) ? ((time[i] / 60000) + " MINUTES") : ((time[i] / 1000) + " SECONDS")), -1);+ picture.setColor(color_line);+ picture.gridLine(gridLeft, i * 2 + 1, (centerx - gridLeft) / 2, i * 2 + 1);+ picture.gridLine(centerx, centery, (centerx - gridLeft) / 2, i * 2 + 1);+ }+ }++ // right column: collect data for access to outside+ for (int i = 0; i < verticalSlots; i++) {hosts[i] = null; time[i] = 0; count[i] = 0;}+ final Set<ConnectionInfo> allConnections = ConnectionInfo.getAllConnections();+ c = 0;+ synchronized (allConnections) {+ for (final ConnectionInfo conInfo: allConnections) {+ host = conInfo.getTargetHost();+ h = (Math.abs(host.hashCode())) % hosts.length;+ hosts[h] = host + " - " + conInfo.getCommand();+ count[h] = (int) conInfo.getUpbytes();+ time[h] = (int) conInfo.getLifetime();+ }+ }++ // draw right column: access to outside+ for (int i = 0; i < hosts.length; i++) {+ if (hosts[i] != null) {+ picture.setColor(color_dot);+ picture.gridDot(gridRight, i * 2 + 1, 7, false);+ picture.gridDot(gridRight, i * 2 + 1, 8, false);+ picture.setColor(color_text);+ picture.gridPrint(gridRight, i * 2 + 1, 8, hosts[i].toUpperCase(), count[i] + " BYTES, " + time[i] + " MS DUE", 1);+ picture.setColor(color_line);+ picture.gridLine(gridRight, i * 2 + 1, centerx + (gridRight - centerx) / 2, i * 2 + 1);+ picture.gridLine(centerx, centery, centerx + (gridRight - centerx) / 2, i * 2 + 1);+ }+ }++ // print headline+ picture.setColor(color_text);+ PrintTool.print(picture, 2, 6, 0, "YACY NODE ACCESS GRID", -1);+ PrintTool.print(picture, width - 2, 6, 0, "SNAPSHOT FROM " + new Date().toString().toUpperCase(), 1);++ // print legend+ picture.setColor(color_grid);+ picture.gridLine(gridLeft, 0, centerx - 2, 0);+ picture.gridLine(gridLeft, 0, gridLeft, picture.gridHeight() - 1);+ picture.gridLine(centerx - 2, 0, centerx - 2, picture.gridHeight() - 1);+ picture.setColor(color_dot);+ picture.gridLine(gridLeft, picture.gridHeight() - 1, centerx - 2, picture.gridHeight() - 1);+ picture.gridPrint(gridLeft, picture.gridHeight() - 1, 8, "", "INCOMING CONNECTIONS", -1);++ picture.setColor(color_grid);+ picture.gridLine(centerx + 3, 0, gridRight + 1, 0);+ picture.gridLine(centerx + 3, 0, centerx + 3, picture.gridHeight() - 1);+ picture.gridLine(gridRight + 1, 0, gridRight + 1, picture.gridHeight() - 1);+ picture.setColor(color_dot);+ picture.gridLine(centerx + 3, picture.gridHeight() - 1, gridRight + 1, picture.gridHeight() - 1);+ picture.gridPrint(gridRight + 1, picture.gridHeight() - 1, 8, "", "OUTGOING CONNECTIONS", 1);++ return picture;++ }+}diff --git a/htroot/env/templates/header.template b/htroot/env/templates/header.templateindex 6c17c3f1c..f61d073f7 100644--- a/htroot/env/templates/header.template+++ b/htroot/env/templates/header.template@@ -77,7 +77,7 @@<ul class="menu"><li><a href="/Network.html" accesskey="w" class="MenuItemLink">YaCy Network</a></li><li><a href="/WatchWebStructure_p.html?host=auto&depth=2&time=1000" class="MenuItemLink lock">Web Visualization</a></li>- <li><a href="/AccessTracker_p.html" class="MenuItemLink lock">Access Tracker</a></li>+ <li><a href="/AccessGrid_p.html" class="MenuItemLink lock">Access Tracker</a></li><li><a href="/ViewLog_p.html" class="MenuItemLink lock">Server Log</a></li><li><a href="/Messages_p.html" class="MenuItemLink lock">Messages<img src="/notifier.gif" alt="New Messages" /></a></li><li><a href="/terminal_p.html" accesskey="t" class="MenuItemLink lock">Terminal</a></li>diff --git a/htroot/env/templates/submenuAccessTracker.template b/htroot/env/templates/submenuAccessTracker.templateindex 9ed9614d1..d73cdda4f 100644--- a/htroot/env/templates/submenuAccessTracker.template+++ b/htroot/env/templates/submenuAccessTracker.template@@ -3,9 +3,10 @@<div class="SubMenugroup"><h3>Server Access</h3><ul class="SubMenu">- <li><a href="/AccessTracker_p.html?page=0" class="MenuItemLink lock">Overview</a></li>- <li><a href="/AccessTracker_p.html?page=1" class="MenuItemLink lock">Details</a></li>- <li><a href="/Connections_p.html" class="MenuItemLink lock">Connections</a></li>+ <li><a href="/AccessGrid_p.html" class="MenuItemLink lock">Access Grid</a></li>+ <li><a href="/AccessTracker_p.html?page=0" class="MenuItemLink lock">Incoming Requests Overview</a></li>+ <li><a href="/AccessTracker_p.html?page=1" class="MenuItemLink lock">Incoming Requests Details</a></li>+ <li><a href="/Connections_p.html" class="MenuItemLink lock">All Connections</a></li></ul></div>diff --git a/source/de/anomic/yacy/graphics/NetworkGraph.java b/source/de/anomic/yacy/graphics/NetworkGraph.javaindex 2858ef6e3..45884ed31 100644--- a/source/de/anomic/yacy/graphics/NetworkGraph.java+++ b/source/de/anomic/yacy/graphics/NetworkGraph.java@@ -267,10 +267,10 @@ public class NetworkGraph {// draw descriptionnetworkPicture.setColor(COL_HEADLINE);- PrintTool.print(networkPicture, 2, 8, 0, "YACY NETWORK '" + networkName.toUpperCase() + "'", -1);- PrintTool.print(networkPicture, 2, 16, 0, networkTitle.toUpperCase(), -1);- PrintTool.print(networkPicture, width - 2, 8, 0, "SNAPSHOT FROM " + new Date().toString().toUpperCase(), 1);- PrintTool.print(networkPicture, width - 2, 16, 0, "DRAWING OF " + totalCount + " SELECTED PEERS", 1);+ PrintTool.print(networkPicture, 2, 6, 0, "YACY NETWORK '" + networkName.toUpperCase() + "'", -1);+ PrintTool.print(networkPicture, 2, 14, 0, networkTitle.toUpperCase(), -1);+ PrintTool.print(networkPicture, width - 2, 6, 0, "SNAPSHOT FROM " + new Date().toString().toUpperCase(), 1);+ PrintTool.print(networkPicture, width - 2, 14, 0, "DRAWING OF " + totalCount + " SELECTED PEERS", 1);return networkPicture;}