NextApp Echo3
v3.0.b4

nextapp.echo.webcontainer
Class ServerMessage

java.lang.Object
  extended by nextapp.echo.webcontainer.ServerMessage

public class ServerMessage
extends java.lang.Object

The outgoing XML message which synchronizes the state of the client to that of the server.


Field Summary
static java.lang.String GROUP_ID_INIT
          Constant for the "init" message part group.
static java.lang.String GROUP_ID_UPDATE
          Constant for the "update" message part group.
 
Constructor Summary
ServerMessage()
          Creates a new ServerMessage.
 
Method Summary
 org.w3c.dom.Element addDirective(java.lang.String groupId, java.lang.String processor)
          Adds a "message-part" to the document that will be processed by the specified client-side processor object.
 org.w3c.dom.Element addDirective(java.lang.String groupId, java.lang.String processor, java.lang.String directiveName)
          Creates and appends a directive element beneath to a message part.
 void addLibrary(java.lang.String serviceId)
          Adds a JavaScript library service to be dynamically loaded.
 org.w3c.dom.Element addPartGroup(java.lang.String groupId)
          Adds a "group" to the document.
 org.w3c.dom.Document getDocument()
          Returns the XML DOM.
 org.w3c.dom.Element getPartGroup(java.lang.String groupId)
          Retrieves the "message-part-group" element pertaining to a specific group.
 void setAttribute(java.lang.String attributeName, java.lang.String attributeValue)
          Sets an arbitrary attribute on the root element.
 void setResync()
          Sets the "resync" attribute to true, indicating that the server is recovering from a condition where the client has become out of sync.
 void setTransactionId(long transactionId)
          Sets the numeric identifier for this transaction, which will be returned in next client message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GROUP_ID_INIT

public static final java.lang.String GROUP_ID_INIT
Constant for the "init" message part group. Message parts in this group are processed before the "update" group.

See Also:
Constant Field Values

GROUP_ID_UPDATE

public static final java.lang.String GROUP_ID_UPDATE
Constant for the "update" message part group. Message parts in this group are processed after the "init" group.

See Also:
Constant Field Values
Constructor Detail

ServerMessage

public ServerMessage()
Creates a new ServerMessage.

Method Detail

addLibrary

public void addLibrary(java.lang.String serviceId)
Adds a JavaScript library service to be dynamically loaded.

Parameters:
serviceId - the id of the service to load (the service must return JavaScript code with content-type "text/javascript")

addPartGroup

public org.w3c.dom.Element addPartGroup(java.lang.String groupId)
Adds a "group" to the document. Part groups enable certain groups of operations, e.g., remove operations, to be performed before others, e.g., add operations.

Parameters:
groupId - the identifier of the group
Returns:
the created "message-part-group" element.

getPartGroup

public org.w3c.dom.Element getPartGroup(java.lang.String groupId)
Retrieves the "message-part-group" element pertaining to a specific group.

Parameters:
groupId - the id of the group
Returns:
the "message-part-group" element

addDirective

public org.w3c.dom.Element addDirective(java.lang.String groupId,
                                        java.lang.String processor)
Adds a "message-part" to the document that will be processed by the specified client-side processor object.

Parameters:
groupId - the id of the group to which the "message-part" element should be added
processor - the name of the client-side processor object which will process the message part, e.g., "EchoEventUpdate", or "EchoDomUpdate"
Returns:
the created "message-part" element

addDirective

public org.w3c.dom.Element addDirective(java.lang.String groupId,
                                        java.lang.String processor,
                                        java.lang.String directiveName)
Creates and appends a directive element beneath to a message part. Attempts to append the directive to an existing message part if the last message part in the specified group happens to have the same processor as is specified by the processor argument. If this is not possible, a new "message-part" element is created and the directive is added to it.

Parameters:
groupId -
processor - the name of the client-side processor object which will process the message part, e.g., "EchoEventUpdate", or "EchoDomUpdate"
directiveName - the name of the directive, e.g., "event-add" or "dom-remove".
Returns:
the directive element

getDocument

public org.w3c.dom.Document getDocument()
Returns the XML DOM.

Returns:
the XML DOM

setAttribute

public void setAttribute(java.lang.String attributeName,
                         java.lang.String attributeValue)
Sets an arbitrary attribute on the root element.

Parameters:
attributeName - the attribute name
attributeValue - the attribute value

setResync

public void setResync()
Sets the "resync" attribute to true, indicating that the server is recovering from a condition where the client has become out of sync. This can occur if two browsers are manipulating the same user instance.


setTransactionId

public void setTransactionId(long transactionId)
Sets the numeric identifier for this transaction, which will be returned in next client message.

Parameters:
transactionId - the transaction identifier

NextApp Echo3
v3.0.b4