|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.semanticdesktop.aperture.crawler.mail.MailUtil
public class MailUtil
Utility methods for JavaMail.
Nested Class Summary | |
---|---|
static class |
MailUtil.LiberalInternetAddress
|
Constructor Summary | |
---|---|
MailUtil()
|
Method Summary | |
---|---|
static void |
addAddressMetadata(javax.mail.internet.InternetAddress address,
URI predicate,
RDFContainer metadata)
Add statements modeling the specified address metadata to the RDFContainer, using the specified predicate to connect the address resource to the mail resource. |
static void |
addAddressMetadata(MailUtil.LiberalInternetAddress address,
URI predicate,
RDFContainer metadata)
Add statements modeling the specified address metadata to the RDFContainer, using the specified predicate to connect the address resource to the mail resource. |
static String |
decodeText(String encodedText)
Alternative for MimeUtility.decodeText(String) with a less strict
parsing algorithm. |
static List<MailUtil.LiberalInternetAddress> |
getAddressHeader(javax.mail.Message msg,
String name)
|
static String |
getHash(javax.mail.internet.MimeMessage msg)
Returns the hash of the message. |
static String |
getMessageId(javax.mail.internet.MimeMessage message)
Returns a string containing the id of the message together with its hash. |
static String |
getMessageIdWithHeadersHash(javax.mail.Message message)
Returns a string containing the id of the message together with its hash. |
static URI |
getParent(DataObject object)
Returns the URI of the object's parent in the containment hierachy. |
static String |
getPersonURI(String email,
String name)
Derive a URI for a person based on an email address and a name that can be used in an RDF graph. |
static Date |
getStereotypicalContentCreatedDate(javax.mail.Message message)
Returns the stereotypical date of a Message. |
static List<MailUtil.LiberalInternetAddress> |
parseAddressHeaderValue(String header)
Parses a value of an address header and extracts email addresses. |
static Date |
parseReceivedHeader(String st)
Parses a single "Received" header and extracts the date time from it. |
static void |
registerParentRelationshipInAccessData(DataObject object,
AccessData accessData)
Stores in the AccessData the fact that the given object has a parent. |
static String |
utf7Decode(String input)
Converts in the UTF7 encoding to it's "normal" UTF16 representation. |
static String |
utf7Encode(String input)
Converts a string (possibly containing non-ascii characters) to it's representation in the UTF7-IMAP encoding. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MailUtil()
Method Detail |
---|
public static String utf7Encode(String input)
input
- the input string
public static String utf7Decode(String input)
input
- the input string in UTF7
public static List<MailUtil.LiberalInternetAddress> getAddressHeader(javax.mail.Message msg, String name) throws javax.mail.MessagingException
javax.mail.MessagingException
public static List<MailUtil.LiberalInternetAddress> parseAddressHeaderValue(String header)
header
-
public static String decodeText(String encodedText)
MimeUtility.decodeText(String)
with a less strict
parsing algorithm. The algorithm is (and will be) tuned to what we see
"in the wild".
encodedText
- The RFC 2047 encoded text.
public static Date getStereotypicalContentCreatedDate(javax.mail.Message message) throws javax.mail.MessagingException
message
- the message we want to get the date for
javax.mail.MessagingException
public static void addAddressMetadata(javax.mail.internet.InternetAddress address, URI predicate, RDFContainer metadata)
address
- The InternetAddress that will be encoded in the RDF model.predicate
- The property URI that will be used to connect the address metadata to the mail
resource.metadata
- The RDFContainer that will receive the RDF statements and whose described URI is
expected to represent the mail resource.public static void addAddressMetadata(MailUtil.LiberalInternetAddress address, URI predicate, RDFContainer metadata)
address
- The InternetAddress that will be encoded in the RDF model.predicate
- The property URI that will be used to connect the address metadata to the mail
resource.metadata
- The RDFContainer that will receive the RDF statements and whose described URI is
expected to represent the mail resource.public static String getPersonURI(String email, String name) throws IllegalArgumentException
email
- The email address of the person (optional).name
- The name of the person (optional).
IllegalArgumentException
- when both the email address and the name do not have reasonable
values.public static void registerParentRelationshipInAccessData(DataObject object, AccessData accessData)
Stores in the AccessData the fact that the given object has a parent.
This method first searches for the parent for the given data object (see getParent(DataObject)
If it finds one, it puts a reference between the two. (see
AccessData.putReferredID(String, String)
).
The parent must already exist within the access data. (see AccessData.isKnownId(String)
).
Otherwise this method won't do anything. This enforces that parents must be crawled and stored in the
access data before their children.
object
- the object whose parent is to be recorded in the access dataaccessData
- the access data where the parent-child relationship is to be recorded, it must
already know the parent (AccessData.isKnownId(String)
)public static URI getParent(DataObject object)
Returns the URI of the object's parent in the containment hierachy.
B is a parent of A is there exists a triple A nie:isPartOf B. In case there is more than one such resource, or the resource is not an URI, this method returns null.
object
- the object whose parent we're looking
public static Date parseReceivedHeader(String st) throws ParseException
Date
instance
st
- the "Received" header content (without the 'Received: ') prefix itself.
Date
for the reception date extracted from this header
ParseException
public static String getMessageId(javax.mail.internet.MimeMessage message) throws javax.mail.MessagingException
<messageIdValue>-<messageHash>where:
getHash(MimeMessage)
message
-
javax.mail.MessagingException
public static String getHash(javax.mail.internet.MimeMessage msg) throws javax.mail.MessagingException, IOException
msg
-
javax.mail.MessagingException
IOException
public static String getMessageIdWithHeadersHash(javax.mail.Message message) throws javax.mail.MessagingException
<messageIdValue>-<messageHash>where:
message
-
javax.mail.MessagingException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |