Class Message

java.lang.Object
com.jalios.jstore.jsync.Message
Direct Known Subclasses:
AckMessage, CommitWorkMessage, DisjoinMessage, JoinMessage, SuggestJoinMessage, UpdateMessage

public abstract class Message extends Object
This abstract class is the super class of all JSync message classes
Author:
Olivier Dedieu
  • Field Details

    • urid

      protected String urid
    • time

      protected long time
  • Constructor Details

    • Message

      public Message(String urid)
      Constructs a new Message
      Parameters:
      urid - the urid of the sender (i.e. replica that sends this message)
      Since:
      jcms-4.1
    • Message

      public Message(org.jdom.Element root)
      Constructs a new Message from an XML element
      Parameters:
      root - the root element
      Since:
      jcms-4.1
  • Method Details

    • getUrid

      public String getUrid()
      Returns:
      the urid of the sender
      Since:
      jcms-4.1
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toXml

      public abstract String toXml()
      Returns:
      an XML representation of this message
      Since:
      jcms-4.1
    • stampToXml

      public String stampToXml(Stamp stamp)
      Parameters:
      stamp - the stamp to represents in XML
      Returns:
      an XML representation of the given stamp
      Since:
      jcms-4.1
    • getXmlHeader

      public String getXmlHeader()
      Returns:
      the XML header of JSync messages
      Since:
      jcms-4.1
    • getXmlFooter

      public String getXmlFooter()
      Returns:
      the XML footer of JSync messages
      Since:
      jcms-4.1
    • parse

      public static Message parse(String xml) throws org.jdom.JDOMException, IOException
      Parse the given XML strings and builds the corresponding JSync message
      Parameters:
      xml - the XML to parse
      Returns:
      a sub-class of Message or null if the message parsing has failed.
      Throws:
      org.jdom.JDOMException - if an error occurs
      IOException - if an error occurs
      Since:
      jcms-4.1
    • getTime

      public long getTime()