当前位置: 首页>>代码示例>>Java>>正文


Java NamespaceHandler类代码示例

本文整理汇总了Java中org.springframework.beans.factory.xml.NamespaceHandler的典型用法代码示例。如果您正苦于以下问题:Java NamespaceHandler类的具体用法?Java NamespaceHandler怎么用?Java NamespaceHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


NamespaceHandler类属于org.springframework.beans.factory.xml包,在下文中一共展示了NamespaceHandler类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: resolve

import org.springframework.beans.factory.xml.NamespaceHandler; //导入依赖的package包/类
public NamespaceHandler resolve(String namespaceUri) {
	boolean trace = log.isTraceEnabled();

	for (Iterator<Map.Entry<NamespaceHandlerResolver, String>> iterator = resolvers.entrySet().iterator(); iterator.hasNext();) {
		Map.Entry<NamespaceHandlerResolver, String> entry = iterator.next();
		NamespaceHandlerResolver handlerResolver = entry.getKey();
		if (trace)
			log.trace("Trying to resolve namespace [" + namespaceUri + "] through resolver " + entry.getValue());
		NamespaceHandler handler = handlerResolver.resolve(namespaceUri);

		String resolvedMsg = (handler != null ? "" : "not ");
		if (trace)
			log.trace("Namespace [" + namespaceUri + "] was " + resolvedMsg + "resolved through handler resolver "
					+ entry.getValue());

		if (handler != null) {
			return handler;
		}

	}
	return null;
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:23,代码来源:DelegatedNamespaceHandlerResolver.java

示例2: decorateIfRequired

import org.springframework.beans.factory.xml.NamespaceHandler; //导入依赖的package包/类
public static BeanDefinitionHolder decorateIfRequired(Node node, BeanDefinitionHolder originalDef,
		ParserContext parserContext) {

	String namespaceUri = node.getNamespaceURI();
	if (!parserContext.getDelegate().isDefaultNamespace(namespaceUri) && !isRFC124Namespace(namespaceUri)) {
		NamespaceHandler handler =
				parserContext.getReaderContext().getNamespaceHandlerResolver().resolve(namespaceUri);
		if (handler != null) {
			return handler.decorate(node, originalDef, new ParserContext(parserContext.getReaderContext(),
					parserContext.getDelegate()));
		} else if (namespaceUri.startsWith("http://www.springframework.org/")) {
			parserContext.getReaderContext().error(
					"Unable to locate Spring NamespaceHandler for XML schema namespace [" + namespaceUri + "]",
					node);
		} else {
			// A custom namespace, not to be handled by Spring - maybe "xml:...".
		}
	}
	return originalDef;
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:21,代码来源:ParsingUtils.java

示例3: xmlns

import org.springframework.beans.factory.xml.NamespaceHandler; //导入依赖的package包/类
/**
 * 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);
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:GroovyBeanDefinitionReader.java

示例4: xmlns

import org.springframework.beans.factory.xml.NamespaceHandler; //导入依赖的package包/类
/**
 * 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);
		}
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:23,代码来源:GroovyBeanDefinitionReader.java

示例5: xmlns

import org.springframework.beans.factory.xml.NamespaceHandler; //导入依赖的package包/类
/**
 * 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);
		}
	}
}
 
开发者ID:txazo,项目名称:spring,代码行数:23,代码来源:GroovyBeanDefinitionReader.java

示例6: resolve

import org.springframework.beans.factory.xml.NamespaceHandler; //导入依赖的package包/类
public NamespaceHandler resolve(String namespaceUri) {
	boolean trace = log.isTraceEnabled();

	for (Iterator iterator = resolvers.entrySet().iterator(); iterator.hasNext();) {
		Map.Entry entry = (Map.Entry) iterator.next();
		NamespaceHandlerResolver handlerResolver = (NamespaceHandlerResolver) entry.getKey();
		if (trace)
			log.trace("Trying to resolve namespace [" + namespaceUri + "] through resolver " + entry.getValue());
		NamespaceHandler handler = handlerResolver.resolve(namespaceUri);

		String resolvedMsg = (handler != null ? "" : "not ");
		if (trace)
			log.trace("Namespace [" + namespaceUri + "] was " + resolvedMsg + "resolved through handler resolver "
					+ entry.getValue());

		if (handler != null) {
			return handler;
		}

	}
	return null;
}
 
开发者ID:BeamFoundry,项目名称:spring-osgi,代码行数:23,代码来源:DelegatedNamespaceHandlerResolver.java

示例7: resolve

import org.springframework.beans.factory.xml.NamespaceHandler; //导入依赖的package包/类
public NamespaceHandler resolve(final String namespaceUri) {
	if (System.getSecurityManager() != null) {
		return AccessController.doPrivileged(new PrivilegedAction<NamespaceHandler>() {

			public NamespaceHandler run() {
				return doResolve(namespaceUri);
			}
		});

	} else {
		return doResolve(namespaceUri);
	}
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:14,代码来源:NamespacePlugins.java

示例8: testCanResolveNamespaceFromBundleAfterAddingPlugin

import org.springframework.beans.factory.xml.NamespaceHandler; //导入依赖的package包/类
public void testCanResolveNamespaceFromBundleAfterAddingPlugin() throws IOException, SAXException {
	Bundle b = new MockBundle();
	this.namespacePlugins.addPlugin(b, false, true);
	NamespaceHandler handler = this.namespacePlugins.resolve("http://www.springframework.org/schema/testme");
	assertNotNull("should find handler", handler);
	assertTrue("should be TestHandler", handler instanceof TestHandler);
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:8,代码来源:NamespacePluginsTest.java

示例9: testResolvedMappedHandler

import org.springframework.beans.factory.xml.NamespaceHandler; //导入依赖的package包/类
@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());
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:8,代码来源:DefaultNamespaceHandlerResolverTests.java

示例10: testResolvedMappedHandlerWithNoArgCtor

import org.springframework.beans.factory.xml.NamespaceHandler; //导入依赖的package包/类
@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());
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:8,代码来源:DefaultNamespaceHandlerResolverTests.java

示例11: resolve

import org.springframework.beans.factory.xml.NamespaceHandler; //导入依赖的package包/类
public NamespaceHandler resolve(final String namespaceUri) {
	if (System.getSecurityManager() != null) {
		return (NamespaceHandler) AccessController.doPrivileged(new PrivilegedAction() {

			public Object run() {
				return doResolve(namespaceUri);
			}
		});

	}
	else {
		return doResolve(namespaceUri);
	}
}
 
开发者ID:BeamFoundry,项目名称:spring-osgi,代码行数:15,代码来源:NamespacePlugins.java

示例12: doResolve

import org.springframework.beans.factory.xml.NamespaceHandler; //导入依赖的package包/类
private NamespaceHandler doResolve(String namespaceUri) {
	boolean debug = log.isDebugEnabled();

	if (debug)
		log.debug("Trying to resolving namespace handler for " + namespaceUri);

	for (Iterator i = plugins.values().iterator(); i.hasNext();) {
		Plugin plugin = (Plugin) i.next();
		try {
			NamespaceHandler handler = plugin.resolve(namespaceUri);
			if (handler != null) {
				if (debug)
					log.debug("Namespace handler for " + namespaceUri + " found inside "
							+ OsgiStringUtils.nullSafeNameAndSymName(plugin.getBundle()));

				return handler;
			}
		}
		catch (IllegalArgumentException ex) {
			if (debug)
				log.debug("Namespace handler for " + namespaceUri + " not found inside "
						+ OsgiStringUtils.nullSafeNameAndSymName(plugin.getBundle()));

		}
	}
	return null;
}
 
开发者ID:BeamFoundry,项目名称:spring-osgi,代码行数:28,代码来源:NamespacePlugins.java

示例13: testCanResolveNamespaceFromBundleAfterAddingPlugin

import org.springframework.beans.factory.xml.NamespaceHandler; //导入依赖的package包/类
public void testCanResolveNamespaceFromBundleAfterAddingPlugin() throws IOException, SAXException {
	Bundle b = new MockBundle();
	this.namespacePlugins.addHandler(b);
	NamespaceHandler handler = this.namespacePlugins.resolve("http://www.springframework.org/schema/testme");
	assertNotNull("should find handler", handler);
	assertTrue("should be TestHandler", handler instanceof TestHandler);
}
 
开发者ID:BeamFoundry,项目名称:spring-osgi,代码行数:8,代码来源:NamespacePluginsTest.java

示例14: resolve

import org.springframework.beans.factory.xml.NamespaceHandler; //导入依赖的package包/类
@Override
public NamespaceHandler resolve(String namespaceUri) {
    if ("http://camel.apache.org/schema/spring".equals(namespaceUri)) {
        return camelHandler;
    } else {
        return delegate.resolve(namespaceUri);
    }
}
 
开发者ID:wildfly-extras,项目名称:wildfly-camel,代码行数:9,代码来源:SpringCamelContextBootstrap.java


注:本文中的org.springframework.beans.factory.xml.NamespaceHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。