hudson.model
Class Hudson

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

public class Hudson
extends Jenkins


Nested Class Summary
static class Hudson.CloudList
          Deprecated. only here for backward comp
static class Hudson.MasterComputer
          Deprecated. only here for backward comp
 
Nested classes/interfaces inherited from class jenkins.model.Jenkins
Jenkins.DescriptorImpl, Jenkins.JenkinsHolder
 
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
 
Fields inherited from class jenkins.model.Jenkins
ADMINISTER, administrativeMonitors, ALLOWED_RESOURCE_EXTENSIONS, ANONYMOUS, AUTOMATIC_SLAVE_LAUNCH, clouds, computers, CONCURRENT_BUILD, FLYWEIGHT_SUPPORT, KILL_AFTER_LOAD, logRecords, lookup, overallLoad, overallNodeProvisioner, PARALLEL_LOAD, PERMISSIONS, pluginManager, proxy, READ, RESOURCE_PATH, root, RUN_SCRIPTS, servletContext, SESSION_HASH, slaves, tcpSlaveAgentListener, unlabeledLoad, unlabeledNodeProvisioner, VERSION, VERSION_HASH, VIEW_RESOURCE_PATH, XSTREAM, XSTREAM2
 
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
Hudson(File root, javax.servlet.ServletContext context)
           
Hudson(File root, javax.servlet.ServletContext context, PluginManager pluginManager)
           
 
Method Summary
static boolean adminCheck()
          Deprecated. since 2007-12-18. Use Node.checkPermission(hudson.security.Permission)
