jenkins.model
Class Jenkins

java.lang.Object
  extended by hudson.model.AbstractModelObject
      extended by hudson.model.Node
          extended by hudson.model.AbstractCIBase
              extended by jenkins.model.Jenkins
All Implemented Interfaces:
ExtensionPoint, Describable<Node>, DescriptorByNameOwner, ItemGroup<TopLevelItem>, ModelObject, ModifiableItemGroup<TopLevelItem>, PersistenceRoot, ReconfigurableDescribable<Node>, Saveable, ViewGroup, SearchableModelObject, SearchItem, AccessControlled, ModelObjectWithChildren, ModelObjectWithContextMenu, ModifiableTopLevelItemGroup, OnMaster, org.kohsuke.stapler.StaplerFallback, org.kohsuke.stapler.StaplerProxy
Direct Known Subclasses:
Hudson

@ExportedBean
public class Jenkins
extends AbstractCIBase
implements ModifiableTopLevelItemGroup, org.kohsuke.stapler.StaplerProxy, org.kohsuke.stapler.StaplerFallback, ViewGroup, AccessControlled, DescriptorByNameOwner, ModelObjectWithContextMenu, ModelObjectWithChildren

Root object of the system.

Author:
Kohsuke Kawaguchi

Nested Class Summary
static class Jenkins.CloudList
           
static class Jenkins.DescriptorImpl
           
static interface Jenkins.JenkinsHolder
          Hook for a test harness to intercept Jenkins.getInstance() Do not use in the production code as the signature may change.
static class Jenkins.MasterComputer
           
 
Nested classes/interfaces inherited from class hudson.model.Node
Node.InternalComputerListener, Node.Mode
 
Nested classes/interfaces inherited from interface jenkins.model.ModelObjectWithContextMenu
ModelObjectWithContextMenu.ContextMenu, ModelObjectWithContextMenu.MenuItem
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Field Summary
static Permission ADMINISTER
           
 List<AdministrativeMonitor> administrativeMonitors
          AdministrativeMonitors installed on this system.
static Set<String> ALLOWED_RESOURCE_EXTENSIONS
          Extension list that doResources(StaplerRequest, StaplerResponse) can serve.
static org.acegisecurity.Authentication ANONYMOUS
          Authentication object that represents the anonymous user.
static boolean AUTOMATIC_SLAVE_LAUNCH
          Automatically try to launch a slave when Jenkins is initialized or a new slave is created.
 Hudson.CloudList clouds
          Active Clouds.
protected  Map<Node,Computer> computers
          Computers in this Hudson system.
static boolean CONCURRENT_BUILD
          Deprecated. as of 1.464 This flag will have no effect.
static boolean FLYWEIGHT_SUPPORT
          Enabled by default as of 1.337.
static boolean KILL_AFTER_LOAD
           
static List<LogRecord> logRecords
          Live view of recent LogRecords produced by Hudson.
 Lookup lookup
          Stores various objects scoped to Jenkins.
 OverallLoadStatistics overallLoad
          Load statistics of the entire system.
 NodeProvisioner overallNodeProvisioner
          Deprecated. as of 1.467 Use unlabeledNodeProvisioner. This was broken because it was tracking all the executors in the system, but it was only tracking free-roaming jobs in the queue. So Cloud fails to launch nodes when you have some exclusive slaves and free-roaming jobs in the queue.
static boolean PARALLEL_LOAD
           
static PermissionGroup PERMISSIONS
           
 PluginManager pluginManager
          Loaded plugins.
 ProxyConfiguration proxy
          HTTP proxy configuration.
static Permission READ
           
static String RESOURCE_PATH
          Prefix to static resources like images and javascripts in the war file.
 File root
          Root directory of the system.
static Permission RUN_SCRIPTS
           
 javax.servlet.ServletContext servletContext
           
static String SESSION_HASH
          Unique random token that identifies the current session.
protected  NodeList slaves
          Set of installed cluster nodes.
 TcpSlaveAgentListener tcpSlaveAgentListener
           
 LoadStatistics unlabeledLoad
          Load statistics of the free roaming jobs and slaves.
 NodeProvisioner unlabeledNodeProvisioner
          NodeProvisioner that reacts to unlabeledLoad.
static String VERSION
          Version number of this Hudson.
static String VERSION_HASH
          Hash of VERSION.
static String VIEW_RESOURCE_PATH
          Prefix to resources alongside view scripts.
static com.thoughtworks.xstream.XStream XSTREAM
          Thread-safe reusable XStream.
static XStream2 XSTREAM2
          Alias to XSTREAM so that one can access additional methods on XStream2 more easily.
 
Fields inherited from class hudson.model.AbstractCIBase
LOG_STARTUP_PERFORMANCE
 
Fields inherited from class hudson.model.Node
holdOffLaunchUntilSave
 
Fields inherited from interface hudson.model.Saveable
NOOP
 
Constructor Summary
protected Jenkins(File root, javax.servlet.ServletContext context)
           
protected Jenkins(File root, javax.servlet.ServletContext context, PluginManager pluginManager)
           
 
Method Summary
static void _doScript(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, javax.servlet.RequestDispatcher view, hudson.remoting.VirtualChannel channel, ACL acl)
           
 Fingerprint _getFingerprint(String md5sum)
          Gets a Fingerprint object if it exists.
 void addNode(Node n)
          Adds one more Node to Hudson.
 void addView(View v)
           
 boolean canDelete(View view)
          Determine whether a view may be deleted.
static void checkGoodName(String name)
          Check if the given name is suitable as a name for job, view, etc.
 void cleanUp()
          Called to shut down the system.
<T extends AbstractProject<?,?>>
T
copy(T src, String name)
           
<T extends TopLevelItem>
T
copy(T src, String name)
          Copys a job.
 Computer createComputer()
          Creates a new Computer object that acts as the UI peer of this Node.
 Launcher createLauncher(TaskListener listener)
          Returns a Launcher for executing programs on this node.
 FilePath createPath(String absolutePath)
          Gets the FilePath on this node.
