Skip to content

Commit 1a9a1f8

Browse files
committed
doc(configuration): adjust SPI conf.xml changes
1 parent d220805 commit 1a9a1f8

10 files changed

Lines changed: 197 additions & 60 deletions

File tree

src/main/xar-resources/data/configuration/configuration.xml

Lines changed: 61 additions & 31 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<module uri="http://exist-db.org/xquery/file" enabled="no"/>
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<modules>
2-
<module id="ngram-index" class="org.exist.indexing.ngram.NGramIndex" file="ngram.dbx" n="3"/>
3-
<!-- <module id="spatial-index" class="org.exist.indexing.spatial.GMLHSQLIndex" connectionTimeout="10000" flushAfter="300" /> -->
2+
<!-- Bundled indexes (lucene-index, ngram-index, range-index, sort-index) are auto-discovered at startup; no entry needed to activate them. -->
3+
<!-- Optional: spatial index requires GML/HSQL JARs on the classpath. -->
4+
<!-- <module id="spatial-index" class="org.exist.indexing.spatial.GMLHSQLIndex" connectionTimeout="10000" flushAfter="300"/> -->
5+
<!-- To suppress a bundled index without removing this file, add enabled="no": -->
6+
<!-- <module id="ngram-index" class="org.exist.indexing.ngram.NGramIndex" file="ngram.dbx" n="3" enabled="no"/> -->
47
</modules>

src/main/xar-resources/data/devguide_indexes/devguide_indexes.xml

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
xmlns:xlink="http://www.w3.org/1999/xlink">
66
<info>
77
<title>Developer's Guide to Modularized Indexes</title>
8-
<date>2Q19</date>
8+
<date>3Q26</date>
99
<keywordset>
1010
<keyword>java-development</keyword>
1111
<keyword>indexes</keyword>
@@ -359,6 +359,54 @@
359359

360360
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
361361

362+
<sect2 xml:id="spi-registration">
363+
<title>Registering an Index via ServiceLoader (SPI)</title>
364+
365+
<para>Since eXist-db 7.0, index modules can be auto-discovered at startup through the
366+
Java <literal>ServiceLoader</literal> mechanism without requiring an explicit
367+
<tag>module</tag> entry in <literal>conf.xml</literal>. This is the recommended
368+
registration mechanism for bundled and reusable third-party indexes.</para>
369+
370+
<para>To register an index via SPI:</para>
371+
372+
<orderedlist>
373+
<listitem>
374+
<para>Implement the <literal>org.exist.indexing.IndexFactory</literal>
375+
interface. It has a single method:</para>
376+
<programlisting>public interface IndexFactory {
377+
AbstractIndex create(BrokerPool pool, Path dataDir, Element config)
378+
throws DatabaseConfigurationException;
379+
String getId();
380+
}</programlisting>
381+
<para><literal>getId()</literal> must return the same stable identifier as
382+
<literal>AbstractIndex.getIndexId()</literal> in the index it creates.
383+
<literal>create()</literal> constructs and configures the index.</para>
384+
</listitem>
385+
<listitem>
386+
<para>Register the factory in the JAR's service descriptor. Create the file
387+
<literal>META-INF/services/org.exist.indexing.IndexFactory</literal>
388+
containing the fully-qualified class name of your factory, one per line:</para>
389+
<programlisting>com.example.myindex.MyIndexFactory</programlisting>
390+
</listitem>
391+
<listitem>
392+
<para>At startup, <literal>IndexManager</literal> scans all JARs on the
393+
classpath for <literal>IndexFactory</literal> providers and calls
394+
<literal>create()</literal> for each one whose
395+
<literal>id</literal> has not been mentioned in <literal>conf.xml</literal>
396+
(either as an active entry or as <code>enabled="no"</code>). The scan
397+
runs once inside the <literal>Configuration</literal> constructor —
398+
there is no per-query overhead.</para>
399+
</listitem>
400+
</orderedlist>
401+
402+
<para>An explicit <tag>module</tag> entry in <literal>conf.xml</literal> for the same
403+
<literal>id</literal> always takes precedence over SPI discovery. To suppress a
404+
SPI-registered index without removing its JAR, add a
405+
<tag>module</tag> entry with <code>enabled="no"</code>.</para>
406+
</sect2>
407+
408+
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
409+
362410
<sect2 xml:id="index-worker">
363411
<title> org.exist.indexing.IndexWorker </title>
364412

