Class UpdateMessage

java.lang.Object
zleurtor.scanmanager.model.messages.AbstractMessage
zleurtor.scanmanager.model.messages.UpdateMessage
All Implemented Interfaces:
Serializable

public class UpdateMessage extends AbstractMessage
The message sent by the server to update a slave.
Author:
Zleurtor
See Also:
  • Constructor Details

    • UpdateMessage

      public UpdateMessage()
      Constructs an empty message.
  • Method Details

    • newMessages

      public static final List<UpdateMessage> newMessages(File theUpdateFile, String thePrefix, String theSuffix) throws IOException
      Create a new list of messages for the given update file.
      Parameters:
      theUpdateFile - The update file.
      thePrefix - The update file prefix.
      theSuffix - The update file suffix.
      Returns:
      A list of messages for the given update file.
      Throws:
      IOException - if an I/O error occurs while reading the update file.
    • getId

      public String getId()
      Returns the update id.
      Returns:
      The update id.
    • getFileContent

      public final byte[] getFileContent()
      Returns the file content of the update.
      Returns:
      The file content of the update.
    • getPrefix

      public String getPrefix()
      Returns the update file prefix.
      Returns:
      The update file prefix.
    • getSuffix

      public String getSuffix()
      Returns the update file suffix.
      Returns:
      The update file suffix.
    • getTotalChunks

      public final int getTotalChunks()
      Returns the total number of chunks for the update file.
      Returns:
      The total number of chunks for the update file.
    • getChunkNumber

      public int getChunkNumber()
      Returns the current chunk number in the update file.
      Returns:
      The current chunk number in the update file.
    • toXml

      Description copied from class: AbstractMessage
      Transform this message to an XML description.
      Specified by:
      toXml in class AbstractMessage
      Returns:
      An XML describing this message.
      Throws:
      ParserConfigurationException - If a DocumentBuildercannot be created which satisfies the configuration requested.
      TransformerFactoryConfigurationError - Thrown in case of service configuration error or ifthe implementation is not available or cannot be instantiated.
      TransformerException - When it is not possible to create a Transformer instance or if an unrecoverable error occurs during the course of the transformation.
      IOException - If an I/O error occurs.
    • fromXml

      Description copied from class: AbstractMessage
      Set this message values to the ones in the given XML description.
      Specified by:
      fromXml in class AbstractMessage
      Parameters:
      xml - The XML containing the values to set in this message.
      Returns:
      This message.
      Throws:
      SAXException - If any parse errors occur.
      IOException - If any IO errors occur.
      ParserConfigurationException - If a DocumentBuildercannot be created which satisfies the configuration requested.
      XPathExpressionException - If an XPath expression cannot be evaluated.