Wiki source code of XAR Module

Last modified by Eleni Cojocariu on 2026/08/21 19:17

Show last authors
1 The [[XAR Module>>doc:extensions:Extension.XAR Module]] is the API XWiki reads and writes [[XAR archives>>doc:documentation.xs.admin.exports.export-content-xar-format.format-specifications.WebHome]] with, and the one to use to inspect an archive without importing it.
2
3 Reading an archive yields the package information of its [[##package.xml## descriptor>>doc:documentation.xs.admin.exports.export-content-xar-format.format-specifications.WebHome]] and one entry per [[Page file>>doc:documentation.xs.admin.exports.export-content-xar-format.format-specifications.document-xml.WebHome]] it holds. How much of the archive is opened depends on the entry point: ##XarPackage## parses the descriptor and lists the entries, while ##XarFile## also gives access to the XML of a chosen Page.
4
5 Wiki pages reach the API through the [[XAR Script Service>>documentation.xs.dev.xar.script-service.WebHome]]. Java code uses the classes of the ##xwiki-platform-xar-model## module, whose sources are in {{scm path="xwiki-platform-core/xwiki-platform-xar/xwiki-platform-xar-model"/}}.
6
7 The classes of the API, and what each of them reads:
8
9 {{plantuml}}
10 @startuml
11 !theme bluegray
12 skinparam componentStyle rectangle
13
14 component "**XarScriptService**\n$services.xar" as SS
15 component "**XarPackage**\npackage information + entries" as XP
16 component "**XarFile**\nentries + the XML of one Page" as XF
17 component "**XarEntry**\nreference, locale, entry name, type" as XE
18 artifact "package.xml" as PKG
19 artifact "Space/Page.xml" as DOC
20
21 SS --> XP
22 XP --> XE : one per Page file
23 XF --> XP
24 XF --> XE
25 XP ..> PKG : reads the descriptor
26 XP ..> DOC : reads the reference only
27 XF ..> DOC : opens the whole file
28 @enduml
29 {{/plantuml}}

Get Connected