Class MailConfigurationServiceImpl
- java.lang.Object
-
- com.atlassian.bamboo.admin.configuration.MailConfigurationServiceImpl
-
- All Implemented Interfaces:
MailConfigurationService
public class MailConfigurationServiceImpl extends Object implements MailConfigurationService
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.atlassian.bamboo.admin.configuration.MailConfigurationService
MailConfigurationService.MailMode
-
-
Constructor Summary
Constructors Constructor Description MailConfigurationServiceImpl(SecretEncryptionService secretEncryptionService, BambooPermissionManager bambooPermissionManager, com.atlassian.struts.TextProvider textProvider)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddeleteMailServer()Delete the current mail server configuration@NotNull com.atlassian.mail.server.SMTPMailServergetMailServer()Retrieve the current mail server configurationbooleanisMailServerConfigured()Returns true if mail server configuration exists@NotNull com.atlassian.mail.server.SMTPMailServerupdateMailServer(@Nullable String name, @Nullable String fromAddress, @Nullable String subjectPrefix, @Nullable Boolean precedenceBulkHeaderExcluded, @Nullable MailConfigurationService.MailMode emailSetting, @Nullable String smtpServer, @Nullable String smtpPort, @Nullable String smtpUsername, @Nullable String smtpPassword, @Nullable Boolean tlsEnabled, @Nullable String jndiLocation)Update the current mail server configuration@NotNull com.atlassian.mail.server.SMTPMailServerupdateMailServer(@Nullable String name, @Nullable String fromAddress, @Nullable String subjectPrefix, @Nullable Boolean precedenceBulkHeaderExcluded, @Nullable String emailSetting, @Nullable String smtpServer, @Nullable String smtpPort, @Nullable String smtpUsername, @Nullable String smtpPassword, @Nullable Boolean tlsEnabled, @Nullable String jndiLocation)Update the current mail server configuration@NotNull List<String>validateJndiLocation(@NotNull String jndiName)Validates JNDI location for mail server.
-
-
-
Constructor Detail
-
MailConfigurationServiceImpl
@Inject public MailConfigurationServiceImpl(@Lazy SecretEncryptionService secretEncryptionService, BambooPermissionManager bambooPermissionManager, com.atlassian.struts.TextProvider textProvider)
-
-
Method Detail
-
isMailServerConfigured
public boolean isMailServerConfigured() throws UnauthorisedExceptionDescription copied from interface:MailConfigurationServiceReturns true if mail server configuration exists- Specified by:
isMailServerConfiguredin interfaceMailConfigurationService- Returns:
- boolean true if server configuration exists, false otherwise
- Throws:
UnauthorisedException- if user does not have appropriate permissions (System Administrator)
-
getMailServer
@NotNull public @NotNull com.atlassian.mail.server.SMTPMailServer getMailServer() throws UnauthorisedException, NotFoundExceptionDescription copied from interface:MailConfigurationServiceRetrieve the current mail server configuration- Specified by:
getMailServerin interfaceMailConfigurationService- Returns:
- current mail server configuration
- Throws:
UnauthorisedException- if user does not have appropriate permissions (System Administrator)NotFoundException- if no mail server configuration is set
-
updateMailServer
@NotNull public @NotNull com.atlassian.mail.server.SMTPMailServer updateMailServer(@Nullable @Nullable String name, @Nullable @Nullable String fromAddress, @Nullable @Nullable String subjectPrefix, @Nullable @Nullable Boolean precedenceBulkHeaderExcluded, @Nullable @Nullable String emailSetting, @Nullable @Nullable String smtpServer, @Nullable @Nullable String smtpPort, @Nullable @Nullable String smtpUsername, @Nullable @Nullable String smtpPassword, @Nullable @Nullable Boolean tlsEnabled, @Nullable @Nullable String jndiLocation) throws WebValidationException, UnauthorisedExceptionDescription copied from interface:MailConfigurationServiceUpdate the current mail server configuration- Specified by:
updateMailServerin interfaceMailConfigurationService- Parameters:
name- name of the email serverfromAddress- an email address Bamboo-generated emails are sent from, must be a valid email addresssubjectPrefix- prefix added to the email subjectprecedenceBulkHeaderExcluded- whether to exclude "precedence:bulk" email headeremailSetting- must be either "JNDI" or "SMTP"smtpServer- address of SMTP server,nullfor "JDNI"smtpPort- port of SMTP server,nullfor "JNDI"smtpUsername- user name,nullfor "JNDI"smtpPassword- password,nullfor "JNDI"tlsEnabled- whether TLS is enabled,nullfor "JNDI"jndiLocation- JNDI address specyfing email server,nullfor "SMTP"- Returns:
- SMTPMailServer - mail server configuration after the update
- Throws:
WebValidationException- if the supplied parameters are invalidUnauthorisedException- if user does not have appropriate permissions (System Administrator)
-
updateMailServer
@NotNull public @NotNull com.atlassian.mail.server.SMTPMailServer updateMailServer(@Nullable @Nullable String name, @Nullable @Nullable String fromAddress, @Nullable @Nullable String subjectPrefix, @Nullable @Nullable Boolean precedenceBulkHeaderExcluded, @Nullable @Nullable MailConfigurationService.MailMode emailSetting, @Nullable @Nullable String smtpServer, @Nullable @Nullable String smtpPort, @Nullable @Nullable String smtpUsername, @Nullable @Nullable String smtpPassword, @Nullable @Nullable Boolean tlsEnabled, @Nullable @Nullable String jndiLocation) throws WebValidationException, UnauthorisedExceptionDescription copied from interface:MailConfigurationServiceUpdate the current mail server configuration- Specified by:
updateMailServerin interfaceMailConfigurationService- Parameters:
name- name of the email serverfromAddress- an email address Bamboo-generated emails are sent from, must be a valid email addresssubjectPrefix- prefix added to the email subjectprecedenceBulkHeaderExcluded- whether to exclude "precedence:bulk" email headeremailSetting- MailMode.JNDI or MailMode.SMTPsmtpServer- address of SMTP server,nullfor JDNIsmtpPort- port of SMTP server,nullfor JNDIsmtpUsername- user name,nullfor JNDIsmtpPassword- password,nullfor JNDItlsEnabled- whether TLS is enabled,nullfor JNDIjndiLocation- JNDI address specyfing email server,nullfor SMTP- Returns:
- SMTPMailServer - mail server configuration after the update
- Throws:
WebValidationException- if the supplied parameters are invalidUnauthorisedException- if user does not have appropriate permissions (System Administrator)
-
deleteMailServer
public void deleteMailServer() throws NotFoundException, com.atlassian.mail.MailExceptionDescription copied from interface:MailConfigurationServiceDelete the current mail server configuration- Specified by:
deleteMailServerin interfaceMailConfigurationService- Throws:
NotFoundException- if a mail server is not currently setcom.atlassian.mail.MailException- if there is an error attempting to delete the current mail configuration
-
validateJndiLocation
@NotNull public @NotNull List<String> validateJndiLocation(@NotNull @NotNull String jndiName)
Description copied from interface:MailConfigurationServiceValidates JNDI location for mail server.This method will not check whether the server can be found under the given location. Only the validity of the location (e.g. that a supported scheme was used) is checked.
- Specified by:
validateJndiLocationin interfaceMailConfigurationService- Parameters:
jndiName- JNDI address specifying email server- Returns:
- list of discovered errors, empty if the given JNDI location is valid
-
-