Database Reference
In-Depth Information
•
mode
defines the permissions on the loaded files in permission string format (e.g.,
rw-rw-r--
). For XQuery files, the
x
permission will be automatically set in
addition.
In most cases you'll want your package loaded under
admin
privileges. Since the
Package Manager runs as
admin
anyway, you don't have to specify the
admin
password. So, the usual contents of the
permissions
element are:
<permissions
user=
"admin"
password=
""
group=
"dba"
mode=
"rw-rw-r--"
/>
The Prepare and Finish Scripts
In
repo.xml
, in the
prepare
and
finish
child elements, you can define two optional
XQuery scripts that run directly before (preinstall) and directly after (post-install) a
package is installed. Typical tasks for these scripts could include:
• Installing indexing or other definitions in a
collection.xconf
resource under‐
neath
/db/system/config
. There are two approaches you can take:
— Do this in the preinstall script (before loading the data). The data will then be
indexed on load.
— Do it in the post-install script and programmatically reindex (using the exten‐
sion function
xmldb:reindex
). This is how the package for the topic's exam‐
ple files works. There is some generic code for this in the
/db/apps/exist-book/
installer/installer.xqm
module that could be reused in other packages if so
desired.
• Creating users and groups for your application (or checking whether they exist).
• Creating data collections and resources outside the application's collection
structure.
Both the pre- and the post-install scripts can make use of some external variables
whose values will be provided by eXist during execution. The variables available for
you to declare in your query's prolog are:
declare
variable
$
home
external
;
declare
variable
$
dir
external
;
declare
variable
$
target
external
;
$hom
The directory where eXist is installed (i.e.,
$EXIST_HOME
)
$dir
The directory containing the unpacked version of your packages
.xar
file
Search WWH ::
Custom Search