Interface SettingResourceHandler


public interface SettingResourceHandler
API for something that can handle setting updates via resources, such as external files.

This API can be used with TextAreaSettingSpecifier or FileSettingSpecifier to provide support for configuration from external resources.

Since:
1.70
Version:
1.1
Author:
matt
  • Method Details

    • getSettingUid

      String getSettingUid()
      Get a unique, application-wide setting ID.

      This ID must be unique across all setting resource handlers registered within the system. Generally the implementation will also be a SettingSpecifierProvider for the same ID.

      Returns:
      unique ID
    • supportedCurrentResourceSettingKeys

      default Collection<String> supportedCurrentResourceSettingKeys()
      Get a list of supported setting keys for the currentSettingResources(String) method.
      Returns:
      the set of supported keys
      Since:
      1.1
    • currentSettingResources

      Iterable<org.springframework.core.io.Resource> currentSettingResources(String settingKey)
      Get the current setting resources for a specific key.
      Parameters:
      settingKey - the setting key, generally a KeyedSettingSpecifier.getKey() value
      Returns:
      the resources, never null
    • applySettingResources

      SettingsUpdates applySettingResources(String settingKey, Iterable<org.springframework.core.io.Resource> resources) throws IOException
      Apply settings for a specific key from a resource.

      This method returns a collection of setting values to update as a result of applying the given resources. This provides a way for the handler to generate a list of settings to be persisted elsewhere (for example via a SettingsService.

      Parameters:
      settingKey - the setting key, generally a KeyedSettingSpecifier.getKey() value
      resources - the resources with the settings to apply
      Returns:
      any setting values that should be persisted as a result of applying the given resources (never null
      Throws:
      IOException - if any IO error occurs