From 9623bf7bbe4e2d434113c64e43e2e90d3125bf0b Mon Sep 17 00:00:00 2001
From: karlchenofhell
Date: Thu, 1 Mar 2007 13:54:14 +0000
Subject: [PATCH] - removed call of java 1.5 method - added config servlet for
local robots.txt - removed YPStats_p as it is of no use anymore -
supertemplates use XHTML now - quick-fix for
http://www.yacy-forum.de/viewtopic.php?p=32296#32296
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3422 6c8d7289-2bf4-0310-a012-ef5d649a1542
---
htroot/BlacklistCleaner_p.html | 8 +-
htroot/BlacklistCleaner_p.java | 8 +-
htroot/ConfigRobotsTxt_p.html | 48 ++++
htroot/ConfigRobotsTxt_p.java | 204 +++++++++++++
htroot/YPStats_p.html | 301 --------------------
htroot/YPStats_p.java | 248 ----------------
htroot/env/page.html | 33 +--
htroot/env/templates/submenuConfig.template | 1 +
source/de/anomic/data/bookmarksDB.java | 12 +-
9 files changed, 283 insertions(+), 580 deletions(-)
create mode 100644 htroot/ConfigRobotsTxt_p.html
create mode 100644 htroot/ConfigRobotsTxt_p.java
delete mode 100644 htroot/YPStats_p.html
delete mode 100644 htroot/YPStats_p.java
diff --git a/htroot/BlacklistCleaner_p.html b/htroot/BlacklistCleaner_p.html
index a7fb96f1d..8befc1272 100644
--- a/htroot/BlacklistCleaner_p.html
+++ b/htroot/BlacklistCleaner_p.html
@@ -14,16 +14,14 @@
-
-
-#%env/templates/footer.template%#
-
\ No newline at end of file
diff --git a/htroot/YPStats_p.java b/htroot/YPStats_p.java
deleted file mode 100644
index 8a0892dec..000000000
--- a/htroot/YPStats_p.java
+++ /dev/null
@@ -1,248 +0,0 @@
-//YPStats_p.java
-//-----------------------
-//Author: Franz Brausse
-//part of YaCy (C) by Michael Peter Christen; mc@anomic.de
-//first published on http://www.anomic.de
-//Frankfurt, Germany, 2004, 2005
-//last major change: 27.06.2006
-//
-//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
-//
-//Using this software in any meaning (reading, learning, copying, compiling,
-//running) means that you agree that the Author(s) is (are) not responsible
-//for cost, loss of data or any harm that may be caused directly or indirectly
-//by usage of this softare or this documentation. The usage of this software
-//is on your own risk. The installation and usage (starting/running) of this
-//software may allow other people or application to access your computer and
-//any attached devices and is highly dependent on the configuration of the
-//software which must be done by the user of the software; the author(s) is
-//(are) also not responsible for proper configuration and usage of the
-//software, even if provoked by documentation provided together with
-//the software.
-//
-//Any changes to this file according to the GPL as documented in the file
-//gpl.txt aside this file in the shipment you received can be done to the
-//lines that follows this copyright notice here, but changes must not be
-//done inside the copyright notive above. A re-distribution must contain
-//the intact and unchanged copyright notice.
-//Contributions and changes to the program code must be marked as such.
-
-//You must compile this file with
-//javac -classpath .:../classes YPStats_p.java
-//if the shell's current path is HTROOT
-
-import java.util.Iterator;
-
-import org.apache.commons.pool.impl.GenericKeyedObjectPool;
-import org.apache.commons.pool.impl.GenericObjectPool;
-
-import de.anomic.http.httpHeader;
-import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.server.serverCore;
-import de.anomic.server.serverObjects;
-import de.anomic.server.serverSwitch;
-import de.anomic.server.serverThread;
-import de.anomic.yacy.yacyCore;
-import de.anomic.yacy.yacySeed;
-
-public class YPStats_p {
-
- private static final int KB = 1024;
-
- //private static long[] slt,chk;
- //private static String[] ost;
- private static long req /*, usd, bst, god*/;
-
- //private static long usedTotal, currTotal, dfltTotal, goodTotal, bestTotal;
-
- public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch sb) {
- // return variable that accumulates replacements
- plasmaSwitchboard switchboard = (plasmaSwitchboard) sb;
- serverObjects prop = new serverObjects();
- //File defaultSettingsFile = new File(switchboard.getRootPath(), "yacy.init");
- //Map defaultSettings = ((post == null) || (!(post.containsKey("submitdefault")))) ? null : serverFileUtils.loadHashMap(defaultSettingsFile);
-
- String url=null;
- if(post!=null && post.containsKey("url")) {
- url=(String)post.get("url");
- } else {
- url="http://ypstats.yacy-forum.de/index.php";
- }
- prop.put("url", url);
-
- Iterator threads = switchboard.threadNames();
- String threadName;
- serverThread thread;
-
- // calculate totals
- long blocktime_total = 0, sleeptime_total = 0, exectime_total = 0;
- while (threads.hasNext()) {
- threadName = (String) threads.next();
- thread = switchboard.getThread(threadName);
- blocktime_total += thread.getBlockTime();
- sleeptime_total += thread.getSleepTime();
- exectime_total += thread.getExecTime();
- }
- if (blocktime_total == 0) blocktime_total = 1;
- if (sleeptime_total == 0) sleeptime_total = 1;
- if (exectime_total == 0) exectime_total = 1;
-
- // set templates for latest news from the threads
- long blocktime, sleeptime, exectime;
- long idlesleep, busysleep, memuse, memprereq;
- int queuesize;
- threads = switchboard.threadNames();
- int c = 0;
- long idleCycles, busyCycles, memshortageCycles;
- while (threads.hasNext()) {
- threadName = (String) threads.next();
- thread = switchboard.getThread(threadName);
-
- // set values to templates
- prop.put("table_" + c + "_threadname", threadName);
- prop.put("table_" + c + "_shortdescr", (thread.getMonitorURL() == null) ? thread.getShortDescription() : "" + thread.getShortDescription() + "");
- prop.put("table_" + c + "_longdescr", thread.getLongDescription());
- queuesize = thread.getJobCount();
- prop.put("table_" + c + "_queuesize", (queuesize == Integer.MAX_VALUE) ? "unlimited" : Integer.toString(queuesize));
-
- blocktime = thread.getBlockTime();
- sleeptime = thread.getSleepTime();
- exectime = thread.getExecTime();
- memuse = thread.getMemoryUse();
- idleCycles = thread.getIdleCycles();
- busyCycles = thread.getBusyCycles();
- memshortageCycles = thread.getOutOfMemoryCycles();
- prop.put("table_" + c + "_blocktime", blocktime / 1000);
- prop.put("table_" + c + "_blockpercent", Long.toString(100 * blocktime / blocktime_total));
- prop.put("table_" + c + "_sleeptime", sleeptime / 1000);
- prop.put("table_" + c + "_sleeppercent", Long.toString(100 * sleeptime / sleeptime_total));
- prop.put("table_" + c + "_exectime", exectime / 1000);
- prop.put("table_" + c + "_execpercent", Long.toString(100 * exectime / exectime_total));
- prop.put("table_" + c + "_totalcycles", Long.toString(idleCycles + busyCycles + memshortageCycles));
- prop.put("table_" + c + "_idlecycles", Long.toString(idleCycles));
- prop.put("table_" + c + "_busycycles", Long.toString(busyCycles));
- prop.put("table_" + c + "_memscycles", Long.toString(memshortageCycles));
- prop.put("table_" + c + "_sle ", ((idleCycles + busyCycles) == 0) ? "-" : Long.toString(sleeptime / (idleCycles + busyCycles)));
- prop.put("table_" + c + "_execpercycle", (busyCycles == 0) ? "-" : Long.toString(exectime / busyCycles));
- prop.put("table_" + c + "_memusepercycle", (busyCycles == 0) ? "-" : Long.toString(memuse / busyCycles / 1024));
-
- // load with old values
- idlesleep = Long.parseLong(switchboard.getConfig(threadName + "_idlesleep" , "1000"));
- busysleep = Long.parseLong(switchboard.getConfig(threadName + "_busysleep", "100"));
- memprereq = Long.parseLong(switchboard.getConfig(threadName + "_memprereq", "0"));
-
- prop.put("table_" + c + "_idlesleep", idlesleep);
- prop.put("table_" + c + "_busysleep", busysleep);
- prop.put("table_" + c + "_memprereq", memprereq / 1024);
-
- c++;
- }
- prop.put("table", c);
-
- // table cache settings
- prop.put("wordCacheMaxCount", switchboard.getConfig("wordCacheMaxCount", "10000"));
-
- // table thread pool settings
- GenericKeyedObjectPool.Config crawlerPoolConfig = switchboard.cacheLoader.getPoolConfig();
- prop.put("pool_0_name","Crawler Pool");
- prop.put("pool_0_maxActive",crawlerPoolConfig.maxActive);
- prop.put("pool_0_maxIdle",crawlerPoolConfig.maxIdle);
- prop.put("pool_0_minIdle",0 /* crawlerPoolConfig.minIdle */);
-
- serverThread httpd = switchboard.getThread("10_httpd");
- GenericObjectPool.Config httpdPoolConfig = ((serverCore)httpd).getPoolConfig();
- prop.put("pool_1_name","httpd Session Pool");
- prop.put("pool_1_maxActive",httpdPoolConfig.maxActive);
- prop.put("pool_1_maxIdle",httpdPoolConfig.maxIdle);
- prop.put("pool_1_minIdle",httpdPoolConfig.minIdle);
-
- GenericObjectPool.Config stackerPoolConfig = switchboard.sbStackCrawlThread.getPoolConfig();
- prop.put("pool_2_name","CrawlStacker Session Pool");
- prop.put("pool_2_maxActive",stackerPoolConfig.maxActive);
- prop.put("pool_2_maxIdle",stackerPoolConfig.maxIdle);
- prop.put("pool_2_minIdle",stackerPoolConfig.minIdle);
- prop.put("pool",3);
-
- // parse initialization memory settings
- String Xmx = sb.getConfig("javastart_Xmx", "Xmx64m").substring(3);
- prop.put("Xmx", Xmx.substring(0, Xmx.length() - 1));
- String Xms = sb.getConfig("javastart_Xms", "Xms10m").substring(3);
- prop.put("Xms", Xms.substring(0, Xms.length() - 1));
-
- plasmaSwitchboard sb1 = (plasmaSwitchboard) sb;
- req = sb1.wordIndex.size();
- putprop(prop, sb, "RWI");
-
- req = sb1.cacheManager.dbSize();
- putprop(prop, sb, "HTTP");
-
- //req = sb1.urlPool.loadedURL.urlHashCache.size();
- putprop(prop, sb, "LURL");
-
- //req = sb1.urlPool.noticeURL.urlHashCache.size();
- putprop(prop, sb, "NURL");
-
- //req = sb1.urlPool.errorURL.urlHashCache.size();
- putprop(prop, sb, "EURL");
-
- req = yacyCore.seedDB.sizeConnected() + yacyCore.seedDB.sizeDisconnected() + yacyCore.seedDB.sizePotential();
- putprop(prop, sb, "DHT");
-
- req = sb1.messageDB.size();
- putprop(prop, sb, "Message");
-
- req = sb1.wikiDB.sizeOfTwo();
- putprop(prop, sb, "Wiki");
-
- req = sb1.blogDB.size();
- putprop(prop, sb, "Blog");
-
- req = yacyCore.newsPool.dbSize();
- putprop(prop, sb, "News");
-
- req = plasmaSwitchboard.robots.size();
- putprop(prop, sb, "Robots");
-
- req = sb1.profiles.size();
- putprop(prop, sb, "Profiles");
-
- prop.put("versionpp", yacy.combined2prettyVersion(sb.getConfig("version","0.1")));
-
- prop.put("links", yacyCore.seedDB.mySeed.get(yacySeed.LCOUNT, "unknown"));
- prop.put("words", yacyCore.seedDB.mySeed.get(yacySeed.ICOUNT, "unknown"));
- /*prop.put("address", yacyCore.seedDB.mySeed.getAddress());
- prop.put("ip", serverCore.publicLocalIP());*/
- prop.put("hash", yacyCore.seedDB.mySeed.hash);
-
- String jversion = System.getProperties().getProperty("java.vendor");
- jversion += " " + System.getProperties().getProperty("java.version");
- prop.put("jversion", jversion);
- prop.put("processors",Runtime.getRuntime().availableProcessors());
-
- // return rewrite values for templates
- return prop;
- }
-
- private static void putprop(serverObjects prop, serverSwitch sb, String db) {
- prop.put("slreq" + db, req);
- prop.put("ramCache" + db, Long.parseLong(sb.getConfig("ramCache" + db, "0")) / KB);
- }
-
- /*
- private static String d(String a, String b) {
- return (a == null) ? b : a;
- }
- */
-}
\ No newline at end of file
diff --git a/htroot/env/page.html b/htroot/env/page.html
index 364ea18f6..7ea35076f 100644
--- a/htroot/env/page.html
+++ b/htroot/env/page.html
@@ -1,19 +1,16 @@
-
-
-
-#[header]#
-
-
-
-#%env/templates/metas.template%#
-
-
-#%env/templates/header.template%#
-
-
-#[page]#
-
-#%env/templates/footer.template%#
-
+
+
+
+ #[header]#
+
+
+
+ #%env/templates/metas.template%#
+
+
+ #%env/templates/header.template%#
+ #[page]#
+ #%env/templates/footer.template%#
+
diff --git a/htroot/env/templates/submenuConfig.template b/htroot/env/templates/submenuConfig.template
index 4224c6182..02144e747 100644
--- a/htroot/env/templates/submenuConfig.template
+++ b/htroot/env/templates/submenuConfig.template
@@ -5,6 +5,7 @@
+
\ No newline at end of file
diff --git a/source/de/anomic/data/bookmarksDB.java b/source/de/anomic/data/bookmarksDB.java
index fbf2776c1..83aa00f54 100644
--- a/source/de/anomic/data/bookmarksDB.java
+++ b/source/de/anomic/data/bookmarksDB.java
@@ -321,12 +321,14 @@ public class bookmarksDB {
}
public Bookmark getBookmark(String urlHash){
try {
- return (Bookmark) bookmarksTable.get(urlHash);
+ kelondroObjectsMapEntry map = (kelondroObjectsMapEntry)bookmarksTable.get(urlHash);
+ if (map instanceof Bookmark) return (Bookmark)map;
+ return new Bookmark(map);
} catch (IOException e) {
return null;
}
-
}
+
public Iterator getBookmarksIterator(boolean priv){
TreeSet set=new TreeSet(new bookmarkComparator(true));
Iterator it=bookmarkIterator(true);
@@ -764,7 +766,11 @@ public class bookmarksDB {
tags=new HashSet();
timestamp=System.currentTimeMillis();
}
-
+
+ public Bookmark(kelondroObjectsMapEntry map) {
+ this(plasmaURL.urlHash((String)map.map().get(BOOKMARK_URL)), map.map());
+ }
+
private Map toMap(){
entry.put(BOOKMARK_TAGS, listManager.hashset2string(tags));
entry.put(BOOKMARK_TIMESTAMP, String.valueOf(this.timestamp));