Class GitHubHookRegisterProblemMonitor
- java.lang.Object
-
- hudson.model.AbstractModelObject
-
- hudson.model.AdministrativeMonitor
-
- org.jenkinsci.plugins.github.admin.GitHubHookRegisterProblemMonitor
-
- All Implemented Interfaces:
ExtensionPoint
,ModelObject
,Saveable
,SearchableModelObject
,SearchItem
,org.kohsuke.stapler.StaplerProxy
@Extension public class GitHubHookRegisterProblemMonitor extends AdministrativeMonitor implements Saveable
Administrative monitor to track problems of registering/removing hooks for GH. Holds non-savable map of repo->message and persisted list of ignored projects. Anyone can register new problem withregisterProblem(GitHubRepositoryName, Throwable)
and check repo for problems withisProblemWith(GitHubRepositoryName)
Has own page with table with problems and ignoring list in global management section. Link to this page is visible if any problem or ignored repo is registered- Since:
- 1.17.0
- Author:
- lanwen (Merkushev Kirill)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GitHubHookRegisterProblemMonitor.GitHubHookRegisterProblemManagementLink
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Field Summary
-
Fields inherited from class hudson.model.AdministrativeMonitor
id
-
-
Constructor Summary
Constructors Constructor Description GitHubHookRegisterProblemMonitor()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.kohsuke.stapler.HttpResponse
doAct(org.kohsuke.stapler.StaplerRequest req)
Depending on whether the user said "yes" or "no", send them to the right place.void
doDisignore(GitHubRepositoryName repo)
This web method requires POST, admin rights and nonnull repo.void
doIgnore(GitHubRepositoryName repo)
This web method requires POST, admin rights and nonnull repo.static GitHubHookRegisterProblemMonitor
get()
String
getDisplayName()
List<GitHubRepositoryName>
getIgnored()
Map<GitHubRepositoryName,String>
getProblems()
boolean
isActivated()
boolean
isProblemWith(GitHubRepositoryName repo)
Checks that repo is registered in this monitorvoid
registerProblem(GitHubRepositoryName repo, Throwable throwable)
Registers problems.void
resolveProblem(GitHubRepositoryName repo)
Removes repo from known problems mapvoid
save()
Save the settings to a file.-
Methods inherited from class hudson.model.AdministrativeMonitor
all, disable, doDisable, getRequiredPermission, getSearchUrl, getTarget, getUrl, isEnabled, isSecurity
-
Methods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, getSearchName, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError
-
-
-
-
Method Detail
-
getProblems
public Map<GitHubRepositoryName,String> getProblems()
- Returns:
- Immutable copy of map with repo->problem message content
-
registerProblem
public void registerProblem(GitHubRepositoryName repo, Throwable throwable)
Registers problems. For messageThrowable.getMessage()
will be used- Parameters:
repo
- full named GitHub repo, if null nothing will be donethrowable
- exception with message about problem, if null nothing will be done- See Also:
registerProblem(GitHubRepositoryName, String)
-
resolveProblem
public void resolveProblem(GitHubRepositoryName repo)
Removes repo from known problems map- Parameters:
repo
- full named GitHub repo, if null nothing will be done
-
isProblemWith
public boolean isProblemWith(GitHubRepositoryName repo)
Checks that repo is registered in this monitor- Parameters:
repo
- full named GitHub repo- Returns:
- true if repo is in the map
-
getIgnored
public List<GitHubRepositoryName> getIgnored()
- Returns:
- immutable copy of list with ignored repos
-
getDisplayName
public String getDisplayName()
- Specified by:
getDisplayName
in interfaceModelObject
- Overrides:
getDisplayName
in classAdministrativeMonitor
-
isActivated
public boolean isActivated()
- Specified by:
isActivated
in classAdministrativeMonitor
-
doAct
public org.kohsuke.stapler.HttpResponse doAct(org.kohsuke.stapler.StaplerRequest req) throws IOException
Depending on whether the user said "yes" or "no", send them to the right place.- Throws:
IOException
-
doIgnore
public void doIgnore(@NonNull @GHRepoName GitHubRepositoryName repo)
This web method requires POST, admin rights and nonnull repo. Responds with redirect to monitor page- Parameters:
repo
- to be ignored. Never null
-
doDisignore
public void doDisignore(@NonNull @GHRepoName GitHubRepositoryName repo)
This web method requires POST, admin rights and nonnull repo. Responds with redirect to monitor page- Parameters:
repo
- to be disignored. Never null
-
save
public void save()
Save the settings to a file. Called on each change ofignored
list
-
get
public static GitHubHookRegisterProblemMonitor get()
- Returns:
- instance of administrative monitor to register/resolve/ignore/check hook problems
-
-