本文整理汇总了Java中org.apache.xml.resolver.CatalogManager类的典型用法代码示例。如果您正苦于以下问题:Java CatalogManager类的具体用法?Java CatalogManager怎么用?Java CatalogManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CatalogManager类属于org.apache.xml.resolver包,在下文中一共展示了CatalogManager类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createRouteBuilder
import org.apache.xml.resolver.CatalogManager; //导入依赖的package包/类
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
// we have to do it here, because we need the context created first
CatalogManager.getStaticManager().setIgnoreMissingProperties(true);
CatalogResolver catalogResolver = new CatalogResolver(true);
URL catalogUrl = ResourceHelper.resolveMandatoryResourceAsUrl(context.getClassResolver(), "org/apache/camel/component/validator/catalog.cat");
catalogResolver.getCatalog().parseCatalog(catalogUrl);
LSResourceResolver resourceResolver = new CatalogLSResourceResolver(catalogResolver);
JndiRegistry registry = (JndiRegistry) ((PropertyPlaceholderDelegateRegistry) context.getRegistry()).getRegistry();
registry.bind("resourceResolver", resourceResolver);
return new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start")
.doTry()
.to("validator:org/apache/camel/component/validator/report.xsd?resourceResolver=#resourceResolver")
.to("mock:valid")
.doCatch(ValidationException.class)
.to("mock:invalid")
.doFinally()
.to("mock:finally")
.end();
}
};
}
示例2: CatalogResolver
import org.apache.xml.resolver.CatalogManager; //导入依赖的package包/类
public CatalogResolver( boolean throwIfNotFound, List<String> catalogs, boolean preferPublic )
{
this.throwIfNotFound = throwIfNotFound;
delegate.setCatalogList( catalogs.toArray( new String[ catalogs.size() ] ) );
delegate.setPreferPublic( preferPublic );
if( LOG.isDebugEnabled() )
{
try
{
Field catalogManagerField = XMLCatalogResolver.class.getDeclaredField( "fResolverCatalogManager" );
catalogManagerField.setAccessible( true );
CatalogManager catalogManager = (CatalogManager) catalogManagerField.get( delegate );
catalogManager.setVerbosity( Integer.MAX_VALUE );
catalogManager.debug = new Debug();
catalogManagerField.setAccessible( false );
}
catch( NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException ex )
{
LOG.warn(
"Unable to setup XML-Catalog resolution logging, something is broken, please report the issue!",
ex
);
}
}
}
示例3: initResolver
import org.apache.xml.resolver.CatalogManager; //导入依赖的package包/类
private void initResolver() throws IOException {
CatalogManager catalogManager = new CatalogManager();
catalogManager.setUseStaticCatalog(true);
catalogManager.setIgnoreMissingProperties(true);
catalogManager.setVerbosity(1);
catalogManager.setPreferPublic(true);
CatalogResolver catalogResolver = new CatalogResolver(catalogManager);
Catalog catalog = catalogResolver.getCatalog();
if (catalogFiles != null && catalogFiles.length > 0) {
for (File catalogFile : catalogFiles) {
LOGGER.trace("Using catalog file {}", catalogFile);
catalog.parseCatalog(catalogFile.getPath());
}
} else if (catalogResourceName != null) {
LOGGER.trace("Using catalog from resource: {}", catalogResourceName);
Enumeration<URL> catalogs = Thread.currentThread().getContextClassLoader().getResources(catalogResourceName);
while (catalogs.hasMoreElements()) {
URL catalogResourceUrl = catalogs.nextElement();
LOGGER.trace("Parsing catalog from URL: {}", catalogResourceUrl);
catalog.parseCatalog(catalogResourceUrl);
}
} else {
throw new IllegalStateException("Catalog is not defined");
}
builtinSchemaResolver = catalogResolver;
}
示例4: testCatalogManager
import org.apache.xml.resolver.CatalogManager; //导入依赖的package包/类
public void testCatalogManager() throws Exception {
XMLCatalogManager manager = getManager();
CatalogManager catalogManager = manager.getManager();
Vector files = catalogManager.getCatalogFiles();
assertEquals(1, files.size());
String filePath = (String)files.get(0);
assertTrue(filePath, filePath.endsWith("catalog.xml"));
assertTrue(filePath, new File(new URI(filePath)).exists());
}
示例5: init
import org.apache.xml.resolver.CatalogManager; //导入依赖的package包/类
/**
* Initialization. Create a CatalogManager and set all
* the properties upfront. This prevents JVM wide system properties
* or a property file somewhere in the environment from affecting
* the behaviour of this catalog resolver.
*/
private void init (String [] catalogs, boolean preferPublic) {
fCatalogsList = (catalogs != null) ? (String[]) catalogs.clone() : null;
fPreferPublic = preferPublic;
fResolverCatalogManager = new CatalogManager();
fResolverCatalogManager.setAllowOasisXMLCatalogPI(false);
fResolverCatalogManager.setCatalogClassName("org.apache.xml.resolver.Catalog");
fResolverCatalogManager.setCatalogFiles("");
fResolverCatalogManager.setIgnoreMissingProperties(true);
fResolverCatalogManager.setPreferPublic(fPreferPublic);
fResolverCatalogManager.setRelativeCatalogs(false);
fResolverCatalogManager.setUseStaticCatalog(false);
fResolverCatalogManager.setVerbosity(0);
}
示例6: getManager
import org.apache.xml.resolver.CatalogManager; //导入依赖的package包/类
@TestOnly
public CatalogManager getManager() {
return myManager;
}
示例7: OasisCatalog
import org.apache.xml.resolver.CatalogManager; //导入依赖的package包/类
OasisCatalog(CatalogManager catalogManager, SAXResolver saxResolver) {
super(catalogManager);
this.saxResolver = saxResolver;
// don't call setupReaders; since we use our own parseCatalogFile
// we'll load the catalogs lazily
}
示例8: XmlValidatorCatalogResolver
import org.apache.xml.resolver.CatalogManager; //导入依赖的package包/类
public XmlValidatorCatalogResolver(CatalogManager manager) {
super(manager);
}
示例9: Catalog
import org.apache.xml.resolver.CatalogManager; //导入依赖的package包/类
/**
* Constructs an empty Catalog with a specific CatalogManager.
*
* <p>The constructor interrogates the relevant system properties
* using the specified Catalog Manager
* and initializes the catalog data structures.</p>
*/
public Catalog(CatalogManager manager) {
catalogManager = manager;
}
示例10: getCatalogManager
import org.apache.xml.resolver.CatalogManager; //导入依赖的package包/类
/**
* Return the CatalogManager used by this catalog.
*
*/
public CatalogManager getCatalogManager() {
return catalogManager;
}
示例11: setCatalogManager
import org.apache.xml.resolver.CatalogManager; //导入依赖的package包/类
/**
* Establish the CatalogManager used by this catalog.
*
*/
public void setCatalogManager(CatalogManager manager) {
catalogManager = manager;
}