All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class JavaAgent.resource.cdl.CDLInterpreter

java.lang.Object
   |
   +----JavaAgent.resource.Interpreter
           |
           +----JavaAgent.resource.cdl.CDLInterpreter

public class CDLInterpreter
extends Interpreter
This Interpreter manages storage and retrieval of capabilities for a capability broker. Brokers are implemented as extensions of Agent Name Servers (ANSs). To know about this Interpreter the ANS should receive a message from its initialization file telling it about this resource and associating it with the name capabilities. Now all messages to the ANS refering to the ontology capabilities will be handled by an instance of this CDLInterpreter.

A CDLInterpreter maintains the capability descriptions of agents advertising their capabilities in CDL (capability storage). On request, a CDLInterpreter can find problem-solving agents for a given problem (capabiliy retrieval). All messages to a CDLInterpreter are ultimately handled by the function interpretMessage(KQMLmessage, Agent) as described below.


Variable Index

 o traceStream

Constructor Index

 o CDLInterpreter()

Method Index

 o addCapability(String, KQMLmessage, Agent)
This function gets called when an agent wants to advertise a new capability.
 o brokerAll(String, CDLDescription, Agent)
This function gets called when an agent wants to contract other agents through the broker that can solve the problem described in the given CDLDescription.
 o brokerOne(String, CDLDescription, Agent)
This function gets called when an agent wants to contract another agent through the broker that can solve the problem described in the given CDLDescription.
 o interpretMessage(KQMLmessage, Agent)
This function is called when the broker receives a KQMLmessage with the ontology capabilities.
 o loadOntology(URL, Agent)
This function loads the action ontology for this CDLInterpreter.
 o recommendAll(String, CDLDescription, Agent)
This function gets called when an agent wants to find other agents that can solve the problem described in the given CDLDescription.
 o recommendOne(String, CDLDescription, Agent)
This function gets called when an agent wants to find another agent that can solve the problem described in the given CDLDescription.

Variables

 o traceStream
 public static FileOutputStream traceStream

Constructors

 o CDLInterpreter
 public CDLInterpreter()

Methods

 o interpretMessage
 public void interpretMessage(KQMLmessage message,
                              Agent receiver) throws InterpretationException
This function is called when the broker receives a KQMLmessage with the ontology capabilities. The following performatives are currently accepted:

Parameters:
message - the KQMLmessage to be interpreted here
receiver - the Agent to which this CDLInterpreter belongs and which has received the message
Throws: InterpretationException
An exception will occur if this CDLInterpreter fails to process this message for some reason.
Overrides:
interpretMessage in class Interpreter
 o loadOntology
 protected void loadOntology(URL ontologyURL,
                             Agent receiver) throws IOException
This function loads the action ontology for this CDLInterpreter. This function should only be called for the broker. It opens the given URL and reads expressions in brackets from there. Each expression is interpreted as a CDLDescription.

Parameters:
ontologyURL - the URL that specifies where to find the ontology
receiver - should be the ANS Agent
 o addCapability
 protected void addCapability(String agent,
                              KQMLmessage message,
                              Agent receiver) throws InterpretationException
This function gets called when an agent wants to advertise a new capability. For this to be a valid capability description the performative must be perform or achieve, the specified receiver must be the agent that advertised the capability, the content language must be CDL, and the content must be a correct CDL expression.

Parameters:
agent - the name of the agent advertising the capability
message - the KQML that has the capability description as its content
receiver - the agent that has received this message, i.e. the broker that owns this CDLInterpreter
Throws: InterpretationException
An exception will occur if the given capability description cannot be processed, e.g. if the content field does not contain a valid CDL expression.
 o recommendOne
 protected void recommendOne(String agent,
                             CDLDescription task,
                             Agent receiver) throws InterpretationException
This function gets called when an agent wants to find another agent that can solve the problem described in the given CDLDescription.

Parameters:
agent - the name of the agent seeking a capability
task - the CDLDescription of the task to be performed
receiver - the agent that has received this message, i.e. the broker that owns this CDLInterpreter
Throws: InterpretationException
An exception will occur if
 o recommendAll
 protected void recommendAll(String agent,
                             CDLDescription task,
                             Agent receiver) throws InterpretationException
This function gets called when an agent wants to find other agents that can solve the problem described in the given CDLDescription.

Parameters:
agent - the name of the agent seeking a capability
task - the CDLDescription of the task to be performed
receiver - the agent that has received this message, i.e. the broker that owns this CDLInterpreter
Throws: InterpretationException
An exception will occur if
 o brokerOne
 protected void brokerOne(String agent,
                          CDLDescription task,
                          Agent receiver) throws InterpretationException
This function gets called when an agent wants to contract another agent through the broker that can solve the problem described in the given CDLDescription.

Parameters:
agent - the name of the agent seeking a capability
task - the CDLDescription of the task to be performed
receiver - the agent that has received this message, i.e. the broker that owns this CDLInterpreter
Throws: InterpretationException
An exception will occur if
 o brokerAll
 protected void brokerAll(String agent,
                          CDLDescription task,
                          Agent receiver) throws InterpretationException
This function gets called when an agent wants to contract other agents through the broker that can solve the problem described in the given CDLDescription.

Parameters:
agent - the name of the agent seeking a capability
task - the CDLDescription of the task to be performed
receiver - the agent that has received this message, i.e. the broker that owns this CDLInterpreter
Throws: InterpretationException
An exception will occur if

All Packages  Class Hierarchy  This Package  Previous  Next  Index