org.openstreetmap.josm.gui.io
Class UploadPrimitivesTask
java.lang.Object
org.openstreetmap.josm.gui.PleaseWaitRunnable
org.openstreetmap.josm.gui.io.AbstractUploadTask
org.openstreetmap.josm.gui.io.UploadPrimitivesTask
- All Implemented Interfaces:
- java.lang.Runnable, ProgressMonitor.CancelListener
public class UploadPrimitivesTask
- extends AbstractUploadTask
The task for uploading a collection of primitives
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
uploadCanceled
private boolean uploadCanceled
lastException
private java.lang.Exception lastException
toUpload
private APIDataSet toUpload
writer
private OsmServerWriter writer
layer
private OsmDataLayer layer
changeset
private Changeset changeset
processedPrimitives
private java.util.HashSet<IPrimitive> processedPrimitives
strategy
private UploadStrategySpecification strategy
UploadPrimitivesTask
public UploadPrimitivesTask(UploadStrategySpecification strategy,
OsmDataLayer layer,
APIDataSet toUpload,
Changeset changeset)
- Creates the task
- Parameters:
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 changeset
- Throws:
java.lang.IllegalArgumentException
- thrown if layer is null
java.lang.IllegalArgumentException
- thrown if toUpload is null
java.lang.IllegalArgumentException
- thrown if strategy is null
java.lang.IllegalArgumentException
- thrown if changeset is null
askMaxChangesetSizeExceedsPolicy
protected MaxChangesetSizeExceededPolicy askMaxChangesetSizeExceedsPolicy()
openNewChangeset
protected void openNewChangeset()
recoverFromChangesetFullException
protected boolean recoverFromChangesetFullException()
recoverFromGoneOnServer
protected void recoverFromGoneOnServer(OsmApiPrimitiveGoneException e,
ProgressMonitor monitor)
throws OsmTransferException
- Retries to recover the upload operation from an exception which was thrown because
an uploaded primitive was already deleted on the server.
- Parameters:
e
- the exception throw by the APImonitor
- a progress monitor
- Throws:
OsmTransferException
- thrown if we can't recover from the exception
cleanupAfterUpload
protected void cleanupAfterUpload()
realRun
protected void realRun()
throws org.xml.sax.SAXException,
java.io.IOException
- Description copied from class:
PleaseWaitRunnable
- Called in the worker thread to do the actual work. When any of the
exception is thrown, a message box will be displayed and closeDialog
is called. finish() is called in any case.
- Specified by:
realRun
in class PleaseWaitRunnable
- Throws:
org.xml.sax.SAXException
java.io.IOException
finish
protected void finish()
- Description copied from class:
PleaseWaitRunnable
- Finish up the data work. Is guaranteed to be called if realRun is called.
Finish is called in the gui thread just after the dialog disappeared.
- Specified by:
finish
in class PleaseWaitRunnable
cancel
protected void cancel()
- Description copied from class:
PleaseWaitRunnable
- User pressed cancel button.
- Specified by:
cancel
in class PleaseWaitRunnable
JOSM