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
-
Nested Class Summary
Nested classes/interfaces inherited from class hudson.model.ManagementLink
ManagementLink.CategoryNested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson -
Field Summary
Fields inherited from class hudson.model.ManagementLink
LIST -
Method Summary
Modifier and TypeMethodDescriptionprotected voidclear()voidEvicts mappings that have not been touched within the retention window.voidforEach(Consumer<? super ContentMapping> action) static ContentMappingsget()getMappingOrCreate(String original, Function<String, ContentMapping> generator) Looks up or creates a new ContentMapping for the given original string and a ContentMapping generator.iterator()static ContentMappingsConstructs a new ContentMappings using an existing config file or default settings if not found.voidreload()voidsave()Methods inherited from class hudson.model.ManagementLink
all, getBadge, getCategoryName, getRequiredPermission, getRequiresConfirmation, getRequiresPOST
-
Method Details
-
get
- Returns:
- the singleton instance
-
newInstance
Constructs a new ContentMappings using an existing config file or default settings if not found.- Throws:
IOException
-
getStopWords
- Returns:
- the set of stop words to ignore when filtering
-
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 viatouch().Uses
computeIfPresentto express the remove-if-stale decision as one map operation. That is not atomic with respect totouch(), which mutateslastSeenin 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
BulkChangeso the eviction is persisted. -
clear
protected void clear() -
save
- Specified by:
savein interfaceSaveable- Throws:
IOException
-
iterator
- Specified by:
iteratorin interfaceIterable<ContentMapping>
-
forEach
- Specified by:
forEachin interfaceIterable<ContentMapping>
-
spliterator
- Specified by:
spliteratorin interfaceIterable<ContentMapping>
-
getIconFileName
- Specified by:
getIconFileNamein interfaceAction- Specified by:
getIconFileNamein classManagementLink
-
getDisplayName
- Specified by:
getDisplayNamein interfaceAction- Specified by:
getDisplayNamein interfaceModelObject
-
getDescription
- Overrides:
getDescriptionin classManagementLink
-
getUrlName
- Specified by:
getUrlNamein interfaceAction- Specified by:
getUrlNamein classManagementLink
-
getCategory
- Overrides:
getCategoryin classManagementLink
-