Class ComputedFolder<I extends TopLevelItem>
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<I>
- Type Parameters:
I- the child item type
- All Implemented Interfaces:
ExtensionPoint,BuildableItem,Describable<TopLevelItem>,DescriptorByNameOwner,Item,ItemGroup<I>,ModelObject,ModifiableViewGroup,PersistenceRoot,Queue.FlyweightTask,SubTask,Queue.Task,ResourceActivity,Saveable,TopLevelItem,ViewGroup,SearchableModelObject,SearchItem,AccessControlled,FullyNamed,FullyNamedModelObject,Loadable,ModelObjectWithChildren,ModelObjectWithContextMenu,Named,ITask,TriggeredItem,OnMaster,IconSpec,org.kohsuke.stapler.HttpDeletable,org.kohsuke.stapler.StaplerFallback,org.kohsuke.stapler.StaplerOverridable,org.kohsuke.stapler.StaplerProxy
public abstract class ComputedFolder<I extends TopLevelItem>
extends AbstractFolder<I>
implements BuildableItem, TriggeredItem, Queue.FlyweightTask
A folder-like item whose children are computed.
Users cannot directly add or remove (or rename) children.
The children should also not offer
Item.CONFIGURE to anyone.- Since:
- 4.11-beta-1
-
Nested Class Summary
Nested classes/interfaces inherited from class com.cloudbees.hudson.plugins.folder.AbstractFolder
AbstractFolder.ItemListenerImpl, 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddTrigger(Trigger trigger) Update an existing trigger or add a new one.voidprotected voidcheckRename(String newName) protected abstract voidcomputeChildren(ChildObserver<I> observer, TaskListener listener) Called to (re-)compute the set of children of this folder.protected FolderComputation<I>createComputation(FolderComputation<I> previous) protected final ChildObserver<I>Deprecated.final FolderComputation<I>org.kohsuke.stapler.HttpResponsedoBuild(TimeDuration delay) voiddoConfigSubmit(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) URL binding and other purposes.protected FilelongGets theOrphanedItemStrategyDescriptors applicable to this folder.protected final StringWhere user will be redirected after creating or reconfiguring aAbstractFolder.booleanprotected voidinit()booleanWhether it is permissible to recompute this folder at this time.booleanIs this folder disabled.booleanIdentifies if thisComputedFolderhas a separate out of band events log.voidvoidprotected final ChildObserver<I>Opens a newChildObserverthat subclasses can use when handling events that might create new / update existing child items.protected Collection<I>orphanedItems(Collection<I> orphaned, TaskListener listener) Hook called when some items are no longer in the list.protected final voidrecalculateAfterSubmitted(boolean recalculate) Method for child classes to use if they want to suppress/confirm the automatic recalculation provided indoConfigSubmit(StaplerRequest2, StaplerResponse2).voidremoveTrigger(Trigger trigger) Remove an existing trigger.booleanscheduleBuild(int quietPeriod, Cause c) booleanscheduleBuild2(int quietPeriod, Action... actions) protected voidsetDisabled(boolean disabled) Sets the folder as disabled.voidsetOrphanedItemStrategy(OrphanedItemStrategy strategy) protected voidsubmit(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) protected voidsubmit(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) Deprecated.booleanDetermines whether the folder supports being made disabled.Methods 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, getDescriptor, getFolderViews, getHealthMetrics, getIcon, getIconClassName, getIconColor, getItem, getItemGroup, getItemName, getItems, getItems, getJob, getJobsDir, getOverrides, getPrimaryView, getPronoun, getProperties, getRootDirFor, getRootDirFor, getStaplerFallback, getUrlChildPrefix, getView, getViewActions, getViews, getViewsTabBar, hasVisibleItems, initViews, invalidateBuildHealthReports, isNameEditable, itemsPut, loadChildren, loadJobTotal, makeDisabled, makeSearchIndex, newDefaultFolderIcon, newDefaultViewsTabBar, newFolderViewHolder, 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, getACL, getApi, getConfigFile, getDescription, getDisplayName, 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, getACL, 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
getFullDisplayName, hasReadPermissionMethods inherited from interface hudson.model.Item
delete, getAbsoluteUrl, getAllJobs, getDisplayName, getFullName, getName, getParent, getRelativeNameFrom, getRelativeNameFrom, getSearchGroup, getShortUrl, getUrl, onCopiedFrom, saveMethods inherited from interface hudson.model.ItemGroup
allItems, allItems, allItems, getAllItems, getAllItems, getAllItems, getItemsStream, getItemsStream, getUrlMethods inherited from interface hudson.model.PersistenceRoot
getRootDirMethods inherited from interface hudson.model.Queue.Task
getAffinityKey, getDefaultAuthentication, getDefaultAuthentication, getDefaultAuthentication2, getDefaultAuthentication2, 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, getUserViewsTabBar
-
Constructor Details
-
ComputedFolder
-
-
Method Details
-
init
protected void init()- Overrides:
initin classAbstractFolder<I extends TopLevelItem>
-
onCreatedFromScratch
public void onCreatedFromScratch()- Specified by:
onCreatedFromScratchin interfaceItem
-
onLoad
Description copied from class:AbstractFolder- Specified by:
onLoadin interfaceItem- Overrides:
onLoadin classAbstractFolder<I extends TopLevelItem>- Throws:
IOException
-
computeChildren
protected abstract void computeChildren(ChildObserver<I> observer, TaskListener listener) throws IOException, InterruptedException Called to (re-)compute the set of children of this folder. It is recommended that the computation checks theThread.interrupted()status and throws aInterruptedExceptionif set at least once every 5 seconds to allow the user to interrupt a computation..- Parameters:
observer- how to indicate which children should be seenlistener- a way to report progress- Throws:
IOException- if there was anIOExceptionduring the computation.InterruptedException- if the computation was interrupted.
-
orphanedItems
protected Collection<I> orphanedItems(Collection<I> orphaned, TaskListener listener) throws IOException, InterruptedException Hook called when some items are no longer in the list. Do not callItem.delete()orItemGroup.onDeleted(T)orItemListener.fireOnDeleted(hudson.model.Item)yourself. By default, usesgetOrphanedItemStrategy().- Parameters:
orphaned- a nonempty set of items which no longer are supposed to be herelistener- the listener to report decisions to.- Returns:
- any subset of
orphaned, representing those children which ought to be removed from the folder now; items not listed will be left alone for the time - Throws:
IOException- if there was an I/O issue processing the items.InterruptedException- if interrupted while processing the items.
-
setOrphanedItemStrategy
-
createEventsChildObserver
@Deprecated @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) protected final ChildObserver<I> createEventsChildObserver()Deprecated.Creates aChildObserverthat subclasses can use when handling events that might create new / update existing child items. The handling of orphaned items is a responsibility of theOrphanedItemStrategywhich is only applied as part of a full computation.- Returns:
- a
ChildObserverfor event handling.
-
openEventsChildObserver
Opens a newChildObserverthat subclasses can use when handling events that might create new / update existing child items. The handling of orphaned items is a responsibility of theOrphanedItemStrategywhich is only applied as part of a full computation.- Returns:
- a
ChildObserverfor event handling. The caller mustChildObserver.close()when done. - Since:
- 6.0.0
-
isDisabled
public boolean isDisabled()Is this folder disabled. A disabled folder should have all child items disabled.- Overrides:
isDisabledin classAbstractFolder<I extends TopLevelItem>- Returns:
trueif and only if the folder is disabled.- See Also:
-
setDisabled
protected void setDisabled(boolean disabled) Sets the folder as disabled.- Overrides:
setDisabledin classAbstractFolder<I extends TopLevelItem>- Parameters:
disabled-trueif and only if the folder is to be disabled.
-
supportsMakeDisabled
public boolean supportsMakeDisabled()Determines whether the folder supports being made disabled.- Overrides:
supportsMakeDisabledin classAbstractFolder<I extends TopLevelItem>- Returns:
trueif and only ifAbstractFolder.setDisabled(boolean)is implemented
-
doConfigSubmit
public void doConfigSubmit(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException, Descriptor.FormException - Overrides:
doConfigSubmitin classAbstractFolder<I extends TopLevelItem>- Throws:
IOExceptionjakarta.servlet.ServletExceptionDescriptor.FormException
-
recalculateAfterSubmitted
protected final void recalculateAfterSubmitted(boolean recalculate) Method for child classes to use if they want to suppress/confirm the automatic recalculation provided indoConfigSubmit(StaplerRequest2, StaplerResponse2). This method should only be called fromsubmit(StaplerRequest2, StaplerResponse2). If called multiple times fromsubmit(StaplerRequest2, StaplerResponse2)then all calls must be with thefalseparameter to suppress recalculation.- Parameters:
recalculate-trueto require recalculation,falseto suppress recalculation.- See Also:
-
submit
protected void submit(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException, Descriptor.FormException - Overrides:
submitin classAbstractFolder<I extends TopLevelItem>- Throws:
IOExceptionjakarta.servlet.ServletExceptionDescriptor.FormException- See Also:
-
submit
@Deprecated protected void submit(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException, Descriptor.FormException Deprecated.- Overrides:
submitin classAbstractFolder<I extends TopLevelItem>- Throws:
IOExceptionjavax.servlet.ServletExceptionDescriptor.FormException
-
getSuccessfulDestination
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @NonNull protected final String getSuccessfulDestination()Where user will be redirected after creating or reconfiguring aAbstractFolder.- Overrides:
getSuccessfulDestinationin classAbstractFolder<I extends TopLevelItem>- Returns:
- A string that represents the redirect location URL.
- See Also:
-
HttpServletResponse.sendRedirect(String)
-
getTriggers
- Specified by:
getTriggersin interfaceTriggeredItem
-
getTriggerDescriptors
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public List<TriggerDescriptor> getTriggerDescriptors() -
addTrigger
Update an existing trigger or add a new one.- Parameters:
trigger- Target trigger instance.
-
removeTrigger
Remove an existing trigger.- Parameters:
trigger- Target trigger instance.
-
getActions
- Overrides:
getActionsin classActionable
-
isBuildable
@Exported public boolean isBuildable()Whether it is permissible to recompute this folder at this time.- Returns:
trueif this folder can currently be recomputed.
-
doBuild
-
scheduleBuild2
- Parameters:
quietPeriod- seconds to wait before starting (normally 0)actions- various actions to associate with the scheduling, such asParametersActionorCauseAction- Returns:
- a handle by which you may wait for the build to complete (or just start); or null if the build was not actually scheduled for some reason
-
scheduleBuild
- Specified by:
scheduleBuildin interfaceBuildableItem
-
scheduleBuild
- Specified by:
scheduleBuildin interfaceBuildableItem
-
getCauseOfBlockage
- Specified by:
getCauseOfBlockagein interfaceQueue.Task
-
checkAbortPermission
public void checkAbortPermission()- Specified by:
checkAbortPermissionin interfaceQueue.Task
-
hasAbortPermission
public boolean hasAbortPermission()- Specified by:
hasAbortPermissionin interfaceITask
-
getAssignedLabel
- Specified by:
getAssignedLabelin interfaceSubTask
-
getLastBuiltOn
- Specified by:
getLastBuiltOnin interfaceSubTask
-
getEstimatedDuration
public long getEstimatedDuration()- Specified by:
getEstimatedDurationin interfaceSubTask
-
createExecutable
- Specified by:
createExecutablein interfaceSubTask- Throws:
IOException
-
createComputation
@NonNull protected FolderComputation<I> createComputation(@CheckForNull FolderComputation<I> previous) -
getComputationDir
-
isHasEvents
public boolean isHasEvents()Identifies if thisComputedFolderhas a separate out of band events log. Default implementation just checks if the events log has content. Subclasses can override this method to force the events log always present in the UI.- Returns:
trueif thisComputedFolderhas a separate out of band events log.
-
getComputation
URL binding and other purposes. It may benulltemporarily inside the constructor, so beware if you extend this class.- Returns:
- the computation.
-
getLastSuccessfulBuild
-
getLastStableBuild
-
getLastFailedBuild
-
checkRename
- Overrides:
checkRenamein classAbstractFolder<I extends TopLevelItem>
-
getOrphanedItemStrategy
-
getOrphanedItemStrategyDescriptors
@Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) @NonNull public List<OrphanedItemStrategyDescriptor> getOrphanedItemStrategyDescriptors()Gets theOrphanedItemStrategyDescriptors applicable to this folder.- Returns:
- the
OrphanedItemStrategyDescriptors applicable to this folder.
-
openEventsChildObserver()