src/main/xar-resources/data/extensions/extensions.xml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
xmlns:xlink="http://www.w3.org/1999/xlink">
66
<info>
77
<title>Extension Modules</title>
8-
<date>2Q21</date>
8+
<date>3Q26</date>
99
<keywordset>
1010
<keyword>java-development</keyword>
1111
</keywordset>
@@ -36,15 +36,20 @@
3636
may then be added to <literal>$EXIST_HOME/extensions/indexes/pom.xml</literal>. They
3737
will be compiled automatically by the standard build targets or as indicated
3838
above.</para>
39-
<para>eXist-db must also be told which modules to load at startup, this is done in
40-
<literal>conf.xml</literal> and the Class name and Namespace for each module is
41-
listed below. </para>
39+
<para>Since eXist-db 7.0, bundled extension modules are auto-discovered at startup via
40+
the Java <literal>ServiceLoader</literal> mechanism — no <literal>conf.xml</literal>
41+
entry is needed to activate them. Third-party modules (not bundled with eXist-db)
42+
still require an explicit <tag>module</tag> entry in the
43+
<tag>builtin-modules</tag> section of <literal>conf.xml</literal>. An explicit entry
44+
always takes precedence over SPI auto-discovery for the same namespace URI; set
45+
<code>enabled="no"</code> on an entry to suppress a bundled module. The class name
46+
and namespace for each module are listed below.</para>
4247
<note>
4348
<para>eXist-db will require a restart to load any new modules added. </para>
4449
</note>
45-
<para>Once a Module is configured and loaded eXist-db will display the module and its
50+
<para>Once a module is configured and loaded, eXist-db will display the module and its
4651
function definitions as part of the <link xlink:href="{${fundocs.pkg.abbrev}}">function
47-
library</link> page or through <literal>util:decribe-function()</literal>.</para>
52+
library</link> page or through <literal>util:describe-function()</literal>.</para>
4853
</sect1>
4954

5055
<!-- ================================================================== -->
@@ -80,12 +85,12 @@
8085
</listitem>
8186
</itemizedlist>
8287
<para>
83-
The Cache module can be configured for with a bounded size, or time, or both. eXist-db cannot
88+
The Cache module can be configured with a bounded size, or time, or both. eXist-db cannot
8489
know how much memory the data you will put in the cache will take, so it is up to you to
8590
manage your own memory needs here.
8691
</para>
8792
<para>A named cache can either be explicitly created by calling the <code>cache:create</code> XQuery
88-
function, or it can be implicitly created lazing on the first operation performed on the cache.
93+
function, or it can be implicitly created lazily on the first operation performed on the cache.
8994
Configuration of the Cache module is specified within the module definition of eXist-db's
9095
<code>conf.xml</code> file:</para>
9196
<programlisting language="xml" xlink:href="listings/listing-2.xml"/>
@@ -116,7 +121,7 @@
116121
</listitem>
117122
</itemizedlist>
118123
<para>
119-
The SQL Module can be configured with additional which allow Connection Pooling of the SQL connections to be utilised.
124+
The SQL Module can be configured with additional options that enable connection pooling for SQL connections.
120125
For this purpose the <link xlink:href="https://github.com/brettwooldridge/HikariCP">HikariCP</link> connection pool implementation is used.
121126
</para>
122127
<para>Multiple connection pools can be configured and used from XQuery via the <code>sql:get-connection-from-pool</code> function.</para>

src/main/xar-resources/data/incompatibilities/incompatibilities.xml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<article version="5.0" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
44
<info>
55
<title>Known Issues when upgrading</title>
6-
<date>1Q20</date>
6+
<date>3Q26</date>
77
<keywordset>
88
<keyword>operations</keyword>
99
</keywordset>
@@ -12,6 +12,36 @@
1212
<!-- ================================================================== -->
1313

