Class DialogMessage
package: net.jxta.myjxta.dialog
public class DialogMessage
Version:
$Id: DialogMessage.java,v 1.1 2004/12/19 23:53:46 gonzo Exp $
Author:
james todd [gonzo at jxta dot org]
Field Summary
private String
   The command encapsulated by this DialogMessage
 
public final static String
   The default group of the originator of this DialogMessage
 
public final static String
   The default PeerGroup id of the originator of the DialogMessage
 
public final static String
   The default value for the originator of the DialogMessage
 
private Map
private String
   The PeerGroup id of the originator of the DialogMessage
 
private String
   The group of the originator of this DialogMessage
 
private final static DialogKeys
private DialogKeys
private String
   The label of this DialogMesage instance
 
private String
   The Message encapsulated by this DialogMessage object
 
private final static char
   The character to use as a new line character
 
private String
   The originator of this DialogMessage
 
private Date
   The time this DialogMessage was created
 
Constructor Summary
public
DialogMessage(String message)
   Create a new DialogMessage object that encapsulates the indicated message
 
public
DialogMessage(String originator, String message, String groupId, String groupName)
   Create a new DialogMessage object with the indicated originator and message
 
public
DialogMessage(String originator, String message, String groupId, String groupName, DialogKeys keys)
public
DialogMessage(Message msg)
public
DialogMessage(Message msg, DialogKeys keys)
public
   Create a new DialogMessage object using all the parameters set in dm.
 
Method Summary
public MessageElement
addMessageElement(String key, MessageElement me)
public void
public Object
   Create a copy of this DialogMessage object
 
public String
   Get the command encapsulated by this DialogMessage object
 
protected static String
getElement(Message msg, String tag)
   Get the content of the element with the indicated tag int the Message object msg.
 
protected static String
getElement(Message msg, String tag, String defaultValue)
   Get the content of the element with the indicated tag int the Message object msg.
 
public String
   Get the PeerGroup Id of the originator of this DialogMessage object
 
public String
   Get the PeerGroup name of the originator of this DialogMessage object
 
public DialogKeys
public String
   Get the label encapsulated by this DialogMessage object
 
public String
   Get the message encapsulated by this DialogMessage object
 
public MessageElement
getMessageElement(String key)
public Iterator
public Map
public String
   Get the originator of this DialogMesage object
 
public Date
   Get the time at which this DialogMessage object was created
 
protected void
overlay(DialogMessage dialogMessage)
   Make sure that all the relevant tags of the DialogMessage object are set to sensible default values
 
public void
setCommand(String command)
   Changes the command encapsulated by this DialogMessage object
 
public void
setGroupId(String groupId)
   Changes the PeerGroup Id of the originator of this DialogMessage object
 
public void
setGroupName(String groupName)
   Changes the PeerGroup name of the originator of this DialogMessage object
 
protected void
public void
setLabel(String label)
   Changes the label encapsulated by this DialogMessage object
 
public void
setMessage(String msg)
   Changes the message encapsulated by this DialogMessage object
 
public void
setOriginator(String originator)
   Changes the originator of this DialogMessage object
 
private void
setTimeStamp(Date timeStamp)
   Changes the time this DialogMessage was created
 
public Message
public String
   Get a string representation of this DialogMessage object
 
Field Detail
command
private String command = null
The command encapsulated by this DialogMessage

DEFAULT_GROUP
public final static String DEFAULT_GROUP = "unknown"
The default group of the originator of this DialogMessage

DEFAULT_GROUP_ID
public final static String DEFAULT_GROUP_ID = "unknown"
The default PeerGroup id of the originator of the DialogMessage

DEFAULT_ORIGINATOR
public final static String DEFAULT_ORIGINATOR = "anonymous"
The default value for the originator of the DialogMessage

elements
private Map elements = null

groupId
private String groupId = null
The PeerGroup id of the originator of the DialogMessage

groupName
private String groupName = null
The group of the originator of this DialogMessage

KEYS
private final static DialogKeys KEYS

keys
private DialogKeys keys = KEYS

label
private String label = null
The label of this DialogMesage instance

message
private String message = null
The Message encapsulated by this DialogMessage object

NEW_LINE
private final static char NEW_LINE = '\n'
The character to use as a new line character

originator
private String originator = null
The originator of this DialogMessage

