org.openstreetmap.josm.io
Class OsmServerObjectReader

java.lang.Object
  extended by org.openstreetmap.josm.io.OsmConnection
      extended by org.openstreetmap.josm.io.OsmServerReader
          extended by 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).


Field Summary
private  boolean full
          true if a full download is required, i.e.
private  PrimitiveId id
          the id of the object to download
private  int version
          the specific version number, if required (incompatible with full), or -1 else
 
Fields inherited from class org.openstreetmap.josm.io.OsmConnection
activeConnection, cancel, oauthParameters
 
Constructor Summary
  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 given id
protected OsmServerObjectReader(PrimitiveId id, boolean full, int version)
           
  OsmServerObjectReader(PrimitiveId id, int version)
          Creates a new server object reader for an object with the given id
 
Method Summary
 DataSet parseOsm(ProgressMonitor progressMonitor)
          Downloads and parses the data.
 
Methods inherited from class org.openstreetmap.josm.io.OsmServerReader
getBaseUrl, getInputStream, getInputStreamRaw, isDoAuthenticate, parseOsmBzip2, parseOsmChange, parseOsmChangeBzip2, parseOsmChangeGzip, parseOsmGzip, parseRawGps, setDoAuthenticate
 
Methods inherited from class org.openstreetmap.josm.io.OsmConnection
addAuth, addBasicAuthorizationHeader, addOAuthAuthorizationHeader, cancel, isCanceled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

private PrimitiveId id
the id of the object to download


full

private boolean full
true if a full download is required, i.e. a download including the immediate children


version

private 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)
                      throws java.lang.IllegalArgumentException
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 - thrown if id <= 0
java.lang.IllegalArgumentException - thrown if type is null

OsmServerObjectReader

public OsmServerObjectReader(long id,
                             OsmPrimitiveType type,
                             int version)
                      throws java.lang.IllegalArgumentException
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 - thrown if id <= 0
java.lang.IllegalArgumentException - thrown if type is null

OsmServerObjectReader

protected OsmServerObjectReader(long id,
                                OsmPrimitiveType type,
                                boolean full,
                                int version)
                         throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

OsmServerObjectReader

public OsmServerObjectReader(PrimitiveId id,
                             boolean full)
Creates a new server object reader for an object with the given id

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 - thrown if id is null
java.lang.IllegalArgumentException - thrown if id.getUniqueId() <= 0

OsmServerObjectReader

public OsmServerObjectReader(PrimitiveId id,
                             int version)
Creates a new server object reader for an object with the given id

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 - thrown if id is null
java.lang.IllegalArgumentException - thrown 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 class OsmServerReader
Parameters:
progressMonitor - the progress monitor. Set to NullProgressMonitor.INSTANCE if null
Returns:
the downloaded data
Throws:
org.xml.sax.SAXException
java.io.IOException
OsmTransferException


JOSM