org.opengts.geocoder.tinygeocoder
Class TinyGeocoder

java.lang.Object
  extended by org.opengts.geocoder.ReverseGeocodeProviderAdapter
      extended by org.opengts.geocoder.tinygeocoder.TinyGeocoder
All Implemented Interfaces:
GeocodeProvider, ReverseGeocodeProvider

public class TinyGeocoder
extends ReverseGeocodeProviderAdapter
implements ReverseGeocodeProvider, GeocodeProvider


Field Summary
protected static java.lang.String ENCODING_UTF8
           
protected static java.lang.String HOST_PRIMARY
           
protected static java.lang.String PROP_hostName
           
protected static int TIMEOUT_Geocode
           
protected static int TIMEOUT_ReverseGeocode
           
 
Fields inherited from class org.opengts.geocoder.ReverseGeocodeProviderAdapter
_PROP_isEnabled, DEFAULT_MAX_FAILOVER_SECONDS, MIN_FAILOVER_SECONDS, PROP_alwaysFast, PROP_maxFailoverSeconds, PROP_ReverseGeocodeProvider_
 
Constructor Summary
TinyGeocoder(java.lang.String name, java.lang.String key, RTProperties rtProps)
          Constructor
 
Method Summary
 GeoPoint getGeocode(java.lang.String address, java.lang.String country)
          GeocodeProvider interface - Gets GeoPoint from address/country
protected  int getGeocodeTimeout()
          Returns the Geocode timeout
protected  java.lang.String getHostname()
          Gets the hostname
 ReverseGeocode getReverseGeocode(GeoPoint gp, java.lang.String localStr, boolean cache)
          Returns a ReverseGeocode instance for the specified GeoPoint
protected  int getReverseGeocodeTimeout()
          Returns the ReverseGeocode timeout
 boolean isFastOperation()
          Returns true if locally resolved, false otherwise.
static void main(java.lang.String[] argv)
          Main entery point for debugging/testing
 
Methods inherited from class org.opengts.geocoder.ReverseGeocodeProviderAdapter
_getUserPass, _main, getAuthorization, getFailoverReverseGeocodeProvider, getFailoverReverseGeocodeProviderName, getMaximumFailoverElapsedSec, getName, getPassword, getProperties, getUsername, hasFailoverReverseGeocodeProvider, isEnabled, isReverseGeocodeFailoverMode, setAuthorization, setFailoverReverseGeocodeProvider, setName, setProperties, startReverseGeocodeFailoverMode, startReverseGeocodeFailoverMode, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.opengts.geocoder.ReverseGeocodeProvider
getFailoverReverseGeocodeProvider, getName, isEnabled, setFailoverReverseGeocodeProvider
 
Methods inherited from interface org.opengts.geocoder.GeocodeProvider
getName, isEnabled
 

Field Detail

HOST_PRIMARY

protected static java.lang.String HOST_PRIMARY

PROP_hostName

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

TIMEOUT_ReverseGeocode

protected static final int TIMEOUT_ReverseGeocode
See Also:
Constant Field Values

TIMEOUT_Geocode

protected static final int TIMEOUT_Geocode
See Also:
Constant Field Values

ENCODING_UTF8

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

TinyGeocoder

public TinyGeocoder(java.lang.String name,
                    java.lang.String key,
                    RTProperties rtProps)
Constructor

Parameters:
name - The name assigned to this ReverseGeocodeProvider
key - The optional authorization key
rtProps - The properties associated with this ReverseGeocodeProvider
Method Detail

isFastOperation

public boolean isFastOperation()
Returns true if locally resolved, false otherwise. (ie. remote address resolution takes more than 20ms to complete)

Specified by:
isFastOperation in interface GeocodeProvider
Specified by:
isFastOperation in interface ReverseGeocodeProvider
Overrides:
isFastOperation in class ReverseGeocodeProviderAdapter
Returns:
true if locally resolved, false otherwise.

getHostname

protected java.lang.String getHostname()
Gets the hostname

Returns:
The hostname

getReverseGeocodeTimeout

protected int getReverseGeocodeTimeout()
Returns the ReverseGeocode timeout


getReverseGeocode

public ReverseGeocode getReverseGeocode(GeoPoint gp,
                                        java.lang.String localStr,
                                        boolean cache)
Returns a ReverseGeocode instance for the specified GeoPoint

Specified by:
getReverseGeocode in interface ReverseGeocodeProvider
Specified by:
getReverseGeocode in class ReverseGeocodeProviderAdapter
Parameters:
gp - The GeoPoint
Returns:
The ReverseGeocode instance

getGeocodeTimeout

protected int getGeocodeTimeout()
Returns the Geocode timeout


getGeocode

public GeoPoint getGeocode(java.lang.String address,
                           java.lang.String country)
GeocodeProvider interface - Gets GeoPoint from address/country

Specified by:
getGeocode in interface GeocodeProvider
Parameters:
address - The address
country - The country code
Returns:
The GeoPoint

main

public static void main(java.lang.String[] argv)
Main entery point for debugging/testing