Package 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:
Runnable
UploadLayerTask uploads the data managed by an
OsmDataLayer asynchronously.
ExecutorService executorService = ...
UploadLayerTask task = new UploadLayerTask(layer, monitor);
Future<?> taskFuture = executorService.submit(task)
try {
// wait for the task to complete
taskFuture.get();
} catch (Exception e) {
e.printStackTrace();
}
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Changesetprivate final OsmDataLayerprivate final ProgressMonitorprivate final Set<IPrimitive>private final UploadStrategySpecificationprivate Collection<OsmPrimitive>private OsmServerWriter -
Constructor Summary
ConstructorsConstructorDescriptionUploadLayerTask(UploadStrategySpecification strategy, OsmDataLayer layer, ProgressMonitor monitor, Changeset changeset) Creates the upload task -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()Cancel the taskprotected OsmPrimitivegetPrimitive(OsmPrimitiveType type, long id) protected voidRetries to recover the upload operation from an exception which was thrown because an uploaded primitive was already deleted on the server.voidrun()Methods inherited from class org.openstreetmap.josm.gui.io.AbstractIOTask
getLastException, isCanceled, isFailed, isSuccessful, setCanceled, setFailed, setLastException
-
Field Details
-
writer
-
layer
-
monitor
-
changeset
-
toUpload
-
processedPrimitives
-
strategy
-
-
Constructor Details
-
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, usesNullProgressMonitor.INSTANCEchangeset- the changeset to be used- Throws:
IllegalArgumentException- if layer is nullIllegalArgumentException- if strategy is null
-
-
Method Details
-
getPrimitive
-
recoverFromGoneOnServer
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 API- Throws:
OsmTransferException- if we can't recover from the exception
-
run
-
cancel
Description copied from class:AbstractIOTaskCancel the task- Specified by:
cancelin classAbstractIOTask
-