org.openstreetmap.josm.gui.io
Class UploadLayerTask
java.lang.Object
org.openstreetmap.josm.gui.io.AbstractIOTask
org.openstreetmap.josm.gui.io.UploadLayerTask
- All Implemented Interfaces:
- java.lang.Runnable
class UploadLayerTask
- extends AbstractIOTask
- implements java.lang.Runnable
UploadLayerTask uploads the data managed by an OsmDataLayer
asynchronously.
ExecutorService executorService = ...
UploadLayerTask task = new UploadLayerTask(layer, monitor);
Future> taskFuture = executorServce.submit(task)
try {
// wait for the task to complete
taskFuture.get();
} catch(Exception e) {
e.printStackTracek();
}
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
writer
private OsmServerWriter writer
layer
private OsmDataLayer layer
monitor
private ProgressMonitor monitor
changeset
private Changeset changeset
toUpload
private java.util.Collection<OsmPrimitive> toUpload
processedPrimitives
private java.util.HashSet<IPrimitive> processedPrimitives
strategy
private UploadStrategySpecification strategy
UploadLayerTask
public UploadLayerTask(UploadStrategySpecification strategy,
OsmDataLayer layer,
ProgressMonitor monitor,
Changeset changeset)
- Creates the upload task
- Parameters:
strategy
- the upload strategy specificationlayer
- the layer. Must not be null.monitor
- a progress monitor. If monitor is null, uses NullProgressMonitor.INSTANCE
changeset
- the changeset to be used
- Throws:
java.lang.IllegalArgumentException
- thrown, if layer is null
java.lang.IllegalArgumentException
- thrown if strategy is null
getPrimitive
protected OsmPrimitive getPrimitive(OsmPrimitiveType type,
long id)
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
run
public void run()
- Description copied from class:
AbstractIOTask
- Runs the task
- Specified by:
run
in interface java.lang.Runnable
- Specified by:
run
in class AbstractIOTask
cancel
public void cancel()
- Description copied from class:
AbstractIOTask
- Cancel the task
- Specified by:
cancel
in class AbstractIOTask
JOSM