hudson.model
Class Hudson

java.lang.Object
  extended by hudson.model.AbstractModelObject
      extended by hudson.model.Node
          extended by hudson.model.Hudson
All Implemented Interfaces:
ExtensionPoint, Describable<Node>, DescriptorByNameOwner, ItemGroup<TopLevelItem>, ModelObject, PersistenceRoot, Saveable, ViewGroup, SearchableModelObject, SearchItem, AccessControlled, org.kohsuke.stapler.StaplerFallback, org.kohsuke.stapler.StaplerProxy

@ExportedBean
public final class Hudson
extends Node
implements ItemGroup<TopLevelItem>, org.kohsuke.stapler.StaplerProxy, org.kohsuke.stapler.StaplerFallback, ViewGroup, AccessControlled, DescriptorByNameOwner

Root object of the system.

Author:
Kohsuke Kawaguchi, Nikita Levyankov

Nested Class Summary
static class Hudson.CloudList
           
static class Hudson.DescriptorImpl
           
static class Hudson.MasterComputer
           
 
Nested classes/interfaces inherited from class hudson.model.Node
Node.Mode, Node.NodeListener
 
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.springframework.security.Authentication ANONYMOUS
           
static boolean AUTOMATIC_SLAVE_LAUNCH
          Automatically try to launch a slave when Hudson is initialized or a new slave is created.
 Hudson.CloudList clouds
          Active Clouds.
static boolean CONCURRENT_BUILD
          Tentative switch to activate the concurrent build behavior.
static boolean FLYWEIGHT_SUPPORT
          Enabled by default as of 1.337.
static boolean KILL_AFTER_LOAD
           
static boolean LOG_STARTUP_PERFORMANCE
           
static List<LogRecord> logRecords
          Live view of recent LogRecords produced by Hudson.
 Lookup lookup
          Stores various objects scoped to Hudson.
 OverallLoadStatistics overallLoad
          Load statistics of the entire system.
 NodeProvisioner overallNodeProvisioner
          NodeProvisioner that reacts to OverallLoadStatistics.
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.
 javax.servlet.ServletContext servletContext
           
 TcpSlaveAgentListener tcpSlaveAgentListener
           
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.
 
Fields inherited from interface hudson.model.Saveable
NOOP
 
Constructor Summary
Hudson(File root, javax.servlet.ServletContext context)
           
Hudson(File root, javax.servlet.ServletContext context, PluginManager pluginManager)
           
 
Method Summary
 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)
           
static boolean adminCheck()
          Deprecated. since 2007-12-18. Use Node.checkPermission(Permission)