1414
<para>This article lists known incompatibilities when upgrading from an older version of eXist-db.</para>
15+
<!-- ================================================================== -->
16+
<sect1 xml:id="v7.0.0">
17+
<title>Upgrading to 7.0.0</title>
18+
19+
<itemizedlist>
20+
<listitem>
21+
<para><emphasis role="bold">conf.xml template trimmed — SPI auto-discovery for bundled
22+
modules and indexes.</emphasis> Built-in XQuery modules and index modules are now
23+
auto-discovered at startup via the Java <literal>ServiceLoader</literal> mechanism.
24+
The default <literal>conf.xml</literal> template no longer lists them explicitly.
25+
Installations upgrading with a hand-maintained <literal>conf.xml</literal> are
26+
unaffected — explicit <tag>module</tag> entries are still honoured and take
27+
precedence over SPI discovery for the same namespace URI or index
28+
<literal>id</literal>. To suppress a bundled module or index without removing its
29+
JAR, add <code>enabled="no"</code> to its entry.</para>
30+
</listitem>
31+
<listitem>
32+
<para><emphasis role="bold">New <code>enabled</code> attribute on
33+
<code>conf.xml</code> elements.</emphasis> The <tag>trigger</tag>,
34+
<tag>job</tag>, <tag>module</tag>, <tag>feature</tag>, <tag>parameter</tag>, and
35+
<tag>property</tag> elements in <literal>conf.xml</literal> now accept an
36+
<code>enabled="yes|no"</code> attribute (default <code>yes</code>). Setting
37+
<code>enabled="no"</code> disables the entry at startup without removing it from
38+
the file. Existing configuration files without the attribute continue to work
39+
unchanged.</para>
40+
</listitem>
41+
</itemizedlist>
42+
43+
</sect1>
44+
1545
<!-- ================================================================== -->
1646
<sect1 xml:id="v5.0.0">
1747
<title>Upgrading to 5.0.0</title>

src/main/xar-resources/data/indexing/indexing.xml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
schematypens="http://purl.oclc.org/dsdl/schematron"?><article xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
44
<info>
55
<title>Configuring Database Indexes</title>
6-
<date>2Q21</date>
6+
<date>3Q26</date>
77
<keywordset>
88
<keyword>application-development</keyword>
99
</keywordset>
@@ -284,13 +284,20 @@
284284

285285
<sect1 xml:id="moduleconf">
286286
<title>Enabling Index Modules</title>
287-
<para> To activate an index plug-in, it needs to be added to the <tag>modules</tag> section
288-
within the global configuration file <literal>conf.xml</literal>:</para>
287+
<para>Since eXist-db 7.0, bundled index modules (Lucene, ngram, range, sort) are
288+
auto-discovered at startup via the Java <literal>ServiceLoader</literal> mechanism. No
289+
<tag>module</tag> entry in <literal>conf.xml</literal> is required to activate them.
290+
Third-party index modules (not bundled with eXist-db) still require an explicit
291+
<tag>module</tag> entry in the <tag>modules</tag> section of
292+
<literal>conf.xml</literal>:</para>
289293

290294
<programlisting language="xml" xlink:href="listings/listing-8.xml"/>
291295

292-
<para>Every <tag>module</tag> element needs at least an <literal>id</literal> and
293-
<literal>class</literal> attribute. The class attribute contains the name of the plug-in
296+
<para>An explicit <tag>module</tag> entry always takes precedence over SPI
297+
auto-discovery for the same <code>id</code>. To suppress a bundled index without
298+
removing its JAR from the classpath, add <code>enabled="no"</code> to the entry.</para>
299+
<para>Every <tag>module</tag> element needs at least an <code>id</code> and
300+
<code>class</code> attribute. The class attribute contains the name of the plug-in
294301
class, which has to be an implementation of
295302
<literal>org.exist.indexing.Index</literal>.</para>
296303
<para>All other attributes or nested configuration elements below the <tag>module</tag>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<job type="system" enabled="no" name="check1" class="org.exist.storage.ConsistencyCheckTask" cron-trigger="0 0 * * * ?">
2+
<parameter name="output" value="export"/>
3+
<parameter name="backup" value="yes"/>
4+
</job>

