org.opengts.geocoder
Class ReverseGeocodeProviderAdapter

java.lang.Object
  extended by org.opengts.geocoder.ReverseGeocodeProviderAdapter
All Implemented Interfaces:
ReverseGeocodeProvider
Direct Known Subclasses:
GeoNames, GisGraphy, GoogleGeocodeV2, Nominatim, TinyGeocoder

public abstract class ReverseGeocodeProviderAdapter
extends java.lang.Object
implements ReverseGeocodeProvider


Field Summary
static java.lang.String _PROP_isEnabled
           
static java.lang.String[] PROP_alwaysFast
           
static java.lang.String PROP_ReverseGeocodeProvider_
           
 
Constructor Summary
ReverseGeocodeProviderAdapter(java.lang.String name, java.lang.String key, RTProperties rtProps)
          Constructor
 
Method Summary
protected  java.lang.String[] _getUserPass()
          Parse and return the user name and password
static void _main()
           
 java.lang.String getAuthorization()
          Gets the authorization key of this ReverseGeocodeProvider
 java.lang.String getName()
          Gets the name of this ReverseGeocodeProvider
protected  java.lang.String getPassword()
          Return authorization password.
 RTProperties getProperties()
          Gets the properties for this ReverseGeocodeProvider
abstract  ReverseGeocode getReverseGeocode(GeoPoint gp, java.lang.String localeStr)
          Returns the best address for the specified GeoPoint
protected  java.lang.String getUsername()
          Return authorization username.
 boolean isEnabled()
          Returns true if this ReverseGeocodeProvider is enabled
 boolean isFastOperation()
          Returns true if this operation will take less than about 20ms to complete the returned value is used to determine whether the 'getReverseGeocode' operation should be performed immediately, or lazily (ie.
static void main(java.lang.String[] args)
           
 void setAuthorization(java.lang.String key)
          Sets the authorization key of this ReverseGeocodeProvider
 void setName(java.lang.String name)
          Sets the name of this ReverseGeocodeProvider
 void setProperties(RTProperties rtProps)
          Sets the properties for this ReverseGeocodeProvider
 java.lang.String toString()
          Returns a String representation of this instance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROP_ReverseGeocodeProvider_

public static final java.lang.String PROP_ReverseGeocodeProvider_
See Also:
Constant Field Values

_PROP_isEnabled

public static final java.lang.String _PROP_isEnabled
See Also:
Constant Field Values

PROP_alwaysFast

public static final java.lang.String[] PROP_alwaysFast
Constructor Detail

ReverseGeocodeProviderAdapter

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

Parameters:
name - The name of this reverse-geocode provider
key - The access key (may be null)
rtProps - The properties (may be null)
Method Detail

setName

public void setName(java.lang.String name)
Sets the name of this ReverseGeocodeProvider

Parameters:
name - The name of this reverse-geocode provider

getName

public java.lang.String getName()
Gets the name of this ReverseGeocodeProvider

Specified by:
getName in interface ReverseGeocodeProvider
Returns:
The name of this reverse-geocode provider

setAuthorization

public void setAuthorization(java.lang.String key)
Sets the authorization key of this ReverseGeocodeProvider

Parameters:
key - The key of this reverse-geocode provider

getAuthorization

public java.lang.String getAuthorization()
Gets the authorization key of this ReverseGeocodeProvider

Returns:
The access key of this reverse-geocode provider

_getUserPass

protected java.lang.String[] _getUserPass()
Parse and return the user name and password

Returns:
The username and password (always a 2 element array)

getUsername

protected java.lang.String getUsername()
Return authorization username. This assumes that the username and password are separated by a ':' character

Returns:
The username

getPassword

protected java.lang.String getPassword()
Return authorization password. This assumes that the username and password are separated by a ':' character

Returns:
The password

setProperties

public void setProperties(RTProperties rtProps)
Sets the properties for this ReverseGeocodeProvider

Parameters:
rtProps - The properties for this reverse-geocode provider

getProperties

public RTProperties getProperties()
Gets the properties for this ReverseGeocodeProvider

Returns:
The properties for this reverse-geocode provider

toString

public java.lang.String toString()
Returns a String representation of this instance

Overrides:
toString in class java.lang.Object
Returns:
A String representation of this instance

isEnabled

public boolean isEnabled()
Returns true if this ReverseGeocodeProvider is enabled

Specified by:
isEnabled in interface ReverseGeocodeProvider
Returns:
True if enabled

isFastOperation

public boolean isFastOperation()
Description copied from interface: ReverseGeocodeProvider
Returns true if this operation will take less than about 20ms to complete the returned value is used to determine whether the 'getReverseGeocode' operation should be performed immediately, or lazily (ie. in a separate thread).

Specified by:
isFastOperation in interface ReverseGeocodeProvider
Returns:
True if this is a fast (ie. local) operation

getReverseGeocode

public abstract ReverseGeocode getReverseGeocode(GeoPoint gp,
                                                 java.lang.String localeStr)
Description copied from interface: ReverseGeocodeProvider
Returns the best address for the specified GeoPoint

Specified by:
getReverseGeocode in interface ReverseGeocodeProvider
Returns:
The reverse-geocoded adress

_main

public static void _main()

main

public static void main(java.lang.String[] args)