Package jenkins.branch
Class MultiBranchProject<P extends Job<P,R> & TopLevelItem,R extends Run<P,R>>
java.lang.Object
hudson.model.AbstractModelObject
hudson.model.Actionable
hudson.model.AbstractItem
com.cloudbees.hudson.plugins.folder.AbstractFolder<I>
com.cloudbees.hudson.plugins.folder.computed.ComputedFolder<P>
jenkins.branch.MultiBranchProject<P,R>
- Type Parameters:
P
- the project typeR
- the run type
- All Implemented Interfaces:
ExtensionPoint
,BuildableItem
,Describable<TopLevelItem>
,DescriptorByNameOwner
,Item
,ItemGroup<P>
,ModelObject
,ModifiableViewGroup
,PersistenceRoot
,Queue.FlyweightTask
,SubTask
,Queue.Task
,ResourceActivity
,Saveable
,TopLevelItem
,ViewGroup
,SearchableModelObject
,SearchItem
,AccessControlled
,Loadable
,ModelObjectWithChildren
,ModelObjectWithContextMenu
,jenkins.scm.api.SCMSourceOwner
,TriggeredItem
,OnMaster
,IconSpec
,org.kohsuke.stapler.HttpDeletable
,org.kohsuke.stapler.StaplerFallback
,org.kohsuke.stapler.StaplerOverridable
,org.kohsuke.stapler.StaplerProxy
public abstract class MultiBranchProject<P extends Job<P,R> & TopLevelItem,R extends Run<P,R>>
extends com.cloudbees.hudson.plugins.folder.computed.ComputedFolder<P>
implements jenkins.scm.api.SCMSourceOwner, IconSpec
Abstract base class for multiple-branch based projects.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
MultiBranchProject.BranchIndexing<P extends Job<P,
R> & TopLevelItem, R extends Run<P, R>> Represents the branch indexing job.static class
Veto attempts to copy branch projects outside of their multibranch container.static class
Our event listener.static class
Adds theMultiBranchProject.State.sourceActions
toActionable.getAllActions()
.Nested classes/interfaces inherited from class com.cloudbees.hudson.plugins.folder.AbstractFolder
com.cloudbees.hudson.plugins.folder.AbstractFolder.ItemListenerImpl, com.cloudbees.hudson.plugins.folder.AbstractFolder.RunListenerImpl
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
Nested classes/interfaces inherited from interface jenkins.model.ModelObjectWithContextMenu
ModelObjectWithContextMenu.ContextMenu, ModelObjectWithContextMenu.ContextMenuVisibility, ModelObjectWithContextMenu.MenuItem, ModelObjectWithContextMenu.MenuItemType
-
Field Summary
Fields inherited from class com.cloudbees.hudson.plugins.folder.AbstractFolder
items
Fields inherited from class hudson.model.AbstractItem
description, displayName, name, PRONOUN, SKIP_PERMISSION_CHECK, TASK_NOUN
-
Constructor Summary
ModifierConstructorDescriptionprotected
MultiBranchProject
(ItemGroup parent, String name) Constructor, mandated byTopLevelItem
. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
computeChildren
(com.cloudbees.hudson.plugins.folder.computed.ChildObserver<P> observer, TaskListener listener) protected com.cloudbees.hudson.plugins.folder.computed.FolderComputation<P>
createComputation
(com.cloudbees.hudson.plugins.folder.computed.FolderComputation<P> previous) protected void
fireSCMSourceAfterSave
(List<jenkins.scm.api.SCMSource> sources) Fires theSCMSource.afterSave()
method for the supplied sources.getACL()
Deprecated.getBranchPropertyStrategy
(jenkins.scm.api.SCMSource source) Returns theBranchPropertyStrategy
for a specificSCMSource
.Returns the directory that branch indexing is stored in.Returns the current/most recent indexing details.Returns the named child job ornull
if no such job exists.getItemByBranchName
(String branchName) Returns the child job with the specified branch name ornull
if no such child job exists.Returns the directory that all branches are stored in.Returns the base class of the projects that are managed by thisMultiBranchProject
.Returns theBranchProjectFactory
.getRootDirFor
(P child) jenkins.scm.api.SCMSource
getSCMSource
(String sourceId) jenkins.scm.api.SCMSourceCriteria
getSCMSourceCriteria
(jenkins.scm.api.SCMSource source) List<jenkins.scm.api.SCMSource>
Get the term used in the UI to represent the source for this kind ofItem
.The sources of branches.Offers direct access to the configurable list of branch sources.protected View
Creates a place-holder view when there's no active branch indexed.boolean
boolean
protected com.cloudbees.hudson.plugins.folder.FolderIcon
protected com.cloudbees.hudson.plugins.folder.views.AbstractFolderViewHolder
protected abstract BranchProjectFactory<P,
R> Creates a new instance of the default project factory to be used for a new instance of the project type.void
void
onSCMSourceUpdated
(jenkins.scm.api.SCMSource source) protected Collection<P>
orphanedItems
(Collection<P> orphaned, TaskListener listener) static String
Inverse function ofUtil.rawEncode(String)
void
setProjectFactory
(BranchProjectFactory<P, R> projectFactory) Sets theBranchProjectFactory
.void
setSourcesList
(List<BranchSource> sources) Offers direct access to set the configurable list of branch sources while preserving branch source id associations for sources that are otherwise unmodifiedprotected void
submit
(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) Methods inherited from class com.cloudbees.hudson.plugins.folder.computed.ComputedFolder
addTrigger, checkAbortPermission, checkRename, createEventsChildObserver, createExecutable, doBuild, doConfigSubmit, getActions, getAssignedLabel, getCauseOfBlockage, getComputation, getEstimatedDuration, getLastBuiltOn, getLastFailedBuild, getLastStableBuild, getLastSuccessfulBuild, getOrphanedItemStrategy, getOrphanedItemStrategyDescriptors, getSuccessfulDestination, getTriggerDescriptors, getTriggers, hasAbortPermission, init, isDisabled, onCreatedFromScratch, openEventsChildObserver, recalculateAfterSubmitted, removeTrigger, scheduleBuild, scheduleBuild, scheduleBuild2, setDisabled, setOrphanedItemStrategy, supportsMakeDisabled
Methods inherited from class com.cloudbees.hudson.plugins.folder.AbstractFolder
addProperty, addView, canDelete, deleteView, doChildrenContextMenu, doCreateView, doDisable, doEnable, doLastBuild, doSubmitDescription, doViewExistsCheck, getAllJobs, getBuildHealth, getBuildHealthReports, getFolderViews, getHealthMetrics, getIcon, getIconColor, getItemGroup, getItems, getItems, getJob, getOverrides, getPrimaryView, getPronoun, getProperties, getRootDirFor, getStaplerFallback, getUrlChildPrefix, getViewActions, getViews, getViewsTabBar, hasVisibleItems, initViews, invalidateBuildHealthReports, isNameEditable, itemsPut, loadChildren, loadJobTotal, makeDisabled, makeSearchIndex, newDefaultViewsTabBar, onDeleted, onRenamed, onViewRenamed, renameBlocker, renameTo, resetFolderViews, save, setIcon, setPrimaryView
Methods inherited from class hudson.model.AbstractItem
delete, delete, doCheckNewName, doConfigDotXml, doConfirmRename, doDoDelete, doReload, doSetName, getAbsoluteUrl, getApi, getConfigFile, getDisplayNameOrNull, getFullDisplayName, getFullName, getName, getParent, getRelativeDisplayNameFrom, getRelativeNameFromGroup, getRootDir, getSearchName, getSearchUrl, getShortUrl, getTarget, getTaskNoun, getUrl, load, movedTo, onCopiedFrom, performDelete, resolveForCLI, setDescription, setDisplayName, setDisplayNameOrNull, toString, updateByXml, updateByXml, writeConfigDotXml, writeReplace
Methods inherited from class hudson.model.Actionable
addAction, addOrReplaceAction, doContextMenu, getAction, getAction, getActions, getAllActions, getDynamic, removeAction, removeActions, replaceAction, replaceActions
Methods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface hudson.security.AccessControlled
checkAnyPermission, checkPermission, hasAnyPermission, hasPermission, hasPermission, hasPermission2
Methods inherited from interface hudson.model.BuildableItem
scheduleBuild, scheduleBuild
Methods inherited from interface hudson.model.DescriptorByNameOwner
getDescriptorByName
Methods inherited from interface hudson.model.Item
delete, getAbsoluteUrl, getAllJobs, getFullDisplayName, getFullName, getName, getParent, getRelativeNameFrom, getRelativeNameFrom, getShortUrl, getUrl, onCopiedFrom, onCreatedFromScratch, save
Methods inherited from interface hudson.model.ItemGroup
allItems, allItems, allItems, getAllItems, getAllItems, getAllItems, getFullDisplayName, getFullName, getItemsStream, getItemsStream, getUrl
Methods inherited from interface hudson.model.PersistenceRoot
getRootDir
Methods inherited from interface hudson.model.Queue.Task
getAffinityKey, getDefaultAuthentication, getDefaultAuthentication, getDefaultAuthentication2, getDefaultAuthentication2, getFullDisplayName, getName, getSubTasks, getUrl, getWhyBlocked, isBuildBlocked, isConcurrentBuild
Methods inherited from interface hudson.model.ResourceActivity
getResourceList
Methods inherited from interface hudson.search.SearchableModelObject
getSearch
Methods inherited from interface hudson.search.SearchItem
getSearchIndex, getSearchName, getSearchUrl
Methods inherited from interface hudson.model.queue.SubTask
getOwnerExecutable, getOwnerTask, getSameNodeConstraint
Methods inherited from interface hudson.model.ViewGroup
getAllViews, getUrl
-
Constructor Details
-
MultiBranchProject
Constructor, mandated byTopLevelItem
.- Parameters:
parent
- the parent of this multibranch job.name
- the name of the multibranch job.
-
-
Method Details
-
onLoad
- Specified by:
onLoad
in interfaceItem
- Overrides:
onLoad
in classcom.cloudbees.hudson.plugins.folder.computed.ComputedFolder<P extends Job<P,
R> & TopLevelItem> - Throws:
IOException
-
newFolderViewHolder
protected com.cloudbees.hudson.plugins.folder.views.AbstractFolderViewHolder newFolderViewHolder()- Overrides:
newFolderViewHolder
in classcom.cloudbees.hudson.plugins.folder.AbstractFolder<P extends Job<P,
R> & TopLevelItem>
-
newDefaultFolderIcon
protected com.cloudbees.hudson.plugins.folder.FolderIcon newDefaultFolderIcon()- Overrides:
newDefaultFolderIcon
in classcom.cloudbees.hudson.plugins.folder.AbstractFolder<P extends Job<P,
R> & TopLevelItem>
-
getIconClassName
- Specified by:
getIconClassName
in interfaceIconSpec
-
getSourcePronoun
Get the term used in the UI to represent the source for this kind ofItem
. Must start with a capital letter.- Returns:
- term used in the UI to represent the source
-
getProjectFactory
Returns theBranchProjectFactory
. ˜- Returns:
- the
BranchProjectFactory
.
-
getProjectClass
Returns the base class of the projects that are managed by thisMultiBranchProject
.- Returns:
- the base class of the projects that are managed by this
MultiBranchProject
. - Since:
- 2.0
-
setProjectFactory
Sets theBranchProjectFactory
.- Parameters:
projectFactory
- the newBranchProjectFactory
.
-
newProjectFactory
Creates a new instance of the default project factory to be used for a new instance of the project type.- Returns:
- a new default
BranchProjectFactory
.
-
getSources
The sources of branches.- Returns:
- the sources of branches.
-
getSourcesList
Offers direct access to the configurable list of branch sources. Intended for use from scripting and testing.- Returns:
- the sources list.
-
setSourcesList
Offers direct access to set the configurable list of branch sources while preserving branch source id associations for sources that are otherwise unmodified- Parameters:
sources
- the new sources.- Throws:
IOException
- if the sources could not be persisted to disk.
-
getSCMSources
- Specified by:
getSCMSources
in interfacejenkins.scm.api.SCMSourceOwner
-
getSCMSource
- Specified by:
getSCMSource
in interfacejenkins.scm.api.SCMSourceOwner
-
getBranchPropertyStrategy
@CheckForNull public BranchPropertyStrategy getBranchPropertyStrategy(@NonNull jenkins.scm.api.SCMSource source) Returns theBranchPropertyStrategy
for a specificSCMSource
.- Parameters:
source
- the specificSCMSource
.- Returns:
- the
BranchPropertyStrategy
to use.
-
getSCMSourceCriteria
@CheckForNull public jenkins.scm.api.SCMSourceCriteria getSCMSourceCriteria(@NonNull jenkins.scm.api.SCMSource source) - Specified by:
getSCMSourceCriteria
in interfacejenkins.scm.api.SCMSourceOwner
-
onSCMSourceUpdated
public void onSCMSourceUpdated(@NonNull jenkins.scm.api.SCMSource source) - Specified by:
onSCMSourceUpdated
in interfacejenkins.scm.api.SCMSourceOwner
-
isHasEvents
public boolean isHasEvents()- Overrides:
isHasEvents
in classcom.cloudbees.hudson.plugins.folder.computed.ComputedFolder<P extends Job<P,
R> & TopLevelItem>
-
computeChildren
protected void computeChildren(com.cloudbees.hudson.plugins.folder.computed.ChildObserver<P> observer, TaskListener listener) throws IOException, InterruptedException - Specified by:
computeChildren
in classcom.cloudbees.hudson.plugins.folder.computed.ComputedFolder<P extends Job<P,
R> & TopLevelItem> - Throws:
IOException
InterruptedException
-
orphanedItems
protected Collection<P> orphanedItems(Collection<P> orphaned, TaskListener listener) throws IOException, InterruptedException - Overrides:
orphanedItems
in classcom.cloudbees.hudson.plugins.folder.computed.ComputedFolder<P extends Job<P,
R> & TopLevelItem> - Throws:
IOException
InterruptedException
-
getItem
Returns the named child job ornull
if no such job exists. -
getItemByBranchName
Returns the child job with the specified branch name ornull
if no such child job exists.- Parameters:
branchName
- the name of the branch.- Returns:
- the child job or
null
if no such job exists or if the requesting user does ave permission to view it. - Since:
- 2.0.0
-
getBranch
Deprecated.usegetItem(String)
orAbstractFolder.getJob(String)
directlyReturns the named branch job ornull
if no such branch exists.- Parameters:
name
- the name of the branch- Returns:
- the named branch job or
null
if no such branch exists.
-
getACL
- Specified by:
getACL
in interfaceAccessControlled
- Overrides:
getACL
in classAbstractItem
-
getDescription
- Overrides:
getDescription
in classAbstractItem
-
getDisplayName
- Specified by:
getDisplayName
in interfaceItem
- Specified by:
getDisplayName
in interfaceModelObject
- Specified by:
getDisplayName
in interfaceResourceActivity
- Overrides:
getDisplayName
in classAbstractItem
-
getJobsDir
Returns the directory that all branches are stored in.- Overrides:
getJobsDir
in classcom.cloudbees.hudson.plugins.folder.AbstractFolder<P extends Job<P,
R> & TopLevelItem> - Returns:
- the directory that all branches are stored in.
-
getRootDirFor
- Specified by:
getRootDirFor
in interfaceItemGroup<P extends Job<P,
R> & TopLevelItem> - Overrides:
getRootDirFor
in classcom.cloudbees.hudson.plugins.folder.AbstractFolder<P extends Job<P,
R> & TopLevelItem>
-
getComputationDir
Returns the directory that branch indexing is stored in.- Overrides:
getComputationDir
in classcom.cloudbees.hudson.plugins.folder.computed.ComputedFolder<P extends Job<P,
R> & TopLevelItem> - Returns:
- the directory that branch indexing is stored in.
-
getDescriptor
- Specified by:
getDescriptor
in interfaceDescribable<P extends Job<P,
R> & TopLevelItem> - Specified by:
getDescriptor
in interfaceTopLevelItem
- Overrides:
getDescriptor
in classcom.cloudbees.hudson.plugins.folder.AbstractFolder<P extends Job<P,
R> & TopLevelItem>
-
getIndexing
Returns the current/most recent indexing details.- Returns:
- the current/most recent indexing details.
-
submit
protected void submit(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException, Descriptor.FormException - Overrides:
submit
in classcom.cloudbees.hudson.plugins.folder.computed.ComputedFolder<P extends Job<P,
R> & TopLevelItem> - Throws:
IOException
javax.servlet.ServletException
Descriptor.FormException
-
fireSCMSourceAfterSave
Fires theSCMSource.afterSave()
method for the supplied sources.- Parameters:
sources
- the sources.
-
getWelcomeView
Creates a place-holder view when there's no active branch indexed.- Returns:
- the place-holder view when there's no active branch indexed.
-
getView
-
isBuildable
public boolean isBuildable()- Overrides:
isBuildable
in classcom.cloudbees.hudson.plugins.folder.computed.ComputedFolder<P extends Job<P,
R> & TopLevelItem>
-
createComputation
@NonNull protected com.cloudbees.hudson.plugins.folder.computed.FolderComputation<P> createComputation(com.cloudbees.hudson.plugins.folder.computed.FolderComputation<P> previous) - Overrides:
createComputation
in classcom.cloudbees.hudson.plugins.folder.computed.ComputedFolder<P extends Job<P,
R> & TopLevelItem>
-
rawDecode
Inverse function ofUtil.rawEncode(String)
- Parameters:
s
- the encoded string.- Returns:
- the decoded string.
-
getItem(String)
orAbstractFolder.getJob(String)
directly