Class ConfiguratorImpl

java.lang.Object
org.codice.ddf.admin.configurator.impl.ConfiguratorImpl
All Implemented Interfaces:
org.codice.ddf.admin.configurator.Configurator

public class ConfiguratorImpl extends Object implements org.codice.ddf.admin.configurator.Configurator
Transactional orchestrator for persisting configuration changes.

Sequentially processes Operations, committing their changes. If a failure occurs during the processing, a rollback is attempted of those handlers that had already been committed. When the commit() operation completes - either successfully, with a successful rollback, or with a failure to rollback - it returns a OperationReport of the outcome. In the case of rollback failures, callers of this class should inform users of those failures so they may manually intercede.

This class does not guarantee that it can reliably rollback changes in the case of failure. It makes a best-effort to revert changes and reports the outcome.

To use this class, first instantiate then invoke the various methods for feature, bundle, config, etc. updates in the order they should be applied. When all have been completed, call the commit() method to write the changes to the system. The resulting OperationReport will have the outcome.

  • Constructor Summary

    Constructors
    Constructor
    Description
    ConfiguratorImpl(ddf.security.audit.SecurityLogger securityLogger)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    add(org.codice.ddf.admin.configurator.Operation operation)
     
    org.codice.ddf.admin.configurator.OperationReport
    commit(String auditMessage, String... auditParams)
    Sequentially invokes all the Operations, committing their changes.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ConfiguratorImpl

      public ConfiguratorImpl(ddf.security.audit.SecurityLogger securityLogger)
  • Method Details

    • commit

      public org.codice.ddf.admin.configurator.OperationReport commit(String auditMessage, String... auditParams)
      Sequentially invokes all the Operations, committing their changes. If a failure occurs during the processing, a rollback is attempted of those handlers that had already been committed.

      In the case of a successful commit, the SecurityLogger will be invoked to log changes.

      Specified by:
      commit in interface org.codice.ddf.admin.configurator.Configurator
      Parameters:
      auditMessage - In the case of a successful commit, the message to pass to the SecurityLogger
      auditParams - In the case of a successful commit, the optional parameters to pass to the SecurityLogger to be interpolated into the message
      Returns:
      report of the commit status, whether successful, successfully rolled back, or partially rolled back with errors
    • add

      public UUID add(org.codice.ddf.admin.configurator.Operation operation)
      Specified by:
      add in interface org.codice.ddf.admin.configurator.Configurator