    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class JavaAgent.resource.AgentInterpreter

    java.lang.Object
       |
       +----JavaAgent.resource.Interpreter
               |
               +----JavaAgent.resource.AgentInterpreter

public class AgentInterpreter
extends Interpreter

Subclass of Interpreter which defines the messages sent between agents regarding addressing and code/file acquisition. Only defined for messages whose syntax is KQML.

The AgentInterpreter has five defined messages with multiple variants of each message type. (each message represents the content field of a top level KQML message):

- (ask-resource :type <resource type> :name <resource name>) . This message type is used to ask about the value of a resource.
- (tell-resource :type <resource type> :name <resource name> :value <resource value> ). This message type is used to inform an Agent about a resource of a specific type, name and value. Where type may be one of "address", "class", "interpreter", "language", "file" or "local-file" (could be some other type of resource). Value is interpreted uniquely for each type. (For address value is "host:port"; for class, Interpreter and language value is the "code_base class_name"; for file the value is "base_url file_name") If a local version of the file exists, it is not replaced. If <resource value> is "?", then the sender does not know the value or location of the resource.
- (invalidate-resource :type <resource type> :name <resource name>). Sent by one Agent to invalidate a given resource. Should result in the resource being removed from local storage.
- (non-unique-name :non-unique-name <agent name> :unique-name <agent name>). Sent by the ANS to an agent who submitted a non-unique agent name. The ANS provides a new unique name for the agent.

Copyright (c) 1995, H. Robert Frost, Stanford University. All rights reserved.

Copyright (c) 1996, H. Robert Frost, Enterprise Integration Technologies, Inc. All rights reserved.

RESTRICTED RIGHTS LEGEND: Use, duplication or disclosure by the Government is subject to restrictions as set forth in subparagraph(c)(1)(ii) of the Rights in Technical Data and Computer Software clause at DFARS 252.227-7013 and in similar clauses in the FAR and NASA FAR supplement.

This software is bound by the terms and conditions listed in the attached LICENSE file.

##

AgentInterpreter()

##

ask_addressAction(KQMLmessage, String, Agent)
  Agent wants an address.
ask_codeAction(KQMLmessage, String, Agent, Resource)
  Request for the location of class code for langauge, Interpreter or class resources.
ask_fileAction(KQMLmessage, String, Agent, Resource)
  Request for the location of a file.
ask_resourceAction(KQMLmessage, String, Agent)
  Handles general ask-resource messages.
interpretLanguage(KQMLmessage, Agent, Language)
  Interpret the Language instance, from the message, for the reciever according to the present Interpreter.
invalidate_addressAction(KQMLmessage, Agent)
  Remove-address message received.
invalidate_addressAgent(KQMLmessage, Agent)
  Agent received a invalidate-address message, if the address exists in the local buffer, remove it.
invalidate_addressANS(KQMLmessage, ANS)
  ANS received an invalidate-address message, if the address exists in the local buffer, remove it, then echo the invalidate-address message to all of the agents which are in the buffer.
invalidate_code_fileAction(KQMLmessage, Agent, Resource)
  Request to invalidate a current code resource.
invalidate_resourceAction(KQMLmessage, Agent)
  Handles general invalidate-resource messages.
non_uniqueAction(KQMLmessage, Agent)
  Agent tried to report a non-unique name, change name to the supplied unique-name, based on the address.
tell_addressAction(KQMLmessage, Agent)
  Provides the address of an agent.
tell_addressAgent(KQMLmessage, Agent)
  Agent has received a tell-address message, store the received address in the local buffer.
tell_addressANS(KQMLmessage, ANS)
  ANS has received the tell_address message, check for unique name, if unique, store in buffer, else send a non-unique-name message back.
tell_codeAction(KQMLmessage, Agent, Resource, boolean)
  Provides the location of class code for langauge, Interpreter or class resources.
tell_fileAction(KQMLmessage, Agent, Resource)
  Provides the location of a remote file which must be copied to the local disk.
