Package org.codice.ddf.spatial.geocoding
Interface GeoEntryExtractor
public interface GeoEntryExtractor
A
GeoEntryExtractor provides methods for extracting GeoEntry objects from various
GeoNames resources.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceAnExtractionCallbackprovides a method for receiving aGeoEntryobject that has been extracted from a resource. -
Method Summary
Modifier and TypeMethodDescriptiongetGeoEntries(String resource, ProgressCallback progressCallback) Extracts GeoNames entries from a resource asGeoEntryobjects, all at once, providing updates about the extraction progress.voidpushGeoEntriesToExtractionCallback(String resource, GeoEntryExtractor.ExtractionCallback extractionCallback) Extracts GeoNames entries from a resource asGeoEntryobjects and passes eachGeoEntryobject through the callbackextractionCallback.voidSets the url
-
Method Details
-
setUrl
Sets the url- Parameters:
url-
-
getGeoEntries
List<GeoEntry> getGeoEntries(String resource, ProgressCallback progressCallback) throws GeoEntryExtractionException, GeoNamesRemoteDownloadException Extracts GeoNames entries from a resource asGeoEntryobjects, all at once, providing updates about the extraction progress.- Parameters:
resource- the resource containing GeoNames entriesprogressCallback- the callback to receive updates about the extraction progress, may be null if you don't want any updates- Returns:
- the list of
GeoEntryobjects corresponding to the GeoNames entries in the resource - Throws:
GeoEntryExtractionException- if an error occurs while extracting GeoNames entries from the resourceGeoNamesRemoteDownloadException- if an error occurs while downloading from the resource
-
pushGeoEntriesToExtractionCallback
void pushGeoEntriesToExtractionCallback(String resource, GeoEntryExtractor.ExtractionCallback extractionCallback) throws GeoEntryExtractionException, GeoNamesRemoteDownloadException Extracts GeoNames entries from a resource asGeoEntryobjects and passes eachGeoEntryobject through the callbackextractionCallback. The callback is called exactly once for eachGeoEntryobject extracted from the resource.This method should be used instead of
getGeoEntries(String, ProgressCallback)if the resource contains a very large number of entries.- Parameters:
resource- the resource containing GeoNames entriesextractionCallback- the callback that receives each extractedGeoEntryobject, must not be null- Throws:
IllegalArgumentException- ifextractionCallbackis nullGeoEntryExtractionException- if an error occurs while extracting GeoNames entries from the resourceGeoNamesRemoteDownloadException- if an error occurs while downloading from the resource
-