orc.orchard
Class Job

java.lang.Object
  extended by orc.orchard.Job

public final class Job
extends java.lang.Object

Standard implementation of a JobService. Extenders should only need to provide a constructor and override onFinish() to clean up any external resources.

Author:
quark

Nested Class Summary
static interface Job.FinishListener
          Used to handle cleanup when the job finishes.
 
Constructor Summary
protected Job(Expr expression, JobConfiguration configuration)
           
 
Method Summary
 void cancelPrompt(int promptID)
           
 JobConfiguration configuration()
           
 void finish()
           
 java.util.List<JobEvent> getEvents(Waiter waiter)
          Return events which occurred since the job started or purgeEvents was last called.
 java.util.Date getStartDate()
           
 void halt()
           
 void onFinish(Job.FinishListener f)
          Register a listener to be called when the job finishes.
 void purgeEvents()
           
 void respondToPrompt(int promptID, java.lang.String response)
          Submit a response to a prompt (initiated by the Prompt site).
 void setEventBufferSize(java.lang.Integer eventBufferSize)
           
 void setStartDate(java.util.Date startDate)
           
 void start()
           
 java.lang.String state()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Job

protected Job(Expr expression,
              JobConfiguration configuration)
Method Detail

start

public void start()
           throws InvalidJobStateException
Throws:
InvalidJobStateException

finish

public void finish()

onFinish

public void onFinish(Job.FinishListener f)
Register a listener to be called when the job finishes.


halt

public void halt()

configuration

public JobConfiguration configuration()

getEvents

public java.util.List<JobEvent> getEvents(Waiter waiter)
                                   throws java.lang.InterruptedException
Return events which occurred since the job started or purgeEvents was last called. If no events have occurred, block using waiter until one occurs. If/when the job completes (so no more events can occur), return an empty list.

Throws:
java.lang.InterruptedException

purgeEvents

public void purgeEvents()

state

public java.lang.String state()

setStartDate

public void setStartDate(java.util.Date startDate)

getStartDate

public java.util.Date getStartDate()

setEventBufferSize

public void setEventBufferSize(java.lang.Integer eventBufferSize)

respondToPrompt

public void respondToPrompt(int promptID,
                            java.lang.String response)
                     throws InvalidPromptException
Submit a response to a prompt (initiated by the Prompt site).

Throws:
InvalidPromptException - if promptID is invalid

cancelPrompt

public void cancelPrompt(int promptID)
                  throws InvalidPromptException
Throws:
InvalidPromptException