Package com.logicaldoc.core.security
Class Geolocation
- java.lang.Object
-
- com.logicaldoc.core.security.Geolocation
-
public class Geolocation extends Object
A class to concentrate the Geolocation operations and at the same time a factory to create beans that carry the geolocation of an IP address.- Since:
- 8.5.3
- Author:
- Marco Meschieri - LogicalDOC
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
finalize()
static Geolocation
get()
Retrieve the singleton instance of the Geolocationstatic Geolocation
get(String ip)
Instantiates a new Geolocation for a given IPString
getCity()
String
getCountry()
String
getCountryCode()
String
getDatabaseVersion()
Retrieves the version of the Geolocation databaseString
getPostal()
String
getState()
boolean
isEnabled()
void
syncDB(String key)
Downloads and installs the latest databaseString
toString()
-
-
-
Method Detail
-
get
public static Geolocation get()
Retrieve the singleton instance of the Geolocation- Returns:
- the Geolocation singleton instance
-
get
public static Geolocation get(String ip) throws IOException
Instantiates a new Geolocation for a given IP- Parameters:
ip
- the address to process- Returns:
- the IP geolocalization
- Throws:
IOException
- if an error happens reading the database
-
isEnabled
public boolean isEnabled()
-
getDatabaseVersion
public String getDatabaseVersion()
Retrieves the version of the Geolocation database- Returns:
- The version
-
syncDB
public void syncDB(String key) throws IOException
Downloads and installs the latest database- Parameters:
key
- the API key- Throws:
IOException
- in case of whatever problem
-
getCountry
public String getCountry()
-
getCity
public String getCity()
-
getPostal
public String getPostal()
-
getState
public String getState()
-
getCountryCode
public String getCountryCode()
-
finalize
public void finalize()
-
-