Skip to content

Commit

Permalink
refactoring:
Browse files Browse the repository at this point in the history
- removed the plasma package. The name of that package came from a very early pre-version of YaCy, even before YaCy was named AnomicHTTPProxy. The Proxy project introduced search for cache contents using class files that had been developed during the plasma project. Information from 2002 about plasma can be found here:
http://web.archive.org/web/20020802110827/http://anomic.de/AnomicPlasma/index.html
We stil have one class that comes mostly unchanged from the plasma project, the Condenser class. But this is now part of the document package and all other classes in the plasma package can be assigned to other packages.
- cleaned up the http package: better structure of that class and clean isolation of server and client classes. The old HTCache becomes part of the client sub-package of http.
- because the plasmaSwitchboard is now part of the search package all servlets had to be touched to declare a different package source.

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6232 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
orbiter committed Jul 19, 2009
1 parent 67da206 commit 1d8d510
Show file tree
Hide file tree
Showing 221 changed files with 3,410 additions and 3,559 deletions.
8 changes: 4 additions & 4 deletions htroot/AccessTracker_p.java
Expand Up @@ -35,10 +35,10 @@
import java.util.Map.Entry;
import java.text.SimpleDateFormat;

import de.anomic.http.httpRequestHeader;
import de.anomic.http.metadata.RequestHeader;
import de.anomic.net.natLib;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.search.QueryParams;
import de.anomic.search.Switchboard;
import de.anomic.server.serverCore;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
Expand All @@ -56,8 +56,8 @@ private static final SortedMap<Long, String> treemapclone(final SortedMap<Long,
return accessClone;
}

public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
final plasmaSwitchboard sb = (plasmaSwitchboard) env;
public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final Switchboard sb = (Switchboard) env;

// return variable that accumulates replacements
final serverObjects prop = new serverObjects();
Expand Down
20 changes: 10 additions & 10 deletions htroot/Banner.java
Expand Up @@ -31,20 +31,20 @@

import javax.imageio.ImageIO;

import de.anomic.http.httpRequestHeader;
import de.anomic.plasma.plasmaGrafics;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.plasma.plasmaSwitchboardConstants;
import de.anomic.http.metadata.RequestHeader;
import de.anomic.search.Switchboard;
import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacySeed;
import de.anomic.ymage.NetworkGraph;
import de.anomic.ymage.ymageMatrix;

