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>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GerritManagement.DescriptorImpl
Descriptor is only used for UI form bindings.-
Nested classes/interfaces inherited from class hudson.model.ManagementLink
ManagementLink.Category
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
Nested classes/interfaces inherited from interface jenkins.model.ModelObjectWithContextMenu
ModelObjectWithContextMenu.ContextMenu, ModelObjectWithContextMenu.ContextMenuVisibility, ModelObjectWithContextMenu.MenuItem, ModelObjectWithContextMenu.MenuItemType
-
-
Constructor Summary
Constructors Constructor Description GerritManagement()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.ModelObjectWithContextMenu.ContextMenu
doContextMenu(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response)
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()
Diagnostics
getDiagnostics()
A sub page displaying some diagnostic views.String
getDisplayName()
String
getIconFileName()
static PluginConfig
getPluginConfig()
Get the plugin config.Permission
getRequiredPermission()
Jenkins.ADMINISTER
permission.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.net.sf.json.JSONObject
getServerStatuses()
Used when getting server status from JavaScript.Object
getTarget()
String
getUrlName()
void
save()
-
Methods inherited from class hudson.model.ManagementLink
all, getBadge, getCategory, getCategoryName, getRequiresConfirmation, getRequiresPOST
-
-
-
-
Field Detail
-
URL_NAME
public static final String URL_NAME
The relative url name for this management link. As returned bygetUrlName()
.- See Also:
- Constant Field Values
-
-
Method Detail
-
getIconFileName
public String getIconFileName()
- Specified by:
getIconFileName
in interfaceAction
- Specified by:
getIconFileName
in classManagementLink
-
getUrlName
public String getUrlName()
- Specified by:
getUrlName
in interfaceAction
- Specified by:
getUrlName
in classManagementLink
-
getDisplayName
public String getDisplayName()
- Specified by:
getDisplayName
in interfaceAction
- Specified by:
getDisplayName
in interfaceModelObject
-
getDescription
public String getDescription()
- Overrides:
getDescription
in classManagementLink
-
getDescriptor
public GerritManagement.DescriptorImpl getDescriptor()
- Specified by:
getDescriptor
in interfaceDescribable<GerritManagement>
-
doContextMenu
public ModelObjectWithContextMenu.ContextMenu doContextMenu(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response) throws Exception
- Specified by:
doContextMenu
in interfaceModelObjectWithContextMenu
- 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 StaplerRequestrsp
- 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 interfaceorg.kohsuke.stapler.StaplerProxy
-
save
public void save() throws IOException
- Specified by:
save
in interfaceSaveable
- 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:
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 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
- StaplerRequestrsp
- 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 classManagementLink
- Returns:
- the permission
-
-