All Packages Class Hierarchy This Package Previous Next Index
Class org.mitre.cvw.mcp.Message
java.lang.Object
|
+----java.util.Dictionary
|
+----java.util.Hashtable
|
+----org.mitre.cvw.mcp.Message
- public class Message
- extends Hashtable
The MOO Client Protocol Message object.
A MOO Client Protocol message has a name, an optional
authorization, and a collection of key-value pairs.
The value associated with a key is a string or an array of strings.
Names and keys are identifiers.
An identifier is made of a letter or underscore followed by any number
of letters, underscores, digits, or minus signs.
Message names and keywords are case-insensitive.
-
Message(String, String)
- Constructs a MOO Client Protocol message object without any arguments.
-
display(PrintWriter)
- Prints an MCP message on a print writer stream.
-
getArray(String)
- Get a string array value associated with the key.
-
getAuth()
- Get the authorization key
The authorization key has been interned.
-
getName()
- Get the name of the message.
-
getString(String)
- Get a string value associated with the key.
-
isIdentifier(String)
- Is the string an identifier?
-
isUnquotedString(String)
- Does the string not require quoting?
-
makeMessage(String)
- Create an MCP message with the authorization copied from this object.
-
put(String, Object)
- Associates a value with a key.
-
toString()
- Returns a string representation of the object.
Message
public Message(String name,
String auth)
- Constructs a MOO Client Protocol message object without any arguments.
- Parameters:
- name - the name of the message
- auth - the authorization key
getName
public String getName()
- Get the name of the message.
The name has been interned.
getAuth
public String getAuth()
- Get the authorization key
The authorization key has been interned.
getString
public String getString(String key)
- Get a string value associated with the key.
If the value associated with the key is not a string,
null is return.
- Parameters:
- key - a symbol without the trailing colon character.
- Returns:
- the value for the key or null if the key
is not associated with a string in the MCP message.
getArray
public String[] getArray(String key)
- Get a string array value associated with the key.
If the value associated with the key is not a string array,
null is return.
- Parameters:
- key - a symbol without the trailing colon character.
- Returns:
- the value for the key or null if the key
is not associated with a string array in the MCP message.
put
public Object put(String key,
Object value)
- Associates a value with a key.
- Parameters:
- key - the specified key in the MCP message
- value - associated with the key
- Returns:
- the old value of the key, or null if it did not have one.
makeMessage
public Message makeMessage(String name)
- Create an MCP message with the authorization copied from this object.
- Parameters:
- name - the name of the request.
display
public void display(PrintWriter pw)
- Prints an MCP message on a print writer stream.
Complete lines are assemble and then supplied to the print writer.
As a result, other threads can write text lines or
MCP messages with multiline values to a shared print writer.
- Parameters:
- pw - the print writer for output.
toString
public String toString()
- Returns a string representation of the object.
- Returns:
- this message as a string.
- Overrides:
- toString in class Hashtable
isIdentifier
public static boolean isIdentifier(String s)
- Is the string an identifier?
- Parameters:
- s - the string
- Returns:
- true if string is an identifier
isUnquotedString
public static boolean isUnquotedString(String s)
- Does the string not require quoting?
- Parameters:
- s - the string
- Returns:
- true if string is a string that does not require quoting
All Packages Class Hierarchy This Package Previous Next Index