XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
davide galloSubject: More about Java extensions and External Functions
Author: davide gallo
Date: 07 Oct 2004 04:11 AM
Hi,

I'm working with XQuery procedures that use to call java classes.
In a precedent topic we talked about calls to Non-Static methods,
and you said that in these cases there is an implicit creation of an
instance of my java class...
Now imagine that this class manages a collection inside itself, and this collection is populated
in the constructor..then imagine that this class as a method getNext(String dummy) to access the next element in this collection..
if i call thi method in Xquery as an external function , each time i call this function the xquery engine will create a NEW() instance of
my class, with this conseguences :
1. New population of the inside collection with loss of performace
2. The method getNext() as no memory of the past (because its class is just new...) and so i get each time the first element

I would know if there is the possibility to manage directly the instances of the external classes created, to reuse the same class for each call of the methods...

I think that a possible solution for me is to ask my class not the NEXT element but exactly the N-elment in a XQuery for cycle but :

i don't know how many elements there are , and each time there is the population tha costs in performace...


Sorry if i'm boring you ...thank you all.


Davide Gallo



Posttop
Alberto MassariSubject: Re: More about Java extensions and External Functions
Author: Alberto Massari
Date: 07 Oct 2004 05:21 AM
Hi Davide,
you are right, a method like getNext() would not work as you expect using
the Stylus XQuery processor. It needs Saxon so that you can create the
object and pass as a parameter to every function invocation.
For the moment, we don't want to follow Saxon on this road, as it implies
extending the XQuery data model to include a "Java object" datatype, or
fake it using some workaround (for instance, Saxon uses a xs:QName object).

If you know that you will be using Saxon 8.1 as your deployment processor,
design your query so that it uses all the extensions it provides; if you
want to design a query that can run on multiple processors, you will need
to avoid using Java extensions completely, and use external variables to
bring data in the query from Java.

Hope this helps,
Alberto


 
Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.