summaryrefslogtreecommitdiff
path: root/htroot
diff options
context:
space:
mode:
authororbiter <orbiter@6c8d7289-2bf4-0310-a012-ef5d649a1542>2007-05-22 15:20:50 +0000
committerorbiter <orbiter@6c8d7289-2bf4-0310-a012-ef5d649a1542>2007-05-22 15:20:50 +0000
commita585b4d41b5136dac1e8a04df3c79c62da80ac5f (patch)
tree89584ad64836055359c88790e7c3b75880ee095f /htroot
parent33ad0c82463ceec6f3b2e703e538e9d6721295f7 (diff)
added web structure image
see http://localhost:8080/WatchWebStructure_p.html git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3747 6c8d7289-2bf4-0310-a012-ef5d649a1542
Diffstat (limited to 'htroot')
-rw-r--r--htroot/WatchCrawler_p.html4
-rw-r--r--htroot/WatchWebStructure_p.html15
-rw-r--r--htroot/WatchWebStructure_p.java14
-rw-r--r--htroot/WebStructurePicture_p.java132
-rw-r--r--htroot/env/templates/submenuCrawler.template7
-rw-r--r--htroot/imagetest.java8
-rw-r--r--htroot/xml/webstructure.java33
-rw-r--r--htroot/xml/webstructure.xml2
8 files changed, 206 insertions, 9 deletions
diff --git a/htroot/WatchCrawler_p.html b/htroot/WatchCrawler_p.html
index 784108152..6282d0314 100644
--- a/htroot/WatchCrawler_p.html
+++ b/htroot/WatchCrawler_p.html
@@ -7,7 +7,9 @@
<script type="text/javascript" src="/js/xml.js"></script>
<script type="text/javascript" src="/js/html.js"></script>
<script type="text/javascript" src="/js/WatchCrawler.js"></script></head>
-<body id="watchCrawler"> #%env/templates/header.template%#
+<body id="watchCrawler">
+#%env/templates/header.template%#
+#%env/templates/submenuCrawler.template%#
<h2>Crawler Monitor</h2>
<p> Next update in <span id="nextUpdate" onclick="changeInterval()"></span> seconds. <img src="/env/grafics/empty.gif" name="ajax" alt="empty"/>
</p>
diff --git a/htroot/WatchWebStructure_p.html b/htroot/WatchWebStructure_p.html
new file mode 100644
index 000000000..f262a6a4f
--- /dev/null
+++ b/htroot/WatchWebStructure_p.html
@@ -0,0 +1,15 @@
+<!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]#': Web Structure</title>
+#%env/templates/metas.template%#
+</head>
+<body id="WebStructure">
+#%env/templates/header.template%#
+#%env/templates/submenuCrawler.template%#
+<h2>Web Structure</h2>
+<img src="WebStructurePicture_p.png">
+
+#%env/templates/footer.template%#
+</body>
+</html>
diff --git a/htroot/WatchWebStructure_p.java b/htroot/WatchWebStructure_p.java
new file mode 100644
index 000000000..b86c2a581
--- /dev/null
+++ b/htroot/WatchWebStructure_p.java
@@ -0,0 +1,14 @@
+
+import de.anomic.http.httpHeader;
+import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.server.serverObjects;
+import de.anomic.server.serverSwitch;
+
+
+public class WatchWebStructure_p {
+ public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) {
+ plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ serverObjects prop = new serverObjects();
+ return prop;
+ }
+}
diff --git a/htroot/WebStructurePicture_p.java b/htroot/WebStructurePicture_p.java
new file mode 100644
index 000000000..019cf1bae
--- /dev/null
+++ b/htroot/WebStructurePicture_p.java
@@ -0,0 +1,132 @@
+// WebStructurePicture.java
+// (C) 2007 by Michael Peter Christen; mc@anomic.de, Frankfurt a. M., Germany
+// first published 22.05.2007 on http://yacy.net
+//
+// This is a part of YaCy, a peer-to-peer based web search engine
+//
+// $LastChangedDate: 2006-04-02 22:40:07 +0200 (So, 02 Apr 2006) $
+// $LastChangedRevision: 1986 $
+// $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
+// (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
+
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Map;
+
+import de.anomic.http.httpHeader;
+import de.anomic.kelondro.kelondroBase64Order;
+import de.anomic.net.URL;
+import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.plasma.plasmaURL;
+import de.anomic.plasma.plasmaWebStructure;
+import de.anomic.server.serverObjects;
+import de.anomic.server.serverSwitch;
+import de.anomic.ymage.ymageGraph;
+import de.anomic.ymage.ymageMatrix;
+
+public class WebStructurePicture_p {
+
+ private static final double maxlongd = (double) Long.MAX_VALUE;
+
+ public static ymageMatrix respond(httpHeader header, serverObjects post, serverSwitch env) {
+ plasmaSwitchboard sb = (plasmaSwitchboard) env;
+
+ int width = 768;
+ int height = 576;
+ int depth = 3;
+ String host = null;
+
+ if (post != null) {
+ width = post.getInt("width", 768);
+ height = post.getInt("height", 576);
+ depth = post.getInt("depth", 3);
+ host = post.get("host", null);
+ }
+
+ //too small values lead to an error, too big to huge CPU/memory consumption, resulting in possible DOS.
+ if (width < 320 ) width = 320;
+ if (width > 1920) width = 1920;
+ if (height < 240) height = 240;
+ if (height > 1920) height = 1920;
+ if (depth > 8) depth = 8;
+ if (depth < 1) depth = 1;
+
+ // find start point
+ if (host == null) {
+ // find domain with most references
+ host = sb.webStructure.hostWithMaxReferences();
+ }
+ // find start hash
+ String hash = null;
+ try {
+ hash = plasmaURL.urlHash(new URL("http://" + host)).substring(6);
+ } catch (MalformedURLException e) {e.printStackTrace();}
+ assert (sb.webStructure.references(hash) != null);
+
+ // recursively find domains, up to a specific depth
+ ymageGraph graph = new ymageGraph();
+ place(graph, sb.webStructure, hash, host, 0.0, 0.0, 0, depth);
+ //graph.print();
+
+ return graph.draw(width, height, 20, 20, 20, 20);
+
+ }
+
+ private static final void place(ymageGraph graph, plasmaWebStructure structure, String centerhash, String centerhost, double x, double y, int nextlayer, int maxlayer) {
+ // returns the host string
+ assert centerhost != null;
+ ymageGraph.coordinate center = graph.getPoint(centerhost);
+ if (center == null) center = graph.addPoint(centerhost, x, y, nextlayer);
+ if (nextlayer == maxlayer) return;
+ nextlayer++;
+ Map next = structure.references(centerhash);
+ Map.Entry entry;
+ String targethash, targethost;
+ // first set points to next hosts
+ Iterator i = next.entrySet().iterator();
+ ArrayList targets = new ArrayList();
+ while (i.hasNext()) {
+ entry = (Map.Entry) i.next();
+ targethash = (String) entry.getKey();
+ targethost = structure.resolveDomHash2DomString(targethash);
+ if (targethost == null) continue;
+ targets.add(new String[] {targethash, targethost});
+ if (graph.getPoint(targethost) != null) continue;
+ // set a new point. It is placed on a circle around the host point
+ double angle = ((double) kelondroBase64Order.enhancedCoder.cardinal((targethash + "____").getBytes())) / maxlongd * 2 * Math.PI;
+ System.out.println("ANGLE = " + angle);
+ double radius = 1.0 / ((double) (1 << nextlayer));
+ graph.addPoint(targethost, x + radius * Math.cos(angle), y + radius * Math.sin(angle), nextlayer);
+ }
+ // recursively set next hosts
+ i = targets.iterator();
+ String[] target;
+ while (i.hasNext()) {
+ target = (String[]) i.next();
+ targethash = target[0];
+ targethost = target[1];
+ ymageGraph.coordinate c = graph.getPoint(targethost);
+ assert c != null;
+ place(graph, structure, targethash, targethost, c.x, c.y, nextlayer, maxlayer);
+ graph.setBorder(centerhost, targethost);
+ }
+ return;
+ }
+
+}
diff --git a/htroot/env/templates/submenuCrawler.template b/htroot/env/templates/submenuCrawler.template
new file mode 100644
index 000000000..63467593c
--- /dev/null
+++ b/htroot/env/templates/submenuCrawler.template
@@ -0,0 +1,7 @@
+<div class="SubMenu">
+<h3>Crawler Monitor Menu</h3>
+<ul class="SubMenu">
+<li><a href="/WatchCrawler_p.html" class="MenuItemLink lock">Crawler Queues</a></li>
+<li><a href="/WatchWebStructure_p.html" class="MenuItemLink lock">Web Structure</a></li>
+</ul>
+</div> \ No newline at end of file
diff --git a/htroot/imagetest.java b/htroot/imagetest.java
index e1004a66d..004dd6cd9 100644
--- a/htroot/imagetest.java
+++ b/htroot/imagetest.java
@@ -88,8 +88,8 @@ public class imagetest {
img.setMode(ymageMatrix.MODE_SUB);
img.setColor(ymageMatrix.SUBTRACTIVE_BLACK);
- for (int y = 0; y < 600; y = y + 50) ymageToolPrint.print(img, 0, 6 + y, 0, "" + y, true);
- for (int x = 0; x < 800; x = x + 50) ymageToolPrint.print(img, x, 6 , 0, "" + x, true);
+ for (int y = 0; y < 600; y = y + 50) ymageToolPrint.print(img, 0, 6 + y, 0, "" + y, -1);
+ for (int x = 0; x < 800; x = x + 50) ymageToolPrint.print(img, x, 6 , 0, "" + x, -1);
img.setColor(ymageMatrix.SUBTRACTIVE_RED);
img.dot(550, 110, 90, true);
img.setColor(ymageMatrix.SUBTRACTIVE_GREEN);
@@ -102,9 +102,9 @@ public class imagetest {
img.arc(220, 110, 50, 90, 30, 110);
img.arc(210, 120, 50, 90, 30, 110);
img.setColor(ymageMatrix.SUBTRACTIVE_BLACK);
- ymageToolPrint.print(img, 50, 110, 0, "BROADCAST MESSAGE #772: NODE %882 BLACK abcefghijklmnopqrstuvwxyz", true);
+ ymageToolPrint.print(img, 50, 110, 0, "BROADCAST MESSAGE #772: NODE %882 BLACK abcefghijklmnopqrstuvwxyz", -1);
img.setColor(ymageMatrix.SUBTRACTIVE_GREEN);
- ymageToolPrint.print(img, 50, 120, 0, "BROADCAST MESSAGE #772: NODE %882 GREEN abcefghijklmnopqrstuvwxyz", true);
+ ymageToolPrint.print(img, 50, 120, 0, "BROADCAST MESSAGE #772: NODE %882 GREEN abcefghijklmnopqrstuvwxyz", -1);
for (long i = 0; i < 256; i++) {
img.setColor(i);
img.dot(10 + 14 * (int) (i / 16), 200 + 14 * (int) (i % 16), 6, true);
diff --git a/htroot/xml/webstructure.java b/htroot/xml/webstructure.java
index 23ba36d23..a254d88c1 100644
--- a/htroot/xml/webstructure.java
+++ b/htroot/xml/webstructure.java
@@ -1,3 +1,30 @@
+// webstructure.java
+// (C) 2007 by Michael Peter Christen; mc@anomic.de, Frankfurt a. M., Germany
+// first published 22.05.2007 on http://yacy.net
+//
+// This is a part of YaCy, a peer-to-peer based web search engine
+//
+// $LastChangedDate: 2006-04-02 22:40:07 +0200 (So, 02 Apr 2006) $
+// $LastChangedRevision: 1986 $
+// $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
+// (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 xml;
import java.util.Iterator;
@@ -14,8 +41,7 @@ public class webstructure {
public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) {
serverObjects prop = new serverObjects();
plasmaSwitchboard sb = (plasmaSwitchboard) env;
- plasmaWebStructure structure = sb.webStructure;
- Iterator i = structure.structureEntryIterator();
+ Iterator i = sb.webStructure.structureEntryIterator();
int c = 0, d;
plasmaWebStructure.structureEntry sentry;
Map.Entry refentry;
@@ -32,7 +58,7 @@ public class webstructure {
refloop: while (k.hasNext()) {
refentry = (Map.Entry) k.next();
refhash = (String) refentry.getKey();
- refdom = structure.resolveDomHash2DomString(refhash);
+ refdom = sb.webStructure.resolveDomHash2DomString(refhash);
if (refdom == null) continue refloop;
prop.put("domains_" + c + "_citations_" + d + "_refhash", refhash);
prop.put("domains_" + c + "_citations_" + d + "_refdom", refdom);
@@ -44,6 +70,7 @@ public class webstructure {
c++;
}
prop.put("domains", c);
+ prop.put("maxref", plasmaWebStructure.maxref);
// return rewrite properties
return prop;
diff --git a/htroot/xml/webstructure.xml b/htroot/xml/webstructure.xml
index 87f04c1f6..79acdc859 100644
--- a/htroot/xml/webstructure.xml
+++ b/htroot/xml/webstructure.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<webstructure>
-<domains reference="forward" count="#[domains]#">
+<domains reference="forward" count="#[domains]#" maxref="#[maxref]#">
#{domains}#
<domain host="#[domain]#" id="#[hash]#" date="#[date]#">
#{citations}#