Awake SQL v1.2.1

org.awakefw.commons.api.client
Interface AwakeProgressManager

All Known Implementing Classes:
DefaultAwakeProgressManager

public interface AwakeProgressManager

Interface that defines methods to monitor in Swing the upload & download of files.

An implemented instance must be passed to the AwakeFileSession instance using the setAwakeProgressManager method.

It is then possible to use your own methods to follow the progress or to cancel the task.
See DefaultAwakeProgressManager for a default and basic implementation that should suit (almost) all your needs.

See the source code of AwakeFileProgressMonitorDemo.java that demonstrates the use of an AwakeProgressManager to upload files on a remote Awake Server.

Since:
1.0
See Also:
DefaultAwakeProgressManager

Method Summary
 void cancel()
          Cancels the current monitored operation.
 long getLengthToTransfer()
          Allows to define the total length in bytes of the file(s) to transfer.
 int getProgress()
          Returns the progress (as percentage) of the current monitored operation.
 boolean isCancelled()
          Method repeatedly called by Awake when uploading/downloading files.
 void setLengthToTransfer(long lengthToTransfer)
          Sets the total length of files in bytes to transfer.
 void setProgress(int progress)
          Sets the progress in percentage of the transfer operation.
 

Method Detail

cancel

void cancel()
Cancels the current monitored operation.


getLengthToTransfer

long getLengthToTransfer()
Allows to define the total length in bytes of the file(s) to transfer. Method will be called by Awake just before the transfer operation.

Returns:
the number for bytes to transfer

getProgress

int getProgress()
Returns the progress (as percentage) of the current monitored operation.
Method is needed and will be called by an external observer (Timer, SwingWorker, ...) to retrieve the progress value between 0 and 100.

Returns:
the progress value as percentage value

isCancelled

boolean isCancelled()
Method repeatedly called by Awake when uploading/downloading files.

Returns true if this task was canceled before it completed normally.

Returns:
true if this task was canceled before it completed

setLengthToTransfer

void setLengthToTransfer(long lengthToTransfer)
Sets the total length of files in bytes to transfer. Should also reinitialize the instance values for a new usage.

Parameters:
lengthToTransfer - the total length in bytes of the file(s) to transfer

setProgress

void setProgress(int progress)
Sets the progress in percentage of the transfer operation.

The method is repeatedly called by Awake during transfer operation each 1% of transfer done.

Parameters:
progress - The value must be between 0 and 100

Awake SQL v1.2.1

Awake SQL - Virtual JDBC Driver over HTTP for Android, Swing and JavaFX
Android & Desktop Edition allow easy access to majors remote SQL databases with regular JDBC calls:
DB2 - H2 - HSQLDB (HyperSQL) - Informix - Ingres - MySQL - Oracle - PostgreSQL - SQL Server - Sybase - Teradata
Copyright © 2012 Kawan Softwares SAS