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


Java CatalogResolver类代码示例

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


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

示例1: createCatalogResolver

import com.sun.org.apache.xml.internal.resolver.tools.CatalogResolver; //导入依赖的package包/类
/**
 * Creates an instance of catalog resolver.
 * 
 * @return
 * @throws MojoExecutionException
 */
protected CatalogResolver createCatalogResolver() throws MojoExecutionException {
	final CatalogManager catalogManager = new CatalogManager();
	catalogManager.setIgnoreMissingProperties(true);
	catalogManager.setUseStaticCatalog(false);
	// TODO Logging
	if (getLog().isDebugEnabled()) {
		catalogManager.setVerbosity(Integer.MAX_VALUE);
	}
	if (getCatalogResolver() == null) {
		return new MavenCatalogResolver(catalogManager, this, getLog());
	} else {
		final String catalogResolverClassName = getCatalogResolver().trim();
		return createCatalogResolverByClassName(catalogResolverClassName);
	}
}
 
开发者ID:highsource,项目名称:maven-jaxb2-plugin,代码行数:22,代码来源:RawXJC2Mojo.java

示例2: checkReenterability

import com.sun.org.apache.xml.internal.resolver.tools.CatalogResolver; //导入依赖的package包/类
@Test
public void checkReenterability() throws IOException {
	CatalogManager cma = new CatalogManager();
	cma.setIgnoreMissingProperties(true);
	cma.setUseStaticCatalog(false);
	final CatalogResolver cra = new CatalogResolver(cma);
	URL a = getClass().getResource("a/catalog.cat");
	cra.getCatalog().parseCatalog(a);
	InputSource ea = cra.resolveEntity(null,
			"http://www.w3.org/1999/xlink.xsd");
	Assert.assertNotNull(ea);

	CatalogManager cmb = new CatalogManager();
	cmb.setIgnoreMissingProperties(true);
	cmb.setUseStaticCatalog(false);
	final CatalogResolver crb = new CatalogResolver(cmb);
	URL b = getClass().getResource("b/catalog.cat");
	crb.getCatalog().parseCatalog(b);
	InputSource eb = crb.resolveEntity(null,
			"http://www.w3.org/2005/atom-author-link.xsd");
	Assert.assertNotNull(eb);

}
 
开发者ID:highsource,项目名称:maven-jaxb2-plugin,代码行数:24,代码来源:MavenCatalogResolverTest.java

示例3: withConfiguredSimpleCatalogManager

import com.sun.org.apache.xml.internal.resolver.tools.CatalogResolver; //导入依赖的package包/类
private static EntityResolver withConfiguredSimpleCatalogManager() {
	// works on Java 9
	final CatalogManager catalogManager = new CatalogManager();
	catalogManager.setIgnoreMissingProperties(true);
	catalogManager.setUseStaticCatalog(false);
	return new CatalogResolver(catalogManager);
}
 
开发者ID:CodeFX-org,项目名称:java-9-wtf,代码行数:8,代码来源:EntityResolverFactory.java

示例4: workaroundCatalogResolver

import com.sun.org.apache.xml.internal.resolver.tools.CatalogResolver; //导入依赖的package包/类
/**
 *  Default CatalogResolver implementation is broken as it depends on CatalogManager.getCatalog() which will always create a new one when
 *  useStaticCatalog is false.
 *  This returns a CatalogResolver that uses the catalog passed as parameter.
 * @param catalog
 * @return  CatalogResolver
 */
private static CatalogResolver workaroundCatalogResolver(final Catalog catalog) {
    // set up a manager
    CatalogManager manager = new CatalogManager() {
        @Override
        public Catalog getCatalog() {
            return catalog;
        }
    };
    manager.setIgnoreMissingProperties(true);
    // Using static catalog may  result in to sharing of the catalog by multiple apps running in a container
    manager.setUseStaticCatalog(false);

    return new CatalogResolver(manager);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:XmlUtil.java

示例5: createCatalogResolverByClassName

import com.sun.org.apache.xml.internal.resolver.tools.CatalogResolver; //导入依赖的package包/类
private CatalogResolver createCatalogResolverByClassName(final String catalogResolverClassName)
		throws MojoExecutionException {
	try {
		final Class<?> draftCatalogResolverClass = Thread.currentThread().getContextClassLoader()
				.loadClass(catalogResolverClassName);
		if (!CatalogResolver.class.isAssignableFrom(draftCatalogResolverClass)) {
			throw new MojoExecutionException(
					MessageFormat.format("Specified catalog resolver class [{0}] could not be casted to [{1}].",
							catalogResolver, CatalogResolver.class));
		} else {
			@SuppressWarnings("unchecked")
			final Class<? extends CatalogResolver> catalogResolverClass = (Class<? extends CatalogResolver>) draftCatalogResolverClass;
			final CatalogResolver catalogResolverInstance = catalogResolverClass.newInstance();
			return catalogResolverInstance;
		}
	} catch (ClassNotFoundException cnfex) {
		throw new MojoExecutionException(
				MessageFormat.format("Could not find specified catalog resolver class [{0}].", catalogResolver),
				cnfex);
	} catch (InstantiationException iex) {
		throw new MojoExecutionException(
				MessageFormat.format("Could not instantiate catalog resolver class [{0}].", catalogResolver), iex);
	} catch (IllegalAccessException iaex) {
		throw new MojoExecutionException(
				MessageFormat.format("Could not instantiate catalog resolver class [{0}].", catalogResolver), iaex);
	}
}
 
开发者ID:highsource,项目名称:maven-jaxb2-plugin,代码行数:28,代码来源:RawXJC2Mojo.java

示例6: blank

import com.sun.org.apache.xml.internal.resolver.tools.CatalogResolver; //导入依赖的package包/类
private static EntityResolver blank() {
	// works on Java 9
	return new CatalogResolver();
}
 
开发者ID:CodeFX-org,项目名称:java-9-wtf,代码行数:5,代码来源:EntityResolverFactory.java

示例7: withDefaultSimpleCatalogManager

import com.sun.org.apache.xml.internal.resolver.tools.CatalogResolver; //导入依赖的package包/类
private static EntityResolver withDefaultSimpleCatalogManager() {
	// works on Java 9
	return new CatalogResolver(new CatalogManager());
}
 
开发者ID:CodeFX-org,项目名称:java-9-wtf,代码行数:5,代码来源:EntityResolverFactory.java

示例8: getCatalogResolverInstance

import com.sun.org.apache.xml.internal.resolver.tools.CatalogResolver; //导入依赖的package包/类
protected CatalogResolver getCatalogResolverInstance() {
	if (catalogResolverInstance == null) {
		throw new IllegalStateException("Catalog resolver was not set up yet.");
	}
	return catalogResolverInstance;
}
 
开发者ID:highsource,项目名称:maven-jaxb2-plugin,代码行数:7,代码来源:RawXJC2Mojo.java

示例9: createEntityResolver

import com.sun.org.apache.xml.internal.resolver.tools.CatalogResolver; //导入依赖的package包/类
protected EntityResolver createEntityResolver(CatalogResolver catalogResolver) {
	final EntityResolver entityResolver = new ReResolvingEntityResolverWrapper(catalogResolver);
	return entityResolver;
}
 
开发者ID:highsource,项目名称:maven-jaxb2-plugin,代码行数:5,代码来源:RawXJC2Mojo.java


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