Class ManagedConfiguration

    • Constructor Detail

      • ManagedConfiguration

        public ManagedConfiguration​(@Nonnull
                                    ConfigurationManager configurationManager)
        Configuration manager constructor.
        Parameters:
        configurationManager - The manager for loading and saving the configuration.
        Throws:
        java.lang.NullPointerException - if the given configuration manager null.
      • ManagedConfiguration

        public ManagedConfiguration​(@Nonnull
                                    ConfigurationManager configurationManager,
                                    @Nullable
                                    Configuration parentConfiguration)
        Configuration manager and parent configuration constructor.
        Parameters:
        configurationManager - The manager for loading and saving the configuration.
        parentConfiguration - The parent configuration to use for fallback lookup, or null if there is no parent configuration.
        Throws:
        java.lang.NullPointerException - if the given configuration manager null.
    • Method Detail

      • getConfigurationManager

        protected ConfigurationManager getConfigurationManager()
        Returns:
        The associated configuration manager.
      • isStale

        protected boolean isStale​(@Nullable
                                  Parameters parameters)
                           throws java.io.IOException
        Determines if the current configuration stale.

        This method also calls ConfigurationManager.isStale(Parameters).

        Parameters:
        parameters - The current parameters as last known, or null if the configuration is not loaded.
        Returns:
        true if the given parameters are stale and need to be reloaded.
        Throws:
        java.io.IOException - if there is an I/O exception checking to see if the current configuration is stale.
      • reload

        public Configuration reload()
                             throws java.io.IOException,
                                    ConfigurationException
        Reloads the managed configuration.

        The configuration is invalidated using invalidate() and the configuration manager is asked to reload the configuration.

        This may be called at any time to manually reload refresh the configuration information, but normally consumers never need to call this directly, as the configuration is managed automatically.

        Returns:
        The freshly reloaded configuration.
        Throws:
        java.io.IOException - if an I/O error occurs loading the configuration.
        ConfigurationException - If there is invalid data or invalid state preventing the configuration from being loaded.