com.emarsys.ecommon.mail
Class JMailProperties

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable<java.lang.Object,java.lang.Object>
          extended by java.util.Properties
              extended by com.emarsys.ecommon.mail.JMailProperties
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.Object,java.lang.Object>

public class JMailProperties
extends java.util.Properties

Special Properties for the use in a JavaMail(tm) environment.

Author:
Michael "kULO" Kulovits
See Also:
Serialized Form

Field Summary
static java.lang.String J_MAIL_FOLDER_IMPL
          specifies the class
static java.lang.String MAIL_DAVMAIL_CLASS
           
static java.lang.String MAIL_DEBUG
           
static java.lang.String MAIL_ENCODING
           
static java.lang.String MAIL_HOST
           
static java.lang.String MAIL_IMAP_CLASS
           
static java.lang.String MAIL_IMAPS_CLASS
           
static java.lang.String MAIL_PASSWORD
           
static java.lang.String MAIL_POP3_CLASS
           
static java.lang.String MAIL_POP3S_CLASS
           
static java.lang.String MAIL_SMTP_CLASS
           
static java.lang.String MAIL_SMTP_HOST
           
static java.lang.String MAIL_SMTP_PORT
           
static java.lang.String MAIL_STORAGE_DEFAULT_FOLDER
          specifies the default folder of a mail storage that will be used if no other folder is defined
static java.lang.String MAIL_STORAGE_EXPUNGE_ERROR_TOLERANCE
          an integer number that specifies how many errors on expunging attempts should be tolerated
static java.lang.String MAIL_STORAGE_EXPUNGE_IMMEDIATELY
          true if this mail folder should expunge mails to be removed immediately or on explicit calling respectively on folder closing
static java.lang.String MAIL_STORAGE_SILENT_ERRORS
          If set to true the JMailStorage will throw MailStorageExceptions only if a further processing is not possible - instead it will log the error and proceed with the processing of the mail storage.
static java.lang.String MAIL_STORE_PROTOCOL
           
static java.lang.String MAIL_USER
           
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
JMailProperties()
           
JMailProperties(java.util.Properties defaults)
           
 
Method Summary
 java.lang.String getDefaultFolderName()
           
static JMailProperties getInstance()
          Factory method.
static JMailProperties getInstance(java.util.Properties props)
          Factory method.
static JMailProperties getInstance(javax.mail.URLName url)
          Factory method that creates new JMailProperties and sets the properties it can get from the passed URLName.
 java.lang.Class<? extends JMailFolder> getJMailFolderImpl()
           
 int getMailStorageErrorTolerance()
           
 boolean getMailStorageExpungeImmediately()
           
static JMailProperties getMockInstance()
           
static JMailProperties getMockInstance(java.util.Properties props)
           
static JMailProperties getMockInstance(javax.mail.URLName url)
          Factory method that creates new JMailProperties and sets the properties it can get from the passed URLName.
 boolean handleErrorsSilently()
          Indicates whether to handle "non-breaking" errors silently or to raise an Exception.
protected  JMailProperties setDebug(boolean debug)
           
 JMailProperties setJMailFolderImplementation(java.lang.Class<? extends JMailFolder> clazz)
           
 JMailProperties setMailEncoding(java.lang.String encoding)
           
 void setMailProperties(javax.mail.URLName url)
           Extracts javamail related properties from the passed URLName if present.
 JMailProperties setMailStorageExpungeErrorTolerance(int errCnt)
           
 JMailProperties setMailStorageExpungeImmediately(boolean expunge)
           
protected  void setPropIfValid(java.lang.String name, java.lang.String value)
           
protected  JMailProperties useMockProviders()
           
 
Methods inherited from class java.util.Properties
getProperty, getProperty, list, list, load, load, loadFromXML, propertyNames, save, setProperty, store, store, storeToXML, storeToXML, stringPropertyNames
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

MAIL_HOST

public static final java.lang.String MAIL_HOST
See Also:
Constant Field Values

MAIL_USER

public static final java.lang.String MAIL_USER
See Also:
Constant Field Values

MAIL_PASSWORD

public static final java.lang.String MAIL_PASSWORD
See Also:
Constant Field Values

MAIL_DEBUG

public static final java.lang.String MAIL_DEBUG
See Also:
Constant Field Values

MAIL_STORE_PROTOCOL

public static final java.lang.String MAIL_STORE_PROTOCOL
See Also:
Constant Field Values

MAIL_SMTP_HOST

public static final java.lang.String MAIL_SMTP_HOST
See Also:
Constant Field Values

MAIL_SMTP_PORT

public static final java.lang.String MAIL_SMTP_PORT
See Also:
Constant Field Values

MAIL_SMTP_CLASS

public static final java.lang.String MAIL_SMTP_CLASS
See Also:
Constant Field Values

MAIL_POP3_CLASS

public static final java.lang.String MAIL_POP3_CLASS
See Also:
Constant Field Values

MAIL_POP3S_CLASS

