Package com.maxmind.geoip

Examples of com.maxmind.geoip.LookupService


 
  private CountryLocator() {
 
    try {
     
      lookup_service = new LookupService( GEOIP_DAT, LookupService.GEOIP_MEMORY_CACHE );   
     
    } catch (IOException e) {
     
          service_down = true;
    }
View Full Code Here


    public LookupService getLocationService()
    {

        if (locationService == null)
        {
            LookupService service = null;
            // Get the db file for the location
            String dbfile = ConfigurationManager.getProperty(
                    SolrLogger.CFG_USAGE_MODULE, "dbfile");
            if (dbfile != null)
            {
                try
                {
                    service = new LookupService(dbfile,
                            LookupService.GEOIP_STANDARD);
                }
                catch (IOException e)
                {
                    e.printStackTrace();
View Full Code Here

    public int index() { return 1; }
    public String path() { return "/user:/register"; }
    public void create(Daemon daemon) throws Exception {
      try {
        if(lookup == null) {
          lookup = new LookupService(System.getProperty("user.dir") + "/res/GeoIP.dat", LookupService.GEOIP_MEMORY_CACHE);
        }
      }
      catch (IOException e) {
        e.printStackTrace();
      }
View Full Code Here

  public void checkIn(long guestId, String ipAddress) throws IOException {
    if (SecurityUtils.isStealth())
      return;
    if (geoIpLookupService == null) {
      String dbLocation = env.get("geoIpDb.location");
      geoIpLookupService = new LookupService(dbLocation,
          LookupService.GEOIP_MEMORY_CACHE);
    }

        LocationFacet locationFacet = new LocationFacet(1);
        long time = System.currentTimeMillis();
View Full Code Here

    Map<String,Integer> consolidatedCountries = new HashMap<String,Integer>();
    Map<String,Integer> countriesForNewsFeeds = new HashMap<String,Integer>();
    Map<String,Integer> countriesForPageViews = new HashMap<String,Integer>();
    Map<String,Integer> countriesForFileDownloads = new HashMap<String,Integer>();

    LookupService lookupService = null;

    try {
      String filename = getClass().getResource("/geo-ip.dat").toExternalForm().substring(5);
      lookupService = new LookupService(filename, LookupService.GEOIP_MEMORY_CACHE);

      for (LogEntry logEntry : log.getLogEntries()) {
        String country = lookupService.getCountry(logEntry.getHost()).getName();
        countries.add(country);
        register(country, countriesForNewsFeeds);
        register(country, countriesForPageViews);
        register(country, countriesForFileDownloads);
        register(country, consolidatedCountries);

        Request req = new Request(logEntry.getRequestUri(), blog);
        if (req.isNewsFeed()) {
          increment(country, countriesForNewsFeeds);
          increment(country, consolidatedCountries);
        } else if (req.isPageView()) {
          increment(country, countriesForPageViews);
          increment(country, consolidatedCountries);
        } else if (req.isFileDownload()) {
          increment(country, countriesForFileDownloads);
          increment(country, consolidatedCountries);
        }
      }
    } catch (IOException ioe) {
      throw new ServletException(ioe);
    } finally {
      if (lookupService != null) {
        lookupService.close();
      }
    }

    getModel().put("logAction", "viewCountries");
    getModel().put("countries", countries);
View Full Code Here

    private LookupService cl;

    public ASNum() throws IOException {
        try {
            cl = new LookupService("data/GeoIPASNum.dat", LookupService.GEOIP_MEMORY_CACHE);
        } catch (FileNotFoundException ignored) {
            cl = new LookupService("GeoIPASNum.dat", LookupService.GEOIP_MEMORY_CACHE);
        }
    }
View Full Code Here

    private LookupService cl;

    public City() throws IOException {
        try {
            cl = new LookupService("data/GeoLiteCity.dat", LookupService.GEOIP_MEMORY_CACHE);
        } catch (FileNotFoundException ignored) {
            cl = new LookupService("GeoLiteCity.dat", LookupService.GEOIP_MEMORY_CACHE);
        }
    }
View Full Code Here

    private LookupService cl;

    public LatLon() throws IOException {
        try {
            cl = new LookupService("data/GeoLiteCity.dat", LookupService.GEOIP_MEMORY_CACHE);
        } catch (FileNotFoundException ignored) {
            cl = new LookupService("GeoLiteCity.dat", LookupService.GEOIP_MEMORY_CACHE);
        }
    }
View Full Code Here

    private LookupService cl;

    public Country() throws IOException {
        try {
            cl = new LookupService("data/GeoIP.dat", LookupService.GEOIP_MEMORY_CACHE);
        } catch (FileNotFoundException ignored) {
            cl = new LookupService("GeoIP.dat", LookupService.GEOIP_MEMORY_CACHE);
        }
    }
View Full Code Here

  LookupService asnLookup;
  LRUMap lru = new LRUMap(10000);
 
  public IpGeo(String dbFile, int options) throws IOException
  {
    maxmind = new LookupService(dbFile, LookupService.GEOIP_MEMORY_CACHE);
  }
View Full Code Here

TOP

Related Classes of com.maxmind.geoip.LookupService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.