net.sourceforge.java.util.jobs
Interface IJob

All Superinterfaces:
IRunnableWithProgress
All Known Implementing Classes:
Job

public interface IJob
extends IRunnableWithProgress

An IJob represents a high level abstraction of a Thread. IJobs are executed in a standardized execution environment in shape of the JobManager whereas an IJob contains common auxiliary meta data which provides detailed information on its execution status.

Author:
Sebastian Machhausen

Field Summary
static int HIGH_PRIORITY
          The highest priority for an IJob
static int LOW_PRIORITY
          The lowest priority for an IJob
static int NORM_PRIORITY
          The default priority for an IJob
 
Method Summary
 void cancel()
           Cancels an IJob.
 void done()
           This method has to be called instantly after an IJob is done.
 Exception getException()
           Gets a potential Exception that may occured while executing an IJob.
 JobManager getJobManager()
           Gets the JobManager that is responsible for the management and scheduling of the IJob.
 String getName()
           Gets the human readable name of an IJob.
 int getPriority()
           Gets the priority of an IJob.
 JobStatus getStatus()
           Gets the status of an IJob.
 Thread getThread()
           Gets the Thread that the IJob runs in.
 boolean isCanceled()
           Gets the cancellation status of an IJob.
 void join()
           Joins the IJob running in the set Thread as returned by the getThread() method.
 void setException(Exception cause)
           Sets a potential Exception that may occured while executing an IJob.
 void setJobManager(JobManager manager)
           Sets the JobManager that is responsible for the management and scheduling of the IJob.
 void setName(String name)
           Sets a human readable name for an IJob.
 void setPriority(int priority)
           Sets the priority of an IJob.
 void setThread(Thread thread)
           Sets the Thread that the IJob runs in.
 void start()
           Starts the IJob in the set Thread as returned by the getThread() method.
 void started()
           This method has to be called instantly after an IJob has been started.
 void statusChanged()
           This method can be called if the JobStatus of an IJob changed.
 
Methods inherited from interface org.eclipse.jface.operation.IRunnableWithProgress
run
 

Field Detail

LOW_PRIORITY

public static final int LOW_PRIORITY
The lowest priority for an IJob

See Also:
Constant Field Values

NORM_PRIORITY

public static final int NORM_PRIORITY
The default priority for an IJob

See Also:
Constant Field Values

HIGH_PRIORITY

public static final int HIGH_PRIORITY
The highest priority for an IJob

See Also:
Constant Field Values
Method Detail

setPriority

public void setPriority(int priority)

Sets the priority of an IJob.

Predefined priorities are: The priority must therefore range between LOW_PRIORITY and HIGH_PRIORITY. Priorites beyons this interval will be rejected and don't change the current priority.

Parameters:
priority - the priority to set for the IJob

getPriority

public int getPriority()

Gets the priority of an IJob.

Predefined priorities are: The priority therefore ranges between LOW_PRIORITY and HIGH_PRIORITY.

Returns:
the priority of the IJob

setJobManager

public void setJobManager(JobManager manager)

Sets the JobManager that is responsible for the management and scheduling of the IJob.

Parameters:
manager - the JobManager that is responsible for the management and scheduling of the IJob

getJobManager

public JobManager getJobManager()

Gets the JobManager that is responsible for the management and scheduling of the IJob.

Returns:
the JobManager that is responsible for the management and scheduling of the IJob

setThread

public void setThread(Thread thread)

Sets the Thread that the IJob runs in.

Parameters:
thread - the Thread that the IJob runs in

getThread

public Thread getThread()

Gets the Thread that the IJob runs in.

Returns:
the Thread that the IJob runs in

setException

public void setException(Exception cause)

Sets a potential Exception that may occured while executing an IJob.

Parameters:
cause - a potential Exception that may occured while executing an IJob; null if no Exception occured

getException

public Exception getException()

Gets a potential Exception that may occured while executing an IJob.

Returns:
a potential Exception that may occured while executing an IJob; null if no Exception occured

setName

public void setName(String name)

Sets a human readable name for an IJob.

Parameters:
name - a human readable name for an IJob

getName

public String getName()

Gets the human readable name of an IJob.

Returns:
the human readable name of an IJob

getStatus

public JobStatus getStatus()

Gets the status of an IJob.

Returns:
a JobStatus object representing the status of the IJob

start

public void start()

Starts the IJob in the set Thread as returned by the getThread() method. If no Thread is set this method does nothing.


started

public void started()

This method has to be called instantly after an IJob has been started.


join

public void join()
          throws InterruptedException

Joins the IJob running in the set Thread as returned by the getThread() method. If no Thread is set this method does nothing.

Throws:
InterruptedException

done

public void done()

This method has to be called instantly after an IJob is done.


statusChanged

public void statusChanged()

This method can be called if the JobStatus of an IJob changed.


cancel

public void cancel()

Cancels an IJob.


isCanceled

public boolean isCanceled()

Gets the cancellation status of an IJob.

Returns:
true if the IJob has been canceled; false otherwise