    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class JavaAgent.resource.KQMLmessage

    java.lang.Object
       |
       +----JavaAgent.resource.Language
               |
               +----JavaAgent.resource.KQMLmessage

public class KQMLmessage
extends Language

Subclass of Language which defines a KQML message. All legal messages must have values for the performative, sender, receiver, language, Interpreter and content fields. Additional fields may be added freely. Constructs a KQML message by parsing an input String, according to the BNF syntax for KQML. See the KQML specification for syntax and semantic details.

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.

##

field_value_pairs

##

KQMLmessage()
  Constructor for KQMLmessage, creates an empty message.
KQMLmessage(String)
  Constructor for KQMLmessage, parses a string to create the message.

##

addFieldValuePair(String, String)
  Sets the value of the field "field".
getFields()
  Return the fields in the message.
getNonDelimiter(StringTokenizer)
  Removes tokens from the StringTokenizer until the Tokenizer is empty or a a non-Delimiter token is found.
getNonWhiteSpace(StringTokenizer)
  Removes tokens from the StringTokenizer until the Tokenizer is empty or a a non-whitespace token is found.
getReadString()
  Returns the KQML message as a single human readable string.
getSendString()
  Returns the KQML message as a single machine readable string.
getValue(String)
  Returns the value of the "field" field.
isDelimiter(String)
  Checks whether a single token is a delimiter.
isWhiteSpace(String)
  Checks whether a single token is whitespace.
LengthDelimitedString(StringTokenizer, int)
  Handles #*"* string constructs.
ParseExpression(StringTokenizer, int, boolean, String)
  Returns the next expression from the StringTokenizer.
parseString(String)
  Takes an empty KQMLmessage instance and populates it by parsing an input string.
testValidity(KQMLmessage)
  Tests the validity of a KQML message.

##

field_value_pairs

     protected Hashtable field_value_pairs

##

KQMLmessage

     public KQMLmessage()

  Constructor for KQMLmessage, creates an empty message.

KQMLmessage

     public KQMLmessage(String message)

  Constructor for KQMLmessage, parses a string to create the message. does not support the #<digit>&lhdigit>*"<ascii>* construct.

  Parameters:
    message - The String containing the message.

##

parseString

     public void parseString(String message)

  Takes an empty KQMLmessage instance and populates it by parsing an input string.

  Parameters:
    message - The String containing the message.
  Overrides:
    parseString in class Language

ParseExpression

     protected String ParseExpression(StringTokenizer st,
                                      int num_paren,
                                      boolean string,
                                      String last_token)

  Returns the next expression from the StringTokenizer. Recursive.

  Parameters:
    st - The current StringTokenizer.
    num_paren - Number of parenthetical nestings.
    string - Are we inside of a string?
    last_token - What was the last token?

LengthDelimitedString

     protected String LengthDelimitedString(StringTokenizer st,
                                            int num_paren)

  Handles #*"* string constructs.

getNonDelimiter

     protected String getNonDelimiter(StringTokenizer st)

  Removes tokens from the StringTokenizer until the Tokenizer is empty or a a non-Delimiter token is found. If no non-Delimiter is found returns null.

getNonWhiteSpace

     protected String getNonWhiteSpace(StringTokenizer st)

  Removes tokens from the StringTokenizer until the Tokenizer is empty or a a non-whitespace token is found. If no non-whitespace is found returns null.

isDelimiter

     protected boolean isDelimiter(String token)

  Checks whether a single token is a delimiter.

isWhiteSpace

     protected boolean isWhiteSpace(String token)

  Checks whether a single token is whitespace.

getFields

     public Enumeration getFields()

  Return the fields in the message.

  Returns:
    An Enumeration of the message fields.

testValidity

     public static boolean testValidity(KQMLmessage message)

  Tests the validity of a KQML message. Does it have all of the necessary fields? Can have more than the minimum set.

  Parameters:
    message - The KQMLmessage to test.
  Returns:
    Boolean answer, true if valid, otherwise false.

addFieldValuePair

     public void addFieldValuePair(String field,
                                   String value)

  Sets the value of the field "field".

  Parameters:
    field - String key for the field.
    value - String value for the field.

getValue

     public String getValue(String field)

  Returns the value of the "field" field. If it does not exit, returns null.

  Returns:
    String representing field value.

getReadString

     public String getReadString()

  Returns the KQML message as a single human readable string.

  Returns:
    Message in string format.

getSendString

     public String getSendString()

  Returns the KQML message as a single machine readable string. This is the format which is sent to other agents.

  Returns:
    Message in string format.

    All Packages  Class Hierarchy  This Package  Previous  Next  Index