    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class JavaAgent.oplan.OPAgent

    java.lang.Object
       |
       +----JavaAgent.agent.Agent
               |
               +----JavaAgent.oplan.OPAgent

public class OPAgent
extends Agent

An OPAgent is basically a normal JAT Agent that also runs an OPlan Process. An OPAgent is created from the class OPAgentContext.

See Also:
  OPAgentContext

##

fromOPlan
  the OPReader for reading from the OPlan Process
oPlanProcess
  the handle of the OPlan Process strted by this OPAgent
toOPlan
  the OPWriter for writing to the OPlan Process

##

OPAgent(ContextInterface, String, URL, URL, File, File)
  The constructor for an OPAgent directly calls standard agent constructor without changing the parameters.

##

init()
  This function first creates the ResourceManager and MessageHandler as for any Agent.
initiateTermination()
  Called when the executable class which contains the OPAgent terminates.
sendInitMessages()
  This function sends the messages which are automatically sent out at startup.

##

oPlanProcess

     public Process oPlanProcess

  the handle of the OPlan Process strted by this OPAgent

fromOPlan

     public OPReader fromOPlan

  the OPReader for reading from the OPlan Process

toOPlan

     public OPWriter toOPlan

  the OPWriter for writing to the OPlan Process

##

OPAgent

     public OPAgent(ContextInterface context,
                    String n,
                    URL init_url,
                    URL shared,
                    File shared_dir,
                    File working_dir)

  The constructor for an OPAgent directly calls standard agent constructor without changing the parameters. The OPlan Process that this OPAgent will run is started in the `init()` method.

  Parameters:
    context - the ContextInterface for this OPAgent
    n - the name of this agent
    init_url - the URL pointing to the initialization messages
    shared - a URL pointing to some shared location
    shared_dir - a shared directory
    working_dir - the working directory for this OPAgent

##

init

     public void init()

  This function first creates the ResourceManager and MessageHandler as for any Agent. Then it adds the broker's address as a resource. This is usually done with the first message from the init-file, but OPAgents get the address from their OPAgentContext which expects it as a command line parameter. Next an OPAgent attempts to start an OPlan Process for which it expects to find OPlan in the directory `/hame/gw/oplan-kcl/bin/`. If this succeeds it also starts an OPReader and an OPWriter which are threads for the communication with OPlan. Other Agents also read the init-file when this function is called, but OPAgents do this in the function `sendInitMessages()` below, i.e. not here.

  Overrides:
    init in class Agent

sendInitMessages

     public void sendInitMessages()

  This function sends the messages which are automatically sent out at startup. Currently this is only the message to the ANS telling it the address of this agent. This function also loads the initialization messages to this agent from the init file which may cause further messages to be sent to the broker. Note that this is different from normal JAT Agents.

  Overrides:
    sendInitMessages in class Agent

initiateTermination

     public void initiateTermination()

  Called when the executable class which contains the OPAgent terminates. The agent sends a remove-address message to the ANS and terminates the OPlan Process.

  Overrides:
    initiateTermination in class Agent

    All Packages  Class Hierarchy  This Package  Previous  Next  Index