Class AbstractFolderDescriptor

java.lang.Object
hudson.model.Descriptor<TopLevelItem>
hudson.model.TopLevelItemDescriptor
com.cloudbees.hudson.plugins.folder.AbstractFolderDescriptor
All Implemented Interfaces:
Saveable, Loadable, OnMaster, IconSpec
Direct Known Subclasses:
Folder.DescriptorImpl

public abstract class AbstractFolderDescriptor extends TopLevelItemDescriptor implements IconSpec
Category of AbstractFolder.
Since:
4.11-beta-1
  • Constructor Details

  • Method Details

    • getDisplayName

      public String getDisplayName()
      Overrides:
      getDisplayName in class TopLevelItemDescriptor
    • getCategoryId

      public String getCategoryId()
      Needed if it wants AbstractFolderDescriptor implementations are categorized in Jenkins 2.x. TODO rather move NestedProjectsCategory here
      Overrides:
      getCategoryId in class TopLevelItemDescriptor
      Returns:
      A string it represents a ItemCategory identifier.
    • getPropertyDescriptors

      public List<AbstractFolderPropertyDescriptor> getPropertyDescriptors()
      Properties that can be configured for this type of AbstractFolder subtype.
      Returns:
      the property descriptors.
    • getHealthMetricDescriptors

      public List<FolderHealthMetricDescriptor> getHealthMetricDescriptors()
      Health metrics that can be configured for this type of AbstractFolder subtype.
      Returns:
      the health metric descriptors.
    • getIconDescriptors

      public List<FolderIconDescriptor> getIconDescriptors()
      Gets the FolderIconDescriptors 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

      public String getIconFilePathPattern()
      Needed if it wants Folder are categorized in Jenkins 2.x.
      Overrides:
      getIconFilePathPattern in class TopLevelItemDescriptor
      Returns:
      A string it represents a URL pattern to get the Item icon in different sizes.
    • getIconClassName

      public String getIconClassName()
      Specified by:
      getIconClassName in interface IconSpec
      Overrides:
      getIconClassName in class TopLevelItemDescriptor
    • isIconConfigurable

      public boolean isIconConfigurable()
    • isTabBarConfigurable

      public boolean isTabBarConfigurable()
    • isLookAndFeelConfigurable

      public boolean isLookAndFeelConfigurable(AbstractFolder<?> folder)
    • 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 to ProjectNamingStrategy and thereby prevent users from creating child items with names that do not comply with the ProjectNamingStrategy.

      However, ComputedFolder instances may not have that luxury. The children of a ComputedFolder may have names that come from an external system and the matching item must be created, always. The obvious solution is that the ComputedFolder should mangle the supplied Item.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 their JENKINS_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 a ChildNameGenerator 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
      The ChildNameGenerator at least allows an AbstractFolder 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 concrete AbstractFolder class or null if no name mangling will be performed.
      Since:
      5.17