adams.data.io.input
Class PropertiesEmailFileReader

java.lang.Object
  extended by adams.core.ConsoleObject
      extended by adams.core.option.AbstractOptionHandler
          extended by adams.data.io.input.AbstractEmailReader
              extended by adams.data.io.input.AbstractEmailFileReader
                  extended by adams.data.io.input.PropertiesEmailFileReader
All Implemented Interfaces:
Debuggable, Destroyable, 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: 7123 $
Author:
fracpete (fracpete at waikato dot ac dot nz)
See Also:
Serialized Form

Field Summary
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_DebugLevel, m_OptionManager
 
Constructor Summary
PropertiesEmailFileReader()
           
 
Method Summary
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, getInput, inputTipText, setInput
 
Methods inherited from class adams.data.io.input.AbstractEmailReader
read
 
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, debug, debug, debugLevelTipText, destroy, finishInit, getDebugLevel, getOptionManager, initialize, isDebugOn, newOptionManager, reset, setDebugLevel, toCommandLine, toString
 
Methods inherited from class adams.core.ConsoleObject
getDebugging, getSystemErr, getSystemOut, 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
 

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
Constructor Detail

PropertiesEmailFileReader

public PropertiesEmailFileReader()
Method Detail

globalInfo

public String globalInfo()
Returns a string describing the object.

Specified by:
globalInfo in class AbstractOptionHandler
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 use
key - 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 use
key - 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 class AbstractEmailReader
Returns:
the email that was read, null in case of error


Copyright © 2013 University of Waikato, Hamilton, NZ. All Rights Reserved.