Esri Geoportal Server
1.0

com.esri.gpt.catalog.lucene
Class Locator

java.lang.Object
  extended by com.esri.gpt.catalog.lucene.Locator

public class Locator
extends Object

Locator.


Nested Class Summary
static class Locator.Candidate
          Candidate.
static class Locator.ScoreComparator
          Score comparator.
 
Field Summary
protected  String url
          geolocator service URL
 
Constructor Summary
protected Locator()
          Creates instance of the locator.
 
Method Summary
 Locator.Candidate[] find(String text)
          Finds candidates.
protected  Locator.Candidate[] find(String address, String city, String state, String zip)
          Finds all candidates for the address.
 Locator.Candidate findBestCandidate(Locator.Candidate[] candidates)
          Finds best candidate from the array of candidates.
 Locator.Candidate findBestCandidate(Locator.Candidate[] candidates, Comparator<Locator.Candidate> comparator)
          Finds best candidate from the array of candidates.
protected  String makeQueryUrl(String address, String city, String state, String zip)
          Makes query URL.
static Locator newInstance()
          Creates new instance of the locator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

url

protected String url
geolocator service URL

Constructor Detail

Locator

protected Locator()
Creates instance of the locator.

Method Detail

newInstance

public static Locator newInstance()
Creates new instance of the locator.

Returns:
locator
Throws:
IllegalArgumentException - if "lucene.locatorClass" parameter is invalid

find

public Locator.Candidate[] find(String text)
                         throws IOException,
                                ParseException
Finds candidates.

Parameters:
text - address text
Returns:
array of candidates
Throws:
IOException - if accessing geolocator service fails
ParseException - if parsing address text fails

findBestCandidate

public Locator.Candidate findBestCandidate(Locator.Candidate[] candidates)
Finds best candidate from the array of candidates. Uses Locator.ScoreComparator.

Parameters:
candidates - array of candidates
Returns:
best candidate or null if no candidates can be found

findBestCandidate

public Locator.Candidate findBestCandidate(Locator.Candidate[] candidates,
                                           Comparator<Locator.Candidate> comparator)
Finds best candidate from the array of candidates.

Parameters:
candidates - array of candidates
comparator - comparator
Returns:
best candidate or null if no candidates can be found

find

protected Locator.Candidate[] find(String address,
                                   String city,
                                   String state,
                                   String zip)
                            throws IOException
Finds all candidates for the address.

Parameters:
address - address
city - city
state - state
zip - zip
Returns:
array of candidates
Throws:
IOException - if accessing geolocator service fails

makeQueryUrl

protected String makeQueryUrl(String address,
                              String city,
                              String state,
                              String zip)
Makes query URL.

Parameters:
address - address
city - city
state - state
zip - zip
Returns:
query url

Esri Geoportal Server
1.0

Copyright 2011 Environmental Systems Research Institute. All rights reserved. Use is subject to license terms.