Search in sources :

Example 1 with EmptyReaderEventListener

use of org.springframework.beans.factory.parsing.EmptyReaderEventListener in project aries by apache.

the class BlueprintNamespaceHandler method createSpringParserContext.

private org.springframework.beans.factory.xml.ParserContext createSpringParserContext(ParserContext parserContext, DefaultListableBeanFactory registry) {
    try {
        XmlBeanDefinitionReader xbdr = new XmlBeanDefinitionReader(registry);
        Resource resource = new UrlResource(parserContext.getSourceNode().getOwnerDocument().getDocumentURI());
        ProblemReporter problemReporter = new FailFastProblemReporter();
        ReaderEventListener listener = new EmptyReaderEventListener();
        SourceExtractor extractor = new NullSourceExtractor();
        NamespaceHandlerResolver resolver = new SpringNamespaceHandlerResolver(parserContext);
        xbdr.setProblemReporter(problemReporter);
        xbdr.setEventListener(listener);
        xbdr.setSourceExtractor(extractor);
        xbdr.setNamespaceHandlerResolver(resolver);
        XmlReaderContext xmlReaderContext = xbdr.createReaderContext(resource);
        BeanDefinitionParserDelegate bdpd = new BeanDefinitionParserDelegate(xmlReaderContext);
        return new org.springframework.beans.factory.xml.ParserContext(xmlReaderContext, bdpd);
    } catch (Exception e) {
        throw new RuntimeException("Error creating spring parser context", e);
    }
}
Also used : EmptyReaderEventListener(org.springframework.beans.factory.parsing.EmptyReaderEventListener) ProblemReporter(org.springframework.beans.factory.parsing.ProblemReporter) FailFastProblemReporter(org.springframework.beans.factory.parsing.FailFastProblemReporter) NamespaceHandlerResolver(org.springframework.beans.factory.xml.NamespaceHandlerResolver) BeanDefinitionParserDelegate(org.springframework.beans.factory.xml.BeanDefinitionParserDelegate) XmlBeanDefinitionReader(org.springframework.beans.factory.xml.XmlBeanDefinitionReader) UrlResource(org.springframework.core.io.UrlResource) Resource(org.springframework.core.io.Resource) ReaderEventListener(org.springframework.beans.factory.parsing.ReaderEventListener) EmptyReaderEventListener(org.springframework.beans.factory.parsing.EmptyReaderEventListener) XmlReaderContext(org.springframework.beans.factory.xml.XmlReaderContext) FailFastProblemReporter(org.springframework.beans.factory.parsing.FailFastProblemReporter) UrlResource(org.springframework.core.io.UrlResource) ParserContext(org.apache.aries.blueprint.ParserContext) NullSourceExtractor(org.springframework.beans.factory.parsing.NullSourceExtractor) SourceExtractor(org.springframework.beans.factory.parsing.SourceExtractor) NullSourceExtractor(org.springframework.beans.factory.parsing.NullSourceExtractor)

Example 2 with EmptyReaderEventListener

use of org.springframework.beans.factory.parsing.EmptyReaderEventListener in project grails-core by grails.

the class BeanBuilder method initializeBeanBuilderForClassLoader.

protected void initializeBeanBuilderForClassLoader(ClassLoader classLoader) {
    xmlBeanDefinitionReader.setBeanClassLoader(classLoader);
    namespaceHandlerResolver = new DefaultNamespaceHandlerResolver(this.classLoader);
    readerContext = new XmlReaderContext(beanBuildResource, new FailFastProblemReporter(), new EmptyReaderEventListener(), new NullSourceExtractor(), xmlBeanDefinitionReader, namespaceHandlerResolver);
}
Also used : EmptyReaderEventListener(org.springframework.beans.factory.parsing.EmptyReaderEventListener) XmlReaderContext(org.springframework.beans.factory.xml.XmlReaderContext) DefaultNamespaceHandlerResolver(org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver) NullSourceExtractor(org.springframework.beans.factory.parsing.NullSourceExtractor) FailFastProblemReporter(org.springframework.beans.factory.parsing.FailFastProblemReporter)

Aggregations

EmptyReaderEventListener (org.springframework.beans.factory.parsing.EmptyReaderEventListener)2 FailFastProblemReporter (org.springframework.beans.factory.parsing.FailFastProblemReporter)2 NullSourceExtractor (org.springframework.beans.factory.parsing.NullSourceExtractor)2 XmlReaderContext (org.springframework.beans.factory.xml.XmlReaderContext)2 ParserContext (org.apache.aries.blueprint.ParserContext)1 ProblemReporter (org.springframework.beans.factory.parsing.ProblemReporter)1 ReaderEventListener (org.springframework.beans.factory.parsing.ReaderEventListener)1 SourceExtractor (org.springframework.beans.factory.parsing.SourceExtractor)1 BeanDefinitionParserDelegate (org.springframework.beans.factory.xml.BeanDefinitionParserDelegate)1 DefaultNamespaceHandlerResolver (org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver)1 NamespaceHandlerResolver (org.springframework.beans.factory.xml.NamespaceHandlerResolver)1 XmlBeanDefinitionReader (org.springframework.beans.factory.xml.XmlBeanDefinitionReader)1 Resource (org.springframework.core.io.Resource)1 UrlResource (org.springframework.core.io.UrlResource)1