public class XMLConfigurator extends Object
| Modifier and Type | Field and Description |
|---|---|
private Schema |
configurationSchema
Schema used to validate configruation files.
|
private Logger |
log
Class logger.
|
private net.shibboleth.utilities.java.support.xml.BasicParserPool |
parserPool
Pool of parsers used to read and validate configurations.
|
private XMLObjectProviderRegistry |
registry
The provider registry instance to use.
|
static String |
XMLTOOLING_CONFIG_NS
Configuration namespace.
|
static String |
XMLTOOLING_CONFIG_PREFIX
Configuration namespace prefix.
|
static String |
XMLTOOLING_DEFAULT_OBJECT_PROVIDER
Name of the object provider used for objects that don't have a registered object provider.
|
static String |
XMLTOOLING_SCHEMA_LOCATION
Location, on the classpath, of the XMLTooling configuration schema.
|
| Constructor and Description |
|---|
XMLConfigurator()
Constructor.
|
| Modifier and Type | Method and 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)
Intializes the object providers defined in the configuration file.
|
void |
load(Document configuration)
Loads the configuration document.
|
protected void |
load(Element configurationRoot)
Loads a configuration after it's been schema validated.
|
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.
|
protected void |
validateConfiguration(Document configuration)
Schema validates the given configuration.
|
@Nonnull @NotEmpty public static final String XMLTOOLING_CONFIG_NS
@Nonnull @NotEmpty public static final String XMLTOOLING_CONFIG_PREFIX
@Nonnull @NotEmpty public static final String XMLTOOLING_DEFAULT_OBJECT_PROVIDER
@Nonnull @NotEmpty public static final String XMLTOOLING_SCHEMA_LOCATION
private net.shibboleth.utilities.java.support.xml.BasicParserPool parserPool
private Schema configurationSchema
@Nonnull private final XMLObjectProviderRegistry registry
public XMLConfigurator()
throws XMLConfigurationException
XMLConfigurationException - thrown if the validation schema for configuration files cannot be createdpublic void load(@Nullable File configurationFile) throws XMLConfigurationException
configurationFile - the configuration file(s) to be loadedXMLConfigurationException - thrown if the configuration file(s) cannot be read or invalidpublic void load(@Nonnull InputStream configurationStream) throws XMLConfigurationException
configurationStream - configuration streamXMLConfigurationException - thrown if the given configuration is invalid or cannot be readpublic void load(@Nonnull Document configuration) throws XMLConfigurationException
configuration - the configurationd documentXMLConfigurationException - thrown if the configuration file(s) cannot be read or invalidprotected void load(@Nonnull Element configurationRoot) throws XMLConfigurationException
configurationRoot - root of the configurationXMLConfigurationException - thrown if there is a problem processing the configurationprotected void initializeObjectProviders(Element objectProviders) throws XMLConfigurationException
objectProviders - the configuration for the various object providersXMLConfigurationException - thrown if the configuration elements are invalidprotected void initializeIDAttributes(Element idAttributesElement) throws XMLConfigurationException
idAttributesElement - the IDAttributes element from the configuration fileXMLConfigurationException - thrown if there is a problem with a parsing or registering the the ID attributeprotected Object createClassInstance(Element configuration) throws XMLConfigurationException
configuration - the current configuration elementXMLConfigurationException - thrown if the class can not be instaniatedprotected void validateConfiguration(Document configuration) throws XMLConfigurationException
configuration - the configuration to validateXMLConfigurationException - thrown if the configuration is not schema-validprotected XMLObjectProviderRegistry getRegistry()
Copyright © 1999–2014. All rights reserved.