Interface agent.Server.AgentContext
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Interface agent.Server.AgentContext

public interface AgentContext
extends Object
The Agents interface into the environment in which it is running. This is implemented only by the AgentServer. An Agent should never run any server side functions unless it has a valid AgentContext.
See Also:
Agent

Method Index

 o dispatch()
This is called by the Agent to re-dispatch this Agent to all the servers in the Servers list.
 o getResultsURL(String)
Called by the Agent to get the URL of the file that writeOutput has been writing our result strings to.
 o reportFinish(String, String, int, String)
Called by the Agent to make the AgentServer tell the dispatching AgentServer that this Agent has finished work and has created the following result file.
 o reportStart(String)
Called by the Agent to make the AgentServer tell the dispatching AgentServer that this Agent has begun working.
 o writeOutput(String)
This is called by the Agent to write a String of result text to the results HTML file.
 o writeOutput(byte[])
This is called by the Agent to write a String of result text to the results HTML file.

Methods

 o dispatch
  public abstract boolean dispatch()
This is called by the Agent to re-dispatch this Agent to all the servers in the Servers list. The Agent can call this method ONLY ONCE! The server has the option of whether or not to do anything. For security reasons, some servers may not dispatch at all. The Agent can call dispatch at any time. Some Agents may want to dispatch first, then run, others may want to run first and then decide whether or not to dispatch based on results.
Returns:
true if the Agent was dispatched to ANY servers, false otherwise
 o writeOutput
  public abstract boolean writeOutput(String HTMLString)
This is called by the Agent to write a String of result text to the results HTML file. The Agent is responsible for creating syntactically correct HTML. The server may, or may not, choose to actually write the string to the file. Servers will be expected to implement checks on result file size, and Agent run-time that will affect whether or not they actually write the string.
Parameters:
HTMLString - This is a string of text in HTML that will appear in the results page for this Agent run.
Returns:
true if the string was written to the output file, false otherwise.
 o writeOutput
  public abstract boolean writeOutput(byte b[])
This is called by the Agent to write a String of result text to the results HTML file. The Agent is responsible for creating syntactically correct HTML. The server may, or may not, choose to actually write the string to the file. Servers will be expected to implement checks on result file size, and Agent run-time that will affect whether or not they actually write the string.
Parameters:
HTMLString - This is a string of text in HTML that will appear in the results page for this Agent run.
Returns:
true if the string was written to the output file, false otherwise.
 o getResultsURL
  public abstract String getResultsURL(String AgentID)
Called by the Agent to get the URL of the file that writeOutput has been writing our result strings to. Agent uses this to pass to reportFinish.
Returns:
the URL of the results file as a String. Result files must have Web-accessible URLs.
See Also:
reportFinish
 o reportStart
  public abstract void reportStart(String AgentID)
Called by the Agent to make the AgentServer tell the dispatching AgentServer that this Agent has begun working. Receipt of this message by the AgentLauncher should cause it to create an entry in its agent list for this agent.
Parameters:
AgentID - The ID of this agent
See Also:
Launcher, Server
 o reportFinish
  public abstract void reportFinish(String AgentID,
                                    String url,
                                    int price,
                                    String comment)
Called by the Agent to make the AgentServer tell the dispatching AgentServer that this Agent has finished work and has created the following result file. Receipt of this message by the AgentLauncher should cause it to update this agents entry in the agent list.
Parameters:
AgentID - The ID of this agent
url - The URL of the results file. If null, there were no results.
price - The price this AgentServer will charge to view the results file.
comment - Any comment the Agent might wish to make about this result - including its size, running time ...
See Also:
Launcher, Server

All Packages  Class Hierarchy  This Package  Previous  Next  Index