Changes

Jump to navigation Jump to search
1 byte removed ,  00:19, 6 April 2012
If an instantiated class inherits the abstract [https://github.com/BaseXdb/basex/blob/master/src/main/java/org/basex/query/QueryModule.java QueryModule] class of BaseX, it will get access to the {{Mono|context}} variable, which is an instance of the [https://github.com/BaseXdb/basex/blob/master/src/main/java/org/basex/query/QueryContext.java QueryContext] class. It provides access to all static and dynamic properties of the current query. Additionally, the default properties of functions can be changed via annotations:
* Java functions can only be executed by users with [[User_Management|Admin permissions]]. You may annotate a function with {{Mono|@Requires(<Permission>)}} to also make it accessible to other users with less permissionsprivileges.* Java code is treated as ''non-deterministic'', as its behavior cannot be predicted by the XQuery processor. You may annotate a function as {{Mono|@Deterministic}} if you know that it will have no side-effects and will always yield the same result.* Java code is treated as ''context-independent''. If a function accesses the query context, it should be annotated as {{Mono|@ContextDependent}}* Java code is treated as ''focus-independent''. If a function accesses the current context item, position or size, it should be annotated as {{Mono|@FocusDependent}}
The following XQuery code invokes two Java methods. The first Java function retrieves information from the static query context, and the second one throws a query exception:
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu