ix.icore
Class IXAgent

java.lang.Object
  |
  +--ix.icore.IXAgent
Direct Known Subclasses:
BasicIdeel, BasicIleed, BasicItest, SimpleIXAgent

public abstract class IXAgent
extends java.lang.Object

Common class for I-X agents.

An agent is usually created by instantiating a subclass of IXAgent and then calling its mainStartup(String[] argv) method. That method will usually be inherited from IXAgent; it processes any command line arguments and then calls startup(). Thus, from the subclass's point of view, startup and initialization has the following steps:

  1. One of the subclass's constructurs, which will call superclass constructors.
  2. mainStartup(String[] argv), which calls
    1. processCommandLineArguments()
    2. startup()
A subclass that redefines processCommandLineArguments() or startup() should normally have them call the corresponding super method to ensure that any common processing is performed. For example, the IXAgent processCommandLineArguments() method will set up interprocess communication as specified by the argument -ipc=methodName.

To support IPC, a subclass of IXAgent must define the getAgentIPCName() method and will typically want to define

or, to intervene at an earlier stage, the method that calls the two above,

See Also:
SimpleIXAgent, SimpleIXAgent.java source code

Field Summary
protected  TextAreaFrame textFrame
          A text area in a separate frame used to display information about incoming messages.
protected static IXAgent thisAgent
           
 
Constructor Summary
IXAgent()
          Standard constructor.
 
Method Summary
protected  void displayMessage(java.lang.String message)
          Adds the specified string to the default message display.
static IXAgent getAgent()
          Returns an object that represents the agent.
abstract  java.lang.Object getAgentIPCName()
          Returns the object used to represent the agent as an IPC "destination".
 java.lang.Object getAgentSymbolName()
          Returns this agent's symbol name.
 void handleInput(IPC.InputMessage message)
          Handles external input in the form of an IPC.InputMessage that contains an Issue or Report object.
 void handleNewIssue(Issue issue)
          Handles new issues from external sources.
 void handleNewReport(Report report)
          Handles new reports from external sources.
 void mainStartup(java.lang.String[] argv)
          Method called by main(String[] argv) to do initialization common to all I-X agents.
protected  void pre_handleInput(IPC.InputMessage message)
          Gets the message before the handleInput method and ensures that handleInput is called in the AWT event dispatching thread.
protected  void processCommandLineArguments()
          Handles command-line arguments common to all I-X agents.
protected  void startServer(java.lang.Object agentName, java.lang.String strategyName)
          Set the default IPC communication strategy and set up to receive messages.
protected  void startup()
          Method called by the mainStartup(String[] argv) method to perform any setup and initialization that should take place after this agent's constructor has been called and command-line arguments have been processed.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

thisAgent

protected static IXAgent thisAgent

textFrame

protected TextAreaFrame textFrame
A text area in a separate frame used to display information about incoming messages.
Constructor Detail

IXAgent

public IXAgent()
Standard constructor.

Method Detail

mainStartup

public void mainStartup(java.lang.String[] argv)
Method called by main(String[] argv) to do initialization common to all I-X agents.

startup

protected void startup()
Method called by the mainStartup(String[] argv) method to perform any setup and initialization that should take place after this agent's constructor has been called and command-line arguments have been processed.

At present, this method does nothing, and all the work is done in subclasses.


processCommandLineArguments

protected void processCommandLineArguments()
Handles command-line arguments common to all I-X agents.
    -debug=boolean
    -fontsize=int
    -ipc=name
 
At present, fontsize is ignored.

debug is used to set Debug.on.

The name in -ipc=name argument will be interpreted by the IPC.getCommunicationStrategy(String) method.

At present, this method also makes any standard I-X changes to the look and feel.

See Also:
ix.iface.Iface#adjustLookAndFeel(), IPC.getCommunicationStrategy(String methodName), Debug.on, Parameters

getAgent

public static IXAgent getAgent()
Returns an object that represents the agent. At present, there can be only one IXAgent per VM.

getAgentIPCName

public abstract java.lang.Object getAgentIPCName()
Returns the object used to represent the agent as an IPC "destination". This object is usually, but not necessarily, a string containing the agent's name. The details will depend on the set of communication strategies that might be used.
See Also:
IPC, IPC.CommunicationStrategy

getAgentSymbolName

public java.lang.Object getAgentSymbolName()
Returns this agent's symbol name.

startServer

protected void startServer(java.lang.Object agentName,
                           java.lang.String strategyName)
Set the default IPC communication strategy and set up to receive messages.
See Also:
IPC

pre_handleInput

protected void pre_handleInput(IPC.InputMessage message)
Gets the message before the handleInput method and ensures that handleInput is called in the AWT event dispatching thread. This is perhaps a temporary measure.

handleInput

public void handleInput(IPC.InputMessage message)
Handles external input in the form of an IPC.InputMessage that contains an Issue or Report object. It calls handleNewIssue or handleNewReport as appropriate.

handleNewIssue

public void handleNewIssue(Issue issue)
Handles new issues from external sources. Subclasses will usually redefine this method.

handleNewReport

public void handleNewReport(Report report)
Handles new reports from external sources. Subclasses will usually redefine this method.

displayMessage

protected void displayMessage(java.lang.String message)
Adds the specified string to the default message display.