public class Configuration extends Object implements ConfigurationMBean
This class represents the configuration of Aspirin. You can configure this software two ways:
There is a way to change behavior of Aspirin dinamically. You can use JMX
to change configuration parameters. In the parameters list we marked the
parameters which are applied immediately. For more informations view
ConfigurationMBean.
| Name | Type | Description |
|---|---|---|
| aspirin.delivery.attempt.delay | Integer | The delay of next attempt to delivery in milliseconds. Change by JMX applied immediately. |
| aspirin.delivery.attempt.count | Integer | Maximal number of delivery attempts of an email. Change by JMX applied immediately. |
| aspirin.delivery.bounce-on-failure | Boolean | If true, a bounce email will be send to postmaster on failure. Change by JMX applied immediately. |
| aspirin.delivery.debug | Boolean | If true, full SMTP communication will be logged. Change by JMX applied immediately. |
| aspirin.delivery.expiry | Long | Time of sending expiry in milliseconds. The queue send an email until current time = queueing time + expiry. Default value is -1, it means forever (no expiration time). Change by JMX applied immediately. |
| aspirin.delivery.threads.active.max | Integer | Maximum number of active delivery threads in the pool. Change by JMX applied immediately. |
| aspirin.delivery.threads.idle.max | Integer | Maximum number of idle delivery threads in the pool (the deilvery threads over this limit will be shutdown). Change by JMX applied immediately. |
| aspirin.delivery.timeout | Integer | Socket and Transport timeout in milliseconds.
Change by JMX applied immediately. |
| aspirin.encoding | String | The MIME encoding. Change by JMX applied immediately. |
| aspirin.hostname | String | The hostname. Change by JMX applied immediately. |
| aspirin.logger.name | String | The name of the logger. Change by JMX applied immediately. WARNING! Changing logger name cause replacing of logger. |
| aspirin.logger.prefix | String | The prefix of the logger. This will be put in the logs at the first position. Change by JMX applied immediately. |
| aspirin.postmaster.email | String | The email address of the postmaster. Change by JMX applied immediately. |
| aspirin.mailstore.class | String | The class name of mail store. Default class is SimpleMailStore in org.masukomi.aspirin.core.store package. |
| aspirin.queuestore.class | String | The class name of queue store. Default class is SimpleQueueStore in org.masukomi.aspirin.core.queue package. |
| Modifier and Type | Class and Description |
|---|---|
private class |
Configuration.Parameter |
| Modifier and Type | Field and Description |
|---|---|
private Map<String,Object> |
configParameters |
private Object |
listenerLock |
private List<ConfigurationChangeListener> |
listeners |
private static org.slf4j.Logger |
log |
private static String |
MAIL_MIME_CHARSET |
private static String |
MAIL_SMTP_CONNECTIONTIMEOUT |
private static String |
MAIL_SMTP_HOST |
private static String |
MAIL_SMTP_LOCALHOST |
private static String |
MAIL_SMTP_TIMEOUT |
private javax.mail.Session |
mailSession |
private MailStore |
mailStore |
protected javax.mail.internet.InternetAddress |
postmaster |
NEVER_EXPIRES, PARAM_DELIVERY_ATTEMPT_COUNT, PARAM_DELIVERY_ATTEMPT_DELAY, PARAM_DELIVERY_BOUNCE_ON_FAILURE, PARAM_DELIVERY_DEBUG, PARAM_DELIVERY_EXPIRY, PARAM_DELIVERY_THREADS_ACTIVE_MAX, PARAM_DELIVERY_THREADS_IDLE_MAX, PARAM_DELIVERY_TIMEOUT, PARAM_ENCODING, PARAM_HOSTNAME, PARAM_LOGGER_NAME, PARAM_LOGGER_PREFIX, PARAM_MAILSTORE_CLASS, PARAM_POSTMASTER_EMAIL| Constructor and Description |
|---|
Configuration() |
Configuration(Properties props) |
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(ConfigurationChangeListener listener) |
int |
getDeliveryAttemptCount() |
int |
getDeliveryAttemptDelay() |
int |
getDeliveryThreadsActiveMax() |
int |
getDeliveryThreadsIdleMax() |
int |
getDeliveryTimeout() |
String |
getEncoding() |
long |
getExpiry() |
String |
getHostname() |
String |
getLoggerName() |
String |
getLoggerPrefix() |
javax.mail.Session |
getMailSession() |
MailStore |
getMailStore() |
String |
getMailStoreClassName() |
javax.mail.internet.InternetAddress |
getPostmaster() |
String |
getPostmasterEmail() |
Object |
getProperty(String name) |
void |
init(Properties props) |
boolean |
isDeliveryBounceOnFailure() |
boolean |
isDeliveryDebug() |
private void |
notifyListeners(String changedParameterName) |
void |
removeListener(ConfigurationChangeListener listener) |
void |
setDeliveryAttemptCount(int attemptCount)
Set the maximal count of delivery tries of a temporary undeliverable
email.
|
void |
setDeliveryAttemptDelay(int delay)
Set the time interval between two delivery attempts of a temporary
undeliverable email.
|
void |
setDeliveryBounceOnFailure(boolean bounce)
Set the bounce email sending (on delivery failures).
|
void |
setDeliveryDebug(boolean debug)
Set the debug of full SMTP communication.
|
void |
setDeliveryThreadsActiveMax(int activeThreadsMax)
Set the maximal count of paralel running delivery threads.
|
void |
setDeliveryThreadsIdleMax(int idleThreadsMax)
Set the maximal count of idle delivery threads stored in pool.
|
void |
setDeliveryTimeout(int timeout)
Set the timeout of
Transport and Socket which is used if
communication is too slow. |
void |
setEncoding(String encoding)
Set the encoding of MIME messages.
|
void |
setExpiry(long expiry)
Set the default expiry of MIME messages.
|
void |
setHostname(String hostname)
Set the hostname, which is used in HELO command of SMTP communication.
|
void |
setMailStore(MailStore mailStore) |
void |
setMailStoreClassName(String className)
Set the mail store class name, where MimeMessages will be stored.
|
void |
setPostmasterEmail(String emailAddress)
Set the email address of postmaster.
|
void |
setProperty(String name,
Object value) |
private void |
updateMailSession() |
private static final org.slf4j.Logger log
private MailStore mailStore
protected javax.mail.internet.InternetAddress postmaster
private javax.mail.Session mailSession
private List<ConfigurationChangeListener> listeners
private Object listenerLock
private static final String MAIL_MIME_CHARSET
private static final String MAIL_SMTP_CONNECTIONTIMEOUT
private static final String MAIL_SMTP_HOST
private static final String MAIL_SMTP_LOCALHOST
private static final String MAIL_SMTP_TIMEOUT
public Configuration()
public Configuration(Properties props)
public void init(Properties props)
public javax.mail.internet.InternetAddress getPostmaster()
public String getHostname()
getHostname in interface ConfigurationMBeanpublic void setHostname(String hostname)
ConfigurationMBeansetHostname in interface ConfigurationMBeanhostname - The name of this server or application.public String getEncoding()
getEncoding in interface ConfigurationMBeanpublic void setEncoding(String encoding)
ConfigurationMBeansetEncoding in interface ConfigurationMBeanencoding - The MIME encoding.public int getDeliveryAttemptCount()
getDeliveryAttemptCount in interface ConfigurationMBeanpublic int getDeliveryAttemptDelay()
getDeliveryAttemptDelay in interface ConfigurationMBeanpublic int getDeliveryThreadsActiveMax()
getDeliveryThreadsActiveMax in interface ConfigurationMBeanpublic int getDeliveryThreadsIdleMax()
getDeliveryThreadsIdleMax in interface ConfigurationMBeanpublic int getDeliveryTimeout()
getDeliveryTimeout in interface ConfigurationMBeanTransport timeout in a delivery.public long getExpiry()
getExpiry in interface ConfigurationMBeanpublic String getLoggerName()
getLoggerName in interface ConfigurationMBeanpublic String getLoggerPrefix()
getLoggerPrefix in interface ConfigurationMBeanpublic MailStore getMailStore()
public String getPostmasterEmail()
getPostmasterEmail in interface ConfigurationMBeanpublic boolean isDeliveryBounceOnFailure()
isDeliveryBounceOnFailure in interface ConfigurationMBeanpublic boolean isDeliveryDebug()
isDeliveryDebug in interface ConfigurationMBeanpublic void setDeliveryAttemptCount(int attemptCount)
ConfigurationMBeansetDeliveryAttemptCount in interface ConfigurationMBeanattemptCount - The count of deliery attempts.public void setDeliveryAttemptDelay(int delay)
ConfigurationMBeansetDeliveryAttemptDelay in interface ConfigurationMBeandelay - The value of delay in milliseconds.public void setDeliveryBounceOnFailure(boolean bounce)
ConfigurationMBeansetDeliveryBounceOnFailure in interface ConfigurationMBeanbounce - If true, then a bounce email will be send to postmaster
on delivery failures.public void setDeliveryDebug(boolean debug)
ConfigurationMBeansetDeliveryDebug in interface ConfigurationMBeandebug - If true, then the full communication will be logged.public void setDeliveryThreadsActiveMax(int activeThreadsMax)
ConfigurationMBeansetDeliveryThreadsActiveMax in interface ConfigurationMBeanpublic void setDeliveryThreadsIdleMax(int idleThreadsMax)
ConfigurationMBeansetDeliveryThreadsIdleMax in interface ConfigurationMBeanpublic void setDeliveryTimeout(int timeout)
ConfigurationMBeanTransport and Socket which is used if
communication is too slow.setDeliveryTimeout in interface ConfigurationMBeantimeout - The value of timeout in milliseconds.public void setExpiry(long expiry)
ConfigurationMBeansetExpiry in interface ConfigurationMBeanexpiry - The default expiry time.public void setMailStore(MailStore mailStore)
public void setPostmasterEmail(String emailAddress)
ConfigurationMBeansetPostmasterEmail in interface ConfigurationMBeanemailAddress - The email address of postmaster.public void addListener(ConfigurationChangeListener listener)
public void removeListener(ConfigurationChangeListener listener)
private void notifyListeners(String changedParameterName)
public String getMailStoreClassName()
getMailStoreClassName in interface ConfigurationMBeanpublic void setMailStoreClassName(String className)
ConfigurationMBeanSimpleMailStore and FileMailStore.setMailStoreClassName in interface ConfigurationMBeanpublic javax.mail.Session getMailSession()
private void updateMailSession()
Copyright © 2013. All Rights Reserved.