src/main/xar-resources/data/scheduler/scheduler.xml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
xmlns:xlink="http://www.w3.org/1999/xlink">
66
<info>
77
<title>Scheduler Module</title>
8-
<date>2Q19</date>
8+
<date>3Q26</date>
99
<keywordset>
1010
<keyword>operations</keyword>
1111
<keyword>application-development</keyword>
@@ -28,11 +28,16 @@
2828
<para>Jobs may be statically scheduled by configuring them in the
2929
<tag>scheduler</tag> element of eXist-db's <code>conf.xml</code>
3030
configuration file. When eXist-db starts-up this configuration is read and
31-
the jobs will be scheduled with the scheduler. The configuration file
32-
contains (commented out) example jobs. An example of a scheduler
31+
the jobs will be scheduled with the scheduler. An example of a scheduler
3332
entry:</para>
3433

3534
<programlisting language="xml" xlink:href="listings/listing-3.xml"/>
35+
36+
<para>Add <code>enabled="no"</code> to a <tag>job</tag> element to keep the
37+
entry in <code>conf.xml</code> without activating it at startup. This is
38+
useful for preparing a job configuration in advance or disabling a job
39+
temporarily without losing its parameters:</para>
40+
<programlisting language="xml" xlink:href="listings/listing-4.xml"/>
3641
</listitem>
3742
</varlistentry>
3843
<varlistentry>
@@ -119,8 +124,8 @@
119124
<para>An XQuery job is a standard XQuery Main Module which is stored in the
120125
database. You configure the scheduling of the job by providing the database
121126
path to the XQuery, for example: <code>/db/my-collection/my-job.xq</code>. </para>
122-
<para>XQuery job's are launched under the <emphasis>guest</emphasis> account. If
123-
you wish to perform tasks as another user , either switch permissions by
127+
<para>XQuery jobs are launched under the <emphasis>guest</emphasis> account. If
128+
you wish to perform tasks as another user, either switch permissions by
124129
calling <code>xmldb:login()</code> from within your job, or set the
125130
<code>SetUid</code>/<code>SetGid</code> bits on the XQuery file's
126131
permissions (see <link xlink:href="security">Security</link> for more
@@ -145,13 +150,13 @@
145150

146151
<sect1 xml:id="schedule">
147152
<title>Job Schedule</title>
148-
<para>Job's may be scheduled using one of two mechanisms, a simple mechanism for periodic
153+
<para>Jobs may be scheduled using one of two mechanisms: a simple mechanism for periodic
149154
execution, or a more complex mechanism which uses the Cron syntax to offer greater
150155
flexibility.</para>
151156
<sect2 xml:id="period">
152157
<title>Periodic Scheduling</title>
153158

154-
<para>For period scheduling enables you can specify for the job to run every
159+
<para>Periodic scheduling lets you specify that the job runs every
155160
<code>n</code> milliseconds. There are additional options to specify a delay before
156161
the first execution of the job, and to only repeat the execution of the job schedule
157162
a fixed number of times.</para>

src/main/xar-resources/data/xquery/xquery.xml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
xmlns:xlink="http://www.w3.org/1999/xlink">
66
<info>
77
<title>XQuery in eXist-db</title>
8-
<date>1Q26</date>
8+
<date>3Q26</date>
99
<keywordset>
1010
<keyword>xquery</keyword>
1111
</keywordset>
@@ -270,9 +270,13 @@
270270
<title>Preloaded Modules</title>
271271

272272
<para>Preloaded modules do not need to be explicitly imported or declared in the prolog
273-
of queries. The <tag>builtin-modules</tag> element in <literal>conf.xml</literal>
274-
lists the namespaces and the corresponding Java class that implements all modules to
275-
be preloaded:</para>
273+
of queries. Since eXist-db 7.0, bundled modules are auto-discovered at startup via
274+
the Java <literal>ServiceLoader</literal> mechanism — no <tag>builtin-modules</tag>
275+
entry in <literal>conf.xml</literal> is required to activate them.</para>
276+
<para>An explicit <tag>module</tag> entry in <tag>builtin-modules</tag> always takes
277+
precedence over SPI auto-discovery for the same namespace URI. Third-party modules
278+
still require an explicit entry. To suppress a bundled module without removing its
279+
JAR, set <code>enabled="no"</code> on its <tag>module</tag> entry:</para>
276280
<programlisting language="xml" xlink:href="listings/listing-17.xml" />
277281
</sect2>
278282

0 commit comments

Comments
 (0)