|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sourceforge.cruisecontrol.publishers.EmailPublisher
Abstract implementation of the Publisher interface, specifically tailored for sending email. The only
abstract method is createMessage, which allows different implementations to send different messages as the body of
the email. As it currently stands, there is one concrete implementation-- LinkEmailPublisher, but the
ability to create EmailPublishers that handle sending a text summary or an html summary is there.
| Nested Class Summary | |
static class |
EmailPublisher.Address
|
static class |
EmailPublisher.Alert
|
static class |
EmailPublisher.Always
|
static class |
EmailPublisher.Failure
|
static class |
EmailPublisher.Ignore
|
static class |
EmailPublisher.Success
|
| Constructor Summary | |
EmailPublisher()
|
|
| Method Summary | |
void |
add(EmailMapper mapper)
|
void |
add(EmailMapping mapping)
|
protected void |
addContentToMessage(java.lang.String content,
javax.mail.Message msg)
Subclasses can override this method to control how the content is added to the Message. |
EmailPublisher.Alert |
createAlert()
|
protected java.lang.String |
createAlertUserList(XMLLogHelper logHelper)
Creates the list of email addresses to receive an alert email message. |
protected java.util.Set |
createAlertUserSet(XMLLogHelper logHelper)
Creates a Set of email addresses to receive an alert email message based on the logHelper. |
EmailPublisher.Always |
createAlways()
|
protected java.lang.String |
createEmailString(java.util.Set emails)
Creates a comma delimited String from a Set of Strings. |
EmailPublisher.Failure |
createFailure()
|
EmailPublisher.Ignore |
createIgnore()
|
protected abstract java.lang.String |
createMessage(XMLLogHelper logHelper)
Implementations of this method will create the email message body. |
protected java.lang.String |
createSubject(XMLLogHelper logHelper)
Creates the subject line for the email message. |
EmailPublisher.Success |
createSuccess()
|
protected java.lang.String |
createUserList(XMLLogHelper logHelper)
Creates the list of email addresses to receive the email message. |
protected java.util.Set |
createUserSet(XMLLogHelper logHelper)
Creates the Set of email addresses to receive the email message.
|
java.lang.String |
getBuildResultsURL()
|
java.lang.String |
getDefaultSuffix()
|
EmailMapper[] |
getEmailMapper()
|
protected javax.mail.internet.InternetAddress |
getFromAddress()
|
java.lang.String |
getMailHost()
|
java.lang.String |
getMailPort()
|
protected java.util.Properties |
getMailProperties()
builds the properties object for the mail session |
java.lang.String |
getPassword()
|
java.lang.String |
getReturnAddress()
|
java.lang.String |
getReturnName()
|
java.lang.String |
getSubjectPrefix()
|
java.lang.String |
getUsername()
|
protected boolean |
matchRegExpr(java.lang.String input,
org.apache.oro.io.GlobFilenameFilter pattern)
Compare the input String against a regular expression pattern. |
void |
publish(org.jdom.Element cruisecontrolLog)
Implementing the Publisher interface. |
protected boolean |
sendMail(java.lang.String toList,
java.lang.String subject,
java.lang.String message,
boolean important)
Sends an email message. |
void |
setBuildResultsURL(java.lang.String url)
|
void |
setDefaultSuffix(java.lang.String defaultEmailSuffix)
|
void |
setFailAsImportant(boolean important)
|
void |
setMailHost(java.lang.String hostname)
|
void |
setMailPort(java.lang.String port)
|
void |
setPassword(java.lang.String passwd)
|
void |
setReportSuccess(java.lang.String report)
|
void |
setReturnAddress(java.lang.String emailAddress)
|
void |
setReturnName(java.lang.String emailReturnName)
|
void |
setSkipUsers(boolean skip)
|
void |
setSpamWhileBroken(boolean spam)
|
void |
setSubjectPrefix(java.lang.String prefix)
|
void |
setUsername(java.lang.String name)
|
void |
setUseSSL(boolean useSSL)
|
protected boolean |
shouldSend(XMLLogHelper logHelper)
Determines if the conditions are right for the email to be sent. |
void |
validate()
Called after the configuration is read to make sure that all the mandatory parameters were specified.. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public EmailPublisher()
| Method Detail |
protected abstract java.lang.String createMessage(XMLLogHelper logHelper)
logHelper - XMLLogHelper wrapper for the build log.
String containing the message
public void validate()
throws CruiseControlException
Publisher
validate in interface PublisherCruiseControlException - if there was a configuration error.
protected java.lang.String createSubject(XMLLogHelper logHelper)
throws CruiseControlException
logHelper - XMLLogHelper wrapper for the build log.
String containing the subject line.
CruiseControlException
protected boolean shouldSend(XMLLogHelper logHelper)
throws CruiseControlException
logHelper - XMLLogHelper wrapper for the build log.
CruiseControlException
protected java.lang.String createUserList(XMLLogHelper logHelper)
throws CruiseControlException
addAlwaysAddress method will always receive the email if it is sent. Any
address set in the addFailureAddress method will receive the message if the build has failed.
logHelper - XMLLogHelper wrapper for the build log.
String of email addresses to receive the email message.
CruiseControlException
protected java.util.Set createUserSet(XMLLogHelper logHelper)
throws CruiseControlException
Set of email addresses to receive the email message.
Uses configured emailmappers to map user names to email addresses. After all mappings are done, mapped users are
checked for existence of the domain part (i.e @mydomain.com) in the mapped email address. If it doesn't exist,
default (if configured) is appended Any addresses set in the addAlwaysAddress method will always
receive the email if it is sent. Any address set in the addFailureAddress method will receive the
message if the build has failed.
logHelper - XMLLogHelper wrapper for the build log.
Set of email addresses to receive the email message.
CruiseControlException
public void publish(org.jdom.Element cruisecontrolLog)
throws CruiseControlException
Publisher interface. Sends modification alert and regular build emails. If a user
is supposed to receive a modification alert and a regular build email, they will only receive the modification
alert. This prevents duplicate emails (currently only the subject is different).
publish in interface PublishercruisecontrolLog - JDOM Element representation of the main cruisecontrol build log
CruiseControlExceptionprotected java.util.Properties getMailProperties()
protected boolean sendMail(java.lang.String toList,
java.lang.String subject,
java.lang.String message,
boolean important)
throws CruiseControlException
toList - comma delimited String of email addressessubject - subject line for the messagemessage - body of the message
CruiseControlException
protected void addContentToMessage(java.lang.String content,
javax.mail.Message msg)
throws javax.mail.MessagingException
content - content returned by createMessagemsg - mail Message with headers and addresses added elsewhere
javax.mail.MessagingException
protected javax.mail.internet.InternetAddress getFromAddress()
throws javax.mail.internet.AddressException
javax.mail.internet.AddressExceptionpublic void setMailHost(java.lang.String hostname)
public java.lang.String getMailHost()
public void setUsername(java.lang.String name)
public java.lang.String getUsername()
public void setPassword(java.lang.String passwd)
public java.lang.String getPassword()
public void setMailPort(java.lang.String port)
public java.lang.String getMailPort()
public void setUseSSL(boolean useSSL)
public void setSubjectPrefix(java.lang.String prefix)
public java.lang.String getSubjectPrefix()
public java.lang.String getBuildResultsURL()
public void setBuildResultsURL(java.lang.String url)
public EmailMapper[] getEmailMapper()
public java.lang.String getReturnAddress()
public void setReturnAddress(java.lang.String emailAddress)
public java.lang.String getReturnName()
public void setReturnName(java.lang.String emailReturnName)
public java.lang.String getDefaultSuffix()
public void setDefaultSuffix(java.lang.String defaultEmailSuffix)
public void setReportSuccess(java.lang.String report)
public void setSkipUsers(boolean skip)
public void setSpamWhileBroken(boolean spam)
public void setFailAsImportant(boolean important)
public EmailPublisher.Ignore createIgnore()
public EmailPublisher.Always createAlways()
public EmailPublisher.Failure createFailure()
public EmailPublisher.Success createSuccess()
public EmailPublisher.Alert createAlert()
public void add(EmailMapping mapping)
public void add(EmailMapper mapper)
protected java.lang.String createAlertUserList(XMLLogHelper logHelper)
throws CruiseControlException
The full path of each modified file is compared against the regular expressions specified in the configuration.
If a modified file's path matches a regular expression, the user's email address is included in the returned
String.
Uses configured emailmappers to map user names to email addresses. After all mappings are done, mapped users are checked for existence of the domain part (i.e @mydomain.com) in the mapped email address. If it doesn't exist, default (if configured) is appended.
logHelper - XMLLogHelper wrapper for the build log.
String of email addresses to receive the email message.
CruiseControlException
protected java.util.Set createAlertUserSet(XMLLogHelper logHelper)
throws CruiseControlException
Set of email addresses to receive an alert email message based on the logHelper.
logHelper - XMLLogHelper wrapper for the build log.
Set of email addresses to receive the email message.
CruiseControlExceptionprotected java.lang.String createEmailString(java.util.Set emails)
String from a Set of Strings.
emails - A Set containing Strings of emails addresses
String of email addresses
protected boolean matchRegExpr(java.lang.String input,
org.apache.oro.io.GlobFilenameFilter pattern)
String against a regular expression pattern.
input - A String to compare against the regExpr patternpattern - A GlobFilenameFilter pattern
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||