use of org.apache.camel.component.schematron.processor.ClassPathURIResolver in project camel by apache.
the class SchematronEndpoint method createTransformerFactory.
private void createTransformerFactory() throws ClassNotFoundException {
// provide the class loader of this component to work in OSGi environments
Class<TransformerFactory> factoryClass = getCamelContext().getClassResolver().resolveMandatoryClass(SAXON_TRANSFORMER_FACTORY_CLASS_NAME, TransformerFactory.class, SchematronComponent.class.getClassLoader());
LOG.debug("Using TransformerFactoryClass {}", factoryClass);
transformerFactory = getCamelContext().getInjector().newInstance(factoryClass);
transformerFactory.setURIResolver(new ClassPathURIResolver(Constants.SCHEMATRON_TEMPLATES_ROOT_DIR, this.uriResolver));
transformerFactory.setAttribute(LINE_NUMBERING, true);
}
use of org.apache.camel.component.schematron.processor.ClassPathURIResolver in project camel by apache.
the class SchematronProducerTest method setUP.
@BeforeClass
public static void setUP() {
SchematronEndpoint endpoint = new SchematronEndpoint();
TransformerFactory fac = new TransformerFactoryImpl();
fac.setURIResolver(new ClassPathURIResolver(Constants.SCHEMATRON_TEMPLATES_ROOT_DIR, endpoint.getUriResolver()));
Templates templates = TemplatesFactory.newInstance().getTemplates(ClassLoader.getSystemResourceAsStream("sch/schematron-1.sch"), fac);
endpoint.setRules(templates);
producer = new SchematronProducer(endpoint);
}
Aggregations