private void addRegistryChangeListener(RegistryListener listener) {
   Registry section = registry.getSection(KEY + ".user");
   if (section != null) {
     section.addChangeListener(listener);
   }
   section = registry.getSection(KEY + ".base");
   if (section != null) {
     section.addChangeListener(listener);
   }
 }
  @PostConstruct
  public void initialize() {

    this.postPolicies = componentContainer.buildMapWithRole(PostDownloadPolicy.class);
    this.prePolicies = componentContainer.buildMapWithRole(PreDownloadPolicy.class);
    this.downloadErrorPolicies = componentContainer.buildMapWithRole(DownloadErrorPolicy.class);
    // Resolve expressions in the userConfigFilename and altConfigFilename
    try {
      ExpressionEvaluator expressionEvaluator = new DefaultExpressionEvaluator();
      expressionEvaluator.addExpressionSource(new SystemPropertyExpressionSource());
      String userConfigFileNameSysProps = System.getProperty("archiva.user.configFileName");
      if (StringUtils.isNotBlank(userConfigFileNameSysProps)) {
        userConfigFilename = userConfigFileNameSysProps;
      } else {
        userConfigFilename = expressionEvaluator.expand(userConfigFilename);
      }
      altConfigFilename = expressionEvaluator.expand(altConfigFilename);
      loadConfiguration();
      handleUpgradeConfiguration();
    } catch (IndeterminateConfigurationException | RegistryException e) {
      throw new RuntimeException("failed during upgrade from previous version" + e.getMessage(), e);
    } catch (EvaluatorException e) {
      throw new RuntimeException(
          "Unable to evaluate expressions found in " + "userConfigFilename or altConfigFilename.",
          e);
    }
    registry.addChangeListener(this);
  }