public final class MessageUtil
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static ch.iec.tc57._2011.schema.message.RequestMessage |
createRequestWithBinaryPayload(java.lang.String name,
byte[] binary,
EnumMessageFormat format)
Creates a request message with binary payload.
|
static ch.iec.tc57._2011.schema.message.RequestMessage |
createRequestWithBinaryPayload(java.lang.String name,
java.lang.StringBuilder binaryB64,
EnumMessageFormat format)
Creates a request message with binary payload.
|
static ch.iec.tc57._2011.schema.message.RequestMessage |
createRequestWithCompressedXmlPayload(java.lang.StringBuilder xmlMessage)
Creates a request message with compressed xml message.
|
static ch.iec.tc57._2011.schema.message.RequestMessage |
createRequestWithOptions(EnumVerb verb,
EnumNoun noun,
java.util.Map<java.lang.String,java.lang.String> options)
Creates a request message with the given options.
|
static ch.iec.tc57._2011.schema.message.RequestMessage |
createRequestWithOptions(java.lang.String verb,
java.lang.String noun,
java.util.Map<java.lang.String,java.lang.String> options)
Creates a request message with the given options.
|
static ch.iec.tc57._2011.schema.message.RequestMessage |
createRequestWithPayload(java.lang.String verb,
java.lang.String noun,
java.lang.StringBuilder xmlMessage)
Creates a request message with a payload.
|
static ch.iec.tc57._2011.schema.message.ResponseMessage |
createResponseWithBinaryPayload(EnumMessageStatus status,
java.lang.String name,
byte[] binary,
EnumMessageFormat format)
Creates a ResponseMessage with a binary content.
|
static ch.iec.tc57._2011.schema.message.ResponseMessage |
createResponseWithBinaryPayload(EnumMessageStatus status,
java.lang.String name,
java.lang.StringBuilder binaryB64,
EnumMessageFormat format)
Creates a ResponseMessage with a binary content.
|
static ch.iec.tc57._2011.schema.message.ResponseMessage |
createResponseWithNoPayload(EnumMessageStatus status)
Creates an empty response (with no payload).
|
static ch.iec.tc57._2011.schema.message.ResponseMessage |
createResponseWithPayload(EnumNoun noun,
EnumMessageStatus status,
org.w3c.dom.Element msgPayload)
Creates a
ResponseMessage with the given parameters and payload. |
static ch.iec.tc57._2011.schema.message.ResponseMessage |
createResponseWithPayload(java.lang.String noun,
EnumMessageStatus status,
org.w3c.dom.Element msgPayload)
Creates a
ResponseMessage with the given parameters and payload. |
static java.util.Map<java.lang.String,java.lang.Object> |
getRequestMessageOptions(ch.iec.tc57._2011.schema.message.RequestMessage message)
Returns a
Map with the given RequestMessage options. |
static java.util.Map<java.lang.String,java.lang.Object> |
getRequestMessageOptionsAllowingErrors(ch.iec.tc57._2011.schema.message.RequestMessage message)
Returns a
Map with the given RequestMessage options ignoring invalid date format parameters and duplicates. |
static java.lang.String |
responsePayload2String(ch.iec.tc57._2011.schema.message.ResponseMessage responseMessage)
Returns the operation response's payload content as a String.
|
static void |
validateMessage(java.lang.StringBuilder stringMessage)
Validates against schema the given IEC 61968-100 message.
|
static void |
validateMessage(StringBuilderMessage msg)
Validates against schema the given IEC 61968-100 message.
|
public static ch.iec.tc57._2011.schema.message.RequestMessage createRequestWithOptions(EnumVerb verb, EnumNoun noun, java.util.Map<java.lang.String,java.lang.String> options)
verb - Request verbnoun - Request nounoptions - Options to be included in the request.public static ch.iec.tc57._2011.schema.message.RequestMessage createRequestWithOptions(java.lang.String verb,
java.lang.String noun,
java.util.Map<java.lang.String,java.lang.String> options)
verb - Request verbnoun - Request nounoptions - Options to be included in the request.public static java.util.Map<java.lang.String,java.lang.Object> getRequestMessageOptions(ch.iec.tc57._2011.schema.message.RequestMessage message)
Map with the given RequestMessage options. The start time and end time are also included in the map.message - Request message.public static java.util.Map<java.lang.String,java.lang.Object> getRequestMessageOptionsAllowingErrors(ch.iec.tc57._2011.schema.message.RequestMessage message)
Map with the given RequestMessage options ignoring invalid date format parameters and duplicates.
The start time and end time are also included in the map.message - Request message.public static ch.iec.tc57._2011.schema.message.RequestMessage createRequestWithPayload(java.lang.String verb,
java.lang.String noun,
java.lang.StringBuilder xmlMessage)
throws javax.xml.parsers.ParserConfigurationException,
org.xml.sax.SAXException,
java.io.IOException
verb - Message verb.noun - Message noun.xmlMessage - Document payload.javax.xml.parsers.ParserConfigurationException - If the current configuration does not support xml parsing.org.xml.sax.SAXException - If the given payload is not well formed.java.io.IOException - If it is not possible to read the given xml payload.public static ch.iec.tc57._2011.schema.message.RequestMessage createRequestWithCompressedXmlPayload(java.lang.StringBuilder xmlMessage)
throws java.io.IOException
xmlMessage - Xml document (payload) to be transmited.java.io.IOException - If the given xml cannot be compressed.public static ch.iec.tc57._2011.schema.message.RequestMessage createRequestWithBinaryPayload(java.lang.String name,
java.lang.StringBuilder binaryB64,
EnumMessageFormat format)
name - Name for binary files. For compressed XML documents this value is not necessary (name will be taken form the xml document during procesing)binaryB64 - Binary data in B64.format - Optional value for the binary format. if null XML will be used.public static ch.iec.tc57._2011.schema.message.RequestMessage createRequestWithBinaryPayload(java.lang.String name,
byte[] binary,
EnumMessageFormat format)
name - Binary name (file name).binary - Binary data as byte[].format - Optional value for the binary format. if null XML will be used.public static ch.iec.tc57._2011.schema.message.ResponseMessage createResponseWithPayload(EnumNoun noun, EnumMessageStatus status, org.w3c.dom.Element msgPayload)
ResponseMessage with the given parameters and payload.noun - Header noun.status - Header statusmsgPayload - Message payloadpublic static ch.iec.tc57._2011.schema.message.ResponseMessage createResponseWithPayload(java.lang.String noun,
EnumMessageStatus status,
org.w3c.dom.Element msgPayload)
ResponseMessage with the given parameters and payload.noun - Header noun.status - Header statusmsgPayload - Message payloadpublic static ch.iec.tc57._2011.schema.message.ResponseMessage createResponseWithNoPayload(EnumMessageStatus status)
status - Response's status OK / FAILED.public static ch.iec.tc57._2011.schema.message.ResponseMessage createResponseWithBinaryPayload(EnumMessageStatus status, java.lang.String name, byte[] binary, EnumMessageFormat format)
status - Message status (OK, FAILED)name - Binary file name.binary - Binary context as byte[].format - Binary format. if null EnumMessageFormat.XML is set.public static ch.iec.tc57._2011.schema.message.ResponseMessage createResponseWithBinaryPayload(EnumMessageStatus status, java.lang.String name, java.lang.StringBuilder binaryB64, EnumMessageFormat format)
status - Message status (OK, FAILED)name - Binary file name.binaryB64 - Binary context in B64.format - Binary format. if null EnumMessageFormat.XML is set.public static void validateMessage(StringBuilderMessage msg) throws org.xml.sax.SAXException
msg - A StringBuilderMessage with 61968-100 message.org.xml.sax.SAXException - If the message is not valid against schema.public static void validateMessage(java.lang.StringBuilder stringMessage)
throws org.xml.sax.SAXException
stringMessage - A String representation of the xml messageorg.xml.sax.SAXException - If the message is not valid against schema.public static java.lang.String responsePayload2String(ch.iec.tc57._2011.schema.message.ResponseMessage responseMessage)
throws javax.xml.transform.TransformerException,
javax.xml.parsers.ParserConfigurationException
responseMessage - Response message received from server.null is returned.javax.xml.transform.TransformerException - If the response cannot be transformed as an String.javax.xml.parsers.ParserConfigurationException - If the response cannot be transformed as an string.