org.openstreetmap.josm.gui.io
Class AbstractIOTask

java.lang.Object
  extended by org.openstreetmap.josm.gui.io.AbstractIOTask
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
SaveLayerTask, UploadLayerTask

public abstract class AbstractIOTask
extends java.lang.Object
implements java.lang.Runnable

This is an abstract task for uploading or saving a data layer.


Field Summary
private  boolean canceled
          indicates whether the task has been canceled
private  boolean failed
          indicates whether the task has been failed
private  java.lang.Exception lastException
          the last exception caught
 
Constructor Summary
AbstractIOTask()
           
 
Method Summary
abstract  void cancel()
          Cancel the task
 java.lang.Exception getLastException()
          Replies the last exception caught
 boolean isCanceled()
          Replies true if the task has been canceled
 boolean isFailed()
          Replies true if the task has been failed
 boolean isSuccessful()
          Replies true if this task was successful, i.e.
abstract  void run()
          Runs the task
protected  void setCanceled(boolean canceled)
          Set whether this task has been canceled
protected  void setFailed(boolean failed)
          Sets whether the task has been failed
protected  void setLastException(java.lang.Exception lastException)
          Sets the last exception caught
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

canceled

private boolean canceled
indicates whether the task has been canceled


failed

private boolean failed
indicates whether the task has been failed


lastException

private java.lang.Exception lastException
the last exception caught

Constructor Detail

AbstractIOTask

public AbstractIOTask()
Method Detail

isCanceled

public boolean isCanceled()
Replies true if the task has been canceled

Returns:
true if the task has been canceled

setCanceled

protected void setCanceled(boolean canceled)
Set whether this task has been canceled

Parameters:
canceled - true, if the task has been canceled; false otherwise

isFailed

public boolean isFailed()
Replies true if the task has been failed

Returns:
true if the task has been failed

setFailed

protected void setFailed(boolean failed)
Sets whether the task has been failed

Parameters:
failed - whether the task has been failed

getLastException

public java.lang.Exception getLastException()
Replies the last exception caught

Returns:
the last exception caught; null, if no exception was caught

setLastException

protected void setLastException(java.lang.Exception lastException)
Sets the last exception caught

Parameters:
lastException - the last exception

isSuccessful

public boolean isSuccessful()
Replies true if this task was successful, i.e. if it wasn't canceled and didn't fail

Returns:
true if this task was successful

run

public abstract void run()
Runs the task

Specified by:
run in interface java.lang.Runnable

cancel

public abstract void cancel()
Cancel the task



JOSM