Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.configuration
Class DefaultConfigurationBuilder.FileConfigurationProvider

    java.lang.Object
      org.apache.commons.configuration.beanutils.DefaultBeanFactory
          org.apache.commons.configuration.DefaultConfigurationBuilder.ConfigurationProvider
              org.apache.commons.configuration.DefaultConfigurationBuilder.FileConfigurationProvider

All Implemented Interfaces:
  BeanFactory

Enclosing class:
  DefaultConfigurationBuilder

    public static class DefaultConfigurationBuilder.FileConfigurationProvider

extends DefaultConfigurationBuilder.ConfigurationProvider

A specialized provider implementation that deals with file based configurations. Ensures that the base path is correctly set and that the load() method gets called.

Field Summary

Fields inherited from class org.apache.commons.configuration.beanutils.DefaultBeanFactory
`INSTANCE`

Constructor Summary
`DefaultConfigurationBuilder.FileConfigurationProvider()` Creates a new instance of `FileConfigurationProvider`.
`DefaultConfigurationBuilder.FileConfigurationProvider(Class configClass)` Creates a new instance of `FileConfigurationProvider` and sets the configuration class.
`DefaultConfigurationBuilder.FileConfigurationProvider(String configClassName)` Creates a new instance of `FileConfigurationProvider` and sets the configuration class name.

Method Summary
`AbstractConfiguration` | `getConfiguration(DefaultConfigurationBuilder.ConfigurationDeclaration decl)` Creates the configuration.
`AbstractConfiguration` | `getEmptyConfiguration(DefaultConfigurationBuilder.ConfigurationDeclaration decl)` Returns an uninitialized file configuration.
`protected void` | `initBeanInstance(Object bean, BeanDeclaration data)` Initializes the bean instance.

Methods inherited from class org.apache.commons.configuration.DefaultConfigurationBuilder.ConfigurationProvider
`fetchConfigurationClass, getConfigurationClass, getConfigurationClassName, loadClass, setConfigurationClass, setConfigurationClassName`

Methods inherited from class org.apache.commons.configuration.beanutils.DefaultBeanFactory
`createBean, createBeanInstance, getDefaultBeanClass`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DefaultConfigurationBuilder.FileConfigurationProvider

    public DefaultConfigurationBuilder.FileConfigurationProvider()

  Creates a new instance of `FileConfigurationProvider`.

### DefaultConfigurationBuilder.FileConfigurationProvider

    public DefaultConfigurationBuilder.FileConfigurationProvider(Class configClass)

  Creates a new instance of `FileConfigurationProvider` and sets the configuration class.

  Parameters:
    `configClass` - the class for the configurations to be created

### DefaultConfigurationBuilder.FileConfigurationProvider

    public DefaultConfigurationBuilder.FileConfigurationProvider(String configClassName)

  Creates a new instance of `FileConfigurationProvider` and sets the configuration class name.

  Parameters:
    `configClassName` - the name of the configuration to be created
  Since:
    1.4

Method Detail

### getConfiguration

    public AbstractConfiguration getConfiguration(DefaultConfigurationBuilder.ConfigurationDeclaration decl)
                                           throws Exception

  Creates the configuration. After that `load()` will be called. If this configuration is marked as optional, exceptions will be ignored.

  Overrides:
    `getConfiguration` in class `DefaultConfigurationBuilder.ConfigurationProvider`
  Parameters:
    `decl` - the declaration
  Returns:
    the new configuration
  Throws:
    `Exception` - if an error occurs

### getEmptyConfiguration

    public AbstractConfiguration getEmptyConfiguration(DefaultConfigurationBuilder.ConfigurationDeclaration decl)
                                                throws Exception

  Returns an uninitialized file configuration. This method will be called for optional configurations when the `getConfiguration()` method caused an error and the `forceCreate` attribute is set. It will create the configuration of the represented type, but the `load()` method won't be called. This way non-existing configuration files can be handled gracefully: If loading a the file fails, an empty configuration will be created that is already configured with the correct file name.

  Overrides:
    `getEmptyConfiguration` in class `DefaultConfigurationBuilder.ConfigurationProvider`
  Parameters:
    `decl` - the bean declaration with initialization parameters for the configuration
  Returns:
    the new configuration object
  Throws:
    `Exception` - if an error occurs
  Since:
    1.4

### initBeanInstance

    protected void initBeanInstance(Object bean,
                                    BeanDeclaration data)
                             throws Exception

  Initializes the bean instance. Ensures that the file configuration's base path will be initialized with the base path of the factory so that relative path names can be correctly resolved.

  Overrides:
    `initBeanInstance` in class `DefaultBeanFactory`
  Parameters:
    `bean` - the bean to be initialized
    `data` - the declaration
  Throws:
    `Exception` - if an error occurs

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2007 The Apache Software Foundation. All Rights Reserved.