ERXLongResponseTask.DefaultImplementation Class Reference

Inherits er::extensions::concurrency::ERXLongResponseTask.

Collaboration diagram for ERXLongResponseTask.DefaultImplementation:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 DefaultImplementation ()
boolean isDone ()
ERXLongResponse longResponse ()
WOComponent nextPage ()
abstract Object performAction ()
void run ()
void setLongResponse (ERXLongResponse sender)
void start ()
Object status ()
void stop ()

Public Attributes

Logger log = Logger.getLogger(ERXUtilities.class)

Protected Member Functions

void _finishInitialization ()
WOComponent cancelPageForStatus (Object aStatus)
Exception exception ()
boolean isCancelled ()
WOComponent pageForException (Exception exception)
WOComponent pageForResult (Object aResult)
WOComponent refreshPageForStatus (Object aStatus)
Object result ()
void setException (Exception anObject)
void setResult (Object anObject)
void setStatus (Object anObject)

Protected Attributes

boolean _cancelled
boolean _done
Exception _exception
ERXLongResponse _longResponse
Object _result
Object _status
Thread _thread


Constructor & Destructor Documentation

Constructor


Member Function Documentation

void _finishInitialization (  )  [protected]

Sets up the object.

WOComponent cancelPageForStatus ( Object  aStatus  )  [protected]

Override this to return a sensible page to show after the task was stopped. The default implementation returns the refresh component's top-level page

Parameters:
aStatus some status object
Returns:
result page for the cancelled task.

Exception exception (  )  [protected]

Returns the exception that may have occurred in the run() method.

boolean isCancelled (  )  [protected]

Checks if the task was stopped externally.

Returns:
true if stop() was called.

boolean isDone (  ) 

ERXLongResponse longResponse (  ) 

Returns the long response for this task.

WOComponent nextPage (  ) 

Default implementation that controls the pages returned on each iteration.

Implements ERXLongResponseTask.

WOComponent pageForException ( Exception  exception  )  [protected]

Override this to return an exception page suitable for the given exception. This implementation just re-throws the exception.

Parameters:
exception 
Returns:
page for the exceptino

WOComponent pageForResult ( Object  aResult  )  [protected]

Override this to return the page after the task was completed without beeing stopped. Whether or not this counts as a success should be divined from the result object. This is the same object you return after being asked for result().

Parameters:
aResult some result object
Returns:
result page for successfu completion

abstract Object performAction (  )  [pure virtual]

You need to override this and perform your long running task.

Returns:
result of performing the action

WOComponent refreshPageForStatus ( Object  aStatus  )  [protected]

Override this to return and modify the refresh page. This is called while the task is still running. Note that is the place where you can call ERXLongResponse.setRefreshInterval(int) to set the next refresh time.

Parameters:
aStatus 

Object result (  )  [protected]

The abstract result object that has been returned by performAction().

void run (  ) 

Implementation of the Runnable interface.

void setException ( Exception  anObject  )  [protected]

Use this method to flag if an exception page should get displayed after finishing the current step.

Parameters:
anObject 

void setLongResponse ( ERXLongResponse  sender  ) 

Sets the long response that controls this task.

Implements ERXLongResponseTask.

void setResult ( Object  anObject  )  [protected]

Abstract result object that will get set when the task is finished.

Parameters:
anObject 

void setStatus ( Object  anObject  )  [protected]

void start (  ) 

Default implementation of the ERXLongResponseTask.start() method. Creates a new thread unless there already exists one.

Implements ERXLongResponseTask.

Object status (  ) 

Returns a current status. This can be any object and will given again to you to divine the next step.

void stop (  ) 

Stops the task. This just sets the cancel flag. Its up to you to check in your task if you are interruptable. So you should check isCancelled() in your performAction().

Implements ERXLongResponseTask.


Member Data Documentation

boolean _cancelled [protected]

Holds the cancel flag

boolean _done [protected]

Holds the done flag

Exception _exception [protected]

Exception code

Refresh page that controls this task

Object _result [protected]

Result code

Object _status [protected]

Status code

Thread _thread [protected]

Hold the thread that performs the task

Logger log = Logger.getLogger(ERXUtilities.class)

logging support


The documentation for this class was generated from the following file:

Generated on Sat May 26 06:43:07 2012 for Project Wonder by  doxygen 1.5.8