Search in sources :

Example 1 with InitializationException

use of org.opensaml.core.config.InitializationException in project cas by apereo.

the class OpenSamlConfigBean method init.

/**
     * Initialize opensaml.
     */
@PostConstruct
public void init() {
    LOGGER.info("Initializing OpenSaml configuration...");
    Assert.notNull(this.parserPool, "parserPool must not be null");
    try {
        InitializationService.initialize();
    } catch (final InitializationException e) {
        throw new RuntimeException("Exception initializing OpenSAML", e);
    }
    XMLObjectProviderRegistry registry;
    synchronized (ConfigurationService.class) {
        registry = ConfigurationService.get(XMLObjectProviderRegistry.class);
        if (registry == null) {
            LOGGER.debug("XMLObjectProviderRegistry did not exist in ConfigurationService, will be created");
            registry = new XMLObjectProviderRegistry();
            ConfigurationService.register(XMLObjectProviderRegistry.class, registry);
        }
    }
    registry.setParserPool(this.parserPool);
    this.builderFactory = registry.getBuilderFactory();
    Assert.notNull(this.builderFactory, "parserPool cannot be null");
    this.marshallerFactory = registry.getMarshallerFactory();
    Assert.notNull(this.marshallerFactory, "marshallerFactory cannot be null");
    this.unmarshallerFactory = registry.getUnmarshallerFactory();
    Assert.notNull(this.unmarshallerFactory, "unmarshallerFactory cannot be null");
    LOGGER.debug("Initialized OpenSaml successfully.");
}
Also used : XMLObjectProviderRegistry(org.opensaml.core.xml.config.XMLObjectProviderRegistry) ConfigurationService(org.opensaml.core.config.ConfigurationService) InitializationException(org.opensaml.core.config.InitializationException) PostConstruct(javax.annotation.PostConstruct)

Aggregations

PostConstruct (javax.annotation.PostConstruct)1 ConfigurationService (org.opensaml.core.config.ConfigurationService)1 InitializationException (org.opensaml.core.config.InitializationException)1 XMLObjectProviderRegistry (org.opensaml.core.xml.config.XMLObjectProviderRegistry)1