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

The following examples show how to use org.springframework.beans.factory.xml.NamespaceHandler. 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: GroovyBeanDefinitionReader.java    From spring-analysis-note with MIT License 6 votes vote down vote up
/**
 * Define a Spring XML namespace definition to use.
 * @param definition the namespace definition
 */
public void xmlns(Map<String, String> definition) {
	if (!definition.isEmpty()) {
		for (Map.Entry<String,String> entry : definition.entrySet()) {
			String namespace = entry.getKey();
			String uri = entry.getValue();
			if (uri == null) {
				throw new IllegalArgumentException("Namespace definition must supply a non-null URI");
			}
			NamespaceHandler namespaceHandler =
					this.groovyDslXmlBeanDefinitionReader.getNamespaceHandlerResolver().resolve(uri);
			if (namespaceHandler == null) {
				throw new BeanDefinitionParsingException(new Problem("No namespace handler found for URI: " + uri,
						new Location(new DescriptiveResource(("Groovy")))));
			}
			this.namespaces.put(namespace, uri);
		}
	}
}
 
Example #2
Source File: GroovyBeanDefinitionReader.java    From java-technology-stack with MIT License 6 votes vote down vote up
/**
 * Define a Spring XML namespace definition to use.
 * @param definition the namespace definition
 */
public void xmlns(Map<String, String> definition) {
	if (!definition.isEmpty()) {
		for (Map.Entry<String,String> entry : definition.entrySet()) {
			String namespace = entry.getKey();
			String uri = entry.getValue();
			if (uri == null) {
				throw new IllegalArgumentException("Namespace definition must supply a non-null URI");
			}
			NamespaceHandler namespaceHandler =
					this.groovyDslXmlBeanDefinitionReader.getNamespaceHandlerResolver().resolve(uri);
			if (namespaceHandler == null) {
				throw new BeanDefinitionParsingException(new Problem("No namespace handler found for URI: " + uri,
						new Location(new DescriptiveResource(("Groovy")))));
			}
			this.namespaces.put(namespace, uri);
		}
	}
}
 
Example #3
Source File: GroovyBeanDefinitionReader.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Define a Spring XML namespace definition to use.
 * @param definition the namespace definition
 */
public void xmlns(Map<String, String> definition) {
	if (!definition.isEmpty()) {
		for (Map.Entry<String,String> entry : definition.entrySet()) {
			String namespace = entry.getKey();
			String uri = entry.getValue();
			if (uri == null) {
				throw new IllegalArgumentException("Namespace definition must supply a non-null URI");
			}
			NamespaceHandler namespaceHandler =
					this.groovyDslXmlBeanDefinitionReader.getNamespaceHandlerResolver().resolve(uri);
			if (namespaceHandler == null) {
				throw new BeanDefinitionParsingException(new Problem("No namespace handler found for URI: " + uri,
						new Location(new DescriptiveResource(("Groovy")))));
			}
			this.namespaces.put(namespace, uri);
		}
	}
}
 
Example #4
Source File: GroovyBeanDefinitionReader.java    From blog_demos with Apache License 2.0 6 votes vote down vote up
/**
 * Define a Spring namespace definition to use.
 * @param definition the namespace definition
 */
public void xmlns(Map<String, String> definition) {
	if (!definition.isEmpty()) {
		for (Map.Entry<String,String> entry : definition.entrySet()) {
			String namespace = entry.getKey();
			String uri = entry.getValue();
			if (uri == null) {
				throw new IllegalArgumentException("Namespace definition must supply a non-null URI");
			}
			NamespaceHandler namespaceHandler = this.xmlBeanDefinitionReader.getNamespaceHandlerResolver().resolve(uri);
			if (namespaceHandler == null) {
				throw new BeanDefinitionParsingException(new Problem("No namespace handler found for URI: " + uri,
						new Location(new DescriptiveResource(("Groovy")))));
			}
			this.namespaces.put(namespace, uri);
		}
	}
}
 
Example #5
Source File: GroovyBeanDefinitionReader.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
/**
 * Define a Spring XML namespace definition to use.
 * @param definition the namespace definition
 */
