com.sonyericsson.hudson.plugins.gerrit.trigger.gerritnotifier
Class NotificationFactory

java.lang.Object
  extended by com.sonyericsson.hudson.plugins.gerrit.trigger.gerritnotifier.NotificationFactory

public class NotificationFactory
extends java.lang.Object

A factory for creating notification entities. This factory is mainly created and used to ease unit testing.

Author:
Robert Sandell <robert.sandell@sonyericsson.com>

Constructor Summary
NotificationFactory()
           
 
Method Summary
 GerritNotifier createGerritNotifier(GerritCmdRunner cmdRunner)
          Factory method for creating a GerritNotifier.
 GerritNotifier createGerritNotifier(IGerritHudsonTriggerConfig config, GerritCmdRunner cmdRunner)
          Factory method for creating a GerritNotifier.
 IGerritHudsonTriggerConfig getConfig()
          Shortcut method to get the config from PluginImpl.
static NotificationFactory getInstance()
          Gets the singleton instance of the NotificationFactory.
 void queueBuildCompleted(BuildMemory.MemoryImprint memoryImprint, hudson.model.TaskListener listener)
          Queues a build completed command on the send-command queue.
 void queueBuildStarted(hudson.model.AbstractBuild build, hudson.model.TaskListener listener, PatchsetCreated event, BuildsStartedStats stats)
          Queues a build started command on the send-command queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NotificationFactory

public NotificationFactory()
Method Detail

getInstance

public static NotificationFactory getInstance()
Gets the singleton instance of the NotificationFactory.

Returns:
the NotificationFactory.

getConfig

public IGerritHudsonTriggerConfig getConfig()
Shortcut method to get the config from PluginImpl. Throws an IllegalStateException if PluginImpl hasn't been started yet.

Returns:
the plugin-config.

createGerritNotifier

public GerritNotifier createGerritNotifier(GerritCmdRunner cmdRunner)
Factory method for creating a GerritNotifier.

Parameters:
cmdRunner - - something capable of sending commands to Gerrit.
Returns:
a GerritNotifier

createGerritNotifier

public GerritNotifier createGerritNotifier(IGerritHudsonTriggerConfig config,
                                           GerritCmdRunner cmdRunner)
Factory method for creating a GerritNotifier.

Parameters:
config - - a configuration to use for parameter expansion.
cmdRunner - - something capable of sending commands to Gerrit.
Returns:
a GerritNotifier

queueBuildCompleted

public void queueBuildCompleted(BuildMemory.MemoryImprint memoryImprint,
                                hudson.model.TaskListener listener)
Queues a build completed command on the send-command queue.

Parameters:
memoryImprint - the memory of the builds.
listener - a listener.
See Also:
GerritSendCommandQueue.queue(com.sonyericsson.hudson.plugins.gerrit.gerritevents.workers.cmd.AbstractSendCommandJob), BuildCompletedCommandJob

queueBuildStarted

public void queueBuildStarted(hudson.model.AbstractBuild build,
                              hudson.model.TaskListener listener,
                              PatchsetCreated event,
                              BuildsStartedStats stats)
Queues a build started command on the send-command queue.

Parameters:
build - the build.
listener - a listener.
event - the event.
stats - the started stats.
See Also:
GerritSendCommandQueue.queue(com.sonyericsson.hudson.plugins.gerrit.gerritevents.workers.cmd.AbstractSendCommandJob), BuildStartedCommandJob


Copyright © 2004-2012. All Rights Reserved.