Interface ContentFilter
- All Superinterfaces:
ExtensionPoint
- All Known Implementing Classes:
ContentMapping
,InetAddressContentFilter
,NoneFilter
,SensitiveContentFilter
Provides a strategy to filter support bundle written contents. This is primarily useful to anonymize data written
to the bundle, though more complex filtering can be achieved.
A
ContentFilter
may produce ContentMappings
during reload()
and
filter(String)
that are automatically persisted. It is therefore important to use
BulkChange
when reloading the filter as well as when launching a task that performs the filtering:
ContentFilter filter = ContentFilter.ALL;
try {
ContentFilter.reloadAndSaveMappings(filter);
} catch (IOException e) {
...
}
[...]
try (BulkChange change = new BulkChange(ContentFilter.bulkChangeTarget())) {
doSomething(filter);
change.commit();
}
- Since:
- TODO
-
Nested Class Summary
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
Field Summary
Modifier and TypeFieldDescriptionstatic final ContentFilter
Provides a ContentFilter that combines all registered ContentFilter extensions.static final ContentFilter
Provides a noop ContentFilter that pass through the value. -
Method Summary
Modifier and TypeMethodDescriptionstatic ExtensionList<ContentFilter>
all()
static Saveable
Return the target forBulkChange
.default void
Deprecated.use reload() insteadstatic String
filter
(ContentFilter filter, String text) An utility method to filter a text only when both, the filter and the text are not null and the text is not empty too.Filters a line or snippet of text.default void
reload()
Reloads the state of this filter.static void
reloadAndSaveMappings
(ContentFilter filter) Reloads the state of this filter and commit .
-
Field Details
-
ALL
Provides a ContentFilter that combines all registered ContentFilter extensions. -
NONE
Provides a noop ContentFilter that pass through the value.
-
-
Method Details
-
all
- Returns:
- all ContentFilter extensions
-
filter
Filters a line or snippet of text.- Parameters:
input
- input data to filter- Returns:
- the filtered input data
-
ensureLoaded
Deprecated.use reload() insteadEnsure that the filter has been loaded at least once. -
reload
default void reload()Reloads the state of this filter. This may be implemented to rescan for more items to filter. -
filter
An utility method to filter a text only when both, the filter and the text are not null and the text is not empty too.- Parameters:
filter
- the filter to use when filteringtext
- the text to filter- Returns:
- the text filtered if it is not empty and the filter is not null
-
bulkChangeTarget
Return the target forBulkChange
.- Returns:
- a
Saveable
-
reloadAndSaveMappings
Reloads the state of this filter and commit .- Throws:
IOException
- if reload or saving failed
-