Difference between revisions of "Repository Module"

From BaseX Documentation
Jump to navigation Jump to search
m (Text replace - "===Version 7.2===" to ";Version 7.2")
(22 intermediate revisions by 2 users not shown)
Line 3: Line 3:
 
=Conventions=
 
=Conventions=
  
All functions in this module are assigned to the {{Code|http://basex.org/modules/repo}} namespace, which is statically bound to the {{Code|repo}} prefix.<br/>
+
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/>
All errors are assigned to the {{Code|http://basex.org/errors}} namespace, which is statically bound to the {{Code|bxerr}} prefix.
 
  
 
=Functions=
 
=Functions=
  
 
==repo:install==
 
==repo:install==
{|
+
 
|-
+
{| width='100%'
| width='90' | '''Signatures'''
+
|- valign="top"
|{{Func|repo:install|$path as xs:string|empty-sequence()}}<br />
+
| width='120' | '''Signatures'''
|-
+
|{{Func|repo:install|$uri as xs:string|empty-sequence()}}<br />
 +
|- valign="top"
 
| '''Summary'''
 
| '''Summary'''
|Installs a package, or (since {{Version|7.2.1}}), replaces an existing package. The parameter {{Code|$path}} indicates the path to the package.<br />
+
|Retrieves and installs a package from the given {{Code|$uri}}. Existing packages are replaced.
|-
+
|- valign="top"
 
| '''Errors'''
 
| '''Errors'''
|{{Error|BXRE0001|XQuery Errors#Packaging Errors}} the package does not exist.<br />{{Error|BXRE0002|XQuery Errors#Packaging Errors}} a package uses an invalid namespace URI.<br />{{Error|BXRE0003|XQuery Errors#Packaging Errors}} the package to be installed requires a package which is still not installed.<br />{{Error|BXRE0004|XQuery Errors#Packaging Errors}} the package descriptor is invalid.<br />{{Error|BXRE0005|XQuery Errors#Packaging Errors}} the module contained in the package to be installed is already installed as part of another package.<br />{{Error|BXRE0006|XQuery Errors#Packaging Errors}} the package cannot be parsed.<br />{{Error|BXRE0009|XQuery Errors#Packaging Errors}} the package version is not supported.<br />{{Error|BXRE0010|XQuery Errors#Packaging Errors}} the package contains an invalid JAR descriptor.<br />{{Error|BXRE0011|XQuery Errors#Packaging Errors}} the package contains a JAR descriptor but it cannot be read.<br />
+
|{{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%'
| width='90' | '''Signatures'''
+
|- valign="top"
|{{Func|repo:delete|$pkg as xs:string|empty-sequence()}}<br />
+
| width='120' | '''Signatures'''
|-
+
|{{Func|repo:delete|$package as xs:string|empty-sequence()}}<br />
 +
|- valign="top"
 
| '''Summary'''
 
| '''Summary'''
|Deletes a package. The parameter {{Code|$pkg}} indicates either the package name as specified in the package descriptor or (since {{Version|7.2.1}}) the name, suffixed with a hyphen and the package version.<br />
+
|Deletes a {{Code|$package}}. The argument contains the package name, optionally suffixed with a dash and the package version.<br />
|-
+
|- valign="top"
 
| '''Errors'''
 
| '''Errors'''
|{{Error|BXRE0007|XQuery Errors#Packaging Errors}} the package cannot be deleted.<br />{{Error|BXRE0008|XQuery Errors#Packaging Errors}} another package depends on the package to be deleted.<br />
+
|{{Error|not-found|#Errors}} a package does not exist.<br />{{Error|delete|#Errors}} the package cannot be deleted.
 
|}
 
|}
  
 
==repo:list==
 
==repo:list==
  
{{Mark|Updated in Version 7.2:}}
+
{| width='100%'
 
+
|- valign="top"
{|
+
| width='120' | '''Signatures'''
|-
 
| width='90' | '''Signatures'''
 
 
|{{Func|repo:list||element(package)*}}<br />
 
|{{Func|repo:list||element(package)*}}<br />
|-
+
|- valign="top"
 
| '''Summary'''
 
| '''Summary'''
 
|Lists the names and versions of all currently installed packages.<br />
 
|Lists the names and versions of all currently installed packages.<br />
Line 50: Line 49:
  
 
{| class="wikitable" width="100%"
 
{| class="wikitable" width="100%"
! width="5%"|Code
+
! width="110"|Code
! width="95%"|Description
+
|Description
|-
+
|- valign="top"
|{{Code|BXRE0001}}
+
|{{Code|delete}}
|The addressed package does not exist.
+
|The package cannot be deleted because of dependencies, or because files are missing.
|-
+
|- valign="top"
|{{Code|BXRE0002}}
+
|{{Code|descriptor}}
|A package uses an invalid namespace URI.
 
|-
 
|{{Code|BXRE0003}}
 
|The package to be installed requires a package which is not installed yet.
 
|-
 
|{{Code|BXRE0004}}
 
 
|The package descriptor is invalid.
 
|The package descriptor is invalid.
|-
+
|- valign="top"
|{{Code|BXRE0005}}
+
|{{Code|installed}}
 
|The module contained in the package to be installed is already installed as part of another package.
 
|The module contained in the package to be installed is already installed as part of another package.
|-
+
|- valign="top"
|{{Code|BXRE0006}}
+
|{{Code|not-found}}
|The package cannot be parsed.
+
|A package does not exist.
|-
+
|- valign="top"
|{{Code|BXRE0007}}
+
|{{Code|parse}}
|The package cannot be deleted.
+
|An error occurred while parsing the package.
|-
+
|- valign="top"
|{{Code|BXRE0008}}
+
|{{Code|version}}
|Another package depends on the package to be deleted
 
|-
 
|{{Code|BXRE0009}}
 
 
|The package version is not supported.
 
|The package version is not supported.
|-
 
|{{Code|BXRE0010}}
 
|The package contains an invalid JAR descriptor.
 
|-
 
|{{Code|BXRE0011}}
 
|The package contains a JAR descriptor but it cannot be read.
 
 
|}
 
|}
  
 
=Changelog=
 
=Changelog=
  
===Version 7.2.1===
+
;Version 9.0
 +
 
 +
* Updated: error codes updated; errors now use the module namespace
  
* Updated: [[#repo:install|repo:install]]: existing packages will be replaced
+
;Version 7.2.1
* Updated: [[#repo:delete|repo:delete]]: remove specific version of a package
+
 
 +
* Updated: {{Function||repo:install}}: existing packages will be replaced
 +
* Updated: {{Function||repo:delete}}: remove specific version of a package
  
 
;Version 7.2
 
;Version 7.2
  
* Updated: [[#repo:list|repo:list]] now returns nodes
+
* Updated: {{Function||repo:list}} now returns nodes
 
 
The module was introduced with {{Version|7.1}}.
 
  
[[Category:XQuery]]
+
The module was introduced with Version 7.1.

Revision as of 13:19, 20 July 2022

This 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 http://basex.org/modules/repo namespace, which is statically bound to the repo prefix.

Functions

repo:install

Signatures repo:install($uri as xs:string) as empty-sequence()
Summary Retrieves and installs a package from the given $uri. 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

Signatures 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

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

Errors

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

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.