static boolean adminCheck(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Deprecated. since 2007-12-18. Use Node.checkPermission(hudson.security.Permission)
 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 doLogRss(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Deprecated. As on 1.267, moved to "/log/rss..."
 void doQuietDown(org.kohsuke.stapler.StaplerResponse rsp)
          Deprecated. as of 1.317 Use Jenkins.doQuietDown() instead.
 CopyOnWriteList<ComputerListener> getComputerListeners()
          Deprecated. as of 1.286. Use ComputerListener.all().
static Hudson getInstance()
           
 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().
 Slave getSlave(String name)
          Deprecated. Use Jenkins.getNode(String). Since 1.252.
 List<Slave> getSlaves()
          Deprecated. Use Jenkins.getNodes(). Since 1.252.
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 isDarwin()
          Deprecated. Use Platform.isDarwin()
static boolean isWindows()
          Deprecated. Use Functions.isWindows().
 void setSlaves(List<Slave> slaves)
          Deprecated. Use Jenkins.setNodes(List). Since 1.252.
 
Methods inherited from class jenkins.model.Jenkins
_getFingerprint, addNode, addView, canDelete, checkGoodName, cleanUp, copy, copy, createComputer, createLauncher, createPath, createProject, createProject, createProject, createProjectFromXML, deleteView, disableSecurity, doCancelQuietDown, doCheckDisplayName, doCheckJobName, doCheckURIEncoding, doCheckViewName, doClassicThreadDump, doCli, doConfigExecutorsSubmit, doConfigSubmit, doContextMenu, doCreateItem, doCreateView, doDefaultJDKCheck, doDoFingerprintCheck, doEval, doException, doExit, doFingerprintCleanup, doGc, doIconSize, doJnlpJars, doLoginEntry, doLogout, doQuietDown, doQuietDown, doReload, doResources, doRestart, doSafeExit, doSafeRestart, doScript, doScriptText, doSecured, doSignup, doSimulateOutOfMemory, doSubmitDescription, doTestPost, doUserContent, doViewExistsCheck, doWorkspaceCleanup, getACL, getActions, getAdjuncts, getAdministrativeMonitor, getAllItems, getAllItems, getAllThreadDumps, getApi, getAsynchPeople, getAuthentication, getAuthorizationStrategy, getBuildDirFor, getBuilder, getBuildWrapper, getClockDifference, getCloud, getComputer, getComputer, getComputerMap, getComputers, getCrumbIssuer, getDependencyGraph, getDescription, getDescriptor, getDescriptor, getDescriptor, getDescriptorByName, getDescriptorByType, getDescriptorList, getDescriptorOrDie, getDisplayName, getDynamic, getExtensionList, getExtensionList, getFederatedLoginService, getFederatedLoginServices, getFingerprint, getFingerprintMap, getFullDisplayName, getFullName, getGlobalNodeProperties, getHeapDump, getInitLevel, getInjector, getItem, getItem, getItem, getItem, getItem, getItemByFullName, getItemByFullName, getItemGroup, getItemMap, getItems, getItems, getJDK, getJDKs, getJnlpJars, getJobNames, getJobProperty, getLabel, getLabelAtom, getLabelAtoms, getLabels, getLabelString, getLegacyInstanceId, getLifecycle, getLog, getManagementLinks, getMarkupFormatter, getMe, getMode, getMyViewsTabBar, getNode, getNodeDescription, getNodeProperties, getNodes, getNumExecutors, getPeople, getPlugin, getPlugin, getPluginManager, getPlugins, getPrimaryView, getProjectNamingStrategy, getProjects, getPublisher, getQueue, getQuietPeriod, getRawBuildsDir, getRawWorkspaceDir, getRepositoryBrowser, getRetentionStrategy, getRootDir, getRootDirFor, getRootPath, getRootUrl, getRootUrlFromRequest, getScm, getScmCheckoutRetryCount, getSCMListeners, getSearchUrl, getSecretKey, getSecretKeyAsAES128, getSecurity, getSecurityRealm, getSecurityRealms, getSelfLabel, getSlaveAgentPort, getStaplerFallback, getSystemMessage, getTarget, getTcpSlaveAgentListener, getTopLevelItemNames, getTrigger, getUnprotectedRootActions, getUpdateCenter, getUrlChildPrefix, getUser, getVersion, getView, getViewActions, getViews, getViewsTabBar, getWidgets, getWorkspaceFor, hasPeople, isCheckURIEncodingEnabled, isQuietingDown, isRootUrlSecure, isTerminating, isUpgradedFromBefore, isUsageStatisticsCollected, isUseCrumbs, isUseProjectNamingStrategy, isUseSecurity, lookup, makeSearchIndex, onDeleted, onRenamed, onViewRenamed, putItem, rebuildDependencyGraph, refreshExtensions, reload, removeNode, restart, safeRestart, save, setAuthorizationStrategy, setCrumbIssuer, setLabelString, setMarkupFormatter, setMode, setMyViewsTabBar, setNodeName, setNodes, setNoUsageStatistics, setNumExecutors, setPrimaryView, setProjectNamingStrategy, setQuietPeriod, setScmCheckoutRetryCount, setSecurityRealm, setSlaveAgentPort, setSystemMessage, setViewsTabBar, 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
 

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
Throws:
IOException
InterruptedException
org.jvnet.hudson.reactor.ReactorException
Method Detail

getInstance

@CLIResolver
public static Hudson getInstance()

getJobListeners

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

Gets all the installed ItemListeners.


getComputerListeners

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

Gets all the installed ComputerListeners.


getSlave

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

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


getSlaves

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


setSlaves

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

Updates the slave list.

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.


doQuietDown

public void doQuietDown(org.kohsuke.stapler.StaplerResponse rsp)
                 throws IOException,
                        javax.servlet.ServletException
Deprecated. as of 1.317 Use Jenkins.doQuietDown() instead.

Throws:
IOException
javax.servlet.ServletException

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

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


isWindows

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


isDarwin

public static boolean isDarwin()
Deprecated. Use Platform.isDarwin()


adminCheck

public static boolean adminCheck()
                          throws IOException
Deprecated. since 2007-12-18. Use Node.checkPermission(hudson.security.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(hudson.security.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.



Copyright © 2004-2013. All Rights Reserved.