timeStamp
private Date timeStamp = null
The time this DialogMessage was created
Constructor Detail
DialogMessage
public DialogMessage(String message)
Create a new DialogMessage object that encapsulates the indicated message
Parameters:
message the message of the new DialogMessage object

DialogMessage
public DialogMessage(String originator, String message, String groupId, String groupName)
Create a new DialogMessage object with the indicated originator and message
Parameters:
originator the originator of this DialogMessage object
message the message of the new DialogMessage object

DialogMessage
public DialogMessage(String originator, String message, String groupId, String groupName, DialogKeys keys)

DialogMessage
public DialogMessage(Message msg)

DialogMessage
public DialogMessage(Message msg, DialogKeys keys)

DialogMessage
public DialogMessage(DialogMessage dm)
Create a new DialogMessage object using all the parameters set in dm.
Parameters:
dm the DialogMessage object to clone
Method Detail
addMessageElement
public MessageElement addMessageElement(String key, MessageElement me)

addMessageElements
public void addMessageElements(Map me)

clone
public Object clone()
Create a copy of this DialogMessage object
Return:
the newly created copy of this DialogMessage object

getCommand
public String getCommand()
Get the command encapsulated by this DialogMessage object
Return:
the command encapsulated by this DialogMessage object

getElement
protected static String getElement(Message msg, String tag, String defaultValue)
Get the content of the element with the indicated tag int the Message object msg.
Parameters:
msg the Message containing the desired tag
tag the desired tag
defaultValue the value to be returned if the desired tag was not found

getElement
protected static String getElement(Message msg, String tag)
Get the content of the element with the indicated tag int the Message object msg.
Parameters:
msg the Message containing the desired tag
tag the desired tag

getGroupId
public String getGroupId()
Get the PeerGroup Id of the originator of this DialogMessage object
Return:
the PeerGroup Id of the originator of this DialogMessage object

getGroupName
public String getGroupName()
Get the PeerGroup name of the originator of this DialogMessage object
Return:
the PeerGroup name

getKeys
public DialogKeys getKeys()

getLabel
public String getLabel()
Get the label encapsulated by this DialogMessage object
Return:
the label encapsulated by this DialogMessage object

getMessage
public String getMessage()
Get the message encapsulated by this DialogMessage object
Return:
the message encapsulated by this DialogMessage object

getMessageElement
public MessageElement getMessageElement(String key)

getMessageElementIterator
public Iterator getMessageElementIterator()

getMessageElements
public Map getMessageElements()

getOriginator
public String getOriginator()
Get the originator of this DialogMesage object
Return:
the originator of this DialogMesage object

getTimeStamp
public Date getTimeStamp()
Get the time at which this DialogMessage object was created
Return:
the timestamp of this DialogMessage object

overlay
protected void overlay(DialogMessage dialogMessage)
Make sure that all the relevant tags of the DialogMessage object are set to sensible default values
Parameters:
dm the DialogMessage which to check for sensible default values

setCommand
public void setCommand(String command)
Changes the command encapsulated by this DialogMessage object
Parameters:
command the new command encapsulated by this DialogMessage object

setGroupId
public void setGroupId(String groupId)
Changes the PeerGroup Id of the originator of this DialogMessage object
Parameters:
groupId the new PeerGroup Id

setGroupName
public void setGroupName(String groupName)
Changes the PeerGroup name of the originator of this DialogMessage object
Parameters:
groupName the new PeerGroup name

setKeys
protected void setKeys(DialogKeys keys)

setLabel
public void setLabel(String label)
Changes the label encapsulated by this DialogMessage object
Parameters:
label the new label encapsulated by this DialogMessage object

setMessage
public void setMessage(String msg)
Changes the message encapsulated by this DialogMessage object
Parameters:
message the new message
Return:
the new message of this DialogMessage object

setOriginator
public void setOriginator(String originator)
Changes the originator of this DialogMessage object
Parameters:
originator the originator of this DialogMessage object

setTimeStamp
private void setTimeStamp(Date timeStamp)
Changes the time this DialogMessage was created
Parameters:
timeStamp the new timestamp of this DialogMessage object

toMessage
public Message toMessage(DialogMessage template)

toString
public String toString()
Get a string representation of this DialogMessage object
Return:
a string representation of this DialogMessage object