|
|
@ -44,6 +44,9 @@ import de.anomic.server.servletProperties;
|
|
|
|
|
|
|
|
|
|
|
|
public class CrawlProfileEditor_p {
|
|
|
|
public class CrawlProfileEditor_p {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final static String CRAWL_PROFILE_PREFIX = "crawlProfiles_";
|
|
|
|
|
|
|
|
private static final String EDIT_ENTRIES_PREFIX = "edit_entries_";
|
|
|
|
|
|
|
|
|
|
|
|
private static final Set<String> ignoreNames = new HashSet<String>();
|
|
|
|
private static final Set<String> ignoreNames = new HashSet<String>();
|
|
|
|
static {
|
|
|
|
static {
|
|
|
|
ignoreNames.add(CrawlSwitchboard.CRAWL_PROFILE_PROXY);
|
|
|
|
ignoreNames.add(CrawlSwitchboard.CRAWL_PROFILE_PROXY);
|
|
|
@ -106,7 +109,9 @@ public class CrawlProfileEditor_p {
|
|
|
|
if (post.containsKey("terminate")) {
|
|
|
|
if (post.containsKey("terminate")) {
|
|
|
|
// termination of a crawl: shift the crawl from active to passive
|
|
|
|
// termination of a crawl: shift the crawl from active to passive
|
|
|
|
final CrawlProfile.entry entry = sb.crawler.profilesActiveCrawls.getEntry(handle);
|
|
|
|
final CrawlProfile.entry entry = sb.crawler.profilesActiveCrawls.getEntry(handle);
|
|
|
|
if (entry != null) sb.crawler.profilesPassiveCrawls.newEntry(entry.map());
|
|
|
|
if (entry != null) {
|
|
|
|
|
|
|
|
sb.crawler.profilesPassiveCrawls.newEntry(entry.map());
|
|
|
|
|
|
|
|
}
|
|
|
|
sb.crawler.profilesActiveCrawls.removeEntry(handle.getBytes());
|
|
|
|
sb.crawler.profilesActiveCrawls.removeEntry(handle.getBytes());
|
|
|
|
// delete all entries from the crawl queue that are deleted here
|
|
|
|
// delete all entries from the crawl queue that are deleted here
|
|
|
|
try {
|
|
|
|
try {
|
|
|
@ -135,11 +140,14 @@ public class CrawlProfileEditor_p {
|
|
|
|
entry selentry;
|
|
|
|
entry selentry;
|
|
|
|
while (it.hasNext()) {
|
|
|
|
while (it.hasNext()) {
|
|
|
|
selentry = it.next();
|
|
|
|
selentry = it.next();
|
|
|
|
if (ignoreNames.contains(selentry.name())) continue;
|
|
|
|
if (ignoreNames.contains(selentry.name())) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
prop.put("profiles_" + count + "_name", selentry.name());
|
|
|
|
prop.put("profiles_" + count + "_name", selentry.name());
|
|
|
|
prop.put("profiles_" + count + "_handle", selentry.handle());
|
|
|
|
prop.put("profiles_" + count + "_handle", selentry.handle());
|
|
|
|
if (handle.equals(selentry.handle()))
|
|
|
|
if (handle.equals(selentry.handle())) {
|
|
|
|
prop.put("profiles_" + count + "_selected", "1");
|
|
|
|
prop.put("profiles_" + count + "_selected", "1");
|
|
|
|
|
|
|
|
}
|
|
|
|
count++;
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
prop.put("profiles", count);
|
|
|
|
prop.put("profiles", count);
|
|
|
@ -155,7 +163,9 @@ public class CrawlProfileEditor_p {
|
|
|
|
tee = lit.next();
|
|
|
|
tee = lit.next();
|
|
|
|
final String cval = selentry.map().get(tee.name);
|
|
|
|
final String cval = selentry.map().get(tee.name);
|
|
|
|
final String val = (tee.type == eentry.BOOLEAN) ? Boolean.toString(post.containsKey(tee.name)) : post.get(tee.name, cval);
|
|
|
|
final String val = (tee.type == eentry.BOOLEAN) ? Boolean.toString(post.containsKey(tee.name)) : post.get(tee.name, cval);
|
|
|
|
if (!cval.equals(val)) sb.crawler.profilesActiveCrawls.changeEntry(selentry, tee.name, val);
|
|
|
|
if (!cval.equals(val)) {
|
|
|
|
|
|
|
|
sb.crawler.profilesActiveCrawls.changeEntry(selentry, tee.name, val);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (final Exception ex) {
|
|
|
|
} catch (final Exception ex) {
|
|
|
|
Log.logException(ex);
|
|
|
|
Log.logException(ex);
|
|
|
@ -208,14 +218,14 @@ public class CrawlProfileEditor_p {
|
|
|
|
while (lit.hasNext()) {
|
|
|
|
while (lit.hasNext()) {
|
|
|
|
final eentry ee = lit.next();
|
|
|
|
final eentry ee = lit.next();
|
|
|
|
final String val = selentry.map().get(ee.name);
|
|
|
|
final String val = selentry.map().get(ee.name);
|
|
|
|
prop.put("edit_entries_" + count + "_readonly", ee.readonly ? "1" : "0");
|
|
|
|
prop.put(EDIT_ENTRIES_PREFIX + count + "_readonly", ee.readonly ? "1" : "0");
|
|
|
|
prop.put("edit_entries_" + count + "_readonly_name", ee.name);
|
|
|
|
prop.put(EDIT_ENTRIES_PREFIX + count + "_readonly_name", ee.name);
|
|
|
|
prop.put("edit_entries_" + count + "_readonly_label", ee.label);
|
|
|
|
prop.put(EDIT_ENTRIES_PREFIX + count + "_readonly_label", ee.label);
|
|
|
|
prop.put("edit_entries_" + count + "_readonly_type", ee.type);
|
|
|
|
prop.put(EDIT_ENTRIES_PREFIX + count + "_readonly_type", ee.type);
|
|
|
|
if (ee.type == eentry.BOOLEAN) {
|
|
|
|
if (ee.type == eentry.BOOLEAN) {
|
|
|
|
prop.put("edit_entries_" + count + "_readonly_type_checked", Boolean.parseBoolean(val) ? "1" : "0");
|
|
|
|
prop.put(EDIT_ENTRIES_PREFIX + count + "_readonly_type_checked", Boolean.parseBoolean(val) ? "1" : "0");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
prop.put("edit_entries_" + count + "_readonly_type_value", val);
|
|
|
|
prop.put(EDIT_ENTRIES_PREFIX + count + "_readonly_type_value", val);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
count++;
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -226,16 +236,17 @@ public class CrawlProfileEditor_p {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static void putProfileEntry(final servletProperties prop, final CrawlProfile.entry profile, final boolean active, final boolean dark, final int count, final int domlistlength) {
|
|
|
|
private static void putProfileEntry(final servletProperties prop, final CrawlProfile.entry profile, final boolean active, final boolean dark, final int count, final int domlistlength) {
|
|
|
|
prop.put("crawlProfiles_" + count + "_dark", dark ? "1" : "0");
|
|
|
|
|
|
|
|
prop.put("crawlProfiles_" + count + "_status", active ? "1" : "0");
|
|
|
|
prop.put(CRAWL_PROFILE_PREFIX + count + "_dark", dark ? "1" : "0");
|
|
|
|
prop.put("crawlProfiles_" + count + "_name", profile.name());
|
|
|
|
prop.put(CRAWL_PROFILE_PREFIX + count + "_status", active ? "1" : "0");
|
|
|
|
prop.putXML("crawlProfiles_" + count + "_startURL", profile.startURL());
|
|
|
|
prop.put(CRAWL_PROFILE_PREFIX + count + "_name", profile.name());
|
|
|
|
prop.put("crawlProfiles_" + count + "_handle", profile.handle());
|
|
|
|
prop.putXML(CRAWL_PROFILE_PREFIX + count + "_startURL", profile.startURL());
|
|
|
|
prop.put("crawlProfiles_" + count + "_depth", profile.depth());
|
|
|
|
prop.put(CRAWL_PROFILE_PREFIX + count + "_handle", profile.handle());
|
|
|
|
prop.put("crawlProfiles_" + count + "_mustmatch", profile.mustMatchPattern().toString());
|
|
|
|
prop.put(CRAWL_PROFILE_PREFIX + count + "_depth", profile.depth());
|
|
|
|
prop.put("crawlProfiles_" + count + "_mustnotmatch", profile.mustNotMatchPattern().toString());
|
|
|
|
prop.put(CRAWL_PROFILE_PREFIX + count + "_mustmatch", profile.mustMatchPattern().toString());
|
|
|
|
prop.put("crawlProfiles_" + count + "_crawlingIfOlder", (profile.recrawlIfOlder() == 0L) ? "no re-crawl" : DateFormat.getDateTimeInstance().format(profile.recrawlIfOlder()));
|
|
|
|
prop.put(CRAWL_PROFILE_PREFIX + count + "_mustnotmatch", profile.mustNotMatchPattern().toString());
|
|
|
|
prop.put("crawlProfiles_" + count + "_crawlingDomFilterDepth", (profile.domFilterDepth() == Integer.MAX_VALUE) ? "inactive" : Integer.toString(profile.domFilterDepth()));
|
|
|
|
prop.put(CRAWL_PROFILE_PREFIX + count + "_crawlingIfOlder", (profile.recrawlIfOlder() == 0L) ? "no re-crawl" : DateFormat.getDateTimeInstance().format(profile.recrawlIfOlder()));
|
|
|
|
|
|
|
|
prop.put(CRAWL_PROFILE_PREFIX + count + "_crawlingDomFilterDepth", (profile.domFilterDepth() == Integer.MAX_VALUE) ? "inactive" : Integer.toString(profile.domFilterDepth()));
|
|
|
|
|
|
|
|
|
|
|
|
// start contrib [MN]
|
|
|
|
// start contrib [MN]
|
|
|
|
int i = 0;
|
|
|
|
int i = 0;
|
|
|
@ -244,22 +255,22 @@ public class CrawlProfileEditor_p {
|
|
|
|
if(i == domlistlength){
|
|
|
|
if(i == domlistlength){
|
|
|
|
item = item + " ...";
|
|
|
|
item = item + " ...";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
prop.putHTML("crawlProfiles_"+count+"_crawlingDomFilterContent_"+i+"_item", item);
|
|
|
|
prop.putHTML(CRAWL_PROFILE_PREFIX+count+"_crawlingDomFilterContent_"+i+"_item", item);
|
|
|
|
i++;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
prop.put("crawlProfiles_"+count+"_crawlingDomFilterContent", i);
|
|
|
|
prop.put(CRAWL_PROFILE_PREFIX+count+"_crawlingDomFilterContent", i);
|
|
|
|
// end contrib [MN]
|
|
|
|
// end contrib [MN]
|
|
|
|
|
|
|
|
|
|
|
|
prop.put("crawlProfiles_" + count + "_crawlingDomMaxPages", (profile.domMaxPages() == Integer.MAX_VALUE) ? "unlimited" : Integer.toString(profile.domMaxPages()));
|
|
|
|
prop.put(CRAWL_PROFILE_PREFIX + count + "_crawlingDomMaxPages", (profile.domMaxPages() == Integer.MAX_VALUE) ? "unlimited" : Integer.toString(profile.domMaxPages()));
|
|
|
|
prop.put("crawlProfiles_" + count + "_withQuery", (profile.crawlingQ()) ? "1" : "0");
|
|
|
|
prop.put(CRAWL_PROFILE_PREFIX + count + "_withQuery", (profile.crawlingQ()) ? "1" : "0");
|
|
|
|
prop.put("crawlProfiles_" + count + "_storeCache", (profile.storeHTCache()) ? "1" : "0");
|
|
|
|
prop.put(CRAWL_PROFILE_PREFIX + count + "_storeCache", (profile.storeHTCache()) ? "1" : "0");
|
|
|
|
prop.put("crawlProfiles_" + count + "_indexText", (profile.indexText()) ? "1" : "0");
|
|
|
|
prop.put(CRAWL_PROFILE_PREFIX + count + "_indexText", (profile.indexText()) ? "1" : "0");
|
|
|
|
prop.put("crawlProfiles_" + count + "_indexMedia", (profile.indexMedia()) ? "1" : "0");
|
|
|
|
prop.put(CRAWL_PROFILE_PREFIX + count + "_indexMedia", (profile.indexMedia()) ? "1" : "0");
|
|
|
|
prop.put("crawlProfiles_" + count + "_remoteIndexing", (profile.remoteIndexing()) ? "1" : "0");
|
|
|
|
prop.put(CRAWL_PROFILE_PREFIX + count + "_remoteIndexing", (profile.remoteIndexing()) ? "1" : "0");
|
|
|
|
prop.put("crawlProfiles_" + count + "_terminateButton", (!active || ignoreNames.contains(profile.name())) ? "0" : "1");
|
|
|
|
prop.put(CRAWL_PROFILE_PREFIX + count + "_terminateButton", (!active || ignoreNames.contains(profile.name())) ? "0" : "1");
|
|
|
|
prop.put("crawlProfiles_" + count + "_terminateButton_handle", profile.handle());
|
|
|
|
prop.put(CRAWL_PROFILE_PREFIX + count + "_terminateButton_handle", profile.handle());
|
|
|
|
prop.put("crawlProfiles_" + count + "_deleteButton", (active) ? "0" : "1");
|
|
|
|
prop.put(CRAWL_PROFILE_PREFIX + count + "_deleteButton", (active) ? "0" : "1");
|
|
|
|
prop.put("crawlProfiles_" + count + "_deleteButton_handle", profile.handle());
|
|
|
|
prop.put(CRAWL_PROFILE_PREFIX + count + "_deleteButton_handle", profile.handle());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|