public class UploadPrimitivesTask extends AbstractUploadTask
Modifier and Type | Field and Description |
---|---|
private Changeset |
changeset |
private java.lang.Exception |
lastException |
private OsmDataLayer |
layer |
private java.util.Set<IPrimitive> |
processedPrimitives |
private UploadStrategySpecification |
strategy |
private APIDataSet |
toUpload |
private boolean |
uploadCanceled |
private OsmServerWriter |
writer |
progressMonitor
Constructor and Description |
---|
UploadPrimitivesTask(UploadStrategySpecification strategy,
OsmDataLayer layer,
APIDataSet toUpload,
Changeset changeset)
Creates the task
|
Modifier and Type | Method and Description |
---|---|
protected MaxChangesetSizeExceededPolicy |
askMaxChangesetSizeExceedsPolicy() |
protected void |
cancel()
User pressed cancel button.
|
protected void |
cleanupAfterUpload() |
private void |
closeChangesetIfRequired() |
protected void |
finish()
Finish up the data work.
|
protected void |
openNewChangeset()
Opens a new changeset.
|
protected void |
realRun()
Called in the worker thread to do the actual work.
|
protected boolean |
recoverFromChangesetFullException() |
protected void |
recoverFromGoneOnServer(OsmApiPrimitiveGoneException e,
ProgressMonitor monitor)
Retries to recover the upload operation from an exception which was thrown because
an uploaded primitive was already deleted on the server.
|
handleFailedUpload, handleGone, handlePreconditionFailed, handleUploadConflict, handleUploadConflictForClosedChangeset, handleUploadConflictForKnownConflict, handleUploadConflictForUnknownConflict, handleUploadPreconditionFailedConflict, synchronizeDataSet, synchronizePrimitive
afterFinish, canRunInBackground, getProgressMonitor, operationCanceled, run
private boolean uploadCanceled
private java.lang.Exception lastException
private final APIDataSet toUpload
private OsmServerWriter writer
private final OsmDataLayer layer
private final java.util.Set<IPrimitive> processedPrimitives
private final UploadStrategySpecification strategy
public UploadPrimitivesTask(UploadStrategySpecification strategy, OsmDataLayer layer, APIDataSet toUpload, Changeset changeset)
strategy
- the upload strategy. Must not be null.layer
- the OSM data layer for which data is uploaded. Must not be null.toUpload
- the collection of primitives to upload. Set to the empty collection if null.changeset
- the changeset to use for uploading. Must not be null. changeset.getId()
can be 0 in which case the upload task creates a new changesetjava.lang.IllegalArgumentException
- if layer is nulljava.lang.IllegalArgumentException
- if toUpload is nulljava.lang.IllegalArgumentException
- if strategy is nulljava.lang.IllegalArgumentException
- if changeset is nullprotected MaxChangesetSizeExceededPolicy askMaxChangesetSizeExceedsPolicy()
protected void openNewChangeset()
protected boolean recoverFromChangesetFullException() throws OsmTransferException
OsmTransferException
protected void recoverFromGoneOnServer(OsmApiPrimitiveGoneException e, ProgressMonitor monitor) throws OsmTransferException
e
- the exception throw by the APImonitor
- a progress monitorOsmTransferException
- if we can't recover from the exceptionprotected void cleanupAfterUpload()
protected void realRun()
PleaseWaitRunnable
realRun
in class PleaseWaitRunnable
private void closeChangesetIfRequired() throws OsmTransferException
OsmTransferException
protected void finish()
PleaseWaitRunnable
finish
in class PleaseWaitRunnable
protected void cancel()
PleaseWaitRunnable
cancel
in class PleaseWaitRunnable