API to stop xquery execution

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

API to stop xquery execution

Radu Coravu
Hi,

I'm a Java developer working for Oxygen XML Editor.
Oxygen allows end users to run XQuery scripts against the ExistDB.
For this we use:

> org.exist.xmldb.RemoteXPathQueryService.execute(XMLResource, CompiledExpression)

Is there any API from the "org.exist.xmldb" package we can use to force
stop an XQuery execution if the end user chooses to do so?
If not, can it be added maybe in a future version?

Regards,
Radu

Radu Coravu
<oXygen/>  XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: API to stop xquery execution

Dannes Wessels-3
Hi Radu,


On 6 Feb 2017, at 8:29 , Radu Coravu <[hidden email]> wrote:

I'm a Java developer working for Oxygen XML Editor.
Oxygen allows end users to run XQuery scripts against the ExistDB.
For this we use:

org.exist.xmldb.RemoteXPathQueryService.execute(XMLResource, CompiledExpression)

Is there any API from the "org.exist.xmldb" package we can use to force 
stop an XQuery execution if the end user chooses to do so?
If not, can it be added maybe in a future version?

Although I did not test it myself, there are two functions you can use from the system module

system:get-running-xqueries

system:get-running-xqueries() as item()

Get a list of running XQueries (dba role only).

Returns:
item() : a node containing the list of running XQueries

which results into information like

<system:xqueries xmlns:system="http://exist-db.org/xquery/system">
    <system:xquery id="807940361" sourceType="String" started="2017-02-12T12:41:23.502+01:00" terminating="false">
        <system:sourceKey>String</system:sourceKey>
        <system:xqueryExpression>system:get-running-xqueries()</system:xqueryExpression>
    </system:xquery>
</system:xqueries>

and

system:kill-running-xquery

system:kill-running-xquery($xquery-id as xs:integeras item()

Kill a running XQuey (dba role only).

Parameters:
$xquery-idThe XQuery ID obtained from get-running-xqueries()
Returns:
item()

The limitation that you need to be DBA for this , for obvious security reasons. A challenge is probably how to relate a query you started (…) with the IDs reported by the first function.

Does this help you a bit?

regards

Dannes

eXist-db Native XML Database

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: API to stop xquery execution

Radu Coravu
Hi Dannes,

Thanks for taking the time to answer and for the good advice.
About this remark:

>  A challenge is probably how to relate a query you started (…) with the IDs reported by the first function.

Indeed this would remain the main problem. For now we'll probably not
provide stop xquery possibilities from Oxygen.

Also, we plan to release Oxygen XML Editor 19 in April-May this year.
We'll start testing Oxygen with the newly released Exist 3.0 and add an
official mention about supporting Exist 3.0 in Oxygen 19.

Regards,
Radu

Radu Coravu
<oXygen/>  XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

On 2/12/2017 1:43 PM, Dannes Wessels wrote:

> Hi Radu,
>
>
>> On 6 Feb 2017, at 8:29 , Radu Coravu <[hidden email]
>> <mailto:[hidden email]>> wrote:
>>
>> I'm a Java developer working for Oxygen XML Editor.
>> Oxygen allows end users to run XQuery scripts against the ExistDB.
>> For this we use:
>>
>>> org.exist.xmldb.RemoteXPathQueryService.execute(XMLResource,
>>> CompiledExpression)
>>
>> Is there any API from the "org.exist.xmldb" package we can use to force
>> stop an XQuery execution if the end user chooses to do so?
>> If not, can it be added maybe in a future version?
>
> Although I did not test it myself, there are two functions you can use
> from the system
> <http://exist-db.org/exist/apps/fundocs/view.html?uri=http://exist-db.org/xquery/system&location=java:org.exist.xquery.functions.system.SystemModule> module
>
>
>         system:get-running-xqueries
>
> system:get-running-xqueries() as item()
>
> Get a list of running XQueries (dba role only).
>
> Returns:
>     item() : a node containing the list of running XQueries
>
>
> which results into information like
>
> <system:xqueries xmlns:system="http://exist-db.org/xquery/system">
>     <system:xquery id="807940361" sourceType="String"
> started="2017-02-12T12:41:23.502+01:00" terminating="false">
>         <system:sourceKey>String</system:sourceKey>
>
> <system:xqueryExpression>system:get-running-xqueries()</system:xqueryExpression>
>     </system:xquery>
> </system:xqueries>
>
> and
>
>
>         system:kill-running-xquery
>
> system:kill-running-xquery($xquery-id as xs:integer) as item()
>
> Kill a running XQuey (dba role only).
>
> Parameters:
>     $xquery-id The XQuery ID obtained from get-running-xqueries()
>
> Returns:
>     item()
>
>
> The limitation that you need to be DBA for this , for obvious security
> reasons. A challenge is probably how to relate a query you started (…)
> with the IDs reported by the first function.
>
> Does this help you a bit?
>
> regards
>
> Dannes
>
> —
> eXist-db Native XML Database
> http://www.exist-db.org



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open