Class JavaAgent.resource.KQMLmessage
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.



Variable Index

 o field_value_pairs

Constructor Index

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

Method Index

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

Variables

 o field_value_pairs
  protected Hashtable field_value_pairs

Constructors

 o KQMLmessage
  public KQMLmessage()
Constructor for KQMLmessage, creates an empty message.
 o 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.

Methods

 o 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
 o 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?
 o LengthDelimitedString
  protected String LengthDelimitedString(StringTokenizer st,
                                         int num_paren)
Handles #*"* string constructs.
 o 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.
 o 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.
 o isDelimiter
  protected boolean isDelimiter(String token)
Checks whether a single token is a delimiter.
 o isWhiteSpace
  protected boolean isWhiteSpace(String token)
Checks whether a single token is whitespace.
 o getFields
  public Enumeration getFields()
Return the fields in the message.
Returns:
An Enumeration of the message fields.
 o 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.
 o 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.
 o 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.
 o getReadString
  public String getReadString()
Returns the KQML message as a single human readable string.
Returns:
Message in string format.
 o 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