tell_resourceAction(KQMLmessage, Agent)
  Handles general tell-resource messages.

##

AgentInterpreter

     public AgentInterpreter()

##

interpretLanguage

     protected void interpretLanguage(KQMLmessage message,
                                      Agent receiver,
                                      Language language) throws InterpretationException

  Interpret the Language instance, from the message, for the reciever according to the present Interpreter. Throws a InterpretationException if the language type cannot be handled.

  Parameters:
    message - Message which needs to be interpreted.
    receiver - Agent who received the message.
    language - Instance of Language which represents the message contents.
  Overrides:
    interpretLanguage in class Interpreter

tell_resourceAction

     protected void tell_resourceAction(KQMLmessage message,
                                        Agent parent)

  Handles general tell-resource messages.

ask_resourceAction

     protected void ask_resourceAction(KQMLmessage message,
                                       String sender,
                                       Agent parent)

  Handles general ask-resource messages.

invalidate_resourceAction

     protected void invalidate_resourceAction(KQMLmessage message,
                                              Agent parent)

  Handles general invalidate-resource messages.

tell_codeAction

     protected void tell_codeAction(KQMLmessage message,
                                    Agent parent,
                                    Resource resource,
                                    boolean instance)

  Provides the location of class code for langauge, Interpreter or class resources. Resource is the Agent storage, instance is true if it should be stored as an instance, false if as a class.

tell_fileAction

     protected void tell_fileAction(KQMLmessage message,
                                    Agent parent,
                                    Resource resource)

  Provides the location of a remote file which must be copied to the local disk.

ask_codeAction

     protected void ask_codeAction(KQMLmessage message,
                                   String sender,
                                   Agent parent,
                                   Resource resource)

  Request for the location of class code for langauge, Interpreter or class resources. resource is the Agent storage, instance is true if it should be stored as an instance, false if as a class.

ask_fileAction

     protected void ask_fileAction(KQMLmessage message,
                                   String sender,
                                   Agent parent,
                                   Resource resource)

  Request for the location of a file.

invalidate_code_fileAction

     protected void invalidate_code_fileAction(KQMLmessage message,
                                               Agent parent,
                                               Resource resource)

  Request to invalidate a current code resource. If the code resource is present, remove it and its location.

tell_addressAction

     protected void tell_addressAction(KQMLmessage message,
                                       Agent parent)

  Provides the address of an agent.

tell_addressANS

     protected void tell_addressANS(KQMLmessage message,
                                    ANS parent)

  ANS has received the tell_address message, check for unique name, if unique, store in buffer, else send a non-unique-name message back.

tell_addressAgent

     protected void tell_addressAgent(KQMLmessage message,
                                      Agent parent)

  Agent has received a tell-address message, store the received address in the local buffer. If the sender did not know the address then store a null in addresses.

ask_addressAction

     protected void ask_addressAction(KQMLmessage message,
                                      String sender,
                                      Agent parent)

  Agent wants an address. Do not attempt to retrieve the address if the Agent does not possess it currently.

invalidate_addressAction

     protected void invalidate_addressAction(KQMLmessage message,
                                             Agent parent)

  Remove-address message received.

invalidate_addressAgent

     protected void invalidate_addressAgent(KQMLmessage message,
                                            Agent parent)

  Agent received a invalidate-address message, if the address exists in the local buffer, remove it.

invalidate_addressANS

     protected void invalidate_addressANS(KQMLmessage message,
                                          ANS parent)

  ANS received an invalidate-address message, if the address exists in the local buffer, remove it, then echo the invalidate-address message to all of the agents which are in the buffer.

non_uniqueAction

     protected void non_uniqueAction(KQMLmessage message,
                                     Agent parent)

  Agent tried to report a non-unique name, change name to the supplied unique-name, based on the address.

    All Packages  Class Hierarchy  This Package  Previous  Next  Index