System Properties Updater
| An extension that allows the update of XWiki object properties and attachments from JVM system properties |
| Type | JAR |
| Category | API |
| Developed by | |
| Rating | |
| License | GNU Lesser General Public License 2.1 |
Table of contents
Description
The use-case of this extension is to allow anyone to update XWiki configuration from command line arguments passed to the JVM. One could for example update a color of a color theme through command-line arguments.
In order to identify which object property or which attachment to update, the extension relies on the serialized form of object property references or attachment references. The serialized reference should be prefixed with either property: or attachment: depending on the type of change.
When providing a system property that defines an attachment, the attachment needs to be provided as a URI. The following schemes are currently supported :
- http or https
- file, in this case the attachment needs to be accessible on the server filesystem
- XWiki 1.4+ data, using the format described in RFC 2397
| System property | Effect |
|---|---|
| property:xwiki:FlamingoThemes.Iceberg^FlamingoThemesCode.ThemeClass.link-color=green | This would update the property link-color of the Iceberg theme to green |
| attachment:xwiki:[email protected]=http://localhost:9000/logo2.svg | This would update the attachment logo.svg of the Iceberg theme to http://localhost:9000/logo2.svg |
The goal of this extension is not to provide “pretty” system properties that could be passed to XWiki. The main interest here is to provide fast deployments, where settings in XWiki can be defined by an administrator in advance.
Java system properties can be defined as JVM parameters, using the -D argument, such as -Dproperty:xwiki:....ThemeClass.link-color=green
Configuration
Configuration of the system properties updater should be defined as properties of xwiki.properties
| Key | Description | Default value | Since |
|---|---|---|---|
| systemPropertiesUpdater.trimDoubleQuotes | Trim any double quotes that could be added by the servlet container around the system properties. | false | 1.5 |
Activation
Three events will trigger the automated update of XWiki attachments and object properties based on system properties :
- When the application is started (ApplicationStartedEvent), the updater will update any property or attachment related to the main wiki
- When a wiki is ready (WikiReadyEvent), the updater will update any property or attachment related to the wiki that is ready
- When a flavor has been installed on a wiki (ExtensionInstalledEvent), the updater will update any property or attachment related to the wiki on which the flavor has been installed
Limitations
This extension will only update properties or attachments during one of the events stated in the section "Activation". At runtime, users will still be able to modify any wiki document, attachment, or property. The extension does not block the edition of a given document, property, or attachment.
Prerequisites & Installation Instructions
We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager).
You can also use the manual method which involves dropping the JAR file and all its dependencies into the WEB-INF/lib folder and restarting XWiki.
Versions
Dependencies
Dependencies for this extension (org.xwiki.contrib.systemproperties:system-properties-updater 1.5.4):
- org.xwiki.commons:xwiki-commons-observation-api 14.10
- org.xwiki.platform:xwiki-platform-bridge 14.10
- org.xwiki.platform:xwiki-platform-model-api 14.10
- org.xwiki.platform:xwiki-platform-oldcore 14.10
- org.xwiki.platform:xwiki-platform-flavor-api 14.10