org.opensaml.xml
Class XMLConfigurator

java.lang.Object
  extended by org.opensaml.xml.XMLConfigurator

public class XMLConfigurator
extends Object

Reads in an XML configuration and configures the XMLTooling library accordingly.


Field Summary
private  Schema configurationSchema
          Schema used to validate configruation files.
private  Logger log
          Class logger.
private  BasicParserPool parserPool
          Pool of parsers used to read and validate configurations.
private  boolean retainXMLConfiguration
          Whether the XML configuration elements that configured object providers should be retained.
 
Constructor Summary
XMLConfigurator()
          Constructor.
XMLConfigurator(boolean retainXML)
          Deprecated. this method will be removed once Configuration no longer has the option to store the XML configuration fragements
 
Method Summary
protected  Object createClassInstance(Element configuration)
          Constructs an instance of the given class.
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.
protected  void initializeValidatorSuites(Element validatorSuitesElement)
          Initializes the validator suites specified in the configuration file.
 void load(Document configuration)
          Loads the configuration docuement.
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private final Logger log
Class logger.


retainXMLConfiguration

private boolean retainXMLConfiguration
Whether the XML configuration elements that configured object providers should be retained.


parserPool

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


configurationSchema

private Schema configurationSchema
Schema used to validate configruation files.

Constructor Detail

XMLConfigurator

public XMLConfigurator()
                throws ConfigurationException
Constructor.

Throws:
ConfigurationException - thrown if the validation schema for configuration files can not be created

XMLConfigurator

public XMLConfigurator(boolean retainXML)
                throws ConfigurationException
Deprecated. this method will be removed once Configuration no longer has the option to store the XML configuration fragements

Constructor.

Parameters:
retainXML - whether to retain the XML configuration elements within the Configuration.
Throws:
ConfigurationException - thrown if the validation schema for configuration files can not be created
Method Detail

load

public void load(File configurationFile)
          throws ConfigurationException
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:
ConfigurationException - thrown if the configuration file(s) can not be be read or invalid

load

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

Parameters:
configurationStream - configuration stream
Throws:
ConfigurationException - thrown if the given configuration is invalid or can not be read

load

public void load(Document configuration)
          throws ConfigurationException
Loads the configuration docuement.

Parameters:
configuration - the configurationd document
Throws:
ConfigurationException - thrown if the configuration file(s) can not be be read or invalid

load

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

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

initializeObjectProviders

protected void initializeObjectProviders(Element objectProviders)
                                  throws ConfigurationException
Intializes the object providers defined in the configuration file.

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

initializeValidatorSuites

protected void initializeValidatorSuites(Element validatorSuitesElement)
                                  throws ConfigurationException
Initializes the validator suites specified in the configuration file.

Parameters:
validatorSuitesElement - the ValidatorSuites element from the configuration file
Throws:
ConfigurationException - thrown if there is a problem initializing the validator suites, usually because of malformed elements

initializeIDAttributes

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

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

createClassInstance

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

Parameters:
configuration - the current configuration element
Returns:
an instance of the given class
Throws:
ConfigurationException - thrown if the class can not be instaniated

validateConfiguration

protected void validateConfiguration(Document configuration)
                              throws ConfigurationException
Schema validates the given configuration.

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


Copyright © 1999-2013. All Rights Reserved.