/** draw a banner with information about the peer */
public class Banner {

public static ymageMatrix respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) throws IOException {
final plasmaSwitchboard sb = (plasmaSwitchboard) env;
public static ymageMatrix respond(final RequestHeader header, final serverObjects post, final serverSwitch env) throws IOException {
final Switchboard sb = (Switchboard) env;
final String IMAGE = "htroot/env/grafics/yacy.gif";
int width = 468;
int height = 60;
Expand All @@ -66,7 +66,7 @@ public static ymageMatrix respond(final httpRequestHeader header, final serverOb
int myppm = 0;
double myqph = 0;
String type = "";
final String network = env.getConfig(plasmaSwitchboardConstants.NETWORK_NAME, "unspecified").toUpperCase();
final String network = env.getConfig(SwitchboardConstants.NETWORK_NAME, "unspecified").toUpperCase();
final int peers = sb.peers.sizeConnected() + 1; // the '+ 1': the own peer is not included in sizeConnected()
long nlinks = sb.peers.countActiveURL();
long nwords = sb.peers.countActiveRWI();
Expand Down Expand Up @@ -103,12 +103,12 @@ public static ymageMatrix respond(final httpRequestHeader header, final serverOb
}
}

if (!plasmaGrafics.logoIsLoaded()) {
if (!NetworkGraph.logoIsLoaded()) {
final BufferedImage logo = ImageIO.read(new File(IMAGE));
return plasmaGrafics.getBannerPicture(1000, width, height, bgcolor, textcolor, bordercolor, name, links, words, type, myppm, network, peers, nlinks, nwords, nqph, nppm, logo);
return NetworkGraph.getBannerPicture(1000, width, height, bgcolor, textcolor, bordercolor, name, links, words, type, myppm, network, peers, nlinks, nwords, nqph, nppm, logo);
}

return plasmaGrafics.getBannerPicture(1000, width, height, bgcolor, textcolor, bordercolor, name, links, words, type, myppm, network, peers, nlinks, nwords, nqph, nppm);
return NetworkGraph.getBannerPicture(1000, width, height, bgcolor, textcolor, bordercolor, name, links, words, type, myppm, network, peers, nlinks, nwords, nqph, nppm);
}

}
18 changes: 9 additions & 9 deletions htroot/BlacklistCleaner_p.java
Expand Up @@ -49,8 +49,8 @@
import de.anomic.data.Blacklist;
import de.anomic.data.DefaultBlacklist;
import de.anomic.data.listManager;
import de.anomic.http.httpRequestHeader;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.http.metadata.RequestHeader;
import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.logging.Log;
Expand All @@ -75,11 +75,11 @@ public class BlacklistCleaner_p {
DefaultBlacklist.class
};

public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final serverObjects prop = new serverObjects();

// initialize the list manager
listManager.switchboard = (plasmaSwitchboard) env;
listManager.switchboard = (Switchboard) env;
listManager.listsPath = new File(env.getRootPath(), env.getConfig("listManager.listsPath", "DATA/LISTS"));
String blacklistToUse = null;

Expand Down Expand Up @@ -113,10 +113,10 @@ public static serverObjects respond(final httpRequestHeader header, final server
}

// list illegal entries
final HashMap<String, Integer> ies = getIllegalEntries(blacklistToUse, plasmaSwitchboard.urlBlacklist);
final HashMap<String, Integer> ies = getIllegalEntries(blacklistToUse, Switchboard.urlBlacklist);
prop.put(RESULTS + "blList", blacklistToUse);
prop.put(RESULTS + "entries", ies.size());
prop.putHTML(RESULTS + "blEngine", plasmaSwitchboard.urlBlacklist.getEngineInfo());
prop.putHTML(RESULTS + "blEngine", Switchboard.urlBlacklist.getEngineInfo());
prop.put(RESULTS + "disabled", (ies.size() == 0) ? "1" : "0");
if (ies.size() > 0) {
prop.put(RESULTS + DISABLED + "entries", ies.size());
Expand All @@ -137,7 +137,7 @@ public static serverObjects respond(final httpRequestHeader header, final server
private static void putBlacklists(final serverObjects prop, final List<String> lists, final String selected) {
boolean supported = false;
for (int i=0; i<supportedBLEngines.length && !supported; i++) {
supported |= (plasmaSwitchboard.urlBlacklist.getClass() == supportedBLEngines[i]);
supported |= (Switchboard.urlBlacklist.getClass() == supportedBLEngines[i]);
}

if (supported) {
Expand Down Expand Up @@ -295,7 +295,7 @@ private static int removeEntries(final String blacklistToUse, final String[] sup
final String host = (s.indexOf("/") == -1) ? s : s.substring(0, s.indexOf("/"));
final String path = (s.indexOf("/") == -1) ? ".*" : s.substring(s.indexOf("/") + 1);
try {
plasmaSwitchboard.urlBlacklist.remove(supportedBlacklistTypes[blTypes],
Switchboard.urlBlacklist.remove(supportedBlacklistTypes[blTypes],
host,path);
} catch (final RuntimeException e) {
//System.err.println(e.getMessage() + ": " + host + "/" + path);
Expand Down Expand Up @@ -332,7 +332,7 @@ private static int alterEntries(
pw.println(host + "/" + path);
for (int blTypes=0; blTypes < supportedBlacklistTypes.length; blTypes++) {
if (listManager.listSetContains(supportedBlacklistTypes[blTypes] + ".BlackLists",blacklistToUse)) {
plasmaSwitchboard.urlBlacklist.add(
Switchboard.urlBlacklist.add(
supportedBlacklistTypes[blTypes],
host,
path);
Expand Down
12 changes: 6 additions & 6 deletions htroot/BlacklistImpExp_p.java
Expand Up @@ -34,8 +34,8 @@
import java.util.TreeMap;

import de.anomic.data.listManager;
import de.anomic.http.httpRequestHeader;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.http.metadata.RequestHeader;
import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacySeed;
Expand All @@ -44,19 +44,19 @@
public class BlacklistImpExp_p {
private final static String DISABLED = "disabled_";

public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
final plasmaSwitchboard sb = (plasmaSwitchboard) env;
public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final Switchboard sb = (Switchboard) env;

// initialize the list manager
listManager.switchboard = (plasmaSwitchboard) env;
listManager.switchboard = (Switchboard) env;
listManager.listsPath = new File(listManager.switchboard.getRootPath(),listManager.switchboard.getConfig("listManager.listsPath", "DATA/LISTS"));

// loading all blacklist files located in the directory
final List<String> dirlist = listManager.getDirListing(listManager.listsPath);

String blacklistToUse = null;
final serverObjects prop = new serverObjects();
prop.putHTML("blacklistEngine", plasmaSwitchboard.urlBlacklist.getEngineInfo());
prop.putHTML("blacklistEngine", Switchboard.urlBlacklist.getEngineInfo());

// if we have not chosen a blacklist until yet we use the first file
if (blacklistToUse == null && dirlist != null && dirlist.size() > 0) {
Expand Down
22 changes: 11 additions & 11 deletions htroot/BlacklistTest_p.java
Expand Up @@ -34,22 +34,22 @@

import de.anomic.data.Blacklist;
import de.anomic.data.listManager;
import de.anomic.http.httpRequestHeader;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.http.metadata.RequestHeader;
import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyURL;

public class BlacklistTest_p {

public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {

// initialize the list manager
listManager.switchboard = (plasmaSwitchboard) env;
listManager.switchboard = (Switchboard) env;
listManager.listsPath = new File(listManager.switchboard.getRootPath(),listManager.switchboard.getConfig("listManager.listsPath", "DATA/LISTS"));

final serverObjects prop = new serverObjects();
prop.putHTML("blacklistEngine", plasmaSwitchboard.urlBlacklist.getEngineInfo());
prop.putHTML("blacklistEngine", Switchboard.urlBlacklist.getEngineInfo());

// do all post operations
if(post != null && post.containsKey("testList")) {
Expand All @@ -62,17 +62,17 @@ public static serverObjects respond(final httpRequestHeader header, final server
} catch (final MalformedURLException e) { testurl = null; }
if(testurl != null) {
prop.putHTML("testlist_url",testurl.toString());
if(plasmaSwitchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_CRAWLER, testurl))
if(Switchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_CRAWLER, testurl))
prop.put("testlist_listedincrawler", "1");
if(plasmaSwitchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_DHT, testurl))
if(Switchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_DHT, testurl))
prop.put("testlist_listedindht", "1");
if(plasmaSwitchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_NEWS, testurl))
if(Switchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_NEWS, testurl))
prop.put("testlist_listedinnews", "1");
if(plasmaSwitchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_PROXY, testurl))
if(Switchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_PROXY, testurl))
prop.put("testlist_listedinproxy", "1");
if(plasmaSwitchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_SEARCH, testurl))
if(Switchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_SEARCH, testurl))
prop.put("testlist_listedinsearch", "1");
if(plasmaSwitchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_SURFTIPS, testurl))
if(Switchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_SURFTIPS, testurl))
prop.put("testlist_listedinsurftips", "1");
}
else prop.put("testlist_url","not valid");
Expand Down
30 changes: 15 additions & 15 deletions htroot/Blacklist_p.java
Expand Up @@ -42,9 +42,9 @@
import de.anomic.data.AbstractBlacklist;
import de.anomic.data.Blacklist;
import de.anomic.data.listManager;
import de.anomic.http.httpRequestHeader;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.http.metadata.RequestHeader;
import de.anomic.search.QueryEvent;
import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyURL;
Expand All @@ -59,10 +59,10 @@ public class Blacklist_p {

private final static String BLACKLIST_FILENAME_FILTER = "^.*\\.black$";

public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {

// initialize the list manager
listManager.switchboard = (plasmaSwitchboard) env;
listManager.switchboard = (Switchboard) env;
listManager.listsPath = new File(listManager.switchboard.getRootPath(),listManager.switchboard.getConfig("listManager.listsPath", "DATA/LISTS"));

// clean up all search events in case that a (new) blacklist entry denies previously returned results
Expand All @@ -77,7 +77,7 @@ public static serverObjects respond(final httpRequestHeader header, final server

String blacklistToUse = null;
final serverObjects prop = new serverObjects();
prop.putHTML("blacklistEngine", plasmaSwitchboard.urlBlacklist.getEngineInfo());
prop.putHTML("blacklistEngine", Switchboard.urlBlacklist.getEngineInfo());

// do all post operations
if (post != null) {
Expand All @@ -94,17 +94,17 @@ public static serverObjects respond(final httpRequestHeader header, final server
} catch (final MalformedURLException e) { testurl = null; }
if(testurl != null) {
prop.putHTML("testlist_url",testurl.toString());
if(plasmaSwitchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_CRAWLER, testurl))
if(Switchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_CRAWLER, testurl))
prop.put("testlist_listedincrawler", "1");
if(plasmaSwitchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_DHT, testurl))
if(Switchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_DHT, testurl))
prop.put("testlist_listedindht", "1");
if(plasmaSwitchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_NEWS, testurl))
if(Switchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_NEWS, testurl))
prop.put("testlist_listedinnews", "1");
if(plasmaSwitchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_PROXY, testurl))
if(Switchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_PROXY, testurl))
prop.put("testlist_listedinproxy", "1");
if(plasmaSwitchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_SEARCH, testurl))
if(Switchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_SEARCH, testurl))
prop.put("testlist_listedinsearch", "1");
if(plasmaSwitchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_SURFTIPS, testurl))
if(Switchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_SURFTIPS, testurl))
prop.put("testlist_listedinsurftips", "1");
}
else prop.put("testlist_url","not valid");
Expand Down Expand Up @@ -512,7 +512,7 @@ public static serverObjects respond(final httpRequestHeader header, final server
* @return null if no error occured, else a String to put into LOCATION
*/
private static String addBlacklistEntry(final String blacklistToUse, String newEntry,
final httpRequestHeader header, final String[] supportedBlacklistTypes) {
final RequestHeader header, final String[] supportedBlacklistTypes) {

if (blacklistToUse == null || blacklistToUse.trim().length() == 0) {
return "";
Expand Down Expand Up @@ -560,7 +560,7 @@ private static String addBlacklistEntry(final String blacklistToUse, String newE
// add to blacklist
for (int blTypes = 0; blTypes < supportedBlacklistTypes.length; blTypes++) {
if (listManager.listSetContains(supportedBlacklistTypes[blTypes] + ".BlackLists", blacklistToUse)) {
plasmaSwitchboard.urlBlacklist.add(supportedBlacklistTypes[blTypes], newEntry.substring(0, pos), newEntry.substring(pos + 1));
Switchboard.urlBlacklist.add(supportedBlacklistTypes[blTypes], newEntry.substring(0, pos), newEntry.substring(pos + 1));
}
}
}
Expand All @@ -577,7 +577,7 @@ private static String addBlacklistEntry(final String blacklistToUse, String newE
* @return null if no error occured, else a String to put into LOCATION
*/
private static String deleteBlacklistEntry(final String blacklistToUse, String oldEntry,
final httpRequestHeader header, final String[] supportedBlacklistTypes) {
final RequestHeader header, final String[] supportedBlacklistTypes) {

if (blacklistToUse == null || blacklistToUse.trim().length() == 0) {
return "";
Expand Down Expand Up @@ -610,7 +610,7 @@ private static String deleteBlacklistEntry(final String blacklistToUse, String o
}
for (int blTypes=0; blTypes < supportedBlacklistTypes.length; blTypes++) {
if (listManager.listSetContains(supportedBlacklistTypes[blTypes] + ".BlackLists",blacklistToUse)) {
plasmaSwitchboard.urlBlacklist.remove(supportedBlacklistTypes[blTypes],oldEntry.substring(0, pos), oldEntry.substring(pos + 1));
Switchboard.urlBlacklist.remove(supportedBlacklistTypes[blTypes],oldEntry.substring(0, pos), oldEntry.substring(pos + 1));
}
}

Expand Down

0 comments on commit 1d8d510

Please sign in to comment.