hudson.plugins.im
Class IMPublisher

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

public abstract class IMPublisher
extends hudson.tasks.Notifier
implements hudson.tasks.BuildStep

The actual Publisher that sends notification-Messages out to the clients.

Author:
Uwe Schaefer, Christoph Kutzinski

Nested Class Summary
 
Nested classes/interfaces inherited from class hudson.tasks.Publisher
hudson.tasks.Publisher.DescriptorExtensionListImpl
 
Nested classes/interfaces inherited from interface hudson.tasks.BuildStep
hudson.tasks.BuildStep.PublisherList
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
hudson.ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Field Summary
 
Fields inherited from interface hudson.tasks.BuildStep
BUILDERS, PUBLISHERS
 
Constructor Summary
protected IMPublisher(java.util.List<IMMessageTarget> defaultTargets, java.lang.String notificationStrategyString, boolean notifyGroupChatsOnBuildStart, boolean notifySuspects, boolean notifyCulprits, boolean notifyFixers, boolean notifyUpstreamCommitters)
          Deprecated. as of 1.9. Use IMPublisher(List, String, boolean, boolean, boolean, boolean, boolean, BuildToChatNotifier) instead.
protected IMPublisher(java.util.List<IMMessageTarget> defaultTargets, java.lang.String notificationStrategyString, boolean notifyGroupChatsOnBuildStart, boolean notifySuspects, boolean notifyCulprits, boolean notifyFixers, boolean notifyUpstreamCommitters, BuildToChatNotifier buildToChatNotifier)
           
 
Method Summary
protected  java.util.List<IMMessageTarget> calculateTargets()
          Returns the notification target which should actually be used for notification.
 BuildToChatNotifier getBuildToChatNotifier()
           
protected abstract  java.lang.String getConfiguredIMId(hudson.model.User user)
          Returns the instant-messaging ID which is configured for a Hudson user (e.g. via a UserProperty) or null if there's nothing configured for him/her.
abstract  hudson.tasks.BuildStepDescriptor<hudson.tasks.Publisher> getDescriptor()
          
protected abstract  IMConnection getIMConnection()
           
protected  IMPublisherDescriptor getIMDescriptor()
           
protected  NotificationStrategy getNotificationStrategy()
           
 java.util.List<IMMessageTarget> getNotificationTargets()
          Returns the notification targets configured on a per-job basis.
 boolean getNotifyCulprits()
          Specifies if culprits - i.e. committers to previous already failing builds - should be informed about subsequent build failures.
 boolean getNotifyFixers()
          Specifies if 'fixers' should be informed about fixed builds.
 boolean getNotifyOnStart()
          Specifies if the starting of builds should be notified to the registered chat rooms.
 boolean getNotifySuspects()
          Specifies if committers to failed builds should be informed about build failures.
 boolean getNotifyUpstreamCommitters()
          Specifies if upstream committers should be informed about build failures.
protected abstract  java.lang.String getPluginName()
          Returns a short name of the plugin to be used e.g. in log messages.
 java.lang.String getStrategy()
          Returns the selected notification strategy as a string suitable for display.
 java.lang.String getTargets()
          Returns the notification targets as a string suitable for display in the settings page.
protected  void log(hudson.model.BuildListener listener, java.lang.String message)
          Logs message to the build listener's logger.
 boolean needsToRunAfterFinalized()
          
 boolean perform(hudson.model.AbstractBuild<?,?> build, hudson.Launcher launcher, hudson.model.BuildListener buildListener)
           
 boolean prebuild(hudson.model.AbstractBuild<?,?> build, hudson.model.BuildListener buildListener)
          
protected  java.lang.Object readResolve()
           
protected  void setNotificationStrategy(NotificationStrategy strategy)
           
protected  void setNotificationTargets(java.util.List<IMMessageTarget> targets)
          Deprecated. Should only be used to deserialize old instances
protected  void setTargets(java.lang.String targetsAsString)
          Deprecated. 
 
Methods inherited from class hudson.tasks.Publisher
all, getProjectAction, prebuild
 
Methods inherited from class hudson.tasks.BuildStepCompatibilityLayer
getProjectAction, getProjectActions, perform
 
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, getProjectActions, getRequiredMonitorService
 

Constructor Detail

IMPublisher

@Deprecated
protected IMPublisher(java.util.List<IMMessageTarget> defaultTargets,
                                 java.lang.String notificationStrategyString,
                                 boolean notifyGroupChatsOnBuildStart,
                                 boolean notifySuspects,
                                 boolean notifyCulprits,
                                 boolean notifyFixers,
                                 boolean notifyUpstreamCommitters)
