org.springframework.beans.factory.xml.NamespaceHandlerResolver Java Examples

The following examples show how to use org.springframework.beans.factory.xml.NamespaceHandlerResolver. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BusApplicationContext.java    From cxf with Apache License 2.0 6 votes vote down vote up
public BusApplicationContext(String[] cf, boolean include,
                             ApplicationContext parent, NamespaceHandlerResolver res) {
    super(new String[0], false, parent);
    cfgFiles = cf;
    includeDefaults = include;
    nsHandlerResolver = res;
    try {
        AccessController.doPrivileged(new PrivilegedExceptionAction<Boolean>() {
            public Boolean run() throws Exception {
                refresh();
                return Boolean.TRUE;
            }

        });
    } catch (PrivilegedActionException e) {
        if (e.getException() instanceof RuntimeException) {
            throw (RuntimeException)e.getException();
        }
        throw new Fault(e);
    }
}
 
Example #2
Source File: BusApplicationContext.java    From cxf with Apache License 2.0 6 votes vote down vote up
public BusApplicationContext(URL[] url, boolean include,
                             ApplicationContext parent,
                             NamespaceHandlerResolver res) {
    super(new String[0], false, parent);
    cfgFileURLs = url;
    includeDefaults = include;
    nsHandlerResolver = res;
    try {
        AccessController.doPrivileged(new PrivilegedExceptionAction<Boolean>() {
            public Boolean run() throws Exception {
                refresh();
                return Boolean.TRUE;
            }

        });
    } catch (PrivilegedActionException e) {
        if (e.getException() instanceof RuntimeException) {
            throw (RuntimeException)e.getException();
        }
        throw new Fault(e);
    }
}
 
Example #3
Source File: CustomNamespaceHandlerTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Before
public void setUp() throws Exception {
	NamespaceHandlerResolver resolver = new DefaultNamespaceHandlerResolver(CLASS.getClassLoader(), NS_PROPS);
	this.beanFactory = new GenericApplicationContext();
	XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(this.beanFactory);
	reader.setNamespaceHandlerResolver(resolver);
	reader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_XSD);
	reader.setEntityResolver(new DummySchemaResolver());
	reader.loadBeanDefinitions(getResource());
	this.beanFactory.refresh();
}
 
Example #4
Source File: CustomNamespaceHandlerTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Before
public void setUp() throws Exception {
	NamespaceHandlerResolver resolver = new DefaultNamespaceHandlerResolver(CLASS.getClassLoader(), NS_PROPS);
	this.beanFactory = new GenericApplicationContext();
	XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(this.beanFactory);
	reader.setNamespaceHandlerResolver(resolver);
	reader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_XSD);
	reader.setEntityResolver(new DummySchemaResolver());
	reader.loadBeanDefinitions(getResource());
	this.beanFactory.refresh();
}
 
Example #5
Source File: CustomNamespaceHandlerTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
	NamespaceHandlerResolver resolver = new DefaultNamespaceHandlerResolver(CLASS.getClassLoader(), NS_PROPS);
	this.beanFactory = new GenericApplicationContext();
	XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(this.beanFactory);
	reader.setNamespaceHandlerResolver(resolver);
	reader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_XSD);
	reader.setEntityResolver(new DummySchemaResolver());
	reader.loadBeanDefinitions(getResource());
	this.beanFactory.refresh();
}
 
Example #6
Source File: SpringBusFactory.java    From cxf with Apache License 2.0 5 votes vote down vote up
private static NamespaceHandlerResolver tryFindNamespaceHandler(ApplicationContext ctx) {
    try {
        SpringBeanLocator sbl = new SpringBeanLocator(ctx);
        List<NamespaceHandlerResolver> r = sbl.getOSGiServices(NamespaceHandlerResolver.class);
        if (r != null && !r.isEmpty()) {
            return r.get(0);
        }
    } catch (Exception t) {
        LOG.log(Level.FINEST, "Could not find NamespaceHandlerResolver",  t);
    }
    return null;
}
 
Example #7
Source File: SpringCamelContextBootstrap.java    From wildfly-camel with Apache License 2.0 5 votes vote down vote up
private void loadBeanDefinitions(Resource resource, ClassLoader classLoader) {
    applicationContext = new GenericApplicationContext();
    applicationContext.setClassLoader(classLoader);
    XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(applicationContext) {
        @Override
        protected NamespaceHandlerResolver createDefaultNamespaceHandlerResolver() {
            NamespaceHandlerResolver defaultResolver = super.createDefaultNamespaceHandlerResolver();
            return new SpringCamelContextBootstrap.CamelNamespaceHandlerResolver(defaultResolver);
        }
    };
    xmlReader.loadBeanDefinitions(resource);
}
 
Example #8
Source File: SpringBusFactory.java    From cxf with Apache License 2.0 4 votes vote down vote up
public SpringBusFactory(NamespaceHandlerResolver r) {
    context = null;
    this.resolver = r;
}
 
Example #9
Source File: SpringBusFactory.java    From cxf with Apache License 2.0 4 votes vote down vote up
public void setNamespaceHandlerResolver(NamespaceHandlerResolver r) {
    resolver = r;
}
 
Example #10
Source File: SpringCamelContextBootstrap.java    From wildfly-camel with Apache License 2.0 4 votes vote down vote up
CamelNamespaceHandlerResolver(NamespaceHandlerResolver delegate) {
    this.delegate = delegate;
    this.camelHandler = new CamelNamespaceHandler();
    this.camelHandler.init();
}