mirror of
https://github.com/internetarchive/heritrix3.git
synced 2026-09-26 07:35:39 +00:00
work for [HER-1605] Refactor parameterizable policies out of frontier
* QueueAssignmentPolicy.java, URIAuthorityBasedQueueAssignmentPolicy.java
move 'force-queue-assignment' setting from frontier to policy
This commit is contained in:
@@ -22,13 +22,33 @@ package org.archive.crawler.frontier;
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.archive.modules.CrawlURI;
|
||||
import org.archive.spring.HasKeyedProperties;
|
||||
import org.archive.spring.KeyedProperties;
|
||||
|
||||
/**
|
||||
* Establishes a mapping from CrawlURIs to String keys (queue names).
|
||||
*
|
||||
* @author gojomo
|
||||
*/
|
||||
public abstract class QueueAssignmentPolicy implements Serializable {
|
||||
public abstract class QueueAssignmentPolicy implements Serializable, HasKeyedProperties {
|
||||
|
||||
KeyedProperties kp = new KeyedProperties();
|
||||
public KeyedProperties getKeyedProperties() {
|
||||
return kp;
|
||||
}
|
||||
|
||||
/** queue assignment to force onto CrawlURIs; intended to be overridden */
|
||||
{
|
||||
setForceQueueAssignment("");
|
||||
}
|
||||
public String getForceQueueAssignment() {
|
||||
return (String) kp.get("forceQueueAssignment");
|
||||
}
|
||||
public void setForceQueueAssignment(String forceQueueAssignment) {
|
||||
kp.put("forceQueueAssignment",forceQueueAssignment);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the String key (name) of the queue to which the
|
||||
* CrawlURI should be assigned.
|
||||
|
||||
+4
@@ -82,6 +82,10 @@ implements
|
||||
return curi.getClassKey();
|
||||
}
|
||||
|
||||
if(!StringUtils.isEmpty(getForceQueueAssignment())) {
|
||||
return getForceQueueAssignment();
|
||||
}
|
||||
|
||||
UURI basis = curi.getPolicyBasisUURI();
|
||||
String candidate = getCoreKey(basis);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user