2005-10-08 02:37:43 +02:00
|
|
|
// NetworkPicture.java
|
|
|
|
// -----------------------
|
|
|
|
// part of YaCy
|
2008-07-20 19:14:51 +02:00
|
|
|
// (C) by Michael Peter Christen; mc@yacy.net
|
2005-10-08 02:37:43 +02:00
|
|
|
// first published on http://www.anomic.de
|
|
|
|
// Frankfurt, Germany, 2005
|
|
|
|
// Created 08.10.2005
|
|
|
|
//
|
2005-10-17 17:46:12 +02:00
|
|
|
// $LastChangedDate$
|
|
|
|
// $LastChangedRevision$
|
|
|
|
// $LastChangedBy$
|
2005-10-08 02:37:43 +02:00
|
|
|
//
|
|
|
|
// 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
|
|
|
|
|
2008-08-25 20:11:47 +02:00
|
|
|
import de.anomic.http.httpRequestHeader;
|
2006-09-30 00:27:20 +02:00
|
|
|
import de.anomic.plasma.plasmaGrafics;
|
2008-05-06 01:13:47 +02:00
|
|
|
import de.anomic.plasma.plasmaSwitchboard;
|
2008-09-24 01:30:25 +02:00
|
|
|
import de.anomic.plasma.plasmaSwitchboardConstants;
|
2005-10-08 02:37:43 +02:00
|
|
|
import de.anomic.server.serverObjects;
|
|
|
|
import de.anomic.server.serverSwitch;
|
2007-01-16 00:31:50 +01:00
|
|
|
import de.anomic.ymage.ymageMatrix;
|
2005-10-08 02:37:43 +02:00
|
|
|
|
2007-04-19 18:16:54 +02:00
|
|
|
/** draw a picture of the yacy network */
|
2005-10-08 02:37:43 +02:00
|
|
|
public class NetworkPicture {
|
|
|
|
|
2008-08-25 20:11:47 +02:00
|
|
|
public static ymageMatrix respond(final httpRequestHeader header, final serverObjects post, final serverSwitch<?> env) {
|
2008-08-02 14:12:04 +02:00
|
|
|
final plasmaSwitchboard sb = (plasmaSwitchboard) env;
|
2008-05-06 01:13:47 +02:00
|
|
|
|
2007-01-29 16:39:05 +01:00
|
|
|
int width = 768;
|
|
|
|
int height = 576;
|
2005-10-18 22:18:49 +02:00
|
|
|
int passiveLimit = 300;
|
|
|
|
int potentialLimit = 300;
|
2005-10-23 19:50:27 +02:00
|
|
|
int maxCount = 1000;
|
2007-06-30 01:06:13 +02:00
|
|
|
String bgcolor = plasmaGrafics.COL_BACKGROUND;
|
2006-04-21 23:21:35 +02:00
|
|
|
boolean corona = true;
|
2005-10-10 12:08:28 +02:00
|
|
|
|
|
|
|
if (post != null) {
|
2007-01-29 16:39:05 +01:00
|
|
|
width = post.getInt("width", 768);
|
|
|
|
height = post.getInt("height", 576);
|
2005-10-18 22:18:49 +02:00
|
|
|
passiveLimit = post.getInt("pal", 300);
|
|
|
|
potentialLimit = post.getInt("pol", 300);
|
2005-10-23 19:50:27 +02:00
|
|
|
maxCount = post.getInt("max", 1000);
|
2006-04-21 23:21:35 +02:00
|
|
|
corona = post.get("corona", "true").equals("true");
|
2007-06-30 01:06:13 +02:00
|
|
|
bgcolor = post.get("bgcolor", bgcolor);
|
2005-10-10 12:08:28 +02:00
|
|
|
}
|
2005-10-08 02:37:43 +02:00
|
|
|
|
2006-02-15 20:18:01 +01:00
|
|
|
//too small values lead to an error, too big to huge CPU/memory consumption, resulting in possible DOS.
|
|
|
|
if (width < 320 ) width = 320;
|
2005-10-30 14:47:42 +01:00
|
|
|
if (width > 1920) width = 1920;
|
2006-02-15 20:18:01 +01:00
|
|
|
if (height < 240) height = 240;
|
2006-04-21 23:21:35 +02:00
|
|
|
if (height > 1920) height = 1920;
|
2006-01-21 01:21:39 +01:00
|
|
|
if (passiveLimit > 1000000) passiveLimit = 1000000;
|
|
|
|
if (potentialLimit > 1000000) potentialLimit = 1000000;
|
2005-10-30 14:47:42 +01:00
|
|
|
if (maxCount > 1000) maxCount = 1000;
|
2009-03-13 11:34:51 +01:00
|
|
|
return plasmaGrafics.getNetworkPicture(sb.webIndex.peers(), 10000, width, height, passiveLimit, potentialLimit, maxCount, corona, env.getConfig(plasmaSwitchboardConstants.NETWORK_NAME, "unspecified"), env.getConfig("network.unit.description", "unspecified"), bgcolor);
|
2005-10-08 02:37:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|