Main Page | Packages | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

org.openmobileis.synchro.openmsp.protocol.Message Class Reference

List of all members.

Detailed Description

Title: OpenMobileIS project source
Description: Represents a OpenMSP message container a Header and set of commands A Message has a counter to manage cmdId and a ContainerMessage representing the root element.

A ContainerMessage contains a Element as value and an array for the children (which are either ContainerMessage or AtomicMessage). To create a command, you have to know if it is a container or an atomic command element, BUT YOU NEVER CREATE AtomicMessage, you've just add the Element to the parent. To create a new message or a message from a string containing an XML representation, call MessageFactory.getFactory() which in charge of creating messages. ********************************************** **** How to build a OpenMSP message ? ******** ********************************************** 1. Get a Message from the factory : MessageFactory.getFactory().createMessage(new Header(sessionID, source, target)) you can also create an header by giving credential information. 2. Add commands to the Message. Message.add(aContainerMessage) if the commands contains subcommands or Message.add(aElement) if the element is an atomic command such as Status or Item. 3. Create a request command having source and target (Sync or Map) new CmlContainerCommand(new Command(message.nextCmdId(), Element.SYNC, aSource, aTarget)) 4. Create a simple request command : Get, Add, Delete, Replace new CmlContainerCommand(new CmlResquestCommand(message.nextCmdId(), Element.ADD)) 5. Add items to a command myMessageContainer.add(new Item(Element.ITEM, source, target)) or myMessageContainer.add(new DataItem(Element.ADD, data, meta, source, target)) myMessageMapContainer.add(new Item(Element.MAP_ITEM, source, target)) 6. Create a result new CmlContainer(new Result(message.nextCmdId(), cmdRef, meta, sourceRef, targetRef)) 7. Create a status new CmlContainer(new Status(message.nextCmdId(), cmdRef, Status.STATUS_OK) ****************************************************** See org.openmobileis.common.synchro.OpenMSP.tests.Example to have a complete example

Author:
Philippe Delrieu
Since:
JDK 1.1
Version:
1.0.

Definition at line 67 of file Message.java.

Public Member Functions

boolean isFinal ()
boolean isEmpty ()
void add (ContainerMessage container) throws OpenMSPException
void add (Element element) throws OpenMSPException
ContainerMessage getRoot ()
boolean hasMoreMessage ()
void resetCursor ()
ContainerMessage nextMessage ()
Header getHeader ()
String encode ()

Protected Member Functions

 Message (Header header, boolean isFinal)
 Message (ContainerMessage root, boolean isFinal)
void setFinal (boolean isFinalMessage)
int nextCmdId ()
void setCmdIds (ContainerMessage container)

Protected Attributes

ContainerMessage root
int cmdIdCounter = 0
boolean isFinal = true

Static Package Attributes

static final long serialVersionUID = 1L
 Set version of the serialized data to make it compatible with new class versions.


The documentation for this class was generated from the following file:
Generated on Wed Dec 14 21:05:40 2005 for OpenMobileIS by  doxygen 1.4.4