Class GerritManagement

java.lang.Object
hudson.model.ManagementLink
com.sonyericsson.hudson.plugins.gerrit.trigger.GerritManagement
All Implemented Interfaces:
ExtensionPoint, Action, Describable<GerritManagement>, ModelObject, Saveable, ModelObjectWithContextMenu, org.kohsuke.stapler.StaplerProxy

@Extension public class GerritManagement extends ManagementLink implements org.kohsuke.stapler.StaplerProxy, Describable<GerritManagement>, Saveable, ModelObjectWithContextMenu
Management link for configuring the global configuration of this trigger.
Author:
Robert Sandell <robert.sandell@sonyericsson.com>
  • Field Details

  • Constructor Details

    • GerritManagement

      public GerritManagement()
  • Method Details

    • getIconFileName

      public String getIconFileName()
      Specified by:
      getIconFileName in interface Action
      Specified by:
      getIconFileName in class ManagementLink
    • getUrlName

      public String getUrlName()
      Specified by:
      getUrlName in interface Action
      Specified by:
      getUrlName in class ManagementLink
    • getDisplayName

      public String getDisplayName()
      Specified by:
      getDisplayName in interface Action
      Specified by:
      getDisplayName in interface ModelObject
    • getDescription

      public String getDescription()
      Overrides:
      getDescription in class ManagementLink
    • getDescriptor

      public GerritManagement.DescriptorImpl getDescriptor()
      Specified by:
      getDescriptor in interface Describable<GerritManagement>
    • doContextMenu

      public ModelObjectWithContextMenu.ContextMenu doContextMenu(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response) throws Exception
      Specified by:
      doContextMenu in interface ModelObjectWithContextMenu
      Throws:
      Exception
    • getDiagnostics

      public Diagnostics getDiagnostics()
      A sub page displaying some diagnostic views.
      Returns:
      the diagnostics page.
    • getServers

      @StaplerDispatchable public List<GerritServer> getServers()
      Gets the list of GerritServer.
      Returns:
      the list of GerritServer.
    • getServer

      @StaplerDispatchable public GerritServer getServer(String encodedServerName)
      Used when redirected to a server.
      Parameters:
      encodedServerName - the server name encoded by URLEncoder.encode(name,"UTF-8").
      Returns:
      the GerritServer object.
    • getServerStatuses

      @JavaScriptMethod public net.sf.json.JSONObject getServerStatuses()
      Used when getting server status from JavaScript.
      Returns:
      the json array of server status.
    • doAddNewServer

      public GerritServer doAddNewServer(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException
      Add a new server.
      Parameters:
      req - the StaplerRequest
      rsp - the StaplerResponse
      Returns:
      the new GerritServer
      Throws:
      IOException - when error sending redirect back to the list of servers
    • getTarget

      public Object getTarget()
      Specified by:
      getTarget in interface org.kohsuke.stapler.StaplerProxy
    • save

      public void save() throws IOException
      Specified by:
      save in interface Saveable
      Throws:
      IOException
    • get

      public static GerritManagement get()
      Returns this singleton.
      Returns:
      the single loaded instance if this class.
    • getPluginConfig

      @CheckForNull public static PluginConfig getPluginConfig()
      Get the plugin config.
      Returns:
      the plugin config.
    • getConfig

      public static IGerritHudsonTriggerConfig getConfig(String serverName)
      Get the config of a server.
      Parameters:
      serverName - the name of the server for which we want to get the config.
      Returns:
      the config.
      See Also:
    • getAdministrativeMonitor

      public GerritAdministrativeMonitor getAdministrativeMonitor()
      The AdministrativeMonitor related to Gerrit. convenience method for the jelly page.
      Returns:
      the monitor if it could be found, or null otherwise.
    • getServerNames

      public List<String> getServerNames()
      Convenience method for jelly. Get the list of Gerrit server names.
      Returns:
      the list of server names as a list.
    • doNameFreeCheck

      public FormValidation doNameFreeCheck(@QueryParameter("value") String value)
      Checks whether server name already exists.
      Parameters:
      value - the value of the name field.
      Returns:
      ok or error.
    • doConfigSubmit

      public void doConfigSubmit(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws javax.servlet.ServletException, IOException, InterruptedException
      Saves the form to the configuration and disk.
      Parameters:
      req - StaplerRequest
      rsp - StaplerResponse
      Throws:
      javax.servlet.ServletException - if something unfortunate happens.
      IOException - if something unfortunate happens.
      InterruptedException - if something unfortunate happens.
    • getRequiredPermission

      public Permission getRequiredPermission()
      Jenkins.ADMINISTER permission. Also used by Jelly
      Overrides:
      getRequiredPermission in class ManagementLink
      Returns:
      the permission