com.opensymphony.xwork2.config.impl

## Class DefaultConfiguration

- java.lang.Object
- - com.opensymphony.xwork2.config.impl.DefaultConfiguration

- All Implemented Interfaces:
    Configuration, Serializable

      public class DefaultConfiguration
      extends Object
      implements Configuration

  DefaultConfiguration
  Author:
    Jason Carreira Created Feb 24, 2003 7:38:06 AM
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Container` | `container`
    `protected String` | `defaultFrameworkBeanName`
    `protected Set<String>` | `loadedFileNames`
    `protected static org.apache.logging.log4j.Logger` | `LOG`
    `protected Map<String,PackageConfig>` | `packageContexts`
    `protected RuntimeConfiguration` | `runtimeConfiguration`
    `protected List<UnknownHandlerConfig>` | `unknownHandlerStack`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultConfiguration()`
    `DefaultConfiguration(String defaultBeanName)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addPackageConfig(String name, PackageConfig packageContext)`
    `protected RuntimeConfiguration` | `buildRuntimeConfiguration()` This builds the internal runtime configuration used by Xwork for finding and configuring Actions from the programmatic configuration data structures.
    `protected Container` | `createBootstrapContainer(List<ContainerProvider> providers)`
    `void` | `destroy()` Allows the configuration to clean up any resources used
    `Container` | `getContainer()`
    `Set<String>` | `getLoadedFileNames()`
    `PackageConfig` | `getPackageConfig(String name)`
    `Set<String>` | `getPackageConfigNames()`
    `Map<String,PackageConfig>` | `getPackageConfigs()`
    `RuntimeConfiguration` | `getRuntimeConfiguration()` The current runtime configuration.
    `List<UnknownHandlerConfig>` | `getUnknownHandlerStack()`
    `void` | `rebuildRuntimeConfiguration()`
    `List<PackageProvider>` | `reloadContainer(List<ContainerProvider> providers)` Calls the ConfigurationProviderFactory.getConfig() to tell it to reload the configuration and then calls buildRuntimeConfiguration().
    `PackageConfig` | `removePackageConfig(String packageName)` Removes a package from the the list of packages.
    `protected ActionContext` | `setContext(Container cont)`
    `void` | `setUnknownHandlerStack(List<UnknownHandlerConfig> unknownHandlerStack)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### LOG

          protected static final org.apache.logging.log4j.Logger LOG

    - #### packageContexts

          protected Map<String,PackageConfig> packageContexts

    - #### runtimeConfiguration

          protected RuntimeConfiguration runtimeConfiguration

    - #### container

          protected Container container

    - #### defaultFrameworkBeanName

          protected String defaultFrameworkBeanName

    - #### loadedFileNames

          protected Set<String> loadedFileNames

    - #### unknownHandlerStack

          protected List<UnknownHandlerConfig> unknownHandlerStack

  - ### Constructor Detail

    - #### DefaultConfiguration

          public DefaultConfiguration()

    - #### DefaultConfiguration

          public DefaultConfiguration(String defaultBeanName)

  - ### Method Detail

    - #### getPackageConfig

          public PackageConfig getPackageConfig(String name)

      Specified by:
        `getPackageConfig` in interface `Configuration`

    - #### getUnknownHandlerStack

          public List<UnknownHandlerConfig> getUnknownHandlerStack()

      Specified by:
        `getUnknownHandlerStack` in interface `Configuration`
      Returns:
        list of unknown handlers

    - #### setUnknownHandlerStack

          public void setUnknownHandlerStack(List<UnknownHandlerConfig> unknownHandlerStack)

      Specified by:
        `setUnknownHandlerStack` in interface `Configuration`
      Parameters:
        `unknownHandlerStack` - list of unknown handlers

    - #### getPackageConfigNames

          public Set<String> getPackageConfigNames()

      Specified by:
        `getPackageConfigNames` in interface `Configuration`

    - #### getPackageConfigs

          public Map<String,PackageConfig> getPackageConfigs()

      Specified by:
        `getPackageConfigs` in interface `Configuration`

    - #### getLoadedFileNames

          public Set<String> getLoadedFileNames()

      Specified by:
        `getLoadedFileNames` in interface `Configuration`

    - #### getRuntimeConfiguration

          public RuntimeConfiguration getRuntimeConfiguration()

      Description copied from interface: `Configuration`
      The current runtime configuration. Currently, if changes have been made to the Configuration since the last time buildRuntimeConfiguration() was called, you'll need to make sure to.
      Specified by:
        `getRuntimeConfiguration` in interface `Configuration`
      Returns:
        the current runtime configuration

    - #### getContainer

          public Container getContainer()

      Specified by:
        `getContainer` in interface `Configuration`
      Returns:
        the container

    - #### addPackageConfig

          public void addPackageConfig(String name,
                                       PackageConfig packageContext)

      Specified by:
        `addPackageConfig` in interface `Configuration`

    - #### removePackageConfig

          public PackageConfig removePackageConfig(String packageName)

      Description copied from interface: `Configuration`
      Removes a package from the the list of packages. Changes to the configuration won't take effect until buildRuntimeConfiguration is called.
      Specified by:
        `removePackageConfig` in interface `Configuration`
      Parameters:
        `packageName` - the name of the package to remove
      Returns:
        the package removed (if any)

    - #### destroy

          public void destroy()

      Allows the configuration to clean up any resources used
      Specified by:
        `destroy` in interface `Configuration`

    - #### rebuildRuntimeConfiguration

          public void rebuildRuntimeConfiguration()

      Specified by:
        `rebuildRuntimeConfiguration` in interface `Configuration`

    - #### reloadContainer

          public List<PackageProvider> reloadContainer(List<ContainerProvider> providers)
                                                throws ConfigurationException

      Calls the ConfigurationProviderFactory.getConfig() to tell it to reload the configuration and then calls buildRuntimeConfiguration().
      Specified by:
        `reloadContainer` in interface `Configuration`
      Parameters:
        `providers` - list of ContainerProvider
      Returns:
        list of package providers
      Throws:
        `ConfigurationException` - in case of any configuration errors

    - #### setContext

          protected ActionContext setContext(Container cont)

    - #### createBootstrapContainer

          protected Container createBootstrapContainer(List<ContainerProvider> providers)

    - #### buildRuntimeConfiguration

          protected RuntimeConfiguration buildRuntimeConfiguration()
                                                            throws ConfigurationException

      This builds the internal runtime configuration used by Xwork for finding and configuring Actions from the programmatic configuration data structures. All of the old runtime configuration will be discarded and rebuilt.

      It basically flattens the data structures to make the information easier to access. It will take an `ActionConfig` and combine its data with all inherited dast. For example, if the `ActionConfig` is in a package that contains a global result and it also contains a result, the resulting `ActionConfig` will have two results.

      Returns:
        runtime configuration
      Throws:
        `ConfigurationException` - in case of any configuration errors

Copyright © 2000–2023 Apache Software Foundation. All rights reserved.