Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
added a serlvet that shows all scanned servers inside of the yacyinteractive search page
orbiter606c5a9b40e0
diff --git a/htroot/ServerScannerList.html b/htroot/ServerScannerList.htmlnew file mode 100644index 000000000..2fe2efc6c--- /dev/null+++ b/htroot/ServerScannerList.html@@ -0,0 +1,62 @@+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >+ <head>+ <title>YaCy '#[clientname]#': Network Scanner Monitor</title>+ #%env/templates/metas.template%#+ </head>+ <body id="IndexCreate">+#(embedded)#+#%env/templates/header.template%#+<h2>Network Scanner Monitor</h2>+::+#%env/templates/embeddedheader.template%#+#(/embedded)#++ #(servertable)#::+ <p>+ The following servers can be searched:+ </p>+ <form id="servertable" action="CrawlStartScanner_p.html" method="post" enctype="multipart/form-data" accept-charset="UTF-8" ><fieldset>+ <legend><label for="servertable">Available server within the given IP range</label></legend>+ <table class="sortable" border="0" cellpadding="2" cellspacing="1">+ <tr class="TableHeader" valign="bottom">+ #(edit)#::+ <th class="sorttable_nosort">+ <input type="checkbox" name="allswitch" onclick="checkAll(this.form.id, this.checked);" />+ </th>+ #(/edit)#+ <th>Protocol</th>+ <th>IP</th>+ <th>URL</th>+ <th>Access</th>+ <th>Process</th>+ </tr>+ #{list}#+ <tr class="TableCellLight">+ #(edit)#::+ <td align="left"><input type="checkbox" name="item_#[count]#" value="mark_#[pk]#" #(preselected)#::checked="checked"#(/preselected)# /></td>+ #(/edit)#+ <td>#[protocol]#</td>+ <td><a href="#[url]#">#[ip]#</a></td>+ <td><a href="#[url]#">#[url]#</a></td>+ #(accessUnknown)#::<td class="info">unknown</td>#(/accessUnknown)#+ #(accessEmpty)#::<td class="info">empty</td>#(/accessEmpty)#+ #(accessGranted)#::<td class="commit">granted</td>#(/accessGranted)#+ #(accessDenied)#::<td class="error">denied</td>#(/accessDenied)#+ #(process)#<td class="info">not in index</td>::<td class="commit">indexed</td>#(/process)#+ </tr>+ #{/list}#+ </table>+ #(edit)#::+ <p>+ <input type="hidden" name="num" value="#[num]#" />+ <input type="submit" name="crawl" value="Add Selected Servers to Crawler" />+ </p>+ #(/edit)#+ </fieldset></form>+ #(/servertable)#+++ #%env/templates/footer.template%#+ </body>+</html>diff --git a/htroot/ServerScannerList.java b/htroot/ServerScannerList.javanew file mode 100644index 000000000..274bae9e9--- /dev/null+++ b/htroot/ServerScannerList.java@@ -0,0 +1,96 @@+/**+ * CrawlStartScanner_p+ * Copyright 2010 by Michael Peter Christen, [email protected], Frankfurt am Main, Germany+ * First released 12.08.2011 at http://yacy.net+ *+ * This library is free software; you can redistribute it and/or+ * modify it under the terms of the GNU Lesser General Public+ * License as published by the Free Software Foundation; either+ * version 2.1 of the License, or (at your option) any later version.+ *+ * This library 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+ * Lesser General Public License for more details.+ *+ * You should have received a copy of the GNU Lesser General Public License+ * along with this program in the file lgpl21.txt+ * If not, see <http://www.gnu.org/licenses/>.+ */++import java.net.MalformedURLException;+import java.util.ConcurrentModificationException;+import java.util.Iterator;+import java.util.Map;++import net.yacy.cora.document.ASCII;+import net.yacy.cora.protocol.RequestHeader;+import net.yacy.cora.protocol.Scanner;+import net.yacy.cora.protocol.Scanner.Access;+import net.yacy.kelondro.data.meta.DigestURI;+import net.yacy.kelondro.logging.Log;++import de.anomic.data.WorkTables;+import de.anomic.search.Switchboard;+import de.anomic.server.serverObjects;+import de.anomic.server.serverSwitch;++public class ServerScannerList {++ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {++ final serverObjects prop = new serverObjects();+ final Switchboard sb = (Switchboard)env;++ prop.put("servertable_edit", post == null ? 0 : post.containsKey("edit") ? 1 : 0);+ prop.put("servertable_list_edit", post == null ? 0 : post.containsKey("edit") ? 1 : 0);+ prop.put("embedded", post == null ? 0 : post.containsKey("embedded") ? 1 : 0);+ prop.put("servertable", 0);++ // write scan table+ if (Scanner.scancacheSize() > 0) {+ // make a comment cache+ final Map<byte[], String> apiCommentCache = WorkTables.commentCache(sb);++ // show scancache table+ prop.put("servertable", 1);+ String urlString;+ DigestURI u;+ table: while (true) {+ try {+ int i = 0;+ final Iterator<Map.Entry<Scanner.Service, Scanner.Access>> se = Scanner.scancacheEntries();+ Map.Entry<Scanner.Service, Scanner.Access> host;+ while (se.hasNext()) {+ host = se.next();+ try {+ u = new DigestURI(host.getKey().url());+ urlString = u.toNormalform(true, false);+ prop.put("servertable_list_" + i + "_edit_pk", ASCII.String(u.hash()));+ prop.put("servertable_list_" + i + "_edit_count", i);+ prop.putHTML("servertable_list_" + i + "_protocol", u.getProtocol());+ prop.putHTML("servertable_list_" + i + "_ip", host.getKey().getInetAddress().getHostAddress());+ prop.putHTML("servertable_list_" + i + "_url", urlString);+ prop.put("servertable_list_" + i + "_accessUnknown", host.getValue() == Access.unknown ? 1 : 0);+ prop.put("servertable_list_" + i + "_accessEmpty", host.getValue() == Access.empty ? 1 : 0);+ prop.put("servertable_list_" + i + "_accessGranted", host.getValue() == Access.granted ? 1 : 0);+ prop.put("servertable_list_" + i + "_accessDenied", host.getValue() == Access.denied ? 1 : 0);+ prop.put("servertable_list_" + i + "_process", Scanner.inIndex(apiCommentCache, urlString) == null ? 0 : 1);+ prop.put("servertable_list_" + i + "_edit_preselected", host.getValue() == Access.granted && Scanner.inIndex(apiCommentCache, urlString) == null ? 1 : 0);+ i++;+ } catch (MalformedURLException e) {+ Log.logException(e);+ }+ }+ prop.put("servertable_list", i);+ prop.put("servertable_edit_num", i);+ break table;+ } catch (ConcurrentModificationException e) {+ continue table;+ }+ }+ }+ return prop;+ }++}diff --git a/htroot/yacyinteractive.html b/htroot/yacyinteractive.htmlindex 462cc4909..fb00ebcc6 100644--- a/htroot/yacyinteractive.html+++ b/htroot/yacyinteractive.html@@ -72,6 +72,14 @@ To see a list of all APIs, please visit the <a href="http://www.yacy-websuche.de</div><div id="downloadscript" style="clear:both;"></div><div id="searchresults" style="clear:both;">+ <iframe name="target"+ src="/ServerScannerList.html?embedded="+ width="100%"+ height="410"+ frameborder="0"+ scrolling="auto"+ id="target">+ </iframe><!-- <div><img src="PerformanceGraph.png" id="graph" alt="PerformanceGraph" width="660" height="240"/></div> --></div><script type="text/javascript">