class ExternalGeoLocationDecideRule extends PredicatedDecideRule {

    private static final long serialVersionUID = 3L;

    private static final Logger LOGGER =
        Logger.getLogger(ExternalGeoLocationDecideRule.class.getName());

    protected ExternalGeoLookupInterface lookup = null; 
    public ExternalGeoLookupInterface getLookup() {
        return this.lookup;
    }
    public void setLookup(ExternalGeoLookupInterface lookup) {
        this.lookup = lookup; 
    }
    
    /**
     * Country code name.
     */
    protected List<String> countryCodes = new ArrayList<String>();
    public List<String> getCountryCodes() {
        return this.countryCodes;
    }
    public void setCountryCodes(List<String> codes) {
        this.countryCodes = codes; 
    }

    protected ServerCache serverCache;
    public ServerCache getServerCache() {
        return this.serverCache;
    }
    @Autowired
    public void setServerCache(ServerCache serverCache) {
        this.serverCache = serverCache;
    }
    
    public ExternalGeoLocationDecideRule() {
    }
    
    @Override
    protected boolean evaluate(CrawlURI uri) {<FILL_FUNCTION_BODY>}
    
}
        
        ExternalGeoLookupInterface impl = getLookup();
        if (impl == null) {
            return false;
        }
        CrawlHost crawlHost = null;
        String host;
        InetAddress address;
        try {
            host = uri.getUURI().getHost();
            crawlHost = serverCache.getHostFor(host);
            if (crawlHost.getCountryCode() != null) {
                return countryCodes.contains(crawlHost.getCountryCode());
            }
            address = crawlHost.getIP();
            if (address == null) {
                // TODO: handle transient lookup failures better
                address = Address.getByName(host);
            }
            crawlHost.setCountryCode((String) impl.lookup(address));
            if (countryCodes.contains(crawlHost.getCountryCode())) {
                LOGGER.fine("Country Code Lookup: " + " " + host
                        + crawlHost.getCountryCode());
                return true;
            }
        } catch (UnknownHostException e) {
            LOGGER.log(Level.FINE, "Failed dns lookup " + uri, e);
            if (crawlHost != null) {
                crawlHost.setCountryCode("--");
            }
        } catch (URIException e) {
            LOGGER.log(Level.FINE, "Failed to parse hostname " + uri, e);
        }

        return false;
    
<methods>public void <init>() ,public org.archive.modules.deciderules.DecideResult getDecision() ,public org.archive.modules.deciderules.DecideResult onlyDecision(org.archive.modules.CrawlURI) ,public void setDecision(org.archive.modules.deciderules.DecideResult) <variables>private static final long serialVersionUID