EnvelopQuerySender¶
-
public class
EnvelopQuerySender
extends HttpSender¶ The
EnvelopSender
is abstract base class for sending HTTP remote request to H2O for querying the message envelop through the administration page.Author: Twinsen Tsang
Constructors¶
EnvelopQuerySender¶
-
protected
EnvelopQuerySender
(FileLogger logger, Data d)¶ Explicit Constructor. Create an instance of
EnvelopQuerySender
Parameters: - logger – The logger for log the sending process.
- d – The data used for generate Envelop query request. It must be a kind of Admin data.
Methods¶
getEnvelopStream¶
-
public final InputStream
getEnvelopStream
()¶ This method should be called after executed
run()
successfully.Returns: The message envelop stream.
getMessageBoxMapping¶
-
protected Map
getMessageBoxMapping
()¶ Get the message box mapping from standardized representation to proprietary representation. It should return a HashMap like this:
HashMap m = new HashMap(); m.put(MSGBOX_IN , "Your Inbox representation"); m.put(MSGBOX_OUT, "Your outbox representation");
Returns: the message box mapping. See also:
EnvelopQuerySender.MSGBOX_IN
,EnvelopQuerySender.MSGBOX_OUT
getMessageBoxToDownload¶
getMessageIdToDownload¶
onCreateRequest¶
-
protected HttpMethod
onCreateRequest
()¶ [@EVENT] This method is invoked when the sender is required to create a HTTP Request from configuration. It generates a form-url-encoded content embedded in the HTTP POST request. It contains two parameters, message_id and message_box. The value of these parameters are extracted from
getMessageIdToDownload()
andgetMessageBoxToDownload()
respectively. NOTE: The values of message_box parameter may differ to what you see because it may transformgetMessageBoxMapping()
.Throws: - NullPointerException – When
getMessageIdToDownload()
return null. WhengetMessageBoxToDownload()
return empty or null. - IllegalArgumentException – When
getMessageBoxToDownload()
return string not equal to ‘INBOX’ and ‘OUTBOX’
- NullPointerException – When
onResponse¶
-
protected void
onResponse
()¶ [@EVENT] This method is invoked when received the reply HTTP response from the server. It saves the response body stream and then available to get through by
getEnvelopStream()
setMessageCriteriaToDownload¶
-
public final void
setMessageCriteriaToDownload
(String messageId, String messageBox)¶ Set the message criteria for down-load the message envelop (and payload).
Parameters: - messageId – The message id to down-load the message envelop.
- messageBox – The message box to down-load the message envelop. either INBOX or OUTBOX.
Throws: - NullPointerException – When
getMessageIdToDownload()
return null. WhengetMessageBoxToDownload()
return empty or null. - IllegalArgumentException – When
getMessageBoxToDownload()
return string not equal to ‘INBOX’ and ‘OUTBOX’