Package org.opensaml.core.xml.config
Class XMLConfigurator
java.lang.Object
org.opensaml.core.xml.config.XMLConfigurator
Reads in an XML configuration and configures the XMLTooling library accordingly.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Schema
Schema used to validate configuration files.private final org.slf4j.Logger
Class logger.private BasicParserPool
Pool of parsers used to read and validate configurations.private final XMLObjectProviderRegistry
The provider registry instance to use.static final String
Configuration namespace.static final String
Configuration namespace prefix.static final String
Name of the object provider used for objects that don't have a registered object provider.static final String
Location, on the classpath, of the XMLTooling configuration schema. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Object
createClassInstance
(Element configuration) Constructs an instance of the given class.protected XMLObjectProviderRegistry
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
Loads the configuration file(s) from the given file.void
load
(InputStream configurationStream) Loads a configuration file from an input stream.void
Loads the configuration document.protected void
Loads a configuration after it's been schema validated.protected void
validateConfiguration
(Document configuration) Schema validates the given configuration.
-
Field Details
-
XMLTOOLING_CONFIG_NS
Configuration namespace.- See Also:
-
XMLTOOLING_CONFIG_PREFIX
Configuration namespace prefix.- See Also:
-
XMLTOOLING_DEFAULT_OBJECT_PROVIDER
Name of the object provider used for objects that don't have a registered object provider.- See Also:
-
XMLTOOLING_SCHEMA_LOCATION
Location, on the classpath, of the XMLTooling configuration schema.- See Also:
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
parserPool
Pool of parsers used to read and validate configurations. -
configurationSchema
Schema used to validate configuration files. -
registry
The provider registry instance to use.
-
-
Constructor Details
-
XMLConfigurator
Constructor.- Throws:
XMLConfigurationException
- thrown if the validation schema for configuration files cannot be created
-
-
Method Details
-
load
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
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
Loads the configuration document.- Parameters:
configuration
- the configuration document- Throws:
XMLConfigurationException
- thrown if the configuration file(s) cannot be read or invalid
-
load
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
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
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
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
Schema validates the given configuration.- Parameters:
configuration
- the configuration to validate- Throws:
XMLConfigurationException
- thrown if the configuration is not schema-valid
-
getRegistry
Get the XMLObject provider registry instance to use.- Returns:
- the registry instance
-