protected static class MultiFetchServerObjectReader.Fetcher extends OsmServerReader implements java.util.concurrent.Callable<MultiFetchServerObjectReader.FetchResult>
MultiFetchServerObjectReader
(one per set of primitives to fetch).
The inheritance of OsmServerReader
is only explained by the need to have a distinct OSM connection by Fetcher
instance.MultiFetchServerObjectReader.FetchResult
Modifier and Type | Field and Description |
---|---|
private java.util.Set<java.lang.Long> |
pkg |
private ProgressMonitor |
progressMonitor |
private OsmPrimitiveType |
type |
gpxParsedProperly
activeConnection, cancel, oauthParameters
Constructor and Description |
---|
Fetcher(OsmPrimitiveType type,
java.util.Set<java.lang.Long> idsPackage,
ProgressMonitor progressMonitor)
Constructs a
Fetcher |
Modifier and Type | Method and Description |
---|---|
MultiFetchServerObjectReader.FetchResult |
call() |
protected MultiFetchServerObjectReader.FetchResult |
fetch(ProgressMonitor progressMonitor)
fetches the requested primitives and updates the specified progress monitor.
|
protected MultiFetchServerObjectReader.FetchResult |
multiGetIdPackage(OsmPrimitiveType type,
java.util.Set<java.lang.Long> pkg,
ProgressMonitor progressMonitor)
invokes a Multi Get for a set of ids and a given
OsmPrimitiveType . |
DataSet |
parseOsm(ProgressMonitor progressMonitor)
Download OSM files from somewhere
|
protected DataSet |
singleGetId(OsmPrimitiveType type,
long id,
ProgressMonitor progressMonitor)
invokes a Multi Get for a single id and a given
OsmPrimitiveType . |
protected MultiFetchServerObjectReader.FetchResult |
singleGetIdPackage(OsmPrimitiveType type,
java.util.Set<java.lang.Long> pkg,
ProgressMonitor progressMonitor)
invokes a sequence of Multi Gets for individual ids in a set of ids and a given
OsmPrimitiveType . |
getBaseUrl, getInputStream, getInputStream, getInputStreamRaw, getInputStreamRaw, getInputStreamRaw, isDoAuthenticate, isGpxParsedProperly, parseNotes, parseOsmBzip2, parseOsmChange, parseOsmChangeBzip2, parseOsmChangeGzip, parseOsmGzip, parseOsmZip, parseRawGps, parseRawGpsBzip2, parseRawNotes, parseRawNotesBzip2, setDoAuthenticate
addAuth, addBasicAuthorizationHeader, addOAuthAuthorizationHeader, cancel, isCanceled
private final java.util.Set<java.lang.Long> pkg
private final OsmPrimitiveType type
private final ProgressMonitor progressMonitor
public Fetcher(OsmPrimitiveType type, java.util.Set<java.lang.Long> idsPackage, ProgressMonitor progressMonitor)
Fetcher
public DataSet parseOsm(ProgressMonitor progressMonitor) throws OsmTransferException
OsmServerReader
parseOsm
in class OsmServerReader
progressMonitor
- The progress monitorOsmTransferException
- if any error occurspublic MultiFetchServerObjectReader.FetchResult call() throws java.lang.Exception
call
in interface java.util.concurrent.Callable<MultiFetchServerObjectReader.FetchResult>
java.lang.Exception
protected MultiFetchServerObjectReader.FetchResult fetch(ProgressMonitor progressMonitor) throws OsmTransferException
progressMonitor
- the progress monitorMultiFetchServerObjectReader.FetchResult
of this operationOsmTransferException
- if an error occurs while communicating with the API serverprotected MultiFetchServerObjectReader.FetchResult multiGetIdPackage(OsmPrimitiveType type, java.util.Set<java.lang.Long> pkg, ProgressMonitor progressMonitor) throws OsmTransferException
OsmPrimitiveType
.
The retrieved primitives are merged to MultiFetchServerObjectReader.outputDataSet
.type
- The primitive type. Must be one of NODE
, WAY
, RELATION
pkg
- the package of idsMultiFetchServerObjectReader.FetchResult
of this operationOsmTransferException
- if an error occurs while communicating with the API serverprotected DataSet singleGetId(OsmPrimitiveType type, long id, ProgressMonitor progressMonitor) throws OsmTransferException
OsmPrimitiveType
.
The retrieved primitive is merged to MultiFetchServerObjectReader.outputDataSet
.type
- The primitive type. Must be one of NODE
, WAY
, RELATION
id
- the idDataSet
resulting of this operationOsmTransferException
- if an error occurs while communicating with the API serverprotected MultiFetchServerObjectReader.FetchResult singleGetIdPackage(OsmPrimitiveType type, java.util.Set<java.lang.Long> pkg, ProgressMonitor progressMonitor) throws OsmTransferException
OsmPrimitiveType
.
The retrieved primitives are merged to MultiFetchServerObjectReader.outputDataSet
.
This method is used if one of the ids in pkg doesn't exist (the server replies with return code 404).
If the set is fetched with this method it is possible to find out which of the ids doesn't exist.
Unfortunately, the server does not provide an error header or an error body for a 404 reply.type
- The primitive type. Must be one of NODE
, WAY
, RELATION
pkg
- the set of idsMultiFetchServerObjectReader.FetchResult
of this operationOsmTransferException
- if an error occurs while communicating with the API server