DLESE Tools
v1.6.0

org.dlese.dpc.schemedit.threadedservices
Class TaskProgress

java.lang.Object
  extended by org.dlese.dpc.schemedit.threadedservices.TaskProgress

public class TaskProgress
extends Object

Class to report progress of a MonitoredTask via a json object.

The monitoredTask updates the TaskProgress object as it runs, and the TaskProgress can also query the Task for other properties, such as whether the task is actually running.

Author:
ostwald

Field Summary
protected static boolean debug
           
 
Constructor Summary
TaskProgress(MonitoredTask task)
          Constructor for the TaskProgress object
 
Method Summary
 int getDone()
          Gets the done attribute of the TaskProgress object
 boolean getError()
          Gets the error attribute of the TaskProgress object
 String getMsg()
          Gets the msg attribute of the TaskProgress object
 float getPercentComplete()
          Percentage of task completed
 String getProgressReport()
          Reports the current progress as a JSON string
 int getTotal()
          Gets the total attribute of the TaskProgress object
 void init(int total)
          Initialize with total items to be processed
 void init(int total, String msg)
          Initialize with total items to be processed and a message that is part of progress reports
 boolean isActive()
          Reports whether this TaskProgress' task is processing.
 void reset()
          NOT YET DOCUMENTED
 void setDone(int done)
          Sets the done attribute of the TaskProgress object
 void setError(boolean error)
          Sets the error attribute of the TaskProgress object
 void setMsg(String msg)
          Sets the msg attribute of the TaskProgress object
 void setTotal(int total)
          Sets the total attribute of the TaskProgress object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

protected static boolean debug
Constructor Detail

TaskProgress

public TaskProgress(MonitoredTask task)
Constructor for the TaskProgress object

Parameters:
task - the task for which we report progress
Method Detail

init

public void init(int total)
Initialize with total items to be processed

Parameters:
total - number of items to be processed

init

public void init(int total,
                 String msg)
Initialize with total items to be processed and a message that is part of progress reports

Parameters:
total - number of items to be processed
msg - message used in reporting

isActive

public boolean isActive()
Reports whether this TaskProgress' task is processing.

Returns:
The active value

getMsg

public String getMsg()
Gets the msg attribute of the TaskProgress object

Returns:
The msg value

setMsg

public void setMsg(String msg)
Sets the msg attribute of the TaskProgress object

Parameters:
msg - The new msg value

getDone

public int getDone()
Gets the done attribute of the TaskProgress object

Returns:
The done value

setDone

public void setDone(int done)
Sets the done attribute of the TaskProgress object

Parameters:
done - The new done value

getTotal

public int getTotal()
Gets the total attribute of the TaskProgress object

Returns:
The total value

setTotal

public void setTotal(int total)
Sets the total attribute of the TaskProgress object

Parameters:
total - The new total value

getError

public boolean getError()
Gets the error attribute of the TaskProgress object

Returns:
The error value

setError

public void setError(boolean error)
Sets the error attribute of the TaskProgress object

Parameters:
error - The new error value

getPercentComplete

public float getPercentComplete()
Percentage of task completed

Can be calculated by client!?

Returns:
NOT YET DOCUMENTED

getProgressReport

public String getProgressReport()
Reports the current progress as a JSON string

Returns:
The progressReport value

reset

public void reset()
NOT YET DOCUMENTED


DLESE Tools
v1.6.0