本文整理匯總了Java中org.springframework.beans.factory.xml.DelegatingEntityResolver類的典型用法代碼示例。如果您正苦於以下問題:Java DelegatingEntityResolver類的具體用法?Java DelegatingEntityResolver怎麽用?Java DelegatingEntityResolver使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
DelegatingEntityResolver類屬於org.springframework.beans.factory.xml包,在下文中一共展示了DelegatingEntityResolver類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createEntityResolver
import org.springframework.beans.factory.xml.DelegatingEntityResolver; //導入依賴的package包/類
/**
* Similar to {@link #createNamespaceHandlerResolver(BundleContext, String, ClassLoader)} , this method creates
* a special OSGi entity resolver that considers the bundle class path first, falling back to the entity resolver
* service provided by the Spring DM extender.
*
* @param bundleContext the OSGi context of which the resolver should be aware of
* @param filter OSGi service filter
* @param bundleClassLoader classloader for creating the OSGi namespace resolver proxy
* @return a OSGi aware entity resolver
*/
private EntityResolver createEntityResolver(BundleContext bundleContext, String filter,
ClassLoader bundleClassLoader) {
Assert.notNull(bundleContext, "bundleContext is required");
// create local namespace resolver
EntityResolver localEntityResolver = new DelegatingEntityResolver(bundleClassLoader);
// hook in OSGi namespace resolver
EntityResolver osgiServiceEntityResolver = lookupEntityResolver(bundleContext, filter, localEntityResolver);
ChainedEntityResolver delegate = new ChainedEntityResolver();
delegate.addEntityResolver(localEntityResolver, "LocalEntityResolver for bundle "
+ OsgiStringUtils.nullSafeNameAndSymName(bundleContext.getBundle()));
// hook in OSGi namespace resolver
delegate.addEntityResolver(osgiServiceEntityResolver, "OSGi Service resolver");
return delegate;
}
示例2: createEntityResolver
import org.springframework.beans.factory.xml.DelegatingEntityResolver; //導入依賴的package包/類
/**
* Similar to {@link #createNamespaceHandlerResolver(BundleContext, ClassLoader, ClassLoader)}, this method creates
* a special OSGi entity resolver that considers the bundle class path first, falling back to the entity resolver
* service provided by the Spring DM extender.
*
* @param bundleContext the OSGi context of which the resolver should be aware of
* @param filter
* @param bundleClassLoader classloader for creating the OSGi namespace resolver proxy
* @return a OSGi aware entity resolver
*/
private EntityResolver createEntityResolver(BundleContext bundleContext, String filter,
ClassLoader bundleClassLoader) {
Assert.notNull(bundleContext, "bundleContext is required");
// create local namespace resolver
EntityResolver localEntityResolver = new DelegatingEntityResolver(bundleClassLoader);
// hook in OSGi namespace resolver
EntityResolver osgiServiceEntityResolver = lookupEntityResolver(bundleContext, filter, localEntityResolver);
DelegatedEntityResolver delegate = new DelegatedEntityResolver();
delegate.addEntityResolver(localEntityResolver, "LocalEntityResolver for bundle "
+ OsgiStringUtils.nullSafeNameAndSymName(bundleContext.getBundle()));
// hook in OSGi namespace resolver
delegate.addEntityResolver(osgiServiceEntityResolver, "OSGi Service resolver");
return delegate;
}
示例3: Plugin
import org.springframework.beans.factory.xml.DelegatingEntityResolver; //導入依賴的package包/類
private Plugin(Bundle bundle) {
this.bundle = bundle;
ClassLoader loader = BundleDelegatingClassLoader.createBundleClassLoaderFor(bundle);
entity = new DelegatingEntityResolver(loader);
namespace = new DefaultNamespaceHandlerResolver(loader);
}
示例4: validate
import org.springframework.beans.factory.xml.DelegatingEntityResolver; //導入依賴的package包/類
@Override
public void validate(final InputStream xmlStream)
throws ValidationFailedException {
try {
if (xsdSchema == null) {
// get the source
final InputSource inputSource = new InputSource(xmlStream);
final EntityResolver resolver = new DelegatingEntityResolver(getClass()
.getClassLoader());
// use the DocumentLoader for validation, the DocumentLoader uses the
// defined XSD of the document, it tries to use the one distributed via
// the jar, otherwise it looks up the URL
documentLoader.loadDocument(inputSource, resolver, errorHandler,
XmlValidationModeDetector.VALIDATION_XSD, true);
} else {
// get the sources
final Source xmlSource = new StreamSource(xmlStream);
final Validator validator = xsdSchema.newValidator();
// validate the document using the default Validator
validator.validate(xmlSource);
}
} catch (final Exception e) {
throw new ValidationFailedException("The loaded or the validation failed.", e);
}
}