use of org.springframework.beans.factory.xml.BeanDefinitionParserDelegate in project grails-core by grails.
the class BeanBuilder method createDynamicElementReader.
protected DynamicElementReader createDynamicElementReader(String namespace, final boolean decorator) {
NamespaceHandler handler = namespaceHandlers.get(namespace);
ParserContext parserContext = new ParserContext(readerContext, new BeanDefinitionParserDelegate(readerContext));
final DynamicElementReader dynamicElementReader = new DynamicElementReader(namespace, namespaces, handler, parserContext) {
@Override
protected void afterInvocation() {
if (!decorator) {
currentBeanConfig = null;
}
}
};
dynamicElementReader.setClassLoader(classLoader);
if (currentBeanConfig != null) {
dynamicElementReader.setBeanConfiguration(currentBeanConfig);
} else if (!decorator) {
currentBeanConfig = new DefaultBeanConfiguration(namespace);
dynamicElementReader.setBeanConfiguration(currentBeanConfig);
}
dynamicElementReader.setBeanDecorator(decorator);
return dynamicElementReader;
}
use of org.springframework.beans.factory.xml.BeanDefinitionParserDelegate 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);
}
}
use of org.springframework.beans.factory.xml.BeanDefinitionParserDelegate in project spring-framework by spring-projects.
the class GroovyBeanDefinitionReader method createDynamicElementReader.
private GroovyDynamicElementReader createDynamicElementReader(String namespace) {
XmlReaderContext readerContext = this.groovyDslXmlBeanDefinitionReader.createReaderContext(new DescriptiveResource("Groovy"));
BeanDefinitionParserDelegate delegate = new BeanDefinitionParserDelegate(readerContext);
boolean decorating = (this.currentBeanDefinition != null);
if (!decorating) {
this.currentBeanDefinition = new GroovyBeanDefinitionWrapper(namespace);
}
return new GroovyDynamicElementReader(namespace, this.namespaces, delegate, this.currentBeanDefinition, decorating) {
@Override
protected void afterInvocation() {
if (!this.decorating) {
currentBeanDefinition = null;
}
}
};
}
Aggregations