Changes

Jump to navigation Jump to search
1,696 bytes added ,  14:56, 12 March 2018
</pre>
Repository modules are stored in a directory named {{Code|BaseXRepo}} or the {{Code|repo}}directory, which resides in your [[Configuration#Home Directory|home directory]]. XQuery modules can be manually copied to the repository directory or installed and deleted via [[#Commands|commands]].
If a module has been placed in the repository (see below), there is no need to specify the location. The following example calls a function from the FunctX module:
org/basex/modules/Hello
org.basex.modules.Hello
 
===Additional Libraries===
 
{{Mark|Introduced with Version 9.0:}}
 
A Java class may depend on additional libraries. The dependencies can be resolved by creating a fat JAR file, i.e., extracting all files of the library archives and producing a single, flat JAR package.
 
Another solution is to copy the libraries into a {{Code|lib}} directory of the JAR package. If the package will be installed, the additional library archives will be extracted and copied to a hidden sub-directory in the repository. If the package will be deleted, the hidden sub-directory will be removed as well.
 
; Examplary contents of {{Code|Image.jar}}
 
lib/
Images.jar
META-INF/
MANIFEST.MF
org/basex/modules/
Image.class
 
; Directory structure of the repository directory after installing the package
 
org/basex/modules/
Image.class
.Images/
Images.jar
==Combined==
{{Mark|Introduced with Version 9.0:}}:
It makes sense to combine the advantages of XQuery and Java packages:
On our [http://files.basex.org/modules/ file server], you can find some example libraries packaged as XML archives (xar files). You can use them to try our packaging API or just as a reference for creating your own packages.
 
=Performance=
 
Importing XQuery modules that are located in the repository is just as fast as importing any other modules. Modules that are imported several times in a project will only be compiled once.
 
Imported Java archives will be dynamically added to the classpath and unregistered after query execution. This requires some constant overhead and may lead to unexpected effects in scenarios with highly concurrent read operations. If you want to get optimal performance, it is recommendable to move your JAR files into the {{Code|lib/custom}} directory of BaseX. This way, the archive will be added to the classpath if BaseX is started. If you have installed a [[#Combined|Combined Package]], you can simply keep your XQuery module in the repository, and the Java classes will be automatically detected.
=Changelog=
* Added: [[#Combined|Combined]] XQuery and Java packages
* Added: [[#Additional Libraries|Additional Libraries]]
;Version 7.2.1
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu