*) new parameters for future use (better blacklist handling for im- and export)

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5403 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
low012 16 years ago
parent e34ac22fbd
commit 5a89266598

@ -35,29 +35,33 @@ public class blacklists {
listManager.listsPath = new File(listManager.switchboard.getRootPath(),listManager.switchboard.getConfig("listManager.listsPath", "DATA/LISTS"));
final List<String> dirlist = listManager.getDirListing(listManager.listsPath);
int blacklistCount=0;
final String blackListName = post.get("listname", "");
List<String> list;
int count;
if (dirlist != null) {
for (String element : dirlist) {
prop.putXML("lists_" + blacklistCount + "_name", element);
if (listManager.listSetContains("BlackLists.Shared", element)) {
if (blackListName.equals("") || element.equals(blackListName)) {
prop.putXML("lists_" + blacklistCount + "_name", element);
if (listManager.listSetContains("BlackLists.Shared", element)) {
list = listManager.getListArray(new File(listManager.listsPath, element));
list = listManager.getListArray(new File(listManager.listsPath, element));
count=0;
for (int j=0;j<list.size();++j){
final String nextEntry = list.get(j);
count=0;
for (int j=0;j<list.size();++j){
final String nextEntry = list.get(j);
if (nextEntry.length() == 0) continue;
if (nextEntry.startsWith("#")) continue;
if (nextEntry.length() == 0) continue;
if (nextEntry.startsWith("#")) continue;
prop.putXML("lists_" + blacklistCount + "_items_" + count + "_item", nextEntry);
count++;
prop.putXML("lists_" + blacklistCount + "_items_" + count + "_item", nextEntry);
count++;
}
prop.put("lists_" + blacklistCount + "_items", count);
blacklistCount++;
}
prop.put("lists_" + blacklistCount + "_items", count);
blacklistCount++;
}
}
}

@ -37,41 +37,45 @@ public class blacklists_p {
listManager.listsPath = new File(listManager.switchboard.getRootPath(),listManager.switchboard.getConfig("listManager.listsPath", "DATA/LISTS"));
final List<String> dirlist = listManager.getDirListing(listManager.listsPath);
int blacklistCount=0;
final String blackListName = post.get("listname", "");
List<String> list;
int count;
if (dirlist != null) {
for (String element : dirlist) {
prop.putXML("lists_" + blacklistCount + "_name", element);
if (listManager.listSetContains("BlackLists.Shared", element)) {
prop.put("lists_" + blacklistCount + "_shared", "1");
} else {
prop.put("lists_" + blacklistCount + "_shared", "0");
}
final String[] types = indexAbstractReferenceBlacklist.BLACKLIST_TYPES_STRING.split(",");
for (int j=0; j<types.length; j++) {
prop.putXML("lists_" + blacklistCount + "_types_" + j + "_name", types[j]);
prop.put("lists_" + blacklistCount + "_types_" + j + "_value",
listManager.listSetContains(types[j] + ".BlackLists", element) ? 1 : 0);
}
prop.put("lists_" + blacklistCount + "_types", types.length);
list = listManager.getListArray(new File(listManager.listsPath, element));
count=0;
for (int j=0;j<list.size();++j){
final String nextEntry = list.get(j);
if (nextEntry.length() == 0) continue;
if (nextEntry.startsWith("#")) continue;
prop.putXML("lists_" + blacklistCount + "_items_" + count + "_item", nextEntry);
count++;
if (blackListName.equals("") || element.equals(blackListName)) {
prop.putXML("lists_" + blacklistCount + "_name", element);
if (listManager.listSetContains("BlackLists.Shared", element)) {
prop.put("lists_" + blacklistCount + "_shared", "1");
} else {
prop.put("lists_" + blacklistCount + "_shared", "0");
}
final String[] types = indexAbstractReferenceBlacklist.BLACKLIST_TYPES_STRING.split(",");
for (int j=0; j<types.length; j++) {
prop.putXML("lists_" + blacklistCount + "_types_" + j + "_name", types[j]);
prop.put("lists_" + blacklistCount + "_types_" + j + "_value",
listManager.listSetContains(types[j] + ".BlackLists", element) ? 1 : 0);
}
prop.put("lists_" + blacklistCount + "_types", types.length);
list = listManager.getListArray(new File(listManager.listsPath, element));
count=0;
for (int j=0;j<list.size();++j){
final String nextEntry = list.get(j);
if (nextEntry.length() == 0) continue;
if (nextEntry.startsWith("#")) continue;
prop.putXML("lists_" + blacklistCount + "_items_" + count + "_item", nextEntry);
count++;
}
prop.put("lists_" + blacklistCount + "_items", count);
blacklistCount++;
}
prop.put("lists_" + blacklistCount + "_items", count);
blacklistCount++;
}
}
prop.put("lists", blacklistCount);

@ -44,7 +44,9 @@ public final class list {
public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch<?> env) {
if (post == null || env == null) throw new NullPointerException("post: " + post + ", sb: " + env);
final plasmaSwitchboard sb = (plasmaSwitchboard) env;
final String blackListName = post.get("listname", "");
// return variable that accumulates replacements
final serverObjects prop = new serverObjects();
if ((post == null) || (env == null)) return prop;
@ -73,9 +75,11 @@ public final class list {
if (filenamesarray.length > 0){
for (int i = 0;i < filenamesarray.length; i++) {
final String filename = filenamesarray[i];
final File fileObj = new File(listsPath,filename);
out.append(listManager.getListString(fileObj, false)).append(serverCore.CRLF_STRING);
if (blackListName.equals("") || filenamesarray[i].equals(blackListName)) {
final String filename = filenamesarray[i];
final File fileObj = new File(listsPath,filename);
out.append(listManager.getListString(fileObj, false)).append(serverCore.CRLF_STRING);
}
}
}

Loading…
Cancel
Save