Deprecated. as of 1.9. Use IMPublisher(List, String, boolean, boolean, boolean, boolean, boolean, BuildToChatNotifier) instead.


IMPublisher

protected IMPublisher(java.util.List<IMMessageTarget> defaultTargets,
                      java.lang.String notificationStrategyString,
                      boolean notifyGroupChatsOnBuildStart,
                      boolean notifySuspects,
                      boolean notifyCulprits,
                      boolean notifyFixers,
                      boolean notifyUpstreamCommitters,
                      BuildToChatNotifier buildToChatNotifier)
Method Detail

needsToRunAfterFinalized

public boolean needsToRunAfterFinalized()

Overrides:
needsToRunAfterFinalized in class hudson.tasks.Publisher

getPluginName

protected abstract java.lang.String getPluginName()
Returns a short name of the plugin to be used e.g. in log messages.


getIMConnection

protected abstract IMConnection getIMConnection()
                                         throws IMException
Throws:
IMException

getNotificationStrategy

protected NotificationStrategy getNotificationStrategy()

setNotificationStrategy

protected void setNotificationStrategy(NotificationStrategy strategy)

getBuildToChatNotifier

public BuildToChatNotifier getBuildToChatNotifier()

getNotificationTargets

public java.util.List<IMMessageTarget> getNotificationTargets()
Returns the notification targets configured on a per-job basis.


calculateTargets

protected java.util.List<IMMessageTarget> calculateTargets()
Returns the notification target which should actually be used for notification. Differs from getNotificationTargets() because it also takes IMPublisherDescriptor.getDefaultTargets() into account!


getTargets

public java.lang.String getTargets()
Returns the notification targets as a string suitable for display in the settings page. Returns an empty string if no targets are set.


setTargets

@Deprecated
protected void setTargets(java.lang.String targetsAsString)
                   throws IMMessageTargetConversionException
Deprecated. 

Throws:
IMMessageTargetConversionException

setNotificationTargets

@Deprecated
protected void setNotificationTargets(java.util.List<IMMessageTarget> targets)
Deprecated. Should only be used to deserialize old instances


getStrategy

public final java.lang.String getStrategy()
Returns the selected notification strategy as a string suitable for display.


getNotifyOnStart

public final boolean getNotifyOnStart()
Specifies if the starting of builds should be notified to the registered chat rooms.


getNotifySuspects

public final boolean getNotifySuspects()
Specifies if committers to failed builds should be informed about build failures.


getNotifyCulprits

public final boolean getNotifyCulprits()
Specifies if culprits - i.e. committers to previous already failing builds - should be informed about subsequent build failures.


getNotifyFixers

public final boolean getNotifyFixers()
Specifies if 'fixers' should be informed about fixed builds.


getNotifyUpstreamCommitters

public final boolean getNotifyUpstreamCommitters()
Specifies if upstream committers should be informed about build failures.


log

protected void log(hudson.model.BuildListener listener,
                   java.lang.String message)
Logs message to the build listener's logger.


perform

public boolean perform(hudson.model.AbstractBuild<?,?> build,
                       hudson.Launcher launcher,
                       hudson.model.BuildListener buildListener)
                throws java.lang.InterruptedException,
                       java.io.IOException
Specified by:
perform in interface hudson.tasks.BuildStep
Overrides:
perform in class hudson.tasks.BuildStepCompatibilityLayer
Throws:
java.lang.InterruptedException
java.io.IOException

prebuild

public boolean prebuild(hudson.model.AbstractBuild<?,?> build,
                        hudson.model.BuildListener buildListener)

Specified by:
prebuild in interface hudson.tasks.BuildStep
Overrides:
prebuild in class hudson.tasks.BuildStepCompatibilityLayer

getDescriptor

public abstract hudson.tasks.BuildStepDescriptor<hudson.tasks.Publisher> getDescriptor()

Specified by:
getDescriptor in interface hudson.model.Describable<hudson.tasks.Publisher>
Overrides:
getDescriptor in class hudson.tasks.Notifier

readResolve

protected java.lang.Object readResolve()

getIMDescriptor

protected final IMPublisherDescriptor getIMDescriptor()

getConfiguredIMId

protected abstract java.lang.String getConfiguredIMId(hudson.model.User user)
Returns the instant-messaging ID which is configured for a Hudson user (e.g. via a UserProperty) or null if there's nothing configured for him/her.



Copyright © 2010. All Rights Reserved.