Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

- refactoring - added new experimental (not-yet-working) image parser - added new test image

orbiter3528b970d62b
diff --git a/htroot/Banner.java b/htroot/Banner.java
index 9814a107f..a0bcb7808 100644
--- a/htroot/Banner.java
+++ b/htroot/Banner.java
@@ -31,19 +31,20 @@ import java.io.IOException;
import javax.imageio.ImageIO;
+import net.yacy.visualization.RasterPlotter;
+
import de.anomic.http.server.RequestHeader;
import de.anomic.search.Switchboard;
import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacySeed;
-import de.anomic.ymage.NetworkGraph;
-import de.anomic.ymage.ymageMatrix;
+import de.anomic.yacy.graphics.NetworkGraph;
/** draw a banner with information about the peer */
public class Banner {
- public static ymageMatrix respond(final RequestHeader header, final serverObjects post, final serverSwitch env) throws IOException {
+ public static RasterPlotter respond(final RequestHeader header, final serverObjects post, final serverSwitch env) throws IOException {
final Switchboard sb = (Switchboard) env;
final String IMAGE = "htroot/env/grafics/yacy.gif";
int width = 468;
diff --git a/htroot/ConfigParser.java b/htroot/ConfigParser.java
index e412fb301..6742636cb 100644
--- a/htroot/ConfigParser.java
+++ b/htroot/ConfigParser.java
@@ -26,7 +26,7 @@
// if the shell's current path is HTROOT
import net.yacy.document.Idiom;
-import net.yacy.document.Parser;
+import net.yacy.document.TextParser;
import de.anomic.http.server.RequestHeader;
import de.anomic.search.Switchboard;
import de.anomic.search.SwitchboardConstants;
@@ -52,23 +52,23 @@ public class ConfigParser {
if (post.containsKey("parserSettings")) {
post.remove("parserSettings");
- for (Idiom parser: Parser.idioms()) {
+ for (Idiom parser: TextParser.idioms()) {
for (String mimeType: parser.supportedMimeTypes()) {
- Parser.grantMime(mimeType, post.get("mimename_" + mimeType, "").equals("on"));
+ TextParser.grantMime(mimeType, post.get("mimename_" + mimeType, "").equals("on"));
}
}
- env.setConfig(SwitchboardConstants.PARSER_MIME_DENY, Parser.getDenyMime());
+ env.setConfig(SwitchboardConstants.PARSER_MIME_DENY, TextParser.getDenyMime());
}
}
int i = 0;
- for (Idiom parser: Parser.idioms()) {
+ for (Idiom parser: TextParser.idioms()) {
prop.put("parser_" + i + "_name", parser.getName());
int mimeIdx = 0;
for (String mimeType: parser.supportedMimeTypes()) {
prop.put("parser_" + i + "_mime_" + mimeIdx + "_mimetype", mimeType);
- prop.put("parser_" + i + "_mime_" + mimeIdx + "_status", (Parser.supportsMime(mimeType) == null) ? 1 : 0);
+ prop.put("parser_" + i + "_mime_" + mimeIdx + "_status", (TextParser.supportsMime(mimeType) == null) ? 1 : 0);
mimeIdx++;
}
prop.put("parser_" + i + "_mime", mimeIdx);
diff --git a/htroot/ConfigUpdate_p.java b/htroot/ConfigUpdate_p.java
index dff277940..12d7eb53f 100644
--- a/htroot/ConfigUpdate_p.java
+++ b/htroot/ConfigUpdate_p.java
@@ -31,12 +31,12 @@ import java.util.TreeSet;
import net.yacy.kelondro.data.meta.DigestURI;
import net.yacy.kelondro.util.FileUtils;
+import net.yacy.kelondro.util.OS;
import de.anomic.http.server.RequestHeader;
import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
-import de.anomic.server.serverSystem;
import de.anomic.yacy.yacyBuildProperties;
import de.anomic.yacy.yacyRelease;
import de.anomic.yacy.yacyVersion;
@@ -52,7 +52,7 @@ public class ConfigUpdate_p {
if (yacyBuildProperties.isPkgManager()) {
prop.put("candeploy", "2");
return prop;
- } else if (serverSystem.canExecUnix || serverSystem.isWindows) {
+ } else if (OS.canExecUnix || OS.isWindows) {
// we can deploy a new system with (i.e.)
// cd DATA/RELEASE;tar xfz $1;cp -Rf yacy/* ../../;rm -Rf yacy
prop.put("candeploy", "1");
diff --git a/htroot/NetworkPicture.java b/htroot/NetworkPicture.java
index 100bc1063..1ec251e96 100644
--- a/htroot/NetworkPicture.java
+++ b/htroot/NetworkPicture.java
@@ -24,18 +24,18 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+import net.yacy.visualization.RasterPlotter;
import de.anomic.http.server.RequestHeader;
import de.anomic.search.Switchboard;
import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
-import de.anomic.ymage.NetworkGraph;
-import de.anomic.ymage.ymageMatrix;
+import de.anomic.yacy.graphics.NetworkGraph;
/** draw a picture of the yacy network */
public class NetworkPicture {
- public static ymageMatrix respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static RasterPlotter respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final Switchboard sb = (Switchboard) env;
int width = 768;
diff --git a/htroot/PeerLoadPicture.java b/htroot/PeerLoadPicture.java
index d65b69e4c..b9ea82a63 100644
--- a/htroot/PeerLoadPicture.java
+++ b/htroot/PeerLoadPicture.java
@@ -9,8 +9,8 @@ import de.anomic.http.server.RequestHeader;
import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
-import de.anomic.ymage.NetworkGraph;
-import de.anomic.ymage.NetworkGraph.CircleThreadPiece;
+import de.anomic.yacy.graphics.NetworkGraph;
+import de.anomic.yacy.graphics.NetworkGraph.CircleThreadPiece;
public class PeerLoadPicture {
diff --git a/htroot/PerformanceGraph.java b/htroot/PerformanceGraph.java
index 11b4bb11d..64d0ee95a 100644
--- a/htroot/PerformanceGraph.java
+++ b/htroot/PerformanceGraph.java
@@ -24,16 +24,16 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+import net.yacy.visualization.RasterPlotter;
import de.anomic.http.server.RequestHeader;
import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
-import de.anomic.ymage.ProfilingGraph;
-import de.anomic.ymage.ymageMatrix;
+import de.anomic.yacy.graphics.ProfilingGraph;
public class PerformanceGraph {
- public static ymageMatrix respond(final RequestHeader header, serverObjects post, final serverSwitch env) {
+ public static RasterPlotter respond(final RequestHeader header, serverObjects post, final serverSwitch env) {
final Switchboard sb = (Switchboard) env;
if (post == null) post = new serverObjects();
diff --git a/htroot/PerformanceQueues_p.java b/htroot/PerformanceQueues_p.java
index 88ba1324c..2725947a2 100644
--- a/htroot/PerformanceQueues_p.java
+++ b/htroot/PerformanceQueues_p.java
@@ -31,6 +31,7 @@ import java.util.Map;
import net.yacy.kelondro.util.FileUtils;
import net.yacy.kelondro.util.Formatter;
+import net.yacy.kelondro.util.OS;
import net.yacy.kelondro.workflow.BusyThread;
import net.yacy.kelondro.workflow.WorkflowThread;
@@ -42,7 +43,6 @@ import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverCore;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
-import de.anomic.server.serverSystem;
public class PerformanceQueues_p {
/**
@@ -85,7 +85,7 @@ public class PerformanceQueues_p {
if (post.containsKey("Xmx")) {
int xmx = 120; // default maximum heap size
try { xmx = Integer.valueOf(post.get("Xmx", "120")).intValue(); } catch (final NumberFormatException e){}
- if (!(serverSystem.isWin32 && xmx >= 2000)){
+ if (!(OS.isWin32 && xmx >= 2000)){
sb.setConfig("javastart_Xmx", "Xmx" + xmx + "m");
sb.setConfig("javastart_Xms", "Xms" + xmx + "m");
prop.put("setStartupCommit", "1");
diff --git a/htroot/PerformanceSearch_p.java b/htroot/PerformanceSearch_p.java
index 7f28517c4..543563b55 100644
--- a/htroot/PerformanceSearch_p.java
+++ b/htroot/PerformanceSearch_p.java
@@ -28,11 +28,12 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
+import net.yacy.kelondro.util.MemoryTracker;
+
import de.anomic.http.server.RequestHeader;
import de.anomic.server.serverObjects;
-import de.anomic.server.serverProfiling;
import de.anomic.server.serverSwitch;
-import de.anomic.ymage.ProfilingGraph;
+import de.anomic.yacy.graphics.ProfilingGraph;
public class PerformanceSearch_p {
@@ -40,13 +41,13 @@ public class PerformanceSearch_p {
// return variable that accumulates replacements
final serverObjects prop = new serverObjects();
- final ArrayList<serverProfiling.Event> events = serverProfiling.history("SEARCH");
+ final ArrayList<MemoryTracker.Event> events = MemoryTracker.history("SEARCH");
int c = 0;
- serverProfiling.Event event;
+ MemoryTracker.Event event;
ProfilingGraph.searchEvent search;
long lastt = 0;
if (events != null) synchronized (events) {
- Iterator<serverProfiling.Event> i = events.iterator();
+ Iterator<MemoryTracker.Event> i = events.iterator();
while (i.hasNext()) {
event = i.next();
search = (ProfilingGraph.searchEvent) event.payload;
diff --git a/htroot/SearchEventPicture.java b/htroot/SearchEventPicture.java
index b555fab30..a087e0450 100644
--- a/htroot/SearchEventPicture.java
+++ b/htroot/SearchEventPicture.java
@@ -24,24 +24,24 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+import net.yacy.visualization.RasterPlotter;
import de.anomic.http.server.RequestHeader;
import de.anomic.search.SearchEventCache;
import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
-import de.anomic.ymage.NetworkGraph;
-import de.anomic.ymage.ymageMatrix;
+import de.anomic.yacy.graphics.NetworkGraph;
// draw a picture of the yacy network
public class SearchEventPicture {
- public static ymageMatrix respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static RasterPlotter respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final Switchboard sb = (Switchboard) env;
final String eventID = header.get("event", SearchEventCache.lastEventID);
if (eventID == null) return null;
- final ymageMatrix yp = NetworkGraph.getSearchEventPicture(sb.peers, eventID);
- if (yp == null) return new ymageMatrix(1, 1, ymageMatrix.MODE_SUB, "000000"); // empty image
+ final RasterPlotter yp = NetworkGraph.getSearchEventPicture(sb.peers, eventID);
+ if (yp == null) return new RasterPlotter(1, 1, RasterPlotter.MODE_SUB, "000000"); // empty image
return yp;
}
diff --git a/htroot/ViewImage.java b/htroot/ViewImage.java
index eae155cec..21732e8d8 100644
--- a/htroot/ViewImage.java
+++ b/htroot/ViewImage.java
@@ -29,6 +29,7 @@ import java.io.InputStream;
import java.net.MalformedURLException;
import java.util.HashMap;
+import net.yacy.document.ImageParser;
import net.yacy.kelondro.data.meta.DigestURI;
import net.yacy.kelondro.logging.Log;
import net.yacy.kelondro.util.FileUtils;
@@ -38,7 +39,6 @@ import de.anomic.http.server.RequestHeader;
import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
-import de.anomic.ymage.ymageImageParser;
public class ViewImage {
@@ -124,7 +124,7 @@ public class ViewImage {
}
// read image
- final Image image = ymageImageParser.parse(urlString, imgb);
+ final Image image = ImageParser.parse(urlString, imgb);
if (image == null || (auth && (width == 0 || height == 0) && maxwidth == 0 && maxheight == 0)) return image;
diff --git a/htroot/WebStructurePicture_p.java b/htroot/WebStructurePicture_p.java
index 0ed529c99..3c9b7aee8 100644
--- a/htroot/WebStructurePicture_p.java
+++ b/htroot/WebStructurePicture_p.java
@@ -33,21 +33,21 @@ import java.util.Map;
import net.yacy.kelondro.data.meta.DigestURI;
import net.yacy.kelondro.order.Base64Order;
+import net.yacy.visualization.PrintTool;
+import net.yacy.visualization.RasterPlotter;
+import net.yacy.visualization.GraphPlotter;
import de.anomic.http.server.RequestHeader;
import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
-import de.anomic.ymage.WebStructureGraph;
-import de.anomic.ymage.ymageGraph;
-import de.anomic.ymage.ymageMatrix;
-import de.anomic.ymage.ymageToolPrint;
+import de.anomic.yacy.graphics.WebStructureGraph;
public class WebStructurePicture_p {
private static final double maxlongd = Long.MAX_VALUE;
- public static ymageMatrix respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static RasterPlotter respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final Switchboard sb = (Switchboard) env;
int width = 768;
@@ -82,12 +82,12 @@ public class WebStructurePicture_p {
// find domain with most references
host = sb.webStructure.hostWithMaxReferences();
}
- ymageMatrix graphPicture;
+ RasterPlotter graphPicture;
if (host == null) {
// probably no information available
- graphPicture = new ymageMatrix(width, height, ymageMatrix.MODE_SUB, ymageGraph.color_back);
- ymageToolPrint.print(graphPicture, width / 2, height / 2, 0, "NO WEB STRUCTURE DATA AVAILABLE.", 0);
- ymageToolPrint.print(graphPicture, width / 2, height / 2 + 16, 0, "START A WEB CRAWL TO OBTAIN STRUCTURE DATA.", 0);
+ graphPicture = new RasterPlotter(width, height, RasterPlotter.MODE_SUB, GraphPlotter.color_back);
+ PrintTool.print(graphPicture, width / 2, height / 2, 0, "NO WEB STRUCTURE DATA AVAILABLE.", 0);
+ PrintTool.print(graphPicture, width / 2, height / 2 + 16, 0, "START A WEB CRAWL TO OBTAIN STRUCTURE DATA.", 0);
} else {
// find start hash
String hash = null;
@@ -97,26 +97,26 @@ public class WebStructurePicture_p {
//assert (sb.webStructure.outgoingReferences(hash) != null);
// recursively find domains, up to a specific depth
- final ymageGraph graph = new ymageGraph();
+ final GraphPlotter graph = new GraphPlotter();
if (host != null) place(graph, sb.webStructure, hash, host, nodes, timeout, 0.0, 0.0, 0, depth);
//graph.print();
graphPicture = graph.draw(width, height, 40, 40, 16, 16);
}
// print headline
- graphPicture.setColor(ymageGraph.color_text);
- ymageToolPrint.print(graphPicture, 2, 8, 0, "YACY WEB-STRUCTURE ANALYSIS", -1);
- if (host != null) ymageToolPrint.print(graphPicture, 2, 16, 0, "LINK ENVIRONMENT OF DOMAIN " + host.toUpperCase(), -1);
- ymageToolPrint.print(graphPicture, width - 2, 8, 0, "SNAPSHOT FROM " + new Date().toString().toUpperCase(), 1);
+ graphPicture.setColor(GraphPlotter.color_text);
+ PrintTool.print(graphPicture, 2, 8, 0, "YACY WEB-STRUCTURE ANALYSIS", -1);
+ if (host != null) PrintTool.print(graphPicture, 2, 16, 0, "LINK ENVIRONMENT OF DOMAIN " + host.toUpperCase(), -1);
+ PrintTool.print(graphPicture, width - 2, 8, 0, "SNAPSHOT FROM " + new Date().toString().toUpperCase(), 1);
return graphPicture;
}
- private static final int place(final ymageGraph graph, final WebStructureGraph structure, final String centerhash, final String centerhost, int maxnodes, final long timeout, final double x, final double y, int nextlayer, final int maxlayer) {
+ private static final int place(final GraphPlotter graph, final WebStructureGraph structure, final String centerhash, final String centerhost, int maxnodes, final long timeout, final double x, final double y, int nextlayer, final int maxlayer) {
// returns the number of nodes that had been placed
assert centerhost != null;
- ymageGraph.coordinate center = graph.getPoint(centerhost);
+ GraphPlotter.coordinate center = graph.getPoint(centerhost);
int mynodes = 0;
if (center == null) {
/*center =*/ graph.addPoint(centerhost, x, y, nextlayer);
@@ -164,7 +164,7 @@ public class WebStructurePicture_p {
target = j.next();
targethash = target[0];
targethost = target[1];
- final ymageGraph.coordinate c = graph.getPoint(targethost);
+ final GraphPlotter.coordinate c = graph.getPoint(targethost);
assert c != null;
nextnodes = ((maxnodes <= 0) || (System.currentTimeMillis() >= timeout)) ? 0 : place(graph, structure, targethash, targethost, maxnodes, timeout, c.x, c.y, nextlayer, maxlayer);
mynodes += nextnodes;
diff --git a/htroot/api/webstructure.java b/htroot/api/webstructure.java
index a5fbae96f..9b005c47b 100644
--- a/htroot/api/webstructure.java
+++ b/htroot/api/webstructure.java
@@ -32,7 +32,7 @@ import de.anomic.http.server.RequestHeader;
import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
-import de.anomic.ymage.WebStructureGraph;
+import de.anomic.yacy.graphics.WebStructureGraph;
public class webstructure {
diff --git a/htroot/cytag.java b/htroot/cytag.java
index 3ffec68fa..c5ec2af4b 100644
--- a/htroot/cytag.java
+++ b/htroot/cytag.java
@@ -30,6 +30,7 @@ import java.io.File;
import java.io.IOException;
import java.util.Date;
+import net.yacy.document.ImageParser;
import net.yacy.document.parser.html.CharacterCoding;
import net.yacy.kelondro.util.DateFormatter;
import net.yacy.kelondro.util.FileUtils;
@@ -38,7 +39,6 @@ import de.anomic.http.server.RequestHeader;
import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
-import de.anomic.ymage.ymageImageParser;
public class cytag {
@@ -74,7 +74,7 @@ public class cytag {
if (imgb == null) return null;
// read image
- final Image image = ymageImageParser.parse("cytag.png", imgb);
+ final Image image = ImageParser.parse("cytag.png", imgb);
return image;
}
diff --git a/htroot/imagetest.java b/htroot/imagetest.java
index 125d355e9..0911d7d63 100644
--- a/htroot/imagetest.java
+++ b/htroot/imagetest.java
@@ -24,15 +24,15 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+import net.yacy.visualization.PrintTool;
+import net.yacy.visualization.RasterPlotter;
import de.anomic.http.server.RequestHeader;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
-import de.anomic.ymage.ymageMatrix;
-import de.anomic.ymage.ymageToolPrint;
public class imagetest {
- public static ymageMatrix respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static RasterPlotter respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
/*
BufferedImage bi = new BufferedImage(640, 400, BufferedImage.TYPE_INT_RGB);
Graphics2D g = bi.createGraphics();
@@ -64,25 +64,25 @@ public class imagetest {
for (int i = 20; i < 100; i++) r.setPixel(i, 34, new int[]{0, 0, 255});
return bi;
*/
- final ymageMatrix img = new ymageMatrix(800, 600, ymageMatrix.MODE_SUB, "FFFFFF");
- img.setColor(ymageMatrix.GREY);
- 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.RED);
+ final RasterPlotter img = new RasterPlotter(800, 600, RasterPlotter.MODE_SUB, "FFFFFF");
+ img.setColor(RasterPlotter.GREY);
+ for (int y = 0; y < 600; y = y + 50) PrintTool.print(img, 0, 6 + y, 0, "" + y, -1);
+ for (int x = 0; x < 800; x = x + 50) PrintTool.print(img, x, 6 , 0, "" + x, -1);
+ img.setColor(RasterPlotter.RED);
img.dot(550, 110, 90, true);
- img.setColor(ymageMatrix.GREEN);
+ img.setColor(RasterPlotter.GREEN);
img.dot(480, 200, 90, true);
- img.setColor(ymageMatrix.BLUE);
+ img.setColor(RasterPlotter.BLUE);
img.dot(620, 200, 90, true);
- img.setColor(ymageMatrix.RED);
+ img.setColor(RasterPlotter.RED);
img.arc(300, 270, 30, 70, 0, 360);
img.setColor("330000");
img.arc(220, 110, 50, 90, 30, 110);
img.arc(210, 120, 50, 90, 30, 110);
- img.setColor(ymageMatrix.GREY);
- ymageToolPrint.print(img, 50, 110, 0, "BROADCAST MESSAGE #772: NODE %882 GREY abcefghijklmnopqrstuvwxyz", -1);
- img.setColor(ymageMatrix.GREEN);
- ymageToolPrint.print(img, 50, 120, 0, "BROADCAST MESSAGE #772: NODE %882 GREEN abcefghijklmnopqrstuvwxyz", -1);
+ img.setColor(RasterPlotter.GREY);
+ PrintTool.print(img, 50, 110, 0, "BROADCAST MESSAGE #772: NODE %882 GREY abcefghijklmnopqrstuvwxyz", -1);
+ img.setColor(RasterPlotter.GREEN);
+ PrintTool.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);
@@ -104,12 +104,12 @@ public class imagetest {
for (int i = 0; i <= 360; i++) {
img.arc(550, 400, 40, 41 + i/9, 0, i);
}
- img.setColor(ymageMatrix.GREY);
+ img.setColor(RasterPlotter.GREY);
int angle;
for (byte c = (byte) 'A'; c <= 'Z'; c++) {
angle = (c - (byte) 'A') * 360 / ((byte) 'Z' - (byte) 'A');
img.arcLine(550, 400, 81, 100, angle);
- ymageToolPrint.arcPrint(img, 550, 400, 100, angle, "ANGLE" + angle + ":" + (char) c);
+ PrintTool.arcPrint(img, 550, 400, 100, angle, "ANGLE" + angle + ":" + (char) c);
}
return img;
diff --git a/htroot/osm.java b/htroot/osm.java
index 570472032..bd4e101dc 100644
--- a/htroot/osm.java
+++ b/htroot/osm.java
@@ -4,15 +4,15 @@
//$LastChangedBy$
//
+import net.yacy.visualization.RasterPlotter;
import de.anomic.http.server.RequestHeader;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
-import de.anomic.ymage.ymageMatrix;
-import de.anomic.ymage.ymageOSM;
+import de.anomic.yacy.graphics.OSMTile;
public class osm {
- public static ymageMatrix respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static RasterPlotter respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
int zoom = 10;
double lat = 50.11670d;
@@ -24,8 +24,8 @@ public class osm {
lon = post.getDouble("lon", lon);
}
- final ymageOSM.tileCoordinates coord = new ymageOSM.tileCoordinates(lat, lon, zoom);
- return ymageOSM.getCombinedTiles(coord);
+ final OSMTile.tileCoordinates coord = new OSMTile.tileCoordinates(lat, lon, zoom);
+ return OSMTile.getCombinedTiles(coord);
}
}
\ No newline at end of file
diff --git a/htroot/yacy/search.java b/htroot/yacy/search.java
index 9227d6f4c..94c2cc21d 100644
--- a/htroot/yacy/search.java
+++ b/htroot/yacy/search.java
@@ -41,6 +41,7 @@ import net.yacy.kelondro.data.word.WordReference;
import net.yacy.kelondro.order.Base64Order;
import net.yacy.kelondro.order.Bitfield;
import net.yacy.kelondro.rwi.ReferenceContainer;
+import net.yacy.kelondro.util.MemoryTracker;
import net.yacy.kelondro.util.SortStack;
import net.yacy.kelondro.util.ISO639;
@@ -57,13 +58,12 @@ import de.anomic.search.ResultEntry;
import de.anomic.search.RankingProcess.NavigatorEntry;
import de.anomic.server.serverCore;
import de.anomic.server.serverObjects;
-import de.anomic.server.serverProfiling;
import de.anomic.server.serverSwitch;
import de.anomic.tools.crypt;
import de.anomic.yacy.yacyCore;
import de.anomic.yacy.yacyNetwork;
import de.anomic.yacy.yacySeed;
-import de.anomic.ymage.ProfilingGraph;
+import de.anomic.yacy.graphics.ProfilingGraph;
public final class search {
@@ -220,7 +220,7 @@ public final class search {
//final Map<byte[], ReferenceContainer<WordReference>>[] containers = sb.indexSegment.index().searchTerm(theQuery.queryHashes, theQuery.excludeHashes, plasmaSearchQuery.hashes2StringSet(urls));
final HashMap<byte[], ReferenceContainer<WordReference>> incc = sb.indexSegments.termIndex(Segments.Process.PUBLIC).searchConjunction(theQuery.queryHashes, QueryParams.hashes2StringSet(urls));
- serverProfiling.update("SEARCH", new ProfilingGraph.searchEvent(theQuery.id(true), SearchEvent.COLLECTION, incc.size(), System.currentTimeMillis() - timer), false);
+ MemoryTracker.update("SEARCH", new ProfilingGraph.searchEvent(theQuery.id(true), SearchEvent.COLLECTION, incc.size(), System.currentTimeMillis() - timer), false);
if (incc != null) {
final Iterator<Map.Entry<byte[], ReferenceContainer<WordReference>>> ci = incc.entrySet().iterator();
Map.Entry<byte[], ReferenceContainer<WordReference>> entry;
@@ -336,7 +336,7 @@ public final class search {
refstr.append(",").append(e.name);
}
prop.put("references", (refstr.length() > 0) ? refstr.substring(1) : refstr.toString());
- serverProfiling.update("SEARCH", new ProfilingGraph.searchEvent(theQuery.id(true), "reference collection", ws.size(), System.currentTimeMillis() - timer), false);
+ MemoryTracker.update("SEARCH", new ProfilingGraph.searchEvent(theQuery.id(true), "reference collection", ws.size(), System.currentTimeMillis() - timer), false);
}
prop.put("indexabstract", indexabstract.toString());
@@ -363,7 +363,7 @@ public final class search {
}
prop.put("links", links.toString());
prop.put("linkcount", accu.size());
- serverProfiling.update("SEARCH", new ProfilingGraph.searchEvent(theQuery.id(true), "result list preparation", accu.size(), System.currentTimeMillis() - timer), false);
+ MemoryTracker.update("SEARCH", new ProfilingGraph.searchEvent(theQuery.id(true), "result list preparation", accu.size(), System.currentTimeMillis() - timer), false);
}
// add information about forward peers
diff --git a/htroot/yacysearch.java b/htroot/yacysearch.java
index dd77671a3..42f59446d 100644
--- a/htroot/yacysearch.java
+++ b/htroot/yacysearch.java
@@ -36,6 +36,7 @@ import java.util.TreeSet;
import net.yacy.document.Condenser;
import net.yacy.document.Document;
import net.yacy.document.content.RSSMessage;
+import net.yacy.document.geolocalization.Location;
import net.yacy.document.parser.xml.RSSFeed;
import net.yacy.kelondro.data.meta.DigestURI;
import net.yacy.kelondro.data.meta.URIMetadataRow;
@@ -45,13 +46,13 @@ import net.yacy.kelondro.order.Bitfield;
import net.yacy.kelondro.util.Domains;
import net.yacy.kelondro.util.Formatter;
import net.yacy.kelondro.util.MemoryControl;
+import net.yacy.kelondro.util.MemoryTracker;
import net.yacy.kelondro.util.SetTools;
import net.yacy.kelondro.util.ISO639;
import de.anomic.crawler.retrieval.LoaderDispatcher;
import de.anomic.data.DidYouMean;
import de.anomic.data.LibraryProvider;
-import de.anomic.data.Location;
import de.anomic.http.server.HeaderFramework;
import de.anomic.http.server.RequestHeader;
import de.anomic.search.QueryParams;
@@ -64,11 +65,10 @@ import de.anomic.search.Switchboard;
import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverCore;
import de.anomic.server.serverObjects;
-import de.anomic.server.serverProfiling;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyNewsPool;
import de.anomic.yacy.yacyNewsRecord;
-import de.anomic.ymage.ProfilingGraph;
+import de.anomic.yacy.graphics.ProfilingGraph;
public class yacysearch {
@@ -459,7 +459,7 @@ public class yacysearch {
DigestURI.TLD_any_zone_filter,
client,
authenticated);
- serverProfiling.update("SEARCH", new ProfilingGraph.searchEvent(theQuery.id(true), SearchEvent.INITIALIZATION, 0, 0), false);
+ MemoryTracker.update("SEARCH", new ProfilingGraph.searchEvent(theQuery.id(true), SearchEvent.INITIALIZATION, 0, 0), false);
// tell all threads to do nothing for a specific time
sb.intermissionAllThreads(10000);
diff --git a/htroot/yacysearchitem.java b/htroot/yacysearchitem.java
index 811d636c0..e34af8ea2 100644
--- a/htroot/yacysearchitem.java
+++ b/htroot/yacysearchitem.java
@@ -32,6 +32,7 @@ import java.util.TreeSet;
import net.yacy.kelondro.data.meta.DigestURI;
import net.yacy.kelondro.util.Formatter;
+import net.yacy.kelondro.util.MemoryTracker;
import de.anomic.http.server.HeaderFramework;
import de.anomic.http.server.RequestHeader;
@@ -44,13 +45,12 @@ import de.anomic.search.SearchEventCache;
import de.anomic.search.Switchboard;
import de.anomic.search.TextSnippet;
import de.anomic.server.serverObjects;
-import de.anomic.server.serverProfiling;
import de.anomic.server.serverSwitch;
import de.anomic.tools.crypt;
import de.anomic.tools.nxTools;
import de.anomic.yacy.yacyNewsPool;
import de.anomic.yacy.yacySeed;
-import de.anomic.ymage.ProfilingGraph;
+import de.anomic.yacy.graphics.ProfilingGraph;
public class yacysearchitem {
@@ -151,7 +151,7 @@ public class yacysearchitem {
prop.put("content_description", desc);
prop.putXML("content_description-xml", desc);
prop.putJSON("content_description-json", desc);
- serverProfiling.update("SEARCH", new ProfilingGraph.searchEvent(theQuery.id(true), SearchEvent.FINALIZATION + "-" + item, 0, 0), false);
+ MemoryTracker.update("SEARCH", new ProfilingGraph.searchEvent(theQuery.id(true), SearchEvent.FINALIZATION + "-" + item, 0, 0), false);
return prop;
}
diff --git a/htroot/yacysearchtrailer.java b/htroot/yacysearchtrailer.java
index c0b8e2c64..e98e03388 100644
--- a/htroot/yacysearchtrailer.java
+++ b/htroot/yacysearchtrailer.java
@@ -27,15 +27,16 @@
import java.util.ArrayList;
import java.util.Iterator;
+import net.yacy.kelondro.util.MemoryTracker;
+
import de.anomic.http.server.RequestHeader;
import de.anomic.search.QueryParams;
import de.anomic.search.SearchEvent;
import de.anomic.search.SearchEventCache;
import de.anomic.search.RankingProcess.NavigatorEntry;
import de.anomic.server.serverObjects;
-import de.anomic.server.serverProfiling;
import de.anomic.server.serverSwitch;
-import de.anomic.ymage.ProfilingGraph;
+import de.anomic.yacy.graphics.ProfilingGraph;
public class yacysearchtrailer {
@@ -145,7 +146,7 @@ public class yacysearchtrailer {
prop.put("nav-about_body", aboutBody);
}
- serverProfiling.update("SEARCH", new ProfilingGraph.searchEvent(theQuery.id(true), SearchEvent.FINALIZATION + "-" + "bottomline", 0, 0), false);
+ MemoryTracker.update("SEARCH", new ProfilingGraph.searchEvent(theQuery.id(true), SearchEvent.FINALIZATION + "-" + "bottomline", 0, 0), false);
return prop;
}
diff --git a/source/de/anomic/crawler/LoaderMessage.java b/source/de/anomic/crawler/LoaderMessage.java
index 805ee8da2..d0f3a7ef4 100644
--- a/source/de/anomic/crawler/LoaderMessage.java
+++ b/source/de/anomic/crawler/LoaderMessage.java
@@ -23,9 +23,10 @@
package de.anomic.crawler;
+import java.util.concurrent.Semaphore;
+
import net.yacy.kelondro.data.meta.DigestURI;
import de.anomic.crawler.retrieval.Response;
-import de.anomic.server.serverSemaphore;
public final class LoaderMessage {
public final int crawlingPriority;
@@ -40,7 +41,7 @@ public final class LoaderMessage {
public final int timeout;
public final boolean keepInMemory;
- private serverSemaphore resultSync = null;
+ private Semaphore resultSync = null;
private Response result;
private String errorMessage;
@@ -68,7 +69,7 @@ public final class LoaderMessage {
this.timeout = timeout;
this.keepInMemory = keepInMemory;
- this.resultSync = new serverSemaphore(0);
+ this.resultSync = new Semaphore(0);
this.result = null;
}
@@ -85,19 +86,19 @@ public final class LoaderMessage {
this.result = theResult;
// notify blocking result readers
- this.resultSync.V();
+ this.resultSync.release();
}
public Response waitForResult() throws InterruptedException {
Response theResult = null;
- this.resultSync.P();
+ this.resultSync.acquire();
/* =====> CRITICAL SECTION <======== */
theResult = this.result;
/* =====> CRITICAL SECTION <======== */
- this.resultSync.V();
+ this.resultSync.release();
return theResult;
}
diff --git a/source/de/anomic/crawler/retrieval/FTPLoader.java b/source/de/anomic/crawler/retrieval/FTPLoader.java
index 7b75bedc2..bf2f51486 100644
--- a/source/de/anomic/crawler/retrieval/FTPLoader.java
+++ b/source/de/anomic/crawler/retrieval/FTPLoader.java
@@ -32,7 +32,7 @@ import java.io.IOException;
import java.io.PrintStream;
import java.util.Date;
-import net.yacy.document.Parser;
+import net.yacy.document.TextParser;
import net.yacy.kelondro.data.meta.DigestURI;
import net.yacy.kelondro.logging.Log;
import net.yacy.kelondro.util.DateFormatter;
@@ -217,13 +217,13 @@ public class FTPLoader {
private Response getFile(final ftpc ftpClient, final Request request) throws Exception {
// determine the mimetype of the resource
final DigestURI entryUrl = request.url();
- final String mimeType = Parser.mimeOf(entryUrl);
+ final String mimeType = TextParser.mimeOf(entryUrl);
final String path = getPath(entryUrl);
// if the mimetype and file extension is supported we start to download
// the file
Response response = null;
- String supportError = Parser.supports(entryUrl, mimeType);
+ String supportError = TextParser.supports(entryUrl, mimeType);
if (supportError != null) {
// reject file
log.logInfo("PARSER REJECTED URL " + request.url().toString() + ": " + supportError);
diff --git a/source/de/anomic/crawler/retrieval/HTTPLoader.java b/source/de/anomic/crawler/retrieval/HTTPLoader.java
index 5915ef8d7..14962963f 100644
--- a/source/de/anomic/crawler/retrieval/HTTPLoader.java
+++ b/source/de/anomic/crawler/retrieval/HTTPLoader.java
@@ -28,7 +28,7 @@ package de.anomic.crawler.retrieval;
import java.io.IOException;
import java.util.Date;
-import net.yacy.document.Parser;
+import net.yacy.document.TextParser;
import net.yacy.kelondro.data.meta.DigestURI;
import net.yacy.kelondro.logging.Log;
@@ -98,7 +98,7 @@ public final class HTTPLoader {
// if not the right file type then reject file
if (acceptOnlyParseable) {
- String supportError = Parser.supportsExtension(request.url());
+ String supportError = TextParser.supportsExtension(request.url());
if (supportError != null) {
sb.crawlQueues.errorURL.newEntry(request, sb.peers.mySeed().hash, new Date(), 1, supportError);
throw new IOException("REJECTED WRONG EXTENSION TYPE: " + supportError);
@@ -141,7 +141,7 @@ public final class HTTPLoader {
if (acceptOnlyParseable) {
// if the response has not the right file type then reject file
- String supportError = Parser.supports(request.url(), res.getResponseHeader().mime());
+ String supportError = TextParser.supports(request.url(), res.getResponseHeader().mime());
if (supportError != null) {
sb.crawlQueues.errorURL.newEntry(request, sb.peers.mySeed().hash, new Date(), 1, supportError);
throw new IOException("REJECTED WRONG MIME TYPE: " + supportError);
diff --git a/source/de/anomic/crawler/retrieval/LoaderDispatcher.java b/source/de/anomic/crawler/retrieval/LoaderDispatcher.java
index 3618be3a9..4d6af8aaa 100644
--- a/source/de/anomic/crawler/retrieval/LoaderDispatcher.java
+++ b/source/de/anomic/crawler/retrieval/LoaderDispatcher.java
@@ -38,7 +38,7 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import net.yacy.document.Document;
-import net.yacy.document.Parser;
+import net.yacy.document.TextParser;
import net.yacy.document.ParserException;
import net.yacy.document.parser.html.ContentScraper;
import net.yacy.document.parser.html.TransformerWriter;
@@ -404,14 +404,14 @@ public final class LoaderDispatcher {
}
// STEP 3: if the metadata is still null try to guess the mimeType of the resource
- String supportError = Parser.supports(url, responseHeader == null ? null : responseHeader.mime());
+ String supportError = TextParser.supports(url, responseHeader == null ? null : responseHeader.mime());
if (supportError != null) {
return null;
}
if (responseHeader == null) {
- return Parser.parseSource(url, null, null, contentLength, resourceStream);
+ return TextParser.parseSource(url, null, null, contentLength, resourceStream);
}
- return Parser.parseSource(url, responseHeader.mime(), responseHeader.getCharacterEncoding(), contentLength, resourceStream);
+ return TextParser.parseSource(url, responseHeader.mime(), responseHeader.getCharacterEncoding(), contentLength, resourceStream);
} catch (final InterruptedException e) {
// interruption of thread detected
return null;
diff --git a/source/de/anomic/crawler/retrieval/Response.java b/source/de/anomic/crawler/retrieval/Response.java
index cdcc44329..9e7ed9ef2 100755
--- a/source/de/anomic/crawler/retrieval/Response.java
+++ b/source/de/anomic/crawler/retrieval/Response.java
@@ -29,7 +29,7 @@ package de.anomic.crawler.retrieval;
import java.util.Date;
import net.yacy.document.Classification;
-import net.yacy.document.Parser;
+import net.yacy.document.TextParser;
import net.yacy.kelondro.data.meta.DigestURI;
import net.yacy.kelondro.util.DateFormatter;
@@ -557,7 +557,7 @@ public class Response {
if (Classification.isPictureMime(mimeType)) {
return "Media_Content_(Picture)";
}
- String parserError = Parser.supportsMime(mimeType);
+ String parserError = TextParser.supportsMime(mimeType);
if (parserError != null) {
return "Media_Content, no parser: " + parserError;
}
@@ -675,7 +675,7 @@ public class Response {
if (responseHeader != null) {
final String mimeType = responseHeader.mime();
if (Classification.isPictureMime(mimeType)) { return "Media_Content_(Picture)"; }
- String parserError = Parser.supportsMime(mimeType);
+ String parserError = TextParser.supportsMime(mimeType);
if (parserError != null) { return "Media_Content, parser error: " + parserError; }
}
if (Classification.isMediaExtension(url().getFileExtension())) { return "Media_Content_(forbidden)"; }
diff --git a/source/de/anomic/data/LibraryProvider.java b/source/de/anomic/data/LibraryProvider.java
index f3564de1c..e4fc42f05 100644
--- a/source/de/anomic/data/LibraryProvider.java
+++ b/source/de/anomic/data/LibraryProvider.java
@@ -39,6 +39,8 @@ import java.util.List;
import java.util.Set;
import java.util.TreeSet;
+import net.yacy.document.geolocalization.OpenGeoDB;
+
public class LibraryProvider {
private static final String path_to_source_dictionaries = "source";
diff --git a/source/de/anomic/http/server/HTTPDFileHandler.java b/source/de/anomic/http/server/HTTPDFileHandler.java
index 1ea21706b..0b3464b0c 100644
--- a/source/de/anomic/http/server/HTTPDFileHandler.java
+++ b/source/de/anomic/http/server/HTTPDFileHandler.java
@@ -91,6 +91,7 @@ import net.yacy.kelondro.util.ByteBuffer;
import net.yacy.kelondro.util.DateFormatter;
import net.yacy.kelondro.util.FileUtils;
import net.yacy.kelondro.util.MemoryControl;
+import net.yacy.visualization.RasterPlotter;
import de.anomic.http.server.servlets.transferURL;
import de.anomic.search.Switchboard;
@@ -101,7 +102,6 @@ import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.server.servletProperties;
import de.anomic.yacy.yacyBuildProperties;
-import de.anomic.ymage.ymageMatrix;
public final class HTTPDFileHandler {
@@ -532,13 +532,13 @@ public final class HTTPDFileHandler {
// error with image generation; send file-not-found
HTTPDemon.sendRespondError(conProp, out, 3, 404, "File not Found", null, null);
} else {
- if (img instanceof ymageMatrix) {
- final ymageMatrix yp = (ymageMatrix) img;
+ if (img instanceof RasterPlotter) {
+ final RasterPlotter yp = (RasterPlotter) img;
// send an image to client
targetDate = new Date(System.currentTimeMillis());
nocache = true;
final String mimeType = mimeTable.getProperty(targetExt, "text/html");
- final ByteBuffer result = ymageMatrix.exportImage(yp.getImage(), targetExt);
+ final ByteBuffer result = RasterPlotter.exportImage(yp.getImage(), targetExt);
// write the array to the client
HTTPDemon.sendRespondHeader(conProp, out, httpVersion, 200, null, mimeType, result.length(), targetDate, null, null, null, null, nocache);
@@ -558,7 +558,7 @@ public final class HTTPDFileHandler {
int height = i.getHeight(null); if (height < 0) height = 96; // bad hack
final BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
bi.createGraphics().drawImage(i, 0, 0, width, height, null);
- final ByteBuffer result = ymageMatrix.exportImage(bi, targetExt);
+ final ByteBuffer result = RasterPlotter.exportImage(bi, targetExt);
// write the array to the client
HTTPDemon.sendRespondHeader(conProp, out, httpVersion, 200, null, mimeType, result.length(), targetDate, null, null, null, null, nocache);
diff --git a/source/de/anomic/http/server/HTTPDProxyHandler.java b/source/de/anomic/http/server/HTTPDProxyHandler.java
index 1e5b6c71c..e29e8a01e 100644
--- a/source/de/anomic/http/server/HTTPDProxyHandler.java
+++ b/source/de/anomic/http/server/HTTPDProxyHandler.java
@@ -71,7 +71,7 @@ import java.util.logging.LogManager;
import java.util.logging.Logger;
import java.util.zip.GZIPOutputStream;
-import net.yacy.document.Parser;
+import net.yacy.document.TextParser;
import net.yacy.document.parser.html.ContentTransformer;
import net.yacy.document.parser.html.Transformer;
import net.yacy.kelondro.data.meta.DigestURI;
@@ -545,7 +545,7 @@ public final class HTTPDProxyHandler {
);
final String storeError = response.shallStoreCacheForProxy();
final boolean storeHTCache = response.profile().storeHTCache();
- final String supportError = Parser.supports(response.url(), response.getMimeType());
+ final String supportError = TextParser.supports(response.url(), response.getMimeType());
if (
/*
* Now we store the response into the htcache directory if
diff --git a/source/de/anomic/search/DocumentIndex.java b/source/de/anomic/search/DocumentIndex.java
index 239a0040a..7479ccd54 100644
--- a/source/de/anomic/search/DocumentIndex.java
+++ b/source/de/anomic/search/DocumentIndex.java
@@ -36,7 +36,7 @@ import java.util.concurrent.LinkedBlockingQueue;
import net.yacy.document.Condenser;
import net.yacy.document.Document;
-import net.yacy.document.Parser;
+import net.yacy.document.TextParser;
import net.yacy.document.ParserException;
import net.yacy.kelondro.data.meta.DigestURI;
import net.yacy.kelondro.data.meta.URIMetadataRow;
@@ -120,7 +120,7 @@ public class DocumentIndex extends Segment {
DigestURI url = new DigestURI("file:" + file.getAbsolutePath());
Document document;
try {
- document = Parser.parseSource(url, null, null, file);
+ document = TextParser.parseSource(url, null, null, file);
} catch (InterruptedException e) {
throw new IOException("cannot parse " + file.toString() + ": " + e.getMessage());
} catch (ParserException e) {
diff --git a/source/de/anomic/search/RankingProcess.java b/source/de/anomic/search/RankingProcess.java
index 558502d49..e206742e0 100644
--- a/source/de/anomic/search/RankingProcess.java
+++ b/source/de/anomic/search/RankingProcess.java
@@ -53,10 +53,10 @@ import net.yacy.kelondro.rwi.Reference;
import net.yacy.kelondro.rwi.ReferenceContainer;
import net.yacy.kelondro.rwi.TermSearch;
import net.yacy.kelondro.util.FileUtils;
+import net.yacy.kelondro.util.MemoryTracker;
import net.yacy.kelondro.util.SortStack;
-import de.anomic.server.serverProfiling;
-import de.anomic.ymage.ProfilingGraph;
+import de.anomic.yacy.graphics.ProfilingGraph;
public final class RankingProcess extends Thread {
@@ -134,7 +134,7 @@ public final class RankingProcess extends Thread {
query.maxDistance);
this.localSearchInclusion = search.inclusion();
final ReferenceContainer<WordReference> index = search.joined();
- serverProfiling.update("SEARCH", new ProfilingGraph.searchEvent(query.id(true), SearchEvent.JOIN, index.size(), System.currentTimeMillis() - timer), false);
+ MemoryTracker.update("SEARCH", new ProfilingGraph.searchEvent(query.id(true), SearchEvent.JOIN, index.size(), System.currentTimeMillis() - timer), false);
if (index.size() == 0) {
return;
}
@@ -171,7 +171,7 @@ public final class RankingProcess extends Thread {
// normalize entries
final BlockingQueue<WordReferenceVars> decodedEntries = this.order.normalizeWith(index);
- serverProfiling.update("SEARCH", new ProfilingGraph.searchEvent(query.id(true), SearchEvent.NORMALIZING, index.size(), System.currentTimeMillis() - timer), false);
+ MemoryTracker.update("SEARCH", new ProfilingGraph.searchEvent(query.id(true), SearchEvent.NORMALIZING, index.size(), System.currentTimeMillis() - timer), false);
// iterate over normalized entries and select some that are better than currently stored
timer = System.currentTimeMillis();
@@ -265,7 +265,7 @@ public final class RankingProcess extends Thread {
}
//if ((query.neededResults() > 0) && (container.size() > query.neededResults())) remove(true, true);
- serverProfiling.update("SEARCH", new ProfilingGraph.searchEvent(query.id(true), SearchEvent.PRESORT, index.size(), System.currentTimeMillis() - timer), false);
+ MemoryTracker.update("SEARCH", new ProfilingGraph.searchEvent(query.id(true), SearchEvent.PRESORT, index.size(), System.currentTimeMillis() - timer), false);
}
/**
diff --git a/source/de/anomic/search/ResultFetcher.java b/source/de/anomic/search/ResultFetcher.java
index 2069cc8af..29597a274 100644
--- a/source/de/anomic/search/ResultFetcher.java
+++ b/source/de/anomic/search/ResultFetcher.java
@@ -34,15 +34,15 @@ import java.util.TreeSet;
import net.yacy.document.Condenser;
import net.yacy.kelondro.data.meta.URIMetadataRow;
import net.yacy.kelondro.logging.Log;
+import net.yacy.kelondro.util.MemoryTracker;
import net.yacy.kelondro.util.SetTools;
import net.yacy.kelondro.util.SortStack;
import net.yacy.kelondro.util.SortStore;
import de.anomic.search.RankingProcess.NavigatorEntry;
import de.anomic.search.MediaSnippet;
-import de.anomic.server.serverProfiling;
import de.anomic.yacy.yacySeedDB;
-import de.anomic.ymage.ProfilingGraph;
+import de.anomic.yacy.graphics.ProfilingGraph;
public class ResultFetcher {
@@ -95,7 +95,7 @@ public class ResultFetcher {
// start worker threads to fetch urls and snippets
this.workerThreads = null;
deployWorker(10);
- serverProfiling.update("SEARCH", new ProfilingGraph.searchEvent(query.id(true), this.workerThreads.length + " online snippet fetch threads started", 0, 0), false);
+ MemoryTracker.update("SEARCH", new ProfilingGraph.searchEvent(query.id(true), this.workerThreads.length + " online snippet fetch threads started", 0, 0), false);
}
@@ -279,7 +279,7 @@ public class ResultFetcher {
public ResultEntry oneResult(final int item) {
// check if we already retrieved this item
// (happens if a search pages is accessed a second time)
- serverProfiling.update("SEARCH", new ProfilingGraph.searchEvent(query.id(true), "obtain one result entry - start", 0, 0), false);
+ MemoryTracker.update("SEARCH", new ProfilingGraph.searchEvent(query.id(true), "obtain one result entry - start", 0, 0), false);
if (this.result.sizeStore() > item) {
// we have the wanted result already in the result array .. return that
return this.result.element(item).element;
diff --git a/source/de/anomic/search/SearchEvent.java b/source/de/anomic/search/SearchEvent.java
index 5d07ebbd1..7e3d3343e 100644
--- a/source/de/anomic/search/SearchEvent.java
+++ b/source/de/anomic/search/SearchEvent.java
@@ -38,15 +38,15 @@ import net.yacy.kelondro.logging.Log;
import net.yacy.kelondro.order.Base64Order;
import net.yacy.kelondro.rwi.ReferenceContainer;
import net.yacy.kelondro.util.MemoryControl;
+import net.yacy.kelondro.util.MemoryTracker;
import net.yacy.kelondro.util.SetTools;
import de.anomic.crawler.ResultURLs;
import de.anomic.search.RankingProcess.NavigatorEntry;
-import de.anomic.server.serverProfiling;
import de.anomic.yacy.yacySearch;
import de.anomic.yacy.yacySeedDB;
import de.anomic.yacy.dht.FlatWordPartitionScheme;
-import de.anomic.ymage.ProfilingGraph;
+import de.anomic.yacy.graphics.ProfilingGraph;
public final class SearchEvent {
@@ -139,7 +139,7 @@ public final class SearchEvent {
(query.domType == QueryParams.SEARCHDOM_GLOBALDHT) ? null : preselectedPeerHashes);
if (this.primarySearchThreads != null) {
if (this.primarySearchThreads.length > fetchpeers) this.rankedCache.moreFeeders(this.primarySearchThreads.length - fetchpeers);
- serverProfiling.update("SEARCH", new ProfilingGraph.searchEvent(query.id(true), "remote search thread start", this.primarySearchThreads.length, System.currentTimeMillis() - timer), false);
+ MemoryTracker.update("SEARCH", new ProfilingGraph.searchEvent(query.id(true), "remote search thread start", this.primarySearchThreads.length, System.currentTimeMillis() - timer), false);
// finished searching
Log.logFine("SEARCH_EVENT", "SEARCH TIME AFTER GLOBAL-TRIGGER TO " + primarySearchThreads.length + " PEERS: " + ((System.currentTimeMillis() - start) / 1000) + " seconds");
} else {
@@ -179,7 +179,7 @@ public final class SearchEvent {
IACount.put(wordhash, Integer.valueOf(container.size()));
IAResults.put(wordhash, ReferenceContainer.compressIndex(container, null, 1000).toString());
}
- serverProfiling.update("SEARCH", new ProfilingGraph.searchEvent(query.id(true), "abstract generation", this.rankedCache.searchContainerMap().size(), System.currentTimeMillis() - timer), false);
+ MemoryTracker.update("SEARCH", new ProfilingGraph.searchEvent(query.id(true), "abstract generation", this.rankedCache.searchContainerMap().size(), System.currentTimeMillis() - timer), false);
}
// start worker threads to fetch urls and snippets
@@ -188,7 +188,7 @@ public final class SearchEvent {
// clean up events
SearchEventCache.cleanupEvents(false);
- serverProfiling.update("SEARCH", new ProfilingGraph.searchEvent(query.id(true), "event-cleanup", 0, 0), false);
+ MemoryTracker.update("SEARCH", new ProfilingGraph.searchEvent(query.id(true), "event-cleanup", 0, 0), false);
// store this search to a cache so it can be re-used
if (MemoryControl.available() < 1024 * 1024 * 10) SearchEventCache.cleanupEvents(true);
diff --git a/source/de/anomic/search/Switchboard.java b/source/de/anomic/search/Switchboard.java
index 8bd5b9427..fda0b324c 100644
--- a/source/de/anomic/search/Switchboard.java
+++ b/source/de/anomic/search/Switchboard.java
@@ -109,11 +109,12 @@ import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Semaphore;
import java.util.regex.Pattern;
import net.yacy.document.Condenser;
import net.yacy.document.Document;
-import net.yacy.document.Parser;
+import net.yacy.document.TextParser;
import net.yacy.document.ParserException;
import net.yacy.document.content.DCEntry;
import net.yacy.document.content.RSSMessage;
@@ -130,7 +131,9 @@ import net.yacy.kelondro.util.DateFormatter;
import net.yacy.kelondro.util.Domains;
import net.yacy.kelondro.util.FileUtils;
import net.yacy.kelondro.util.MemoryControl;
+import net.yacy.kelondro.util.MemoryTracker;
import net.yacy.kelondro.util.SetTools;
+import net.yacy.kelondro.util.OS;
import net.yacy.kelondro.workflow.BusyThread;
import net.yacy.kelondro.workflow.InstantBusyThread;
import net.yacy.kelondro.workflow.WorkflowJob;
@@ -178,9 +181,6 @@ import de.anomic.net.UPnP;
import de.anomic.search.blockrank.CRDistribution;
import de.anomic.server.serverSwitch;
import de.anomic.server.serverCore;
-import de.anomic.server.serverProfiling;
-import de.anomic.server.serverSemaphore;
-import de.anomic.server.serverSystem;
import de.anomic.tools.crypt;
import de.anomic.tools.CryptoLib;
import de.anomic.yacy.yacyBuildProperties;
@@ -195,7 +195,7 @@ import de.anomic.yacy.yacyUpdateLocation;
import de.anomic.yacy.yacyRelease;
import de.anomic.yacy.dht.Dispatcher;
import de.anomic.yacy.dht.PeerSelection;
-import de.anomic.ymage.WebStructureGraph;
+import de.anomic.yacy.graphics.WebStructureGraph;
public final class Switchboard extends serverSwitch {
@@ -273,7 +273,7 @@ public final class Switchboard extends serverSwitch {
public boolean useTailCache;
public boolean exceed134217727;
- private final serverSemaphore shutdownSync = new serverSemaphore(0);
+ private final Semaphore shutdownSync = new Semaphore(0);
private boolean terminate = false;
//private Object crawlingPausedSync = new Object();
@@ -285,7 +285,7 @@ public final class Switchboard extends serverSwitch {
public Switchboard(final File rootPath, final String initPath, final String configPath, final boolean applyPro) throws IOException {
super(rootPath, initPath, configPath, applyPro);
- serverProfiling.startSystemProfiling();
+ MemoryTracker.startSystemProfiling();
sb=this;
// set loglevel and log
@@ -342,7 +342,7 @@ public final class Switchboard extends serverSwitch {
// start indexing management
log.logConfig("Starting Indexing Management");
final String networkName = getConfig(SwitchboardConstants.NETWORK_NAME, "");
- final long fileSizeMax = (serverSystem.isWindows) ? sb.getConfigLong("filesize.max.win", (long) Integer.MAX_VALUE) : sb.getConfigLong("filesize.max.other", (long) Integer.MAX_VALUE);
+ final long fileSizeMax = (OS.isWindows) ? sb.getConfigLong("filesize.max.win", (long) Integer.MAX_VALUE) : sb.getConfigLong("filesize.max.other", (long) Integer.MAX_VALUE);
final int redundancy = (int) sb.getConfigLong("network.unit.dhtredundancy.senior", 1);
final int partitionExponent = (int) sb.getConfigLong("network.unit.dht.partitionExponent", 0);
this.networkRoot = new File(new File(indexPath, networkName), "NETWORK");
@@ -512,7 +512,7 @@ public final class Switchboard extends serverSwitch {
// define a realtime parsable mimetype list
log.logConfig("Parser: Initializing Mime Type deny list");
- Parser.setDenyMime(getConfig(SwitchboardConstants.PARSER_MIME_DENY, null));
+ TextParser.setDenyMime(getConfig(SwitchboardConstants.PARSER_MIME_DENY, null));
// start a loader
log.logConfig("Starting Crawl Loader");
@@ -816,7 +816,7 @@ public final class Switchboard extends serverSwitch {
overwriteNetworkDefinition();
final File indexPrimaryPath = getConfigPath(SwitchboardConstants.INDEX_PRIMARY_PATH, SwitchboardConstants.INDEX_PATH_DEFAULT);
final int wordCacheMaxCount = (int) getConfigLong(SwitchboardConstants.WORDCACHE_MAX_COUNT, 20000);
- final long fileSizeMax = (serverSystem.isWindows) ? sb.getConfigLong("filesize.max.win", (long) Integer.MAX_VALUE) : sb.getConfigLong("filesize.max.other", (long) Integer.MAX_VALUE);
+ final long fileSizeMax = (OS.isWindows) ? sb.getConfigLong("filesize.max.win", (long) Integer.MAX_VALUE) : sb.getConfigLong("filesize.max.other", (long) Integer.MAX_VALUE);
final int redundancy = (int) sb.getConfigLong("network.unit.dhtredundancy.senior", 1);
final int partitionExponent = (int) sb.getConfigLong("network.unit.dht.partitionExponent", 0);
final String networkName = getConfig(SwitchboardConstants.NETWORK_NAME, "");
@@ -1099,7 +1099,7 @@ public final class Switchboard extends serverSwitch {
public void close() {
log.logConfig("SWITCHBOARD SHUTDOWN STEP 1: sending termination signal to managed threads:");
- serverProfiling.stopSystemProfiling();
+ MemoryTracker.stopSystemProfiling();
terminateAllThreads(true);
log.logConfig("SWITCHBOARD SHUTDOWN STEP 2: sending termination signal to threaded indexing");
// closing all still running db importer jobs
@@ -1166,7 +1166,7 @@ public final class Switchboard extends serverSwitch {
// check if the parser supports the mime type
if (noIndexReason == null) {
- noIndexReason = Parser.supports(response.url(), response.getMimeType());
+ noIndexReason = TextParser.supports(response.url(), response.getMimeType());
}
@@ -1615,7 +1615,7 @@ public final class Switchboard extends serverSwitch {
try {
// parse the document
- document = Parser.parseSource(entry.url(), entry.getMimeType(), entry.getCharacterEncoding(), b);
+ document = TextParser.parseSource(entry.url(), entry.getMimeType(), entry.getCharacterEncoding(), b);
assert(document != null) : "Unexpected error. Parser returned null.";
} catch (final ParserException e) {
this.log.logWarning("Unable to parse the resource '" + entry.url() + "'. " + e.getMessage());
@@ -1759,10 +1759,10 @@ public final class Switchboard extends serverSwitch {
if (System.currentTimeMillis() - lastPPMUpdate > 20000) {
// we don't want to do this too often
updateMySeed();
- serverProfiling.update("ppm", Long.valueOf(currentPPM()), true);
+ MemoryTracker.update("ppm", Long.valueOf(currentPPM()), true);
lastPPMUpdate = System.currentTimeMillis();
}
- serverProfiling.update("indexed", queueEntry.url().toNormalform(true, false), false);
+ MemoryTracker.update("indexed", queueEntry.url().toNormalform(true, false), false);
// if this was performed for a remote crawl request, notify requester
if ((processCase == SwitchboardConstants.PROCESSCASE_6_GLOBAL_CRAWLING) && (queueEntry.initiator() != null)) {
@@ -2067,11 +2067,11 @@ public final class Switchboard extends serverSwitch {
}
public int currentPPM() {
- return serverProfiling.countEvents("indexed", 20000) * 3;
+ return MemoryTracker.countEvents("indexed", 20000) * 3;
}
public String makeDefaultPeerName() {
- String name = myPublicIP() + "-" + yacyCore.speedKey + "dpn" + serverSystem.infoKey() + (System.currentTimeMillis() & 99);
+ String name = myPublicIP() + "-" + yacyCore.speedKey + "dpn" + OS.infoKey() + (System.currentTimeMillis() & 99);
name = name.replace('.', '-');
name = name.replace('_', '-');
name = name.replace(':', '-');
@@ -2196,7 +2196,7 @@ public final class Switchboard extends serverSwitch {
public void terminate() {
this.terminate = true;
- this.shutdownSync.V();
+ this.shutdownSync.release();
}
public boolean isTerminated() {
@@ -2204,7 +2204,7 @@ public final class Switchboard extends serverSwitch {
}
public boolean waitForShutdown() throws InterruptedException {
- this.shutdownSync.P();
+ this.shutdownSync.acquire();
return this.terminate;
}
diff --git a/source/de/anomic/server/serverSemaphore.java b/source/de/anomic/server/serverSemaphore.java
deleted file mode 100644
index d4eabfe2f..000000000
--- a/source/de/anomic/server/serverSemaphore.java
+++ /dev/null
@@ -1,82 +0,0 @@
-//serverSemaphore.java
-//------------------------
-//part of YaCy
-//(C) by Michael Peter Christen; [email protected]
-//first published on http://www.anomic.de
-//Frankfurt, Germany, 2005
-//
-//this file is contributed by Martin Thelian
-//last major change: $LastChangedDate$ by $LastChangedBy$
-//Revision: $LastChangedRevision$
-//
-//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 de.anomic.server;
-
-public final class serverSemaphore {
- private long currentValue = 0;
- private long maximumValue = Long.MAX_VALUE;
-
- public serverSemaphore(final long initialValue) {
- this(initialValue,Long.MAX_VALUE);
- }
-
- protected serverSemaphore(final long initialValue, final long maxValue) {
- /* some errorhandling */
- if (maxValue < initialValue) {
- throw new IllegalArgumentException("The semaphore maximum value must not be " +
- "greater than the semaphore init value.");
- }
-
- if (maxValue < 1) {
- throw new IllegalArgumentException("The semaphore maximum value must be greater or equal 1.");
- }
-
- if (initialValue < 0) {
- throw new IllegalArgumentException("The semaphore initial value must be greater or equal 0.");
- }
-
-
- // setting the initial Sempahore Values
- this.currentValue = initialValue;
- this.maximumValue = maxValue;
- }
-
- public synchronized void P() throws InterruptedException
- {
- this.currentValue-- ;
-
- if (this.currentValue < 0) {
- try {
- wait();
- } catch(final InterruptedException e) {
- this.currentValue++;
- throw e;
- }
- }
- }
-
- public synchronized void V() {
- if (this.currentValue+1 == this.maximumValue) {
- throw new IndexOutOfBoundsException("The maximum value of the semaphore was reached");
- }
-
- this.currentValue++;
-
- if (this.currentValue <= 0) {
- notify();
- }
- }
- }
\ No newline at end of file
diff --git a/source/de/anomic/tools/mediawikiIndex.java b/source/de/anomic/tools/mediawikiIndex.java
index bf74c95ed..4b49cffb9 100644
--- a/source/de/anomic/tools/mediawikiIndex.java
+++ b/source/de/anomic/tools/mediawikiIndex.java
@@ -27,7 +27,7 @@
package de.anomic.tools;
import net.yacy.document.Document;
-import net.yacy.document.Parser;
+import net.yacy.document.TextParser;
import net.yacy.document.ParserException;
import net.yacy.kelondro.data.meta.DigestURI;
import net.yacy.kelondro.logging.Log;
@@ -483,7 +483,7 @@ public class mediawikiIndex extends Thread {
public void genDocument() throws InterruptedException, ParserException {
try {
url = new DigestURI(urlStub + title, null);
- document = Parser.parseSource(url, "text/html", "utf-8", html.getBytes("UTF-8"));
+ document = TextParser.parseSource(url, "text/html", "utf-8", html.getBytes("UTF-8"));
// the wiki parser is not able to find the proper title in the source text, so it must be set here
document.setTitle(title);
} catch (UnsupportedEncodingException e) {
diff --git a/source/de/anomic/yacy/Tray.java b/source/de/anomic/yacy/Tray.java
index 38b5d45a8..e48f63c7e 100644
--- a/source/de/anomic/yacy/Tray.java
+++ b/source/de/anomic/yacy/Tray.java
@@ -37,9 +37,10 @@ import java.io.File;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
+import net.yacy.kelondro.util.OS;
+
import de.anomic.search.Switchboard;
import de.anomic.search.SwitchboardConstants;
-import de.anomic.server.serverSystem;
public final class Tray {
@@ -61,7 +62,7 @@ public final class Tray {
trayLabel = sb.getConfig(SwitchboardConstants.TRAY_LABEL, "YaCy");
try {
final boolean trayIcon = sb.getConfigBool(SwitchboardConstants.TRAY_ICON_ENABLED, false);
- if (trayIcon && (serverSystem.isWindows || sb.getConfigBool(SwitchboardConstants.TRAY_ICON_FORCED, false))) {
+ if (trayIcon && (OS.isWindows || sb.getConfigBool(SwitchboardConstants.TRAY_ICON_FORCED, false))) {
System.setProperty("java.awt.headless", "false");
if(nativeTrayIcon.isSupported()) {
@@ -156,7 +157,7 @@ public final class Tray {
protected static void openBrowser(final String browserPopUpPage){
if(isIntegrated) return;
// no need for https, because we are on localhost
- serverSystem.openBrowser("http://localhost:" + sb.getConfig("port", "8080") + "/" + browserPopUpPage);
+ OS.openBrowser("http://localhost:" + sb.getConfig("port", "8080") + "/" + browserPopUpPage);
}
public static void removeTray(){
diff --git a/source/de/anomic/ymage/NetworkGraph.java b/source/de/anomic/yacy/graphics/NetworkGraph.java
similarity index 79%
rename from source/de/anomic/ymage/NetworkGraph.java
rename to source/de/anomic/yacy/graphics/NetworkGraph.java
index 03faec1b9..8e1cd11de 100644
--- a/source/de/anomic/ymage/NetworkGraph.java
+++ b/source/de/anomic/yacy/graphics/NetworkGraph.java
@@ -26,7 +26,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.ymage;
+package de.anomic.yacy.graphics;
import java.awt.Color;
import java.awt.Graphics2D;
@@ -35,6 +35,9 @@ import java.awt.image.BufferedImage;
import java.util.Date;
import java.util.Iterator;
+import net.yacy.visualization.PrintTool;
+import net.yacy.visualization.RasterPlotter;
+
import de.anomic.search.QueryParams;
import de.anomic.search.SearchEvent;
import de.anomic.search.SearchEventCache;
@@ -100,17 +103,17 @@ public class NetworkGraph {
private static final int LEGEND_BOX_SIZE = 10;
- private static ymageMatrix networkPicture = null;
+ private static RasterPlotter networkPicture = null;
private static long networkPictureDate = 0;
private static BufferedImage peerloadPicture = null;
private static long peerloadPictureDate = 0;
- private static ymageMatrix bannerPicture = null; // [MN]
+ private static RasterPlotter bannerPicture = null; // [MN]
private static BufferedImage logo = null; // [MN]
private static long bannerPictureDate = 0; // [MN]
- public static ymageMatrix getSearchEventPicture(final yacySeedDB seedDB, final String eventID) {
+ public static RasterPlotter getSearchEventPicture(final yacySeedDB seedDB, final String eventID) {
final SearchEvent event = SearchEventCache.getEvent(eventID);
if (event == null) return null;
final yacySearch[] primarySearches = event.getPrimarySearchThreads();
@@ -118,7 +121,7 @@ public class NetworkGraph {
if (primarySearches == null) return null; // this was a local search and there are no threads
// get a copy of a recent network picture
- final ymageMatrix eventPicture = getNetworkPicture(seedDB, 120000, Switchboard.getSwitchboard().getConfig(SwitchboardConstants.NETWORK_NAME, "unspecified"), Switchboard.getSwitchboard().getConfig("network.unit.description", "unspecified"), COL_BACKGROUND);
+ final RasterPlotter eventPicture = getNetworkPicture(seedDB, 120000, Switchboard.getSwitchboard().getConfig(SwitchboardConstants.NETWORK_NAME, "unspecified"), Switchboard.getSwitchboard().getConfig("network.unit.description", "unspecified"), COL_BACKGROUND);
//if (eventPicture instanceof ymageMatrix) eventPicture = (ymageMatrix) eventPicture; //new ymageMatrix((ymageMatrix) eventPicture);
// TODO: fix cloning of ymageMatrix pictures
@@ -131,7 +134,7 @@ public class NetworkGraph {
// draw in the primary search peers
for (int j = 0; j < primarySearches.length; j++) {
- eventPicture.setColor((primarySearches[j].isAlive()) ? ymageMatrix.RED : ymageMatrix.GREEN);
+ eventPicture.setColor((primarySearches[j].isAlive()) ? RasterPlotter.RED : RasterPlotter.GREEN);
angle = (int) (360.0 * (((double) FlatWordPartitionScheme.std.dhtPosition(primarySearches[j].target().hash.getBytes(), null)) / ((double) Long.MAX_VALUE)));
eventPicture.arcLine(cx, cy, cr - 20, cr, angle);
}
@@ -139,7 +142,7 @@ public class NetworkGraph {
// draw in the secondary search peers
if (secondarySearches != null) {
for (int j = 0; j < secondarySearches.length; j++) {
- eventPicture.setColor((secondarySearches[j].isAlive()) ? ymageMatrix.RED : ymageMatrix.GREEN);
+ eventPicture.setColor((secondarySearches[j].isAlive()) ? RasterPlotter.RED : RasterPlotter.GREEN);
angle = (int) (360.0 * (((double) FlatWordPartitionScheme.std.dhtPosition(secondarySearches[j].target().hash.getBytes(), null)) / ((double) Long.MAX_VALUE)));
eventPicture.arcLine(cx, cy, cr - 10, cr, angle - 1);
eventPicture.arcLine(cx, cy, cr - 10, cr, angle + 1);
@@ -149,7 +152,7 @@ public class NetworkGraph {
// draw in the search target
final QueryParams query = event.getQuery();
final Iterator<byte[]> i = query.queryHashes.iterator();
- eventPicture.setColor(ymageMatrix.GREY);
+ eventPicture.setColor(RasterPlotter.GREY);
while (i.hasNext()) {
long[] positions = seedDB.scheme.dhtPositions(i.next());
for (int j = 0; j < positions.length; j++) {
@@ -161,11 +164,11 @@ public class NetworkGraph {
return eventPicture;
}
- public static ymageMatrix getNetworkPicture(final yacySeedDB seedDB, final long maxAge, final String networkName, final String networkTitle, final String bgcolor) {
+ public static RasterPlotter getNetworkPicture(final yacySeedDB seedDB, final long maxAge, final String networkName, final String networkTitle, final String bgcolor) {
return getNetworkPicture(seedDB, maxAge, 640, 480, 300, 300, 1000, true, networkName, networkTitle, bgcolor);
}
- public static ymageMatrix getNetworkPicture(final yacySeedDB seedDB, final long maxAge, final int width, final int height, final int passiveLimit, final int potentialLimit, final int maxCount, final boolean corona, final String networkName, final String networkTitle, final String bgcolor) {
+ public static RasterPlotter getNetworkPicture(final yacySeedDB seedDB, final long maxAge, final int width, final int height, final int passiveLimit, final int potentialLimit, final int maxCount, final boolean corona, final String networkName, final String networkTitle, final String bgcolor) {
if ((networkPicture == null) || ((System.currentTimeMillis() - networkPictureDate) > maxAge)) {
drawNetworkPicture(seedDB, width, height, passiveLimit, potentialLimit, maxCount, corona, networkName, networkTitle, bgcolor);
}
@@ -180,7 +183,7 @@ public class NetworkGraph {
int outerradius = innerradius + innerradius * seedDB.sizeConnected() / 100;
if (outerradius > innerradius * 2) outerradius = innerradius * 2;
- networkPicture = new ymageMatrix(width, height, (bgcolor.equals("000000")) ? ymageMatrix.MODE_ADD : ymageMatrix.MODE_SUB, bgcolor);
+ networkPicture = new RasterPlotter(width, height, (bgcolor.equals("000000")) ? RasterPlotter.MODE_ADD : RasterPlotter.MODE_SUB, bgcolor);
// draw network circle
networkPicture.setColor(COL_DHTCIRCLE);
@@ -239,16 +242,16 @@ public class NetworkGraph {
// draw description
networkPicture.setColor(COL_HEADLINE);
- ymageToolPrint.print(networkPicture, 2, 8, 0, "YACY NETWORK '" + networkName.toUpperCase() + "'", -1);
- ymageToolPrint.print(networkPicture, 2, 16, 0, networkTitle.toUpperCase(), -1);
- ymageToolPrint.print(networkPicture, width - 2, 8, 0, "SNAPSHOT FROM " + new Date().toString().toUpperCase(), 1);
- ymageToolPrint.print(networkPicture, width - 2, 16, 0, "DRAWING OF " + totalCount + " SELECTED PEERS", 1);
+ 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);
// set timestamp
networkPictureDate = System.currentTimeMillis();
}
- private static void drawNetworkPicturePeer(final ymageMatrix img, final int x, final int y, final int innerradius, final int outerradius, final yacySeed seed, final String colorDot, final String colorLine, final String colorText, final boolean corona) {
+ private static void drawNetworkPicturePeer(final RasterPlotter img, final int x, final int y, final int innerradius, final int outerradius, final yacySeed seed, final String colorDot, final String colorLine, final String colorText, final boolean corona) {
final String name = seed.getName().toUpperCase() /*+ ":" + seed.hash + ":" + (((double) ((int) (100 * (((double) yacySeed.dhtPosition(seed.hash)) / ((double) yacySeed.maxDHTDistance))))) / 100.0)*/;
if (name.length() < shortestName) shortestName = name.length();
if (name.length() > longestName) longestName = name.length();
@@ -266,7 +269,7 @@ public class NetworkGraph {
img.arcLine(x, y, innerradius + 18, innerradius + linelength, angle);
// draw text
img.setColor(colorText);
- ymageToolPrint.arcPrint(img, x, y, innerradius + linelength, angle, name);
+ PrintTool.arcPrint(img, x, y, innerradius + linelength, angle, name);
// draw corona around dot for crawling activity
int ppm20 = seed.getPPM() / 20;
@@ -341,7 +344,7 @@ public class NetworkGraph {
}
//[MN]
- public static ymageMatrix getBannerPicture(final long maxAge, final int width, final int height, final String bgcolor, final String textcolor, final String bordercolor, final String name, final long links, final long words, final String type, final int ppm, final String network, final int peers, final long nlinks, final long nwords, final double nqph, final long nppm) {
+ public static RasterPlotter getBannerPicture(final long maxAge, final int width, final int height, final String bgcolor, final String textcolor, final String bordercolor, final String name, final long links, final long words, final String type, final int ppm, final String network, final int peers, final long nlinks, final long nwords, final double nqph, final long nppm) {
if ((bannerPicture == null) || ((System.currentTimeMillis() - bannerPictureDate) > maxAge)) {
drawBannerPicture(width, height, bgcolor, textcolor, bordercolor, name, links, words, type, ppm, network, peers, nlinks, nwords, nqph, nppm, logo);
}
@@ -349,7 +352,7 @@ public class NetworkGraph {
}
//[MN]
- public static ymageMatrix getBannerPicture(final long maxAge, final int width, final int height, final String bgcolor, final String textcolor, final String bordercolor, final String name, final long links, final long words, final String type, final int ppm, final String network, final int peers, final long nlinks, final long nwords, final double nqph, final long nppm, final BufferedImage newLogo) {
+ public static RasterPlotter getBannerPicture(final long maxAge, final int width, final int height, final String bgcolor, final String textcolor, final String bordercolor, final String name, final long links, final long words, final String type, final int ppm, final String network, final int peers, final long nlinks, final long nwords, final double nqph, final long nppm, final BufferedImage newLogo) {
if ((bannerPicture == null) || ((System.currentTimeMillis() - bannerPictureDate) > maxAge)) {
drawBannerPicture(width, height, bgcolor, textcolor, bordercolor, name, links, words, type, ppm, network, peers, nlinks, nwords, nqph, nppm, newLogo);
}
@@ -361,26 +364,26 @@ public class NetworkGraph {
final int exprlength = 19;
logo = newLogo;
- bannerPicture = new ymageMatrix(width, height, ymageMatrix.MODE_REPLACE, bgcolor);
+ bannerPicture = new RasterPlotter(width, height, RasterPlotter.MODE_REPLACE, bgcolor);
// draw description
bannerPicture.setColor(textcolor);
- ymageToolPrint.print(bannerPicture, 100, 12, 0, "PEER: " + addTrailingBlanks(name, exprlength), -1);
- ymageToolPrint.print(bannerPicture, 100, 22, 0, "LINKS: " + addBlanksAndDots(links, exprlength), -1);
- ymageToolPrint.print(bannerPicture, 100, 32, 0, "WORDS: " + addBlanksAndDots(words, exprlength), -1);
- ymageToolPrint.print(bannerPicture, 100, 42, 0, "TYPE: " + addTrailingBlanks(type, exprlength), -1);
- ymageToolPrint.print(bannerPicture, 100, 52, 0, "SPEED: " + addTrailingBlanks(ppm + " PAGES/MINUTE", exprlength), -1);
-
- ymageToolPrint.print(bannerPicture, 285, 12, 0, "NETWORK: " + addTrailingBlanks(network + " [" + peers + "]", exprlength), -1);
- ymageToolPrint.print(bannerPicture, 285, 22, 0, "LINKS: " + addBlanksAndDots(nlinks, exprlength), -1);
- ymageToolPrint.print(bannerPicture, 285, 32, 0, "WORDS: " + addBlanksAndDots(nwords, exprlength), -1);
- ymageToolPrint.print(bannerPicture, 285, 42, 0, "QUERIES: " + addTrailingBlanks(nqph + " QUERIES/HOUR", exprlength), -1);
- ymageToolPrint.print(bannerPicture, 285, 52, 0, "SPEED: " + addTrailingBlanks(nppm + " PAGES/MINUTE", exprlength), -1);
+ PrintTool.print(bannerPicture, 100, 12, 0, "PEER: " + addTrailingBlanks(name, exprlength), -1);
+ PrintTool.print(bannerPicture, 100, 22, 0, "LINKS: " + addBlanksAndDots(links, exprlength), -1);
+ PrintTool.print(bannerPicture, 100, 32, 0, "WORDS: " + addBlanksAndDots(words, exprlength), -1);
+ PrintTool.print(bannerPicture, 100, 42, 0, "TYPE: " + addTrailingBlanks(type, exprlength), -1);
+ PrintTool.print(bannerPicture, 100, 52, 0, "SPEED: " + addTrailingBlanks(ppm + " PAGES/MINUTE", exprlength), -1);
+
+ PrintTool.print(bannerPicture, 285, 12, 0, "NETWORK: " + addTrailingBlanks(network + " [" + peers + "]", exprlength), -1);
+ PrintTool.print(bannerPicture, 285, 22, 0, "LINKS: " + addBlanksAndDots(nlinks, exprlength), -1);
+ PrintTool.print(bannerPicture, 285, 32, 0, "WORDS: " + addBlanksAndDots(nwords, exprlength), -1);
+ PrintTool.print(bannerPicture, 285, 42, 0, "QUERIES: " + addTrailingBlanks(nqph + " QUERIES/HOUR", exprlength), -1);
+ PrintTool.print(bannerPicture, 285, 52, 0, "SPEED: " + addTrailingBlanks(nppm + " PAGES/MINUTE", exprlength), -1);
if (logo != null) {
final int x = (100/2 - logo.getWidth()/2);
final int y = (height/2 - logo.getHeight()/2);
- bannerPicture.insertBitmap(logo, x, y, 0, 0, ymageMatrix.FILTER_ANTIALIASING);
+ bannerPicture.insertBitmap(logo, x, y, 0, 0, RasterPlotter.FILTER_ANTIALIASING);
}
if (!bordercolor.equals("")) {
diff --git a/source/de/anomic/ymage/ymageOSM.java b/source/de/anomic/yacy/graphics/OSMTile.java
similarity index 95%
rename from source/de/anomic/ymage/ymageOSM.java
rename to source/de/anomic/yacy/graphics/OSMTile.java
index eef8b0e33..54e1ef21d 100644
--- a/source/de/anomic/ymage/ymageOSM.java
+++ b/source/de/anomic/yacy/graphics/OSMTile.java
@@ -24,7 +24,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.ymage;
+package de.anomic.yacy.graphics;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
@@ -38,17 +38,18 @@ import javax.imageio.ImageIO;
import net.yacy.kelondro.data.meta.DigestURI;
import net.yacy.kelondro.logging.Log;
+import net.yacy.visualization.RasterPlotter;
import de.anomic.crawler.CrawlProfile;
import de.anomic.crawler.retrieval.Response;
import de.anomic.http.client.Cache;
import de.anomic.search.Switchboard;
-public class ymageOSM {
+public class OSMTile {
// helper methods to load map images from openstreetmap.org
- public static ymageMatrix getCombinedTiles(final tileCoordinates t11) {
+ public static RasterPlotter getCombinedTiles(final tileCoordinates t11) {
tileCoordinates t00, t10, t20, t01, t21, t02, t12, t22;
t00 = new tileCoordinates(t11.xtile - 1, t11.ytile - 1, t11.zoom);
t10 = new tileCoordinates(t11.xtile , t11.ytile - 1, t11.zoom);
@@ -58,7 +59,7 @@ public class ymageOSM {
t02 = new tileCoordinates(t11.xtile - 1, t11.ytile + 1, t11.zoom);
t12 = new tileCoordinates(t11.xtile , t11.ytile + 1, t11.zoom);
t22 = new tileCoordinates(t11.xtile + 1, t11.ytile + 1, t11.zoom);
- final ymageMatrix m = new ymageMatrix(768, 768, ymageMatrix.MODE_REPLACE, "FFFFFF");
+ final RasterPlotter m = new RasterPlotter(768, 768, RasterPlotter.MODE_REPLACE, "FFFFFF");
BufferedImage bi;
bi = getSingleTile(t00); if (bi != null) m.insertBitmap(getSingleTile(t00), 0, 0);
bi = getSingleTile(t10); if (bi != null) m.insertBitmap(getSingleTile(t10), 256, 0);
diff --git a/source/de/anomic/ymage/ProfilingGraph.java b/source/de/anomic/yacy/graphics/ProfilingGraph.java
similarity index 66%
rename from source/de/anomic/ymage/ProfilingGraph.java
rename to source/de/anomic/yacy/graphics/ProfilingGraph.java
index 152e90ad9..9bb566316 100644
--- a/source/de/anomic/ymage/ProfilingGraph.java
+++ b/source/de/anomic/yacy/graphics/ProfilingGraph.java
@@ -24,24 +24,28 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.ymage;
+package de.anomic.yacy.graphics;
import java.util.ArrayList;
import java.util.ConcurrentModificationException;
-import de.anomic.server.serverProfiling;
-import de.anomic.server.serverProfiling.Event;
+
+import net.yacy.kelondro.util.MemoryTracker;
+import net.yacy.kelondro.util.MemoryTracker.Event;
+import net.yacy.visualization.RasterPlotter;
+import net.yacy.visualization.ChartPlotter;
+
public class ProfilingGraph {
- private static ymageChart bufferChart = null;
+ private static ChartPlotter bufferChart = null;
public static long maxPayload(final String eventname, final long min) {
- final ArrayList<Event> list = serverProfiling.history(eventname);
+ final ArrayList<Event> list = MemoryTracker.history(eventname);
if (list == null) return min;
long max = min, l;
synchronized (list) {
- for (serverProfiling.Event event: list) {
+ for (MemoryTracker.Event event: list) {
l = ((Long) event.payload).longValue();
if (l > max) max = l;
}
@@ -49,7 +53,7 @@ public class ProfilingGraph {
return max;
}
- public static ymageMatrix performanceGraph(final int width, final int height, final String subline) {
+ public static RasterPlotter performanceGraph(final int width, final int height, final String subline) {
// find maximum values for automatic graph dimension adoption
final int maxppm = (int) maxPayload("ppm", 25);
final int maxwords = (int) maxPayload("wordcache", 12000);
@@ -68,12 +72,12 @@ public class ProfilingGraph {
final int vspace = height - topborder - bottomborder;
final int hspace = width - leftborder - rightborder;
final int maxtime = 600;
- ymageChart chart = new ymageChart(width, height, "FFFFFF", "000000", "AAAAAA", leftborder, rightborder, topborder, bottomborder, "YACY PEER PERFORMANCE: MAIN MEMORY, WORD CACHE AND PAGES/MINUTE (PPM)", subline);
- chart.declareDimension(ymageChart.DIMENSION_BOTTOM, bottomscale, hspace / (maxtime / bottomscale), -maxtime, "000000", "CCCCCC", "TIME/SECONDS");
- chart.declareDimension(ymageChart.DIMENSION_LEFT, leftscale, vspace * leftscale / maxwords, 0, "008800", null , "INDEXING, WORDS IN CACHE");
- chart.declareDimension(ymageChart.DIMENSION_RIGHT, rightscale, vspace * rightscale / maxmbytes, 0, "0000FF", "CCCCCC", "MEMORY/MEGABYTE");
- chart.declareDimension(ymageChart.DIMENSION_ANOT0, anotscale, vspace * anotscale / maxppm, 0, "008800", null , "PPM [PAGES/MINUTE]");
- chart.declareDimension(ymageChart.DIMENSION_ANOT1, vspace / 6, vspace / 6, 0, "888800", null , "URL");
+ ChartPlotter chart = new ChartPlotter(width, height, "FFFFFF", "000000", "AAAAAA", leftborder, rightborder, topborder, bottomborder, "YACY PEER PERFORMANCE: MAIN MEMORY, WORD CACHE AND PAGES/MINUTE (PPM)", subline);
+ chart.declareDimension(ChartPlotter.DIMENSION_BOTTOM, bottomscale, hspace / (maxtime / bottomscale), -maxtime, "000000", "CCCCCC", "TIME/SECONDS");
+ chart.declareDimension(ChartPlotter.DIMENSION_LEFT, leftscale, vspace * leftscale / maxwords, 0, "008800", null , "INDEXING, WORDS IN CACHE");
+ chart.declareDimension(ChartPlotter.DIMENSION_RIGHT, rightscale, vspace * rightscale / maxmbytes, 0, "0000FF", "CCCCCC", "MEMORY/MEGABYTE");
+ chart.declareDimension(ChartPlotter.DIMENSION_ANOT0, anotscale, vspace * anotscale / maxppm, 0, "008800", null , "PPM [PAGES/MINUTE]");
+ chart.declareDimension(ChartPlotter.DIMENSION_ANOT1, vspace / 6, vspace / 6, 0, "888800", null , "URL");
// draw chart
long time;
@@ -98,47 +102,47 @@ public class ProfilingGraph {
}
*/
// draw memory
- ArrayList<Event> events = serverProfiling.history("memory");
+ ArrayList<Event> events = MemoryTracker.history("memory");
x0 = 1; y0 = 0;
- if (events != null) synchronized (events) {for (serverProfiling.Event event: events) {
+ if (events != null) synchronized (events) {for (MemoryTracker.Event event: events) {
time = event.time - now;
bytes = ((Long) event.payload).longValue();
x1 = (int) (time/1000);
y1 = (int) (bytes / 1024 / 1024);
chart.setColor("AAAAFF");
- chart.chartDot(ymageChart.DIMENSION_BOTTOM, ymageChart.DIMENSION_RIGHT, x1, y1, 2, null, 0);
+ chart.chartDot(ChartPlotter.DIMENSION_BOTTOM, ChartPlotter.DIMENSION_RIGHT, x1, y1, 2, null, 0);
chart.setColor("0000FF");
- if (x0 < 0) chart.chartLine(ymageChart.DIMENSION_BOTTOM, ymageChart.DIMENSION_RIGHT, x0, y0, x1, y1);
+ if (x0 < 0) chart.chartLine(ChartPlotter.DIMENSION_BOTTOM, ChartPlotter.DIMENSION_RIGHT, x0, y0, x1, y1);
x0 = x1; y0 = y1;
}}
// draw wordcache
- events = serverProfiling.history("wordcache");
+ events = MemoryTracker.history("wordcache");
x0 = 1; y0 = 0;
- if (events != null) synchronized (events) {for (serverProfiling.Event event: events) {
+ if (events != null) synchronized (events) {for (MemoryTracker.Event event: events) {
time = event.time - now;
words = (int) ((Long) event.payload).longValue();
x1 = (int) (time/1000);
y1 = words;
chart.setColor("228822");
- chart.chartDot(ymageChart.DIMENSION_BOTTOM, ymageChart.DIMENSION_LEFT, x1, y1, 2, null, 315);
+ chart.chartDot(ChartPlotter.DIMENSION_BOTTOM, ChartPlotter.DIMENSION_LEFT, x1, y1, 2, null, 315);
chart.setColor("008800");
- if (x0 < 0) chart.chartLine(ymageChart.DIMENSION_BOTTOM, ymageChart.DIMENSION_LEFT, x0, y0, x1, y1);
+ if (x0 < 0) chart.chartLine(ChartPlotter.DIMENSION_BOTTOM, ChartPlotter.DIMENSION_LEFT, x0, y0, x1, y1);
x0 = x1; y0 = y1;
}}
// draw ppm
- events = serverProfiling.history("ppm");
+ events = MemoryTracker.history("ppm");
x0 = 1; y0 = 0;
- if (events != null) synchronized (events) {for (serverProfiling.Event event: events) {
+ if (events != null) synchronized (events) {for (MemoryTracker.Event event: events) {
time = event.time - now;
ppm = (int) ((Long) event.payload).longValue();
x1 = (int) (time/1000);
y1 = ppm;
chart.setColor("AA8888");
- if (x0 < 0) chart.chartLine(ymageChart.DIMENSION_BOTTOM, ymageChart.DIMENSION_ANOT0, x0, y0, x1, y1);
+ if (x0 < 0) chart.chartLine(ChartPlotter.DIMENSION_BOTTOM, ChartPlotter.DIMENSION_ANOT0, x0, y0, x1, y1);
chart.setColor("AA2222");
- chart.chartDot(ymageChart.DIMENSION_BOTTOM, ymageChart.DIMENSION_ANOT0, x1, y1, 2, ppm + " PPM", 0);
+ chart.chartDot(ChartPlotter.DIMENSION_BOTTOM, ChartPlotter.DIMENSION_ANOT0, x1, y1, 2, ppm + " PPM", 0);
x0 = x1; y0 = y1;
}}
diff --git a/source/de/anomic/ymage/WebStructureGraph.java b/source/de/anomic/yacy/graphics/WebStructureGraph.java
similarity index 99%
rename from source/de/anomic/ymage/WebStructureGraph.java
rename to source/de/anomic/yacy/graphics/WebStructureGraph.java
index cbe607773..8237504cc 100644
--- a/source/de/anomic/ymage/WebStructureGraph.java
+++ b/source/de/anomic/yacy/graphics/WebStructureGraph.java
@@ -25,7 +25,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.ymage;
+package de.anomic.yacy.graphics;
import java.io.File;
import java.io.IOException;
diff --git a/source/de/anomic/yacy/yacyCore.java b/source/de/anomic/yacy/yacyCore.java
index adcf852a5..d065cdec9 100644
--- a/source/de/anomic/yacy/yacyCore.java
+++ b/source/de/anomic/yacy/yacyCore.java
@@ -47,6 +47,7 @@ import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.Semaphore;
import net.yacy.document.content.RSSMessage;
import net.yacy.document.parser.xml.RSSFeed;
@@ -56,7 +57,6 @@ import net.yacy.kelondro.util.DateFormatter;
import de.anomic.search.Switchboard;
import de.anomic.server.serverCore;
-import de.anomic.server.serverSemaphore;
import de.anomic.yacy.dht.PeerSelection;
import de.anomic.yacy.seedUpload.yacySeedUploadFile;
import de.anomic.yacy.seedUpload.yacySeedUploadFtp;
@@ -215,15 +215,15 @@ public class yacyCore {
protected class publishThread extends Thread {
int added;
private final yacySeed seed;
- private final serverSemaphore sync;
+ private final Semaphore sync;
private final List<Thread> syncList;
public publishThread(final ThreadGroup tg, final yacySeed seed,
- final serverSemaphore sync, final List<Thread> syncList) throws InterruptedException {
+ final Semaphore sync, final List<Thread> syncList) throws InterruptedException {
super(tg, "PublishSeed_" + seed.getName());
this.sync = sync;
- this.sync.P();
+ this.sync.acquire();
this.syncList = syncList;
this.seed = seed;
@@ -276,7 +276,7 @@ public class yacyCore {
log.logSevere("publishThread: error with target seed " + seed.toString() + ": " + e.getMessage(), e);
} finally {
this.syncList.add(this);
- this.sync.V();
+ this.sync.release();
}
}
}
@@ -366,14 +366,14 @@ public class yacyCore {
// holding a reference to all started threads
int contactedSeedCount = 0;
final List<Thread> syncList = Collections.synchronizedList(new LinkedList<Thread>()); // memory for threads
- final serverSemaphore sync = new serverSemaphore(attempts);
+ final Semaphore sync = new Semaphore(attempts);
// going through the peer list and starting a new publisher thread for each peer
int i = 0;
while (si.hasNext()) {
seed = si.next();
if (seed == null) {
- sync.P();
+ sync.acquire();
continue;
}
i++;
@@ -384,7 +384,7 @@ public class yacyCore {
if ((address == null) || (seederror != null)) {
// we don't like that address, delete it
sb.peers.peerActions.peerDeparture(seed, "peer ping to peer resulted in address = " + address + "; seederror = " + seederror);
- sync.P();
+ sync.acquire();
} else {
// starting a new publisher thread
contactedSeedCount++;
@@ -396,7 +396,7 @@ public class yacyCore {
for (int j = 0; j < contactedSeedCount; j++) {
// waiting for the next thread to finish
- sync.P();
+ sync.acquire();
// if this is true something is wrong ...
if (syncList.isEmpty()) {
diff --git a/source/de/anomic/yacy/yacyRelease.java b/source/de/anomic/yacy/yacyRelease.java
index 879404dfa..708d6cb08 100644
--- a/source/de/anomic/yacy/yacyRelease.java
+++ b/source/de/anomic/yacy/yacyRelease.java
@@ -50,6 +50,7 @@ import net.yacy.kelondro.io.CharBuffer;
import net.yacy.kelondro.logging.Log;
import net.yacy.kelondro.order.Base64Order;
import net.yacy.kelondro.util.FileUtils;
+import net.yacy.kelondro.util.OS;
import de.anomic.crawler.CrawlProfile;
import de.anomic.crawler.retrieval.HTTPLoader;
@@ -60,7 +61,6 @@ import de.anomic.http.server.RequestHeader;
import de.anomic.http.server.ResponseContainer;
import de.anomic.search.Switchboard;
import de.anomic.server.serverCore;
-import de.anomic.server.serverSystem;
import de.anomic.tools.CryptoLib;
import de.anomic.tools.SignatureOutputStream;
import de.anomic.tools.tarTools;
@@ -390,7 +390,7 @@ public final class yacyRelease extends yacyVersion {
final Switchboard sb = Switchboard.getSwitchboard();
final String apphome = sb.getRootPath().toString();
- if (serverSystem.isWindows) {
+ if (OS.isWindows) {
final File startType = new File(sb.getRootPath(), "DATA/yacy.noconsole".replace("/", File.separator));
String starterFile = "startYACY_debug.bat";
if (startType.exists()) starterFile = "startYACY.bat"; // startType noconsole
@@ -412,9 +412,9 @@ public final class yacyRelease extends yacyVersion {
"cd \"" + apphome + "\"" + serverCore.LF_STRING +
"start /MIN CMD /C " + starterFile + serverCore.LF_STRING;
final File scriptFile = new File(sb.getRootPath(), "DATA/RELEASE/restart.bat".replace("/", File.separator));
- serverSystem.deployScript(scriptFile, script);
+ OS.deployScript(scriptFile, script);
Log.logInfo("RESTART", "wrote restart-script to " + scriptFile.getAbsolutePath());
- serverSystem.execAsynchronous(scriptFile);
+ OS.execAsynchronous(scriptFile);
Log.logInfo("RESTART", "script is running");
sb.terminate(5000);
} catch (final IOException e) {
@@ -442,14 +442,14 @@ public final class yacyRelease extends yacyVersion {
"#!/bin/sh" + serverCore.LF_STRING +
yacyBuildProperties.getRestartCmd() + " >/var/lib/yacy/RELEASE/log" + serverCore.LF_STRING;
final File scriptFile = new File(sb.getRootPath(), "DATA/RELEASE/restart.sh");
- serverSystem.deployScript(scriptFile, script);
+ OS.deployScript(scriptFile, script);
Log.logInfo("RESTART", "wrote restart-script to " + scriptFile.getAbsolutePath());
- serverSystem.execAsynchronous(scriptFile);
+ OS.execAsynchronous(scriptFile);
Log.logInfo("RESTART", "script is running");
} catch (final IOException e) {
Log.logSevere("RESTART", "restart failed", e);
}
- } else if (serverSystem.canExecUnix) {
+ } else if (OS.canExecUnix) {
// start a re-start daemon
try {
Log.logInfo("RESTART", "INITIATED");
@@ -462,9 +462,9 @@ public final class yacyRelease extends yacyVersion {
"cd ../../" + serverCore.LF_STRING +
"nohup ./startYACY.sh > /dev/null" + serverCore.LF_STRING;
final File scriptFile = new File(sb.getRootPath(), "DATA/RELEASE/restart.sh");
- serverSystem.deployScript(scriptFile, script);
+ OS.deployScript(scriptFile, script);
Log.logInfo("RESTART", "wrote restart-script to " + scriptFile.getAbsolutePath());
- serverSystem.execAsynchronous(scriptFile);
+ OS.execAsynchronous(scriptFile);
Log.logInfo("RESTART", "script is running");
sb.terminate(5000);
} catch (final IOException e) {
@@ -493,7 +493,7 @@ public final class yacyRelease extends yacyVersion {
}
String script = null;
String scriptFileName = null;
- if (serverSystem.isWindows) {
+ if (OS.isWindows) {
final File startType = new File(sb.getRootPath(), "DATA/yacy.noconsole".replace("/", File.separator));
String starterFile = "startYACY_debug.bat";
if (startType.exists()) starterFile = "startYACY.bat"; // startType noconsole
@@ -562,9 +562,9 @@ public final class yacyRelease extends yacyVersion {
scriptFileName = "update.sh";
}
final File scriptFile = new File(sb.getRootPath(), "DATA/RELEASE/".replace("/", File.separator) + scriptFileName);
- serverSystem.deployScript(scriptFile, script);
+ OS.deployScript(scriptFile, script);
Log.logInfo("UPDATE", "wrote update-script to " + scriptFile.getAbsolutePath());
- serverSystem.execAsynchronous(scriptFile);
+ OS.execAsynchronous(scriptFile);
Log.logInfo("UPDATE", "script is running");
sb.setConfig("update.time.deploy", System.currentTimeMillis());
sb.terminate(5000);
diff --git a/source/net/yacy/dbtest.java b/source/net/yacy/dbtest.java
index e9e5450ca..cf233cc3a 100644
--- a/source/net/yacy/dbtest.java
+++ b/source/net/yacy/dbtest.java
@@ -25,8 +25,8 @@ import net.yacy.kelondro.table.SplitTable;
import net.yacy.kelondro.table.Table;
import net.yacy.kelondro.util.MemoryControl;
import net.yacy.kelondro.workflow.InstantBusyThread;
+import net.yacy.visualization.ChartPlotter;
-import de.anomic.ymage.ymageChart;
public class dbtest {
@@ -515,7 +515,7 @@ public class dbtest {
final class memprofiler extends Thread {
- ymageChart memChart;
+ ChartPlotter memChart;
boolean run;
File outputFile;
long start;
@@ -523,11 +523,11 @@ final class memprofiler extends Thread {
public memprofiler(final int width, final int height, final int expectedTimeSeconds, final File outputFile) {
this.outputFile = outputFile;
final int expectedKilobytes = 20 * 1024;//(Runtime.getRuntime().totalMemory() / 1024);
- memChart = new ymageChart(width, height, "FFFFFF", "000000", "000000", 50, 20, 20, 20, "MEMORY CHART FROM EXECUTION AT " + new Date(), null);
+ memChart = new ChartPlotter(width, height, "FFFFFF", "000000", "000000", 50, 20, 20, 20, "MEMORY CHART FROM EXECUTION AT " + new Date(), null);
final int timescale = 10; // steps with each 10 seconds
final int memscale = 1024;
- memChart.declareDimension(ymageChart.DIMENSION_BOTTOM, timescale, (width - 40) * timescale / expectedTimeSeconds, 0, "FFFFFF", "555555", "SECONDS");
- memChart.declareDimension(ymageChart.DIMENSION_LEFT, memscale, (height - 40) * memscale / expectedKilobytes, 0, "FFFFFF", "555555", "KILOBYTES");
+ memChart.declareDimension(ChartPlotter.DIMENSION_BOTTOM, timescale, (width - 40) * timescale / expectedTimeSeconds, 0, "FFFFFF", "555555", "SECONDS");
+ memChart.declareDimension(ChartPlotter.DIMENSION_LEFT, memscale, (height - 40) * memscale / expectedKilobytes, 0, "FFFFFF", "555555", "KILOBYTES");
run = true;
start = System.currentTimeMillis();
}
@@ -540,7 +540,7 @@ final class memprofiler extends Thread {
memChart.setColor("FF0000");
seconds1 = (int) ((System.currentTimeMillis() - start) / 1000);
kilobytes1 = (int) (MemoryControl.used() / 1024);
- memChart.chartLine(ymageChart.DIMENSION_BOTTOM, ymageChart.DIMENSION_LEFT, seconds0, kilobytes0, seconds1, kilobytes1);
+ memChart.chartLine(ChartPlotter.DIMENSION_BOTTOM, ChartPlotter.DIMENSION_LEFT, seconds0, kilobytes0, seconds1, kilobytes1);
seconds0 = seconds1;
kilobytes0 = kilobytes1;
try {Thread.sleep(100);} catch (final InterruptedException e) {}
diff --git a/source/net/yacy/document/AbstractParser.java b/source/net/yacy/document/AbstractParser.java
index 53e57db9b..85db1f3e7 100644
--- a/source/net/yacy/document/AbstractParser.java
+++ b/source/net/yacy/document/AbstractParser.java
@@ -126,7 +126,7 @@ public abstract class AbstractParser implements Idiom {
// XXX: workaround for relative paths within document
+ file.getPath().substring(file.getPath().indexOf(File.separatorChar) + 1)
+ "/" + file.getName());
- final Document subdoc = Parser.parseSource(url, Parser.mimeOf(url), null, file);
+ final Document subdoc = TextParser.parseSource(url, TextParser.mimeOf(url), null, file);
// TODO: change anchors back to use '#' after archive name
doc.addSubDocument(subdoc);
subdoc.close();
diff --git a/source/de/anomic/ymage/ymageImageParser.java b/source/net/yacy/document/ImageParser.java
similarity index 69%
rename from source/de/anomic/ymage/ymageImageParser.java
rename to source/net/yacy/document/ImageParser.java
index 62fdb215f..29358e398 100644
--- a/source/de/anomic/ymage/ymageImageParser.java
+++ b/source/net/yacy/document/ImageParser.java
@@ -1,26 +1,30 @@
-package de.anomic.ymage;
+package net.yacy.document;
import java.awt.Container;
import java.awt.Image;
import java.awt.MediaTracker;
import java.awt.Toolkit;
+import net.yacy.document.parser.images.bmpParser;
+import net.yacy.document.parser.images.icoParser;
-public class ymageImageParser {
+
+
+public class ImageParser {
public static final Image parse(final String filename, final byte[] source) {
final MediaTracker mediaTracker = new MediaTracker(new Container());
Image image;
- if (((filename.endsWith(".ico")) || (filename.endsWith(".bmp"))) && (ymageBMPParser.isBMP(source))) {
+ if (((filename.endsWith(".ico")) || (filename.endsWith(".bmp"))) && (bmpParser.isBMP(source))) {
// parse image with BMP parser
- ymageBMPParser bmpparser;
- bmpparser = new ymageBMPParser(source);
+ bmpParser bmpparser;
+ bmpparser = new bmpParser(source);
image = bmpparser.getImage();
if (image == null) return null;
- } else if ((filename.endsWith(".ico")) && (ymageICOParser.isICO(source))) {
+ } else if ((filename.endsWith(".ico")) && (icoParser.isICO(source))) {
// parse image with ICO parser
- ymageICOParser icoparser;
- icoparser = new ymageICOParser(source);
+ icoParser icoparser;
+ icoparser = new icoParser(source);
image = icoparser.getImage(0);
if (image == null) return null;
} else {
diff --git a/source/net/yacy/document/Parser.java b/source/net/yacy/document/TextParser.java
similarity index 99%
rename from source/net/yacy/document/Parser.java
rename to source/net/yacy/document/TextParser.java
index 5ea36e841..bec075a4b 100644
--- a/source/net/yacy/document/Parser.java
+++ b/source/net/yacy/document/TextParser.java
@@ -57,11 +57,12 @@ import net.yacy.document.parser.vcfParser;
import net.yacy.document.parser.vsdParser;
import net.yacy.document.parser.xlsParser;
import net.yacy.document.parser.zipParser;
+import net.yacy.document.parser.images.genericImageParser;
import net.yacy.kelondro.data.meta.DigestURI;
import net.yacy.kelondro.logging.Log;
-public final class Parser {
+public final class TextParser {
private static final Log log = new Log("PARSER");
@@ -82,6 +83,7 @@ public final class Parser {
initParser(new docParser());
initParser(new gzipParser());
initParser(new htmlParser());
+ initParser(new genericImageParser());
initParser(new odtParser());
initParser(new ooxmlParser());
initParser(new pdfParser());
diff --git a/source/de/anomic/data/Coordinates.java b/source/net/yacy/document/geolocalization/Coordinates.java
similarity index 95%
rename from source/de/anomic/data/Coordinates.java
rename to source/net/yacy/document/geolocalization/Coordinates.java
index 0560dc4f4..5171dfa3d 100644
--- a/source/de/anomic/data/Coordinates.java
+++ b/source/net/yacy/document/geolocalization/Coordinates.java
@@ -24,7 +24,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.data;
+package net.yacy.document.geolocalization;
public class Coordinates implements Comparable<Coordinates> {
diff --git a/source/de/anomic/data/Location.java b/source/net/yacy/document/geolocalization/Location.java
similarity index 93%
rename from source/de/anomic/data/Location.java
rename to source/net/yacy/document/geolocalization/Location.java
index 509bf2295..52391066f 100644
--- a/source/de/anomic/data/Location.java
+++ b/source/net/yacy/document/geolocalization/Location.java
@@ -24,7 +24,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.data;
+package net.yacy.document.geolocalization;
+
public class Location extends Coordinates {
diff --git a/source/de/anomic/data/OpenGeoDB.java b/source/net/yacy/document/geolocalization/OpenGeoDB.java
similarity index 97%
rename from source/de/anomic/data/OpenGeoDB.java
rename to source/net/yacy/document/geolocalization/OpenGeoDB.java
index ab6aaedea..34f578b63 100644
--- a/source/de/anomic/data/OpenGeoDB.java
+++ b/source/net/yacy/document/geolocalization/OpenGeoDB.java
@@ -24,7 +24,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.data;
+package net.yacy.document.geolocalization;
import java.io.BufferedReader;
import java.io.File;
@@ -44,6 +44,7 @@ import java.util.SortedMap;
import java.util.TreeMap;
import java.util.zip.GZIPInputStream;
+
/**
* this class loads and parses database dumps from the OpenGeoDB project
* files can be loaded from http://sourceforge.net/projects/opengeodb/files/
diff --git a/source/net/yacy/document/parser/bzipParser.java b/source/net/yacy/document/parser/bzipParser.java
index c85b45ee1..40d445d6f 100644
--- a/source/net/yacy/document/parser/bzipParser.java
+++ b/source/net/yacy/document/parser/bzipParser.java
@@ -36,7 +36,7 @@ import java.util.Set;
import net.yacy.document.AbstractParser;
import net.yacy.document.Document;
import net.yacy.document.Idiom;
-import net.yacy.document.Parser;
+import net.yacy.document.TextParser;
import net.yacy.document.ParserException;
import net.yacy.kelondro.data.meta.DigestURI;
import net.yacy.kelondro.util.FileUtils;
@@ -113,7 +113,7 @@ public class bzipParser extends AbstractParser implements Idiom {
checkInterruption();
// creating a new parser class to parse the unzipped content
- return Parser.parseSource(location,null,null,tempFile);
+ return TextParser.parseSource(location,null,null,tempFile);
} catch (final Exception e) {
if (e instanceof InterruptedException) throw (InterruptedException) e;
if (e instanceof ParserException) throw (ParserException) e;
diff --git a/source/net/yacy/document/parser/gzipParser.java b/source/net/yacy/document/parser/gzipParser.java
index 10b528187..624b7fdcb 100644
--- a/source/net/yacy/document/parser/gzipParser.java
+++ b/source/net/yacy/document/parser/gzipParser.java
@@ -37,7 +37,7 @@ import java.util.zip.GZIPInputStream;
import net.yacy.document.AbstractParser;
import net.yacy.document.Document;
import net.yacy.document.Idiom;
-import net.yacy.document.Parser;
+import net.yacy.document.TextParser;
import net.yacy.document.ParserException;
import net.yacy.kelondro.data.meta.DigestURI;
import net.yacy.kelondro.util.FileUtils;
@@ -100,7 +100,7 @@ public class gzipParser extends AbstractParser implements Idiom {
checkInterruption();
// creating a new parser class to parse the unzipped content
- return Parser.parseSource(location,null,null,tempFile);
+ return TextParser.parseSource(location,null,null,tempFile);
} catch (final Exception e) {
if (e instanceof InterruptedException) throw (InterruptedException) e;
if (e instanceof ParserException) throw (ParserException) e;
diff --git a/source/de/anomic/ymage/ymageBMPParser.java b/source/net/yacy/document/parser/images/bmpParser.java
similarity index 98%
rename from source/de/anomic/ymage/ymageBMPParser.java
rename to source/net/yacy/document/parser/images/bmpParser.java
index 01192afc3..a27cde59f 100644
--- a/source/de/anomic/ymage/ymageBMPParser.java
+++ b/source/net/yacy/document/parser/images/bmpParser.java
@@ -22,7 +22,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.ymage;
+package net.yacy.document.parser.images;
import java.awt.image.BufferedImage;
import java.io.File;
@@ -32,7 +32,7 @@ import java.io.IOException;
import javax.imageio.ImageIO;
-public class ymageBMPParser {
+public class bmpParser {
// this is a implementation of http://de.wikipedia.org/wiki/Windows_Bitmap
@@ -55,7 +55,7 @@ public class ymageBMPParser {
return (source != null) && (source.length >= 2) && (source[0] == 'B') && (source[1] == 'M');
}
- public ymageBMPParser(final byte[] source) {
+ public bmpParser(final byte[] source) {
// read info-header
final int bfOffBits = DWORD(source, FILEHEADER_offset + 10);
@@ -262,7 +262,7 @@ public class ymageBMPParser {
e.printStackTrace();
}
- final ymageBMPParser parser = new ymageBMPParser(file);
+ final bmpParser parser = new bmpParser(file);
try {
ImageIO.write(parser.getImage(), "PNG", out);
diff --git a/source/net/yacy/document/parser/images/genericImageParser.java b/source/net/yacy/document/parser/images/genericImageParser.java
new file mode 100644
index 000000000..cfc5fa747
--- /dev/null
+++ b/source/net/yacy/document/parser/images/genericImageParser.java
@@ -0,0 +1,141 @@
+// pngParser.java
+// (C) 2009 by Michael Peter Christen; [email protected], Frankfurt a. M., Germany
+// first published 16.10.2009 on http://yacy.net
+//
+// This is a part of YaCy, a peer-to-peer based web search engine
+//
+// $LastChangedDate: 2009-10-11 02:12:19 +0200 (So, 11 Okt 2009) $
+// $LastChangedRevision: 6398 $
+// $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 net.yacy.document.parser.images;
+
+import java.awt.image.BufferedImage;
+import java.awt.image.Raster;
+import java.io.EOFException;
+import java.io.IOException;
+import java.io.InputStream;import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.imageio.ImageIO;
+
+import net.yacy.document.AbstractParser;
+import net.yacy.document.Document;
+import net.yacy.document.Idiom;
+import net.yacy.document.ParserException;
+import net.yacy.document.parser.html.ImageEntry;
+import net.yacy.kelondro.data.meta.DigestURI;
+
+public class genericImageParser extends AbstractParser implements Idiom {
+
+ /**
+ * a list of mime types that are supported by this parser class
+ * @see #getSupportedMimeTypes()
+ */
+ public static final Set<String> SUPPORTED_MIME_TYPES = new HashSet<String>();
+ public static final Set<String> SUPPORTED_EXTENSIONS = new HashSet<String>();
+ static {
+ SUPPORTED_EXTENSIONS.add("png");
+ SUPPORTED_EXTENSIONS.add("gif");
+ SUPPORTED_EXTENSIONS.add("jpg");
+ SUPPORTED_EXTENSIONS.add("jpeg");
+ SUPPORTED_EXTENSIONS.add("jpe");
+ SUPPORTED_MIME_TYPES.add("image/png");
+ SUPPORTED_MIME_TYPES.add("image/gif");
+ SUPPORTED_MIME_TYPES.add("image/jpg");
+ }
+
+ public genericImageParser() {
+ super("Generic Image Parser");
+ }
+
+ @Override
+ public Document parse(
+ final DigestURI location,
+ final String mimeType,
+ final String documentCharset,
+ final InputStream sourceStream) throws ParserException, InterruptedException {
+ BufferedImage image = null;
+ try {
+ image = ImageIO.read(sourceStream);
+ } catch (final EOFException e) {
+ throw new ParserException(e.getMessage(), location);
+ } catch (final IOException e) {
+ throw new ParserException(e.getMessage(), location);
+ }
+
+ // scan the image
+ int height = image.getHeight();
+ int width = image.getWidth();
+ Raster raster = image.getData();
+ int[] pixel = raster.getPixel(0, 0, (int[])null);
+ long[] average = new long[]{0, 0, 0};
+ int pc = 0;
+ for (int x = width / 4; x < 3 * width / 4; x = x + 2) {
+ for (int y = height / 4; y < 3 * height / 4; y = y + 2) {
+ pixel = raster.getPixel(x, y, pixel);
+ average[0] += pixel[0];
+ average[1] += pixel[1];
+ average[2] += pixel[2];
+ pc++;
+ }
+ }
+
+ // get image properties
+ String [] propNames = image.getPropertyNames();
+ StringBuilder sb = new StringBuilder(propNames.length * 80);
+ for (String propName: propNames) {
+ sb.append(propName).append(" = ").append(image.getProperty(propName)).append(" .\n");
+ }
+
+ final HashSet<String> languages = new HashSet<String>();
+ final HashMap<DigestURI, String> anchors = new HashMap<DigestURI, String>();
+ final HashMap<String, ImageEntry> images = new HashMap<String, ImageEntry>();
+
+ return new Document(
+ location,
+ mimeType,
+ "UTF-8",
+ languages,
+ new String[]{}, // keywords
+ "", // title
+ "", // author
+ new String[]{}, // sections
+ "", // description
+ sb.toString().getBytes(), // content text
+ anchors, // anchors
+ images); // images
+ }
+/*
+ * Document(final DigestURI location, final String mimeType, final String charset, final Set<String> languages,
+ final String[] keywords, final String title, final String author,
+ final String[] sections, final String abstrct,
+ final Object text, final Map<DigestURI, String> anchors, final HashMap<String, ImageEntry> images) {(non-Javadoc)
+ * @see net.yacy.document.Idiom#supportedMimeTypes()
+ */
+ public Set<String> supportedMimeTypes() {
+ return SUPPORTED_MIME_TYPES;
+ }
+
+ public Set<String> supportedExtensions() {
+ return SUPPORTED_EXTENSIONS;
+ }
+
+}
diff --git a/source/de/anomic/ymage/ymageICOParser.java b/source/net/yacy/document/parser/images/icoParser.java
similarity index 67%
rename from source/de/anomic/ymage/ymageICOParser.java
rename to source/net/yacy/document/parser/images/icoParser.java
index 4399518bf..5fde16f6c 100644
--- a/source/de/anomic/ymage/ymageICOParser.java
+++ b/source/net/yacy/document/parser/images/icoParser.java
@@ -22,7 +22,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.ymage;
+package net.yacy.document.parser.images;
import java.awt.image.BufferedImage;
import java.io.File;
@@ -32,35 +32,36 @@ import java.io.IOException;
import javax.imageio.ImageIO;
-public class ymageICOParser {
+
+public class icoParser {
// this is a implementation of http://msdn2.microsoft.com/en-us/library/ms997538(d=printer).aspx
public static final int ICONDIRENTRY_size = 16;
private final int idCount;
- ymageBMPParser.INFOHEADER[] infoheaders;
- ymageBMPParser.IMAGEMAP[] imagemaps;
+ bmpParser.INFOHEADER[] infoheaders;
+ bmpParser.IMAGEMAP[] imagemaps;
public static final boolean isICO(final byte[] source) {
// check the file magic
return (source != null) && (source.length >= 4) && (source[0] == 0) && (source[1] == 0) && (source[2] == 1) && (source[3] == 0);
}
- public ymageICOParser(final byte[] source) {
+ public icoParser(final byte[] source) {
// read info-header
- idCount = ymageBMPParser.WORD(source, 4);
+ idCount = bmpParser.WORD(source, 4);
// read the icon directory entry and the image entries
final ICONDIRENTRY[] icondirentries = new ICONDIRENTRY[idCount];
- infoheaders = new ymageBMPParser.INFOHEADER[idCount];
- final ymageBMPParser.COLORTABLE[] colortables = new ymageBMPParser.COLORTABLE[idCount];
- imagemaps = new ymageBMPParser.IMAGEMAP[idCount];
+ infoheaders = new bmpParser.INFOHEADER[idCount];
+ final bmpParser.COLORTABLE[] colortables = new bmpParser.COLORTABLE[idCount];
+ imagemaps = new bmpParser.IMAGEMAP[idCount];
for (int i = 0; i < idCount; i++) {
icondirentries[i] = new ICONDIRENTRY(source, 6 + i * ICONDIRENTRY_size);
- infoheaders[i] = new ymageBMPParser.INFOHEADER(source, icondirentries[i].dwImageOffset);
- colortables[i] = new ymageBMPParser.COLORTABLE(source, icondirentries[i].dwImageOffset + ymageBMPParser.INFOHEADER_size, infoheaders[i]);
- imagemaps[i] = new ymageBMPParser.IMAGEMAP(source, icondirentries[i].dwImageOffset + ymageBMPParser.INFOHEADER_size + colortables[i].colorbytes, icondirentries[i].bWidth, icondirentries[i].bHeight, infoheaders[i].biCompression, infoheaders[i].biBitCount, colortables[i]);
+ infoheaders[i] = new bmpParser.INFOHEADER(source, icondirentries[i].dwImageOffset);
+ colortables[i] = new bmpParser.COLORTABLE(source, icondirentries[i].dwImageOffset + bmpParser.INFOHEADER_size, infoheaders[i]);
+ imagemaps[i] = new bmpParser.IMAGEMAP(source, icondirentries[i].dwImageOffset + bmpParser.INFOHEADER_size + colortables[i].colorbytes, icondirentries[i].bWidth, icondirentries[i].bHeight, infoheaders[i].biCompression, infoheaders[i].biBitCount, colortables[i]);
}
}
@@ -71,14 +72,14 @@ public class ymageICOParser {
public ICONDIRENTRY(final byte[] s, final int offset) {
// read info-header
- bWidth = ymageBMPParser.BYTE(s, offset + 0);
- bHeight = ymageBMPParser.BYTE(s, offset + 1);
- bColorCount = ymageBMPParser.BYTE(s, offset + 2);
- bReserved = ymageBMPParser.BYTE(s, offset + 3);
- wPlanes = ymageBMPParser.WORD(s, offset + 4);
- wBitCount = ymageBMPParser.WORD(s, offset + 6);
- dwBytesInRes = ymageBMPParser.DWORD(s, offset + 8);
- dwImageOffset = ymageBMPParser.DWORD(s, offset + 12);
+ bWidth = bmpParser.BYTE(s, offset + 0);
+ bHeight = bmpParser.BYTE(s, offset + 1);
+ bColorCount = bmpParser.BYTE(s, offset + 2);
+ bReserved = bmpParser.BYTE(s, offset + 3);
+ wPlanes = bmpParser.WORD(s, offset + 4);
+ wBitCount = bmpParser.WORD(s, offset + 6);
+ dwBytesInRes = bmpParser.DWORD(s, offset + 8);
+ dwImageOffset = bmpParser.DWORD(s, offset + 12);
}
}
@@ -109,7 +110,7 @@ public class ymageICOParser {
e.printStackTrace();
}
- final ymageICOParser parser = new ymageICOParser(file);
+ final icoParser parser = new icoParser(file);
try {
ImageIO.write(parser.getImage(0), "PNG", out);
diff --git a/source/net/yacy/document/parser/sevenzipParser.java b/source/net/yacy/document/parser/sevenzipParser.java
index 6ef535666..e7f442b12 100644
--- a/source/net/yacy/document/parser/sevenzipParser.java
+++ b/source/net/yacy/document/parser/sevenzipParser.java
@@ -38,7 +38,7 @@ import java.util.Set;
import net.yacy.document.AbstractParser;
import net.yacy.document.Document;
import net.yacy.document.Idiom;
-import net.yacy.document.Parser;
+import net.yacy.document.TextParser;
import net.yacy.document.ParserException;
import net.yacy.kelondro.data.meta.DigestURI;
import net.yacy.kelondro.io.CachedFileOutputStream;
@@ -196,11 +196,11 @@ public class sevenzipParser extends AbstractParser implements Idiom {
// workaround for relative links in file, normally '#' shall be used behind the location, see
// below for reversion of the effects
final DigestURI url = DigestURI.newURL(doc.dc_source(), this.prefix + "/" + super.filePath);
- final String mime = Parser.mimeOf(super.filePath.substring(super.filePath.lastIndexOf('.') + 1));
+ final String mime = TextParser.mimeOf(super.filePath.substring(super.filePath.lastIndexOf('.') + 1));
if (this.cfos.isFallback()) {
- theDoc = Parser.parseSource(url, mime, null, this.cfos.getContentFile());
+ theDoc = TextParser.parseSource(url, mime, null, this.cfos.getContentFile());
} else {
- theDoc = Parser.parseSource(url, mime, null, this.cfos.getContentBAOS());
+ theDoc = TextParser.parseSource(url, mime, null, this.cfos.getContentBAOS());
}
this.doc.addSubDocument(theDoc);
diff --git a/source/net/yacy/document/parser/tarParser.java b/source/net/yacy/document/parser/tarParser.java
index 202292f80..76ad8b552 100644
--- a/source/net/yacy/document/parser/tarParser.java
+++ b/source/net/yacy/document/parser/tarParser.java
@@ -43,7 +43,7 @@ import java.util.zip.GZIPInputStream;
import net.yacy.document.AbstractParser;
import net.yacy.document.Document;
import net.yacy.document.Idiom;
-import net.yacy.document.Parser;
+import net.yacy.document.TextParser;
import net.yacy.document.ParserException;
import net.yacy.document.parser.html.ContentScraper;
import net.yacy.document.parser.html.ImageEntry;
@@ -135,7 +135,7 @@ public class tarParser extends AbstractParser implements Idiom {
final String entryExt = (idx > -1) ? entryName.substring(idx+1) : "";
// trying to determine the mimeType per file extension
- final String entryMime = Parser.mimeOf(entryExt);
+ final String entryMime = TextParser.mimeOf(entryExt);
// getting the entry content
File subDocTempFile = null;
@@ -150,7 +150,7 @@ public class tarParser extends AbstractParser implements Idiom {
checkInterruption();
// parsing the content
- subDoc = Parser.parseSource(DigestURI.newURL(location,"#" + entryName),entryMime,null,subDocTempFile);
+ subDoc = TextParser.parseSource(DigestURI.newURL(location,"#" + entryName),entryMime,null,subDocTempFile);
} catch (final ParserException e) {
this.theLogger.logInfo("Unable to parse tar file entry '" + entryName + "'. " + e.getMessage());
} finally {
diff --git a/source/net/yacy/document/parser/zipParser.java b/source/net/yacy/document/parser/zipParser.java
index 1c4ab79e0..b6480ba5e 100644
--- a/source/net/yacy/document/parser/zipParser.java
+++ b/source/net/yacy/document/parser/zipParser.java
@@ -44,7 +44,7 @@ import java.util.zip.ZipInputStream;
import net.yacy.document.AbstractParser;
import net.yacy.document.Document;
import net.yacy.document.Idiom;
-import net.yacy.document.Parser;
+import net.yacy.document.TextParser;
import net.yacy.document.ParserException;
import net.yacy.document.parser.html.ContentScraper;
import net.yacy.document.parser.html.ImageEntry;
@@ -124,7 +124,7 @@ public class zipParser extends AbstractParser implements Idiom {
final String entryExt = (idx > -1) ? entryName.substring(idx+1) : "";
// trying to determine the mimeType per file extension
- final String entryMime = Parser.mimeOf(entryExt);
+ final String entryMime = TextParser.mimeOf(entryExt);
// parsing the content
File subDocTempFile = null;
@@ -136,7 +136,7 @@ public class zipParser extends AbstractParser implements Idiom {
FileUtils.copy(zippedContent,subDocTempFile,entry.getSize());
// parsing the zip file entry
- subDoc = Parser.parseSource(DigestURI.newURL(location,"#" + entryName),entryMime,null, subDocTempFile);
+ subDoc = TextParser.parseSource(DigestURI.newURL(location,"#" + entryName),entryMime,null, subDocTempFile);
} catch (final ParserException e) {
this.theLogger.logInfo("Unable to parse zip file entry '" + entryName + "'. " + e.getMessage());
} finally {
diff --git a/source/net/yacy/kelondro/rwi/IndexCell.java b/source/net/yacy/kelondro/rwi/IndexCell.java
index 5fe8831a7..57296e6d5 100644
--- a/source/net/yacy/kelondro/rwi/IndexCell.java
+++ b/source/net/yacy/kelondro/rwi/IndexCell.java
@@ -40,8 +40,8 @@ import net.yacy.kelondro.order.MergeIterator;
import net.yacy.kelondro.order.Order;
import net.yacy.kelondro.util.ByteArray;
import net.yacy.kelondro.util.MemoryControl;
+import net.yacy.kelondro.util.MemoryTracker;
-import de.anomic.server.serverProfiling;
/*
* an index cell is a part of the horizontal index in the new segment-oriented index
@@ -108,7 +108,7 @@ public final class IndexCell<ReferenceType extends Reference> extends AbstractBu
public void add(ReferenceContainer<ReferenceType> newEntries) throws IOException {
this.ram.add(newEntries);
if (this.ram.size() % 1000 == 0 || this.lastCleanup + cleanupCycle < System.currentTimeMillis()) {
- serverProfiling.update("wordcache", Long.valueOf(this.ram.size()), true);
+ MemoryTracker.update("wordcache", Long.valueOf(this.ram.size()), true);
cleanCache();
}
}
@@ -116,7 +116,7 @@ public final class IndexCell<ReferenceType extends Reference> extends AbstractBu
public void add(byte[] termHash, ReferenceType entry) throws IOException {
this.ram.add(termHash, entry);
if (this.ram.size() % 1000 == 0 || this.lastCleanup + cleanupCycle < System.currentTimeMillis()) {
- serverProfiling.update("wordcache", Long.valueOf(this.ram.size()), true);
+ MemoryTracker.update("wordcache", Long.valueOf(this.ram.size()), true);
cleanCache();
}
}
diff --git a/source/de/anomic/server/serverProfiling.java b/source/net/yacy/kelondro/util/MemoryTracker.java
similarity index 93%
rename from source/de/anomic/server/serverProfiling.java
rename to source/net/yacy/kelondro/util/MemoryTracker.java
index e96dc8277..15674c7de 100644
--- a/source/de/anomic/server/serverProfiling.java
+++ b/source/net/yacy/kelondro/util/MemoryTracker.java
@@ -1,4 +1,4 @@
-// serverProfiling.java
+// MemoryTracker.java
// (C) 2007 by Michael Peter Christen; [email protected], Frankfurt a. M., Germany
// first published 17.11.2007 on http://yacy.net
//
@@ -24,24 +24,23 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.server;
+package net.yacy.kelondro.util;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-import net.yacy.kelondro.util.MemoryControl;
-public class serverProfiling extends Thread {
+public class MemoryTracker extends Thread {
private static final Map<String, ArrayList<Event>> historyMaps = new ConcurrentHashMap<String, ArrayList<Event>>();
private static final Map<String, Long> eventAccess = new ConcurrentHashMap<String, Long>(); // value: last time when this was accessed
- private static serverProfiling systemProfiler = null;
+ private static MemoryTracker systemProfiler = null;
public static void startSystemProfiling() {
- systemProfiler = new serverProfiling(1500);
+ systemProfiler = new MemoryTracker(1500);
systemProfiler.start();
}
@@ -52,7 +51,7 @@ public class serverProfiling extends Thread {
private final long delaytime;
private boolean running;
- public serverProfiling(final long time) {
+ public MemoryTracker(final long time) {
this.delaytime = time;
running = true;
}
diff --git a/source/de/anomic/server/serverSystem.java b/source/net/yacy/kelondro/util/OS.java
similarity index 96%
rename from source/de/anomic/server/serverSystem.java
rename to source/net/yacy/kelondro/util/OS.java
index 19ce664fb..b37af287f 100644
--- a/source/de/anomic/server/serverSystem.java
+++ b/source/net/yacy/kelondro/util/OS.java
@@ -1,4 +1,4 @@
-// serverSystem.java
+// OS.java
// -------------------------------------------
// (C) by Michael Peter Christen; [email protected]
// first published on http://www.anomic.de
@@ -19,7 +19,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.server;
+package net.yacy.kelondro.util;
import java.io.BufferedReader;
import java.io.File;
@@ -33,12 +33,12 @@ import java.util.List;
import java.util.Properties;
import java.util.Vector;
+import de.anomic.server.serverCore;
+
import net.yacy.kelondro.logging.Log;
-import net.yacy.kelondro.util.FileUtils;
-import net.yacy.kelondro.util.ConsoleInterface;
-public final class serverSystem {
+public final class OS {
// constants for system identification
public static final int systemMacOSC = 0; // 'classic' Mac OS 7.6.1/8.*/9.*
diff --git a/source/de/anomic/ymage/AnimGifEncoder.java b/source/net/yacy/visualization/AnimGifEncoder.java
similarity index 99%
rename from source/de/anomic/ymage/AnimGifEncoder.java
rename to source/net/yacy/visualization/AnimGifEncoder.java
index 0cacc02d6..ec45603a1 100644
--- a/source/de/anomic/ymage/AnimGifEncoder.java
+++ b/source/net/yacy/visualization/AnimGifEncoder.java
@@ -33,7 +33,7 @@
// - removed unused variables
// - replaced old java classes by new one
-package de.anomic.ymage;
+package net.yacy.visualization;
import java.awt.Canvas;
import java.awt.Image;
@@ -57,6 +57,7 @@ import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
+
/**
* <p>This class can be used to write an animated GIF file by combining several
* images. It is loosely based on the Acme GIF encoder.</p>
@@ -1136,8 +1137,8 @@ public class AnimGifEncoder {
public static void main(final String[] args) {
System.setProperty("java.awt.headless", "true");
- final ymageMatrix m = new ymageMatrix(200, 300, ymageMatrix.MODE_SUB, "FFFFFF");
- ymageMatrix.demoPaint(m);
+ final RasterPlotter m = new RasterPlotter(200, 300, RasterPlotter.MODE_SUB, "FFFFFF");
+ RasterPlotter.demoPaint(m);
final File file = new File("/Users/admin/Desktop/testimage.gif");
OutputStream os;
diff --git a/source/de/anomic/ymage/ymageCaptcha.java b/source/net/yacy/visualization/Captcha.java
similarity index 87%
rename from source/de/anomic/ymage/ymageCaptcha.java
rename to source/net/yacy/visualization/Captcha.java
index 103f4a4e1..b430719e0 100644
--- a/source/de/anomic/ymage/ymageCaptcha.java
+++ b/source/net/yacy/visualization/Captcha.java
@@ -21,15 +21,16 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.ymage;
+package net.yacy.visualization;
import java.util.Random;
import javax.imageio.ImageIO;
-public class ymageCaptcha extends ymageMatrix {
- public ymageCaptcha(final int width, final int height, final byte displayMode, final String code) {
+public class Captcha extends RasterPlotter {
+
+ public Captcha(final int width, final int height, final byte displayMode, final String code) {
super(width, height, displayMode, "FFFFFF");
this.create(code);
}
@@ -53,7 +54,7 @@ public class ymageCaptcha extends ymageMatrix {
for(int i=0;i<chars;i++){
y = random.nextInt(height/2) + (height/4);
setColor(((random.nextInt(128)+64)<<16) + ((random.nextInt(128)+64)<<8) + random.nextInt(128)+64);
- ymageToolPrint.print(this, widthPerChar*i+random.nextInt(widthPerChar/2) , y , 0, code.substring(i,i+1), -1);
+ PrintTool.print(this, widthPerChar*i+random.nextInt(widthPerChar/2) , y , 0, code.substring(i,i+1), -1);
}
//adding some noise
@@ -82,7 +83,7 @@ public class ymageCaptcha extends ymageMatrix {
// go into headless awt mode
System.setProperty("java.awt.headless", "true");
- final ymageCaptcha m = new ymageCaptcha(200, 70, ymageMatrix.MODE_REPLACE, args[1]);
+ final Captcha m = new Captcha(200, 70, RasterPlotter.MODE_REPLACE, args[1]);
try {
ImageIO.write(m.getImage(), "png", new java.io.File(args[0]));
} catch (final java.io.IOException e) {
diff --git a/source/de/anomic/ymage/ymageChart.java b/source/net/yacy/visualization/ChartPlotter.java
similarity index 86%
rename from source/de/anomic/ymage/ymageChart.java
rename to source/net/yacy/visualization/ChartPlotter.java
index 96607c669..d3acac5a6 100644
--- a/source/de/anomic/ymage/ymageChart.java
+++ b/source/net/yacy/visualization/ChartPlotter.java
@@ -19,7 +19,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.ymage;
+package net.yacy.visualization;
import java.io.File;
import java.io.FileOutputStream;
@@ -27,7 +27,8 @@ import java.io.IOException;
import javax.imageio.ImageIO;
-public class ymageChart extends ymageMatrix {
+
+public class ChartPlotter extends RasterPlotter {
public static final int DIMENSION_RIGHT = 0;
public static final int DIMENSION_TOP = 1;
@@ -49,10 +50,10 @@ public class ymageChart extends ymageMatrix {
//String name;
//String backgroundColor, foregroundColor;
- public ymageChart(final int width, final int height, final String backgroundColor, final String foregroundColor, final String lightColor,
+ public ChartPlotter(final int width, final int height, final String backgroundColor, final String foregroundColor, final String lightColor,
final int leftborder, final int rightborder, final int topborder, final int bottomborder,
final String name, final String subline) {
- super(width, height, ymageMatrix.MODE_REPLACE, backgroundColor);
+ super(width, height, RasterPlotter.MODE_REPLACE, backgroundColor);
this.leftborder = leftborder;
this.rightborder = rightborder;
this.topborder = topborder;
@@ -62,11 +63,11 @@ public class ymageChart extends ymageMatrix {
//this.foregroundColor = foregroundColor;
if (name != null) {
this.setColor(foregroundColor);
- ymageToolPrint.print(this, width / 2 - name.length() * 3, 6, 0, name, -1);
+ PrintTool.print(this, width / 2 - name.length() * 3, 6, 0, name, -1);
}
if (subline != null) {
this.setColor(lightColor);
- ymageToolPrint.print(this, width / 2 - subline.length() * 3, 14, 0, subline, -1);
+ PrintTool.print(this, width / 2 - subline.length() * 3, 14, 0, subline, -1);
}
}
@@ -90,7 +91,7 @@ public class ymageChart extends ymageMatrix {
final int y = (coord_y - offsets[dimension_y]) * pixels[dimension_y] / scales[dimension_y];
if (dotsize == 1) plot(leftborder + x, height - bottomborder - y);
else dot(leftborder + x, height - bottomborder - y, dotsize, true);
- if (anot != null) ymageToolPrint.print(this, leftborder + x + dotsize + 2 + ((anotAngle == 315) ? -9 : 0), height - bottomborder - y + ((anotAngle == 315) ? -3 : 0), anotAngle, anot, (anotAngle == 0) ? -1 : ((anotAngle == 315) ? 1 : 0));
+ if (anot != null) PrintTool.print(this, leftborder + x + dotsize + 2 + ((anotAngle == 315) ? -9 : 0), height - bottomborder - y + ((anotAngle == 315) ? -3 : 0), anotAngle, anot, (anotAngle == 0) ? -1 : ((anotAngle == 315) ? 1 : 0));
}
public void chartLine(final int dimension_x, final int dimension_y, final int coord_x1, final int coord_y1, final int coord_x2, final int coord_y2) {
@@ -112,12 +113,12 @@ public class ymageChart extends ymageMatrix {
}
setColor(colorNaming);
line(x, y - 3, x, y + 3);
- ymageToolPrint.print(this, x, (top) ? y - 3 : y + 9, 0, Integer.toString(s), -1);
+ PrintTool.print(this, x, (top) ? y - 3 : y + 9, 0, Integer.toString(s), -1);
x += pixelperscale;
s += scale;
}
setColor(colorNaming);
- ymageToolPrint.print(this, width - rightborder, (top) ? y - 9 : y + 15, 0, name, 1);
+ PrintTool.print(this, width - rightborder, (top) ? y - 9 : y + 15, 0, name, 1);
line(leftborder - 4, y, width - rightborder + 4, y);
}
@@ -136,12 +137,12 @@ public class ymageChart extends ymageMatrix {
line(x - 3, y, x + 3, y);
s1 = (s >= 1000000 && s % 10000 == 0) ? Integer.toString(s / 1000000) + "M" : (s >= 1000 && s % 1000 == 0) ? Integer.toString(s / 1000) + "K" : Integer.toString(s);
if (s1.length() > s1max) s1max = s1.length();
- ymageToolPrint.print(this, (left) ? leftborder - 4 : width - rightborder + 4, y, 0, s1, (left) ? 1 : -1);
+ PrintTool.print(this, (left) ? leftborder - 4 : width - rightborder + 4, y, 0, s1, (left) ? 1 : -1);
y -= pixelperscale;
s += scale;
}
setColor(colorNaming);
- ymageToolPrint.print(this, (left) ? x - s1max * 6 - 6 : x + s1max * 6 + 9, topborder, 90, name, 1);
+ PrintTool.print(this, (left) ? x - s1max * 6 - 6 : x + s1max * 6 + 9, topborder, 90, name, 1);
line(x, topborder - 4, x, height - bottomborder + 4);
}
@@ -152,7 +153,7 @@ public class ymageChart extends ymageMatrix {
final String scale = "CCCCCC";
final String green = "008800";
final String blue = "0000FF";
- final ymageChart ip = new ymageChart(660, 240, bg, fg, fg, 30, 30, 20, 20, "PEER PERFORMANCE GRAPH: PAGES/MINUTE and USED MEMORY", "");
+ final ChartPlotter ip = new ChartPlotter(660, 240, bg, fg, fg, 30, 30, 20, 20, "PEER PERFORMANCE GRAPH: PAGES/MINUTE and USED MEMORY", "");
ip.declareDimension(DIMENSION_BOTTOM, 60, 60, -600, fg, scale, "TIME/SECONDS");
//ip.declareDimension(DIMENSION_TOP, 10, 40, "000000", null, "count");
ip.declareDimension(DIMENSION_LEFT, 50, 40, 0, green, scale , "PPM [PAGES/MINUTE]");
diff --git a/source/de/anomic/ymage/ymageToolCircle.java b/source/net/yacy/visualization/CircleTool.java
similarity index 94%
rename from source/de/anomic/ymage/ymageToolCircle.java
rename to source/net/yacy/visualization/CircleTool.java
index ab7bc8b8c..84d881ce9 100644
--- a/source/de/anomic/ymage/ymageToolCircle.java
+++ b/source/net/yacy/visualization/CircleTool.java
@@ -24,12 +24,13 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.ymage;
+package net.yacy.visualization;
import java.util.ArrayList;
import java.util.HashSet;
-public class ymageToolCircle {
+
+public class CircleTool {
private static int[][] circles = new int[0][];
@@ -96,7 +97,7 @@ public class ymageToolCircle {
return circles[radius - 1];
}
- public static void circle(final ymageMatrix matrix, final int xc, final int yc, final int radius) {
+ public static void circle(final RasterPlotter matrix, final int xc, final int yc, final int radius) {
if (radius == 0) {
matrix.plot(xc, yc);
} else {
@@ -113,7 +114,7 @@ public class ymageToolCircle {
}
}
- public static void circle(final ymageMatrix matrix, final int xc, final int yc, final int radius, final int fromArc, final int toArc) {
+ public static void circle(final RasterPlotter matrix, final int xc, final int yc, final int radius, final int fromArc, final int toArc) {
// draws only a part of a circle
// arc is given in degree
if (radius == 0) {
diff --git a/source/de/anomic/ymage/ymageDemoApplet.java b/source/net/yacy/visualization/DemoApplet.java
similarity index 78%
rename from source/de/anomic/ymage/ymageDemoApplet.java
rename to source/net/yacy/visualization/DemoApplet.java
index 97282cd6b..9a81672ab 100644
--- a/source/de/anomic/ymage/ymageDemoApplet.java
+++ b/source/net/yacy/visualization/DemoApplet.java
@@ -1,11 +1,12 @@
-package de.anomic.ymage;
+package net.yacy.visualization;
import java.applet.Applet;
import java.awt.Dimension;
import java.awt.Graphics;
-public class ymageDemoApplet extends Applet implements Runnable {
+
+public class DemoApplet extends Applet implements Runnable {
// can be run in eclipse with
// Run -> Run As -> Java Applet
@@ -16,7 +17,7 @@ public class ymageDemoApplet extends Applet implements Runnable {
int delay;
Thread animator;
Dimension offDimension;
- ymageMatrix offGraphics;
+ RasterPlotter offGraphics;
public void init() {
final String str = getParameter("fps");
@@ -47,7 +48,7 @@ public class ymageDemoApplet extends Applet implements Runnable {
public void update(final Graphics g) {
final Dimension d = getSize();
- offGraphics = new ymageMatrix(d.width, d.height, ymageMatrix.MODE_REPLACE, "FFFFFF");
+ offGraphics = new RasterPlotter(d.width, d.height, RasterPlotter.MODE_REPLACE, "FFFFFF");
paintFrame(offGraphics);
g.drawImage(offGraphics.getImage(), 0, 0, null);
}
@@ -58,11 +59,11 @@ public class ymageDemoApplet extends Applet implements Runnable {
}
}
- public void paintFrame(final ymageMatrix m) {
- ymageMatrix.demoPaint(m);
+ public void paintFrame(final RasterPlotter m) {
+ RasterPlotter.demoPaint(m);
final int y = (int) (System.currentTimeMillis() / 10 % 300);
- m.setColor(ymageMatrix.GREY);
- ymageToolPrint.print(m, 0, y, 0, "Hello World", -1);
+ m.setColor(RasterPlotter.GREY);
+ PrintTool.print(m, 0, y, 0, "Hello World", -1);
}
}
diff --git a/source/de/anomic/ymage/ymageFontGenerator.java b/source/net/yacy/visualization/FontGenerator5Pixel.java
similarity index 99%
rename from source/de/anomic/ymage/ymageFontGenerator.java
rename to source/net/yacy/visualization/FontGenerator5Pixel.java
index 37811c859..982907dad 100644
--- a/source/de/anomic/ymage/ymageFontGenerator.java
+++ b/source/net/yacy/visualization/FontGenerator5Pixel.java
@@ -1,4 +1,4 @@
-// ymageFontGenerator.java
+// FontGenerator5Pixel.java
// ---------------------------
// (C) by Michael Peter Christen; [email protected]
// first published on http://www.anomic.de
@@ -19,9 +19,9 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.ymage;
+package net.yacy.visualization;
-public class ymageFontGenerator {
+public class FontGenerator5Pixel {
/*
?0x20: !"#$%&'
diff --git a/source/de/anomic/ymage/ymage8BitFontGenerator.java b/source/net/yacy/visualization/FontGenerator8Pixel.java
similarity index 99%
rename from source/de/anomic/ymage/ymage8BitFontGenerator.java
rename to source/net/yacy/visualization/FontGenerator8Pixel.java
index d5d9fab30..89391465d 100644
--- a/source/de/anomic/ymage/ymage8BitFontGenerator.java
+++ b/source/net/yacy/visualization/FontGenerator8Pixel.java
@@ -25,9 +25,9 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.ymage;
+package net.yacy.visualization;
-public class ymage8BitFontGenerator {
+public class FontGenerator8Pixel {
//A valid ymage font has 96 characters:
diff --git a/source/de/anomic/ymage/ymageGraph.java b/source/net/yacy/visualization/GraphPlotter.java
similarity index 94%
rename from source/de/anomic/ymage/ymageGraph.java
rename to source/net/yacy/visualization/GraphPlotter.java
index e9bd57836..e06f7918e 100644
--- a/source/de/anomic/ymage/ymageGraph.java
+++ b/source/net/yacy/visualization/GraphPlotter.java
@@ -24,13 +24,14 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.ymage;
+package net.yacy.visualization;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
+
/* this class is a container for graph coordinates and it can draw such coordinates into a graph
* all coordinates are given in a artificial coordinate system, in the range from
* -1 to +1. The lower left point of the graph has the coordinate -1, -1 and the upper
@@ -38,7 +39,7 @@ import java.util.Map;
* 0,0 is the center of the graph
*/
-public class ymageGraph {
+public class GraphPlotter {
// a ymageGraph is a set of points and borders between the points
// to reference the points, they must all have a nickname
@@ -54,7 +55,7 @@ public class ymageGraph {
HashSet<String> borders;
double leftmost, rightmost, topmost, bottommost;
- public ymageGraph() {
+ public GraphPlotter() {
points = new HashMap<String, coordinate>();
borders = new HashSet<String>();
leftmost = 1.0;
@@ -131,8 +132,8 @@ public class ymageGraph {
}
}
- public ymageMatrix draw(final int width, final int height, final int leftborder, final int rightborder, final int topborder, final int bottomborder) {
- final ymageMatrix image = new ymageMatrix(width, height, ymageMatrix.MODE_SUB, color_back);
+ public RasterPlotter draw(final int width, final int height, final int leftborder, final int rightborder, final int topborder, final int bottomborder) {
+ final RasterPlotter image = new RasterPlotter(width, height, RasterPlotter.MODE_SUB, color_back);
final double xfactor = ((rightmost - leftmost) == 0.0) ? 0.0 : (width - leftborder - rightborder) / (rightmost - leftmost);
final double yfactor = ((topmost - bottommost) == 0.0) ? 0.0 : (height - topborder - bottomborder) / (topmost - bottommost);
@@ -151,7 +152,7 @@ public class ymageGraph {
image.setColor(color_dot);
image.dot(x, y, 6, true);
image.setColor(color_text);
- ymageToolPrint.print(image, x, y + 10, 0, name.toUpperCase(), 0);
+ PrintTool.print(image, x, y + 10, 0, name.toUpperCase(), 0);
}
// draw lines
diff --git a/source/de/anomic/ymage/ymageToolPrint.java b/source/net/yacy/visualization/PrintTool.java
similarity index 93%
rename from source/de/anomic/ymage/ymageToolPrint.java
rename to source/net/yacy/visualization/PrintTool.java
index f7614e205..08cecd2eb 100644
--- a/source/de/anomic/ymage/ymageToolPrint.java
+++ b/source/net/yacy/visualization/PrintTool.java
@@ -24,9 +24,10 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.ymage;
+package net.yacy.visualization;
-public class ymageToolPrint {
+
+public class PrintTool {
private static long[] font = new long[]{
@@ -44,7 +45,7 @@ public class ymageToolPrint {
0x0000000EC2E0ECL,0x0000000EC2E030L,0x0000000FF2E3FCL,0x000F0B8B80B80FL,0x00300C0300C030L,0x03C0B80B8B83C0L,0x0000B83BB0B800L,0x03FFC0F03C0FFFL
};
- private static void print(final ymageMatrix matrix, int x, int y, final int angle, final char letter) {
+ private static void print(final RasterPlotter matrix, int x, int y, final int angle, final char letter) {
final int index = letter - 0x20;
if (index >= font.length) return;
long character = font[index];
@@ -84,7 +85,7 @@ public class ymageToolPrint {
}
}
- public static void print(final ymageMatrix matrix, final int x, final int y, final int angle, final String message, final int align) {
+ public static void print(final RasterPlotter matrix, final int x, final int y, final int angle, final String message, final int align) {
// align = -1 : left
// align = 1 : right
// align = 0 : center
@@ -109,7 +110,7 @@ public class ymageToolPrint {
private static final int arcDist = 8;
- public static void arcPrint(final ymageMatrix matrix, final int cx, final int cy, final int radius, final int angle, final String message) {
+ public static void arcPrint(final RasterPlotter matrix, final int cx, final int cy, final int radius, final int angle, final String message) {
final int x = cx + (int) ((radius + 1) * Math.cos(Math.PI * angle / 180));
final int y = cy - (int) ((radius + 1) * Math.sin(Math.PI * angle / 180));
int yp = y + 3;
diff --git a/source/de/anomic/ymage/ymageMatrix.java b/source/net/yacy/visualization/RasterPlotter.java
similarity index 96%
rename from source/de/anomic/ymage/ymageMatrix.java
rename to source/net/yacy/visualization/RasterPlotter.java
index 6d78f44b3..7b87741f7 100644
--- a/source/de/anomic/ymage/ymageMatrix.java
+++ b/source/net/yacy/visualization/RasterPlotter.java
@@ -31,7 +31,7 @@
are not available in awt.
*/
-package de.anomic.ymage;
+package net.yacy.visualization;
import java.awt.Color;
import java.awt.Graphics2D;
@@ -48,7 +48,7 @@ import net.yacy.kelondro.util.ByteBuffer;
import net.yacy.kelondro.util.MemoryControl;
-public class ymageMatrix {
+public class RasterPlotter {
// colors regarding RGB Color Model
public static final long RED = 0xFF0000;
@@ -71,11 +71,11 @@ public class ymageMatrix {
private final long backgroundCol;
private final byte defaultMode;
- public ymageMatrix(final int width, final int height, final byte drawMode, final String backgroundColor) {
+ public RasterPlotter(final int width, final int height, final byte drawMode, final String backgroundColor) {
this(width, height, drawMode, Long.parseLong(backgroundColor, 16));
}
- public ymageMatrix(final int width, final int height, final byte drawMode, final long backgroundColor) {
+ public RasterPlotter(final int width, final int height, final byte drawMode, final long backgroundColor) {
if (!(MemoryControl.request(1024 * 1024 + 3 * width * height, false))) throw new RuntimeException("ymage: not enough memory (" + MemoryControl.available() + ") available");
this.width = width;
this.height = height;
@@ -270,14 +270,14 @@ public class ymageMatrix {
public void dot(final int x, final int y, final int radius, final boolean filled) {
if (filled) {
- for (int r = radius; r >= 0; r--) ymageToolCircle.circle(this, x, y, r);
+ for (int r = radius; r >= 0; r--) CircleTool.circle(this, x, y, r);
} else {
- ymageToolCircle.circle(this, x, y, radius);
+ CircleTool.circle(this, x, y, radius);
}
}
public void arc(final int x, final int y, final int innerRadius, final int outerRadius, final int fromArc, final int toArc) {
- for (int r = innerRadius; r <= outerRadius; r++) ymageToolCircle.circle(this, x, y, r, fromArc, toArc);
+ for (int r = innerRadius; r <= outerRadius; r++) CircleTool.circle(this, x, y, r, fromArc, toArc);
}
public void arcLine(final int cx, final int cy, final int innerRadius, final int outerRadius, final int angle) {
@@ -610,18 +610,18 @@ public class ymageMatrix {
}
- public static void demoPaint(final ymageMatrix m) {
+ public static void demoPaint(final RasterPlotter m) {
m.setColor(GREY);
- m.line(0, 70, 100, 70); ymageToolPrint.print(m, 0, 65, 0, "Grey", -1);
+ m.line(0, 70, 100, 70); PrintTool.print(m, 0, 65, 0, "Grey", -1);
m.line(65, 0, 65, 300);
m.setColor(RED);
- m.line(0, 90, 100, 90); ymageToolPrint.print(m, 0, 85, 0, "Red", -1);
+ m.line(0, 90, 100, 90); PrintTool.print(m, 0, 85, 0, "Red", -1);
m.line(70, 0, 70, 300);
m.setColor(GREEN);
- m.line(0, 110, 100, 110); ymageToolPrint.print(m, 0, 105, 0, "Green", -1);
+ m.line(0, 110, 100, 110); PrintTool.print(m, 0, 105, 0, "Green", -1);
m.line(75, 0, 75, 300);
m.setColor(BLUE);
- m.line(0, 130, 100, 130); ymageToolPrint.print(m, 0, 125, 0, "Blue", -1);
+ m.line(0, 130, 100, 130); PrintTool.print(m, 0, 125, 0, "Blue", -1);
m.line(80, 0, 80, 300);
}
/*
@@ -717,7 +717,7 @@ public class ymageMatrix {
// go into headless awt mode
System.setProperty("java.awt.headless", "true");
- final ymageMatrix m = new ymageMatrix(200, 300, MODE_SUB, "FFFFFF");
+ final RasterPlotter m = new RasterPlotter(200, 300, MODE_SUB, "FFFFFF");
demoPaint(m);
final File file = new File("/Users/admin/Desktop/testimage.png");
try {
diff --git a/source/net/yacy/yacy.java b/source/net/yacy/yacy.java
index fe9f69f50..9be77af2f 100644
--- a/source/net/yacy/yacy.java
+++ b/source/net/yacy/yacy.java
@@ -42,6 +42,7 @@ import java.util.Map;
import java.util.Properties;
import java.util.TreeMap;
import java.util.TreeSet;
+import java.util.concurrent.Semaphore;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
@@ -61,6 +62,7 @@ import net.yacy.kelondro.util.FileUtils;
import net.yacy.kelondro.util.Formatter;
import net.yacy.kelondro.util.MemoryControl;
import net.yacy.kelondro.util.ScoreCluster;
+import net.yacy.kelondro.util.OS;
import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
@@ -74,8 +76,6 @@ import de.anomic.search.Segment;
import de.anomic.search.Switchboard;
import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverCore;
-import de.anomic.server.serverSemaphore;
-import de.anomic.server.serverSystem;
import de.anomic.tools.enumerateFiles;
import de.anomic.yacy.yacyClient;
import de.anomic.yacy.yacySeedDB;
@@ -147,7 +147,7 @@ public final class yacy {
* Semaphore needed by {@link yacy#waitForFinishedStartup()} to block
* until startup has finished
*/
- private static serverSemaphore startupFinishedSync = new serverSemaphore(0);
+ private static Semaphore startupFinishedSync = new Semaphore(0);
/**
* Starts up the whole application. Sets up all datastructures and starts
@@ -200,7 +200,7 @@ public final class yacy {
Log.logConfig("STARTUP", "Operation system: " + System.getProperty("os.name","unknown"));
Log.logConfig("STARTUP", "Application root-path: " + homePath);
Log.logConfig("STARTUP", "Time zone: UTC" + DateFormatter.UTCDiffString() + "; UTC+0000 is " + System.currentTimeMillis());
- Log.logConfig("STARTUP", "Maximum file system path length: " + serverSystem.maxPathLength);
+ Log.logConfig("STARTUP", "Maximum file system path length: " + OS.maxPathLength);
f = new File(homePath, "DATA/yacy.running");
if (f.exists()) { // another instance running? VM crash? User will have to care about this
@@ -229,7 +229,6 @@ public final class yacy {
// hardcoded, forced, temporary value-migration
sb.setConfig("htTemplatePath", "htroot/env/templates");
- sb.setConfig("parseableExt", "html,htm,txt,php,shtml,asp");
int oldRev;
try {
@@ -327,7 +326,7 @@ public final class yacy {
//boolean properPW = (sb.getConfig("adminAccount", "").length() == 0) && (sb.getConfig(httpd.ADMIN_ACCOUNT_B64MD5, "").length() > 0);
//if (!properPW) browserPopUpPage = "ConfigBasic.html";
final String browserPopUpApplication = sb.getConfig(SwitchboardConstants.BROWSER_POP_UP_APPLICATION, "firefox");
- serverSystem.openBrowser((server.withSSL()?"https":"http") + "://localhost:" + serverCore.getPortNr(port) + "/" + browserPopUpPage, browserPopUpApplication);
+ OS.openBrowser((server.withSSL()?"https":"http") + "://localhost:" + serverCore.getPortNr(port) + "/" + browserPopUpPage, browserPopUpApplication);
}
// unlock yacyTray browser popup
@@ -393,7 +392,7 @@ public final class yacy {
//} catch (ConcurrentModificationException e) {}
// signal finished startup
- startupFinishedSync.V();
+ startupFinishedSync.release();
// wait for server shutdown
try {
@@ -435,7 +434,7 @@ public final class yacy {
} catch (final Exception ee) {
Log.logSevere("STARTUP", "FATAL ERROR: " + ee.getMessage(),ee);
} finally {
- startupFinishedSync.V();
+ startupFinishedSync.release();
}
Log.logConfig("SHUTDOWN", "goodbye. (this is the last line)");
Log.shutdown();
diff --git a/test/de/anomic/document/ParserTest.java b/test/de/anomic/document/ParserTest.java
index c61554ee4..11d893abb 100644
--- a/test/de/anomic/document/ParserTest.java
+++ b/test/de/anomic/document/ParserTest.java
@@ -3,7 +3,7 @@ package de.anomic.document;
import static org.junit.Assert.*;
import static org.junit.matchers.JUnitMatchers.*;
import net.yacy.document.Document;
-import net.yacy.document.Parser;
+import net.yacy.document.TextParser;
import net.yacy.kelondro.data.meta.DigestURI;
import org.junit.Test;
@@ -37,7 +37,7 @@ public class ParserTest {
String mimetype = testFiles[i][1];
DigestURI url = new DigestURI("http://localhost/"+filename);
- Document doc = Parser.parseSource(url, mimetype, null, file.length(), new FileInputStream(file));
+ Document doc = TextParser.parseSource(url, mimetype, null, file.length(), new FileInputStream(file));
Reader content = new InputStreamReader(doc.getText(), doc.getCharset());
StringBuilder str = new StringBuilder();
int c;
diff --git a/test/parsertest/image_green_sd.png b/test/parsertest/image_green_sd.png
new file mode 100644
index 000000000..0956b9dd5
Binary files /dev/null and b/test/parsertest/image_green_sd.png differ