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 Details

    • XMLTOOLING_CONFIG_NS

      @Nonnull @NotEmpty public static final String XMLTOOLING_CONFIG_NS
      Configuration namespace.
      See Also:
    • XMLTOOLING_CONFIG_PREFIX

      @Nonnull @NotEmpty public static final String XMLTOOLING_CONFIG_PREFIX
      Configuration namespace prefix.
      See Also:
    • 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:
    • XMLTOOLING_SCHEMA_LOCATION

      @Nonnull @NotEmpty public static final String XMLTOOLING_SCHEMA_LOCATION
      Location, on the classpath, of the XMLTooling configuration schema.
      See Also:
    • log

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

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

      private Schema configurationSchema
      Schema used to validate configuration files.
    • registry

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

  • 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(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(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

      protected Object createClassInstance(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(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

      protected XMLObjectProviderRegistry getRegistry()
      Get the XMLObject provider registry instance to use.
      Returns:
      the registry instance