public abstract class OsmServerReader extends OsmConnection
Modifier and Type | Field and Description |
---|---|
private OsmApi |
api |
private boolean |
doAuthenticate |
protected boolean |
gpxParsedProperly |
activeConnection, cancel, oauthParameters
Constructor and Description |
---|
OsmServerReader() |
Modifier and Type | Method and Description |
---|---|
protected void |
adaptRequest(HttpClient request)
Allows subclasses to modify the request.
|
private static java.lang.String |
fetchResponseText(HttpClient.Response response) |
protected java.lang.String |
getBaseUrl()
Return the base URL for relative URL requests
|
protected java.io.InputStream |
getInputStream(java.lang.String urlStr,
ProgressMonitor progressMonitor)
Open a connection to the given url and return a reader on the input stream
from that connection.
|
protected java.io.InputStream |
getInputStream(java.lang.String urlStr,
ProgressMonitor progressMonitor,
java.lang.String reason)
Open a connection to the given url and return a reader on the input stream
from that connection.
|
protected java.io.InputStream |
getInputStreamRaw(java.lang.String urlStr,
ProgressMonitor progressMonitor)
Open a connection to the given url and return a reader on the input stream
from that connection.
|
protected java.io.InputStream |
getInputStreamRaw(java.lang.String urlStr,
ProgressMonitor progressMonitor,
java.lang.String reason)
Open a connection to the given url and return a reader on the input stream
from that connection.
|
protected java.io.InputStream |
getInputStreamRaw(java.lang.String urlStr,
ProgressMonitor progressMonitor,
java.lang.String reason,
boolean uncompressAccordingToContentDisposition)
Open a connection to the given url and return a reader on the input stream
from that connection.
|
boolean |
isDoAuthenticate()
Returns true if this reader is adding authentication credentials to the read
request sent to the server.
|
boolean |
isGpxParsedProperly()
Determines if the GPX data has been parsed properly.
|
java.util.List<Note> |
parseNotes(int noteLimit,
int daysClosed,
ProgressMonitor progressMonitor)
Downloads notes from the API, given API limit parameters
|
abstract DataSet |
parseOsm(ProgressMonitor progressMonitor)
Download OSM files from somewhere
|
DataSet |
parseOsmBzip2(ProgressMonitor progressMonitor)
Download BZip2-compressed OSM files from somewhere
|
DataSet |
parseOsmChange(ProgressMonitor progressMonitor)
Download OSM Change files from somewhere
|
DataSet |
parseOsmChangeBzip2(ProgressMonitor progressMonitor)
Download BZip2-compressed OSM Change files from somewhere
|
DataSet |
parseOsmChangeGzip(ProgressMonitor progressMonitor)
Download GZip-compressed OSM Change files from somewhere
|
DataSet |
parseOsmGzip(ProgressMonitor progressMonitor)
Download GZip-compressed OSM files from somewhere
|
DataSet |
parseOsmZip(ProgressMonitor progressMonitor)
Download Zip-compressed OSM files from somewhere
|
GpxData |
parseRawGps(ProgressMonitor progressMonitor)
Retrieve raw gps waypoints from the server API.
|
GpxData |
parseRawGpsBzip2(ProgressMonitor progressMonitor)
Retrieve BZip2-compressed GPX files from somewhere.
|
java.util.List<Note> |
parseRawNotes(ProgressMonitor progressMonitor)
Downloads notes from a given raw URL.
|
java.util.List<Note> |
parseRawNotesBzip2(ProgressMonitor progressMonitor)
Download notes from a URL that contains a bzip2 compressed notes dump file
|
void |
setDoAuthenticate(boolean doAuthenticate)
Sets whether this reader adds authentication credentials to the read
request sent to the server.
|
addAuth, addBasicAuthorizationHeader, addOAuthAuthorizationHeader, cancel, isCanceled, obtainAccessToken
private boolean doAuthenticate
protected boolean gpxParsedProperly
public OsmServerReader()
protected java.io.InputStream getInputStream(java.lang.String urlStr, ProgressMonitor progressMonitor) throws OsmTransferException
null
.
Relative URL's are directed to API base URL.urlStr
- The url to connect to.progressMonitor
- progress monitoring and abort handlernull
.OsmTransferException
- if data transfer errors occurprotected java.io.InputStream getInputStream(java.lang.String urlStr, ProgressMonitor progressMonitor, java.lang.String reason) throws OsmTransferException
null
.
Relative URL's are directed to API base URL.urlStr
- The url to connect to.progressMonitor
- progress monitoring and abort handlerreason
- The reason to show on console. Can be null
if no reason is givennull
.OsmTransferException
- if data transfer errors occurprotected java.lang.String getBaseUrl()
protected java.io.InputStream getInputStreamRaw(java.lang.String urlStr, ProgressMonitor progressMonitor) throws OsmTransferException
null
.urlStr
- The exact url to connect to.progressMonitor
- progress monitoring and abort handlernull
.OsmTransferException
- if data transfer errors occurprotected java.io.InputStream getInputStreamRaw(java.lang.String urlStr, ProgressMonitor progressMonitor, java.lang.String reason) throws OsmTransferException
null
.urlStr
- The exact url to connect to.progressMonitor
- progress monitoring and abort handlerreason
- The reason to show on console. Can be null
if no reason is givennull
.OsmTransferException
- if data transfer errors occurprotected java.io.InputStream getInputStreamRaw(java.lang.String urlStr, ProgressMonitor progressMonitor, java.lang.String reason, boolean uncompressAccordingToContentDisposition) throws OsmTransferException
null
.urlStr
- The exact url to connect to.progressMonitor
- progress monitoring and abort handlerreason
- The reason to show on console. Can be null
if no reason is givenuncompressAccordingToContentDisposition
- Whether to inspect the HTTP header Content-Disposition
for filename
and uncompress a gzip/bzip2 stream.null
.OsmTransferException
- if data transfer errors occurprivate static java.lang.String fetchResponseText(HttpClient.Response response)
protected void adaptRequest(HttpClient request)
request
- the prepared requestpublic abstract DataSet parseOsm(ProgressMonitor progressMonitor) throws OsmTransferException
progressMonitor
- The progress monitorOsmTransferException
- if any error occurspublic DataSet parseOsmChange(ProgressMonitor progressMonitor) throws OsmTransferException
progressMonitor
- The progress monitorOsmTransferException
- if any error occurspublic DataSet parseOsmChangeBzip2(ProgressMonitor progressMonitor) throws OsmTransferException
progressMonitor
- The progress monitorOsmTransferException
- if any error occurspublic DataSet parseOsmChangeGzip(ProgressMonitor progressMonitor) throws OsmTransferException
progressMonitor
- The progress monitorOsmTransferException
- if any error occurspublic GpxData parseRawGps(ProgressMonitor progressMonitor) throws OsmTransferException
progressMonitor
- The progress monitorOsmTransferException
- if any error occurspublic GpxData parseRawGpsBzip2(ProgressMonitor progressMonitor) throws OsmTransferException
progressMonitor
- The progress monitorOsmTransferException
- if any error occurspublic DataSet parseOsmBzip2(ProgressMonitor progressMonitor) throws OsmTransferException
progressMonitor
- The progress monitorOsmTransferException
- if any error occurspublic DataSet parseOsmGzip(ProgressMonitor progressMonitor) throws OsmTransferException
progressMonitor
- The progress monitorOsmTransferException
- if any error occurspublic DataSet parseOsmZip(ProgressMonitor progressMonitor) throws OsmTransferException
progressMonitor
- The progress monitorOsmTransferException
- if any error occurspublic boolean isDoAuthenticate()
public void setDoAuthenticate(boolean doAuthenticate)
doAuthenticate
- true if this reader adds authentication credentials to the read
request sent to the serverpublic final boolean isGpxParsedProperly()
GpxReader.parse(boolean)
public java.util.List<Note> parseNotes(int noteLimit, int daysClosed, ProgressMonitor progressMonitor) throws OsmTransferException
noteLimit
- How many notes to download.daysClosed
- Return notes closed this many days in the past. -1 means all notes, ever. 0 means only unresolved notes.progressMonitor
- Progress monitor for user feedbackOsmTransferException
- if any errors happenpublic java.util.List<Note> parseRawNotes(ProgressMonitor progressMonitor) throws OsmTransferException
progressMonitor
- progress monitorOsmTransferException
- if any error occurs during dialog with OSM APIpublic java.util.List<Note> parseRawNotesBzip2(ProgressMonitor progressMonitor) throws OsmTransferException
progressMonitor
- progress monitorOsmTransferException
- if any error occurs during dialog with OSM API