com.sonyericsson.hudson.plugins.gerrit.trigger
Class GerritManagement

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

@Extension
public class GerritManagement
extends hudson.model.ManagementLink
implements org.kohsuke.stapler.StaplerProxy, hudson.model.Describable<GerritManagement>, hudson.model.Saveable, jenkins.model.ModelObjectWithContextMenu

Management link for configuring the global configuration of this trigger.

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

Nested Class Summary
static class GerritManagement.DescriptorImpl
          Descriptor is only used for UI form bindings.
 
Nested classes/interfaces inherited from interface jenkins.model.ModelObjectWithContextMenu
jenkins.model.ModelObjectWithContextMenu.ContextMenu, jenkins.model.ModelObjectWithContextMenu.MenuItem
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
hudson.ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Field Summary
static String URL_NAME
          The relative url name for this management link.
 
Fields inherited from class hudson.model.ManagementLink
LIST
 
Fields inherited from interface hudson.model.Saveable
NOOP
 
Constructor Summary
GerritManagement()
           
 
Method Summary
 GerritServer doAddNewServer(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Add a new server.
 void doConfigSubmit(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Saves the form to the configuration and disk.
 jenkins.model.ModelObjectWithContextMenu.ContextMenu doContextMenu(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response)
           
 hudson.util.FormValidation doNameFreeCheck(String value)
          Checks whether server name already exists.
static GerritManagement get()
          Returns this singleton.
 GerritAdministrativeMonitor getAdministrativeMonitor()
          The AdministrativeMonitor related to Gerrit.
static IGerritHudsonTriggerConfig getConfig(String serverName)
          Get the config of a server.
 String getDescription()
           
 GerritManagement.DescriptorImpl getDescriptor()
           
 String getDisplayName()
           
 String getIconFileName()
           
static PluginConfig getPluginConfig()
          Get the plugin config.
 GerritServer getServer(String encodedServerName)
          Used when redirected to a server.
 List<String> getServerNames()
          Convenience method for jelly.
 List<GerritServer> getServers()
          Gets the list of GerritServer.
 Object getTarget()
           
 String getUrlName()
           
 void save()
           
 
Methods inherited from class hudson.model.ManagementLink
all
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

URL_NAME

public static final String URL_NAME
The relative url name for this management link. As returned by getUrlName().

See Also:
Constant Field Values
Constructor Detail

GerritManagement

public GerritManagement()
Method Detail

getIconFileName

public String getIconFileName()
Specified by:
getIconFileName in interface hudson.model.Action
Specified by:
getIconFileName in class hudson.model.ManagementLink

getUrlName

public String getUrlName()
Specified by:
getUrlName in interface hudson.model.Action
Specified by:
getUrlName in class hudson.model.ManagementLink

getDisplayName

public String getDisplayName()
Specified by:
getDisplayName in interface hudson.model.Action
Specified by:
getDisplayName in interface hudson.model.ModelObject

getDescription

public String getDescription()
Overrides:
getDescription in class hudson.model.ManagementLink

getDescriptor

public GerritManagement.DescriptorImpl getDescriptor()
Specified by:
getDescriptor in interface hudson.model.Describable<GerritManagement>

doContextMenu

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

getServers

public List<GerritServer> getServers()
Gets the list of GerritServer.

Returns:
the list of GerritServer.

getServer

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.

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 hudson.model.Saveable
Throws:
IOException

get

public static GerritManagement get()
Returns this singleton.

Returns:
the single loaded instance if this class.

getPluginConfig

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:
GerritServer.getConfig()

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 hudson.util.FormValidation doNameFreeCheck(@QueryParameter(value="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.


Copyright © 2004-2013. All Rights Reserved.