com.web_visage.ichat
Class DefaultMessageFactory

java.lang.Object
  extended by com.web_visage.ichat.AbstractMessageFactory
      extended by com.web_visage.ichat.DefaultMessageFactory
All Implemented Interfaces:
IChatMessageConstants, IChatMessageFactory

public class DefaultMessageFactory
extends AbstractMessageFactory

Creates client messages.

Author:
K.Baturytski

Field Summary
 
Fields inherited from interface com.web_visage.ichat.IChatMessageConstants
BEGIN_END_MARKER, COMMON_LINE, ICHAT_TAG, PRIVATE_TAG, SEPARATOR, WILDCARD
 
Method Summary
 IChatForwardMessage createForwardMessage(IChatSender aSender, java.lang.String aReceiver, IChatMessage aMessage)
          Creates public "transport" message.
 IChatMessage[] createMessage(byte[] aCryptedMessage)
          Creates message from the raw byte form.
 IChatServerForwardMessage createServerForwardMessage(IChatMessage aMessage)
          Creates server "forward" message.
static DefaultMessageFactory getSingleton()
          Returns singleton instance.
 
Methods inherited from class com.web_visage.ichat.AbstractMessageFactory
createAlertMessage, createBoardMessage, createBroadcastMessage, createConnectMessage, createConnectToLineMessage, createCreateLineMessage, createCreateMessage, createDisconnectFromLineMessage, createDisconnectMessage, createMeMessage, createPrivateMessage, createPublicMessage, createReceivedMessage, createRefreshBoardMessage, createRefreshLineMessage, createRefreshMessage, createRenameMessage, createStatusMessage, createStatusReqMessage
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createForwardMessage

public IChatForwardMessage createForwardMessage(IChatSender aSender,
                                                java.lang.String aReceiver,
                                                IChatMessage aMessage)
Creates public "transport" message. Forward message is a wrapper for all messages types.

Parameters:
aSender - - a sender object
aReceiver - - receiver name or '*' for all
aMessage - - unencrypted message to wrap
Returns:
ready to send forward message (with encrypted message inside)

createServerForwardMessage

public IChatServerForwardMessage createServerForwardMessage(IChatMessage aMessage)
Creates server "forward" message. Acts as transport wrapper for all message types delivered to client.

Parameters:
aMessage -
Returns:

createMessage

public IChatMessage[] createMessage(byte[] aCryptedMessage)
                             throws IChatException
Creates message from the raw byte form. Since there is possibility to have more than one message in a block, function returns an array of messages.

Parameters:
aCryptedMessage - - crypted raw byte data
Returns:
Throws:
IChatException

getSingleton

public static DefaultMessageFactory getSingleton()
Returns singleton instance.

Returns: