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,ITask,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
Nested ClassesModifier and TypeClassDescriptionstatic classMultiBranchProject.BranchIndexing<P extends Job<P,R> & TopLevelItem, R extends Run<P, R>> Represents the branch indexing job.static classVeto attempts to copy branch projects outside of their multibranch container.static classOur event listener.static classAdds theMultiBranchProject.State.sourceActionstoActionable.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.RunListenerImplNested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudsonNested classes/interfaces inherited from interface org.kohsuke.stapler.HttpDeletable
org.kohsuke.stapler.HttpDeletable.HttpDeletableDispatcherNested 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, reloadingThisFields inherited from class hudson.model.AbstractItem
description, displayName, name, PRONOUN, SKIP_PERMISSION_CHECK, TASK_NOUN -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMultiBranchProject(ItemGroup parent, String name) Constructor, mandated byTopLevelItem. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcomputeChildren(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 voidfireSCMSourceAfterSave(List<jenkins.scm.api.SCMSource> sources) Fires theSCMSource.afterSave()method for the supplied sources.getACL()Deprecated.getBranchPropertyStrategy(jenkins.scm.api.SCMSource source) Returns theBranchPropertyStrategyfor a specificSCMSource.Returns the directory that branch indexing is stored in.Returns the current/most recent indexing details.Returns the named child job ornullif no such job exists.getItemByBranchName(String branchName) Returns the child job with the specified branch name ornullif 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.SCMSourcegetSCMSource(String sourceId) jenkins.scm.api.SCMSourceCriteriagetSCMSourceCriteria(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 ViewCreates a place-holder view when there's no active branch indexed.booleanbooleanprotected com.cloudbees.hudson.plugins.folder.FolderIconprotected com.cloudbees.hudson.plugins.folder.views.AbstractFolderViewHolderprotected abstract BranchProjectFactory<P,R> Creates a new instance of the default project factory to be used for a new instance of the project type.voidvoidonSCMSourceUpdated(jenkins.scm.api.SCMSource source) protected Collection<P>orphanedItems(Collection<P> orphaned, TaskListener listener) static StringInverse function ofUtil.rawEncode(String)voidsetProjectFactory(BranchProjectFactory<P, R> projectFactory) Sets theBranchProjectFactory.voidsetSourcesList(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 voidsubmit(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 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, submit, supportsMakeDisabledMethods inherited from class com.cloudbees.hudson.plugins.folder.AbstractFolder
addLoadedChild, addProperty, addView, canDelete, deleteView, doChildrenContextMenu, doChildrenContextMenu, doCreateView, doCreateView, doDisable, doEnable, doLastBuild, doLastBuild, doSubmitDescription, doSubmitDescription, doViewExistsCheck, getAllJobs, getBuildHealth, getBuildHealthReports, getFolderViews, getHealthMetrics, getIcon, getIconColor, getItemGroup, getItemName, 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, reloadThis, renameBlocker, renameTo, resetFolderViews, save, setIcon, setPrimaryViewMethods inherited from class hudson.model.AbstractItem
delete, delete, delete, doCheckNewName, doConfigDotXml, doConfigDotXml, doConfirmRename, doDoDelete, 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, writeReplaceMethods inherited from class hudson.model.Actionable
addAction, addOrReplaceAction, doContextMenu, doContextMenu, getAction, getAction, getActions, getAllActions, getDynamic, getDynamic, removeAction, removeActions, replaceAction, replaceActionsMethods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError, sendError, sendError, sendErrorMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface hudson.security.AccessControlled
checkAnyPermission, checkPermission, hasAnyPermission, hasPermission, hasPermission, hasPermission2Methods inherited from interface hudson.model.BuildableItem
scheduleBuild, scheduleBuildMethods inherited from interface hudson.model.DescriptorByNameOwner
getDescriptorByNameMethods inherited from interface jenkins.model.queue.ITask
hasReadPermissionMethods inherited from interface hudson.model.Item
delete, getAbsoluteUrl, getAllJobs, getFullDisplayName, getFullName, getName, getParent, getRelativeNameFrom, getRelativeNameFrom, getSearchGroup, getShortUrl, getUrl, onCopiedFrom, onCreatedFromScratch, saveMethods inherited from interface hudson.model.ItemGroup
allItems, allItems, allItems, getAllItems, getAllItems, getAllItems, getFullDisplayName, getFullName, getItemsStream, getItemsStream, getUrlMethods inherited from interface hudson.model.PersistenceRoot
getRootDirMethods inherited from interface hudson.model.Queue.Task
getAffinityKey, getDefaultAuthentication, getDefaultAuthentication, getDefaultAuthentication2, getDefaultAuthentication2, getFullDisplayName, getName, getSubTasks, getUrl, getWhyBlocked, isBuildBlocked, isConcurrentBuildMethods inherited from interface hudson.model.ResourceActivity
getResourceListMethods inherited from interface hudson.search.SearchableModelObject
getSearchMethods inherited from interface hudson.search.SearchItem
getSearchIcon, getSearchIndex, getSearchName, getSearchUrlMethods inherited from interface hudson.model.queue.SubTask
getOwnerExecutable, getOwnerTask, getSameNodeConstraintMethods 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:
onLoadin interfaceItem- Overrides:
onLoadin 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:
newFolderViewHolderin classcom.cloudbees.hudson.plugins.folder.AbstractFolder<P extends Job<P,R> & TopLevelItem>
-
newDefaultFolderIcon
protected com.cloudbees.hudson.plugins.folder.FolderIcon newDefaultFolderIcon()- Overrides:
newDefaultFolderIconin classcom.cloudbees.hudson.plugins.folder.AbstractFolder<P extends Job<P,R> & TopLevelItem>
-
getIconClassName
- Specified by:
getIconClassNamein interfaceIconSpec- Overrides:
getIconClassNamein classcom.cloudbees.hudson.plugins.folder.AbstractFolder<P extends Job<P,R> & TopLevelItem>
-
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:
getSCMSourcesin interfacejenkins.scm.api.SCMSourceOwner
-
getSCMSource
- Specified by:
getSCMSourcein interfacejenkins.scm.api.SCMSourceOwner
-
getBranchPropertyStrategy
@CheckForNull public BranchPropertyStrategy getBranchPropertyStrategy(@NonNull jenkins.scm.api.SCMSource source) Returns theBranchPropertyStrategyfor a specificSCMSource.- Parameters:
source- the specificSCMSource.- Returns:
- the
BranchPropertyStrategyto use.
-
getSCMSourceCriteria
@CheckForNull public jenkins.scm.api.SCMSourceCriteria getSCMSourceCriteria(@NonNull jenkins.scm.api.SCMSource source) - Specified by:
getSCMSourceCriteriain interfacejenkins.scm.api.SCMSourceOwner
-
onSCMSourceUpdated
public void onSCMSourceUpdated(@NonNull jenkins.scm.api.SCMSource source) - Specified by:
onSCMSourceUpdatedin interfacejenkins.scm.api.SCMSourceOwner
-
isHasEvents
public boolean isHasEvents()- Overrides:
isHasEventsin 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:
computeChildrenin classcom.cloudbees.hudson.plugins.folder.computed.ComputedFolder<P extends Job<P,R> & TopLevelItem> - Throws:
IOExceptionInterruptedException
-
orphanedItems
protected Collection<P> orphanedItems(Collection<P> orphaned, TaskListener listener) throws IOException, InterruptedException - Overrides:
orphanedItemsin classcom.cloudbees.hudson.plugins.folder.computed.ComputedFolder<P extends Job<P,R> & TopLevelItem> - Throws:
IOExceptionInterruptedException
-
getItem
Returns the named child job ornullif no such job exists. -
getItemByBranchName
Returns the child job with the specified branch name ornullif no such child job exists.- Parameters:
branchName- the name of the branch.- Returns:
- the child job or
nullif 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 ornullif no such branch exists.- Parameters:
name- the name of the branch- Returns:
- the named branch job or
nullif no such branch exists.
-
getACL
- Specified by:
getACLin interfaceAccessControlled- Overrides:
getACLin classAbstractItem
-
getDescription
- Overrides:
getDescriptionin classAbstractItem
-
getDisplayName
- Specified by:
getDisplayNamein interfaceItem- Specified by:
getDisplayNamein interfaceModelObject- Specified by:
getDisplayNamein interfaceResourceActivity- Overrides:
getDisplayNamein classAbstractItem
-
getJobsDir
Returns the directory that all branches are stored in.- Overrides:
getJobsDirin classcom.cloudbees.hudson.plugins.folder.AbstractFolder<P extends Job<P,R> & TopLevelItem> - Returns:
- the directory that all branches are stored in.
-
getRootDirFor
- Specified by:
getRootDirForin interfaceItemGroup<P extends Job<P,R> & TopLevelItem> - Overrides:
getRootDirForin classcom.cloudbees.hudson.plugins.folder.AbstractFolder<P extends Job<P,R> & TopLevelItem>
-
getComputationDir
Returns the directory that branch indexing is stored in.- Overrides:
getComputationDirin 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:
getDescriptorin interfaceDescribable<P extends Job<P,R> & TopLevelItem> - Specified by:
getDescriptorin interfaceTopLevelItem- Overrides:
getDescriptorin 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.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException, Descriptor.FormException - Overrides:
submitin classcom.cloudbees.hudson.plugins.folder.computed.ComputedFolder<P extends Job<P,R> & TopLevelItem> - Throws:
IOExceptionjakarta.servlet.ServletExceptionDescriptor.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:
isBuildablein 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:
createComputationin 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