hudson.model
Class AbstractProject<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>

java.lang.Object
  extended by hudson.model.AbstractModelObject
      extended by hudson.model.Actionable
          extended by hudson.model.AbstractItem
              extended by hudson.model.Job<P,R>
                  extended by hudson.model.AbstractProject<P,R>
All Implemented Interfaces:
ExtensionPoint, BuildableItem, DescriptorByNameOwner, Item, ModelObject, PersistenceRoot, SubTask, Queue.Task, ResourceActivity, Saveable, SearchableModelObject, SearchItem, AccessControlled, IAbstractProject, ICascadingJob, IJob, org.kohsuke.stapler.HttpDeletable, org.kohsuke.stapler.StaplerOverridable
Direct Known Subclasses:
BaseBuildableProject

public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
extends Job<P,R>
implements BuildableItem, IAbstractProject

Base implementation of Jobs that build software. For now this is primarily the common part of Project and MavenModule.

Author:
Kohsuke Kawaguchi
See Also:
AbstractBuild

Nested Class Summary
static class AbstractProject.AbstractProjectDescriptor
          AbstractProject subtypes should implement this base class as a descriptor.
static class AbstractProject.BecauseOfBuildInProgress
          Blocked because the previous build is already in progress.
static class AbstractProject.BecauseOfDownstreamBuildInProgress
          Because the downstream build is in progress, and we are configured to wait for that.
static class AbstractProject.BecauseOfUpstreamBuildInProgress
          Because the upstream build is in progress, and we are configured to wait for that.
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Field Summary
static Permission ABORT
          Permission to abort a build.
static String AFFINITY_CHO0SER_KEY
           
static String APPOINTED_NODE_PROPERTY_NAME
           
static String ASSIGNED_LABEL_KEY
           
static String BASIC_KEY
           
static String BLOCK_BUILD_WHEN_DOWNSTREAM_BUILDING_PROPERTY_NAME
           
static String BLOCK_BUILD_WHEN_UPSTREAM_BUILDING_PROPERTY_NAME
           
static String BUILD_TRIGGER_PROPERTY_NAME
           
static String CLEAN_WORKSPACE_REQUIRED_PROPERTY_NAME
           
static String CONCURRENT_BUILD_PROPERTY_NAME
           
static String CUSTOM_WORKSPACE_PROPERTY_NAME
           
static String HAS_QUIET_PERIOD_PROPERTY_NAME
           
static String HAS_SCM_CHECKOUT_RETRY_COUNT_PROPERTY_NAME
           
static String JDK_PROPERTY_NAME
           
static String QUIET_PERIOD_PROPERTY_NAME
           
static String SCM_CHECKOUT_RETRY_COUNT_PROPERTY_NAME
           
static String SCM_PROPERTY_NAME
           
static String SLAVE_KEY
           
 
Fields inherited from class hudson.model.Job
LOG_ROTATOR_PROPERTY_NAME, PARAMETERS_DEFINITION_JOB_PROPERTY_PROPERTY_NAME, PROPERTY_NAME_SEPARATOR
 
Fields inherited from interface hudson.model.Item
BUILD, CONFIGURE, CREATE, DELETE, EXTENDED_READ, PERMISSIONS, READ, WIPEOUT, WORKSPACE
 
Fields inherited from interface hudson.model.Saveable
NOOP
 
