|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.harvard.deas.hyperenc.EmailHyperCommunicator
public class EmailHyperCommunicator
Sends and receives messages via e-mail. Each EmailHyperCommunicator sends and receives messages for a particular e-mail account. Clients may request that messages be sent from that account, and may check for incoming messages to that account.
The presence of an e-mail header with the name specified in
HYPERENC_HEADER
indicates that the e-mail contains a
hyper-encrypted message. E-mail messages without this header are ignored. The
value of the header indicates the format of the body. The only format
currently supported is "text"; that format is described below. Future
implementations may support XML-based bodies or other formats.
The address specified in the From:
e-mail header corresponds to
the sender field of a HyperMessage. The address specified in the
To:
header corresponds to the recipient field of a
HyperMessage. If the e-mail Message has more than one recipient, all but the
first are ignored. These addresses are converted to their corresponding
Contacts by looking up the Address in the ContactList provided at
construction.
The "text" format is a hastily-assembled, somewhat fragile format for encoding hyper-encryption messages. Future versions will support improved formats (XML-based, for example).
An e-mail body with the "text" format has five sections, which may appear in any order: type, block list, MAC, subject, and content. (Message produced by this class give the five sections in that order.) The sections may be separated by any number of newlines; leading and trailing whitespace in all sections is ignored.
HyperMAC
. If the message does not contain a MAC, the MAC
section must still be present, but contains only whitespace.
ContactList
,
HyperMAC
Field Summary | |
---|---|
static String |
HYPERENC_HEADER
|
Constructor Summary | |
---|---|
EmailHyperCommunicator(Properties accountInfo,
ContactList contactList)
Creates a new EmailHyperCommunicator with the given account information. |
Method Summary | |
---|---|
protected Message |
makeMessage(HyperMessage hm,
Session session)
Converts an HyperMessage into a Message containing the
same data. |
protected HyperMessage |
processMessage(Message msg)
Create a HyperMessage from the given Message. |
List<HyperMessage> |
receive()
Retrieves incoming messages from the e-mail server. |
void |
send(HyperMessage hm)
Send a HyperMessage via e-mail. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String HYPERENC_HEADER
Constructor Detail |
---|
public EmailHyperCommunicator(Properties accountInfo, ContactList contactList)
accountInfo
- a Properties object holding the account details for the e-mail
account this EmailHyperCommunicator should use.contactList
- a list of Contacts; the EmailHyperCommunicator uses this list to
look up the Contact that corresponds to a given AddressMethod Detail |
---|
public void send(HyperMessage hm)
hm
to a
Message
using makeMessage
, then sends it
over a Transport
created using this
EmailHyperCommunicator's account info.
send
in interface HyperCommunicator
hm
- the HyperMessage to be sentprotected Message makeMessage(HyperMessage hm, Session session)
Message
containing the
same data. The returned Message is constructed using the account
information from this Transmitter and is ready to be sent via e-mail.
The format of the returned Message is specified by the documentation for the EmailHyperCommunicator class.
hm
- HyperMessage to be convertedsession
- the Session
containing mail properties used to
send this message
hm
public List<HyperMessage> receive()
Message
s to HyperMessages using
processMessage
.
receive
in interface HyperCommunicator
protected HyperMessage processMessage(Message msg) throws MessageParseException
null
. If msg
does not have a received date
(obtained via getReceivedDate()
), the current time is used.
The recipient and sender Address of the message are converted to Contacts
using the contactMap
with which this HyperCommunicator was
constructed.
The format expected when parsing the given Message is specified by the documentation for the EmailHyperCommunicator class.
msg
- The received Message
msg
,
or null
if msg
is not a hyper-encryption
message
MessageParseException
- if the body of msg
could not be parsed
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |