Skip to content

Commit 8fd2efd

Browse files
committed
[feature] Ship native XSD schemas in all distribution layouts
Include schema/ (conf.xsd, collection.xconf.xsd, descriptor.xsd, controller-config.xsd, mime-types.xsd, users.xsd, server.xsd, security-manager.xsd, expath-pkg.xsd and its extensions) in the tarball, zip, Docker image, IzPack installer, and macOS .app bundle as $EXIST_HOME/schema/. Also fix the "abrev" -> "abbrev" typo in expath-pkg.xsd. Closes #6189 Partially addresses #6008
1 parent 92b9c25 commit 8fd2efd

12 files changed

Lines changed: 53 additions & 7 deletions

File tree

AGENTS.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,30 @@ ANTLR generates `XQueryParser.java`, `XQueryLexer.java`, `XQueryTreeParser.java`
144144
| `org.exist.dom.persistent` | Persistent DOM implementation |
145145
| `org.exist.dom.memtree` | In-memory DOM (for constructed nodes) |
146146

147+
### Native config schemas (`schema/`)
148+
149+
eXist-db's own config-file XSDs (`conf.xsd`, `collection.xconf.xsd`, `descriptor.xsd`,
150+
`controller-config.xsd`, `mime-types.xsd`, plus `users.xsd`/`server.xsd`/`security-manager.xsd`/
151+
`expath-pkg.xsd` and its extensions) live in [`schema/`](schema/) at the repo root, and are shipped
152+
in every distribution layout as `$EXIST_HOME/schema/` — a sibling of `etc/`, `bin/`, `lib/` (tarball,
153+
zip, Docker image, and the IzPack installer all include it; see `exist-distribution`/`exist-docker`/
154+
`exist-installer`). External tools (eXide, IDE plugins) can resolve a config file's grammar from
155+
this fixed location instead of vendoring their own copy.
156+
157+
- Each XSD's `xs:schema/@version` is an independent semver line — see [`schema/README.md`](schema/README.md)
158+
for the versioning policy (CI enforces a version bump on any semantic schema edit, via
159+
`mvn -N xml:transform@schema-governance`, see [`schema/governance.xsl`](schema/governance.xsl)).
160+
- `org.exist.util.SchemaVersion`'s version constants are generated at build time from the XSDs
161+
themselves (`generate-sources` phase, see `exist-core/pom.xml`'s `schema-version-codegen`
162+
execution and [`schema/generate-schema-version.xsl`](schema/generate-schema-version.xsl)) — never
163+
hand-edit `SchemaVersion`'s constants; bump the XSD's `xs:schema/@version` instead and the
164+
constant follows automatically on the next build.
165+
- The 5 canonical instances (the files `pom.xml`'s `validate-canonical-instances` execution
166+
validates on every `mvn validate`) are the only ones checked for drift; the ~39 test/sample
167+
fixture copies scattered across module test resources (e.g. `extensions/*/src/test/resources*/conf.xml`)
168+
are intentionally hand-trimmed per-module subsets, not literal copies — don't try to regenerate
169+
them from canonical.
170+
147171
### Adding a new `fn:` function
148172

149173
1. Create the class in `org.exist.xquery.functions.fn` extending `BasicFunction`

exist-distribution/pom.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,12 +516,21 @@
516516
<mkdir dir="${assemble.dir}/etc"/>
517517
<mkdir dir="${assemble.dir}/bin"/>
518518
<mkdir dir="${assemble.dir}/logs"/>
519+
<mkdir dir="${assemble.dir}/schema"/>
519520

520521
<!-- copy configuration files -->
521522
<copy todir="${assemble.dir}/etc">
522523
<fileset dir="${project.basedir}/src/main/config"/>
523524
</copy>
524525

