juife
v0.1a

net.sf.juife
Interface Task<R>

All Known Implementing Classes:
AbstractTask

public interface Task<R>

Defines a task that can be queued for execution in a TaskQueue or in a TaskList.

See Also:
TaskQueue, TaskList

Method Summary
 void addTaskListener(TaskListener l)
          Registers the specified listener for receiving event messages.
 boolean done()
          Determines whether the task has finished execution.
 boolean doneWithErrors()
          Determines whether the task has finished its execution successfully.
 java.lang.String getDescription()
          Gets a short description about this task.
 int getErrorCode()
          Gets an appropriate error code identifying the failure of the task.
 java.lang.String getErrorMessage()
          Gets an appropriate error message when the task fails.
 R getResult()
          Gets the result of the task execution.
 java.lang.String getTitle()
          Gets the title of this task.
 void invoke()
          Starts the execution of this task.
 void invokeAndWait()
          Starts the execution of this task.
 boolean isStarted()
          Determines whether the task has been started.
 void removeTaskListener(TaskListener l)
          Removes the specified listener.
 void setTitle(java.lang.String title)
          Sets the title of this task.
 void stop()
          Terminates the execution of this task
 

Method Detail

addTaskListener

void addTaskListener(TaskListener l)
Registers the specified listener for receiving event messages.

Parameters:
l - The TaskListener to register.

removeTaskListener

void removeTaskListener(TaskListener l)
Removes the specified listener.

Parameters:
l - The TaskListener to remove.

done

boolean done()
Determines whether the task has finished execution.

Returns:
true if the task has finished execution, false otherwise.

doneWithErrors

boolean doneWithErrors()
Determines whether the task has finished its execution successfully.

Returns:
true if the task has not finished its execution successfully; false otherwise

getErrorCode

int getErrorCode()
Gets an appropriate error code identifying the failure of the task.

Returns:
An appropriate error code identifying the error.
See Also:
doneWithErrors()

getErrorMessage

java.lang.String getErrorMessage()
Gets an appropriate error message when the task fails.

Returns:
An appropriate error message describing the failure of the task.
See Also:
doneWithErrors()

getResult

R getResult()
Gets the result of the task execution.

Returns:
R instance providing the result of the task execution.

getDescription

java.lang.String getDescription()
Gets a short description about this task.

Returns:
An arbitrary text describing this task.

invoke

void invoke()
Starts the execution of this task. This method returns immediately after the the task is started. If you want to wait until the end of execution consider using invokeAndWait(). Notice that every task can be started only once.

Throws:
java.lang.IllegalStateException - if the task has been started already.
See Also:
invokeAndWait()

invokeAndWait

void invokeAndWait()
Starts the execution of this task. This method blocks until the task finishes its execution. Consider using invoke() if you don't want this method to wait until the end of the task execution. Notice that every task can be started only once.

Throws:
java.lang.IllegalStateException - if the task has been started already.
See Also:
invoke()

isStarted

boolean isStarted()
Determines whether the task has been started.

Returns:
true if the task is already started and false if the task is not started yet.

getTitle

java.lang.String getTitle()
Gets the title of this task.

Returns:
The title of this task.

setTitle

void setTitle(java.lang.String title)
Sets the title of this task.

Parameters:
title - Specifies the title text of this task.

stop

void stop()
Terminates the execution of this task


juife
v0.1a

Copyright © 2005 Grigor Iliev. All rights reserved. SourceForge.net Logo