ABLE 2.0.0 07/02/2003 10:25:01

com.ibm.able.conversation
Class TextMessageForm

java.lang.Object
  |
  +--com.ibm.able.conversation.TextMessageForm
All Implemented Interfaces:
MessageForm

public class TextMessageForm
extends java.lang.Object
implements MessageForm

This is a MessageForm for messages with two String-valued elements, "name" and "text". The "name" is considered a property of this MessageForm, while the "text" is considered the constituent data.
The name may be used in either of two ways:
1. "free": when parsing, the name is extracted from the message and discarded. Any non-null value is acceptible; parse(...) returns true.
2. "fixed": when parsing, the name extracted from the message is tested against the value stored in this MessageForm. For parsing to be successful, it has to match.
In both cases, the message is formed in the same way.

OLD VERSION -- TO BE DELETED Replaced by com.ibm.able.converstion.JasStringLiteralTransform.


Field Summary
protected static java.lang.String NAME_KEY
           
protected static java.lang.String TEXT_KEY
           
 
Constructor Summary
TextMessageForm()
          Constructors
TextMessageForm(java.lang.String newName)
           
TextMessageForm(java.lang.String newName, boolean newFixed)
           
 
Method Summary
 void clearData()
          Sets text to null.
 javax.agent.Payload formMessagePayload()
          Creates a message, using constituent data that was stored inside this MessageForm object.
 java.lang.Object[] getData()
          Returns the text, packed into a length-1 array.
 java.lang.String getName()
           
 java.lang.String getText()
           
 boolean isNameFixed()
           
static void main(java.lang.String[] args)
          For testing only.
protected  javax.agent.Payload makePayload(java.lang.String localName, java.lang.String localText)
           
 boolean parseMessagePayload(javax.agent.Payload messagePayload)
          Parses the message into its constituent data, which is (supposed to be) stored inside this message-form object in a type-specific way.
 javax.agent.Payload sampleMessagePayload()
          Return a "sample message" showing the format, but with dummy data values.
 void setData(java.lang.Object[] data)
          Tries to set the text.
 void setName(java.lang.String newName)
           
 void setNameFixed(boolean newValue)
           
 void setText(java.lang.String newText)
           
 java.lang.String toString()
          Here, we print both the properties and the constituent data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NAME_KEY

protected static final java.lang.String NAME_KEY

TEXT_KEY

protected static final java.lang.String TEXT_KEY
Constructor Detail

TextMessageForm

public TextMessageForm()
Constructors

TextMessageForm

public TextMessageForm(java.lang.String newName)

TextMessageForm

public TextMessageForm(java.lang.String newName,
                       boolean newFixed)
Method Detail

getName

public java.lang.String getName()

setName

public void setName(java.lang.String newName)

isNameFixed

public boolean isNameFixed()

setNameFixed

public void setNameFixed(boolean newValue)

getText

public java.lang.String getText()

setText

public void setText(java.lang.String newText)

setData

public void setData(java.lang.Object[] data)
             throws java.lang.IllegalArgumentException
Tries to set the text.
Specified by:
setData in interface MessageForm
Parameters:
data - Length-1 array containing a String as its firstr (and only) element.

getData

public java.lang.Object[] getData()
Returns the text, packed into a length-1 array. (To get the name, use getName()).
Specified by:
getData in interface MessageForm

clearData

public void clearData()
Sets text to null. Does NOT change name.
Specified by:
clearData in interface MessageForm

makePayload

protected javax.agent.Payload makePayload(java.lang.String localName,
                                          java.lang.String localText)

formMessagePayload

public javax.agent.Payload formMessagePayload()
                                       throws java.lang.IllegalStateException
Description copied from interface: MessageForm
Creates a message, using constituent data that was stored inside this MessageForm object. If there's something wrong with the data--e.g., if it hasn't been set, or has been set to bad values, throws an IllegalStateException.
Specified by:
formMessagePayload in interface MessageForm
See Also:
MessageForm.formMessagePayload()

sampleMessagePayload

public javax.agent.Payload sampleMessagePayload()
Description copied from interface: MessageForm
Return a "sample message" showing the format, but with dummy data values. This is inherently limited, because we're not characterizing the range of possible messages. We're only giving one example.
Specified by:
sampleMessagePayload in interface MessageForm
See Also:
MessageForm.sampleMessagePayload()

parseMessagePayload

public boolean parseMessagePayload(javax.agent.Payload messagePayload)
Description copied from interface: MessageForm
Parses the message into its constituent data, which is (supposed to be) stored inside this message-form object in a type-specific way.
Specified by:
parseMessagePayload in interface MessageForm
See Also:
MessageForm.parseMessagePayload(Payload)

toString

public java.lang.String toString()
Here, we print both the properties and the constituent data. That's no good.
Overrides:
toString in class java.lang.Object

main

public static void main(java.lang.String[] args)
For testing only.

ABLE 2.0.0 07/02/2003 10:25:01

(C) Copyright IBM Corporation 1999, 2003