Interface ContentFilter

  • All Superinterfaces:
    All Known Implementing Classes:
    ContentMapping, InetAddressContentFilter, NoneFilter, SensitiveContentFilter

    public interface ContentFilter
    extends ExtensionPoint
    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 {
       } catch (IOException e) {
       try (BulkChange change = new BulkChange(ContentFilter.bulkChangeTarget())) {
    • Field Detail

      • ALL

        static final ContentFilter ALL
        Provides a ContentFilter that combines all registered ContentFilter extensions.
      • NONE

        static final ContentFilter NONE
        Provides a noop ContentFilter that pass through the value.
    • Method Detail

      • filter

        String filter​(@NonNull
                      String input)
        Filters a line or snippet of text.
        input - input data to filter
        the filtered input data
      • ensureLoaded

        default void ensureLoaded()
        use reload() instead
        Ensure 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

        static String filter​(@NonNull
                             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.
        filter - the filter to use when filtering
        text - the text to filter
        the text filtered if it is not empty and the filter is not null
      • reloadAndSaveMappings

        static void reloadAndSaveMappings​(@NonNull
                                          ContentFilter filter)
                                   throws IOException
        Reloads the state of this filter and commit .
        IOException - if reload or saving failed