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.
-
traceStream
-
-
CDLInterpreter()
-
-
addCapability(String, KQMLmessage, Agent)
- This function gets called when an agent wants to advertise a new
capability.
-
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.
-
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.
-
interpretMessage(KQMLmessage, Agent)
- This function is called when the broker receives a KQMLmessage
with the ontology capabilities.
-
loadOntology(URL, Agent)
- This function loads the action ontology for this CDLInterpreter.
-
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.
-
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.
traceStream
public static FileOutputStream traceStream
CDLInterpreter
public CDLInterpreter()
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:
- load-ontology calls loadOntology(...)
- advertise calls addCapability(...)
- recommend-one calls recommendOne(...)
- recommend-all calls recommendAll(...)
- broker-one calls brokerOne(...)
- broker-all calls brokerAll(...)
- 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
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
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.
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
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
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
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