diff options
| author | orbiter <orbiter@6c8d7289-2bf4-0310-a012-ef5d649a1542> | 2009-05-11 21:12:30 +0000 |
|---|---|---|
| committer | orbiter <orbiter@6c8d7289-2bf4-0310-a012-ef5d649a1542> | 2009-05-11 21:12:30 +0000 |
| commit | d3ca0389798565f0fd125ec018c15e290ad6b4aa (patch) | |
| tree | 63c4f5f1c06928f74acad40d35e13af89ac2e6e6 /htroot/processing | |
| parent | 04ec42e1d0564feeb0de067af621ce7cc7198bf0 (diff) | |
fixed domain graph applet (visible in Terminal)
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5946 6c8d7289-2bf4-0310-a012-ef5d649a1542
Diffstat (limited to 'htroot/processing')
| -rwxr-xr-x | htroot/processing/domaingraph/applet/domaingraph.jar | bin | 188763 -> 188849 bytes | |||
| -rwxr-xr-x | htroot/processing/domaingraph/applet/domaingraph.java | 34 | ||||
| -rwxr-xr-x | htroot/processing/domaingraph/applet/domaingraph.pde | 32 | ||||
| -rwxr-xr-x | htroot/processing/domaingraph/domaingraph.pde | 32 |
4 files changed, 82 insertions, 16 deletions
diff --git a/htroot/processing/domaingraph/applet/domaingraph.jar b/htroot/processing/domaingraph/applet/domaingraph.jar Binary files differindex b3d7de50c..2f95b9070 100755 --- a/htroot/processing/domaingraph/applet/domaingraph.jar +++ b/htroot/processing/domaingraph/applet/domaingraph.jar diff --git a/htroot/processing/domaingraph/applet/domaingraph.java b/htroot/processing/domaingraph/applet/domaingraph.java index a8a8b588e..bc84521f5 100755 --- a/htroot/processing/domaingraph/applet/domaingraph.java +++ b/htroot/processing/domaingraph/applet/domaingraph.java @@ -1,4 +1,4 @@ -import processing.core.*; import traer.physics.*; import traer.animation.*; import processing.net.*; import java.applet.*; import java.awt.*; import java.awt.image.*; import java.awt.event.*; import java.io.*; import java.net.*; import java.text.*; import java.util.*; import java.util.zip.*; import javax.sound.midi.*; import javax.sound.midi.spi.*; import javax.sound.sampled.*; import javax.sound.sampled.spi.*; import java.util.regex.*; import javax.xml.parsers.*; import javax.xml.transform.*; import javax.xml.transform.dom.*; import javax.xml.transform.sax.*; import javax.xml.transform.stream.*; import org.xml.sax.*; import org.xml.sax.ext.*; import org.xml.sax.helpers.*; public class domaingraph extends PApplet {// Domain visualization graph for YaCy +import processing.core.*; import traer.physics.*; import traer.animation.*; import processing.net.*; import java.applet.*; import java.awt.*; import java.awt.image.*; import java.awt.event.*; import java.io.*; import java.net.*; import java.text.*; import java.util.*; import java.util.zip.*; public class domaingraph extends PApplet {// Domain visualization graph for YaCy // by Michael Christen // // this applet uses code and the physics engine from @@ -96,7 +96,7 @@ public void draw() { public void initRequest(boolean update) { myClient = new Client(this, host, port); - myClient.write((update) ? "GET /xml/webstructure.xml?latest= HTTP/1.1\n" : "GET /xml/webstructure.xml HTTP/1.1\n"); + myClient.write((update) ? "GET /api/webstructure.xml?latest= HTTP/1.1\n" : "GET /xml/webstructure.xml HTTP/1.1\n"); myClient.write("Host: localhost\n\n"); } @@ -111,8 +111,31 @@ public void processRequestResponse(int steps) { String line = myClient.readStringUntil((byte) 10); //println("Line: " + line); if (line == null) line = ""; else line = line.trim(); - if (line.startsWith("<domain")) processDomain(parseProps(line.substring(7, line.length() - 1).trim())); - if (line.startsWith("<citation")) processCitation(parseProps(line.substring(9, line.length() - 2).trim())); + /* + <domain host="www.oreilly.com" id="-1po3Y" date="20090510"> + <reference id="uU2r5Q" count="2">www.catb.org</reference> + <reference id="zG43kY" count="516">oreilly.com</reference> + <reference id="QEf_LZ" count="44">www.oreillynet.com</reference> + + </domain> + */ + int p = line.indexOf("<domain"); + if (p >= 0) { + //println("domain :" + line.substring(p + 8, line.length() - 1).trim()); + processDomain(parseProps(line.substring(p + 8, line.length() - 1).trim())); + } + p = line.indexOf("<reference"); + if (p >= 0) { + int q = line.indexOf("</reference>"); + if (q > 0) { + int r = line.lastIndexOf('>', q); + if (r > 0) { + String refhost = line.substring(r, q); + //println("reference:" + line.substring(p + 11, r).trim()); + processCitation(refhost, parseProps(line.substring(p + 11, r).trim())); + } + } + } lastUpdate = System.currentTimeMillis(); } else { initTime = false; @@ -135,9 +158,8 @@ public void processDomain(HashMap props) { addAttraction(h.node); } -public void processCitation(HashMap props) { +public void processCitation(String host, HashMap props) { //println("Citation: " + props.toString()); - String host = (String) props.get("host"); if (host == null) host = ""; String id = (String) props.get("id"); if (id == null) id = ""; int count = 0; try { diff --git a/htroot/processing/domaingraph/applet/domaingraph.pde b/htroot/processing/domaingraph/applet/domaingraph.pde index 8936c07a3..1dfbb495a 100755 --- a/htroot/processing/domaingraph/applet/domaingraph.pde +++ b/htroot/processing/domaingraph/applet/domaingraph.pde @@ -96,7 +96,7 @@ void draw() { void initRequest(boolean update) { myClient = new Client(this, host, port); - myClient.write((update) ? "GET /xml/webstructure.xml?latest= HTTP/1.1\n" : "GET /xml/webstructure.xml HTTP/1.1\n"); + myClient.write((update) ? "GET /api/webstructure.xml?latest= HTTP/1.1\n" : "GET /xml/webstructure.xml HTTP/1.1\n"); myClient.write("Host: localhost\n\n"); } @@ -111,8 +111,31 @@ void processRequestResponse(int steps) { String line = myClient.readStringUntil((byte) 10); //println("Line: " + line); if (line == null) line = ""; else line = line.trim(); - if (line.startsWith("<domain")) processDomain(parseProps(line.substring(7, line.length() - 1).trim())); - if (line.startsWith("<citation")) processCitation(parseProps(line.substring(9, line.length() - 2).trim())); + /* + <domain host="www.oreilly.com" id="-1po3Y" date="20090510"> + <reference id="uU2r5Q" count="2">www.catb.org</reference> + <reference id="zG43kY" count="516">oreilly.com</reference> + <reference id="QEf_LZ" count="44">www.oreillynet.com</reference> + + </domain> + */ + int p = line.indexOf("<domain"); + if (p >= 0) { + //println("domain :" + line.substring(p + 8, line.length() - 1).trim()); + processDomain(parseProps(line.substring(p + 8, line.length() - 1).trim())); + } + p = line.indexOf("<reference"); + if (p >= 0) { + int q = line.indexOf("</reference>"); + if (q > 0) { + int r = line.lastIndexOf('>', q); + if (r > 0) { + String refhost = line.substring(r, q); + //println("reference:" + line.substring(p + 11, r).trim()); + processCitation(refhost, parseProps(line.substring(p + 11, r).trim())); + } + } + } lastUpdate = System.currentTimeMillis(); } else { initTime = false; @@ -135,9 +158,8 @@ void processDomain(HashMap props) { addAttraction(h.node); } -void processCitation(HashMap props) { +void processCitation(String host, HashMap props) { //println("Citation: " + props.toString()); - String host = (String) props.get("host"); if (host == null) host = ""; String id = (String) props.get("id"); if (id == null) id = ""; int count = 0; try { diff --git a/htroot/processing/domaingraph/domaingraph.pde b/htroot/processing/domaingraph/domaingraph.pde index 8936c07a3..1dfbb495a 100755 --- a/htroot/processing/domaingraph/domaingraph.pde +++ b/htroot/processing/domaingraph/domaingraph.pde @@ -96,7 +96,7 @@ void draw() { void initRequest(boolean update) { myClient = new Client(this, host, port); - myClient.write((update) ? "GET /xml/webstructure.xml?latest= HTTP/1.1\n" : "GET /xml/webstructure.xml HTTP/1.1\n"); + myClient.write((update) ? "GET /api/webstructure.xml?latest= HTTP/1.1\n" : "GET /xml/webstructure.xml HTTP/1.1\n"); myClient.write("Host: localhost\n\n"); } @@ -111,8 +111,31 @@ void processRequestResponse(int steps) { String line = myClient.readStringUntil((byte) 10); //println("Line: " + line); if (line == null) line = ""; else line = line.trim(); - if (line.startsWith("<domain")) processDomain(parseProps(line.substring(7, line.length() - 1).trim())); - if (line.startsWith("<citation")) processCitation(parseProps(line.substring(9, line.length() - 2).trim())); + /* + <domain host="www.oreilly.com" id="-1po3Y" date="20090510"> + <reference id="uU2r5Q" count="2">www.catb.org</reference> + <reference id="zG43kY" count="516">oreilly.com</reference> + <reference id="QEf_LZ" count="44">www.oreillynet.com</reference> + + </domain> + */ + int p = line.indexOf("<domain"); + if (p >= 0) { + //println("domain :" + line.substring(p + 8, line.length() - 1).trim()); + processDomain(parseProps(line.substring(p + 8, line.length() - 1).trim())); + } + p = line.indexOf("<reference"); + if (p >= 0) { + int q = line.indexOf("</reference>"); + if (q > 0) { + int r = line.lastIndexOf('>', q); + if (r > 0) { + String refhost = line.substring(r, q); + //println("reference:" + line.substring(p + 11, r).trim()); + processCitation(refhost, parseProps(line.substring(p + 11, r).trim())); + } + } + } lastUpdate = System.currentTimeMillis(); } else { initTime = false; @@ -135,9 +158,8 @@ void processDomain(HashMap props) { addAttraction(h.node); } -void processCitation(HashMap props) { +void processCitation(String host, HashMap props) { //println("Citation: " + props.toString()); - String host = (String) props.get("host"); if (host == null) host = ""; String id = (String) props.get("id"); if (id == null) id = ""; int count = 0; try { |
