java.lang.Object
com.sonyericsson.hudson.plugins.gerrit.trigger.gerritnotifier.GerritNotifierFactory

public class GerritNotifierFactory extends 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 Details

    • GerritNotifierFactory

      public GerritNotifierFactory()
  • Method Details

    • getInstance

      public static GerritNotifierFactory getInstance()
      Gets the singleton instance of the NotificationFactory.
      Returns:
      the NotificationFactory.
    • getConfig

      public IGerritHudsonTriggerConfig getConfig(String serverName)
      Shortcut method to get the config from GerritServer.
      Parameters:
      serverName - the name of the server.
      Returns:
      the server-config.
    • createGerritNotifier

      public GerritNotifier createGerritNotifier(com.sonymobile.tools.gerrit.gerritevents.GerritCmdRunner cmdRunner, String serverName)
      Factory method for creating a GerritNotifier.
      Parameters:
      cmdRunner - - something capable of sending commands to Gerrit.
      serverName - the name of the server.
      Returns:
      a GerritNotifier
    • createGerritNotifier

      public GerritNotifier createGerritNotifier(IGerritHudsonTriggerConfig config, com.sonymobile.tools.gerrit.gerritevents.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, 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.sonymobile.tools.gerrit.gerritevents.workers.cmd.AbstractSendCommandJob)
      • BuildCompletedCommandJob
    • queueBuildStarted

      public void queueBuildStarted(Run build, TaskListener listener, com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent 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.sonymobile.tools.gerrit.gerritevents.workers.cmd.AbstractSendCommandJob)
      • BuildStartedCommandJob