Project

Profile

Help

Bug #2170

closed

Passing down object reference to extension function not available

Added by O'Neil Delpratt about 10 years ago. Updated almost 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
s9api API
Sprint/Milestone:
Start date:
2014-10-08
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
9.6
Fix Committed on Branch:
9.6
Fixed in Maintenance Release:
Platforms:

Description

Bug issue initially reported by Gunther Rademacher:

Reports a migration problem between 9.5 and 9.6.

What I would like to do is pass down some object reference into an

XQueryEvaluator, and retrieve it from within an extension function used

by the query. The following worked with 9.5:

...when evaluating an XQuery:

     XQueryEvaluator evaluator = executable.load();

     evaluator.setExternalVariable(

       new QName("data"),

       XdmValue.wrap(new ObjectValue("hello world")));

...and in an extension function used by the query:

    public Sequence call(XPathContext context, Sequence[] 

arguments) throws XPathException

    {

      ObjectValue parameter = (ObjectValue) 

context.getController().getParameter("data");

      return new StringValue((String) parameter.getObject());

With 9.6, the getParameter method has disappeared, and it is unclear to

me how to properly adapt the above code. Some debugging shows that my

external variable shows up in

    context.getController().getBindery().globalParameters

We need to think of a way of providing access to the global parameters including the defaulted values.


Files

ExternalVar.java (2.66 KB) ExternalVar.java Example of workaround invoking reflection O'Neil Delpratt, 2014-10-08 17:13

Please register to edit this issue

Also available in: Atom PDF