Project

Profile

Help

Limiting Java Classes Available to Reflexive Extensions

Added by Brian Dueck about 9 years ago

Hi;

I have a use case where I want to limit the set of Java classes that are available to reflexive extensions written in xquery running inside Saxonica.

Yes, I know there are ways to do this within Java itself, but for various reasons I want to apply this to XQuery only.

As a follow-up question, is there a way to get a list of classes and methods that a particular xquery is referencing at compile time so that I can know what Java reflexive extensions are being used without actually running the xquery?

Thanks!

Brian.


Replies (1)

RE: Limiting Java Classes Available to Reflexive Extensions - Added by Michael Kay about 9 years ago

You could subclass JavaExtensionFunctionFactory and override the method makeExtensionFunctionCall() to check the class and method.

Haven't checked, but I think you can set this using

((JavaExtensionLibrary)professionalConfiguration.getExtensionBinder("java")).setExtensionFunctionFactory(myFactory).

On the follow-up question, you could (a) try capturing the explain() output of query processing, or (b) use the same mechanism as above: subclass the factory and capture requests as they arive, or (c) walk the expression tree directly, or (d) register a CodeInjector with the StaticQueryContext

Come to think of it (d) could be used for your first requirement as well. It's designed to allow insertion of diagnostic or tracing code into the expression tree, but it can equally be used just to monitor the expressions that are being created.

    (1-1/1)

    Please register to reply