org.semanticdesktop.aperture.extractor.mime
Class MailUtil

java.lang.Object
  extended by org.semanticdesktop.aperture.extractor.mime.MailUtil

public class MailUtil
extends Object

Utility methods for JavaMail.


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 getDates(javax.mail.Message message, RDFContainer container)
          Adds the information about dates pertaining to the given message.
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MailUtil

public MailUtil()
Method Detail

getDates

public static void getDates(javax.mail.Message message,
                            RDFContainer container)
                     throws javax.mail.MessagingException
Adds the information about dates pertaining to the given message. In compliance with the previous versions of this method, it adds the current date as the received date of the message if neither the sent date nor the received date are specified.

Parameters:
message - the message
container - the container where the metadata should be stored
Throws:
javax.mail.MessagingException

addAddressMetadata

public static void addAddressMetadata(javax.mail.internet.InternetAddress address,
                                      URI predicate,
                                      RDFContainer metadata)
                               throws ModelException
Add statements modeling the specified address metadata to the RDFContainer, using the specified predicate to connect the address resource to the mail resource.

Parameters:
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.
Throws:
ModelException

getPersonURI

public static String getPersonURI(String email,
                                  String name)
                           throws IllegalArgumentException
Derive a URI for a person based on an email address and a name that can be used in an RDF graph. At least one of these properties has to have a real value.

Parameters:
email - The email address of the person (optional).
name - The name of the person (optional).
Returns:
A URI String that can be used to model the person.
Throws:
IllegalArgumentException - when both the email address and the name do not have reasonable values.


Copyright © 2010 Aperture Development Team. All Rights Reserved.