Class EmailReader
Reads emails (and their attachments) from IMAP mailboxes.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.northconcepts.datapipeline.core.DataEndpoint
DataEndpoint.State -
Field Summary
Fields inherited from class com.northconcepts.datapipeline.core.DataReader
fieldLineage, recordLineageFields inherited from class com.northconcepts.datapipeline.core.DataEndpoint
lastRecord, PRODUCT, PRODUCT_VERSION, VENDOR, XML_INPUT_FACTORY_KEYFields inherited from class com.northconcepts.datapipeline.core.Endpoint
BUFFER_SIZE, captureElapsedTime, DEFAULT_READ_BUFFER_SIZEFields inherited from class com.northconcepts.datapipeline.core.DataObject
id, log, name, TIMESTAMP_FORMAT -
Constructor Summary
ConstructorsConstructorDescriptionEmailReader(MailStore mailStore, String host, int port, String user, String password) EmailReader(MailStore mailStore, String host, String user, String password) Creates a reader that connects to the mail store's default port. -
Method Summary
Modifier and TypeMethodDescriptionaddExceptionProperties(DataException exception) Adds this endpoint's current state to aDataException.voidclose()Indicates that this endpoint has finished reading or writing.Returns the order in which the messages are read (default isFORWARD).Returns the name of the folder to read messages from (default isINBOX).getHost()intgetPort()Returns the properties used to create the mail session; keys not set here fall back to the system properties.SearchTermReturns the criteria selecting which messages are read or null to read every message in the folder.getUser()booleanisDebug()Indicates if debug mode is turned on for the mail session when the reader opens (default is false).voidopen()Makes this endpoint ready for reading or writing.protected RecordreadImpl()Overridden by subclasses to read the next record from thisDataReader.setDebug(boolean debug) Indicates if debug mode is turned on for the mail session when the reader opens (default is false).setDirection(EmailReadDirection direction) Sets the order in which the messages are read; null resets it toFORWARD.setFolderName(String folderName) Sets the name of the folder to read messages from (default isINBOX).setProperty(String key, String value) Sets a property passed to the mail session when the reader is opened.setSearchTerm(SearchTerm searchTerm) Sets the criteria selecting which messages are read; null reads every message in the folder.Methods inherited from class com.northconcepts.datapipeline.core.DataReader
addLineage, available, getBufferSize, getNestedEndpoint, getNestedReader, getReader, getRootEndpoint, getRootReader, isExhausted, isLineageSupported, isSaveLineage, peek, pop, push, read, setSaveLineage, skipMethods inherited from class com.northconcepts.datapipeline.core.DataEndpoint
decrementRecordCount, enableJmx, getLastRecord, getRecordCount, getRecordCountAsBigInteger, getRecordCountAsString, incrementRecordCount, isRecordCountBigInteger, resetRecordCount, toStringMethods inherited from class com.northconcepts.datapipeline.core.Endpoint
addElapsedtime, assertClosed, assertNotOpened, assertOpened, finalize, getClosedOn, getDescription, getElapsedTime, getElapsedTimeAsString, getOpenedOn, getOpenElapsedTime, getOpenElapsedTimeAsString, getSelfTime, getSelfTimeAsString, getState, isCaptureElapsedTime, isClosed, isOpen, setCaptureElapsedTime, setDescription
-
Constructor Details
-
EmailReader
Creates a reader that connects to the mail store's default port. -
EmailReader
-
-
Method Details
-
getProperties
Returns the properties used to create the mail session; keys not set here fall back to the system properties. -
setProperty
Sets a property passed to the mail session when the reader is opened. -
getMailStore
-
getHost
-
getPort
public int getPort() -
getUser
-
getFolderName
Returns the name of the folder to read messages from (default isINBOX). -
setFolderName
Sets the name of the folder to read messages from (default isINBOX). -
getSearchTerm
public SearchTerm getSearchTerm()Returns the criteria selecting which messages are read or null to read every message in the folder. -
setSearchTerm
Sets the criteria selecting which messages are read; null reads every message in the folder. -
getDirection
Returns the order in which the messages are read (default isFORWARD). -
setDirection
Sets the order in which the messages are read; null resets it toFORWARD. -
isDebug
public boolean isDebug()Indicates if debug mode is turned on for the mail session when the reader opens (default is false). -
setDebug
Indicates if debug mode is turned on for the mail session when the reader opens (default is false). -
open
Description copied from class:DataEndpointMakes this endpoint ready for reading or writing.- Overrides:
openin classIntegrationReader- Throws:
DataException
-
close
Description copied from class:DataEndpointIndicates that this endpoint has finished reading or writing.- Overrides:
closein classDataEndpoint- Throws:
DataException
-
readImpl
Description copied from class:DataReaderOverridden by subclasses to read the next record from thisDataReader. The default implementation ofDataReader.read()now insures that this method will not be called again after it returns anull.If no record is available,
nullwill be returned.Contract for subclasses (see also
docs/authoring/DataReader.md):- Return
nullexactly once to signal end-of-stream. - Do not call this method directly —
DataReader.read()is the template method that wraps exceptions, increments the record count, and tracks lineage. - Do not call
DataEndpoint.incrementRecordCount()here;DataReader.read()already does. - Throw raw exceptions;
DataReader.read()wraps them viaexception(throwable).
- Specified by:
readImplin classDataReader- Throws:
Throwable
- Return
-
addExceptionProperties
Description copied from class:EndpointAdds this endpoint's current state to aDataException. Since this method is called whenever an exception is thrown, subclasses should override it to add their specific information.- Overrides:
addExceptionPropertiesin classDataReader
-