|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.semanticdesktop.aperture.crawler.mail.DataObjectFactory
public class DataObjectFactory
Creates a set of DataObjects from a MimeMessage.
DataObjectFactory interprets the structure of a MimeMessage and creates a list of DataObjects that model its contents in a way that is most natural to users. Practically this means that the DataObject list should be as similar as possible to how mail readers present the mail.
For example, a multipart/alternative message may have a rather complex object structure (a Part with a MultiPart content, on its turn containing two BodyParts), but this is translated to a single DataObject holding all the mail metadata (sender, receiver, etc) as well as an InputStream accessing the simplest of the two body parts (typically the text/plain part).
Known bugs/features:
Nested Class Summary | |
---|---|
static interface |
DataObjectFactory.PartStreamFactory
Obtains InputStreams from Part instances. |
Constructor Summary | |
---|---|
DataObjectFactory(javax.mail.internet.MimeMessage message,
RDFContainerFactory containerFactory,
DataObjectFactory.PartStreamFactory streamFactory,
DataSource dataSource,
URI messageUri,
URI folderUri)
A simplified constructor that implies the default part uri delimiter |
|
DataObjectFactory(javax.mail.internet.MimeMessage message,
RDFContainerFactory containerFactory,
DataObjectFactory.PartStreamFactory streamFactory,
DataSource dataSource,
URI messageUri,
URI folderUri,
String partUriDelimiter)
A little simplified constructor that implies the attachment uri prefix to be the same as the message URI. |
|
DataObjectFactory(javax.mail.internet.MimeMessage message,
RDFContainerFactory containerFactory,
DataObjectFactory.PartStreamFactory streamFactory,
DataSource dataSource,
URI messageUri,
URI folderUri,
String partUriDelimiter,
String attachmentUriPrefix)
Constructs a data object factory for the given message |
Method Summary | |
---|---|
void |
disposeRemainingObjects()
Disposes of the data objects remaining on the list of objects to return. |
Map<URI,DataObject> |
getAllDataObjects()
Returns a map containing all data objects, indexed by their URIs (from DataObject.getID() |
DataObject |
getObject()
Returns a DataObject representing a single message. |
DataObject |
getObject(String url)
Returns a data object with the given url, the data object will be removed from the list of data objects to remove. |
DataObject |
getObjectAndDisposeAllOtherObjects(String url)
Returns a data object with the given url chosen from the set of objects created from the MimeMessage instance passed to the constructor of this DataObjectFactory. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DataObjectFactory(javax.mail.internet.MimeMessage message, RDFContainerFactory containerFactory, DataObjectFactory.PartStreamFactory streamFactory, DataSource dataSource, URI messageUri, URI folderUri, String partUriDelimiter, String attachmentUriPrefix) throws IOException, javax.mail.MessagingException
message
- containerFactory
- executorService
- streamFactory
- a factory of streams for mail parts, this parameter can be null, in which case a
default implementation will be used, that simply calls Part.getInputStream()
dataSource
- messageUri
- folderUri
- partUriDelimiter
- attachmentUriPrefix
-
IOException
javax.mail.MessagingException
public DataObjectFactory(javax.mail.internet.MimeMessage message, RDFContainerFactory containerFactory, DataObjectFactory.PartStreamFactory streamFactory, DataSource dataSource, URI messageUri, URI folderUri, String partUriDelimiter) throws IOException, javax.mail.MessagingException
message
- containerFactory
- streamFactory
- dataSource
- messageUri
- folderUri
- partUriDelimiter
-
IOException
javax.mail.MessagingException
public DataObjectFactory(javax.mail.internet.MimeMessage message, RDFContainerFactory containerFactory, DataObjectFactory.PartStreamFactory streamFactory, DataSource dataSource, URI messageUri, URI folderUri) throws IOException, javax.mail.MessagingException
message
- containerFactory
- executorService
- streamFactory
- dataSource
- messageUri
- folderUri
-
IOException
javax.mail.MessagingException
Method Detail |
---|
public DataObject getObject() throws javax.mail.MessagingException, IOException
javax.mail.MessagingException
IOException
public void disposeRemainingObjects()
public DataObject getObject(String url)
disposeRemainingObjects()
method and therefore must
be disposed manually by the user.
url
-
public DataObject getObjectAndDisposeAllOtherObjects(String url)
url
-
public Map<URI,DataObject> getAllDataObjects() throws javax.mail.MessagingException, IOException
DataObject.getID()
DataObject.getID()
javax.mail.MessagingException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |