Class IndexNaming

java.lang.Object
ai.attackframework.tools.burp.utils.IndexNaming

public final class IndexNaming extends Object
Maps between logical index keys and the concrete names used for OpenSearch and file export.

Index names are derived from one global base template. The default base is "attackframework-tool-burp", which produces these default names: attackframework-tool-burp-exporter, ...-findings, ...-settings, ...-sitemap, and ...-traffic.

  • Field Details

  • Method Details

    • indexKeys

      public static List<String> indexKeys()
      Returns the supported logical index keys in display/order-stable form.
    • indexNameForShortName

      public static String indexNameForShortName(String shortName)
      Returns the default concrete index name for the given short name.
    • defaultTemplateForShortName

      public static String defaultTemplateForShortName(String shortName, String baseTemplate)
      Returns the default template for the given short name using the provided base template.
    • configuredTemplateForShortName

      public static String configuredTemplateForShortName(ConfigState.State state, String shortName)
      Returns the configured template for the given logical index key.
    • resolveConfiguredIndexName

      public static String resolveConfiguredIndexName(ConfigState.State state, String shortName, Instant instant)
      Resolves the configured template for one logical index key at the provided instant.
    • resolveAllConfiguredNames

      public static IndexNaming.ResolutionResult resolveAllConfiguredNames(ConfigState.State state, Instant instant)
      Resolves every configured logical index name at the provided instant and validates them.

      Errors include invalid date/time placeholders, unsupported variable syntax, and invalid OpenSearch index names.

    • requireKnownIndexKey

      public static String requireKnownIndexKey(String indexName)
      Returns the logical key only for default or legacy index names that can be safely inferred.

      Custom configured index names are intentionally rejected so callers do not silently misroute field filtering, stats, or retry accounting by guessing from a physical name.

      Throws:
      IllegalArgumentException - when the provided name is not one of the known default or legacy index names
    • displayNameForIndexKey

      public static String displayNameForIndexKey(String indexKey)
      Returns the user-facing display name for one logical index key.
    • computeSelectedIndexKeys

      public static List<String> computeSelectedIndexKeys(List<String> selectedSources)
      Returns the logical index keys required by the selected sources.

      Unsupported source names are ignored. The Exporter index is included only when the exporter source is selected.

    • computeIndexBaseNames

      public static List<String> computeIndexBaseNames(List<String> selectedSources)
      Returns the default concrete index names required by the selected sources.
    • toJsonFileNames

      public static List<String> toJsonFileNames(List<String> baseNames)
      Returns .json mapping-file names for the provided index base names.
    • toExportFileNames

      public static List<String> toExportFileNames(List<String> baseNames, boolean jsonlEnabled, boolean bulkNdjsonEnabled)
      Returns export data file names for the selected on-disk formats.
    • normalizeBaseTemplate

      public static String normalizeBaseTemplate(String template)
      Normalizes the stored global base template and falls back to the default when blank.
    • resolveTemplate

      public static String resolveTemplate(String template, Instant instant)
      Replaces supported date/time variables in the provided template.
    • validateResolvedName

      public static String validateResolvedName(String resolvedName)
      Returns a human-readable validation error, or null when the resolved name is valid.
    • validateBaseTemplateDetailed

      public static IndexNaming.BaseTemplateValidation validateBaseTemplateDetailed(String baseTemplate, Instant instant)
      Validates the global base template against the concrete index names it would produce.

      Blank input is treated as valid because the UI falls back to the default base template. Non-blank values must resolve into valid OpenSearch index names after the fixed suffix for each logical index is appended.

    • validateBaseTemplate

      public static String validateBaseTemplate(String baseTemplate, Instant instant)
      Returns a human-readable validation error for the global base template, or null.