Class WhoAreYouMessage
java.lang.Object
zleurtor.scanmanager.model.messages.AbstractMessage
zleurtor.scanmanager.model.messages.WhoAreYouMessage
- All Implemented Interfaces:
Serializable
The message sent by the server to ask a slave to identify itself.
- Author:
- Zleurtor
- See Also:
-
Field Summary
Fields inherited from class zleurtor.scanmanager.model.messages.AbstractMessage
DISCOVER, LOGGER, STOP
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs an empty message.WhoAreYouMessage
(int theHeartbeatPort, int theHeartbeatPeriod) Constructs message with the given heartbeat port and period. -
Method Summary
Modifier and TypeMethodDescriptionprotected final AbstractMessage
Set this message values to the ones in the given XML description.int
The period between two heartbeat messages.int
The port on which heartbeat messages are accepted.protected final String
toXml()
Transform this message to an XML description.Methods inherited from class zleurtor.scanmanager.model.messages.AbstractMessage
serialize, unserialize
-
Constructor Details
-
WhoAreYouMessage
public WhoAreYouMessage()Constructs an empty message. -
WhoAreYouMessage
public WhoAreYouMessage(int theHeartbeatPort, int theHeartbeatPeriod) Constructs message with the given heartbeat port and period.- Parameters:
theHeartbeatPort
- The port on which heartbeat messages are accepted.theHeartbeatPeriod
- The period between two heartbeat messages.
-
-
Method Details
-
getHeartbeatPort
public int getHeartbeatPort()The port on which heartbeat messages are accepted.- Returns:
- The port on which heartbeat messages are accepted.
-
getHeartbeatPeriod
public int getHeartbeatPeriod()The period between two heartbeat messages.- Returns:
- The period between two heartbeat messages.
-
toXml
protected final String toXml() throws ParserConfigurationException, TransformerFactoryConfigurationError, TransformerException, IOExceptionDescription copied from class:AbstractMessage
Transform this message to an XML description.- Specified by:
toXml
in classAbstractMessage
- 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
protected final AbstractMessage fromXml(String xml) throws SAXException, IOException, ParserConfigurationException, XPathExpressionException Description copied from class:AbstractMessage
Set this message values to the ones in the given XML description.- Specified by:
fromXml
in classAbstractMessage
- 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.
-