Package org.openstreetmap.josm.io
Class OsmServerObjectReader
- java.lang.Object
-
- org.openstreetmap.josm.io.OsmConnection
-
- org.openstreetmap.josm.io.OsmServerReader
-
- org.openstreetmap.josm.io.OsmServerObjectReader
-
public class OsmServerObjectReader extends OsmServerReader
OsmServerObjectReader reads an individual object from the OSM server. It can either download the object including or not including its immediate children. The former case is called a "full download". It can also download a specific version of the object (however, "full" download is not possible in that case).
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.openstreetmap.josm.io.OsmServerReader
OsmServerReader.DomParser<R>
-
Nested classes/interfaces inherited from class org.openstreetmap.josm.io.OsmConnection
OsmConnection.OAuthAccessTokenFetcher
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
full
true if a full download is required, i.e.private PrimitiveId
id
the id of the object to downloadprivate int
version
the specific version number, if required (incompatible with full), or -1 else-
Fields inherited from class org.openstreetmap.josm.io.OsmServerReader
contentType, gpxParsedProperly
-
Fields inherited from class org.openstreetmap.josm.io.OsmConnection
activeConnection, cancel, fetcher, oAuth20Parameters
-
-
Constructor Summary
Constructors Modifier Constructor Description OsmServerObjectReader(long id, OsmPrimitiveType type, boolean full)
Creates a new server object reader for a given id and a primitive type.protected
OsmServerObjectReader(long id, OsmPrimitiveType type, boolean full, int version)
OsmServerObjectReader(long id, OsmPrimitiveType type, int version)
Creates a new server object reader for a given id and a primitive type.OsmServerObjectReader(PrimitiveId id, boolean full)
Creates a new server object reader for an object with the givenid
protected
OsmServerObjectReader(PrimitiveId id, boolean full, int version)
OsmServerObjectReader(PrimitiveId id, int version)
Creates a new server object reader for an object with the givenid
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DataSet
parseOsm(ProgressMonitor progressMonitor)
Downloads and parses the data.-
Methods inherited from class org.openstreetmap.josm.io.OsmServerReader
adaptRequest, fetchData, getAttribute, getBaseUrl, getInputStream, getInputStream, getInputStreamRaw, getInputStreamRaw, getInputStreamRaw, getInputStreamRaw, isDoAuthenticate, isGpxParsedProperly, parseNotes, parseOsm, parseOsmChange, parseOsmChange, parseRawGps, parseRawGps, parseRawNotes, parseRawNotes, setDoAuthenticate
-
Methods inherited from class org.openstreetmap.josm.io.OsmConnection
addAuth, addBasicAuthorizationHeader, addOAuth20AuthorizationHeader, cancel, isCanceled, retrieveBasicAuthorizationLogin, setOAuthAccessTokenFetcher
-
-
-
-
Field Detail
-
id
private final PrimitiveId id
the id of the object to download
-
full
private final boolean full
true if a full download is required, i.e. a download including the immediate children
-
version
private final int version
the specific version number, if required (incompatible with full), or -1 else
-
-
Constructor Detail
-
OsmServerObjectReader
public OsmServerObjectReader(long id, OsmPrimitiveType type, boolean full)
Creates a new server object reader for a given id and a primitive type.- Parameters:
id
- the object id. > 0 required.type
- the type. Must not be null.full
- true, if a full download is requested (i.e. a download including immediate children); false, otherwise- Throws:
java.lang.IllegalArgumentException
- if id <= 0java.lang.IllegalArgumentException
- if type is null
-
OsmServerObjectReader
public OsmServerObjectReader(long id, OsmPrimitiveType type, int version)
Creates a new server object reader for a given id and a primitive type.- Parameters:
id
- the object id. > 0 required.type
- the type. Must not be null.version
- the specific version number, if required; -1, otherwise- Throws:
java.lang.IllegalArgumentException
- if id <= 0java.lang.IllegalArgumentException
- if type is null
-
OsmServerObjectReader
protected OsmServerObjectReader(long id, OsmPrimitiveType type, boolean full, int version)
-
OsmServerObjectReader
public OsmServerObjectReader(PrimitiveId id, boolean full)
Creates a new server object reader for an object with the givenid
- Parameters:
id
- the object id. Must not be null. Unique id > 0 required.full
- true, if a full download is requested (i.e. a download including immediate children); false, otherwise- Throws:
java.lang.IllegalArgumentException
- if id is nulljava.lang.IllegalArgumentException
- if id.getUniqueId() <= 0
-
OsmServerObjectReader
public OsmServerObjectReader(PrimitiveId id, int version)
Creates a new server object reader for an object with the givenid
- Parameters:
id
- the object id. Must not be null. Unique id > 0 required.version
- the specific version number, if required; -1, otherwise- Throws:
java.lang.IllegalArgumentException
- if id is nulljava.lang.IllegalArgumentException
- if id.getUniqueId() <= 0
-
OsmServerObjectReader
protected OsmServerObjectReader(PrimitiveId id, boolean full, int version)
-
-
Method Detail
-
parseOsm
public DataSet parseOsm(ProgressMonitor progressMonitor) throws OsmTransferException
Downloads and parses the data.- Specified by:
parseOsm
in classOsmServerReader
- Parameters:
progressMonitor
- the progress monitor. Set toNullProgressMonitor.INSTANCE
if null- Returns:
- the downloaded data
- Throws:
OsmTransferException
- if any error occurs during dialog with OSM API
-
-