*) remove import java.lang

*) Added Super()
*) replaced startsWith()
*) cleaned


git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@670 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
borg-0300 20 years ago
parent b1cd1fa917
commit c0e3d18bbf

@ -41,10 +41,8 @@
package de.anomic.plasma; package de.anomic.plasma;
import java.lang.String;
import java.util.HashMap;
import java.io.File; import java.io.File;
import java.util.HashMap;
import de.anomic.kelondro.kelondroMSetTools; import de.anomic.kelondro.kelondroMSetTools;
public class plasmaURLPattern { public class plasmaURLPattern {
@ -53,6 +51,7 @@ public class plasmaURLPattern {
private HashMap hostpaths = null; // key=host, value=path; mapped url is http://host/path; path does not start with '/' here private HashMap hostpaths = null; // key=host, value=path; mapped url is http://host/path; path does not start with '/' here
public plasmaURLPattern(File rootPath) { public plasmaURLPattern(File rootPath) {
super();
this.rootPath = rootPath; this.rootPath = rootPath;
this.hostpaths = new HashMap(); this.hostpaths = new HashMap();
} }
@ -66,12 +65,14 @@ public class plasmaURLPattern {
} }
public void loadLists(String mapname, String filenames, String sep) { public void loadLists(String mapname, String filenames, String sep) {
//File listsPath = new File(getRootPath(), getConfig("listsPath", "DATA/LISTS")); // File listsPath = new File(getRootPath(), getConfig("listsPath", "DATA/LISTS"));
String filenamesarray[] = filenames.split(","); final String[] filenamesarray = filenames.split(",");
if(filenamesarray.length >0) if( filenamesarray.length > 0) {
for(int i = 0; i < filenamesarray.length; i++) for (int i = 0; i < filenamesarray.length; i++) {
hostpaths.putAll(kelondroMSetTools.loadMap(mapname, (new File(rootPath, filenamesarray[i])).toString(), sep)); hostpaths.putAll(kelondroMSetTools.loadMap(mapname, (new File(rootPath, filenamesarray[i])).toString(), sep));
}
}
} }
public void remove(String host) { public void remove(String host) {
@ -79,12 +80,12 @@ public class plasmaURLPattern {
} }
public void add(String host, String path) { public void add(String host, String path) {
if (path.startsWith("/")) path = path.substring(1); if (path.length() > 0 && path.charAt(0) == '/') path = path.substring(1);
hostpaths.put(host, path); hostpaths.put(host, path);
} }
public boolean isListed(String hostlow, String path) { public boolean isListed(String hostlow, String path) {
if (path.startsWith("/")) path = path.substring(1); if (path.length() > 0 && path.charAt(0) == '/') path = path.substring(1);
String pp = ""; // path-pattern String pp = ""; // path-pattern
// first try to match the domain with wildcard '*' // first try to match the domain with wildcard '*'

Loading…
Cancel
Save