camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luca Burgazzoli (JIRA)" <j...@apache.org>
Subject [jira] [Work started] (CAMEL-9591) Support Saxon integrated extension functions
Date Thu, 11 Feb 2016 15:18:18 GMT

     [ https://issues.apache.org/jira/browse/CAMEL-9591?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Work on CAMEL-9591 started by Luca Burgazzoli.
----------------------------------------------
> Support Saxon integrated extension functions 
> ---------------------------------------------
>
>                 Key: CAMEL-9591
>                 URL: https://issues.apache.org/jira/browse/CAMEL-9591
>             Project: Camel
>          Issue Type: New Feature
>          Components: camel-xslt
>            Reporter: Luca Burgazzoli
>            Assignee: Luca Burgazzoli
>            Priority: Minor
>
> Since Saxon 9.2, writing extension functions has been supplemented by a new mechanism,
referred to as [integrated extension functions|http://www.saxonica.com/html/documentation/extensibility/integratedfunctions].

> To use such an extension function, user writes a custom class which extends net.sf.saxon.lib.ExtensionFunctionDefinition
an registers it in the Saxon transformer factory. It works fine. Only problem is that there's
no convenient support in Camel to pass such an extension function reference to camel-xslt.
> Current way: 
> {code:java}
>     // Define my extension functions (note: Saxon requires a class for each function)
>     List<ExtensionFunctionDefinition> extensionFunctions = new ArrayList<ExtensionFunctionDefinition>();
>     extensionFunctions.add(new MyExtensionFunction1());
>     extensionFunctions.add(new MyExtensionFunction2());
>     
>     // Register extension functions
>     TransformerFactoryImpl extendedSaxonTransformerFactory = new TransformerFactoryImpl();
>     Configuration configuration = extendedSaxonTransformerFactory.getConfiguration();
>     for ( ExtensionFunctionDefinition func : extensionFunctions ) {
>         configuration.registerExtensionFunction(func);
>     }
>     // Enable secure processing (note: secure processing allows use of Saxon integrated
extension functions as opposed to reflective extension functions)  
>     extendedSaxonTransformerFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING,
true);
>     // Register transformer factory on Camel
>     SimpleRegistry registry = new SimpleRegistry();
>     registry.put("extendedSaxonTransformerFactory", extendedSaxonTransformerFactory);
>     CamelContext context = new DefaultCamelContext(registry);
>     // Define Route
>     context.addRoutes(new RouteBuilder() {
>         @Override
>         public void configure() throws Exception {
>             from("direct:start")
>                 .to("xslt:transformation/myStyleSheet.xslt?transformerFactory=#extendedSaxonTransformerFactory");
>         }
>     });
> {code}
> Proposed way:
> {code:java}
>     // Define my extension functions (note: Saxon requires a class for each function)
>     List<ExtensionFunctionDefinition> extensionFunctions = new ArrayList<ExtensionFunctionDefinition>();
>     extensionFunctions.add(new MyExtensionFunction1());
>     extensionFunctions.add(new MyExtensionFunction2());
>     // Register extension functions with Camel
>     SimpleRegistry registry = new SimpleRegistry();
>     registry.put("extensionFunctions", extensionFunctions);
>     CamelContext context = new DefaultCamelContext(registry);
>     // Define Route
>     context.addRoutes(new RouteBuilder() {
>         @Override
>         public void configure() throws Exception {
>             from("direct:start")
>                 .to("xslt:transformation/myStyleSheet.xslt?saxon=true&saxonExtensionFunctions=#extensionFunctions&secureProcessing=true");
>         }
>     });
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message