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
,Loadable
,ModelObjectWithChildren
,ModelObjectWithContextMenu
,TriggeredItem
,OnMaster
,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.RunListenerImpl
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
Nested classes/interfaces inherited from interface org.kohsuke.stapler.HttpDeletable
org.kohsuke.stapler.HttpDeletable.HttpDeletableDispatcher
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, reloadingThis
Fields inherited from class hudson.model.AbstractItem
description, displayName, name, PRONOUN, SKIP_PERMISSION_CHECK, TASK_NOUN
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addTrigger
(Trigger trigger) Update an existing trigger or add a new one.void
protected void
checkRename
(String newName) protected abstract void
computeChildren
(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.HttpResponse
doBuild
(TimeDuration delay) void
doConfigSubmit
(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) URL binding and other purposes.protected File
long
Gets theOrphanedItemStrategyDescriptor
s applicable to this folder.protected final String
Where user will be redirected after creating or reconfiguring aAbstractFolder
.boolean
protected void
init()
boolean
Whether it is permissible to recompute this folder at this time.boolean
Is this folder disabled.boolean
Identifies if thisComputedFolder
has a separate out of band events log.void
void
protected final ChildObserver<I>
Opens a newChildObserver
that 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 void
recalculateAfterSubmitted
(boolean recalculate) Method for child classes to use if they want to suppress/confirm the automatic recalculation provided indoConfigSubmit(StaplerRequest, StaplerResponse)
.void
removeTrigger
(Trigger trigger) Remove an existing trigger.boolean
scheduleBuild
(int quietPeriod, Cause c) boolean
scheduleBuild2
(int quietPeriod, Action... actions) protected void
setDisabled
(boolean disabled) Sets the folder as disabled.void
setOrphanedItemStrategy
(OrphanedItemStrategy strategy) protected void
submit
(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) boolean
Determines whether the folder supports being made disabled.Methods inherited from class com.cloudbees.hudson.plugins.folder.AbstractFolder
addLoadedChild, addProperty, addView, canDelete, deleteView, doChildrenContextMenu, doCreateView, doDisable, doEnable, doLastBuild, doSubmitDescription, doViewExistsCheck, getAllJobs, getBuildHealth, getBuildHealthReports, getDescriptor, getFolderViews, getHealthMetrics, getIcon, 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, setPrimaryView
Methods inherited from class hudson.model.AbstractItem
delete, delete, delete, doCheckNewName, doConfigDotXml, doConfigDotXml, doConfirmRename, doDoDelete, doDoDelete, doReload, doSetName, doSubmitDescription, 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, writeReplace
Methods inherited from class hudson.model.Actionable
addAction, addOrReplaceAction, doContextMenu, doContextMenu, getAction, getAction, getActions, getAllActions, getDynamic, getDynamic, removeAction, removeActions, replaceAction, replaceActions
Methods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, requirePOST, sendError, sendError, sendError, 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, getACL, 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, getDisplayName, getFullDisplayName, getFullName, getName, getParent, getRelativeNameFrom, getRelativeNameFrom, getShortUrl, getUrl, onCopiedFrom, save
Methods inherited from interface hudson.model.ItemGroup
allItems, allItems, allItems, getAllItems, getAllItems, getAllItems, getFullDisplayName, getFullName, getItemsStream, getItemsStream, getUrl
Methods inherited from interface jenkins.model.ModelObjectWithChildren
doChildrenContextMenu
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
getDisplayName, 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
-
ComputedFolder
-
-
Method Details
-
init
protected void init()- Overrides:
init
in classAbstractFolder<I extends TopLevelItem>
-
onCreatedFromScratch
public void onCreatedFromScratch()- Specified by:
onCreatedFromScratch
in interfaceItem
-
onLoad
Description copied from class:AbstractFolder
- Specified by:
onLoad
in interfaceItem
- Overrides:
onLoad
in 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 aInterruptedException
if 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 anIOException
during 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 aChildObserver
that subclasses can use when handling events that might create new / update existing child items. The handling of orphaned items is a responsibility of theOrphanedItemStrategy
which is only applied as part of a full computation.- Returns:
- a
ChildObserver
for event handling.
-
openEventsChildObserver
Opens a newChildObserver
that subclasses can use when handling events that might create new / update existing child items. The handling of orphaned items is a responsibility of theOrphanedItemStrategy
which is only applied as part of a full computation.- Returns:
- a
ChildObserver
for 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:
isDisabled
in classAbstractFolder<I extends TopLevelItem>
- Returns:
true
if and only if the folder is disabled.- See Also:
-
setDisabled
protected void setDisabled(boolean disabled) Sets the folder as disabled.- Overrides:
setDisabled
in classAbstractFolder<I extends TopLevelItem>
- Parameters:
disabled
-true
if and only if the folder is to be disabled.
-
supportsMakeDisabled
public boolean supportsMakeDisabled()Determines whether the folder supports being made disabled.- Overrides:
supportsMakeDisabled
in classAbstractFolder<I extends TopLevelItem>
- Returns:
true
if and only ifAbstractFolder.setDisabled(boolean)
is implemented
-
doConfigSubmit
public void doConfigSubmit(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException, Descriptor.FormException - Overrides:
doConfigSubmit
in classAbstractFolder<I extends TopLevelItem>
- Throws:
IOException
javax.servlet.ServletException
Descriptor.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(StaplerRequest, StaplerResponse)
. This method should only be called fromsubmit(StaplerRequest, StaplerResponse)
. If called multiple times fromsubmit(StaplerRequest, StaplerResponse)
then all calls must be with thefalse
parameter to suppress recalculation.- Parameters:
recalculate
-true
to require recalculation,false
to suppress recalculation.- See Also:
-
submit
protected void submit(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException, Descriptor.FormException - Overrides:
submit
in classAbstractFolder<I extends TopLevelItem>
- Throws:
IOException
javax.servlet.ServletException
Descriptor.FormException
- See Also:
-
getSuccessfulDestination
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @NonNull protected final String getSuccessfulDestination()Where user will be redirected after creating or reconfiguring aAbstractFolder
.- Overrides:
getSuccessfulDestination
in classAbstractFolder<I extends TopLevelItem>
- Returns:
- A string that represents the redirect location URL.
- See Also:
-
HttpServletResponse.sendRedirect(String)
-
getTriggers
- Specified by:
getTriggers
in 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:
getActions
in classActionable
-
isBuildable
@Exported public boolean isBuildable()Whether it is permissible to recompute this folder at this time.- Returns:
true
if 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 asParametersAction
orCauseAction
- 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:
scheduleBuild
in interfaceBuildableItem
-
scheduleBuild
- Specified by:
scheduleBuild
in interfaceBuildableItem
-
getCauseOfBlockage
- Specified by:
getCauseOfBlockage
in interfaceQueue.Task
-
checkAbortPermission
public void checkAbortPermission()- Specified by:
checkAbortPermission
in interfaceQueue.Task
-
hasAbortPermission
public boolean hasAbortPermission()- Specified by:
hasAbortPermission
in interfaceQueue.Task
-
getAssignedLabel
- Specified by:
getAssignedLabel
in interfaceSubTask
-
getLastBuiltOn
- Specified by:
getLastBuiltOn
in interfaceSubTask
-
getEstimatedDuration
public long getEstimatedDuration()- Specified by:
getEstimatedDuration
in interfaceSubTask
-
createExecutable
- Specified by:
createExecutable
in interfaceSubTask
- Throws:
IOException
-
createComputation
@NonNull protected FolderComputation<I> createComputation(@CheckForNull FolderComputation<I> previous) -
getComputationDir
-
isHasEvents
public boolean isHasEvents()Identifies if thisComputedFolder
has 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:
true
if thisComputedFolder
has a separate out of band events log.
-
getComputation
URL binding and other purposes. It may benull
temporarily inside the constructor, so beware if you extend this class.- Returns:
- the computation.
-
getLastSuccessfulBuild
-
getLastStableBuild
-
getLastFailedBuild
-
checkRename
- Overrides:
checkRename
in classAbstractFolder<I extends TopLevelItem>
-
getOrphanedItemStrategy
-
getOrphanedItemStrategyDescriptors
@Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) @NonNull public List<OrphanedItemStrategyDescriptor> getOrphanedItemStrategyDescriptors()Gets theOrphanedItemStrategyDescriptor
s applicable to this folder.- Returns:
- the
OrphanedItemStrategyDescriptor
s applicable to this folder.
-
openEventsChildObserver()