public void xmlns(Map<String, String> definition) {
	if (!definition.isEmpty()) {
		for (Map.Entry<String,String> entry : definition.entrySet()) {
			String namespace = entry.getKey();
			String uri = entry.getValue();
			if (uri == null) {
				throw new IllegalArgumentException("Namespace definition must supply a non-null URI");
			}
			NamespaceHandler namespaceHandler = this.groovyDslXmlBeanDefinitionReader.getNamespaceHandlerResolver().resolve(
				uri);
			if (namespaceHandler == null) {
				throw new BeanDefinitionParsingException(new Problem("No namespace handler found for URI: " + uri,
						new Location(new DescriptiveResource(("Groovy")))));
			}
			this.namespaces.put(namespace, uri);
		}
	}
}
 
Example #6
Source File: DefaultNamespaceHandlerResolverTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void testResolvedMappedHandler() {
	DefaultNamespaceHandlerResolver resolver = new DefaultNamespaceHandlerResolver(getClass().getClassLoader());
	NamespaceHandler handler = resolver.resolve("http://www.springframework.org/schema/util");
	assertNotNull("Handler should not be null.", handler);
	assertEquals("Incorrect handler loaded", UtilNamespaceHandler.class, handler.getClass());
}
 
Example #7
Source File: DefaultNamespaceHandlerResolverTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void testResolvedMappedHandlerWithNoArgCtor() {
	DefaultNamespaceHandlerResolver resolver = new DefaultNamespaceHandlerResolver();
	NamespaceHandler handler = resolver.resolve("http://www.springframework.org/schema/util");
	assertNotNull("Handler should not be null.", handler);
	assertEquals("Incorrect handler loaded", UtilNamespaceHandler.class, handler.getClass());
}
 
Example #8
Source File: DefaultNamespaceHandlerResolverTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void testResolvedMappedHandler() {
	DefaultNamespaceHandlerResolver resolver = new DefaultNamespaceHandlerResolver(getClass().getClassLoader());
	NamespaceHandler handler = resolver.resolve("http://www.springframework.org/schema/util");
	assertNotNull("Handler should not be null.", handler);
	assertEquals("Incorrect handler loaded", UtilNamespaceHandler.class, handler.getClass());
}
 
Example #9
Source File: DefaultNamespaceHandlerResolverTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void testResolvedMappedHandlerWithNoArgCtor() {
	DefaultNamespaceHandlerResolver resolver = new DefaultNamespaceHandlerResolver();
	NamespaceHandler handler = resolver.resolve("http://www.springframework.org/schema/util");
	assertNotNull("Handler should not be null.", handler);
	assertEquals("Incorrect handler loaded", UtilNamespaceHandler.class, handler.getClass());
}
 
Example #10
Source File: DefaultNamespaceHandlerResolverTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void testResolvedMappedHandler() {
	DefaultNamespaceHandlerResolver resolver = new DefaultNamespaceHandlerResolver(getClass().getClassLoader());
	NamespaceHandler handler = resolver.resolve("http://www.springframework.org/schema/util");
	assertNotNull("Handler should not be null.", handler);
	assertEquals("Incorrect handler loaded", UtilNamespaceHandler.class, handler.getClass());
}
 
Example #11
Source File: DefaultNamespaceHandlerResolverTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void testResolvedMappedHandlerWithNoArgCtor() {
	DefaultNamespaceHandlerResolver resolver = new DefaultNamespaceHandlerResolver();
	NamespaceHandler handler = resolver.resolve("http://www.springframework.org/schema/util");
	assertNotNull("Handler should not be null.", handler);
	assertEquals("Incorrect handler loaded", UtilNamespaceHandler.class, handler.getClass());
}
 
Example #12
Source File: SpringCamelContextBootstrap.java    From wildfly-camel with Apache License 2.0 5 votes vote down vote up
@Override
public NamespaceHandler resolve(String namespaceUri) {
    if ("http://camel.apache.org/schema/spring".equals(namespaceUri)) {
        return camelHandler;
    } else {
        return delegate.resolve(namespaceUri);
    }
}