Interface Configurable

    • Method Detail

      • configure

        default void configure​(@NotNull
                               @NotNull Map<String,​Object> stormConf,
                               @NotNull
                               @NotNull com.fasterxml.jackson.databind.JsonNode filterParams)
        Called when this filter is being initialized
        Parameters:
        stormConf - The Storm configuration used for the configurable
        filterParams - the filter specific configuration. Never null
      • configure

        default void configure​(@NotNull
                               @NotNull Map<String,​Object> stormConf,
                               @NotNull
                               @NotNull com.fasterxml.jackson.databind.JsonNode filterParams,
                               @NotNull
                               @NotNull String filterName)
        Called when this filter is being initialized
        Parameters:
        stormConf - The Storm configuration used for the configurable
        filterParams - the filter specific configuration. Never null
        filterName - The filter name.
      • createConfiguredInstance

        @NotNull
        static <T extends Configurable> @NotNull List<@NotNull T> createConfiguredInstance​(@NotNull
                                                                                           @NotNull String configName,
                                                                                           @NotNull
                                                                                           @NotNull Class<T> filterClass,
                                                                                           @NotNull
                                                                                           @NotNull Map<String,​Object> stormConf,
                                                                                           @NotNull
                                                                                           @NotNull com.fasterxml.jackson.databind.JsonNode filtersConf)
        Used by classes like URLFilters and ParseFilters to load the configuration of utilized filters from the provided JSON config.

        The functions searches for a childNode in filtersConf with the given configName. If the childNode is found it initializes all elements in the list provided by the filtersConf and initialized them as filterClass.

        The following snippet shows the JSON-Schema for a config file, if the config file does not meet the schema, the function fails.

        
         {
           "$id": "https://stormcrawler.net/schemas/configurable/config",
           "$schema": "https://json-schema.org/draft/2020-12/schema",
           "type": "object",
           "properties": {
             <configName>: {
               "type": "array",
               "contains": {
                 "type": "object",
                 "properties": {
                   "name": {
                     "type": "string",
                     "default": "<unnamed>"
                   },
                   "class": {
                     "type": "string"
                   },
                   "properties": {
                     "type": "array",
                     "default": null
                   }
                 },
                 "required": [
                   "class"
                 ]
               }
             }
           }
         }