If you're reading this, you're most likely already familiar with the
properties-local.xml file used to configure Orbeon Forms. This file typically goes inside the Orbeon Forms web app, in
WEB-INF/resources/config. What if you'd like to package a single
war for Orbeon Forms, and deploy that
war on multiple servers on which you need to have slightly different configurations? Is it possible to store this configuration outside of the
war file? It is, and we'll see how you can do this in the remainder of this post.
- The class loader resource manager loads files from the class path. Most of the built-in resources are stored in jar files that ship with Orbeon Forms, and are thus loaded with the ClassLoader resource manager.
- The web app resource manager typically loads files from the web app's
- The file system resource manager loads files from a directory on disk you specify.
By default, Orbeon Forms first attempts to load resources with the class loader resource manager, and if that fails tries with the web app resource manager. But you can change this by adding context params in the Orbeon Forms
web.xml. For instance, with the following two context params added, Orbeon Forms will first try to load resources from
<context-param> <param-name>oxf.resources.priority.0</param-name> <param-value> org.orbeon.oxf.resources.FilesystemResourceManagerFactory </param-value> </context-param> <context-param> <param-name> oxf.resources.priority.0.oxf.resources.filesystem.sandbox-directory </param-name> <param-value>/etc/orbeon</param-value> </context-param>
With this single change to the Orbeon Forms
war, and the choice of a "standard" directory in which you'll place your configuration files, say
/etc/orbeon, you can deploy the same
war on multiple servers, and have different configurations in the
/etc/orbeon of each server.
Changing Tomcat's configuration
Tomcat allows you to set the value of context parameters for an app in its own configuration, so you don't even have to change the
web.xml. The following two lines added inside your Tomcat's
<Context> element for the Orbeon Forms web app (e.g. in your
server.xml) are equivalent to the change we did earlier to the
<Parameter override="false" name="oxf.resources.priority.0" value="org.orbeon.oxf.resources.FilesystemResourceManagerFactory"/> <Parameter override="false" name="oxf.resources.priority.0.oxf.resources.filesystem.sandbox-directory" value="/etc/orbeon"/>
Post a Comment