Changes

Jump to navigation Jump to search
1,073 bytes added ,  16:29, 20 October 2017
no edit summary
The advantages of this approach is the execution of imported classes is more efficient than the execution of instances that are created at runtime via {{Code|new()}}. A drawback is that no arguments can be passed on to the class constructor. As a consequence, the import fails if the addressed class has no default constructor, but at least one constructor with arguments.
=Integration= ==Context-Awareness==
Java classes can be coupled even more closely to the BaseX core library.
[http://www.w3.org/TR/xpath-functions-30/#properties-of-functions function properties].
==Locking==
By default, a Java function will be executed in parallel with other code. However, if a Java function performs sensitive write operations, it is advisable to explicitly lock the code. This can be realized via locking annotations:
If an XQuery expression is run which calls the Java {{Code|write()}} function, every other query that calls {{Code|write()}} or {{Code|read()}} needs to wait for the query to be finished. If a query calls the {{Code|read()}} function, only those queries are queued that call {{Code|write()}}, because this function is only annotated with a {{Code|read}} lock. More details on parallel query execution can be found in the article on [[Transaction Management]].
==Data Types==
The following table lists the mappings of XQuery and Java types:
| <code>null</code>
|}
 
==URI Rewriting==
 
If a module is looked up in the repository, the namespace URI is rewritten to a local file path:
 
# If the URI is a URL:
## colons will be replaced with slashes,
## in the URI authority, the order of all substrings separated by dots is reversed, and
## dots in the authority and the path are replaced by slashes. If no path exists, a single slash is appended.
# Otherwise, if the URI is a URN, colons will be replaced with slashes.
# Characters other than letters, dots and slashes will be replaced with dashes.
# If the resulting string ends with a slash, the {{Code|index}} string is appended.
 
If the resulting path has no file suffix, it may point to either an XQuery module or a Java archive.
The following examples show some rewritings:
 
* {{Code|<nowiki>http://basex.org/modules/hello/World</nowiki>}} → {{Code|org/basex/modules/hello/World}}
* {{Code|<nowiki>http://www.example.com</nowiki>}} → {{Code|com/example/www/index}}
* {{Code|a/little/example}} → {{Code|a/little/example}}
* {{Code|a:b:c}} → {{Code|a/b/c}}
=Changelog=
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu