Class ConfigurationUpdater

java.lang.Object
org.codice.ddf.admin.configuration.ConfigurationUpdater
All Implemented Interfaces:
org.codice.felix.cm.internal.ConfigurationPersistencePlugin

public class ConfigurationUpdater extends Object implements org.codice.felix.cm.internal.ConfigurationPersistencePlugin
Addresses shortcomings of the Felix ConfigInstaller with our own implementation that properly updates the etc directory.

This configuration installer handles writeback like the Felix one did and does a few other things:

  • Removes files from etc when they are deleted from ConfigurationAdmin
  • Protects against tampering with the felix.fileinstall.filename by third parties, which could disrupt the dropping of config files
  • Ensures password fields in config files are encrypted
Handling writeback means running this class handles the updating of dropped-in config files in the etc directory. To keep Felix itself from disrupting this process, enableConfigSave in custom.properties should be set to false.
  • Constructor Details

    • ConfigurationUpdater

      public ConfigurationUpdater(org.codice.ddf.admin.core.api.ConfigurationAdmin ddfConfigAdmin, List strategies, ddf.security.encryption.EncryptionService encryptionService)
  • Method Details

    • initialize

      public void initialize(Set<org.codice.felix.cm.internal.ConfigurationContext> state)
      Specified by:
      initialize in interface org.codice.felix.cm.internal.ConfigurationPersistencePlugin
    • handleStore

      public final void handleStore(org.codice.felix.cm.internal.ConfigurationContext context) throws IOException
      Specified by:
      handleStore in interface org.codice.felix.cm.internal.ConfigurationPersistencePlugin
      Throws:
      IOException
    • handleDelete

      public final void handleDelete(String pid) throws IOException

      Remove config files from etc when a delete occurs but only if felix is tracking the file.

      Specified by:
      handleDelete in interface org.codice.felix.cm.internal.ConfigurationPersistencePlugin
      Parameters:
      pid - the pid pointing to the configuration to delete.
      Throws:
      IOException
    • setSecurityLogger

      public void setSecurityLogger(ddf.security.audit.SecurityLogger securityLogger)