more generics

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4412 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 17 years ago
parent 4a80902081
commit 1a296af6ff

@ -175,12 +175,12 @@ public class CacheAdmin_p {
formatAnchor(prop, document.getAudiolinks(), "audio"); formatAnchor(prop, document.getAudiolinks(), "audio");
formatAnchor(prop, document.getVideolinks(), "video"); formatAnchor(prop, document.getVideolinks(), "video");
formatAnchor(prop, document.getApplinks(), "apps"); formatAnchor(prop, document.getApplinks(), "apps");
formatAnchor(prop, document.getEmaillinks(), "email"); formatEmail(prop, document.getEmaillinks(), "email");
prop.putHTML("info_type_text", new String(scraper.getText())); prop.putHTML("info_type_text", new String(scraper.getText()));
i = 0; i = 0;
final Iterator sentences = document.getSentences(false); final Iterator<StringBuffer> sentences = document.getSentences(false);
if (sentences != null) if (sentences != null)
while (sentences.hasNext()) { while (sentences.hasNext()) {
prop.putHTML("info_type_lines_" + i + "_line", prop.putHTML("info_type_lines_" + i + "_line",
@ -217,8 +217,8 @@ public class CacheAdmin_p {
prop.put("info_empty", "1"); prop.put("info_empty", "1");
} else { } else {
prop.put("info_empty", "0"); prop.put("info_empty", "0");
final TreeSet dList = new TreeSet(); final TreeSet<String> dList = new TreeSet<String>();
final TreeSet fList = new TreeSet(); final TreeSet<String> fList = new TreeSet<String>();
int size = list.length - 1, i = size; int size = list.length - 1, i = size;
for (; i >= 0 ; i--) { // Rueckwaerts ist schneller for (; i >= 0 ; i--) { // Rueckwaerts ist schneller
if (new File(dir, list[i]).isDirectory()) if (new File(dir, list[i]).isDirectory())
@ -227,7 +227,7 @@ public class CacheAdmin_p {
fList.add(list[i]); fList.add(list[i]);
} }
Iterator iter = dList.iterator(); Iterator<String> iter = dList.iterator();
i = 0; i = 0;
prop.put("info_treeFolders", dList.size()); prop.put("info_treeFolders", dList.size());
while (iter.hasNext()) { while (iter.hasNext()) {
@ -257,33 +257,33 @@ public class CacheAdmin_p {
return prop; return prop;
} }
private static void formatHeader(serverObjects prop, Map header) { private static void formatHeader(serverObjects prop, Map<String, String> header) {
if (header == null) { if (header == null) {
prop.put("info_header", "0"); prop.put("info_header", "0");
} else { } else {
prop.put("info_header", "1"); prop.put("info_header", "1");
int i = 0; int i = 0;
final Iterator iter = header.entrySet().iterator(); final Iterator<Map.Entry<String, String>> iter = header.entrySet().iterator();
Map.Entry entry; Map.Entry<String, String> entry;
while (iter.hasNext()) { while (iter.hasNext()) {
entry = (Map.Entry) iter.next(); entry = iter.next();
prop.put("info_header_line_" + i + "_property", (String) entry.getKey()); prop.put("info_header_line_" + i + "_property", entry.getKey());
prop.put("info_header_line_" + i + "_value", (String) entry.getValue()); prop.put("info_header_line_" + i + "_value", entry.getValue());
i++; i++;
} }
prop.put("info_header_line", i); prop.put("info_header_line", i);
} }
} }
private static void formatAnchor(serverObjects prop, Map anchor, String extension) { private static void formatAnchor(serverObjects prop, Map<yacyURL, String> anchor, String extension) {
final Iterator iter = anchor.entrySet().iterator(); final Iterator<Map.Entry<yacyURL, String>> iter = anchor.entrySet().iterator();
String descr; String descr;
Map.Entry entry; Map.Entry<yacyURL, String> entry;
prop.put("info_type_use." + extension + "_" + extension, anchor.size()); prop.put("info_type_use." + extension + "_" + extension, anchor.size());
int i = 0; int i = 0;
while (iter.hasNext()) { while (iter.hasNext()) {
entry = (Map.Entry) iter.next(); entry = iter.next();
descr = ((String) entry.getValue()).trim(); descr = entry.getValue().trim();
if (descr.length() == 0) { descr = "-"; } if (descr.length() == 0) { descr = "-"; }
prop.put("info_type_use." + extension + "_" + extension + "_" + i + "_name", prop.put("info_type_use." + extension + "_" + extension + "_" + i + "_name",
de.anomic.data.htmlTools.encodeUnicode2html(descr.replaceAll("\n", "").trim(), true)); de.anomic.data.htmlTools.encodeUnicode2html(descr.replaceAll("\n", "").trim(), true));
@ -293,14 +293,33 @@ public class CacheAdmin_p {
} }
prop.put("info_type_use." + extension, (i == 0) ? 0 : 1); prop.put("info_type_use." + extension, (i == 0) ? 0 : 1);
} }
private static void formatEmail(serverObjects prop, Map<String, String> anchor, String extension) {
final Iterator<Map.Entry<String, String>> iter = anchor.entrySet().iterator();
String descr;
Map.Entry<String, String> entry;
prop.put("info_type_use." + extension + "_" + extension, anchor.size());
int i = 0;
while (iter.hasNext()) {
entry = iter.next();
descr = entry.getValue().trim();
if (descr.length() == 0) { descr = "-"; }
prop.put("info_type_use." + extension + "_" + extension + "_" + i + "_name",
de.anomic.data.htmlTools.encodeUnicode2html(descr.replaceAll("\n", "").trim(), true));
prop.put("info_type_use." + extension + "_" + extension + "_" + i + "_link",
de.anomic.data.htmlTools.encodeUnicode2html(entry.getKey().toString(), true));
i++;
}
prop.put("info_type_use." + extension, (i == 0) ? 0 : 1);
}
private static void formatImageAnchor(serverObjects prop, TreeSet anchor) { private static void formatImageAnchor(serverObjects prop, TreeSet<htmlFilterImageEntry> anchor) {
final Iterator iter = anchor.iterator(); final Iterator<htmlFilterImageEntry> iter = anchor.iterator();
htmlFilterImageEntry ie; htmlFilterImageEntry ie;
prop.put("info_type_use.images_images", anchor.size()); prop.put("info_type_use.images_images", anchor.size());
int i = 0; int i = 0;
while (iter.hasNext()) { while (iter.hasNext()) {
ie = (htmlFilterImageEntry) iter.next(); ie = iter.next();
prop.putHTML("info_type_use.images_images_" + i + "_name", ie.alt().replaceAll("\n", "").trim()); prop.putHTML("info_type_use.images_images_" + i + "_name", ie.alt().replaceAll("\n", "").trim());
prop.putHTML("info_type_use.images_images_" + i + "_link", prop.putHTML("info_type_use.images_images_" + i + "_link",
de.anomic.data.htmlTools.encodeUnicode2html(ie.url().toNormalform(false, true), false)); de.anomic.data.htmlTools.encodeUnicode2html(ie.url().toNormalform(false, true), false));

@ -1,151 +0,0 @@
// ScreenSaver.java
// -----------------------
// part of YaCy
// (C) by Michael Peter Christen; mc@anomic.de
// first published on http://www.anomic.de
// Frankfurt, Germany, 2006
//
// This File is contributed by Martin Thelian
// $LastChangedDate$
// $LastChangedRevision$
// $LastChangedBy$
//
// 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.
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import de.anomic.http.httpHeader;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.plasma.plasmaSwitchboardQueue;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyCore;
import de.anomic.yacy.yacySeed;
public class ScreenSaver {
/**
* Generates a proxy-autoconfig-file (application/x-ns-proxy-autoconfig)
* See: <a href="http://wp.netscape.com/eng/mozilla/2.0/relnotes/demo/proxy-live.html">Proxy Auto-Config File Format</a>
* @param header the complete HTTP header of the request
* @param post any arguments for this servlet, the request carried with (GET as well as POST)
* @param env the serverSwitch object holding all runtime-data
* @return the rewrite-properties for the template
*/
public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) {
plasmaSwitchboard sb = (plasmaSwitchboard)env;
boolean localCrawlStarted = false;
boolean remoteTriggeredCrawlStarted = false;
boolean globalCrawlTriggerStarted = false;
try {
InputStream input = (InputStream) header.get("INPUTSTREAM");
OutputStream output = (OutputStream) header.get("OUTPUTSTREAM");
String line = null;
BufferedReader inputReader = new BufferedReader(new InputStreamReader(input));
PrintWriter outputWriter = new PrintWriter(output);
while ((line = inputReader.readLine()) != null) {
yacyCore.peerActions.updateMySeed();
if (line.equals("")) {
continue;
} else if (line.startsWith("PPM")) {
String currentPPM = yacyCore.seedDB.mySeed().get(yacySeed.ISPEED, "-1");
outputWriter.println(currentPPM);
} else if (line.startsWith("LINKS")) {
String currentLinks = yacyCore.seedDB.mySeed().get(yacySeed.LCOUNT, "-1");
outputWriter.println(currentLinks);
} else if (line.startsWith("WORDS")) {
String currentWords = yacyCore.seedDB.mySeed().get(yacySeed.ICOUNT, "-1");
outputWriter.println(currentWords);
} else if (line.equals("CURRENTURL")) {
String currentURL = "";
ArrayList entryList = new ArrayList();
synchronized (sb.indexingTasksInProcess) {
if (sb.indexingTasksInProcess.size() > 0) {
entryList.addAll(sb.indexingTasksInProcess.values());
}
}
if (entryList.size() > 0) {
plasmaSwitchboardQueue.Entry pcentry = (plasmaSwitchboardQueue.Entry) entryList.get(0);
currentURL = pcentry.url().toString();
}
outputWriter.println(currentURL);
} else if (line.equals("CONTINUECRAWLING")) {
if (sb.crawlJobIsPaused(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL)) {
localCrawlStarted = true;
sb.continueCrawlJob(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL);
}
if (sb.crawlJobIsPaused(plasmaSwitchboard.CRAWLJOB_REMOTE_TRIGGERED_CRAWL)) {
remoteTriggeredCrawlStarted = true;
sb.continueCrawlJob(plasmaSwitchboard.CRAWLJOB_REMOTE_TRIGGERED_CRAWL);
}
if (sb.crawlJobIsPaused(plasmaSwitchboard.CRAWLJOB_REMOTE_CRAWL_LOADER)) {
globalCrawlTriggerStarted = true;
sb.continueCrawlJob(plasmaSwitchboard.CRAWLJOB_REMOTE_CRAWL_LOADER);
}
} else if (line.equals("EXIT")) {
outputWriter.println("OK");
outputWriter.flush();
return null;
} else {
outputWriter.println("Unknown command");
}
outputWriter.flush();
}
return null;
} catch (Exception e) {
return null;
} finally {
if (localCrawlStarted) {
sb.pauseCrawlJob(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL);
}
if (remoteTriggeredCrawlStarted) {
sb.pauseCrawlJob(plasmaSwitchboard.CRAWLJOB_REMOTE_TRIGGERED_CRAWL);
}
if (globalCrawlTriggerStarted) {
sb.pauseCrawlJob(plasmaSwitchboard.CRAWLJOB_REMOTE_CRAWL_LOADER);
}
}
}
}

@ -75,7 +75,7 @@ import de.anomic.server.serverDate;
import de.anomic.yacy.yacyURL; import de.anomic.yacy.yacyURL;
public final class httpHeader extends TreeMap<String, Object> implements Map<String, Object> { public final class httpHeader extends TreeMap<String, String> implements Map<String, String> {
private static final long serialVersionUID = 17L; private static final long serialVersionUID = 17L;
@ -239,8 +239,8 @@ public final class httpHeader extends TreeMap<String, Object> implements Map<Str
public static final String CONNECTION_PROP_PREV_REQUESTLINE = "PREVREQUESTLINE"; public static final String CONNECTION_PROP_PREV_REQUESTLINE = "PREVREQUESTLINE";
public static final String CONNECTION_PROP_REQUEST_START = "REQUEST_START"; public static final String CONNECTION_PROP_REQUEST_START = "REQUEST_START";
public static final String CONNECTION_PROP_REQUEST_END = "REQUEST_END"; public static final String CONNECTION_PROP_REQUEST_END = "REQUEST_END";
public static final String CONNECTION_PROP_INPUTSTREAM = "INPUTSTREAM"; //public static final String CONNECTION_PROP_INPUTSTREAM = "INPUTSTREAM";
public static final String CONNECTION_PROP_OUTPUTSTREAM = "OUTPUTSTREAM"; //public static final String CONNECTION_PROP_OUTPUTSTREAM = "OUTPUTSTREAM";
/* PROPERTIES: Client -> Proxy */ /* PROPERTIES: Client -> Proxy */
public static final String CONNECTION_PROP_CLIENT_REQUEST_HEADER = "CLIENT_REQUEST_HEADER"; public static final String CONNECTION_PROP_CLIENT_REQUEST_HEADER = "CLIENT_REQUEST_HEADER";
@ -302,7 +302,7 @@ public final class httpHeader extends TreeMap<String, Object> implements Map<Str
// we override the put method to make use of the reverseMappingCache // we override the put method to make use of the reverseMappingCache
public Object put(String key, Object value) { public String put(String key, String value) {
String upperK = key.toUpperCase(); String upperK = key.toUpperCase();
if (reverseMappingCache == null) { if (reverseMappingCache == null) {
@ -315,14 +315,14 @@ public final class httpHeader extends TreeMap<String, Object> implements Map<Str
} }
// we put in without a cached key and store the key afterwards // we put in without a cached key and store the key afterwards
Object r = super.put(key, value); String r = super.put(key, value);
reverseMappingCache.put(upperK, key); reverseMappingCache.put(upperK, key);
return r; return r;
} }
// to make the occurrence of multiple keys possible, we add them using a counter // to make the occurrence of multiple keys possible, we add them using a counter
public Object add(String key, Object value) { public String add(String key, String value) {
int c = keyCount((String) key); int c = keyCount(key);
if (c == 0) return put(key, value); if (c == 0) return put(key, value);
return put("*" + key + "-" + c, value); return put("*" + key + "-" + c, value);
} }
@ -906,10 +906,10 @@ public final class httpHeader extends TreeMap<String, Object> implements Map<Str
setCookie( name, value, null, null, null, false); setCookie( name, value, null, null, null, false);
} }
public String getHeaderCookies(){ public String getHeaderCookies(){
Iterator<Map.Entry<String, Object>> it = this.entrySet().iterator(); Iterator<Map.Entry<String, String>> it = this.entrySet().iterator();
while(it.hasNext()) while(it.hasNext())
{ {
Map.Entry<String, Object> e = it.next(); Map.Entry<String, String> e = it.next();
//System.out.println(""+e.getKey()+" : "+e.getValue()); //System.out.println(""+e.getKey()+" : "+e.getValue());
if(e.getKey().equals("Cookie")) if(e.getKey().equals("Cookie"))
{ {

@ -530,8 +530,8 @@ public final class httpdFileHandler {
// call rewrite-class // call rewrite-class
requestHeader.put(httpHeader.CONNECTION_PROP_CLIENTIP, conProp.getProperty("CLIENTIP")); requestHeader.put(httpHeader.CONNECTION_PROP_CLIENTIP, conProp.getProperty("CLIENTIP"));
requestHeader.put(httpHeader.CONNECTION_PROP_PATH, path); requestHeader.put(httpHeader.CONNECTION_PROP_PATH, path);
requestHeader.put(httpHeader.CONNECTION_PROP_INPUTSTREAM, body); //requestHeader.put(httpHeader.CONNECTION_PROP_INPUTSTREAM, body);
requestHeader.put(httpHeader.CONNECTION_PROP_OUTPUTSTREAM, out); //requestHeader.put(httpHeader.CONNECTION_PROP_OUTPUTSTREAM, out);
httpd.sendRespondHeader(conProp, out, httpVersion, 200, null); httpd.sendRespondHeader(conProp, out, httpVersion, 200, null);

@ -114,6 +114,10 @@ public class indexRWIEntryOrder extends kelondroAbstractOrder<indexRWIEntry> imp
return cardinal(new indexRWIRowEntry(key)); return cardinal(new indexRWIRowEntry(key));
} }
public long tf(indexRWIEntry t) {
return (t.hitcount() - min.hitcount()) * (1 + max.wordsintext() - min.wordsintext()) / (1 + max.hitcount() - min.hitcount()) / (t.wordsintext() - min.wordsintext());
}
public long cardinal(indexRWIEntry t) { public long cardinal(indexRWIEntry t) {
//return Long.MAX_VALUE - preRanking(ranking, iEntry, this.entryMin, this.entryMax, this.searchWords); //return Long.MAX_VALUE - preRanking(ranking, iEntry, this.entryMin, this.entryMax, this.searchWords);
// the normalizedEntry must be a normalized indexEntry // the normalizedEntry must be a normalized indexEntry

@ -147,7 +147,6 @@ public class kelondroMergeIterator<E> implements kelondroCloneableIterator<E> {
throw new java.lang.UnsupportedOperationException("merge does not support remove"); throw new java.lang.UnsupportedOperationException("merge does not support remove");
} }
@SuppressWarnings("unchecked")
public static <A> kelondroCloneableIterator<A> cascade(Set<kelondroCloneableIterator<A>> /*of*/ iterators, kelondroOrder<A> c, Method merger, boolean up) { public static <A> kelondroCloneableIterator<A> cascade(Set<kelondroCloneableIterator<A>> /*of*/ iterators, kelondroOrder<A> c, Method merger, boolean up) {
// this extends the ability to combine two iterators // this extends the ability to combine two iterators
// to the abiliy of combining a set of iterators // to the abiliy of combining a set of iterators

@ -57,7 +57,7 @@ import de.anomic.yacy.yacyURL;
public class ResourceInfoFactory { public class ResourceInfoFactory {
public IResourceInfo buildResourceInfoObj( public IResourceInfo buildResourceInfoObj(
yacyURL resourceURL, yacyURL resourceURL,
Map resourceMetadata Map<String, String> resourceMetadata
) throws UnsupportedProtocolException, IllegalAccessException { ) throws UnsupportedProtocolException, IllegalAccessException {
String protocString = resourceURL.getProtocol(); String protocString = resourceURL.getProtocol();
@ -70,10 +70,10 @@ public class ResourceInfoFactory {
try { try {
// loading class by name // loading class by name
final Class moduleClass = Class.forName(className); final Class<?> moduleClass = Class.forName(className);
// getting the constructor // getting the constructor
final Constructor classConstructor = moduleClass.getConstructor( new Class[] { final Constructor<?> classConstructor = moduleClass.getConstructor( new Class[] {
yacyURL.class, yacyURL.class,
Map.class Map.class
} ); } );

@ -58,44 +58,44 @@ public class ResourceInfo implements IResourceInfo {
public static final String MIMETYPE = "mimetype"; public static final String MIMETYPE = "mimetype";
public static final String MODIFICATION_DATE = "modificationDate"; public static final String MODIFICATION_DATE = "modificationDate";
public static final String REFERER = "referer";
private yacyURL url; private yacyURL objectURL, refererURL;
private HashMap propertyMap; private HashMap<String, String> propertyMap;
/** /**
* Constructor used by the {@link ResourceInfoFactory} * Constructor used by the {@link ResourceInfoFactory}
* @param objectURL * @param objectURL
* @param objectInfo * @param objectInfo
*/ */
public ResourceInfo(yacyURL objectURL, Map objectInfo) { public ResourceInfo(yacyURL objectURL, Map<String, String> objectInfo) {
if (objectURL == null) throw new NullPointerException(); if (objectURL == null) throw new NullPointerException();
if (objectInfo == null) throw new NullPointerException(); if (objectInfo == null) throw new NullPointerException();
// generating the url hash // generating the url hash
this.url = objectURL; this.objectURL = objectURL;
this.refererURL = null;
// create the http header object // create the http header object
this.propertyMap = new HashMap(objectInfo); this.propertyMap = new HashMap<String, String>(objectInfo);
} }
public ResourceInfo(yacyURL objectURL, yacyURL refererUrl, String mimeType, Date fileDate) { public ResourceInfo(yacyURL objectURL, yacyURL refererUrl, String mimeType, Date fileDate) {
if (objectURL == null) throw new NullPointerException(); if (objectURL == null) throw new NullPointerException();
// generating the url hash // generating the url hash
this.url = objectURL; this.objectURL = objectURL;
// create the http header object // create the http header object
this.propertyMap = new HashMap(); this.propertyMap = new HashMap<String, String>();
if (refererUrl != null) if (refererUrl != null)
this.propertyMap.put(REFERER, refererUrl); this.refererURL = refererUrl;
if (mimeType != null) if (mimeType != null)
this.propertyMap.put(MIMETYPE, mimeType); this.propertyMap.put(MIMETYPE, mimeType);
if (fileDate != null) if (fileDate != null)
this.propertyMap.put(MODIFICATION_DATE, Long.toString(fileDate.getTime())); this.propertyMap.put(MODIFICATION_DATE, Long.toString(fileDate.getTime()));
} }
public Map getMap() { public Map<String, String> getMap() {
return this.propertyMap; return this.propertyMap;
} }
@ -109,11 +109,11 @@ public class ResourceInfo implements IResourceInfo {
} }
public yacyURL getRefererUrl() { public yacyURL getRefererUrl() {
return (this.propertyMap == null) ? null : ((yacyURL) this.propertyMap.get(REFERER)); return this.refererURL;
} }
public yacyURL getUrl() { public yacyURL getUrl() {
return this.url; return this.objectURL;
} }
public Date ifModifiedSince() { public Date ifModifiedSince() {

@ -68,7 +68,7 @@ public class ResourceInfo implements IResourceInfo {
* @param objectURL * @param objectURL
* @param objectInfo * @param objectInfo
*/ */
public ResourceInfo(yacyURL objectURL, Map objectInfo) { public ResourceInfo(yacyURL objectURL, Map<String, String> objectInfo) {
if (objectURL == null) throw new NullPointerException(); if (objectURL == null) throw new NullPointerException();
if (objectInfo == null) throw new NullPointerException(); if (objectInfo == null) throw new NullPointerException();
@ -90,7 +90,7 @@ public class ResourceInfo implements IResourceInfo {
this.responseHeader = responseHeaders; this.responseHeader = responseHeaders;
} }
public Map getMap() { public Map<String, String> getMap() {
return this.responseHeader; return this.responseHeader;
} }

@ -38,14 +38,14 @@ public final class plasmaProtocolLoader {
private plasmaSwitchboard sb; private plasmaSwitchboard sb;
private serverLog log; private serverLog log;
private HashSet supportedProtocols; private HashSet<String> supportedProtocols;
private plasmaHTTPLoader httpLoader; private plasmaHTTPLoader httpLoader;
private plasmaFTPLoader ftpLoader; private plasmaFTPLoader ftpLoader;
public plasmaProtocolLoader(plasmaSwitchboard sb, serverLog log) { public plasmaProtocolLoader(plasmaSwitchboard sb, serverLog log) {
this.sb = sb; this.sb = sb;
this.log = log; this.log = log;
this.supportedProtocols = new HashSet(Arrays.asList(new String[]{"http","https","ftp"})); this.supportedProtocols = new HashSet<String>(Arrays.asList(new String[]{"http","https","ftp"}));
// initiate loader objects // initiate loader objects
httpLoader = new plasmaHTTPLoader(sb, log); httpLoader = new plasmaHTTPLoader(sb, log);
@ -57,8 +57,9 @@ public final class plasmaProtocolLoader {
return this.supportedProtocols.contains(protocol.trim().toLowerCase()); return this.supportedProtocols.contains(protocol.trim().toLowerCase());
} }
public HashSet getSupportedProtocols() { @SuppressWarnings("unchecked")
return (HashSet) this.supportedProtocols.clone(); public HashSet<String> getSupportedProtocols() {
return (HashSet<String>) this.supportedProtocols.clone();
} }
public plasmaHTCache.Entry load(plasmaCrawlEntry entry, String parserMode) { public plasmaHTCache.Entry load(plasmaCrawlEntry entry, String parserMode) {

@ -149,7 +149,7 @@ public class plasmaSearchAPI {
prop.putNum("genUrlList_urlList_"+i+"_urlExists_ranking", (entry.ranking() - rn)); prop.putNum("genUrlList_urlList_"+i+"_urlExists_ranking", (entry.ranking() - rn));
prop.putNum("genUrlList_urlList_"+i+"_urlExists_domlength", yacyURL.domLengthEstimation(entry.hash())); prop.putNum("genUrlList_urlList_"+i+"_urlExists_domlength", yacyURL.domLengthEstimation(entry.hash()));
prop.putNum("genUrlList_urlList_"+i+"_urlExists_ybr", plasmaSearchRankingProcess.ybr(entry.hash())); prop.putNum("genUrlList_urlList_"+i+"_urlExists_ybr", plasmaSearchRankingProcess.ybr(entry.hash()));
prop.putNum("genUrlList_urlList_"+i+"_urlExists_authority", ranked.getOrder().authority(entry.hash())); prop.putNum("genUrlList_urlList_"+i+"_urlExists_authority", (ranked.getOrder() == null) ? -1 : ranked.getOrder().authority(entry.hash()));
prop.put("genUrlList_urlList_"+i+"_urlExists_date", serverDate.formatShortDay(new Date(entry.word().lastModified()))); prop.put("genUrlList_urlList_"+i+"_urlExists_date", serverDate.formatShortDay(new Date(entry.word().lastModified())));
prop.putNum("genUrlList_urlList_"+i+"_urlExists_wordsintitle", entry.word().wordsintitle()); prop.putNum("genUrlList_urlList_"+i+"_urlExists_wordsintitle", entry.word().wordsintitle());
prop.putNum("genUrlList_urlList_"+i+"_urlExists_wordsintext", entry.word().wordsintext()); prop.putNum("genUrlList_urlList_"+i+"_urlExists_wordsintext", entry.word().wordsintext());

@ -96,7 +96,7 @@ public final class plasmaSearchRankingProcess {
this.localSearchContainerMaps = wordIndex.localSearchContainers(query, null); this.localSearchContainerMaps = wordIndex.localSearchContainers(query, null);
serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(query.id(true), plasmaSearchEvent.COLLECTION, this.localSearchContainerMaps[0].size(), System.currentTimeMillis() - timer)); serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(query.id(true), plasmaSearchEvent.COLLECTION, this.localSearchContainerMaps[0].size(), System.currentTimeMillis() - timer));
// join and exlcude the local result // join and exclude the local result
timer = System.currentTimeMillis(); timer = System.currentTimeMillis();
indexContainer index = indexContainer index =
(this.localSearchContainerMaps == null) ? (this.localSearchContainerMaps == null) ?

Loading…
Cancel
Save