Class AbstractFolderDescriptor
java.lang.Object
hudson.model.Descriptor<TopLevelItem>
hudson.model.TopLevelItemDescriptor
com.cloudbees.hudson.plugins.folder.AbstractFolderDescriptor
- Direct Known Subclasses:
Folder.DescriptorImpl
Category of
AbstractFolder
.- Since:
- 4.11-beta-1
-
Nested Class Summary
Nested classes/interfaces inherited from class hudson.model.Descriptor
Descriptor.FormException, Descriptor.PropertyType, Descriptor.Self
-
Field Summary
Fields inherited from class hudson.model.Descriptor
clazz
-
Constructor Summary
ModifierConstructorDescriptionprotected
Default constructor.protected
AbstractFolderDescriptor
(Class<? extends AbstractFolder> clazz) Explicit constructor. -
Method Summary
Modifier and TypeMethodDescription<I extends TopLevelItem>
ChildNameGenerator<AbstractFolder<I>,I> Folders, especially computed folders, may have requirements for using a different on-disk file name for child items than the url-segment name.doCheckDisplayNameOrNull
(AbstractFolder folder, String value) Needed if it wants AbstractFolderDescriptor implementations are categorized in Jenkins 2.x.Health metrics that can be configured for this type ofAbstractFolder
subtype.Gets theFolderIconDescriptor
s applicable for this folder type.Needed if it wants Folder are categorized in Jenkins 2.x.Properties that can be configured for this type ofAbstractFolder
subtype.boolean
boolean
isLookAndFeelConfigurable
(AbstractFolder<?> folder) boolean
Methods inherited from class hudson.model.TopLevelItemDescriptor
all, checkApplicableIn, doCheckDisplayNameOrNull, getDescription, getIconFilePath, isApplicable, isApplicableIn, newInstance, newInstance, newInstance, testInstance
Methods inherited from class hudson.model.Descriptor
addHelpFileRedirect, bindJSON, bindJSON, calcAutoCompleteSettings, calcFillSettings, configure, configure, configure, doHelp, doHelp, find, find, findByDescribableClassName, findById, getCategory, getCheckMethod, getCheckUrl, getConfigFile, getConfigPage, getCurrentDescriptorByNameUrl, getDescriptorFullUrl, getDescriptorUrl, getGlobalConfigPage, getGlobalPropertyType, getHelpFile, getHelpFile, getHelpFile, getId, getJsonSafeClassName, getKlass, getPlugin, getPossibleViewNames, getPropertyType, getPropertyType, getPropertyTypeOrDie, getRequiredGlobalConfigPagePermission, getStaticHelpUrl, getStaticHelpUrl, getT, getViewPage, isInstance, isSubTypeOf, load, newInstance, newInstance, newInstancesFromHeteroList, newInstancesFromHeteroList, newInstancesFromHeteroList, newInstancesFromHeteroList, save, self, toArray, toList, toMap
-
Constructor Details
-
AbstractFolderDescriptor
Explicit constructor.- Parameters:
clazz
- the explicitAbstractFolder
sub-class that this descriptor is for.- See Also:
-
AbstractFolderDescriptor
protected AbstractFolderDescriptor()Default constructor.- See Also:
-
-
Method Details
-
getDisplayName
- Overrides:
getDisplayName
in classTopLevelItemDescriptor
-
getCategoryId
Needed if it wants AbstractFolderDescriptor implementations are categorized in Jenkins 2.x. TODO rather moveNestedProjectsCategory
here- Overrides:
getCategoryId
in classTopLevelItemDescriptor
- Returns:
- A string it represents a ItemCategory identifier.
-
getPropertyDescriptors
Properties that can be configured for this type ofAbstractFolder
subtype.- Returns:
- the property descriptors.
-
getHealthMetricDescriptors
Health metrics that can be configured for this type ofAbstractFolder
subtype.- Returns:
- the health metric descriptors.
-
getIconDescriptors
Gets theFolderIconDescriptor
s applicable for this folder type.- Returns:
- the icon descriptors.
- Since:
- 5.14
-
doCheckDisplayNameOrNull
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public FormValidation doCheckDisplayNameOrNull(@AncestorInPath AbstractFolder folder, @QueryParameter String value) -
getIconFilePathPattern
Needed if it wants Folder are categorized in Jenkins 2.x.- Overrides:
getIconFilePathPattern
in classTopLevelItemDescriptor
- Returns:
- A string it represents a URL pattern to get the Item icon in different sizes.
-
getIconClassName
- Specified by:
getIconClassName
in interfaceIconSpec
- Overrides:
getIconClassName
in classTopLevelItemDescriptor
-
isIconConfigurable
public boolean isIconConfigurable() -
isTabBarConfigurable
public boolean isTabBarConfigurable() -
isLookAndFeelConfigurable
-
childNameGenerator
@NonNull public <I extends TopLevelItem> ChildNameGenerator<AbstractFolder<I>,I> childNameGenerator()Folders, especially computed folders, may have requirements for using a different on-disk file name for child items than the url-segment name. Typically this is to work around filesystem naming rules. Regular folders typically would leave the naming of child items toProjectNamingStrategy
and thereby prevent users from creating child items with names that do not comply with theProjectNamingStrategy
.However,
ComputedFolder
instances may not have that luxury. The children of aComputedFolder
may have names that come from an external system and the matching item must be created, always. The obvious solution is that theComputedFolder
should mangle the suppliedItem.getName()
but the side-effect is that the URLs of the child items will now be mangled. Additionally the filename requirements can be rather onerous. Here is the most portable list of filename specification:- Assume case insensitive
- Assume no filename can be longer than 32 characters
- Assume that only the characters
A-Za-z0-9_.-
are available - Assume that there are some special reserved names such as
.
and..
- Assume that there are some problematic names to avoid such as
AUX
,CON
,NUL
, etc. See Microsoft's page on "Naming Files, Paths, and Namespaces" (What's that you say, "Oh but we only run on Linux", perhaps but users may want to migrate from one OS to an other by moving theirJENKINS_HOME
(or even parts of it) so if you are mangling names, be sure to ensure that the mangled name is the same on all OSes - NFC vs. NFD may be a concern as different filesystems
apply different rules and normalization to the filenames. This is primarily a concern when migrating from
before having a
ChildNameGenerator
to having aChildNameGenerator
as the migration will require inference of the un-mangled name from the filesystem, which may or may not match the un-mangled name from the source of the computation. Now POSIX does not specify how the filesystem is supposed to handle encoding of filenames and there can be strange behaviours, e.g.File.listFiles()
is rumoured to always return NFC on OS-X
ChildNameGenerator
at least allows anAbstractFolder
to apply an on-disk naming strategy that differs from the names used for the URLs.If you implement a
ChildNameGenerator
it is strongly recommended to return a singleton for performance reasons.- Type Parameters:
I
- A wildcard parameter to assist type matching.- Returns:
- a (ideally singleton) instance of
ChildNameGenerator
for all instances of the concreteAbstractFolder
class ornull
if no name mangling will be performed. - Since:
- 5.17
-