E.g. Let us say you have the following configuration:
<config>
<service name="my-config">
<!-- lots of other stuff -->
</service>
</config>
You would need to put the following into your web.xml file:
<context-param> <param-name>oa4mp:oauth2.server.config.file</param-name> <param-value>/path/to/cfg.xml</param-value> </context-param>
<context-param>
<param-name>oa4mp:oauth2.server.config.name</param-name>
<param-value>my-config</param-value>
</context-param>
You may also have several configurations within a file and specify an alias or alternate name. This allows you to very easily switch configurations, keep old ones or have test configurations. To specify a configuration as an alias, you need to specify the name and alias tags:
<config> <service name="default" alias="new-config"/> <service name="new-config"> <!-- whole bunch of stuff for the actual configuration --> </service> <service name="mysql-5.0.2"> <!-- complete configuration here --> </service> </config>
In the example above, the service would be configured to always use "default" but the configuration is aliased to map this to "new-config". A typical use might be that the service is trying to migrate from mysql 5.0.2 and wants to preserve the old configuration so as to back out as needed. Again, you may have any number of aliases and aliases are transitive, so an alias can refer to another alias and so forth and these will be resolved down the chain.
<config> <service name="default" alias="new-config"/> <file include="/path/to/server-cfg.xml"/> </config>
<config> <service name="new-config"> <!-- whole bunch of stuff for the actual configuration --> </service> <service name="mysql-5.0.2"> <!-- complete configuration here --> </service> </config>
A really great use of this is specifying an administrative configuration. This lets you point to your main configuration as well as have other specialized configurations (such a file store for backing up a database, monitoring clients, etc.) You need only have a single server configuration file and refer to that.
Another use of configuration files is if you are running multiple versions of OA4MP. For instance, have a file for OAuth 1.0a-based configuration and one for OAuth2 - based ones. Then have a file that refers to these with aliases for the currently active configurations.