Package org.opensaml.core.xml.config

# Class XMLConfigurator

java.lang.Object
org.opensaml.core.xml.config.XMLConfigurator

public class XMLConfigurator extends Object
Reads in an XML configuration and configures the XMLTooling library accordingly.

## Field Summary

Fields
Modifier and Type
Field
Description
`private Schema`
`configurationSchema`
Schema used to validate configuration files.
`private final org.slf4j.Logger`
`log`
Class logger.
`private BasicParserPool`
`parserPool`
Pool of parsers used to read and validate configurations.
`private final XMLObjectProviderRegistry`
`registry`
The provider registry instance to use.
`static final String`
`XMLTOOLING_CONFIG_NS`
Configuration namespace.
`static final String`
`XMLTOOLING_CONFIG_PREFIX`
Configuration namespace prefix.
`static final String`
`XMLTOOLING_DEFAULT_OBJECT_PROVIDER`
Name of the object provider used for objects that don't have a registered object provider.
`static final String`
`XMLTOOLING_SCHEMA_LOCATION`
Location, on the classpath, of the XMLTooling configuration schema.

## Constructor Summary

Constructors
Constructor
Description
`XMLConfigurator()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`protected Object`
`createClassInstance(Element configuration)`
Constructs an instance of the given class.
`protected XMLObjectProviderRegistry`
`getRegistry()`
Get the XMLObject provider registry instance to use.
`protected void`
`initializeIDAttributes(Element idAttributesElement)`
Registers the global ID attributes specified in the configuration file.
`protected void`
`initializeObjectProviders(Element objectProviders)`
Initializes the object providers defined in the configuration file.
`void`
`load(File configurationFile)`
Loads the configuration file(s) from the given file.
`void`
`load(InputStream configurationStream)`
Loads a configuration file from an input stream.
`void`
`load(Document configuration)`
Loads the configuration document.
`protected void`
`load(Element configurationRoot)`
Loads a configuration after it's been schema validated.
`protected void`
`validateConfiguration(Document configuration)`
Schema validates the given configuration.

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

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

## Field Details

### XMLTOOLING_CONFIG_NS

@Nonnull @NotEmpty public static final String XMLTOOLING_CONFIG_NS
Configuration namespace.

See Also:
  - Constant Field Values

### XMLTOOLING_CONFIG_PREFIX

@Nonnull @NotEmpty public static final String XMLTOOLING_CONFIG_PREFIX
Configuration namespace prefix.

See Also:
  - Constant Field Values

### XMLTOOLING_DEFAULT_OBJECT_PROVIDER

@Nonnull @NotEmpty public static final String XMLTOOLING_DEFAULT_OBJECT_PROVIDER
Name of the object provider used for objects that don't have a registered object provider.

See Also:
  - Constant Field Values

### XMLTOOLING_SCHEMA_LOCATION

@Nonnull @NotEmpty public static final String XMLTOOLING_SCHEMA_LOCATION
Location, on the classpath, of the XMLTooling configuration schema.

See Also:
  - Constant Field Values

### log

@Nonnull private final org.slf4j.Logger log
Class logger.

### parserPool

@Nonnull private BasicParserPool parserPool
Pool of parsers used to read and validate configurations.

### configurationSchema

@Nonnull private Schema configurationSchema
Schema used to validate configuration files.

### registry

@Nonnull private final XMLObjectProviderRegistry registry
The provider registry instance to use.

## Constructor Details

### XMLConfigurator

public XMLConfigurator() throws XMLConfigurationException
Constructor.

Throws:
  `XMLConfigurationException` - thrown if the validation schema for configuration files cannot be created

## Method Details

### load

public void load(@Nullable File configurationFile) throws XMLConfigurationException
Loads the configuration file(s) from the given file. If the file is a directory each file within the directory is loaded.

Parameters:
  `configurationFile` - the configuration file(s) to be loaded
Throws:
  `XMLConfigurationException` - thrown if the configuration file(s) cannot be read or invalid

### load

public void load(@Nonnull InputStream configurationStream) throws XMLConfigurationException
Loads a configuration file from an input stream.

Parameters:
  `configurationStream` - configuration stream
Throws:
  `XMLConfigurationException` - thrown if the given configuration is invalid or cannot be read

### load

public void load(@Nonnull Document configuration) throws XMLConfigurationException
Loads the configuration document.

Parameters:
  `configuration` - the configuration document
Throws:
  `XMLConfigurationException` - thrown if the configuration file(s) cannot be read or invalid

### load

protected void load(@Nonnull Element configurationRoot) throws XMLConfigurationException
Loads a configuration after it's been schema validated.

Parameters:
  `configurationRoot` - root of the configuration
Throws:
  `XMLConfigurationException` - thrown if there is a problem processing the configuration

### initializeObjectProviders

protected void initializeObjectProviders(@Nonnull Element objectProviders) throws XMLConfigurationException
Initializes the object providers defined in the configuration file.

Parameters:
  `objectProviders` - the configuration for the various object providers
Throws:
  `XMLConfigurationException` - thrown if the configuration elements are invalid

### initializeIDAttributes

protected void initializeIDAttributes(@Nonnull Element idAttributesElement) throws XMLConfigurationException
Registers the global ID attributes specified in the configuration file.

Parameters:
  `idAttributesElement` - the IDAttributes element from the configuration file
Throws:
  `XMLConfigurationException` - thrown if there is a problem with a parsing or registering the ID attribute

### createClassInstance

@Nonnull protected Object createClassInstance(@Nonnull Element configuration) throws XMLConfigurationException
Constructs an instance of the given class.

Parameters:
  `configuration` - the current configuration element
Returns:
  an instance of the given class
Throws:
  `XMLConfigurationException` - thrown if the class can not be instantiated

### validateConfiguration

protected void validateConfiguration(@Nonnull Document configuration) throws XMLConfigurationException
Schema validates the given configuration.

Parameters:
  `configuration` - the configuration to validate
Throws:
  `XMLConfigurationException` - thrown if the configuration is not schema-valid

### getRegistry

@Nonnull protected XMLObjectProviderRegistry getRegistry()
Get the XMLObject provider registry instance to use.

Returns:
  the registry instance