Difference between revisions of "Repository Module"

From BaseX Documentation
Jump to navigation Jump to search
 
(59 intermediate revisions by 2 users not shown)
Line 1: Line 1:
This module is introduced with BaseX {{Mark|Version 7.1}}. It contains [[Querying#Functions|XQuery functions]] for managing [http://expath.org/modules/pkg/ EXPath packages]. All functions are preceded by the <code>repo:</code> prefix which is linked to the namespace <code><nowiki>http://basex.org/modules/repo</nowiki></code>. You can read more about BaseX implementation of the EXPath Packaging API [[Packaging|here]].
+
This [[Module Library|XQuery Module]] contains functions for installing, listing and deleting modules contained in the [[Repository]].
 +
 
 +
=Conventions=
 +
 
 +
All functions and errors in this module are assigned to the <code><nowiki>http://basex.org/modules/repo</nowiki></code> namespace, which is statically bound to the {{Code|repo}} prefix.<br/>
 +
 
 +
=Functions=
  
 
==repo:install==
 
==repo:install==
{|
+
 
|-
+
{| width='100%'
| valign='top' width='90' | '''Signatures'''
+
|- valign="top"
|<code><b>repo:install</b>($path as xs:string) as empty-sequence()</code><br />
+
| width='120' | '''Signature'''
|-
+
|<pre>repo:install(
| valign='top' | '''Summary'''
+
  $href  as xs:string
|Installs a package. The parameter <code>$path</code> indicates the path to the package.<br />
+
) as empty-sequence()</pre>
|-
+
|- valign="top"
| valign='top' | '''Errors'''
+
| '''Summary'''
|<b>[[XQuery Errors#Packaging Errors|PACK0001]]</b> is raised if the package does not exist.<br /><b>[[XQuery Errors#Packaging Errors|PACK0002]]</b> is raised if the package is already installed.<br /><b>[[XQuery Errors#Packaging Errors|PACK0003]]</b> is raised if the package to be installed requires a package which is still not installed.<br /><b>[[XQuery Errors#Packaging Errors|PACK0004]]</b> is raised if the package descriptor is invalid.<br /><b>[[XQuery Errors#Packaging Errors|PACK0005]]</b> is raised if the module contained in the package to be installed is already installed as part of another package.<br /><b>[[XQuery Errors#Packaging Errors|PACK0006]]</b> is raised if the package cannot be parsed.<br /><b>[[XQuery Errors#Packaging Errors|PACK0009]]</b> is raised if the package version is not supported.<br /><b>[[XQuery Errors#Packaging Errors|PACK0010]]</b> is raised if the package contains an invalid JAR descriptor.<br /><b>[[XQuery Errors#Packaging Errors|PACK0011]]</b> is raised if the package contains a JAR descriptor but it cannot be read.<br />
+
|Retrieves and installs a package from the given {{Code|$href}} location. Existing packages are replaced.
 +
|- valign="top"
 +
| '''Errors'''
 +
|{{Error|not-found|#Errors}} a package does not exist.<br/>{{Error|descriptor|#Errors}} the package descriptor is invalid.<br/>{{Error|installed|#Errors}} the module contained in the package to be installed is already installed as part of another package.<br/>{{Error|parse|#Errors}} an error occurred while parsing the package.<br/>{{Error|version|#Errors}} the package version is not supported.
 
|}
 
|}
  
 
==repo:delete==
 
==repo:delete==
{|
+
 
|-
+
{| width='100%'
| valign='top' width='90' | '''Signatures'''
+
|- valign="top"
|<code><b>repo:delete</b>($pkg as xs:string) as empty-sequence()</code><br />
+
| width='120' | '''Signature'''
|-
+
|<pre>repo:delete(
| valign='top' | '''Summary'''
+
  $package  as xs:string
|Deletes a package. The parameter <code>$pkg</code> indicates either the package name as specified in the package descriptor or the name of the directory where the package is installed.<br />
+
) as empty-sequence()</pre>
|-
+
|- valign="top"
| valign='top' | '''Errors'''
+
| '''Summary'''
|<b>[[XQuery Errors#Packaging Errors|PACK0007]]</b> is raised if the package cannot be deleted.<br /><b>[[XQuery Errors#Packaging Errors|PACK0008]]</b> is raised if another package depends on the package to be deleted.<br />
+
|Deletes a {{Code|$package}}. The argument contains the package name, optionally suffixed with a dash and the package version.<br/>
 +
|- valign="top"
 +
| '''Errors'''
 +
|{{Error|not-found|#Errors}} a package does not exist.<br/>{{Error|delete|#Errors}} the package cannot be deleted.
 
|}
 
|}
  
 
==repo:list==
 
==repo:list==
{|
+
 
|-
+
{| width='100%'
| valign='top' width='90' | '''Signatures'''
+
|- valign="top"
|<code><b>repo:list</b>() as xs:string*</code><br />
+
| width='120' | '''Signature'''
|-
+
|<pre>repo:list() as element(package)*</pre>
| valign='top' | '''Summary'''
+
|- valign="top"
|Lists the names of all currently installed packages.<br />
+
| '''Summary'''
 +
|Lists the names and versions of all currently installed packages.<br/>
 +
|}
 +
 
 +
=Errors=
 +
 
 +
{| class="wikitable" width="100%"
 +
! width="110"|Code
 +
|Description
 +
|- valign="top"
 +
|{{Code|delete}}
 +
|The package cannot be deleted because of dependencies, or because files are missing.
 +
|- valign="top"
 +
|{{Code|descriptor}}
 +
|The package descriptor is invalid.
 +
|- valign="top"
 +
|{{Code|installed}}
 +
|The module contained in the package to be installed is already installed as part of another package.
 +
|- valign="top"
 +
|{{Code|not-found}}
 +
|A package does not exist.
 +
|- valign="top"
 +
|{{Code|parse}}
 +
|An error occurred while parsing the package.
 +
|- valign="top"
 +
|{{Code|version}}
 +
|The package version is not supported.
 
|}
 
|}
 +
 +
=Changelog=
 +
 +
;Version 9.0
 +
 +
* Updated: error codes updated; errors now use the module namespace
 +
 +
;Version 7.2.1
 +
 +
* Updated: {{Function||repo:install}}: existing packages will be replaced
 +
* Updated: {{Function||repo:delete}}: remove specific version of a package
 +
 +
;Version 7.2
 +
 +
* Updated: {{Function||repo:list}} now returns nodes
 +
 +
The module was introduced with Version 7.1.

Latest revision as of 16:08, 9 March 2023

This XQuery Module contains functions for installing, listing and deleting modules contained in the Repository.

Conventions[edit]

All functions and errors in this module are assigned to the http://basex.org/modules/repo namespace, which is statically bound to the repo prefix.

Functions[edit]

repo:install[edit]

Signature
repo:install(
  $href  as xs:string
) as empty-sequence()
Summary Retrieves and installs a package from the given $href location. Existing packages are replaced.
Errors not-found: a package does not exist.
descriptor: the package descriptor is invalid.
installed: the module contained in the package to be installed is already installed as part of another package.
parse: an error occurred while parsing the package.
version: the package version is not supported.

repo:delete[edit]

Signature
repo:delete(
  $package  as xs:string
) as empty-sequence()
Summary Deletes a $package. The argument contains the package name, optionally suffixed with a dash and the package version.
Errors not-found: a package does not exist.
delete: the package cannot be deleted.

repo:list[edit]

Signature
repo:list() as element(package)*
Summary Lists the names and versions of all currently installed packages.

Errors[edit]

Code Description
delete The package cannot be deleted because of dependencies, or because files are missing.
descriptor The package descriptor is invalid.
installed The module contained in the package to be installed is already installed as part of another package.
not-found A package does not exist.
parse An error occurred while parsing the package.
version The package version is not supported.

Changelog[edit]

Version 9.0
  • Updated: error codes updated; errors now use the module namespace
Version 7.2.1
  • Updated: repo:install: existing packages will be replaced
  • Updated: repo:delete: remove specific version of a package
Version 7.2

The module was introduced with Version 7.1.