Method Summary
 SortedMap<Integer,? extends R> _getRuns()
          Gets all the runs.
 void addProperty(JobProperty<? super P> jobProp)
          Adds JobProperty.
 void addTrigger(Trigger<?> trigger)
          Adds a new Trigger to this Project if not active yet.
 boolean blockBuildWhenDownstreamBuilding()
          Indicates whether build should be blocked while downstream project is building.
 boolean blockBuildWhenUpstreamBuilding()
          Indicates whether build should be blocked while upstream project is building.
 void checkAbortPermission()
          Checks the permission to see if the current user can abort this executable.
 boolean checkout(AbstractBuild build, Launcher launcher, BuildListener listener, File changelogFile)
           
 boolean cleanWorkspace()
          Cleans project workspace.
 R createExecutable()
          Creates Queue.Executable, which performs the actual execution of the task.
 void disable()
           
 void doBuild(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Schedules a new build command.
 void doBuildWithParameters(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Supports build trigger with parameters via an HTTP GET or POST.
 void doCancelQueue(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Cancels a scheduled build.
 FormValidation doCheckRetryCount(String value)
          Validates the retry count Regex
 void doConfigSubmit(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Accepts submission from the configuration page.
 org.kohsuke.stapler.HttpResponse doDisable()
           
 org.kohsuke.stapler.HttpResponse doDoWipeOutWorkspace()
          Wipes out the workspace.
 org.kohsuke.stapler.HttpResponse doEnable()
           
 void doPolling(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Schedules a new SCM polling command.
 void doRssChangelog(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          RSS feed for changes in this project.
 DirectoryBrowserSupport doWs(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Serves the workspace files.
 void enable()
           
static AbstractProject findNearest(String name)
          Finds a AbstractProject that has the name closest to the given name.
 List<Action> getActions()
          Gets actions contributed to this build.
 AppointedNode getAppointedNode()
          Returns AppointedNode.
 Label getAssignedLabel()
          If this project is configured to be always built on this node, return that Node.
 String getAssignedLabelString()
          Gets the textual representation of the assigned label as it was entered by the user.
 BuildAuthorizationToken getAuthToken()
           
 List<AbstractProject> getBuildTriggerUpstreamProjects()
          Returns only those upstream projects that defines BuildTrigger to this project.
 CauseOfBlockage getCauseOfBlockage()
          If the execution of this task should be blocked for temporary reasons, this method returns a non-null object explaining why.
 int getDelay(org.kohsuke.stapler.StaplerRequest req)
          Computes the delay by taking the default value and the override in the request parameter into the account.
 List<AbstractProject> getDownstreamProjects()
          Gets the other AbstractProjects that should be built when a build of this project is completed.
 boolean getHasCustomQuietPeriod()
          Deprecated. as of 2.1.2 This method was used only on UI side. No longer required.
 BallColor getIconColor()
          Used as the color of the status ball for the project.
 JDK getJDK()
           
 String getJDKName()
           
 Node getLastBuiltOn()
          Gets the Node where this project was last built on.
 FilePath getModuleRoot()
          Deprecated. as of 1.319 See getWorkspace() for a migration strategy.
 FilePath[] getModuleRoots()
          Deprecated. as of 1.319 See getWorkspace() for a migration strategy.
 Queue.Task getOwnerTask()
          Gets the Queue.Task that this subtask belongs to.
 List<ProminentProjectAction> getProminentActions()
           
 String getPronoun()
          Get the term used in the UI to represent this kind of AbstractProject.
abstract  DescribableList<Publisher,Descriptor<Publisher>> getPublishersList()
          Returns the live list of all Publishers configured for this project.
 Queue.Item getQueueItem()
          
 int getQuietPeriod()
          Returns project quiet period.
 SortedMap<Integer,Fingerprint.RangeSet> getRelationship(AbstractProject that)
          Gets the dependency relationship map between this project (as the source) and that project (as the sink.)
 ResourceList getResourceList()
          List of necessary resources to perform the build of this project.
 AbstractProject getRootProject()
          Returns the root project value.
 Object getSameNodeConstraint()
          If a subset of SubTasks of a Queue.Task needs to be collocated with other SubTasks, those SubTasks should return the equal object here.
 SCM getScm()
          Returns configured SCM for project,
 int getScmCheckoutRetryCount()
          Returns scm checkout retry count.
 R getSomeBuildWithWorkspace()
          Gets some build that has a live workspace.
 FilePath getSomeWorkspace()
          Gets a workspace for some build of this project.
 List<SubTask> getSubTasks()
          Obtains the SubTasks that constitute this task.
 Set<AbstractProject> getTransitiveDownstreamProjects()
          Gets all the downstream projects including transitive downstream projects.
 Set<AbstractProject> getTransitiveUpstreamProjects()
          Gets all the upstream projects including transitive upstream projects.
<T extends Trigger>
T
getTrigger(Class<T> clazz)
          Gets the specific trigger, or null if the propert is not configured for this job.
 DescribableList<Trigger<?>,TriggerDescriptor> getTriggerDescribableList()
           
 Map<TriggerDescriptor,Trigger> getTriggers()
          Returns map of triggers.
 List<Trigger<?>> getTriggersList()
           
 List<AbstractProject> getUpstreamProjects()
           
 String getWhyBlocked()
           
 FilePath getWorkspace()
          Deprecated. as of 1.319 To support concurrent builds of the same project, this method is moved to AbstractBuild. For backward compatibility, this method returns the right AbstractBuild.getWorkspace() if called from Executor, and otherwise the workspace of the last build.

If you are calling this method during a build from an executor, switch it to AbstractBuild.getWorkspace(). If you are calling this method to serve a file from the workspace, doing a form validation, etc., then use getSomeWorkspace()

 Resource getWorkspaceResource()
          Deprecated. as of 1.319 Projects no longer have a fixed workspace, ands builds will find an available workspace via WorkspaceList for each build (furthermore, that happens after a build is started.) So a Resource representation for a workspace at the project level no longer makes sense.

If you need to lock a workspace while you do some computation, see the source code of pollSCMChanges(TaskListener) for how to obtain a lock of a workspace through WorkspaceList.

 boolean hasAbortPermission()
          Works just like Queue.Task.checkAbortPermission() except it indicates the status by a return value, instead of exception.
 boolean hasCustomScmCheckoutRetryCount()
          Deprecated. as of 2.1.2
 boolean hasParticipant(User user)
          Returns true if this user has made a commit to this project.
 boolean isAdvancedAffinityChooser()
          Gets whether this project is using the advanced affinity chooser UI.
 boolean isBuildable()
          Returns true if we should display "build now" icon
 boolean isBuildBlocked()
          Returns true if the execution should be blocked for temporary reasons.
 boolean isCleanWorkspaceRequired()
          Checks whether workspace should be cleaned before build
 boolean isConcurrentBuild()
          Does this project perform concurrent builds?
 boolean isConfigurable()
          Used in sidepanel.jelly to decide whether to display the config/delete/build links.
 boolean isDisabled()
           
abstract  boolean isFingerprintConfigured()
          True if the builds of this project produces Fingerprint records.
 boolean isInQueue()
          Returns true if the build is in the queue.
 boolean isParameterized()
           
 void makeDisabled(boolean b)
          Marks the build as disabled.
 void onCreatedFromScratch()
          When an item is created from scratch (instead of copied), this method will be invoked.
 void onLoad(ItemGroup<? extends Item> parent, String name)
          Called right after when a Item is loaded from disk.
 PollingResult poll(TaskListener listener)
          Checks if there's any update in SCM, and returns true if any is found.
 boolean pollSCMChanges(TaskListener listener)
          Deprecated. as of 1.346 Use poll(TaskListener) instead.
 void removeRun(R run)
          Called from Run to remove it from this job.
 void removeTrigger(TriggerDescriptor trigger)
          Removes Trigger frin this Project by TriggerDescriptor.
static AbstractProject resolveForCLI(String name)
          Used for CLI binding.
 boolean scheduleBuild()
          Deprecated. Use scheduleBuild(Cause). Since 1.283
 boolean scheduleBuild(Cause c)
          Schedules a build of this project.
 boolean scheduleBuild(int quietPeriod)
          Deprecated. Use scheduleBuild(int, Cause). Since 1.283
 boolean scheduleBuild(int quietPeriod, Cause c)
           
 boolean scheduleBuild(int quietPeriod, Cause c, Action... actions)
          Schedules a build.
 Future<R> scheduleBuild2(int quietPeriod)
          Schedules a build, and returns a Future object to wait for the completion of the build.
 Future<R> scheduleBuild2(int quietPeriod, Cause c)
          Schedules a build of this project, and returns a Future object to wait for the completion of the build.
 Future<R> scheduleBuild2(int quietPeriod, Cause c, Action... actions)
          Schedules a build of this project, and returns a Future object to wait for the completion of the build.
 Future<R> scheduleBuild2(int quietPeriod, Cause c, Collection<? extends Action> actions)
          Schedules a build of this project, and returns a Future object to wait for the completion of the build.
 boolean schedulePolling()
          Schedules a polling of this project.
 void setAdvancedAffinityChooser(boolean b)
          Sets whether this project is using the advanced affinity chooser UI.
 void setAppointedNode(AppointedNode appointedNode)
          Sets AppointedNode.
 void setAssignedLabel(Label label)
          Sets the assigned label.
 void setAssignedNode(Node node)
          Assigns this job to the given node.
 void setBlockBuildWhenDownstreamBuilding(boolean b)
          Sets blockBuildWhenDownstreamBuilding flag.
 void setBlockBuildWhenUpstreamBuilding(boolean b)
          Sets blockBuildWhenUpstreamBuilding flag.
 void setCleanWorkspaceRequired(boolean cleanWorkspaceRequired)
          Sets cleanWorkspaceRequired flag.
 void setConcurrentBuild(boolean b)
           
 void setJDK(JDK jdk)
          Overwrites the JDK setting.
 void setJDK(String jdk)
          Overwrites the JDK setting.
 void setQuietPeriod(Integer seconds)
          Sets the custom quiet period of this project, or revert to the global default if null is given.
 void setScm(SCM scm)
          Sets scm value.
 void setScmCheckoutRetryCount(Integer retryCount)
           
 void setTriggers(List<Trigger<?>> triggerList)
          Sets list of triggers.
 
Methods inherited from class hudson.model.Job
addCascadingChild, assignBuildNumber, doBuildStatus, doDescription, doDoRename, doModifyCascadingProperty, doResetProjectProperty, doRssAll, doRssFailed, doUpdateCascadingProject, getACL, getAllJobs, getAllProperties, getBuild, getBuildByNumber, getBuildForCLI, getBuildHealth, getBuildHealthReports, getBuilds, getBuilds, getBuildsAsMap, getBuildsByTimestamp, getBuildStatusUrl, getBuildTimeGraph, getCascadingChildrenNames, getCascadingProject, getCascadingProjectName, getCreatedBy, getCreationTime, getDynamic, getEstimatedDuration, getFirstBuild, getLastBuild, getLastBuildsOverThreshold, getLastCompletedBuild, getLastFailedBuild, getLastStableBuild, getLastSuccessfulBuild, getLastUnstableBuild, getLastUnsuccessfulBuild, getLogRotator, getNearestBuild, getNearestOldBuild, getNextBuildNumber, getOverrides, getPermalinks, getProjectProperties, getProperties, getProperty, getProperty, getProperty, getTimeline, getWidgets, hasCascadingChild, hasCascadingProject, initProjectProperties, isBuilding, isKeepDependencies, isNameEditable, logRotate, onCopiedFrom, putProjectProperty, removeCascadingChild, removeProjectProperty, removeProperty, removeProperty, renameCascadingChildName, renameCascadingProjectNameTo, renameTo, save, setAllowSave, setCascadingProjectName, setLogRotator, supportsLogRotator, updateNextBuildNumber
 
Methods inherited from class hudson.model.AbstractItem
checkPermission, delete, delete, doConfigDotXml, doDoDelete, doSubmitDescription, getAbsoluteUrl, getApi, getConfigFile, getDescription, getDescriptorByName, getDisplayName, getFullDisplayName, getFullName, getName, getParent, getRootDir, getSearchUrl, getShortUrl, getUrl, hasPermission, setDescription, toString
 
Methods inherited from class hudson.model.Actionable
addAction, getAction, getAction, getActions
 
Methods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, getSearchName
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface hudson.model.Queue.Task
getFullDisplayName, getName, getUrl
 
Methods inherited from interface hudson.model.queue.SubTask
getEstimatedDuration
 
Methods inherited from interface hudson.model.ResourceActivity
getDisplayName
 
Methods inherited from interface org.eclipse.hudson.api.model.IJob
assignBuildNumber, getAllProperties, getBuildByNumber, getBuildHealth, getBuildHealthReports, getBuilds, getBuilds, getBuildsAsMap, getBuildStatusUrl, getBuildTimeGraph, getCreatedBy, getCreationTime, getFirstBuild, getLastBuild, getLastBuildsOverThreshold, getLastCompletedBuild, getLastFailedBuild, getLastStableBuild, getLastSuccessfulBuild, getLastUnstableBuild, getLastUnsuccessfulBuild, getLogRotator, getNearestBuild, getNearestOldBuild, getNextBuildNumber, getPermalinks, getProperties, getTimeline, getWidgets, isBuilding, isKeepDependencies, isNameEditable, logRotate, setLogRotator, supportsLogRotator, updateNextBuildNumber
 
Methods inherited from interface hudson.model.Item
delete, getAbsoluteUrl, getAllJobs, getDisplayName, getFullDisplayName, getFullName, getName, getParent, getShortUrl, getUrl, onCopiedFrom, save
 
Methods inherited from interface hudson.model.PersistenceRoot
getRootDir
 
Methods inherited from interface hudson.search.SearchableModelObject
getSearch
 
Methods inherited from interface hudson.search.SearchItem
getSearchIndex, getSearchName, getSearchUrl
 
Methods inherited from interface hudson.security.AccessControlled
checkPermission, getACL, hasPermission
 

Field Detail

CONCURRENT_BUILD_PROPERTY_NAME

public static final String CONCURRENT_BUILD_PROPERTY_NAME
See Also:
Constant Field Values

CLEAN_WORKSPACE_REQUIRED_PROPERTY_NAME

public static final String CLEAN_WORKSPACE_REQUIRED_PROPERTY_NAME
See Also:
Constant Field Values

BLOCK_BUILD_WHEN_DOWNSTREAM_BUILDING_PROPERTY_NAME

public static final String BLOCK_BUILD_WHEN_DOWNSTREAM_BUILDING_PROPERTY_NAME
See Also:
Constant Field Values

BLOCK_BUILD_WHEN_UPSTREAM_BUILDING_PROPERTY_NAME

public static final String BLOCK_BUILD_WHEN_UPSTREAM_BUILDING_PROPERTY_NAME
See Also:
Constant Field Values

QUIET_PERIOD_PROPERTY_NAME

public static final String QUIET_PERIOD_PROPERTY_NAME
See Also:
Constant Field Values

SCM_CHECKOUT_RETRY_COUNT_PROPERTY_NAME

public static final String SCM_CHECKOUT_RETRY_COUNT_PROPERTY_NAME
See Also:
Constant Field Values

CUSTOM_WORKSPACE_PROPERTY_NAME

public static final String CUSTOM_WORKSPACE_PROPERTY_NAME
See Also:
Constant Field Values

JDK_PROPERTY_NAME

public static final String JDK_PROPERTY_NAME
See Also:
Constant Field Values

SCM_PROPERTY_NAME

public static final String SCM_PROPERTY_NAME
See Also:
Constant Field Values

HAS_QUIET_PERIOD_PROPERTY_NAME

public static final String HAS_QUIET_PERIOD_PROPERTY_NAME
See Also:
Constant Field Values

HAS_SCM_CHECKOUT_RETRY_COUNT_PROPERTY_NAME

public static final String HAS_SCM_CHECKOUT_RETRY_COUNT_PROPERTY_NAME
See Also:
Constant Field Values

BUILD_TRIGGER_PROPERTY_NAME

public static final String BUILD_TRIGGER_PROPERTY_NAME
See Also:
Constant Field Values

APPOINTED_NODE_PROPERTY_NAME

public static final String APPOINTED_NODE_PROPERTY_NAME
See Also:
Constant Field Values

BASIC_KEY

public static final String BASIC_KEY
See Also:
Constant Field Values

AFFINITY_CHO0SER_KEY

public static final String AFFINITY_CHO0SER_KEY
See Also:
Constant Field Values

SLAVE_KEY

public static final String SLAVE_KEY
See Also:
Constant Field Values

ASSIGNED_LABEL_KEY

public static final String ASSIGNED_LABEL_KEY
See Also:
Constant Field Values

ABORT

public static final Permission ABORT
Permission to abort a build. For now, let's make it the same as Item.BUILD

Method Detail

onCreatedFromScratch

public void onCreatedFromScratch()
Description copied from interface: Item
When an item is created from scratch (instead of copied), this method will be invoked. Used as the post-construction initialization.

Specified by:
onCreatedFromScratch in interface Item
Overrides:
onCreatedFromScratch in class AbstractItem

onLoad

public void onLoad(ItemGroup<? extends Item> parent,
                   String name)
            throws IOException
Description copied from class: AbstractItem
Called right after when a Item is loaded from disk. This is an opporunity to do a post load processing.

Specified by:
onLoad in interface Item
Overrides:
onLoad in class Job<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
name - Name of the directory (not a path --- just the name portion) from which the configuration was loaded. This usually becomes the name of this item.
Throws:
IOException

isConcurrentBuild

@Exported
public boolean isConcurrentBuild()
Does this project perform concurrent builds?

Specified by:
isConcurrentBuild in interface Queue.Task
Since:
1.319

setConcurrentBuild

public void setConcurrentBuild(boolean b)
                        throws IOException
Throws:
IOException

isCleanWorkspaceRequired

public boolean isCleanWorkspaceRequired()
Description copied from interface: IAbstractProject
Checks whether workspace should be cleaned before build

Specified by:
isCleanWorkspaceRequired in interface IAbstractProject
Returns:
boolean value

setCleanWorkspaceRequired

public void setCleanWorkspaceRequired(boolean cleanWorkspaceRequired)
Description copied from interface: IAbstractProject
Sets cleanWorkspaceRequired flag.

Specified by:
setCleanWorkspaceRequired in interface IAbstractProject
Parameters:
cleanWorkspaceRequired - true - to always clean workspace.

getAssignedLabel

public Label getAssignedLabel()
If this project is configured to be always built on this node, return that Node. Otherwise null.

Specified by:
getAssignedLabel in interface SubTask
Specified by:
getAssignedLabel in interface IAbstractProject
Returns:
Label instance.

getAssignedLabelString

public String getAssignedLabelString()
Gets the textual representation of the assigned label as it was entered by the user.

Specified by:
getAssignedLabelString in interface IAbstractProject
Returns:
string

setAssignedLabel

public void setAssignedLabel(Label label)
                      throws IOException
Sets the assigned label.

Specified by:
setAssignedLabel in interface IAbstractProject
Parameters:
label - node label.
Throws:
IOException - exception.

setAssignedNode

public void setAssignedNode(Node node)
                     throws IOException
Assigns this job to the given node. A convenience method over setAssignedLabel(Label).

Specified by:
setAssignedNode in interface IAbstractProject
Parameters:
node - node.
Throws:
IOException - exception

isAdvancedAffinityChooser

public boolean isAdvancedAffinityChooser()
Gets whether this project is using the advanced affinity chooser UI.

Specified by:
isAdvancedAffinityChooser in interface IAbstractProject
Returns:
true - advanced chooser, false - simple textfield.

setAdvancedAffinityChooser

public void setAdvancedAffinityChooser(boolean b)
                                throws IOException
Sets whether this project is using the advanced affinity chooser UI.

Specified by:
setAdvancedAffinityChooser in interface IAbstractProject
Parameters:
b - true - advanced chooser, false - otherwise
Throws:
IOException - exception.

setAppointedNode

public void setAppointedNode(AppointedNode appointedNode)
Sets AppointedNode.

Specified by:
setAppointedNode in interface IAbstractProject
Parameters:
appointedNode - AppointedNode.

getAppointedNode

public AppointedNode getAppointedNode()
Returns AppointedNode. Returned value is not null.

Specified by:
getAppointedNode in interface IAbstractProject
Returns:
appointedNode AppointedNode.

getPronoun

public String getPronoun()
Get the term used in the UI to represent this kind of AbstractProject. Must start with a capital letter.

Overrides:
getPronoun in class Job<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>

getRootProject

public AbstractProject getRootProject()
Returns the root project value.

Specified by:
getRootProject in interface IAbstractProject
Returns:
the root project value.

getWorkspace

public final FilePath getWorkspace()
Deprecated. as of 1.319 To support concurrent builds of the same project, this method is moved to AbstractBuild. For backward compatibility, this method returns the right AbstractBuild.getWorkspace() if called from Executor, and otherwise the workspace of the last build.

If you are calling this method during a build from an executor, switch it to AbstractBuild.getWorkspace(). If you are calling this method to serve a file from the workspace, doing a form validation, etc., then use getSomeWorkspace()

Gets the directory where the module is checked out.

Returns:
null if the workspace is on a slave that's not connected.

getSomeWorkspace

public final FilePath getSomeWorkspace()
Gets a workspace for some build of this project.

This is useful for obtaining a workspace for the purpose of form field validation, where exactly which build the workspace belonged is less important. The implementation makes a cursory effort to find some workspace.

Specified by:
getSomeWorkspace in interface IAbstractProject
Returns:
null if there's no available workspace.
Since:
1.319

getSomeBuildWithWorkspace

public final R getSomeBuildWithWorkspace()
Gets some build that has a live workspace.

Specified by:
getSomeBuildWithWorkspace in interface IAbstractProject
Returns:
null if no such build exists.

getModuleRoot

public FilePath getModuleRoot()
Deprecated. as of 1.319 See getWorkspace() for a migration strategy.

Returns the root directory of the checked-out module.

This is usually where pom.xml, build.xml and so on exists.


getModuleRoots

public FilePath[] getModuleRoots()
Deprecated. as of 1.319 See getWorkspace() for a migration strategy.

Returns the root directories of all checked-out modules.

Some SCMs support checking out multiple modules into the same workspace. In these cases, the returned array will have a length greater than one.

Returns:
The roots of all modules checked out from the SCM.

getQuietPeriod

public int getQuietPeriod()
Description copied from interface: IAbstractProject
Returns project quiet period.

Specified by:
getQuietPeriod in interface IAbstractProject
Returns:
int value.

setQuietPeriod

public void setQuietPeriod(Integer seconds)
                    throws IOException
Sets the custom quiet period of this project, or revert to the global default if null is given.

Specified by:
setQuietPeriod in interface IAbstractProject
Parameters:
seconds - quiet period
Throws:
IOException - if any.

getScmCheckoutRetryCount

public int getScmCheckoutRetryCount()
Description copied from interface: IAbstractProject
Returns scm checkout retry count.

Specified by:
getScmCheckoutRetryCount in interface IAbstractProject
Returns:
int value.

setScmCheckoutRetryCount

public void setScmCheckoutRetryCount(Integer retryCount)

getHasCustomQuietPeriod

public boolean getHasCustomQuietPeriod()
Deprecated. as of 2.1.2 This method was used only on UI side. No longer required.

Returns:
true if quiet period was configured.

hasCustomScmCheckoutRetryCount

public boolean hasCustomScmCheckoutRetryCount()
Deprecated. as of 2.1.2

Checks whether scmRetryCount is configured

Returns:
true if yes, false - otherwise.

isBuildable

public boolean isBuildable()
Description copied from class: Job
Returns true if we should display "build now" icon

Specified by:
isBuildable in interface IJob
Specified by:
isBuildable in class Job<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
Returns:
true if we should display "build now" icon

isConfigurable

public boolean isConfigurable()
Used in sidepanel.jelly to decide whether to display the config/delete/build links.

Specified by:
isConfigurable in interface IAbstractProject
Returns:
true - if configurable, false - otherwise.

blockBuildWhenDownstreamBuilding

public boolean blockBuildWhenDownstreamBuilding()
Description copied from interface: IAbstractProject
Indicates whether build should be blocked while downstream project is building.

Specified by:
blockBuildWhenDownstreamBuilding in interface IAbstractProject
Returns:
true if yes, false - otherwise.

setBlockBuildWhenDownstreamBuilding

public void setBlockBuildWhenDownstreamBuilding(boolean b)
                                         throws IOException
Description copied from interface: IAbstractProject
Sets blockBuildWhenDownstreamBuilding flag.

Specified by:
setBlockBuildWhenDownstreamBuilding in interface IAbstractProject
Parameters:
b - new boolean value.
Throws:
IOException - if any.

blockBuildWhenUpstreamBuilding

public boolean blockBuildWhenUpstreamBuilding()
Description copied from interface: IAbstractProject
Indicates whether build should be blocked while upstream project is building.

Specified by:
blockBuildWhenUpstreamBuilding in interface IAbstractProject
Returns:
true if yes, false - otherwise.

setBlockBuildWhenUpstreamBuilding

public void setBlockBuildWhenUpstreamBuilding(boolean b)
                                       throws IOException
Description copied from interface: IAbstractProject
Sets blockBuildWhenUpstreamBuilding flag.

Specified by:
setBlockBuildWhenUpstreamBuilding in interface IAbstractProject
Parameters:
b - new boolean value.
Throws:
IOException - if any.

isDisabled

public boolean isDisabled()
Specified by:
isDisabled in interface IAbstractProject
Returns:
true if project disabled, false - otherwise.

doCheckRetryCount

public FormValidation doCheckRetryCount(@QueryParameter
                                        String value)
                                 throws IOException,
                                        javax.servlet.ServletException
Validates the retry count Regex

Throws:
IOException
javax.servlet.ServletException

makeDisabled

public void makeDisabled(boolean b)
                  throws IOException
Marks the build as disabled.

Specified by:
makeDisabled in interface IAbstractProject
Parameters:
b - true - to disable project, false - enable.
Throws:
IOException - if any.

disable

public void disable()
             throws IOException
Throws:
IOException

enable

public void enable()
            throws IOException
Throws:
IOException

getIconColor

public BallColor getIconColor()
Description copied from class: Job
Used as the color of the status ball for the project.

Specified by:
getIconColor in interface IJob
Overrides:
getIconColor in class Job<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
Returns:
the color of the status ball for the project.

getPublishersList

public abstract DescribableList<Publisher,Descriptor<Publisher>> getPublishersList()
Returns the live list of all Publishers configured for this project.

This method couldn't be called getPublishers() because existing methods in sub-classes return different inconsistent types.


addProperty

public void addProperty(JobProperty<? super P> jobProp)
                 throws IOException
Description copied from class: Job
Adds JobProperty.

Overrides:
addProperty in class Job<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
Throws:
IOException

getProminentActions

public List<ProminentProjectAction> getProminentActions()
Specified by:
getProminentActions in interface IAbstractProject
Returns:
list of ProminentProjectActions for current project.

doConfigSubmit

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

Overrides:
doConfigSubmit in class Job<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
Throws:
IOException
javax.servlet.ServletException
Descriptor.FormException

scheduleBuild

public boolean scheduleBuild()
Deprecated. Use scheduleBuild(Cause). Since 1.283

Specified by:
scheduleBuild in interface BuildableItem

scheduleBuild

public boolean scheduleBuild(int quietPeriod)
Deprecated. Use scheduleBuild(int, Cause). Since 1.283

Specified by:
scheduleBuild in interface BuildableItem

scheduleBuild

public boolean scheduleBuild(Cause c)
Schedules a build of this project.

Specified by:
scheduleBuild in interface BuildableItem
Returns:
true if the project is actually added to the queue. false if the queue contained it and therefore the add() was noop

scheduleBuild

public boolean scheduleBuild(int quietPeriod,
                             Cause c)
Specified by:
scheduleBuild in interface BuildableItem

scheduleBuild

public boolean scheduleBuild(int quietPeriod,
                             Cause c,
                             Action... actions)
Schedules a build. Important: the actions should be persistable without outside references (e.g. don't store references to this project). To provide parameters for a parameterized project, add a ParametersAction. If no ParametersAction is provided for such a project, one will be created with the default parameter values.

Parameters:
quietPeriod - the quiet period to observer
c - the cause for this build which should be recorded
actions - a list of Actions that will be added to the build
Returns:
whether the build was actually scheduled

scheduleBuild2

public Future<R> scheduleBuild2(int quietPeriod,
                                Cause c,
                                Action... actions)
Schedules a build of this project, and returns a Future object to wait for the completion of the build.

Parameters:
actions - For the convenience of the caller, this array can contain null, and those will be silently ignored.

scheduleBuild2

public Future<R> scheduleBuild2(int quietPeriod,
                                Cause c,
                                Collection<? extends Action> actions)
Schedules a build of this project, and returns a Future object to wait for the completion of the build.

Parameters:
actions - For the convenience of the caller, this collection can contain null, and those will be silently ignored.
Since:
1.383

scheduleBuild2

public Future<R> scheduleBuild2(int quietPeriod)
Schedules a build, and returns a Future object to wait for the completion of the build.

Production code shouldn't be using this, but for tests this is very convenient, so this isn't marked as deprecated.


scheduleBuild2

public Future<R> scheduleBuild2(int quietPeriod,
                                Cause c)
Schedules a build of this project, and returns a Future object to wait for the completion of the build.


schedulePolling

public boolean schedulePolling()
Schedules a polling of this project.


isInQueue

public boolean isInQueue()
Returns true if the build is in the queue.

Specified by:
isInQueue in interface IJob
Overrides:
isInQueue in class Job<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
Returns:
true if the build is in the queue.

getQueueItem

public Queue.Item getQueueItem()
Description copied from class: Job

Specified by:
getQueueItem in interface IJob
Overrides:
getQueueItem in class Job<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
Returns:
queue item If this job is in the build queue.

getJDKName

public String getJDKName()
Specified by:
getJDKName in interface IAbstractProject
Returns:
name of jdk chosen for current project. Could taken from parent

getJDK

public JDK getJDK()
Specified by:
getJDK in interface IAbstractProject
Returns:
JDK that this project is configured with, or null.

setJDK

public void setJDK(JDK jdk)
            throws IOException
Overwrites the JDK setting.

Specified by:
setJDK in interface IAbstractProject
Parameters:
jdk - new JDK candidate
Throws:
IOException - if any.

setJDK

public void setJDK(String jdk)
Description copied from interface: IAbstractProject
Overwrites the JDK setting.

Specified by:
setJDK in interface IAbstractProject
Parameters:
jdk - new jdk name value.

getAuthToken

public BuildAuthorizationToken getAuthToken()

_getRuns

public SortedMap<Integer,? extends R> _getRuns()
Description copied from class: Job
Gets all the runs. The resulting map must be immutable (by employing copy-on-write semantics.) The map is descending order, with newest builds at the top.


removeRun

public void removeRun(R run)
Description copied from class: Job
Called from Run to remove it from this job. The files are deleted already. So all the callee needs to do is to remove a reference from this Job.


getActions

public List<Action> getActions()
Gets actions contributed to this build.

A new Action can be added by getActions().add(...).

Note that this method returns a read-only view of Actions. BuildSteps and others who want to add a project action should do so by implementing BuildStep.getProjectActions(AbstractProject).

Overrides:
getActions in class Actionable
Returns:
may be empty but never null.
See Also:
TransientProjectActionFactory

getLastBuiltOn

public Node getLastBuiltOn()
Gets the Node where this project was last built on.

Specified by:
getLastBuiltOn in interface SubTask
Returns:
null if no information is available (for example, if no build was done yet.)

getSameNodeConstraint

public Object getSameNodeConstraint()
Description copied from interface: SubTask
If a subset of SubTasks of a Queue.Task needs to be collocated with other SubTasks, those SubTasks should return the equal object here. If null, the execution unit isn't under a colocation constraint.

Specified by:
getSameNodeConstraint in interface SubTask

getOwnerTask

public final Queue.Task getOwnerTask()
Description copied from interface: SubTask
Gets the Queue.Task that this subtask belongs to.

Specified by:
getOwnerTask in interface SubTask

isBuildBlocked

public boolean isBuildBlocked()
Returns true if the execution should be blocked for temporary reasons.

Short-hand for getCauseOfBlockage()!=null.

A project must be blocked if its own previous build is in progress, or if the blockBuildWhenUpstreamBuilding option is true and an upstream project is building, but derived classes can also check other conditions.

Specified by:
isBuildBlocked in interface Queue.Task

getWhyBlocked

public String getWhyBlocked()
Specified by:
getWhyBlocked in interface Queue.Task

getCauseOfBlockage

public CauseOfBlockage getCauseOfBlockage()
Description copied from interface: Queue.Task
If the execution of this task should be blocked for temporary reasons, this method returns a non-null object explaining why.

Otherwise this method returns null, indicating that the build can proceed right away.

This can be used to define mutual exclusion that goes beyond ResourceActivity.getResourceList().

Specified by:
getCauseOfBlockage in interface Queue.Task

getSubTasks

public List<SubTask> getSubTasks()
Description copied from interface: Queue.Task
Obtains the SubTasks that constitute this task.

The collection returned by this method must also contain the primary SubTask represented by this Queue.TransientTask object itself as the first element. The returned value is read-only.

At least size 1.

Since this is a newly added method, the invocation may results in AbstractMethodError. Use Tasks#getSubTasksOf(Task) that avoids this.

Specified by:
getSubTasks in interface Queue.Task

createExecutable

public R createExecutable()
                                              throws IOException
Description copied from interface: SubTask
Creates Queue.Executable, which performs the actual execution of the task.

Specified by:
createExecutable in interface SubTask
Throws:
IOException

checkAbortPermission

public void checkAbortPermission()
Description copied from interface: Queue.Task
Checks the permission to see if the current user can abort this executable. Returns normally from this method if it's OK.

Specified by:
checkAbortPermission in interface Queue.Task

hasAbortPermission

public boolean hasAbortPermission()
Description copied from interface: Queue.Task
Works just like Queue.Task.checkAbortPermission() except it indicates the status by a return value, instead of exception.

Specified by:
hasAbortPermission in interface Queue.Task

getWorkspaceResource

public Resource getWorkspaceResource()
Deprecated. as of 1.319 Projects no longer have a fixed workspace, ands builds will find an available workspace via WorkspaceList for each build (furthermore, that happens after a build is started.) So a Resource representation for a workspace at the project level no longer makes sense.

If you need to lock a workspace while you do some computation, see the source code of pollSCMChanges(TaskListener) for how to obtain a lock of a workspace through WorkspaceList.

Gets the Resource that represents the workspace of this project. Useful for locking and mutual exclusion control.


getResourceList

public ResourceList getResourceList()
List of necessary resources to perform the build of this project.

Specified by:
getResourceList in interface ResourceActivity
Returns:
never null

checkout

public boolean checkout(AbstractBuild build,
                        Launcher launcher,
                        BuildListener listener,
                        File changelogFile)
                 throws IOException,
                        InterruptedException
Throws:
IOException
InterruptedException

pollSCMChanges

public boolean pollSCMChanges(TaskListener listener)
Deprecated. as of 1.346 Use poll(TaskListener) instead.

Checks if there's any update in SCM, and returns true if any is found.


poll

public PollingResult poll(TaskListener listener)
Checks if there's any update in SCM, and returns true if any is found.

The implementation is responsible for ensuring mutual exclusion between polling and builds if necessary.

Since:
1.345

hasParticipant

public boolean hasParticipant(User user)
Returns true if this user has made a commit to this project.

Since:
1.191

getScm

@Exported
public SCM getScm()
Description copied from interface: IAbstractProject
Returns configured SCM for project,

Specified by:
getScm in interface IAbstractProject
Returns:
SCM instance

setScm

public void setScm(SCM scm)
            throws IOException
Description copied from interface: IAbstractProject
Sets scm value.

Specified by:
setScm in interface IAbstractProject
Parameters:
scm - SCM
Throws:
IOException - if any.

addTrigger

public void addTrigger(Trigger<?> trigger)
                throws IOException
Adds a new Trigger to this Project if not active yet.

Specified by:
addTrigger in interface IAbstractProject
Parameters:
trigger - new trigger.
Throws:
IOException - if any.

removeTrigger

public void removeTrigger(TriggerDescriptor trigger)
                   throws IOException
Description copied from interface: IAbstractProject
Removes Trigger frin this Project by TriggerDescriptor.

Specified by:
removeTrigger in interface IAbstractProject
Parameters:
trigger - descriptor of trigger.
Throws:
IOException - if any.

getTriggers

public Map<TriggerDescriptor,Trigger> getTriggers()
Description copied from interface: IAbstractProject
Returns map of triggers.

Specified by:
getTriggers in interface IAbstractProject
Returns:
Map.

getTriggersList

public List<Trigger<?>> getTriggersList()
Specified by:
getTriggersList in interface IAbstractProject
Returns:
list of Trigger elements.

getTriggerDescribableList

public DescribableList<Trigger<?>,TriggerDescriptor> getTriggerDescribableList()
Specified by:
getTriggerDescribableList in interface IAbstractProject
Returns:
describable list of trigger elements.

getTrigger

public <T extends Trigger> T getTrigger(Class<T> clazz)
Gets the specific trigger, or null if the propert is not configured for this job.

Specified by:
getTrigger in interface IAbstractProject
Parameters:
clazz - class of trigger
Returns:
T

setTriggers

public void setTriggers(List<Trigger<?>> triggerList)
Description copied from interface: IAbstractProject
Sets list of triggers.

Specified by:
setTriggers in interface IAbstractProject
Parameters:
triggerList - list of Trigger object

isFingerprintConfigured

public abstract boolean isFingerprintConfigured()
True if the builds of this project produces Fingerprint records.


getDownstreamProjects

@Exported
public final List<AbstractProject> getDownstreamProjects()
Gets the other AbstractProjects that should be built when a build of this project is completed.

Specified by:
getDownstreamProjects in interface IAbstractProject
Returns:
the other AbstractProjects that should be built when a build of this project is completed.

getUpstreamProjects

@Exported
public final List<AbstractProject> getUpstreamProjects()
Specified by:
getUpstreamProjects in interface IAbstractProject
Returns:
the other AbstractProjects that should be built before a build of this project is started.

getBuildTriggerUpstreamProjects

public final List<AbstractProject> getBuildTriggerUpstreamProjects()
Returns only those upstream projects that defines BuildTrigger to this project. This is a subset of getUpstreamProjects()

Specified by:
getBuildTriggerUpstreamProjects in interface IAbstractProject
Returns:
A List of upstream projects that has a BuildTrigger to this project.

getTransitiveUpstreamProjects

public final Set<AbstractProject> getTransitiveUpstreamProjects()
Gets all the upstream projects including transitive upstream projects.

Specified by:
getTransitiveUpstreamProjects in interface IAbstractProject
Returns:
all the upstream projects including transitive upstream projects.
Since:
1.138

getTransitiveDownstreamProjects

public final Set<AbstractProject> getTransitiveDownstreamProjects()
Gets all the downstream projects including transitive downstream projects.

Specified by:
getTransitiveDownstreamProjects in interface IAbstractProject
Returns:
all the downstream projects including transitive downstream projects.
Since:
1.138

getRelationship

public SortedMap<Integer,Fingerprint.RangeSet> getRelationship(AbstractProject that)
Gets the dependency relationship map between this project (as the source) and that project (as the sink.)

Specified by:
getRelationship in interface IAbstractProject
Parameters:
that - AbstractProject to find relations.
Returns:
can be empty but not null. build number of this project to the build numbers of that project.

isParameterized

public boolean isParameterized()
Specified by:
isParameterized in interface IAbstractProject
Returns:
true if project is parameterized.

doBuild

public void doBuild(org.kohsuke.stapler.StaplerRequest req,
                    org.kohsuke.stapler.StaplerResponse rsp)
             throws IOException,
                    javax.servlet.ServletException
Schedules a new build command.

Throws:
IOException
javax.servlet.ServletException

getDelay

public int getDelay(org.kohsuke.stapler.StaplerRequest req)
             throws javax.servlet.ServletException
Computes the delay by taking the default value and the override in the request parameter into the account.

Throws:
javax.servlet.ServletException

doBuildWithParameters

public void doBuildWithParameters(org.kohsuke.stapler.StaplerRequest req,
                                  org.kohsuke.stapler.StaplerResponse rsp)
                           throws IOException,
                                  javax.servlet.ServletException
Supports build trigger with parameters via an HTTP GET or POST. Currently only String parameters are supported.

Throws:
IOException
javax.servlet.ServletException

doPolling

public void doPolling(org.kohsuke.stapler.StaplerRequest req,
                      org.kohsuke.stapler.StaplerResponse rsp)
               throws IOException,
                      javax.servlet.ServletException
Schedules a new SCM polling command.

Throws:
IOException
javax.servlet.ServletException

doCancelQueue

public void doCancelQueue(org.kohsuke.stapler.StaplerRequest req,
                          org.kohsuke.stapler.StaplerResponse rsp)
                   throws IOException,
                          javax.servlet.ServletException
Cancels a scheduled build.

Throws:
IOException
javax.servlet.ServletException

doWs

public DirectoryBrowserSupport doWs(org.kohsuke.stapler.StaplerRequest req,
                                    org.kohsuke.stapler.StaplerResponse rsp)
                             throws IOException,
                                    javax.servlet.ServletException,
                                    InterruptedException
Serves the workspace files.

Throws:
IOException
javax.servlet.ServletException
InterruptedException

doDoWipeOutWorkspace

public org.kohsuke.stapler.HttpResponse doDoWipeOutWorkspace()
                                                      throws IOException,
                                                             javax.servlet.ServletException,
                                                             InterruptedException
Wipes out the workspace.

Throws:
IOException
javax.servlet.ServletException
InterruptedException

cleanWorkspace

public boolean cleanWorkspace()
                       throws IOException,
                              InterruptedException
Description copied from interface: IAbstractProject
Cleans project workspace.

Specified by:
cleanWorkspace in interface IAbstractProject
Returns:
true if success, false otherwise.
Throws:
IOException - if any.
InterruptedException - if any.

doDisable

@CLIMethod(name="disable-job")
public org.kohsuke.stapler.HttpResponse doDisable()
                                           throws IOException,
                                                  javax.servlet.ServletException
Throws:
IOException
javax.servlet.ServletException

doEnable

@CLIMethod(name="enable-job")
public org.kohsuke.stapler.HttpResponse doEnable()
                                          throws IOException,
                                                 javax.servlet.ServletException
Throws:
IOException
javax.servlet.ServletException

doRssChangelog

public void doRssChangelog(org.kohsuke.stapler.StaplerRequest req,
                           org.kohsuke.stapler.StaplerResponse rsp)
                    throws IOException,
                           javax.servlet.ServletException
RSS feed for changes in this project.

Throws:
IOException
javax.servlet.ServletException

findNearest

public static AbstractProject findNearest(String name)
Finds a AbstractProject that has the name closest to the given name.


resolveForCLI

@CLIResolver
public static AbstractProject resolveForCLI(String name)
                                     throws org.kohsuke.args4j.CmdLineException
Used for CLI binding.

Throws:
org.kohsuke.args4j.CmdLineException


Copyright © 2004-2013 Hudson. All Rights Reserved.