zeus.actors
Class ZeusTask

java.lang.Object
  extended byjava.lang.Thread
      extended byzeus.actors.ZeusTask
All Implemented Interfaces:
java.lang.Runnable

public abstract class ZeusTask
extends java.lang.Thread

Tasks are generated in the form of 'stub' files, skeleton implementations that need to be realised by application specific program code - this code is linked to the agents through the methods of this interface. This approach enables new domain-specific functionality to be integrated with the automated created agent-specific code, without needing to modify the latter. < p> The class variables include several arrays of Fact objects, one of which passes information from agent to task, and another which stores the result of performing the task (which can then be read back by the agent when the task has completed running.

This is a crucially important class for developers who want to add their own application-specific functionality, and so should be studied carefully. Instructions and an example of how to write a task body are provided in Section 6 of Zeus Application Realisation Guide. TaskExternals have been available since Zeus 1.1 and allow customisation without editing the stubs - which is useful in terms of preserving your edited code in a separate file.


Field Summary
protected  AgentContext context
           
protected  java.lang.String desired_by
           
protected  Fact[] expInputArgs
          The information the task expects to receive, (as specified when the task was defined) this can be used to validate the inputArgs
protected  Fact[] expOutputArgs
          The information the task expects to return, (as specified when the task was defined) this can be used to validate the outputArgs
protected  Fact[][] inputArgs
          The information passed from the agent to the task, (a 2D array is used to enable multiple fact instances)
private  boolean isAborted
           
private  boolean isFinished
           
private  boolean isRunning
           
protected  java.lang.String[] media
           
protected  Fact[][] outputArgs
          The information returned from the task to the agent
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
protected ZeusTask()
           
 
Method Summary
 void abort()
          Call this method in cases where the task terminates abnormally
protected abstract  void exec()
          This is the interface between the agent and the task; hence the body of the task should implement this method
 java.lang.String getDescription()
          This is the method called to get the string that describes this task in the service registration The concrete implementation is included to promote the smooth running of legacy agents
 java.lang.String getDesiredBy()
           
 Fact[] getExpectedInputArgs()
           
 Fact[] getExpectedOutputArgs()
           
 Fact[][] getInputArgs()
           
 java.lang.String getInstanceDetails()
          Get the instance details from the task.
 Fact[][] getOutputArgs()
           
 boolean isAborted()
           
 boolean isFinished()
           
 boolean isRunning()
           
 void run()
          Used internally by the ExecutionMonitor to start the task, users should not call this themselves
 void setContext(AgentContext context)
           
 void setDesiredBy(java.lang.String desired_by)
           
 void setExpectedInputArgs(Fact[] f)
           
 void setExpectedOutputArgs(Fact[] f)
           
 void setInputArgs(Fact[][] t)
           
 void setMedia(java.lang.String[] media)
           
 void setOutputArgs(Fact[] f)
           
 void setOutputArgs(Fact[][] f)
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

inputArgs

protected Fact[][] inputArgs
The information passed from the agent to the task, (a 2D array is used to enable multiple fact instances)


outputArgs

protected Fact[][] outputArgs
The information returned from the task to the agent


expInputArgs

protected Fact[] expInputArgs
The information the task expects to receive, (as specified when the task was defined) this can be used to validate the inputArgs


expOutputArgs

protected Fact[] expOutputArgs
The information the task expects to return, (as specified when the task was defined) this can be used to validate the outputArgs


media

protected java.lang.String[] media

isFinished

private boolean isFinished

isRunning

private boolean isRunning

isAborted

private boolean isAborted

desired_by

protected java.lang.String desired_by

context

protected AgentContext context
Constructor Detail

ZeusTask

protected ZeusTask()
Method Detail

setMedia

public void setMedia(java.lang.String[] media)

run

public void run()
Used internally by the ExecutionMonitor to start the task, users should not call this themselves


isRunning

public boolean isRunning()

isFinished

public boolean isFinished()

isAborted

public boolean isAborted()

abort

public void abort()
Call this method in cases where the task terminates abnormally


setContext

public void setContext(AgentContext context)

setInputArgs

public void setInputArgs(Fact[][] t)

setExpectedOutputArgs

public void setExpectedOutputArgs(Fact[] f)

setExpectedInputArgs

public void setExpectedInputArgs(Fact[] f)

setOutputArgs

public void setOutputArgs(Fact[] f)

setOutputArgs

public void setOutputArgs(Fact[][] f)

getInputArgs

public Fact[][] getInputArgs()

getExpectedOutputArgs

public Fact[] getExpectedOutputArgs()

getExpectedInputArgs

public Fact[] getExpectedInputArgs()

getOutputArgs

public Fact[][] getOutputArgs()

setDesiredBy

public void setDesiredBy(java.lang.String desired_by)

getDesiredBy

public java.lang.String getDesiredBy()

exec

protected abstract void exec()
This is the interface between the agent and the task; hence the body of the task should implement this method


getDescription

public java.lang.String getDescription()
This is the method called to get the string that describes this task in the service registration The concrete implementation is included to promote the smooth running of legacy agents

Since:
1.3

getInstanceDetails

public java.lang.String getInstanceDetails()
Get the instance details from the task. Returns null if not implemented by the sub class.



Copyright © 2000-2003 BT Exact Technologies. All Rights Reserved.