public abstract class AdministrativeMonitor extends AbstractModelObject implements ExtensionPoint
Plugins who wish to contribute such notifications can implement this
class and put Extension
on it to register it to Jenkins.
Once installed, it's the implementer's responsibility to perform
monitoring and activate/deactivate the monitor accordingly. Sometimes
this can be done by updating a flag from code (see SCMTrigger
for one such example), while other times it's more convenient to do
so by running some code periodically (for this, use TimerTrigger#timer
)
AdministrativeMonitor
s are bound to URL by Jenkins.getAdministrativeMonitor(String)
.
See getUrl()
.
isActivated()
returns true, Jenkins will use the message.jelly
view of this object to render the warning text. This happens in the
http://SERVER/jenkins/manage page. This view should typically render
a DIV box with class='error' or class='warning' with a human-readable text
inside it. It often also contains a link to a page that provides more details
about the problem.
Jenkins.administrativeMonitors
ExtensionPoint.LegacyInstancesAreScopedToHudson
Modifier and Type | Field and Description |
---|---|
String |
id
Human-readable ID of this monitor, which needs to be unique within the system.
|
Modifier | Constructor and Description |
---|---|
protected |
AdministrativeMonitor() |
protected |
AdministrativeMonitor(String id) |
Modifier and Type | Method and Description |
---|---|
static ExtensionList<AdministrativeMonitor> |
all()
All registered
AdministrativeMonitor instances. |
void |
disable(boolean value)
Mark this monitor as disabled, to prevent this from showing up in the UI.
|
void |
doDisable(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
URL binding to disable this monitor.
|
String |
getDisplayName() |
String |
getSearchUrl()
Returns the URL of this item relative to the parent
SearchItem . |
String |
getUrl()
Returns the URL of this monitor, relative to the context path, like "administrativeMonitor/foobar".
|
abstract boolean |
isActivated()
Returns true if this monitor is activated and
wants to produce a warning message.
|
boolean |
isEnabled()
Returns true if this monitor
isn't disabled earlier. |
getSearch, getSearchIndex, getSearchName, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError
public final String id
This ID is used to remember persisted setting for this monitor, so the ID should remain consistent beyond the Hudson JVM lifespan.
protected AdministrativeMonitor(String id)
protected AdministrativeMonitor()
public String getUrl()
public String getDisplayName()
getDisplayName
in interface ModelObject
public final String getSearchUrl()
SearchItem
SearchItem
.getSearchUrl
in interface SearchItem
public void disable(boolean value) throws IOException
IOException
public boolean isEnabled()
isn't disabled
earlier.
This flag implements the ability for the admin to say "no thank you" to the monitor that he wants to ignore.
public abstract boolean isActivated()
This method is called from the HTML rendering thread, so it should run efficiently.
public void doDisable(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException
IOException
public static ExtensionList<AdministrativeMonitor> all()
AdministrativeMonitor
instances.Copyright © 2018. All rights reserved.