Package adams.data.io.input
Class PropertiesEmailFileReader
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.io.input.AbstractEmailReader
-
- adams.data.io.input.AbstractEmailFileReader
-
- adams.data.io.input.PropertiesEmailFileReader
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,FileFormatHandler
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,SizeOfHandler
,EmailFileReader
,EmailReader
,Serializable
public class PropertiesEmailFileReader extends AbstractEmailFileReader
Reads emails stored in properties files.
Valid options are:
-D <int> (property: debugLevel) The greater the number the more additional info the scheme may output to the console (0 = off). default: 0 minimum: 0
-input <adams.core.io.PlaceholderFile> (property: input) The file to read the email from. default: ${CWD}
- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
KEY_ATTACHMENTS
the key for the attachments.static String
KEY_BCC
the key for the bcc recipients.static String
KEY_BODY
the key for the body.static String
KEY_CC
the key for the cc recipients.static String
KEY_FROM
the key for the sender.static String
KEY_SUBJECT
the key for the subject.static String
KEY_TO
the key for the recipients.-
Fields inherited from class adams.data.io.input.AbstractEmailFileReader
m_Input
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description PropertiesEmailFileReader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Email
doRead()
Performs the actual reading.protected EmailAddress[]
getAddresses(Properties props, String key)
Reads the email addresses from the specified property.protected File[]
getFiles(Properties props, String key)
Reads the files from the specified property.String
getFormatDescription()
Returns the description of the file format.String[]
getFormatExtensions()
Returns the extension(s) of the file format (without dot).String
globalInfo()
Returns a string describing the object.-
Methods inherited from class adams.data.io.input.AbstractEmailFileReader
check, defineOptions, getDefaultFormatExtension, getInput, inputTipText, setInput
-
Methods inherited from class adams.data.io.input.AbstractEmailReader
read
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.data.io.input.EmailReader
read
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
KEY_FROM
public static final String KEY_FROM
the key for the sender.- See Also:
- Constant Field Values
-
KEY_TO
public static final String KEY_TO
the key for the recipients.- See Also:
- Constant Field Values
-
KEY_CC
public static final String KEY_CC
the key for the cc recipients.- See Also:
- Constant Field Values
-
KEY_BCC
public static final String KEY_BCC
the key for the bcc recipients.- See Also:
- Constant Field Values
-
KEY_SUBJECT
public static final String KEY_SUBJECT
the key for the subject.- See Also:
- Constant Field Values
-
KEY_BODY
public static final String KEY_BODY
the key for the body.- See Also:
- Constant Field Values
-
KEY_ATTACHMENTS
public static final String KEY_ATTACHMENTS
the key for the attachments.- See Also:
- Constant Field Values
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
getFormatDescription
public String getFormatDescription()
Returns the description of the file format.- Returns:
- the description
-
getFormatExtensions
public String[] getFormatExtensions()
Returns the extension(s) of the file format (without dot).- Returns:
- the extensions (no dot!)
-
getAddresses
protected EmailAddress[] getAddresses(Properties props, String key) throws Exception
Reads the email addresses from the specified property.- Parameters:
props
- the properties to usekey
- the property to read- Returns:
- the generated email addresses
- Throws:
Exception
- in case the splitting fails
-
getFiles
protected File[] getFiles(Properties props, String key) throws Exception
Reads the files from the specified property.- Parameters:
props
- the properties to usekey
- the property to read- Returns:
- the generated files
- Throws:
Exception
- in case the splitting fails
-
doRead
protected Email doRead()
Performs the actual reading.- Specified by:
doRead
in classAbstractEmailReader
- Returns:
- the email that was read, null in case of error
-
-