Class ContentMappings

java.lang.Object
hudson.model.ManagementLink
com.cloudbees.jenkins.support.filter.ContentMappings
All Implemented Interfaces:
ExtensionPoint, Action, ModelObject, Saveable, Iterable<ContentMapping>

@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public class ContentMappings extends ManagementLink implements Saveable, Iterable<ContentMapping>
Holds all anonymized content mappings and provides a management view to see those mappings.
Since:
TODO
  • Method Details

    • get

      public static ContentMappings get()
      Returns:
      the singleton instance
    • newInstance

      @Extension public static ContentMappings newInstance() throws IOException
      Constructs a new ContentMappings using an existing config file or default settings if not found.
      Throws:
      IOException
    • getStopWords

      @NonNull public Set<String> getStopWords()
      Returns:
      the set of stop words to ignore when filtering
    • getMappings

      @NonNull public Map<String,String> getMappings()
      Returns:
      the map of original to replacement values known to this instance
    • getMappingOrCreate

      @NonNull public ContentMapping getMappingOrCreate(@NonNull String original, @NonNull Function<String,ContentMapping> generator)
      Looks up or creates a new ContentMapping for the given original string and a ContentMapping generator.
    • reload

      public void reload()
    • evictStale

      public void evictStale()
      Evicts mappings that have not been touched within the retention window. This method runs after all content has been filtered, so every currently-live and currently-matched mapping has been refreshed via touch().

      Uses computeIfPresent to express the remove-if-stale decision as one map operation. That is not atomic with respect to touch(), which mutates lastSeen in place rather than replacing the map value, so a touch landing between the staleness check and the removal is lost. touchMatched(com.cloudbees.jenkins.support.filter.ContentMapping) covers the case where that matters: a mapping matched in real content is put back if a concurrently generated bundle has already swept it away. Do not rely on the mapping simply being recreated later -- for an item that has been deleted, nothing recreates it.

      Must be called from within a BulkChange so the eviction is persisted.

    • clear

      protected void clear()
    • save

      public void save() throws IOException
      Specified by:
      save in interface Saveable
      Throws:
      IOException
    • iterator

      @NonNull public Iterator<ContentMapping> iterator()
      Specified by:
      iterator in interface Iterable<ContentMapping>
    • forEach

      public void forEach(Consumer<? super ContentMapping> action)
      Specified by:
      forEach in interface Iterable<ContentMapping>
    • spliterator

      public Spliterator<ContentMapping> spliterator()
      Specified by:
      spliterator in interface Iterable<ContentMapping>
    • getIconFileName

      @NonNull public String getIconFileName()
      Specified by:
      getIconFileName in interface Action
      Specified by:
      getIconFileName in class ManagementLink
    • getDisplayName

      @NonNull public String getDisplayName()
      Specified by:
      getDisplayName in interface Action
      Specified by:
      getDisplayName in interface ModelObject
    • getDescription

      public String getDescription()
      Overrides:
      getDescription in class ManagementLink
    • getUrlName

      @NonNull public String getUrlName()
      Specified by:
      getUrlName in interface Action
      Specified by:
      getUrlName in class ManagementLink
    • getCategory

      @NonNull public ManagementLink.Category getCategory()
      Overrides:
      getCategory in class ManagementLink