Openfire: Customization Guide

# Customization Guide

## Introduction

Openfire provides ways to customize application code as well as the Admin console, while maintaining that code in a separate location from the distribution source. The base code and custom code are integrated during the build process.

Topics that are covered in this document:

## File Structure

To customize files, create the following file structure in your `openfireHome` directory (where all the source files are on your filesystem).

Openfire 'home' directory structure

    custom/
        | - i18n/                    <- Directory to place translation files to be overridden
        | - conf/                    <- Directory to place configuration files to be overridden
        | - lib/                     <- Directory to place any private or 3rd party jar files
        | - source/                  <- Directory to place java source files to be overridden
        | - webapp/                  <- Directory to place any web file (image, CSS or jsp)

In the `custom/conf` directory, mirror the contents under the `src/conf` directory. Any files you place under `custom/conf` will override the current conf files under conf in the build. For example, to override the `openfire.xml` config file, you would place a openfire.xml file under the directory `custom/conf/`.

Any files you place under the `custom/lib` directory will be placed along side the other jar files under the `openfire/lib/` directory. For example, if you require a 3rd party jar file for use with changes you made under `custom/source/`, you would place the jar file in `custom/lib/` and it will be placed in the `lib/` in the build.

In the `custom/source` directory, mirror the contents under the `src/java` directory. Any files you place under `custom/source` will override the current source files in the build. For example, to override the class `org.jivesoftware.openfire.Channel` you would place a Channel.java file under the directory `custom/source/org/jivesoftware/openfire/`.

In the `custom/webapp` directory, mirror the contents of the `src/web` directory. Any files you place there will override the current source files in the build. For example, if you want to modify `src/web/login.jsp` then add login.jsp to the directory `custom/webapp`.

In the `custom/resources/jar` directory, mirror the contents of the `src/resources/jar` directory. Any files you place there will override the current source files in the build. These files will be placed in the root of the generated Openfire.jar file.

In the `custom/resources/nativeAuth` directory, mirror the contents of the `src/resources/nativeAuth` directory. Any files you place there will override the current source files in the build.

Currently, overridden files will simply be included in the built war or jar files. We have not added functionality to bundle these changes in a separate jar file.

The texts that are used in the administration panel (as well as some other texts) are taken from various translation files under the `src/i18n` directory. To customize such a file, a file by the same name can be added in the `custom/i18n` directory. The build process will merge both files, which you to add your own properties, as well as override existing properties, without the need to copy all properties that aren't of interest to you.

## Build

Simply build the application as normal. You may need to run the `./mvnw clean` task for your changes to be picked up.