org.archive.crawler.deciderules
Class ExternalGeoLocationDecideRule

java.lang.Object
  extended by javax.management.Attribute
      extended by org.archive.crawler.settings.Type
          extended by org.archive.crawler.settings.ComplexType
              extended by org.archive.crawler.settings.ModuleType
                  extended by org.archive.crawler.deciderules.DecideRule
                      extended by org.archive.crawler.deciderules.ConfiguredDecideRule
                          extended by org.archive.crawler.deciderules.PredicatedDecideRule
                              extended by org.archive.crawler.deciderules.ExternalGeoLocationDecideRule
All Implemented Interfaces:
java.io.Serializable, javax.management.DynamicMBean

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

Nested Class Summary
 
Nested classes/interfaces inherited from class org.archive.crawler.settings.ComplexType
ComplexType.MBeanAttributeInfoIterator
 
Field Summary
(package private) static java.lang.String ATTR_COUNTRY_CODE
           
(package private) static java.lang.String ATTR_IMPLEMENTATION
           
(package private) static java.lang.String DEFAULT_COUNTRY_CODE
           
 
Fields inherited from class org.archive.crawler.deciderules.ConfiguredDecideRule
ALLOWED_TYPES, ATTR_DECISION
 
Fields inherited from class org.archive.crawler.deciderules.DecideRule
ACCEPT, PASS, REJECT
 
Fields inherited from class org.archive.crawler.settings.ComplexType
definition, definitionMap
 
Constructor Summary
ExternalGeoLocationDecideRule(java.lang.String name)
           
 
Method Summary
protected  boolean evaluate(java.lang.Object obj)
           
protected  ExternalGeoLookupInterface getConfiguredImplementation(java.lang.Object o)
          Get implementation, if one specified.
 
Methods inherited from class org.archive.crawler.deciderules.PredicatedDecideRule
decisionFor
 
Methods inherited from class org.archive.crawler.deciderules.ConfiguredDecideRule
singlePossibleNonPassDecision
 
Methods inherited from class org.archive.crawler.deciderules.DecideRule
getController, kickUpdate
 
Methods inherited from class org.archive.crawler.settings.ModuleType
addElement, listUsedFiles
 
Methods inherited from class org.archive.crawler.settings.ComplexType
addElementToDefinition, checkValue, earlyInitialize, getAbsoluteName, getAttribute, getAttribute, getAttribute, getAttributeInfo, getAttributeInfo, getAttributeInfoIterator, getAttributes, getDataContainerRecursive, getDataContainerRecursive, getDefaultValue, getDescription, getElementFromDefinition, getLegalValues, getLocalAttribute, getMBeanInfo, getMBeanInfo, getParent, getPreservedFields, getSettingsHandler, getUncheckedAttribute, getValue, globalSettings, invoke, isInitialized, isOverridden, iterator, removeElementFromDefinition, setAsOrder, setAttribute, setAttribute, setAttributes, setDescription, setPreservedFields, toString, unsetAttribute
 
Methods inherited from class org.archive.crawler.settings.Type
addConstraint, equals, getConstraints, getLegalValueType, isExpertSetting, isOverrideable, isTransient, setExpertSetting, setLegalValueType, setOverrideable, setTransient
 
Methods inherited from class javax.management.Attribute
getName, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ATTR_IMPLEMENTATION

static final java.lang.String ATTR_IMPLEMENTATION
See Also:
Constant Field Values

ATTR_COUNTRY_CODE

static final java.lang.String ATTR_COUNTRY_CODE
See Also:
Constant Field Values

DEFAULT_COUNTRY_CODE

static final java.lang.String DEFAULT_COUNTRY_CODE
See Also:
Constant Field Values
Constructor Detail

ExternalGeoLocationDecideRule

public ExternalGeoLocationDecideRule(java.lang.String name)
Parameters:
name - Name of this rule.
Method Detail

evaluate

protected boolean evaluate(java.lang.Object obj)
Specified by:
evaluate in class PredicatedDecideRule

getConfiguredImplementation

protected ExternalGeoLookupInterface getConfiguredImplementation(java.lang.Object o)
Get implementation, if one specified. If none specified, will keep trying to find one. Will be messy if the provided class is not-instantiable

Parameters:
o - A context object.
Returns:
Instance of ExternalGeoLookupInterface or null.


Copyright © 2003-2011 Internet Archive. All Rights Reserved.