Package org.archive.modules.deciderules
Class ExternalGeoLocationDecideRule
java.lang.Object
org.archive.modules.deciderules.DecideRule
org.archive.modules.deciderules.PredicatedDecideRule
org.archive.modules.deciderules.ExternalGeoLocationDecideRule
- All Implemented Interfaces:
Serializable
,org.archive.spring.HasKeyedProperties
public class ExternalGeoLocationDecideRule extends PredicatedDecideRule
A rule that can be configured to take alternate implementations
of the ExternalGeoLocationInterface.
If no implementation specified, or none found, returns configured decision.
If host in URI has been resolved checks CrawlHost for the country code
determination.
If country code is not present, does country lookup, and saves the country
code to
CrawlHost
for future consultation.
If country code is present in CrawlHost
, compares it against
the configured code.
Note that if a host's IP address changes during the crawl, we still consider
the associated hostname to be in the country of its original IP address.- Author:
- Igor Ranitovic
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description protected List<String>
countryCodes
Country code name.protected ExternalGeoLookupInterface
lookup
protected ServerCache
serverCache
Fields inherited from class org.archive.modules.deciderules.DecideRule
comment, kp
-
Constructor Summary
Constructors Constructor Description ExternalGeoLocationDecideRule()
-
Method Summary
Modifier and Type Method Description protected boolean
evaluate(CrawlURI uri)
List<String>
getCountryCodes()
ExternalGeoLookupInterface
getLookup()
ServerCache
getServerCache()
void
setCountryCodes(List<String> codes)
void
setLookup(ExternalGeoLookupInterface lookup)
void
setServerCache(ServerCache serverCache)
Methods inherited from class org.archive.modules.deciderules.PredicatedDecideRule
getDecision, innerDecide, onlyDecision, setDecision
Methods inherited from class org.archive.modules.deciderules.DecideRule
accepts, decisionFor, getComment, getEnabled, getKeyedProperties, setComment, setEnabled
-
Field Details
-
lookup
-
countryCodes
Country code name. -
serverCache
-
-
Constructor Details
-
ExternalGeoLocationDecideRule
public ExternalGeoLocationDecideRule()
-
-
Method Details
-
getLookup
-
setLookup
-
getCountryCodes
-
setCountryCodes
-
getServerCache
-
setServerCache
-
evaluate
- Specified by:
evaluate
in classPredicatedDecideRule
-