static boolean adminCheck(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Deprecated. since 2007-12-18. Use Node.checkPermission(Permission)
 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)
          Creates a new job.
 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.
 org.kohsuke.stapler.HttpRedirect doCancelQuietDown()
           
 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.
 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 configuration page.
 void doConfigSubmit(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Accepts submission from the configuration page.
 Item doCreateItem(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
           
 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 doExit(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Shutdown the system.
 void doFieldCheck(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Deprecated. as of 1.294 Define your own check method, instead of relying on this generic one.
 FormValidation doFieldCheck(String value, String type, String errorText, String warningText)
          Deprecated. as of 1.324 Either use client-side validation (e.g. class="required number") or define your own check method, instead of relying on this generic one.
 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.
 void doLogRss(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Deprecated. As on 1.267, moved to "/log/rss..."
 org.kohsuke.stapler.HttpRedirect doQuietDown()
           
 org.kohsuke.stapler.HttpRedirect doQuietDown(boolean block, int timeout)
           
 void doQuietDown(org.kohsuke.stapler.StaplerResponse rsp)
          Deprecated. as of 1.317 Use doQuietDown() instead.
 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.
 void doSafeExit(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Shutdown the system safely.
 void doSafeRestart(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          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 Dynamic Language 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)
          Checks if a top-level view with the given name exists.
 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.
<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.
 Api getApi()
           
static org.springframework.security.Authentication getAuthentication()
          Deprecated. As of release 3.0.0, replaced by HudsonSecurityManager.getAuthentication()
 AuthorizationStrategy getAuthorizationStrategy()
           
 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 programmatically.
 Computer getComputer(String name)
           
 CopyOnWriteList<ComputerListener> getComputerListeners()
          Deprecated. as of 1.286. Use ComputerListener.all().
 Computer[] getComputers()
          Gets the read-only list of all Computers.
 CrumbIssuer getCrumbIssuer()
           
 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.
 Iterator<GlobalMessage> getGlobalMessages()
           
 DescribableList<NodeProperty<?>,NodePropertyDescriptor> getGlobalNodeProperties()
           
 RemotingDiagnostics.HeapDump getHeapDump()
          Obtains the heap dump.
 InitMilestone getInitLevel()
          Gets the initialization milestone that we've already reached.
static Hudson getInstance()
           
 TopLevelItem getItem(String name)
          Gets the Item inside this group that has a given name.
 Item getItemByFullName(String fullName)
           
<T extends Item>
T
getItemByFullName(String fullName, Class<T> type)
          Gets the Item object by its full name.
 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 Hudson.
<T> List<T>
getItems(Class<T> type)
          Gets just the immediate children of Hudson 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.
 TopLevelItem getJob(String name)
          Deprecated. Left only for the compatibility of URLs. Should not be invoked for any other purpose.
 TopLevelItem getJobCaseInsensitive(String name)
          Deprecated. Used only for mapping jobs to URL in a case-insensitive fashion.
 CopyOnWriteList<ItemListener> getJobListeners()
          Deprecated. as of 1.286. Use ItemListener.all().
 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.
 Lifecycle getLifecycle()
           
 LogRecorderManager getLog()
          For binding LogRecorderManager to "/log".
 List<ManagementLink> getManagementLinks()
           
 MarkupFormatter getMarkupFormatter()
           
 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.
 String getNodeName()
          Deprecated.  
 DescribableList<NodeProperty<?>,NodePropertyDescriptor> getNodeProperties()
          Gets the NodeProperty instances configured for this Node.
 List<Node> getNodes()
          Returns all Nodes in the system, excluding Hudson 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.
 PluginCenter getPluginCenter()
           
 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.
 List<Project> getProjects()
          Gets the list of all the projects.
 Descriptor<Publisher> getPublisher(String shortClassName)
          Gets the publisher descriptor by name.
 Queue getQueue()
           
 int getQuietPeriod()
          Gets the system default quiet period.
 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 Hudson, such as "http://localhost/hudson/".
 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.
 ScriptSupport getScriptSupport()
           
 String getSearchUrl()
          Returns the URL of this item relative to the parent SearchItem.
 String getSecretKey()
          Returns a secret key that survives across container start/stop.
 SecretKey getSecretKeyAsAES128()
          Gets the secret key as a key for AES-128.
 List<TopLevelItem> getSecuredItems()
           
 SecurityMode getSecurity()
          Returns the constant that captures the three basic security modes in Hudson.
 HudsonSecurityManager getSecurityManager()
           
 SecurityRealm getSecurityRealm()
           
 Descriptor<SecurityRealm> getSecurityRealms(String shortClassName)
          Gets the SecurityRealm descriptors by name.
 LabelAtom getSelfLabel()
          Gets the special label that represents this node itself.
 Slave getSlave(String name)
          Deprecated. Use getNode(String). Since 1.252.
 int getSlaveAgentPort()
           
 List<Slave> getSlaves()
          Deprecated. Use getNodes(). Since 1.252.
 View getStaplerFallback()
          Fallback to the primary view.
 String getSystemMessage()
          Synonym to getNodeDescription().
 Object getTarget()
           
 TcpSlaveAgentListener getTcpSlaveAgentListener()
           
 Collection<String> getTopLevelItemNames()
          Gets the names of all the TopLevelItems.
 TriggerDescriptor getTrigger(String shortClassName)
          Gets the trigger descriptor by name.
 UpdateCenter getUpdateCenter()
           
 String getUrl()
          Deprecated. Why are you calling a method that always returns ""? Perhaps you meant getRootUrl().
 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 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.
 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()
          Does this View has any associated user information recorded?
static boolean isAdmin()
          Deprecated. since 2007-12-18. This method is deprecated when Hudson moved from simple Unix root-like model of "admin gets to do everything, and others don't have any privilege" to more complex ACL and Permission based scheme.

For a quick migration, use Hudson.getInstance().getACL().hasPermission(Hudson.ADMINISTER) To check if the user has the 'administer' role in Hudson.

But ideally, your plugin should first identify a suitable Permission (or create one, if appropriate), then identify a suitable AccessControlled object to check its permission against.

static boolean isAdmin(org.kohsuke.stapler.StaplerRequest req)
          Deprecated. since 2007-12-18. Define a custom Permission and check against ACL. See isAdmin() for more instructions.
static boolean isCheckURIEncodingEnabled()
          Does not check when system default encoding is "ISO-8859-1".
static boolean isDarwin()
           
 boolean isQuietingDown()
          Returns true if Hudson is quieting down.
 boolean isTerminating()
          Returns true if the container initiated the termination of the web application.
 boolean isUpgradedFromBefore(VersionNumber v)
          Returns true if the current running Hudson 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 isUseSecurity()
          A convenience method to check if there's some security restrictions in place.
static boolean isWindows()
          Deprecated. Use Functions.isWindows().
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 reload()
          Reloads the configuration synchronously.
 TopLevelItem reloadProjectFromDisk(File jobDir)
          Reload a project to update its definition.
 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 authorizationStrategy)
           
 void setCrumbIssuer(CrumbIssuer issuer)
           
 void setMarkupFormatter(MarkupFormatter markupFormatter)
           
 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 setSecurityRealm(SecurityRealm securityRealm)
           
 void setSlaves(List<Slave> slaves)
          Deprecated. Use setNodes(List). Since 1.252.
 void setSystemMessage(String message)
          Sets the system message.
 
Methods inherited from class hudson.model.Node
canTake, checkPermission, getAssignedLabels, getChannel, getFileSystemProvisioner, getLabelCloud, getNodePropertyDescriptors, hasPermission, isHoldOffLaunchUntilSave, setOfflineCause, toComputer
 
Methods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, getSearchName
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface hudson.security.AccessControlled
checkPermission, hasPermission
 

Field Detail

lookup

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


root

public final transient File root
Root directory of the system.


clouds

public final Hudson.CloudList clouds
Active Clouds.


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.


overallNodeProvisioner

public final transient NodeProvisioner overallNodeProvisioner
NodeProvisioner that reacts to OverallLoadStatistics.


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.


VERSION

public static String VERSION
Version number of this Hudson.


VERSION_HASH

public static String VERSION_HASH
Hash of VERSION.


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 Hudson 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

LOG_STARTUP_PERFORMANCE

public static boolean LOG_STARTUP_PERFORMANCE

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

public static boolean CONCURRENT_BUILD
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 Hudson 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

ANONYMOUS

public static final org.springframework.security.Authentication ANONYMOUS
Constructor Detail

Hudson

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

Hudson

public Hudson(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 Hudson 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()

getNodeName

@Deprecated
public String getNodeName()
Deprecated. 

If you are calling this on Hudson something is wrong.

Specified by:
getNodeName in class Node
Returns:
"" if this is master

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()

getPluginCenter

public PluginCenter getPluginCenter()

getSecurityManager

public HudsonSecurityManager getSecurityManager()

getUpdateCenter

public UpdateCenter getUpdateCenter()

isUsageStatisticsCollected

public boolean isUsageStatisticsCollected()

setNoUsageStatistics

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

getPeople

public View.People getPeople()

hasPeople

public boolean hasPeople()
Does this View has any associated user information recorded?


getApi

public Api getApi()

getSecretKey

public String getSecretKey()
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()
Gets the secret key as a key for AES-128.

Since:
1.308

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.


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)

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.


getJobListeners

public CopyOnWriteList<ItemListener> getJobListeners()
Deprecated. as of 1.286. Use ItemListener.all().

Gets all the installed ItemListeners.


getSCMListeners

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


getComputerListeners

public CopyOnWriteList<ComputerListener> getComputerListeners()
Deprecated. as of 1.286. Use ComputerListener.all().

Gets all the installed ComputerListeners.


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 hpi 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 to getNodeDescription().


getMarkupFormatter

public MarkupFormatter getMarkupFormatter()

setMarkupFormatter

public void setMarkupFormatter(MarkupFormatter markupFormatter)

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 Hudson.

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

getSecuredItems

@Exported(name="securedJobs")
public List<TopLevelItem> getSecuredItems()

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 Hudson 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.


getProjects

public List<Project> getProjects()
Gets the list of all the projects.

Since Project can only show up under Hudson, no need to search recursively.


getJobNames

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


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

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

getMyViewsTabBar

public MyViewsTabBar getMyViewsTabBar()

getScriptSupport

public ScriptSupport getScriptSupport()

isUpgradedFromBefore

public boolean isUpgradedFromBefore(VersionNumber v)
Returns true if the current running Hudson 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)

getComputer

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


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

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


getLabels

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


getLabelAtoms

public Set<LabelAtom> getLabelAtoms()

getQueue

public Queue getQueue()

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.


getSlave

public Slave getSlave(String name)
Deprecated. Use getNode(String). Since 1.252.

Gets the slave node of the give name, hooked under this Hudson.


getNode

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.


getSlaves

public List<Slave> getSlaves()
Deprecated. Use getNodes(). Since 1.252.


getNodes

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


setSlaves

public void setSlaves(List<Slave> slaves)
               throws IOException
Deprecated. Use setNodes(List). Since 1.252.

Updates the slave list.

Throws:
IOException

addNode

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

Throws:
IOException

removeNode

public void removeNode(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.


getScmCheckoutRetryCount

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


getUrl

public String getUrl()
Deprecated. Why are you calling a method that always returns ""? Perhaps you meant getRootUrl().

Description copied from interface: ItemGroup
Returns the path relative to the context root, like "foo/bar/zot/". Note no leading slash but trailing slash.

Specified by:
getUrl in interface ItemGroup<TopLevelItem>
Specified by:
getUrl in interface ViewGroup

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 Hudson.)

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

makeSearchIndex

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


getPrimaryView

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


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 Hudson, such as "http://localhost/hudson/".

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()

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.

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)
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.

If HUDSON_WORKSPACES_PROPERTY_KEY is set through JNDI or system properties or environment variables. workspaceRoot will be set based on property value.

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

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.


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)

getLifecycle

public Lifecycle getLifecycle()

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.

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.

setAuthorizationStrategy

public void setAuthorizationStrategy(AuthorizationStrategy authorizationStrategy)

isQuietingDown

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

getJob

public TopLevelItem getJob(String name)
Deprecated. Left only for the compatibility of URLs. Should not be invoked for any other purpose.


getJobCaseInsensitive

public TopLevelItem getJobCaseInsensitive(String name)
Deprecated. Used only for mapping jobs to URL in a case-insensitive fashion.


getItem

public TopLevelItem getItem(String name)
Gets the Item inside this group that has a given name.. Note that the look up is case-insensitive.

Specified by:
getItem in interface ItemGroup<TopLevelItem>

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

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

public Item getItemByFullName(String fullName)

getUser

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

Returns:
This method returns a non-null object for any user name, without validation.

createProject

public TopLevelItem createProject(TopLevelItemDescriptor type,
                                  String name)
                           throws IOException
Creates a new job.

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

createProject

public TopLevelItem createProject(TopLevelItemDescriptor type,
                                  String name,
                                  boolean notify)
                           throws IOException
Creates a new job.

Parameters:
type - Descriptor for job type
name - Name for job
notify - Whether to fire onCreated method for all ItemListeners
Throws:
IllegalArgumentException - if a project of the give name already exists.
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

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

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.


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()

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
Accepts submission from the configuration page.

Throws:
IOException
javax.servlet.ServletException

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 void doQuietDown(org.kohsuke.stapler.StaplerResponse rsp)
                 throws IOException,
                        javax.servlet.ServletException
Deprecated. as of 1.317 Use doQuietDown() instead.

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

doCreateItem

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

createProjectFromXML

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

Throws:
IOException
Since:
1.319

reloadProjectFromDisk

public TopLevelItem reloadProjectFromDisk(File jobDir)
                                   throws IOException
Reload a project to update its definition.

Throws:
IOException
Since:
2.x.x

copy

public <T extends TopLevelItem> T copy(T src,
                                       String name)
                            throws IOException
Copys a job.

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:
ParseException - if the given name is not good
Failure

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)

doLogRss

public void doLogRss(org.kohsuke.stapler.StaplerRequest req,
                     org.kohsuke.stapler.StaplerResponse rsp)
              throws IOException,
                     javax.servlet.ServletException
Deprecated. As on 1.267, moved to "/log/rss..."

RSS feed for log entries.

Throws:
IOException
javax.servlet.ServletException

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

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 $HUDSON_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 void doSafeRestart(org.kohsuke.stapler.StaplerRequest req,
                                        org.kohsuke.stapler.StaplerResponse rsp)
                   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

public void doExit(org.kohsuke.stapler.StaplerRequest req,
                   org.kohsuke.stapler.StaplerResponse rsp)
            throws IOException
Shutdown the system.

Throws:
IOException
Since:
1.161

doSafeExit

public void doSafeExit(org.kohsuke.stapler.StaplerRequest req,
                       org.kohsuke.stapler.StaplerResponse rsp)
                throws IOException
Shutdown the system safely.

Throws:
IOException
Since:
1.332

getAuthentication

@Deprecated
public static org.springframework.security.Authentication getAuthentication()
Deprecated. As of release 3.0.0, replaced by HudsonSecurityManager.getAuthentication()


doScript

public void doScript(org.kohsuke.stapler.StaplerRequest req,
                     org.kohsuke.stapler.StaplerResponse rsp)
              throws IOException,
                     javax.servlet.ServletException
For system diagnostics. Run arbitrary Dynamic Language 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 Dynamic Language script and return result as plain text.

Throws:
IOException
javax.servlet.ServletException

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.


doViewExistsCheck

public FormValidation doViewExistsCheck(@QueryParameter
                                        String value)
Checks if a top-level view with the given name exists.


doFieldCheck

public void doFieldCheck(org.kohsuke.stapler.StaplerRequest req,
                         org.kohsuke.stapler.StaplerResponse rsp)
                  throws IOException,
                         javax.servlet.ServletException
Deprecated. as of 1.294 Define your own check method, instead of relying on this generic one.

Throws:
IOException
javax.servlet.ServletException

doFieldCheck

public FormValidation doFieldCheck(@QueryParameter(fixEmpty=true)
                                   String value,
                                   @QueryParameter(fixEmpty=true)
                                   String type,
                                   @QueryParameter(fixEmpty=true)
                                   String errorText,
                                   @QueryParameter(fixEmpty=true)
                                   String warningText)
Deprecated. as of 1.324 Either use client-side validation (e.g. class="required number") or define your own check method, instead of relying on this generic one.

Checks if the value for a field is set; if not an error or warning text is displayed. If the parameter "value" is not set then the parameter "errorText" is displayed as an error text. If the parameter "errorText" is not set, then the parameter "warningText" is displayed as a warning text.

If the text is set and the parameter "type" is set, it will validate that the value is of the correct type. Supported types are "number, "number-positive" and "number-negative".


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.hudson-ci.org/display/HUDSON/Tomcat#Tomcat-i18n

Throws:
IOException

isCheckURIEncodingEnabled

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


isWindows

public static boolean isWindows()
Deprecated. Use Functions.isWindows().


isDarwin

public static boolean isDarwin()

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

getGlobalMessages

public Iterator<GlobalMessage> getGlobalMessages()
Since:
2.1.0

getStaplerFallback

public View getStaplerFallback()
Fallback to the primary view.

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

lookup

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


adminCheck

public static boolean adminCheck()
                          throws IOException
Deprecated. since 2007-12-18. Use Node.checkPermission(Permission)

Throws:
IOException

adminCheck

public static boolean adminCheck(org.kohsuke.stapler.StaplerRequest req,
                                 org.kohsuke.stapler.StaplerResponse rsp)
                          throws IOException
Deprecated. since 2007-12-18. Use Node.checkPermission(Permission)

Throws:
IOException

isAdmin

public static boolean isAdmin()
Deprecated. since 2007-12-18. This method is deprecated when Hudson moved from simple Unix root-like model of "admin gets to do everything, and others don't have any privilege" to more complex ACL and Permission based scheme.

For a quick migration, use Hudson.getInstance().getACL().hasPermission(Hudson.ADMINISTER) To check if the user has the 'administer' role in Hudson.

But ideally, your plugin should first identify a suitable Permission (or create one, if appropriate), then identify a suitable AccessControlled object to check its permission against.

Checks if the current user (for which we are processing the current request) has the admin access.


isAdmin

public static boolean isAdmin(org.kohsuke.stapler.StaplerRequest req)
Deprecated. since 2007-12-18. Define a custom Permission and check against ACL. See isAdmin() for more instructions.


getVersion

public static 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 Hudson. All Rights Reserved.