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

com.ibm.able.examples.conversation
Class AmabSelectionMessageForm

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

public class AmabSelectionMessageForm
extends java.lang.Object
implements MessageForm

This class represents the message-form used during the AMAB Conversation by the buyer to indicate a selection from the Offer set provided by the seller

See Also:
MessageForm, MessageFormFactory

Field Summary
protected static java.lang.String NAME_KEY
           
protected static java.lang.String SELECTION_KEY
           
 
Constructor Summary
AmabSelectionMessageForm()
          Default Constructor
AmabSelectionMessageForm(java.lang.String newName)
          Single Argument Constructor - as required by the MessageFormFactory
 
Method Summary
 void clearData()
          Sets selection to zero.
 javax.agent.Payload formMessagePayload()
          Creates a message, using constituent data that was stored inside this MessageForm object.
 java.lang.Object[] getData()
          Returns the selection, packed into a length-1 array.
 java.lang.String getName()
          Return the name
 int getSelection()
          Return the selection value
protected  javax.agent.Payload makePayload(java.lang.String localName, java.lang.Integer i)
          internal function to create a payload for contituent data
 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 selection
 void setName(java.lang.String newName)
          Set the name of the Selection Message
 void setSelection(int selection)
          Set the selection value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME_KEY

protected static final java.lang.String NAME_KEY

SELECTION_KEY

protected static final java.lang.String SELECTION_KEY
Constructor Detail

AmabSelectionMessageForm

public AmabSelectionMessageForm()
Default Constructor

AmabSelectionMessageForm

public AmabSelectionMessageForm(java.lang.String newName)
Single Argument Constructor - as required by the MessageFormFactory
Method Detail

getName

public java.lang.String getName()
Return the name

Returns:
the name

setName

public void setName(java.lang.String newName)
Set the name of the Selection Message

Parameters:
newName - the name

getSelection

public int getSelection()
Return the selection value

Returns:
the selection value

setSelection

public void setSelection(int selection)
Set the selection value

Parameters:
selection - the actual selection value

setData

public void setData(java.lang.Object[] data)
             throws java.lang.IllegalArgumentException
Tries to set the selection

Specified by:
setData in interface MessageForm
Parameters:
data - Length-1 array containing an Integer as its first (and only) element.

getData

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

clearData

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

makePayload

protected javax.agent.Payload makePayload(java.lang.String localName,
                                          java.lang.Integer i)
internal function to create a payload for contituent data

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)

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

(C) Copyright IBM Corporation 1999, 2003