some more generics

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

@ -67,12 +67,12 @@ public final class plasmaSearchEvent {
private plasmaSearchQuery query;
private plasmaWordIndex wordIndex;
private plasmaSearchRankingProcess rankedCache; // ordered search results, grows dynamically as all the query threads enrich this container
private Map rcAbstracts; // cache for index abstracts; word:TreeMap mapping where the embedded TreeMap is a urlhash:peerlist relation
private Map<String, TreeMap<String, String>> rcAbstracts; // cache for index abstracts; word:TreeMap mapping where the embedded TreeMap is a urlhash:peerlist relation
private yacySearch[] primarySearchThreads, secondarySearchThreads;
private Thread localSearchThread;
private TreeMap preselectedPeerHashes;
//private Object[] references;
public TreeMap IAResults;
public TreeMap<String, String> IAResults;
public TreeMap<String, Integer> IACount;
public String IAmaxcounthash, IAneardhthash;
private int localcount;
@ -92,12 +92,12 @@ public final class plasmaSearchEvent {
this.eventTime = System.currentTimeMillis(); // for lifetime check
this.wordIndex = wordIndex;
this.query = query;
this.rcAbstracts = (query.queryHashes.size() > 1) ? new TreeMap() : null; // generate abstracts only for combined searches
this.rcAbstracts = (query.queryHashes.size() > 1) ? new TreeMap<String, TreeMap<String, String>>() : null; // generate abstracts only for combined searches
this.primarySearchThreads = null;
this.secondarySearchThreads = null;
this.preselectedPeerHashes = preselectedPeerHashes;
this.IAResults = new TreeMap();
this.IACount = new TreeMap();
this.IAResults = new TreeMap<String, String>();
this.IACount = new TreeMap<String, Integer>();
this.IAmaxcounthash = null;
this.IAneardhthash = null;
this.localcount = 0;

@ -95,7 +95,7 @@ public final class yacyClient {
// but they appear to be another peer by comparisment of the other peer's hash
// this works of course only if we know the other peer's hash.
HashMap result = null;
HashMap<String, String> result = null;
final serverObjects post = yacyNetwork.basicRequestPost(plasmaSwitchboard.getSwitchboard(), null);
for (int retry = 0; retry < 3; retry++) try {
// generate request
@ -244,7 +244,7 @@ public final class yacyClient {
// send request
try {
final HashMap result = nxTools.table(
final HashMap<String, String> result = nxTools.table(
httpc.wput(new yacyURL("http://" + target.getClusterAddress() + "/yacy/query.html", null),
target.getHexHash() + ".yacyh",
8000,
@ -274,7 +274,7 @@ public final class yacyClient {
// send request
try {
final HashMap result = nxTools.table(
final HashMap<String, String> result = nxTools.table(
httpc.wput(new yacyURL("http://" + target.getClusterAddress() + "/yacy/query.html", null),
target.getHexHash() + ".yacyh",
8000,
@ -306,7 +306,7 @@ public final class yacyClient {
// send request
try {
final HashMap result = nxTools.table(
final HashMap<String, String> result = nxTools.table(
httpc.wput(new yacyURL("http://" + target.getClusterAddress() + "/yacy/query.html", null),
target.getHexHash() + ".yacyh",
6000,
@ -386,7 +386,7 @@ public final class yacyClient {
yacySeed target,
plasmaWordIndex wordIndex,
plasmaSearchRankingProcess containerCache,
Map abstractCache,
Map<String, TreeMap<String, String>> abstractCache,
plasmaURLPattern blacklist,
plasmaSearchRankingProfile rankingProfile,
kelondroBitfield constraint
@ -426,7 +426,7 @@ public final class yacyClient {
final long timestamp = System.currentTimeMillis();
// send request
HashMap result = null;
HashMap<String, String> result = null;
try {
result = nxTools.table(
httpc.wput(new yacyURL("http://" + target.getClusterAddress() + "/yacy/search.html", null),
@ -585,7 +585,7 @@ public final class yacyClient {
if (((String) entry.getKey()).startsWith("indexabstract.")) {
wordhash = ((String) entry.getKey()).substring(14);
synchronized (abstractCache) {
singleAbstract = (TreeMap) abstractCache.get(wordhash); // a mapping from url-hashes to a string of peer-hashes
singleAbstract = (TreeMap<String, String>) abstractCache.get(wordhash); // a mapping from url-hashes to a string of peer-hashes
if (singleAbstract == null) singleAbstract = new TreeMap();
ci = new serverByteBuffer(((String) entry.getValue()).getBytes());
//System.out.println("DEBUG-ABSTRACTFETCH: for word hash " + wordhash + " received " + ci.toString());
@ -632,7 +632,7 @@ public final class yacyClient {
// send request
try {
final HashMap result = nxTools.table(
final HashMap<String, String> result = nxTools.table(
httpc.wput(new yacyURL("http://" + targetAddress(targetHash) + "/yacy/message.html", null),
yacySeed.b64Hash2hexHash(targetHash)+ ".yacyh",
8000,
@ -667,7 +667,7 @@ public final class yacyClient {
// send request
try {
final HashMap result = nxTools.table(
final HashMap<String, String> result = nxTools.table(
httpc.wput(new yacyURL("http://" + targetAddress(targetHash) + "/yacy/message.html", null),
yacySeed.b64Hash2hexHash(targetHash)+ ".yacyh",
20000,
@ -712,7 +712,7 @@ public final class yacyClient {
// send request
try {
final yacyURL url = new yacyURL("http://" + targetAddress + "/yacy/transfer.html", null);
final HashMap result = nxTools.table(
final HashMap<String, String> result = nxTools.table(
httpc.wput(url,
url.getHost(),
6000,
@ -747,7 +747,7 @@ public final class yacyClient {
// send request
try {
final yacyURL url = new yacyURL("http://" + targetAddress + "/yacy/transfer.html", null);
final HashMap result = nxTools.table(
final HashMap<String, String> result = nxTools.table(
httpc.wput(url,
url.getHost(),
20000,
@ -790,7 +790,7 @@ public final class yacyClient {
return "wrong protocol: " + protocol;
}
public static HashMap crawlReceipt(yacySeed target, String process, String result, String reason, indexURLEntry entry, String wordhashes) {
public static HashMap<String, String> crawlReceipt(yacySeed target, String process, String result, String reason, indexURLEntry entry, String wordhashes) {
assert (target != null);
assert (yacyCore.seedDB.mySeed() != null);
assert (yacyCore.seedDB.mySeed() != target);
@ -868,14 +868,14 @@ public final class yacyClient {
}
// transfer the RWI without the URLs
HashMap in = transferRWI(targetSeed, indexes, gzipBody, timeout);
HashMap<String, String> in = transferRWI(targetSeed, indexes, gzipBody, timeout);
resultObj.put("resultTransferRWI", in);
if (in == null) {
resultObj.put("result", "no_connection_1");
return resultObj;
}
if (in.containsKey("indexPayloadSize")) payloadSize += ((Integer)in.get("indexPayloadSize")).intValue();
if (in.containsKey("indexPayloadSize")) payloadSize += Integer.parseInt(in.get("indexPayloadSize"));
String result = (String) in.get("result");
if (result == null) {
@ -916,7 +916,7 @@ public final class yacyClient {
resultObj.put("result","no_connection_2");
return resultObj;
}
if (in.containsKey("urlPayloadSize")) payloadSize += ((Integer)in.get("urlPayloadSize")).intValue();
if (in.containsKey("urlPayloadSize")) payloadSize += Integer.parseInt(in.get("urlPayloadSize"));
result = (String) in.get("result");
if (result == null) {
@ -975,9 +975,9 @@ public final class yacyClient {
}
post.put("entryc", indexcount);
post.put("indexes", entrypost.toString());
post.put("indexes", entrypost.toString());
try {
final ArrayList v = nxTools.strings(
final ArrayList<String> v = nxTools.strings(
httpc.wput(
new yacyURL("http://" + address + "/yacy/transferRWI.html", null),
targetSeed.getHexHash() + ".yacyh",
@ -993,9 +993,9 @@ public final class yacyClient {
yacyCore.seedDB.mySeed().incSI(indexcount);
}
final HashMap result = nxTools.table(v);
final HashMap<String, String> result = nxTools.table(v);
// return the transfered index data in bytes (for debugging only)
result.put("indexPayloadSize", new Integer(entrypost.length()));
result.put("indexPayloadSize", Integer.toString(entrypost.length()));
return result;
} catch (Exception e) {
yacyCore.log.logSevere("yacyClient.transferRWI error:" + e.getMessage());
@ -1003,7 +1003,7 @@ public final class yacyClient {
}
}
private static HashMap transferURL(yacySeed targetSeed, indexURLEntry[] urls, boolean gzipBody, int timeout) {
private static HashMap<String, String> transferURL(yacySeed targetSeed, indexURLEntry[] urls, boolean gzipBody, int timeout) {
// this post a message to the remote message board
final String address = targetSeed.getPublicAddress();
if (address == null) { return null; }
@ -1031,7 +1031,7 @@ public final class yacyClient {
}
post.put("urlc", urlc);
try {
final ArrayList v = nxTools.strings(
final ArrayList<String> v = nxTools.strings(
httpc.wput(
new yacyURL("http://" + address + "/yacy/transferURL.html", null),
targetSeed.getHexHash() + ".yacyh",
@ -1047,9 +1047,9 @@ public final class yacyClient {
yacyCore.seedDB.mySeed().incSU(urlc);
}
HashMap result = nxTools.table(v);
HashMap<String, String> result = nxTools.table(v);
// return the transfered url data in bytes (for debugging only)
result.put("urlPayloadSize", new Integer(urlPayloadSize));
result.put("urlPayloadSize", Integer.toString(urlPayloadSize));
return result;
} catch (Exception e) {
yacyCore.log.logSevere("yacyClient.transferURL error:" + e.getMessage());
@ -1057,7 +1057,7 @@ public final class yacyClient {
}
}
public static HashMap getProfile(yacySeed targetSeed) {
public static HashMap<String, String> getProfile(yacySeed targetSeed) {
// this post a message to the remote message board
final serverObjects post = yacyNetwork.basicRequestPost(plasmaSwitchboard.getSwitchboard(), targetSeed.hash);
@ -1102,7 +1102,7 @@ public final class yacyClient {
(sb.remoteProxyConfig.useProxy()) &&
(sb.remoteProxyConfig.useProxy4Yacy());
final HashMap result = nxTools.table(
final HashMap<String, String> result = nxTools.table(
httpc.wget(
new yacyURL("http://" + target.getPublicAddress() + "/yacy/search.html" +
"?myseed=" + yacyCore.seedDB.mySeed().genSeedStr(null) +

@ -91,7 +91,7 @@ public class yacyCore {
/** pseudo-random key derived from a time-interval while YaCy startup*/
public static long speedKey = 0;
public static File yacyDBPath;
public static final Map amIAccessibleDB = Collections.synchronizedMap(new HashMap()); // Holds PeerHash / yacyAccessible Relations
public static final Map<String, yacyAccessible> amIAccessibleDB = Collections.synchronizedMap(new HashMap<String, yacyAccessible>()); // Holds PeerHash / yacyAccessible Relations
// constants for PeerPing behaviour
private static final int PING_INITIAL = 10;
private static final int PING_MAX_RUNNING = 3;

@ -66,7 +66,7 @@ public class yacySearch extends Thread {
final private int partitions;
final private plasmaWordIndex wordIndex;
final private plasmaSearchRankingProcess containerCache;
final private Map abstractCache;
final private Map<String, TreeMap<String, String>> abstractCache;
final private plasmaURLPattern blacklist;
final private yacySeed targetPeer;
private String[] urls;
@ -77,7 +77,8 @@ public class yacySearch extends Thread {
public yacySearch(String wordhashes, String excludehashes, String urlhashes, String prefer, String filter, int count, int maxDistance,
boolean global, int partitions, yacySeed targetPeer, plasmaWordIndex wordIndex,
plasmaSearchRankingProcess containerCache, Map abstractCache,
plasmaSearchRankingProcess containerCache,
Map<String, TreeMap<String, String>> abstractCache,
plasmaURLPattern blacklist,
plasmaSearchRankingProfile rankingProfile,
kelondroBitfield constraint) {
@ -247,10 +248,13 @@ public class yacySearch extends Thread {
String wordhashes, String excludehashes, String urlhashes,
String prefer, String filter, int count, int maxDist,
plasmaWordIndex wordIndex,
plasmaSearchRankingProcess containerCache, Map abstractCache,
int targets, plasmaURLPattern blacklist,
plasmaSearchRankingProcess containerCache,
Map<String, TreeMap<String, String>> abstractCache,
int targets,
plasmaURLPattern blacklist,
plasmaSearchRankingProfile rankingProfile,
kelondroBitfield constraint, TreeMap clusterselection) {
kelondroBitfield constraint,
TreeMap clusterselection) {
// check own peer status
if (yacyCore.seedDB.mySeed() == null || yacyCore.seedDB.mySeed().getPublicAddress() == null) { return null; }
@ -283,7 +287,7 @@ public class yacySearch extends Thread {
if (targetPeer == null) return null;
if (clusterselection != null) targetPeer.setAlternativeAddress((String) clusterselection.get(targetPeer.hash));
yacySearch searchThread = new yacySearch(wordhashes, excludehashes, urlhashes, "", "", 0, 9999, true, 0, targetPeer,
wordIndex, containerCache, new TreeMap(), blacklist, rankingProfile, constraint);
wordIndex, containerCache, new TreeMap<String, TreeMap<String, String>>(), blacklist, rankingProfile, constraint);
searchThread.start();
return searchThread;
}

Loading…
Cancel
Save