hudson.plugins.emailext
Class ExtendedEmailPublisher

java.lang.Object
  extended by hudson.tasks.BuildStepCompatibilityLayer
      extended by hudson.tasks.Publisher
          extended by hudson.plugins.emailext.ExtendedEmailPublisher
All Implemented Interfaces:
hudson.ExtensionPoint, hudson.model.Describable<hudson.tasks.Publisher>, hudson.tasks.BuildStep

public class ExtendedEmailPublisher
extends hudson.tasks.Publisher

Sample Builder.

When the user configures the project and enables this builder, ExtendedEmailPublisher.DescriptorImpl.newInstance(StaplerRequest) is invoked and a new ExtendedEmailPublisher is created. The created instance is persisted to the project configuration XML by using XStream, so this allows you to use instance fields (like #name) to remember the configuration.

When a build is performed, the perform(Build, Launcher, BuildListener) method will be invoked. This Publisher seeks to solve some of the issues people are having with Hudson's default email publisher. Mainly that you cannot send emails on a successful build. This plugin should allow you to send any combination of email based on build status and recipients.

Author:
kyle.sweeney@valtech.com

Nested Class Summary
static class ExtendedEmailPublisher.DescriptorImpl
           
 
Nested classes/interfaces inherited from interface hudson.tasks.BuildStep
hudson.tasks.BuildStep.PublisherList
 
Field Summary
static java.lang.String COMMA_SEPARATED_SPLIT_REGEXP
           
static java.lang.String DEFAULT_BODY_TEXT
           
static java.lang.String DEFAULT_SUBJECT_TEXT
           
 java.lang.String defaultContent
           
 java.lang.String defaultSubject
           
static ExtendedEmailPublisher.DescriptorImpl DESCRIPTOR
           
static java.lang.String EMAIL_ADDRESS_REGEXP
           
static java.lang.String OLD_DEFAULT_BODY_TEXT
           
static java.lang.String OLD_DEFAULT_SUBJECT_TEXT
           
static java.lang.String PROJECT_DEFAULT_BODY_TEXT
           
static java.lang.String PROJECT_DEFAULT_SUBJECT_TEXT
           
 java.lang.String recipientList
          A comma-separated list of email recipient that will be used for every trigger.
 
Fields inherited from interface hudson.tasks.BuildStep
BUILDERS, PUBLISHERS
 
Constructor Summary
ExtendedEmailPublisher()
           
 
Method Summary
<P extends hudson.model.Project<P,B>,B extends hudson.model.Build<P,B>>
boolean
_perform(B build, hudson.Launcher launcher, hudson.model.BuildListener listener)
           
static void addEmailContentType(EmailContent contentType)
           
static void addEmailTriggerType(EmailTriggerDescriptor triggerType)
           
 boolean getConfigured()
           
 java.util.List<EmailTrigger> getConfiguredTriggers()
          Get the list of configured email triggers for this project.
 hudson.model.Descriptor<hudson.tasks.Publisher> getDescriptor()
           
static java.util.Collection<EmailContent> getEmailContentTypes()
           
static java.util.Collection<java.lang.String> getEmailTriggerNames()
           
static java.util.Collection<EmailTriggerDescriptor> getEmailTriggers()
           
 java.util.List<EmailTrigger> getNonConfiguredTriggers()
          Get the list of non-configured email triggers for this project.
static java.util.List<EmailTrigger> getTriggersForNonConfiguredInstance()
           
 boolean isConfigured()
          Return true if the project has been configured, otherwise returns false
 boolean perform(hudson.model.Build build, hudson.Launcher launcher, hudson.model.BuildListener listener)
           
static void removeEmailContentType(EmailContent contentType)
           
static void removeEmailTriggerType(EmailTriggerDescriptor triggerType)
           
<P extends hudson.model.Project<P,B>,B extends hudson.model.Build<P,B>>
java.lang.String
replaceTokensWithContent(java.lang.String origText, EmailType type, hudson.model.Build<P,B> build)
           
 
Methods inherited from class hudson.tasks.Publisher
getProjectAction, needsToRunAfterFinalized, prebuild
 
Methods inherited from class hudson.tasks.BuildStepCompatibilityLayer
getProjectAction, perform, prebuild
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface hudson.tasks.BuildStep
getProjectAction, perform, prebuild
 

Field Detail

EMAIL_ADDRESS_REGEXP

public static final java.lang.String EMAIL_ADDRESS_REGEXP
See Also:
#extractAddressFromId(String), Constant Field Values

COMMA_SEPARATED_SPLIT_REGEXP

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

OLD_DEFAULT_SUBJECT_TEXT

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

OLD_DEFAULT_BODY_TEXT

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

DEFAULT_SUBJECT_TEXT

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

DEFAULT_BODY_TEXT

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

PROJECT_DEFAULT_SUBJECT_TEXT

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

PROJECT_DEFAULT_BODY_TEXT

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

recipientList

public java.lang.String recipientList
A comma-separated list of email recipient that will be used for every trigger.


defaultSubject

public java.lang.String defaultSubject

defaultContent

public java.lang.String defaultContent

DESCRIPTOR

public static final ExtendedEmailPublisher.DescriptorImpl DESCRIPTOR
Constructor Detail

ExtendedEmailPublisher

public ExtendedEmailPublisher()
Method Detail

addEmailContentType

public static void addEmailContentType(EmailContent contentType)
                                throws EmailExtException
Throws:
EmailExtException

removeEmailContentType

public static void removeEmailContentType(EmailContent contentType)

addEmailTriggerType

public static void addEmailTriggerType(EmailTriggerDescriptor triggerType)
                                throws EmailExtException
Throws:
EmailExtException

removeEmailTriggerType

public static void removeEmailTriggerType(EmailTriggerDescriptor triggerType)

getEmailTriggers

public static java.util.Collection<EmailTriggerDescriptor> getEmailTriggers()

getEmailTriggerNames

public static java.util.Collection<java.lang.String> getEmailTriggerNames()

getTriggersForNonConfiguredInstance

public static java.util.List<EmailTrigger> getTriggersForNonConfiguredInstance()

getEmailContentTypes

public static java.util.Collection<EmailContent> getEmailContentTypes()

getConfiguredTriggers

public java.util.List<EmailTrigger> getConfiguredTriggers()
Get the list of configured email triggers for this project.


getNonConfiguredTriggers

public java.util.List<EmailTrigger> getNonConfiguredTriggers()
Get the list of non-configured email triggers for this project.


isConfigured

public boolean isConfigured()
Return true if the project has been configured, otherwise returns false


getConfigured

public boolean getConfigured()

perform

public boolean perform(hudson.model.Build build,
                       hudson.Launcher launcher,
                       hudson.model.BuildListener listener)
                throws java.lang.InterruptedException,
                       java.io.IOException
Overrides:
perform in class hudson.tasks.BuildStepCompatibilityLayer
Throws:
java.lang.InterruptedException
java.io.IOException

_perform

public <P extends hudson.model.Project<P,B>,B extends hudson.model.Build<P,B>> boolean _perform(B build,
                                                                                                hudson.Launcher launcher,
                                                                                                hudson.model.BuildListener listener)
                 throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException

replaceTokensWithContent

public <P extends hudson.model.Project<P,B>,B extends hudson.model.Build<P,B>> java.lang.String replaceTokensWithContent(java.lang.String origText,
                                                                                                                         EmailType type,
                                                                                                                         hudson.model.Build<P,B> build)

getDescriptor

public hudson.model.Descriptor<hudson.tasks.Publisher> getDescriptor()


Copyright © 2008. All Rights Reserved.