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:
gojomo
2009-10-05 23:04:37 +00:00
parent 10275d7fa1
commit 8f7ad4eae4
2 changed files with 25 additions and 1 deletions
@@ -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.
@@ -82,6 +82,10 @@ implements
return curi.getClassKey();
}
if(!StringUtils.isEmpty(getForceQueueAssignment())) {
return getForceQueueAssignment();
}
UURI basis = curi.getPolicyBasisUURI();
String candidate = getCoreKey(basis);