public static final java.lang.String MAIL_POP3S_CLASS
See Also:
Constant Field Values

MAIL_IMAP_CLASS

public static final java.lang.String MAIL_IMAP_CLASS
See Also:
Constant Field Values

MAIL_IMAPS_CLASS

public static final java.lang.String MAIL_IMAPS_CLASS
See Also:
Constant Field Values

MAIL_DAVMAIL_CLASS

public static final java.lang.String MAIL_DAVMAIL_CLASS
See Also:
Constant Field Values

MAIL_ENCODING

public static final java.lang.String MAIL_ENCODING
See Also:
Constant Field Values

MAIL_STORAGE_SILENT_ERRORS

public static final java.lang.String MAIL_STORAGE_SILENT_ERRORS
If set to true the JMailStorage will throw MailStorageExceptions only if a further processing is not possible - instead it will log the error and proceed with the processing of the mail storage.

See Also:
Constant Field Values

MAIL_STORAGE_DEFAULT_FOLDER

public static final java.lang.String MAIL_STORAGE_DEFAULT_FOLDER
specifies the default folder of a mail storage that will be used if no other folder is defined

See Also:
Constant Field Values

MAIL_STORAGE_EXPUNGE_IMMEDIATELY

public static final java.lang.String MAIL_STORAGE_EXPUNGE_IMMEDIATELY
true if this mail folder should expunge mails to be removed immediately or on explicit calling respectively on folder closing

See Also:
Constant Field Values

MAIL_STORAGE_EXPUNGE_ERROR_TOLERANCE

public static final java.lang.String MAIL_STORAGE_EXPUNGE_ERROR_TOLERANCE
an integer number that specifies how many errors on expunging attempts should be tolerated

See Also:
Constant Field Values

J_MAIL_FOLDER_IMPL

public static final java.lang.String J_MAIL_FOLDER_IMPL
specifies the class

See Also:
Constant Field Values
Constructor Detail

JMailProperties

public JMailProperties()

JMailProperties

public JMailProperties(java.util.Properties defaults)
Parameters:
defaults -
Method Detail

getInstance

public static final JMailProperties getInstance()
Factory method.

Returns:

getInstance

public static final JMailProperties getInstance(java.util.Properties props)
Factory method.

Parameters:
props -
Returns:

getInstance

public static final JMailProperties getInstance(javax.mail.URLName url)
Factory method that creates new JMailProperties and sets the properties it can get from the passed URLName.

Parameters:
url -
Returns:
See Also:
setMailProperties(URLName)

getMockInstance

public static final JMailProperties getMockInstance()
Returns:

getMockInstance

public static final JMailProperties getMockInstance(java.util.Properties props)
Parameters:
props -
Returns:

getMockInstance

public static final JMailProperties getMockInstance(javax.mail.URLName url)
Factory method that creates new JMailProperties and sets the properties it can get from the passed URLName.

Parameters:
url -
Returns:
See Also:
setMailProperties(URLName)

useMockProviders

protected JMailProperties useMockProviders()
Returns:

setDebug

protected JMailProperties setDebug(boolean debug)
Parameters:
debug -
Returns:

setMailProperties

public void setMailProperties(javax.mail.URLName url)

Extracts javamail related properties from the passed URLName if present.

Currently the extraction of properties from the passed url supports only MAIL_STORE_PROTOCOL, MAIL_HOST, MAIL_USER and MAIL_PASSWORD.

Parameters:
url -

setPropIfValid

protected void setPropIfValid(java.lang.String name,
                              java.lang.String value)
Parameters:
name -
value -

handleErrorsSilently

public boolean handleErrorsSilently()
Indicates whether to handle "non-breaking" errors silently or to raise an Exception.

Returns:
true if the MAIL_STORAGE_SILENT_ERRORS is set to true, false otherwise.

getDefaultFolderName

public java.lang.String getDefaultFolderName()
Returns:
the folder name specified by MAIL_STORAGE_DEFAULT_FOLDER or "INBOX" if not set.

getJMailFolderImpl

public java.lang.Class<? extends JMailFolder> getJMailFolderImpl()
Returns:

setJMailFolderImplementation

public JMailProperties setJMailFolderImplementation(java.lang.Class<? extends JMailFolder> clazz)
Parameters:
clazz -
Returns:

getMailStorageExpungeImmediately

public boolean getMailStorageExpungeImmediately()
Returns:

setMailStorageExpungeImmediately

public JMailProperties setMailStorageExpungeImmediately(boolean expunge)
Parameters:
expunge -
Returns:

getMailStorageErrorTolerance

public int getMailStorageErrorTolerance()
Returns:

setMailStorageExpungeErrorTolerance

public JMailProperties setMailStorageExpungeErrorTolerance(int errCnt)
Parameters:
expunge -
Returns:

setMailEncoding

public JMailProperties setMailEncoding(java.lang.String encoding)
Parameters:
encoding -
Returns:


Copyright © 2010 emarsys AG. All Rights Reserved.