Class DefaultOrphanedItemStrategy
- java.lang.Object
-
- hudson.model.AbstractDescribableImpl<OrphanedItemStrategy>
-
- com.cloudbees.hudson.plugins.folder.computed.OrphanedItemStrategy
-
- com.cloudbees.hudson.plugins.folder.computed.DefaultOrphanedItemStrategy
-
- All Implemented Interfaces:
ExtensionPoint
,Describable<OrphanedItemStrategy>
public class DefaultOrphanedItemStrategy extends OrphanedItemStrategy
The defaultOrphanedItemStrategy
. Trims dead items by the # of days or the # of builds much likeLogRotator
.- Author:
- Stephen Connolly
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DefaultOrphanedItemStrategy.DescriptorImpl
OurDescriptor
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Constructor Summary
Constructors Constructor Description DefaultOrphanedItemStrategy(boolean pruneDeadBranches, int daysToKeep, int numToKeep)
Programmatic constructor.DefaultOrphanedItemStrategy(boolean pruneDeadBranches, String daysToKeepStr, String numToKeepStr)
Stapler's constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getDaysToKeep()
Gets the number of days to keep dead branches.String
getDaysToKeepStr()
Returns the number of days to keep dead branches.int
getNumToKeep()
Gets the number of dead branches to keep.String
getNumToKeepStr()
Gets the number of dead branches to keep.boolean
isAbortBuilds()
Returnstrue
if pending or ongoing should be aborted.boolean
isPruneDeadBranches()
Returnstrue
if dead branches should be removed.<I extends TopLevelItem>
Collection<I>orphanedItems(ComputedFolder<I> owner, Collection<I> orphaned, TaskListener listener)
parameters and return value as inComputedFolder.orphanedItems(java.util.Collection<I>, hudson.model.TaskListener)
void
setAbortBuilds(boolean abortBuilds)
-
Methods inherited from class com.cloudbees.hudson.plugins.folder.computed.OrphanedItemStrategy
getDescriptor
-
-
-
-
Constructor Detail
-
DefaultOrphanedItemStrategy
@DataBoundConstructor public DefaultOrphanedItemStrategy(boolean pruneDeadBranches, @CheckForNull String daysToKeepStr, @CheckForNull String numToKeepStr)
Stapler's constructor.- Parameters:
pruneDeadBranches
- remove dead branches.daysToKeepStr
- how old a branch must be to remove.numToKeepStr
- how many branches to keep.
-
DefaultOrphanedItemStrategy
public DefaultOrphanedItemStrategy(boolean pruneDeadBranches, int daysToKeep, int numToKeep)
Programmatic constructor.- Parameters:
pruneDeadBranches
- remove dead branches.daysToKeep
- how old a branch must be to remove.numToKeep
- how many branches to keep.
-
-
Method Detail
-
getDaysToKeep
public int getDaysToKeep()
Gets the number of days to keep dead branches.- Returns:
- the number of days to keep dead branches.
-
getNumToKeep
public int getNumToKeep()
Gets the number of dead branches to keep.- Returns:
- the number of dead branches to keep.
-
isPruneDeadBranches
public boolean isPruneDeadBranches()
Returnstrue
if dead branches should be removed.- Returns:
true
if dead branches should be removed.
-
isAbortBuilds
public boolean isAbortBuilds()
Returnstrue
if pending or ongoing should be aborted.- Returns:
true
if pending or ongoing should be aborted.
-
setAbortBuilds
@DataBoundSetter public void setAbortBuilds(boolean abortBuilds)
-
getDaysToKeepStr
@NonNull public String getDaysToKeepStr()
Returns the number of days to keep dead branches.- Returns:
- the number of days to keep dead branches.
-
getNumToKeepStr
@NonNull public String getNumToKeepStr()
Gets the number of dead branches to keep.- Returns:
- the number of dead branches to keep.
-
orphanedItems
public <I extends TopLevelItem> Collection<I> orphanedItems(ComputedFolder<I> owner, Collection<I> orphaned, TaskListener listener) throws IOException, InterruptedException
Description copied from class:OrphanedItemStrategy
parameters and return value as inComputedFolder.orphanedItems(java.util.Collection<I>, hudson.model.TaskListener)
- Specified by:
orphanedItems
in classOrphanedItemStrategy
- Type Parameters:
I
- the type of item.- Parameters:
owner
- the owning folder.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.
-
-