IntroductionA resource manager is an Orbeon Forms component responsible for reading and writing XML and other resources like binary and text documents. A resource manager abstracts the actual mechanisms used to store resources. An important benefit of using such an abstraction is that it is possible to store all your application files in a sandbox which can be moved at will within a filesystem or between storage mechanisms. For instance, resources can be stored:
A resource manager is both used:
This page describes the different types of resource managers and explains their configuration. General configurationA single resource manager is initialized per Orbeon Forms web application. Configuration is handled in the web application descriptor ( <context-param><param-name>oxf.resources.factory</param-name><param-value>org.orbeon.oxf.resources.DefaultResourceManagerFactory</param-value></context-param> Other properties depend on the resource manager defined by the factory. These properties are described in the following sections. Filesystem resource managerConfiguration
The Filesystem resource manager loads resources from a filesystem. This is especially useful during development, since no packaging of resources is necessary. The Using the Filesystem resource manager without a sandbox is particularly useful for command-line applications. Example<context-param><param-name>oxf.resources.factory</param-name><param-value>org.orbeon.oxf.resources.FilesystemResourceManagerFactory</param-value></context-param><context-param><param-name>oxf.resources.filesystem.sandbox-directory</param-name><param-value>/home/user/oxf/myapp/resources</param-value></context-param> ClassLoader resource manager
The class loader resource manager can load resource from a JAR file or from a directory in the classpath. This resource manager is required to load internal resources for Orbeon Forms. WebApp resource manager
This resource manager is useful when you want to package an application into a single WAR file for distribution and deployment. The configuration property indicates the path prefix of the resources directory inside a WAR file. It is recommended to store resources under the WEB-INF directory to make sure that the resources are not exposed to remote clients. URL resource manager
This resource manager is able to load resources form any URL (http or ftp). It can be used if your resources are located on a web server or a content management system with an HTTP interface. WebDAV resource managerNOTE: The WebDAV resource manager is considered experimental.
This resource manager is able to load resources form a WebDAV repository through HTTP. Examples of WebDAV repositories include: For more information about WebDAV, please consult WebDAV Resources. Example<context-param><param-name>oxf.resources.factory</param-name><param-value>org.orbeon.oxf.resources.WebDAVResourceManagerFactory</param-value></context-param><context-param><param-name>oxf.resources.webdav.base</param-name><param-value>http://www.somwhere.com/base/</param-value></context-param><context-param><param-name>oxf.resources.webdav.username</param-name><param-value>joe</param-value></context-param><context-param><param-name>oxf.resources.webdav.password</param-name><param-value>password</param-value></context-param> Priority resource manager
With the priority resource manager you can chain several resource managers. It is crucial to be able to load resources from multiple sources since some resources are bundled in the Orbeon Forms JAR file. Thus, the class loader resource manager must always be in the priority chain. It usually has the lowest priority so the application developer can override system resources. There can be any number of chained resource managers. They are configured by adding a NOTE: The priority resource manager is more efficient when most resources are found in the first resource manager specified. Example<context-param><param-name>oxf.resources.factory</param-name><param-value>org.orbeon.oxf.resources.PriorityResourceManagerFactory</param-value></context-param><context-param><param-name>oxf.resources.webapp.rootdir</param-name><param-value>/WEB-INF/resources</param-value></context-param><context-param><param-name>oxf.resources.priority.1</param-name><param-value>org.orbeon.oxf.resources.WebAppResourceManagerFactory</param-value></context-param><context-param><param-name>oxf.resources.priority.2</param-name><param-value>org.orbeon.oxf.resources.ClassLoaderResourceManagerFactory</param-value></context-param> |