526+
<!-- copy native XML schemas (#6189): $EXIST_HOME/schema/, sibling to etc/ -->
527+
<copy todir="${assemble.dir}/schema">
528+
<fileset dir="${project.basedir}/../schema">
529+
<exclude name="*.md"/>
530+
<exclude name="governance.xsl"/>
531+
</fileset>
532+
</copy>
533+
525534
<macrodef name="copy-script">
526535
<attribute name="src"/>
527536
<attribute name="dest"/>

exist-distribution/src/main/config/conf.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
- http://exist-db.org/exist/apps/doc/documentation.xml
5959
6060
-->
61-
<exist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../schema/conf.xsd" schemaVersion="2.1.1">
61+
<exist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../schema/conf.xsd" schemaVersion="2.1.1">
6262

6363
<!--
6464
Configures the database backend.

exist-distribution/src/main/config/descriptor.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
-->
88

99

10-
<xquery-app request-replay-log="false" filtered="true" schemaVersion="1.2.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="schema/descriptor.xsd">
10+
<xquery-app request-replay-log="false" filtered="true" schemaVersion="1.2.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../schema/descriptor.xsd">
1111
<!--
1212
request-replay-log: Controls whether the Server logs incoming requests
1313
to the file request-replay-log.txt. This is useful for reproducing eXist behaviour and

exist-docker/src/assembly/dist-assembly-docker.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
<include>autodeploy/**</include>
3838
<include>etc/**</include>
3939
<include>logs/**</include>
40+
<include>schema/**</include>
4041
<include>LICENSE</include>
4142
</includes>
4243
</fileSet>

exist-docker/src/main/resources-filtered/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ COPY autodeploy /exist/autodeploy
2828
COPY etc /exist/etc
2929
COPY lib /exist/lib
3030
COPY logs /exist/logs
31+
COPY schema /exist/schema
3132

3233

3334
# Build-time metadata as defined at http://label-schema.org

exist-docker/src/main/resources-filtered/Dockerfile-DEBUG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ COPY autodeploy /exist/autodeploy
3030
COPY etc /exist/etc
3131
COPY lib /exist/lib
3232
COPY logs /exist/logs
33+
COPY schema /exist/schema
3334

3435
# Build-time metadata as defined at http://label-schema.org
3536
# and used by autobuilder @hooks/build

exist-installer/src/main/izpack/install.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@
156156
</fileset>
157157
<fileset targetdir="$INSTALL_PATH/etc" dir="etc"/>
158158
<fileset targetdir="$INSTALL_PATH/lib" dir="lib"/>
159+
<fileset targetdir="$INSTALL_PATH/schema" dir="schema"/>
159160
<fileset os="windows" targetdir="$INSTALL_PATH/lib" dir="@{izpack.resources.target}">
160161
<include name="icon.ico"/>
161162
</fileset>

exist-jetty-config/src/main/resources/webapp/WEB-INF/catalog.xml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,16 @@
77

88
<!-- eXist-db internals entries -->
99
<uri name="http://exist-db.org/collection-config/1.0" uri="../../../schema/collection.xconf.xsd"/>
10-
10+
<uri name="http://exist.sourceforge.net/NS/exist" uri="../../../schema/controller-config.xsd"/>
11+
<!-- conf.xml/descriptor.xml/mime-types.xml have no target namespace, so they're keyed by
12+
the literal schemaLocation hint's suffix rather than a namespace URI. systemSuffix
13+
matches regardless of how many ../ precede it, so this resolves correctly both for the
14+
canonical templates (../schema/conf.xsd from etc/) and for the many test/sample
15+
instance copies scattered across modules with differing relative depths. -->
16+
<systemSuffix systemIdSuffix="schema/conf.xsd" uri="../../../schema/conf.xsd"/>
17+
<systemSuffix systemIdSuffix="schema/descriptor.xsd" uri="../../../schema/descriptor.xsd"/>
18+
<systemSuffix systemIdSuffix="schema/mime-types.xsd" uri="../../../schema/mime-types.xsd"/>
19+
1120
<!-- W3C XHTML DTD entries -->
1221

1322
<public publicId="-//W3C//DTD XHTML 1.0 Strict//EN" uri="entities/xhtml1-strict.dtd"/>

exist-jetty-config/src/main/resources/webapp/WEB-INF/controller-config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
++ The order of elements within this configuration file is significant.
77
-->
88
<configuration xmlns="http://exist.sourceforge.net/NS/exist" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9-
xsi:schemaLocation="http://exist.sourceforge.net/NS/exist file:../../schema/controller-config.xsd" schemaVersion="1.1.1">
9+
xsi:schemaLocation="http://exist.sourceforge.net/NS/exist file:../../../schema/controller-config.xsd" schemaVersion="1.1.1">
1010

1111
<!-- Webstart servlet -->
1212
<forward pattern="/webstart" servlet="jnlp"/>

0 commit comments

Comments
 (0)