<T extends TopLevelItem>
T
createProject(Class<T> type, String name)
          Creates a new job.
 TopLevelItem createProject(TopLevelItemDescriptor type, String name)
           
 TopLevelItem createProject(TopLevelItemDescriptor type, String name, boolean notify)
          Creates a new job.
 TopLevelItem createProjectFromXML(String name, InputStream xml)
          /** Creates a new job from its configuration XML.
 void deleteView(View view)
          Deletes a view in this group.
 void disableSecurity()
           
 org.kohsuke.stapler.HttpRedirect doCancelQuietDown()
           
 FormValidation doCheckDisplayName(String displayName, String jobName)
          Checks to see if the candidate displayName collides with any existing display names or project names
 FormValidation doCheckJobName(String value)
          Makes sure that the given name is good as a job name.
 FormValidation doCheckURIEncoding(org.kohsuke.stapler.StaplerRequest request)
          Checks if container uses UTF-8 to decode URLs.
 FormValidation doCheckViewName(String value)
          Checks if a top-level view with the given name exists and make sure that the name is good as a view name.
 ModelObjectWithContextMenu.ContextMenu doChildrenContextMenu(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response)
          Generates the context menu to list up all the children.
 void doClassicThreadDump(org.kohsuke.stapler.StaplerResponse rsp)
          Backward compatibility.
 void doCli(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Handles HTTP requests for duplex channels for CLI.
 void doConfigExecutorsSubmit(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Accepts submission from the node configuration page.
 void doConfigSubmit(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Accepts submission from the configuration page.
 ModelObjectWithContextMenu.ContextMenu doContextMenu(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response)
          Generates the context menu.
 TopLevelItem doCreateItem(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          The request format follows that of &lt;n:form xmlns:n="/lib/form">.
 void doCreateView(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
           
 FormValidation doDefaultJDKCheck(org.kohsuke.stapler.StaplerRequest request, String value)
          If the user chose the default JDK, make sure we got 'java' in PATH.
 void doDoFingerprintCheck(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Do a finger-print check.
 void doEval(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Evaluates the Jelly script submitted by the client.
 void doException()
          End point that intentionally throws an exception to test the error behaviour.
 void doExit(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Shutdown the system.
 void doFingerprintCleanup(org.kohsuke.stapler.StaplerResponse rsp)
           
 void doGc(org.kohsuke.stapler.StaplerResponse rsp)
          For debugging.
 void doIconSize(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Changes the icon size by changing the cookie
 Slave.JnlpJar doJnlpJars(org.kohsuke.stapler.StaplerRequest req)
           
 void doLoginEntry(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Called once the user logs in.
 void doLogout(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Logs out the user.
 org.kohsuke.stapler.HttpRedirect doQuietDown()
           
 org.kohsuke.stapler.HttpRedirect doQuietDown(boolean block, int timeout)
           
 org.kohsuke.stapler.HttpResponse doReload()
          Reloads the configuration.
 void doResources(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Serves static resources placed along with Jelly view files.
 void doRestart(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Perform a restart of Hudson, if we can.
 org.kohsuke.stapler.HttpResponse doSafeExit(org.kohsuke.stapler.StaplerRequest req)
          Shutdown the system safely.
 org.kohsuke.stapler.HttpResponse doSafeRestart(org.kohsuke.stapler.StaplerRequest req)
          Queues up a restart of Hudson for when there are no builds running, if we can.
 void doScript(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          For system diagnostics.
 void doScriptText(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Run arbitrary Groovy script and return result as plain text.
 void doSecured(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Checks if the user was successfully authenticated.
 void doSignup(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Sign up for the user account.
 void doSimulateOutOfMemory()
          Simulates OutOfMemoryError.
 void doSubmitDescription(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Accepts the new description.
 void doTestPost(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
           
 DirectoryBrowserSupport doUserContent()
          Binds /userContent/...
 FormValidation doViewExistsCheck(String value)
          Deprecated. 1.512
 void doWorkspaceCleanup(org.kohsuke.stapler.StaplerResponse rsp)
           
 ACL getACL()
          Returns the root ACL.
 List<Action> getActions()
          Returns the transient Actions associated with the top page.
 org.kohsuke.stapler.framework.adjunct.AdjunctManager getAdjuncts(String dummy)
          Makes AdjunctManager URL-bound.
 AdministrativeMonitor getAdministrativeMonitor(String id)
          Binds AdministrativeMonitors to URL.
 List<Item> getAllItems()
          Gets all the items recursively.
<T extends Item>
List<T>
getAllItems(Class<T> type)
          Gets all the Items recursively in the ItemGroup tree and filter them by the given type.
 Map<String,Map<String,String>> getAllThreadDumps()
          Obtains the thread dump of all slaves (including the master.)
 Api getApi()
           
 View.AsynchPeople getAsynchPeople()
           
static org.acegisecurity.Authentication getAuthentication()
          Gets the Authentication object that represents the user associated with the current request.
 AuthorizationStrategy getAuthorizationStrategy()
           
 File getBuildDirFor(Job job)
           
 Descriptor<Builder> getBuilder(String shortClassName)
          Gets the builder descriptor by name.
 Descriptor<BuildWrapper> getBuildWrapper(String shortClassName)
          Gets the build wrapper descriptor by name.
 ClockDifference getClockDifference()
          Estimates the clock difference with this slave.
 Cloud getCloud(String name)
          Gets a Cloud by its name, or null.
 ComputerSet getComputer()
          Deprecated. UI method. Not meant to be used programatically.
 Computer getComputer(String name)
           
protected  Map<Node,Computer> getComputerMap()
           
 Computer[] getComputers()
          Gets the read-only list of all Computers.
 CrumbIssuer getCrumbIssuer()
          Gets the CrumbIssuer currently in use.
 DependencyGraph getDependencyGraph()
           
 String getDescription()
           
 NodeDescriptor getDescriptor()
          Gets the descriptor for this instance.
 Descriptor getDescriptor(Class<? extends Describable> type)
          Gets the Descriptor that corresponds to the given Describable type.
 Descriptor getDescriptor(String id)
          Exposes Descriptor by its name to URL.
 Descriptor getDescriptorByName(String id)
          Alias for getDescriptor(String).
<T extends Descriptor>
T
getDescriptorByType(Class<T> type)
          Gets the Descriptor instance in the current Hudson by its type.
<T extends Describable<T>,D extends Descriptor<T>>
DescriptorExtensionList<T,D>
getDescriptorList(Class<T> type)
          Returns ExtensionList that retains the discovered Descriptor instances for the given kind of Describable.
 Descriptor getDescriptorOrDie(Class<? extends Describable> type)
          Works just like getDescriptor(Class) but don't take no for an answer.
 String getDisplayName()
           
 Object getDynamic(String token)
           
<T> ExtensionList<T>
getExtensionList(Class<T> extensionType)
          Returns ExtensionList that retains the discovered instances for the given extension type.
 ExtensionList getExtensionList(String extensionType)
          Used to bind ExtensionLists to URLs.
 FederatedLoginService getFederatedLoginService(String name)
           
 List<FederatedLoginService> getFederatedLoginServices()
           
 Object getFingerprint(String md5sum)
           
 FingerprintMap getFingerprintMap()
           
 String getFullDisplayName()
           
 String getFullName()
          Gets the full name of this ItemGroup.
 DescribableList<NodeProperty<?>,NodePropertyDescriptor> getGlobalNodeProperties()
           
 RemotingDiagnostics.HeapDump getHeapDump()
          Obtains the heap dump.
 InitMilestone getInitLevel()
          Gets the initialization milestone that we've already reached.
 com.google.inject.Injector getInjector()
          Gets the dependency injection container that hosts all the extension implementations and other components in Jenkins.
static Jenkins getInstance()
           
 TopLevelItem getItem(String name)
          Gets the Item inside this group that has a given name, or null if it does not exist.
 Item getItem(String pathName, Item context)
           
<T extends Item>
T
getItem(String pathName, Item context, Class<T> type)
           
 Item getItem(String pathName, ItemGroup context)
          Gets the item by its path name from the given context
<T extends Item>
T
getItem(String pathName, ItemGroup context, Class<T> type)
           
 Item getItemByFullName(String fullName)
           
<T extends Item>
T
getItemByFullName(String fullName, Class<T> type)
          Gets the Item object by its full name.
 Jenkins getItemGroup()
          Returns the ItemGroup from which the views in this group should render items.
 Map<String,TopLevelItem> getItemMap()
          Returns the read-only view of all the TopLevelItems keyed by their names.
 List<TopLevelItem> getItems()
          Gets just the immediate children of Jenkins.
<T> List<T>
getItems(Class<T> type)
          Gets just the immediate children of Jenkins but of the given type.
 JDK getJDK(String name)
          Gets the JDK installation of the given name, or returns null.
 List<JDK> getJDKs()
           
 Slave.JnlpJar getJnlpJars(String fileName)
          Serves jar files for JNLP slave agents.
 Collection<String> getJobNames()
          Gets the names of all the Jobs.
 JobPropertyDescriptor getJobProperty(String shortClassName)
          Gets the JobPropertyDescriptor by name.
 Label getLabel(String expr)
          Gets the label that exists on this system by the name.
 LabelAtom getLabelAtom(String name)
          Returns the label atom of the given name.
 Set<LabelAtom> getLabelAtoms()
           
 Set<Label> getLabels()
          Gets all the active labels in the current system.
 String getLabelString()
          Returns the manually configured label for a node.
 String getLegacyInstanceId()
          Returns the unique identifier of this Jenkins that has been historically used to identify this Jenkins to the outside world.
 Lifecycle getLifecycle()
           
 LogRecorderManager getLog()
          For binding LogRecorderManager to "/log".
 List<ManagementLink> getManagementLinks()
           
 MarkupFormatter getMarkupFormatter()
          Gets the markup formatter used in the system.
 User getMe()
          Exposes the current user to /me URL.
 Node.Mode getMode()
          Returns Node.Mode.EXCLUSIVE if this node is only available for those jobs that exclusively specifies this node as the assigned node.
 MyViewsTabBar getMyViewsTabBar()
           
 Node getNode(String name)
          Gets the slave node of the give name, hooked under this Hudson.
 String getNodeDescription()
          Human-readable description of this node.
 DescribableList<NodeProperty<?>,NodePropertyDescriptor> getNodeProperties()
          Gets the NodeProperty instances configured for this Node.
 List<Node> getNodes()
          Returns all Nodes in the system, excluding Jenkins instance itself which represents the master.
 int getNumExecutors()
          Returns the number of Executors.
 View.People getPeople()
           
<P extends Plugin>
P
getPlugin(Class<P> clazz)
          Gets the plugin object from its class.
 Plugin getPlugin(String shortName)
          Gets the plugin object from its short name.
 PluginManager getPluginManager()
           
<P extends Plugin>
List<P>
getPlugins(Class<P> clazz)
          Gets the plugin objects from their super-class.
 View getPrimaryView()
          Returns the primary View that renders the top-page of Hudson.
 ProjectNamingStrategy getProjectNamingStrategy()
          The strategy used to check the project names.
 List<Project> getProjects()
          Deprecated. This method will ignore Maven and matrix projects, as well as projects inside containers such as folders. You may prefer to call getAllItems(Class) on AbstractProject, perhaps also using Util.createSubList(java.util.Collection, java.lang.Class) to consider only TopLevelItems. (That will also consider the caller's permissions.) If you really want to get just Projects at top level, ignoring permissions, you can filter the values from getItemMap() using Util.createSubList(java.util.Collection, java.lang.Class).
 Descriptor<Publisher> getPublisher(String shortClassName)
          Gets the publisher descriptor by name.
 Queue getQueue()
           
 int getQuietPeriod()
          Gets the system default quiet period.
 String getRawBuildsDir()
           
 String getRawWorkspaceDir()
           
 Descriptor<RepositoryBrowser<?>> getRepositoryBrowser(String shortClassName)
          Gets the repository browser descriptor by name.
 Descriptor<RetentionStrategy<?>> getRetentionStrategy(String shortClassName)
          Gets the retention strategy descriptor by name.
 File getRootDir()
          Gets the root directory on the file system that this Item can use freely for storing the configuration data.
 File getRootDirFor(TopLevelItem child)
          Assigns the root directory for children.
 FilePath getRootPath()
          Gets the root directory of this node.
 String getRootUrl()
          Gets the absolute URL of Jenkins, such as "http://localhost/jenkins/".
 String getRootUrlFromRequest()
          Gets the absolute URL of Hudson top page, such as "http://localhost/hudson/".
 Descriptor<SCM> getScm(String shortClassName)
          Gets the SCM descriptor by name.
 int getScmCheckoutRetryCount()
          Gets the global SCM check out retry count.
 CopyOnWriteList<SCMListener> getSCMListeners()
          Gets all the installed SCMListeners.
 String getSearchUrl()
          Returns the URL of this item relative to the parent SearchItem.
 String getSecretKey()
          Deprecated. Due to the past security advisory, this value should not be used any more to protect sensitive information. See ConfidentialStore and ConfidentialKey for how to store secrets.
 SecretKey getSecretKeyAsAES128()
          Deprecated. See getSecretKey().
 SecurityMode getSecurity()
          Returns the constant that captures the three basic security modes in Hudson.
 SecurityRealm getSecurityRealm()
           
 Descriptor<SecurityRealm> getSecurityRealms(String shortClassName)
          Gets the SecurityRealm descriptors by name.
 LabelAtom getSelfLabel()
          Gets the special label that represents this node itself.
 int getSlaveAgentPort()
           
 View getStaplerFallback()
          Fallback to the primary view.
 String getSystemMessage()
          Synonym for getDescription().
 Object getTarget()
           
 TcpSlaveAgentListener getTcpSlaveAgentListener()
           
 Collection<String> getTopLevelItemNames()
          Gets the names of all the TopLevelItems.
 TriggerDescriptor getTrigger(String shortClassName)
          Gets the trigger descriptor by name.
 Collection<String> getUnprotectedRootActions()
          Gets a list of unprotected root actions.
 UpdateCenter getUpdateCenter()
           
 String getUrlChildPrefix()
          Gets the URL token that prefixes the URLs for child Items.
 User getUser(String name)
          Gets the user of the given name.
static hudson.util.VersionNumber getVersion()
          Parses VERSION into VersionNumber, or null if it's not parseable as a version number (such as when Hudson is run with "mvn hudson-dev:run")
 View getView(String name)
          Gets a view of the given name.
 List<Action> getViewActions()
          Returns actions that should be displayed in views.
 Collection<View> getViews()
          Gets the read-only list of all Views.
 ViewsTabBar getViewsTabBar()
          Gets the TabBar for the views.
 List<Widget> getWidgets()
          Gets the Widgets registered on this object.
 FilePath getWorkspaceFor(TopLevelItem item)
          Returns a "workspace" directory for the given TopLevelItem.
 boolean hasPeople()
          Deprecated. Potentially very expensive call; do not use from Jelly views.
static boolean isCheckURIEncodingEnabled()
          Does not check when system default encoding is "ISO-8859-1".
 boolean isQuietingDown()
          Returns true if Hudson is quieting down.
 boolean isRootUrlSecure()
          Is Jenkins running in HTTPS? Note that we can't really trust ServletRequest.isSecure() because HTTPS might be terminated in the reverse proxy.
 boolean isTerminating()
          Returns true if the container initiated the termination of the web application.
 boolean isUpgradedFromBefore(hudson.util.VersionNumber v)
          Returns true if the current running Jenkins is upgraded from a version earlier than the specified version.
 boolean isUsageStatisticsCollected()
           
 boolean isUseCrumbs()
          If true, all the POST requests to Hudson would have to have crumb in it to protect Hudson from CSRF vulnerabilities.
 boolean isUseProjectNamingStrategy()
           
 boolean isUseSecurity()
          A convenience method to check if there's some security restrictions in place.
static
<T> T
lookup(Class<T> type)
          Shortcut for Hudson.getInstance().lookup.get(type)
 SearchIndexBuilder makeSearchIndex()
          Default implementation that returns empty index.
 void onDeleted(TopLevelItem item)
          Called in response to AbstractItem.doDoDelete(StaplerRequest, StaplerResponse)
 void onRenamed(TopLevelItem job, String oldName, String newName)
          Called by Job.renameTo(String) to update relevant data structure.
 void onViewRenamed(View view, String oldName, String newName)
          View calls this method when it's renamed.
 void putItem(TopLevelItem item)
          Overwrites the existing item by new one.
 void rebuildDependencyGraph()
          Rebuilds the dependency map.
 void refreshExtensions()
          Refresh ExtensionLists by adding all the newly discovered extensions.
 void reload()
          Reloads the configuration synchronously.
 void removeNode(Node n)
          Removes a Node from Hudson.
 void restart()
          Performs a restart.
 void safeRestart()
          Queues up a restart to be performed once there are no builds currently running.
 void save()
          Save the settings to a file.
 void setAuthorizationStrategy(AuthorizationStrategy a)
           
 void setCrumbIssuer(CrumbIssuer issuer)
           
 void setLabelString(String label)
          Sets the label string for a node.
 void setMarkupFormatter(MarkupFormatter f)
          Sets the markup formatter used in the system globally.
 void setMode(Node.Mode m)
           
 void setMyViewsTabBar(MyViewsTabBar myViewsTabBar)
           
 void setNodeName(String name)
          When the user clones a Node, Hudson uses this method to change the node name right after the cloned Node object is instantiated.
 void setNodes(List<? extends Node> nodes)
           
 void setNoUsageStatistics(Boolean noUsageStatistics)
           
 void setNumExecutors(int n)
           
 void setPrimaryView(View v)
           
 void setProjectNamingStrategy(ProjectNamingStrategy ns)
           
 void setQuietPeriod(Integer quietPeriod)
          Sets the global quiet period.
 void setScmCheckoutRetryCount(int scmCheckoutRetryCount)
           
 void setSecurityRealm(SecurityRealm securityRealm)
           
 void setSlaveAgentPort(int port)
           
 void setSystemMessage(String message)
          Sets the system message.
 void setViewsTabBar(ViewsTabBar viewsTabBar)
           
protected  void updateComputerList()
           
 
Methods inherited from class hudson.model.AbstractCIBase
getNodeName, getUrl, interruptReloadThread, killComputer, resetLabel, setViewOwner, updateComputerList
 
Methods inherited from class hudson.model.Node
canTake, canTake, checkPermission, getAssignedLabels, getChannel, getFileSystemProvisioner, getLabelCloud, getNodePropertyDescriptors, hasPermission, isHoldOffLaunchUntilSave, reconfigure, toComputer
 
Methods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, getSearchName, requirePOST, sendError, sendError, sendError, sendError, sendError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface hudson.model.ItemGroup
getUrl
 
Methods inherited from interface hudson.model.ViewGroup
getUrl
 
Methods inherited from interface hudson.security.AccessControlled
checkPermission, hasPermission
 

Field Detail

lookup

public final transient Lookup lookup
Stores various objects scoped to Jenkins.


root

public final transient File root
Root directory of the system.


computers

protected final transient Map<Node,Computer> computers
Computers in this Hudson system. Read-only.


clouds

public final Hudson.CloudList clouds
Active Clouds.


slaves

protected volatile NodeList slaves
Set of installed cluster nodes.

We use this field with copy-on-write semantics. This field has mutable list (to keep the serialization look clean), but it shall never be modified. Only new completely populated slave list can be set here.

The field name should be really nodes, but again the backward compatibility prevents us from renaming.


pluginManager

public final transient PluginManager pluginManager
Loaded plugins.


tcpSlaveAgentListener

public transient volatile TcpSlaveAgentListener tcpSlaveAgentListener

overallLoad

@Exported
public final transient OverallLoadStatistics overallLoad
Load statistics of the entire system. This includes every executor and every job in the system.


unlabeledLoad

@Exported
public final transient LoadStatistics unlabeledLoad
Load statistics of the free roaming jobs and slaves. This includes all executors on Mode#NORMAL nodes and jobs that do not have any assigned nodes.

Since:
1.467

unlabeledNodeProvisioner

public final transient NodeProvisioner unlabeledNodeProvisioner
NodeProvisioner that reacts to unlabeledLoad.

Since:
1.467

overallNodeProvisioner

@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class)
public final transient NodeProvisioner overallNodeProvisioner
Deprecated. as of 1.467 Use unlabeledNodeProvisioner. This was broken because it was tracking all the executors in the system, but it was only tracking free-roaming jobs in the queue. So Cloud fails to launch nodes when you have some exclusive slaves and free-roaming jobs in the queue.

servletContext

public final transient javax.servlet.ServletContext servletContext

administrativeMonitors

public final transient List<AdministrativeMonitor> administrativeMonitors
AdministrativeMonitors installed on this system.

See Also:
AdministrativeMonitor

proxy

public transient volatile ProxyConfiguration proxy
HTTP proxy configuration.


ALLOWED_RESOURCE_EXTENSIONS

public static final Set<String> ALLOWED_RESOURCE_EXTENSIONS
Extension list that doResources(StaplerRequest, StaplerResponse) can serve. This set is mutable to allow plugins to add additional extensions.


logRecords

public static List<LogRecord> logRecords
Live view of recent LogRecords produced by Hudson.


XSTREAM

public static final com.thoughtworks.xstream.XStream XSTREAM
Thread-safe reusable XStream.


XSTREAM2

public static final XStream2 XSTREAM2
Alias to XSTREAM so that one can access additional methods on XStream2 more easily.


VERSION

public static String VERSION
Version number of this Hudson.


VERSION_HASH

public static String VERSION_HASH
Hash of VERSION.


SESSION_HASH

public static String SESSION_HASH
Unique random token that identifies the current session. Used to make RESOURCE_PATH unique so that we can set long "Expires" header. We used to use VERSION_HASH, but making this session local allows us to reuse the same RESOURCE_PATH for static resources in plugins.


RESOURCE_PATH

public static String RESOURCE_PATH
Prefix to static resources like images and javascripts in the war file. Either "" or strings like "/static/VERSION", which avoids Jenkins to pick up stale cache when the user upgrades to a different version.

Value computed in WebAppMain.


VIEW_RESOURCE_PATH

public static String VIEW_RESOURCE_PATH
Prefix to resources alongside view scripts. Strings like "/resources/VERSION", which avoids Hudson to pick up stale cache when the user upgrades to a different version.

Value computed in WebAppMain.


PARALLEL_LOAD

public static boolean PARALLEL_LOAD

KILL_AFTER_LOAD

public static boolean KILL_AFTER_LOAD

FLYWEIGHT_SUPPORT

public static boolean FLYWEIGHT_SUPPORT
Enabled by default as of 1.337. Will keep it for a while just in case we have some serious problems.


CONCURRENT_BUILD

@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class)
public static boolean CONCURRENT_BUILD
Deprecated. as of 1.464 This flag will have no effect.
Tentative switch to activate the concurrent build behavior. When we merge this back to the trunk, this allows us to keep this feature hidden for a while until we iron out the kinks.

See Also:
AbstractProject.isConcurrentBuild()

AUTOMATIC_SLAVE_LAUNCH

public static boolean AUTOMATIC_SLAVE_LAUNCH
Automatically try to launch a slave when Jenkins is initialized or a new slave is created.


PERMISSIONS

public static final PermissionGroup PERMISSIONS

ADMINISTER

public static final Permission ADMINISTER

READ

public static final Permission READ

RUN_SCRIPTS

public static final Permission RUN_SCRIPTS

ANONYMOUS

public static final org.acegisecurity.Authentication ANONYMOUS
Authentication object that represents the anonymous user. Because Acegi creates its own AnonymousAuthenticationToken instances, the code must not expect the singleton semantics. This is just a convenient instance.

Since:
1.343
Constructor Detail

Jenkins

protected Jenkins(File root,
                  javax.servlet.ServletContext context)
           throws IOException,
                  InterruptedException,
                  org.jvnet.hudson.reactor.ReactorException
Throws:
IOException
InterruptedException
org.jvnet.hudson.reactor.ReactorException

Jenkins

protected Jenkins(File root,
                  javax.servlet.ServletContext context,
                  PluginManager pluginManager)
           throws IOException,
                  InterruptedException,
                  org.jvnet.hudson.reactor.ReactorException
Parameters:
pluginManager - If non-null, use existing plugin manager. create a new one.
Throws:
IOException
InterruptedException
org.jvnet.hudson.reactor.ReactorException
Method Detail

getInstance

@CLIResolver
public static Jenkins getInstance()

getTcpSlaveAgentListener

public TcpSlaveAgentListener getTcpSlaveAgentListener()

getAdjuncts

public org.kohsuke.stapler.framework.adjunct.AdjunctManager getAdjuncts(String dummy)
Makes AdjunctManager URL-bound. The dummy parameter allows us to use different URLs for the same adjunct, for proper cache handling.


getSlaveAgentPort

@Exported
public int getSlaveAgentPort()

setSlaveAgentPort

public void setSlaveAgentPort(int port)
                       throws IOException
Parameters:
port - 0 to indicate random available TCP port. -1 to disable this service.
Throws:
IOException

setNodeName

public void setNodeName(String name)
Description copied from class: Node
When the user clones a Node, Hudson uses this method to change the node name right after the cloned Node object is instantiated.

This method is never used for any other purpose, and as such for all practical intents and purposes, the node name should be treated like immutable.

Specified by:
setNodeName in class Node

getNodeDescription

public String getNodeDescription()
Description copied from class: Node
Human-readable description of this node.

Specified by:
getNodeDescription in class Node

getDescription

@Exported
public String getDescription()

getPluginManager

public PluginManager getPluginManager()

getUpdateCenter

public UpdateCenter getUpdateCenter()

isUsageStatisticsCollected

public boolean isUsageStatisticsCollected()

setNoUsageStatistics

public void setNoUsageStatistics(Boolean noUsageStatistics)
                          throws IOException
Throws:
IOException

getPeople

public View.People getPeople()

getAsynchPeople

public View.AsynchPeople getAsynchPeople()
Since:
1.484

hasPeople

public boolean hasPeople()
Deprecated. Potentially very expensive call; do not use from Jelly views.

Does this View has any associated user information recorded?


getApi

public Api getApi()

getSecretKey

public String getSecretKey()
Deprecated. Due to the past security advisory, this value should not be used any more to protect sensitive information. See ConfidentialStore and ConfidentialKey for how to store secrets.

Returns a secret key that survives across container start/stop.

This value is useful for implementing some of the security features.


getSecretKeyAsAES128

public SecretKey getSecretKeyAsAES128()
Deprecated. See getSecretKey().

Gets the secret key as a key for AES-128.

Since:
1.308

getLegacyInstanceId

public String getLegacyInstanceId()
Returns the unique identifier of this Jenkins that has been historically used to identify this Jenkins to the outside world.

This form of identifier is weak in that it can be impersonated by others. See https://wiki.jenkins-ci.org/display/JENKINS/Instance+Identity for more modern form of instance ID that can be challenged and verified.

Since:
1.498

getScm

public Descriptor<SCM> getScm(String shortClassName)
Gets the SCM descriptor by name. Primarily used for making them web-visible.


getRepositoryBrowser

public Descriptor<RepositoryBrowser<?>> getRepositoryBrowser(String shortClassName)
Gets the repository browser descriptor by name. Primarily used for making them web-visible.


getBuilder

public Descriptor<Builder> getBuilder(String shortClassName)
Gets the builder descriptor by name. Primarily used for making them web-visible.


getBuildWrapper

public Descriptor<BuildWrapper> getBuildWrapper(String shortClassName)
Gets the build wrapper descriptor by name. Primarily used for making them web-visible.


getPublisher

public Descriptor<Publisher> getPublisher(String shortClassName)
Gets the publisher descriptor by name. Primarily used for making them web-visible.


getTrigger

public TriggerDescriptor getTrigger(String shortClassName)
Gets the trigger descriptor by name. Primarily used for making them web-visible.


getRetentionStrategy

public Descriptor<RetentionStrategy<?>> getRetentionStrategy(String shortClassName)
Gets the retention strategy descriptor by name. Primarily used for making them web-visible.


getJobProperty

public JobPropertyDescriptor getJobProperty(String shortClassName)
Gets the JobPropertyDescriptor by name. Primarily used for making them web-visible.


getComputer

public ComputerSet getComputer()
Deprecated. UI method. Not meant to be used programatically.


getDescriptor

public Descriptor getDescriptor(String id)
Exposes Descriptor by its name to URL. After doing all the getXXX(shortClassName) methods, I finally realized that this just doesn't scale.

Parameters:
id - Either Descriptor.getId() (recommended) or the short name of a Describable subtype (for compatibility)
Throws:
IllegalArgumentException - if a short name was passed which matches multiple IDs (fail fast)

getDescriptorByName

public Descriptor getDescriptorByName(String id)
Alias for getDescriptor(String).

Specified by:
getDescriptorByName in interface DescriptorByNameOwner
Parameters:
id - Either Descriptor.getId() (recommended) or the short name.

getDescriptor

public Descriptor getDescriptor(Class<? extends Describable> type)
Gets the Descriptor that corresponds to the given Describable type.

If you have an instance of type and call Describable.getDescriptor(), you'll get the same instance that this method returns.


getDescriptorOrDie

public Descriptor getDescriptorOrDie(Class<? extends Describable> type)
Works just like getDescriptor(Class) but don't take no for an answer.

Throws:
AssertionError - If the descriptor is missing.
Since:
1.326

getDescriptorByType

public <T extends Descriptor> T getDescriptorByType(Class<T> type)
Gets the Descriptor instance in the current Hudson by its type.


getSecurityRealms

public Descriptor<SecurityRealm> getSecurityRealms(String shortClassName)
Gets the SecurityRealm descriptors by name. Primarily used for making them web-visible.


updateComputerList

protected void updateComputerList()
                           throws IOException
Throws:
IOException

getSCMListeners

public CopyOnWriteList<SCMListener> getSCMListeners()
Gets all the installed SCMListeners.


getPlugin

public Plugin getPlugin(String shortName)
Gets the plugin object from its short name.

This allows URL hudson/plugin/ID to be served by the views of the plugin class.


getPlugin

public <P extends Plugin> P getPlugin(Class<P> clazz)
Gets the plugin object from its class.

This allows easy storage of plugin information in the plugin singleton without every plugin reimplementing the singleton pattern.

Parameters:
clazz - The plugin class (beware class-loader fun, this will probably only work from within the jpi that defines the plugin class, it may or may not work in other cases)
Returns:
The plugin instance.

getPlugins

public <P extends Plugin> List<P> getPlugins(Class<P> clazz)
Gets the plugin objects from their super-class.

Parameters:
clazz - The plugin class (beware class-loader fun)
Returns:
The plugin instances.

getSystemMessage

public String getSystemMessage()
Synonym for getDescription().


getMarkupFormatter

public MarkupFormatter getMarkupFormatter()
Gets the markup formatter used in the system.

Returns:
never null.
Since:
1.391

setMarkupFormatter

public void setMarkupFormatter(MarkupFormatter f)
Sets the markup formatter used in the system globally.

Since:
1.391

setSystemMessage

public void setSystemMessage(String message)
                      throws IOException
Sets the system message.

Throws:
IOException

getFederatedLoginService

public FederatedLoginService getFederatedLoginService(String name)

getFederatedLoginServices

public List<FederatedLoginService> getFederatedLoginServices()

createLauncher

public Launcher createLauncher(TaskListener listener)
Description copied from class: Node
Returns a Launcher for executing programs on this node.

The callee must call Launcher.decorateFor(Node) before returning to complete the decoration.

Specified by:
createLauncher in class Node

getFullName

public String getFullName()
Description copied from interface: ItemGroup
Gets the full name of this ItemGroup.

Specified by:
getFullName in interface ItemGroup<TopLevelItem>
See Also:
Item.getFullName()

getFullDisplayName

public String getFullDisplayName()
Specified by:
getFullDisplayName in interface ItemGroup<TopLevelItem>
See Also:
Item.getFullDisplayName()

getActions

public List<Action> getActions()
Returns the transient Actions associated with the top page.

Adding Action is primarily useful for plugins to contribute an item to the navigation bar of the top page. See existing Action implementation for it affects the GUI.

To register an Action, implement RootAction extension point, or write code like Hudson.getInstance().getActions().add(...).

Returns:
Live list where the changes can be made. Can be empty but never null.
Since:
1.172

getItems

@Exported(name="jobs")
public List<TopLevelItem> getItems()
Gets just the immediate children of Jenkins.

Specified by:
getItems in interface ItemGroup<TopLevelItem>
See Also:
getAllItems(Class)

getItemMap

public Map<String,TopLevelItem> getItemMap()
Returns the read-only view of all the TopLevelItems keyed by their names.

This method is efficient, as it doesn't involve any copying.

Since:
1.296

getItems

public <T> List<T> getItems(Class<T> type)
Gets just the immediate children of Jenkins but of the given type.


getAllItems

public <T extends Item> List<T> getAllItems(Class<T> type)
Gets all the Items recursively in the ItemGroup tree and filter them by the given type.


getAllItems

public List<Item> getAllItems()
Gets all the items recursively.

Since:
1.402

getProjects

@Deprecated
public List<Project> getProjects()
Deprecated. This method will ignore Maven and matrix projects, as well as projects inside containers such as folders. You may prefer to call getAllItems(Class) on AbstractProject, perhaps also using Util.createSubList(java.util.Collection, java.lang.Class) to consider only TopLevelItems. (That will also consider the caller's permissions.) If you really want to get just Projects at top level, ignoring permissions, you can filter the values from getItemMap() using Util.createSubList(java.util.Collection, java.lang.Class).

Gets a list of simple top-level projects.


getJobNames

public Collection<String> getJobNames()
Gets the names of all the Jobs.


getViewActions

public List<Action> getViewActions()
Description copied from interface: ViewGroup
Returns actions that should be displayed in views.

In this interface, the return value is used read-only. This doesn't prevent subtypes from returning modifiable actions, however.

This method was added later to ViewGroup, so old plugins might not be implementing this. To work around this, Views can use View.getOwnerViewActions().

Specified by:
getViewActions in interface ViewGroup
Returns:
may be empty but never null.
See Also:
Actionable.getActions()

getTopLevelItemNames

public Collection<String> getTopLevelItemNames()
Gets the names of all the TopLevelItems.


getView

public View getView(String name)
Description copied from interface: ViewGroup
Gets a view of the given name. This also creates the URL binding for views (in the form of ".../view/FOOBAR/...")

Specified by:
getView in interface ViewGroup

getViews

@Exported
public Collection<View> getViews()
Gets the read-only list of all Views.

Specified by:
getViews in interface ViewGroup
Returns:
can be empty but never null.

addView

public void addView(View v)
             throws IOException
Throws:
IOException

canDelete

public boolean canDelete(View view)
Description copied from interface: ViewGroup
Determine whether a view may be deleted.

Specified by:
canDelete in interface ViewGroup

deleteView

public void deleteView(View view)
                throws IOException
Description copied from interface: ViewGroup
Deletes a view in this group.

Specified by:
deleteView in interface ViewGroup
Throws:
IOException

onViewRenamed

public void onViewRenamed(View view,
                          String oldName,
                          String newName)
Description copied from interface: ViewGroup
View calls this method when it's renamed. This method is intended to work as a notification to the ViewGroup (so that it can adjust its internal data structure, for example.)

It is the caller's responsibility to ensure that the new name is a legal view name.

Specified by:
onViewRenamed in interface ViewGroup

getPrimaryView

@Exported
public View getPrimaryView()
Returns the primary View that renders the top-page of Hudson.

Specified by:
getPrimaryView in interface ViewGroup

setPrimaryView

public void setPrimaryView(View v)

getViewsTabBar

public ViewsTabBar getViewsTabBar()
Description copied from interface: ViewGroup
Gets the TabBar for the views. TabBar for views can be provided by extension. Only one TabBar can be active at a given time (Selectable by user in the global Configuration page). Default TabBar is provided by Hudson Platform.

Specified by:
getViewsTabBar in interface ViewGroup

setViewsTabBar

public void setViewsTabBar(ViewsTabBar viewsTabBar)

getItemGroup

public Jenkins getItemGroup()
Description copied from interface: ViewGroup
Returns the ItemGroup from which the views in this group should render items.

Generally speaking, Views render a subset of TopLevelItems that belong to this item group. This method was added later to ViewGroup, so old plugins might not be implementing this. To work around this, Views can use View.getOwnerItemGroup().

Specified by:
getItemGroup in interface ViewGroup
Returns:
Never null. Sometimes this is ModifiableItemGroup (if the container allows arbitrary addition)

getMyViewsTabBar

public MyViewsTabBar getMyViewsTabBar()

setMyViewsTabBar

public void setMyViewsTabBar(MyViewsTabBar myViewsTabBar)

isUpgradedFromBefore

public boolean isUpgradedFromBefore(hudson.util.VersionNumber v)
Returns true if the current running Jenkins is upgraded from a version earlier than the specified version.

This method continues to return true until the system configuration is saved, at which point version will be overwritten and Hudson forgets the upgrade history.

To handle SNAPSHOTS correctly, pass in "1.N.*" to test if it's upgrading from the version equal or younger than N. So say if you implement a feature in 1.301 and you want to check if the installation upgraded from pre-1.301, pass in "1.300.*"

Since:
1.301

getComputers

public Computer[] getComputers()
Gets the read-only list of all Computers.


getComputer

@CLIResolver
public Computer getComputer(String name)

getLabel

public Label getLabel(String expr)
Gets the label that exists on this system by the name.

Returns:
null if name is null.
See Also:
(String)

getLabelAtom

@Nullable
public LabelAtom getLabelAtom(@CheckForNull
                                       String name)
Returns the label atom of the given name.

Returns:
non-null iff name is non-null

getLabels

public Set<Label> getLabels()
Gets all the active labels in the current system.


getLabelAtoms

public Set<LabelAtom> getLabelAtoms()

getQueue

public Queue getQueue()
Specified by:
getQueue in class AbstractCIBase

getDisplayName

public String getDisplayName()
Specified by:
getDisplayName in interface ModelObject
Overrides:
getDisplayName in class Node

getJDKs

public List<JDK> getJDKs()

getJDK

public JDK getJDK(String name)
Gets the JDK installation of the given name, or returns null.


getNode

@CheckForNull
public Node getNode(String name)
Gets the slave node of the give name, hooked under this Hudson.


getCloud

public Cloud getCloud(String name)
Gets a Cloud by its name, or null.


getComputerMap

protected Map<Node,Computer> getComputerMap()
Specified by:
getComputerMap in class AbstractCIBase

getNodes

public List<Node> getNodes()
Returns all Nodes in the system, excluding Jenkins instance itself which represents the master.

Specified by:
getNodes in class AbstractCIBase

addNode

public void addNode(Node n)
             throws IOException
Adds one more Node to Hudson.

Throws:
IOException

removeNode

public void removeNode(@Nonnull
                       Node n)
                throws IOException
Removes a Node from Hudson.

Throws:
IOException

setNodes

public void setNodes(List<? extends Node> nodes)
              throws IOException
Throws:
IOException

getNodeProperties

public DescribableList<NodeProperty<?>,NodePropertyDescriptor> getNodeProperties()
Description copied from class: Node
Gets the NodeProperty instances configured for this Node.

Specified by:
getNodeProperties in class Node

getGlobalNodeProperties

public DescribableList<NodeProperty<?>,NodePropertyDescriptor> getGlobalNodeProperties()

getAdministrativeMonitor

public AdministrativeMonitor getAdministrativeMonitor(String id)
Binds AdministrativeMonitors to URL.


getDescriptor

public NodeDescriptor getDescriptor()
Description copied from interface: Describable
Gets the descriptor for this instance.

Descriptor is a singleton for every concrete Describable implementation, so if a.getClass()==b.getClass() then a.getDescriptor()==b.getDescriptor() must hold.

Specified by:
getDescriptor in interface Describable<Node>
Specified by:
getDescriptor in class Node

getQuietPeriod

public int getQuietPeriod()
Gets the system default quiet period.


setQuietPeriod

public void setQuietPeriod(Integer quietPeriod)
                    throws IOException
Sets the global quiet period.

Parameters:
quietPeriod - null to the default value.
Throws:
IOException

getScmCheckoutRetryCount

public int getScmCheckoutRetryCount()
Gets the global SCM check out retry count.


setScmCheckoutRetryCount

public void setScmCheckoutRetryCount(int scmCheckoutRetryCount)
                              throws IOException
Throws:
IOException

getSearchUrl

public String getSearchUrl()
Description copied from interface: SearchItem
Returns the URL of this item relative to the parent SearchItem.

Specified by:
getSearchUrl in interface SearchItem
Overrides:
getSearchUrl in class Node
Returns:
URL like "foo" or "foo/bar". The path can end with '/'. The path that starts with '/' will be interpreted as the absolute path (within the context path of Jenkins.)

makeSearchIndex

public SearchIndexBuilder makeSearchIndex()
Description copied from class: AbstractModelObject
Default implementation that returns empty index.

Overrides:
makeSearchIndex in class AbstractModelObject

getUrlChildPrefix

public String getUrlChildPrefix()
Description copied from interface: ItemGroup
Gets the URL token that prefixes the URLs for child Items. Like "job", "item", etc.

Specified by:
getUrlChildPrefix in interface ItemGroup<TopLevelItem>

getRootUrl

public String getRootUrl()
Gets the absolute URL of Jenkins, such as "http://localhost/jenkins/".

This method first tries to use the manually configured value, then fall back to StaplerRequest.getRootPath(). It is done in this order so that it can work correctly even in the face of a reverse proxy.

Returns:
This method returns null if this parameter is not configured by the user. The caller must gracefully deal with this situation. The returned URL will always have the trailing '/'.
Since:
1.66
See Also:
Descriptor.getCheckUrl(String), getRootUrlFromRequest(), Hyperlinks in HTML

isRootUrlSecure

public boolean isRootUrlSecure()
Is Jenkins running in HTTPS? Note that we can't really trust ServletRequest.isSecure() because HTTPS might be terminated in the reverse proxy.


getRootUrlFromRequest

public String getRootUrlFromRequest()
Gets the absolute URL of Hudson top page, such as "http://localhost/hudson/".

Unlike getRootUrl(), which uses the manually configured value, this one uses the current request to reconstruct the URL. The benefit is that this is immune to the configuration mistake (users often fail to set the root URL correctly, especially when a migration is involved), but the downside is that unless you are processing a request, this method doesn't work. Please note that this will not work in all cases if Jenkins is running behind a reverse proxy (e.g. when user has switched off ProxyPreserveHost, which is default setup or the actual url uses https) and you should use getRootUrl if you want to be sure you reflect user setup. See https://wiki.jenkins-ci.org/display/JENKINS/Running+Jenkins+behind+Apache

Since:
1.263

getRootDir

public File getRootDir()
Description copied from interface: PersistenceRoot
Gets the root directory on the file system that this Item can use freely for storing the configuration data.

This parameter is given by the ItemGroup when Item is loaded from memory.

Specified by:
getRootDir in interface PersistenceRoot

getWorkspaceFor

public FilePath getWorkspaceFor(TopLevelItem item)
Description copied from class: Node
Returns a "workspace" directory for the given TopLevelItem.

Workspace directory is usually used for keeping out the checked out source code, but it can be used for anything.

Specified by:
getWorkspaceFor in class Node
Returns:
null if this node is not connected hence the path is not available

getBuildDirFor

public File getBuildDirFor(Job job)

getRawWorkspaceDir

public String getRawWorkspaceDir()

getRawBuildsDir

public String getRawBuildsDir()

getRootPath

public FilePath getRootPath()
Description copied from class: Node
Gets the root directory of this node.

Hudson always owns a directory on every node. This method returns that.

Specified by:
getRootPath in class Node
Returns:
null if the node is offline and hence the FilePath object is not available.

createPath

public FilePath createPath(String absolutePath)
Description copied from class: Node
Gets the FilePath on this node.

Overrides:
createPath in class Node

getClockDifference

public ClockDifference getClockDifference()
Description copied from class: Node
Estimates the clock difference with this slave.

Specified by:
getClockDifference in class Node
Returns:
always non-null.

getLog

public LogRecorderManager getLog()
For binding LogRecorderManager to "/log". Everything below here is admin-only, so do the check here.


isUseSecurity

@Exported
public boolean isUseSecurity()
A convenience method to check if there's some security restrictions in place.


isUseProjectNamingStrategy

public boolean isUseProjectNamingStrategy()

isUseCrumbs

@Exported
public boolean isUseCrumbs()
If true, all the POST requests to Hudson would have to have crumb in it to protect Hudson from CSRF vulnerabilities.


getSecurity

public SecurityMode getSecurity()
Returns the constant that captures the three basic security modes in Hudson.


getSecurityRealm

public SecurityRealm getSecurityRealm()
Returns:
never null.

setSecurityRealm

public void setSecurityRealm(SecurityRealm securityRealm)

setAuthorizationStrategy

public void setAuthorizationStrategy(AuthorizationStrategy a)

disableSecurity

public void disableSecurity()

setProjectNamingStrategy

public void setProjectNamingStrategy(ProjectNamingStrategy ns)

getLifecycle

public Lifecycle getLifecycle()

getInjector

public com.google.inject.Injector getInjector()
Gets the dependency injection container that hosts all the extension implementations and other components in Jenkins.

Since:
1.GUICE

getExtensionList

public <T> ExtensionList<T> getExtensionList(Class<T> extensionType)
Returns ExtensionList that retains the discovered instances for the given extension type.

Parameters:
extensionType - The base type that represents the extension point. Normally ExtensionPoint subtype but that's not a hard requirement.
Returns:
Can be an empty list but never null.

getExtensionList

public ExtensionList getExtensionList(String extensionType)
                               throws ClassNotFoundException
Used to bind ExtensionLists to URLs.

Throws:
ClassNotFoundException
Since:
1.349

getDescriptorList

public <T extends Describable<T>,D extends Descriptor<T>> DescriptorExtensionList<T,D> getDescriptorList(Class<T> type)
Returns ExtensionList that retains the discovered Descriptor instances for the given kind of Describable.

Returns:
Can be an empty list but never null.

refreshExtensions

public void refreshExtensions()
                       throws ExtensionRefreshException
Refresh ExtensionLists by adding all the newly discovered extensions. Exposed only for PluginManager.dynamicLoad(File).

Throws:
ExtensionRefreshException

getACL

public ACL getACL()
Returns the root ACL.

Specified by:
getACL in interface AccessControlled
Overrides:
getACL in class Node
Returns:
never null.
See Also:
AuthorizationStrategy.getRootACL()

getAuthorizationStrategy

public AuthorizationStrategy getAuthorizationStrategy()
Returns:
never null.

getProjectNamingStrategy

public ProjectNamingStrategy getProjectNamingStrategy()
The strategy used to check the project names.

Returns:
never null

isQuietingDown

@Exported
public boolean isQuietingDown()
Returns true if Hudson is quieting down.

No further jobs will be executed unless it can be finished while other current pending builds are still in progress.


isTerminating

public boolean isTerminating()
Returns true if the container initiated the termination of the web application.


getInitLevel

public InitMilestone getInitLevel()
Gets the initialization milestone that we've already reached.

Returns:
InitMilestone.STARTED even if the initialization hasn't been started, so that this method never returns null.

setNumExecutors

public void setNumExecutors(int n)
                     throws IOException
Throws:
IOException

getItem

public TopLevelItem getItem(String name)
Gets the Item inside this group that has a given name, or null if it does not exist.. Note that the look up is case-insensitive.

Specified by:
getItem in interface ItemGroup<TopLevelItem>

getItem

public Item getItem(String pathName,
                    ItemGroup context)
Gets the item by its path name from the given context

Path Names

If the name starts from '/', like "/foo/bar/zot", then it's interpreted as absolute. Otherwise, the name should be something like "foo/bar" and it's interpreted like relative path name in the file system is, against the given context.

Parameters:
context - null is interpreted as Jenkins. Base 'directory' of the interpretation.
Since:
1.406

getItem

public final Item getItem(String pathName,
                          Item context)

getItem

public final <T extends Item> T getItem(String pathName,
                                        ItemGroup context,
                                        Class<T> type)

getItem

public final <T extends Item> T getItem(String pathName,
                                        Item context,
                                        Class<T> type)

getRootDirFor

public File getRootDirFor(TopLevelItem child)
Description copied from interface: ItemGroup
Assigns the root directory for children.

Specified by:
getRootDirFor in interface ItemGroup<TopLevelItem>

getItemByFullName

@CheckForNull
public <T extends Item> T getItemByFullName(String fullName,
                                                         Class<T> type)
Gets the Item object by its full name. Full names are like path names, where each name of Item is combined by '/'.

Returns:
null if either such Item doesn't exist under the given full name, or it exists but it's no an instance of the given type.

getItemByFullName

@CheckForNull
public Item getItemByFullName(String fullName)

getUser

@CheckForNull
public User getUser(String name)
Gets the user of the given name.

Returns:
the user of the given name, if that person exists or the invoker Node.hasPermission(hudson.security.Permission) on ADMINISTER; else null
See Also:
User.get(String,boolean)

createProject

public TopLevelItem createProject(TopLevelItemDescriptor type,
                                  String name)
                           throws IOException
Throws:
IOException

createProject

public TopLevelItem createProject(TopLevelItemDescriptor type,
                                  String name,
                                  boolean notify)
                           throws IOException
Description copied from interface: ModifiableTopLevelItemGroup
Creates a new job.

Specified by:
createProject in interface ModifiableTopLevelItemGroup
Parameters:
type - Descriptor for job type
name - Name for job
notify - Whether to fire onCreated method for all ItemListeners
Throws:
IOException

putItem

public void putItem(TopLevelItem item)
             throws IOException,
                    InterruptedException
Overwrites the existing item by new one.

This is a short cut for deleting an existing job and adding a new one.

Throws:
IOException
InterruptedException

createProject

public <T extends TopLevelItem> T createProject(Class<T> type,
                                                String name)
                                     throws IOException
Creates a new job.

This version infers the descriptor from the type of the top-level item.

Throws:
IllegalArgumentException - if the project of the given name already exists.
IOException

onRenamed

public void onRenamed(TopLevelItem job,
                      String oldName,
                      String newName)
               throws IOException
Called by Job.renameTo(String) to update relevant data structure. assumed to be synchronized on Hudson by the caller.

Specified by:
onRenamed in interface ItemGroup<TopLevelItem>
Throws:
IOException

onDeleted

public void onDeleted(TopLevelItem item)
               throws IOException
Called in response to AbstractItem.doDoDelete(StaplerRequest, StaplerResponse)

Specified by:
onDeleted in interface ItemGroup<TopLevelItem>
Throws:
IOException

getFingerprintMap

public FingerprintMap getFingerprintMap()

getFingerprint

public Object getFingerprint(String md5sum)
                      throws IOException
Throws:
IOException

_getFingerprint

public Fingerprint _getFingerprint(String md5sum)
                            throws IOException
Gets a Fingerprint object if it exists. Otherwise null.

Throws:
IOException

getNumExecutors

public int getNumExecutors()
Description copied from class: Node
Returns the number of Executors. This may be different from getExecutors().size() because it takes time to adjust the number of executors.

Specified by:
getNumExecutors in class Node

getMode

public Node.Mode getMode()
Description copied from class: Node
Returns Node.Mode.EXCLUSIVE if this node is only available for those jobs that exclusively specifies this node as the assigned node.

Specified by:
getMode in class Node

setMode

public void setMode(Node.Mode m)
             throws IOException
Throws:
IOException

getLabelString

public String getLabelString()
Description copied from class: Node
Returns the manually configured label for a node. The list of assigned and dynamically determined labels is available via Node.getAssignedLabels() and includes all labels that have been manually configured. Mainly for form binding.

Specified by:
getLabelString in class Node

setLabelString

public void setLabelString(String label)
                    throws IOException
Description copied from class: Node
Sets the label string for a node. This value will be returned by Node.getLabelString().

Overrides:
setLabelString in class Node
Parameters:
label - The new label string to use.
Throws:
IOException

getSelfLabel

public LabelAtom getSelfLabel()
Description copied from class: Node
Gets the special label that represents this node itself.

Overrides:
getSelfLabel in class Node

createComputer

public Computer createComputer()
Description copied from class: Node
Creates a new Computer object that acts as the UI peer of this Node. Nobody but updateComputerList() should call this method.

Specified by:
createComputer in class Node

save

public void save()
          throws IOException
Save the settings to a file.

Specified by:
save in interface Saveable
Throws:
IOException - if the persistence failed.

cleanUp

public void cleanUp()
Called to shut down the system.


getDynamic

public Object getDynamic(String token)

doConfigSubmit

public void doConfigSubmit(org.kohsuke.stapler.StaplerRequest req,
                           org.kohsuke.stapler.StaplerResponse rsp)
                    throws IOException,
                           javax.servlet.ServletException,
                           Descriptor.FormException
Accepts submission from the configuration page.

Throws:
IOException
javax.servlet.ServletException
Descriptor.FormException

getCrumbIssuer

public CrumbIssuer getCrumbIssuer()
Gets the CrumbIssuer currently in use.

Returns:
null if none is in use.

setCrumbIssuer

public void setCrumbIssuer(CrumbIssuer issuer)

doTestPost

public void doTestPost(org.kohsuke.stapler.StaplerRequest req,
                       org.kohsuke.stapler.StaplerResponse rsp)
                throws IOException,
                       javax.servlet.ServletException
Throws:
IOException
javax.servlet.ServletException

doConfigExecutorsSubmit

public void doConfigExecutorsSubmit(org.kohsuke.stapler.StaplerRequest req,
                                    org.kohsuke.stapler.StaplerResponse rsp)
                             throws IOException,
                                    javax.servlet.ServletException,
                                    Descriptor.FormException
Accepts submission from the node configuration page.

Throws:
IOException
javax.servlet.ServletException
Descriptor.FormException

doSubmitDescription

public void doSubmitDescription(org.kohsuke.stapler.StaplerRequest req,
                                org.kohsuke.stapler.StaplerResponse rsp)
                         throws IOException,
                                javax.servlet.ServletException
Accepts the new description.

Throws:
IOException
javax.servlet.ServletException

doQuietDown

public org.kohsuke.stapler.HttpRedirect doQuietDown()
                                             throws IOException
Throws:
IOException

doQuietDown

@CLIMethod(name="quiet-down")
public org.kohsuke.stapler.HttpRedirect doQuietDown(@QueryParameter
                                                                  boolean block,
                                                                  @QueryParameter
                                                                  int timeout)
                                             throws InterruptedException,
                                                    IOException
Throws:
InterruptedException
IOException

doCancelQuietDown

@CLIMethod(name="cancel-quiet-down")
public org.kohsuke.stapler.HttpRedirect doCancelQuietDown()

doClassicThreadDump

public void doClassicThreadDump(org.kohsuke.stapler.StaplerResponse rsp)
                         throws IOException,
                                javax.servlet.ServletException
Backward compatibility. Redirect to the thread dump.

Throws:
IOException
javax.servlet.ServletException

getAllThreadDumps

public Map<String,Map<String,String>> getAllThreadDumps()
                                                 throws IOException,
                                                        InterruptedException
Obtains the thread dump of all slaves (including the master.)

Since this is for diagnostics, it has a built-in precautionary measure against hang slaves.

Throws:
IOException
InterruptedException

doCreateItem

public TopLevelItem doCreateItem(org.kohsuke.stapler.StaplerRequest req,
                                 org.kohsuke.stapler.StaplerResponse rsp)
                          throws IOException,
                                 javax.servlet.ServletException
Description copied from interface: ModifiableItemGroup
The request format follows that of &lt;n:form xmlns:n="/lib/form">.

Specified by:
doCreateItem in interface ModifiableItemGroup<TopLevelItem>
Throws:
IOException
javax.servlet.ServletException

createProjectFromXML

public TopLevelItem createProjectFromXML(String name,
                                         InputStream xml)
                                  throws IOException
Description copied from interface: ModifiableTopLevelItemGroup
/** Creates a new job from its configuration XML. The type of the job created will be determined by what's in this XML.

Specified by:
createProjectFromXML in interface ModifiableTopLevelItemGroup
Parameters:
name - Name of the newly created project.
xml - Item configuration as xml
Returns:
Newly created TopLevelItem.
Throws:
IOException
Since:
1.319

copy

public <T extends TopLevelItem> T copy(T src,
                                       String name)
                            throws IOException
Description copied from interface: ModifiableTopLevelItemGroup
Copys a job.

Specified by:
copy in interface ModifiableTopLevelItemGroup
Parameters:
src - A TopLevelItem to be copied.
name - Name of the newly created project.
Returns:
Newly created TopLevelItem.
Throws:
IOException

copy

public <T extends AbstractProject<?,?>> T copy(T src,
                                               String name)
                                    throws IOException
Throws:
IOException

doCreateView

public void doCreateView(org.kohsuke.stapler.StaplerRequest req,
                         org.kohsuke.stapler.StaplerResponse rsp)
                  throws IOException,
                         javax.servlet.ServletException,
                         Descriptor.FormException
Throws:
IOException
javax.servlet.ServletException
Descriptor.FormException

checkGoodName

public static void checkGoodName(String name)
                          throws Failure
Check if the given name is suitable as a name for job, view, etc.

Throws:
Failure - if the given name is not good

doSecured

public void doSecured(org.kohsuke.stapler.StaplerRequest req,
                      org.kohsuke.stapler.StaplerResponse rsp)
               throws IOException,
                      javax.servlet.ServletException
Checks if the user was successfully authenticated.

Throws:
IOException
javax.servlet.ServletException
See Also:
BasicAuthenticationFilter

doLoginEntry

public void doLoginEntry(org.kohsuke.stapler.StaplerRequest req,
                         org.kohsuke.stapler.StaplerResponse rsp)
                  throws IOException
Called once the user logs in. Just forward to the top page.

Throws:
IOException

doLogout

public void doLogout(org.kohsuke.stapler.StaplerRequest req,
                     org.kohsuke.stapler.StaplerResponse rsp)
              throws IOException,
                     javax.servlet.ServletException
Logs out the user.

Throws:
IOException
javax.servlet.ServletException

getJnlpJars

public Slave.JnlpJar getJnlpJars(String fileName)
Serves jar files for JNLP slave agents.


doJnlpJars

public Slave.JnlpJar doJnlpJars(org.kohsuke.stapler.StaplerRequest req)

doReload

@CLIMethod(name="reload-configuration")
public org.kohsuke.stapler.HttpResponse doReload()
                                          throws IOException
Reloads the configuration.

Throws:
IOException

reload

public void reload()
            throws IOException,
                   InterruptedException,
                   org.jvnet.hudson.reactor.ReactorException
Reloads the configuration synchronously.

Throws:
IOException
InterruptedException
org.jvnet.hudson.reactor.ReactorException

doDoFingerprintCheck

public void doDoFingerprintCheck(org.kohsuke.stapler.StaplerRequest req,
                                 org.kohsuke.stapler.StaplerResponse rsp)
                          throws IOException,
                                 javax.servlet.ServletException
Do a finger-print check.

Throws:
IOException
javax.servlet.ServletException

doGc

public void doGc(org.kohsuke.stapler.StaplerResponse rsp)
          throws IOException
For debugging. Expose URL to perform GC.

Throws:
IOException

doException

public void doException()
End point that intentionally throws an exception to test the error behaviour.


doContextMenu

public ModelObjectWithContextMenu.ContextMenu doContextMenu(org.kohsuke.stapler.StaplerRequest request,
                                                            org.kohsuke.stapler.StaplerResponse response)
                                                     throws IOException,
                                                            org.apache.commons.jelly.JellyException
Description copied from interface: ModelObjectWithContextMenu
Generates the context menu. The typical implementation is return new ContextMenu().from(this,request,response);, which implements the default behaviour. See ModelObjectWithContextMenu.ContextMenu.from(ModelObjectWithContextMenu, StaplerRequest, StaplerResponse) for more details of what it does. This should suit most implementations.

Specified by:
doContextMenu in interface ModelObjectWithContextMenu
Throws:
IOException
org.apache.commons.jelly.JellyException

doChildrenContextMenu

public ModelObjectWithContextMenu.ContextMenu doChildrenContextMenu(org.kohsuke.stapler.StaplerRequest request,
                                                                    org.kohsuke.stapler.StaplerResponse response)
                                                             throws Exception
Description copied from interface: ModelObjectWithChildren
Generates the context menu to list up all the children.

Specified by:
doChildrenContextMenu in interface ModelObjectWithChildren
Throws:
Exception

getHeapDump

public RemotingDiagnostics.HeapDump getHeapDump()
                                         throws IOException
Obtains the heap dump.

Throws:
IOException

doSimulateOutOfMemory

public void doSimulateOutOfMemory()
                           throws IOException
Simulates OutOfMemoryError. Useful to make sure OutOfMemoryHeapDump setting.

Throws:
IOException

doCli

public void doCli(org.kohsuke.stapler.StaplerRequest req,
                  org.kohsuke.stapler.StaplerResponse rsp)
           throws IOException,
                  javax.servlet.ServletException,
                  InterruptedException
Handles HTTP requests for duplex channels for CLI.

Throws:
IOException
javax.servlet.ServletException
InterruptedException

doUserContent

public DirectoryBrowserSupport doUserContent()
Binds /userContent/... to $JENKINS_HOME/userContent.


doRestart

@CLIMethod(name="restart")
public void doRestart(org.kohsuke.stapler.StaplerRequest req,
                                    org.kohsuke.stapler.StaplerResponse rsp)
               throws IOException,
                      javax.servlet.ServletException,
                      RestartNotSupportedException
Perform a restart of Hudson, if we can. This first replaces "app" to HudsonIsRestarting

Throws:
IOException
javax.servlet.ServletException
RestartNotSupportedException

doSafeRestart

@CLIMethod(name="safe-restart")
public org.kohsuke.stapler.HttpResponse doSafeRestart(org.kohsuke.stapler.StaplerRequest req)
                                               throws IOException,
                                                      javax.servlet.ServletException,
                                                      RestartNotSupportedException
Queues up a restart of Hudson for when there are no builds running, if we can. This first replaces "app" to HudsonIsRestarting

Throws:
IOException
javax.servlet.ServletException
RestartNotSupportedException
Since:
1.332

restart

public void restart()
             throws RestartNotSupportedException
Performs a restart.

Throws:
RestartNotSupportedException

safeRestart

public void safeRestart()
                 throws RestartNotSupportedException
Queues up a restart to be performed once there are no builds currently running.

Throws:
RestartNotSupportedException
Since:
1.332

doExit

@CLIMethod(name="shutdown")
public void doExit(org.kohsuke.stapler.StaplerRequest req,
                                 org.kohsuke.stapler.StaplerResponse rsp)
            throws IOException
Shutdown the system.

Throws:
IOException
Since:
1.161

doSafeExit

@CLIMethod(name="safe-shutdown")
public org.kohsuke.stapler.HttpResponse doSafeExit(org.kohsuke.stapler.StaplerRequest req)
                                            throws IOException
Shutdown the system safely.

Throws:
IOException
Since:
1.332

getAuthentication

public static org.acegisecurity.Authentication getAuthentication()
Gets the Authentication object that represents the user associated with the current request.


doScript

public void doScript(org.kohsuke.stapler.StaplerRequest req,
                     org.kohsuke.stapler.StaplerResponse rsp)
              throws IOException,
                     javax.servlet.ServletException
For system diagnostics. Run arbitrary Groovy script.

Throws:
IOException
javax.servlet.ServletException

doScriptText

public void doScriptText(org.kohsuke.stapler.StaplerRequest req,
                         org.kohsuke.stapler.StaplerResponse rsp)
                  throws IOException,
                         javax.servlet.ServletException
Run arbitrary Groovy script and return result as plain text.

Throws:
IOException
javax.servlet.ServletException

_doScript

public static void _doScript(org.kohsuke.stapler.StaplerRequest req,
                             org.kohsuke.stapler.StaplerResponse rsp,
                             javax.servlet.RequestDispatcher view,
                             hudson.remoting.VirtualChannel channel,
                             ACL acl)
                      throws IOException,
                             javax.servlet.ServletException
Throws:
IOException
javax.servlet.ServletException
Since:
1.509.1

doEval

public void doEval(org.kohsuke.stapler.StaplerRequest req,
                   org.kohsuke.stapler.StaplerResponse rsp)
            throws IOException,
                   javax.servlet.ServletException
Evaluates the Jelly script submitted by the client. This is useful for system administration as well as unit testing.

Throws:
IOException
javax.servlet.ServletException

doSignup

public void doSignup(org.kohsuke.stapler.StaplerRequest req,
                     org.kohsuke.stapler.StaplerResponse rsp)
              throws IOException,
                     javax.servlet.ServletException
Sign up for the user account.

Throws:
IOException
javax.servlet.ServletException

doIconSize

public void doIconSize(org.kohsuke.stapler.StaplerRequest req,
                       org.kohsuke.stapler.StaplerResponse rsp)
                throws IOException,
                       javax.servlet.ServletException
Changes the icon size by changing the cookie

Throws:
IOException
javax.servlet.ServletException

doFingerprintCleanup

public void doFingerprintCleanup(org.kohsuke.stapler.StaplerResponse rsp)
                          throws IOException
Throws:
IOException

doWorkspaceCleanup

public void doWorkspaceCleanup(org.kohsuke.stapler.StaplerResponse rsp)
                        throws IOException
Throws:
IOException

doDefaultJDKCheck

public FormValidation doDefaultJDKCheck(org.kohsuke.stapler.StaplerRequest request,
                                        @QueryParameter
                                        String value)
If the user chose the default JDK, make sure we got 'java' in PATH.


doCheckJobName

public FormValidation doCheckJobName(@QueryParameter
                                     String value)
Makes sure that the given name is good as a job name.


doCheckViewName

public FormValidation doCheckViewName(@QueryParameter
                                      String value)
Checks if a top-level view with the given name exists and make sure that the name is good as a view name.


doViewExistsCheck

public FormValidation doViewExistsCheck(@QueryParameter
                                        String value)
Deprecated. 1.512

Checks if a top-level view with the given name exists.


doResources

public void doResources(org.kohsuke.stapler.StaplerRequest req,
                        org.kohsuke.stapler.StaplerResponse rsp)
                 throws IOException,
                        javax.servlet.ServletException
Serves static resources placed along with Jelly view files.

This method can serve a lot of files, so care needs to be taken to make this method secure. It's not clear to me what's the best strategy here, though the current implementation is based on file extensions.

Throws:
IOException
javax.servlet.ServletException

doCheckURIEncoding

public FormValidation doCheckURIEncoding(org.kohsuke.stapler.StaplerRequest request)
                                  throws IOException
Checks if container uses UTF-8 to decode URLs. See http://wiki.jenkins-ci.org/display/JENKINS/Tomcat#Tomcat-i18n

Throws:
IOException

isCheckURIEncodingEnabled

public static boolean isCheckURIEncodingEnabled()
Does not check when system default encoding is "ISO-8859-1".


rebuildDependencyGraph

public void rebuildDependencyGraph()
Rebuilds the dependency map.


getDependencyGraph

public DependencyGraph getDependencyGraph()

getManagementLinks

public List<ManagementLink> getManagementLinks()

getMe

public User getMe()
Exposes the current user to /me URL.


getWidgets

public List<Widget> getWidgets()
Gets the Widgets registered on this object.

Plugins who wish to contribute boxes on the side panel can add widgets by getWidgets().add(new MyWidget()) from Plugin.start().


getTarget

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

getUnprotectedRootActions

public Collection<String> getUnprotectedRootActions()
Gets a list of unprotected root actions. These URL prefixes should be exempted from access control checks by container-managed security. Ideally would be synchronized with getTarget().

Returns:
a list of URL names
Since:
1.495

getStaplerFallback

public View getStaplerFallback()
Fallback to the primary view.

Specified by:
getStaplerFallback in interface org.kohsuke.stapler.StaplerFallback

doCheckDisplayName

public FormValidation doCheckDisplayName(@QueryParameter
                                         String displayName,
                                         @QueryParameter
                                         String jobName)
Checks to see if the candidate displayName collides with any existing display names or project names

Parameters:
displayName - The display name to test
jobName - The name of the job the user is configuring
Returns:

lookup

public static <T> T lookup(Class<T> type)
Shortcut for Hudson.getInstance().lookup.get(type)


getVersion

public static hudson.util.VersionNumber getVersion()
Parses VERSION into VersionNumber, or null if it's not parseable as a version number (such as when Hudson is run with "mvn hudson-dev:run")



Copyright © 2004-2013. All Rights Reserved.