use of com.maxmind.geoip2.DatabaseReader in project nutch by apache.
the class GeoIPDocumentCreator method createDocFromIspDb.
public static NutchDocument createDocFromIspDb(String serverIp, NutchDocument doc, DatabaseReader reader) throws UnknownHostException, IOException, GeoIp2Exception {
IspResponse response = reader.isp(InetAddress.getByName(serverIp));
addIfNotNull(doc, "ip", serverIp);
addIfNotNull(doc, "autonSystemNum", response.getAutonomousSystemNumber());
addIfNotNull(doc, "autonSystemOrg", response.getAutonomousSystemOrganization());
addIfNotNull(doc, "isp", response.getIsp());
addIfNotNull(doc, "org", response.getOrganization());
return doc;
}
Aggregations