org.openstreetmap.josm.gui.io
Class AbstractUploadTask

java.lang.Object
  extended by org.openstreetmap.josm.gui.PleaseWaitRunnable
      extended by org.openstreetmap.josm.gui.io.AbstractUploadTask
All Implemented Interfaces:
java.lang.Runnable, ProgressMonitor.CancelListener
Direct Known Subclasses:
UploadPrimitivesTask

public abstract class AbstractUploadTask
extends PleaseWaitRunnable


Field Summary
 
Fields inherited from class org.openstreetmap.josm.gui.PleaseWaitRunnable
progressMonitor
 
Constructor Summary
AbstractUploadTask(java.lang.String title)
           
AbstractUploadTask(java.lang.String title, boolean ignoreException)
           
AbstractUploadTask(java.lang.String title, ProgressMonitor progressMonitor, boolean ignoreException)
           
 
Method Summary
protected  void handleFailedUpload(java.lang.Exception e)
          error handler for any exception thrown during upload
protected  void handleGone(OsmApiPrimitiveGoneException e)
          Handles an error which is caused by a delete request for an already deleted OsmPrimitive on the server, i.e.
protected  void handlePreconditionFailed(OsmApiException e)
          handles an precondition failed conflict, i.e.
protected  void handleUploadConflict(OsmApiException e)
          handles an upload conflict, i.e.
protected  void handleUploadConflictForClosedChangeset(long changesetId, java.util.Date d)
          Handles the case that a conflict was detected while uploading where we don't know what OsmPrimitive actually caused the conflict (for whatever reason)
protected  void handleUploadConflictForKnownConflict(OsmPrimitiveType primitiveType, long id, java.lang.String serverVersion, java.lang.String myVersion)
          Handles the case that a conflict in a specific OsmPrimitive was detected while uploading
protected  void handleUploadConflictForUnknownConflict()
          Handles the case that a conflict was detected while uploading where we don't know what OsmPrimitive actually caused the conflict (for whatever reason)
protected  void handleUploadPreconditionFailedConflict(OsmApiException e, Pair<OsmPrimitive,java.util.Collection<OsmPrimitive>> conflict)
          Handles the case where deleting a node failed because it is still in use in a non-deleted way on the server.
protected  void synchronizeDataSet()
          Synchronizes the local state of the dataset with the state on the server.
protected  void synchronizePrimitive(OsmPrimitiveType type, long id)
          Synchronizes the local state of an OsmPrimitive with its state on the server.
 
Methods inherited from class org.openstreetmap.josm.gui.PleaseWaitRunnable
afterFinish, cancel, canRunInBackground, finish, getProgressMonitor, operationCanceled, realRun, run
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractUploadTask

public AbstractUploadTask(java.lang.String title,
                          boolean ignoreException)

AbstractUploadTask

public AbstractUploadTask(java.lang.String title,
                          ProgressMonitor progressMonitor,
                          boolean ignoreException)

AbstractUploadTask

public AbstractUploadTask(java.lang.String title)
Method Detail

synchronizePrimitive

protected void synchronizePrimitive(OsmPrimitiveType type,
                                    long id)
Synchronizes the local state of an OsmPrimitive with its state on the server. The method uses an individual GET for the primitive.

Parameters:
id - the primitive ID

synchronizeDataSet

protected void synchronizeDataSet()
Synchronizes the local state of the dataset with the state on the server. Reuses the functionality of UpdateDataAction.

See Also:
UpdateDataAction.actionPerformed(ActionEvent)

handleUploadConflictForKnownConflict

protected void handleUploadConflictForKnownConflict(OsmPrimitiveType primitiveType,
                                                    long id,
                                                    java.lang.String serverVersion,
                                                    java.lang.String myVersion)
Handles the case that a conflict in a specific OsmPrimitive was detected while uploading

Parameters:
primitiveType - the type of the primitive, either node, way or relation
id - the id of the primitive
serverVersion - the version of the primitive on the server
myVersion - the version of the primitive in the local dataset

handleUploadConflictForUnknownConflict

protected void handleUploadConflictForUnknownConflict()
Handles the case that a conflict was detected while uploading where we don't know what OsmPrimitive actually caused the conflict (for whatever reason)


handleUploadConflictForClosedChangeset

protected void handleUploadConflictForClosedChangeset(long changesetId,
                                                      java.util.Date d)
Handles the case that a conflict was detected while uploading where we don't know what OsmPrimitive actually caused the conflict (for whatever reason)


handleUploadPreconditionFailedConflict

protected void handleUploadPreconditionFailedConflict(OsmApiException e,
                                                      Pair<OsmPrimitive,java.util.Collection<OsmPrimitive>> conflict)
Handles the case where deleting a node failed because it is still in use in a non-deleted way on the server.


handleUploadConflict

protected void handleUploadConflict(OsmApiException e)
handles an upload conflict, i.e. an error indicated by a HTTP return code 409.

Parameters:
e - the exception

handlePreconditionFailed

protected void handlePreconditionFailed(OsmApiException e)
handles an precondition failed conflict, i.e. an error indicated by a HTTP return code 412.

Parameters:
e - the exception

handleGone

protected void handleGone(OsmApiPrimitiveGoneException e)
Handles an error which is caused by a delete request for an already deleted OsmPrimitive on the server, i.e. a HTTP response code of 410. Note that an update on an already deleted object results in a 409, not a 410.

Parameters:
e - the exception

handleFailedUpload

protected void handleFailedUpload(java.lang.Exception e)
error handler for any exception thrown during upload

Parameters:
e - the exception


JOSM