Info | ||||||||
---|---|---|---|---|---|---|---|---|
This page describes the enhanced/reloadable configuration feature, based on Apache Commons Configuration, which has been submitted for possible inclusion was added in DSpace 6.
|
...
In DSpace 5 or below, DSpace used it's its own custom Property-based configuration scheme, along with a custom build.properties
which could tweak the build/compilation process in order to "override" some pre-selected configurations in the dspace.cfg
file. While this configuration scheme "worked" at a basic level, it required a lot of custom variable interpolation (i.e. filtering) to occur in both the Maven build process (mvn package
) and the Ant install process (ant fresh_install
or ant update
). The end result was that configuration files in your DSpace installation directory ([dspace.dir]
) contained the correct settings from your build.properties file, but with all variables (${setting}
) were filled outreplaced by the values from your build.properties file. So, it was no longer possible to easily tweak certain key settings (like dspace.dir
or solr.server
) without having to either re-run the entire build process or make corrections to several files at once.
Enter Apache Commons Configuration.
The Since DSpace 6, the Enhanced Configuration Scheme feature uses Apache Commons Configuration (version 1.10) as the new configuration scheme for DSpace. This provides several key advantages over our old, custom configuration scheme:
- Apache Commons Configuration is a well-established Java library whose goal is to make configuration more flexible and easier to manage.
- It automatically interpolates all settings at runtime. This means we no longer need to replace variables (
${setting}
) within our configurations. They will be auto-determined at runtime based on the value of that variable within one of the configuration files. For more on variable interpolation see its Basic Features documentation. - It is a flexible configuration scheme. It can read configurations from several sources at once, including Properties files, XML config files and even database tables (see its Overview documentation). Currently, in the DSpace Enhanced Configuration Scheme we are still only using Properties files, similar to DSpace 5 and below. But, we now are should we decide to do so, we are now able to easily move all or some configurations to XML configs or database config tables.
- The locations of the configuration sources can be easily customized by DSpace administrators in a new
config-definition.xml
file, which configures Apache Commons Configuration for DSpace. More on that below. - The
config-definition.xml
file itself is simply a "configuration definition" file as defined by Apache Commons Configuration. See the Configuration File Documentation for more details.
- The locations of the configuration sources can be easily customized by DSpace administrators in a new
- It allows for easy overriding of configuration values from other sources. How the overrides occur is up to depends on how you've configured Apache Commons Configuration. For DSpace, we have a new
config-definition.xml
which defines the following override scheme (again, this can be easily tweaked for local needs):- If a setting is specified in Java System Properties (e.g.
-D[setting]=[value]
), it overrides the same setting found in any below location - If a setting is specified as an Environment Variable, it overrides the same setting found in any below location
- If a setting is specified in the new
local.cfg
configuration file, it overrides the default value in any below location - Default values for all settings are specified in the
dspace.cfg
and themodules/*.cfg
configuration files.
- If a setting is specified in Java System Properties (e.g.
- It supports enhanced Properties files. This means our
dspace.cfg
,local.cfg
and other configuration files can now immediately support some enhanced options, including:- The ability to easily include other configuration files via: "
include=[config-file-location]
" (See the end of the updateddspace.cfg
for examples) - The ability to provide lists of values to "array" configurations by specifying the setting multiple times (rather than creating a giant comma separated configuration spanning multiple lines). For example, enabling both LDAP and Password authentication can now be done via these two lines:
plugin.sequence.org.dspace.authenticate.AuthenticationMethod = org.dspace.authenticate.LDAPAuthentication
plugin.sequence.org.dspace.authenticate.AuthenticationMethod = org.dspace.authenticate.PasswordAuthentication
- For more information see the Commons Config Properties File documentation.
- The ability to easily include other configuration files via: "
- More information/features can also be found in the Apache Commons Configuration v1.10 User Guide.
Building / Installing DSpace
With the Enhanced Configuration Scheme, the DSpace build process is slightly changed. The build.properties
file no longer exists and therefore has no effect on the build process.
Here's how the basics of building/installing DSpace:
- Download DSpace (as normalusual)
cd [dspace-source]
- Create your own initial local.cfg configuration file
cp local.cfg.EXAMPLE local.cfg
- The following fields MUST be specified in your local.cfg in order to install DSpace:
dspace.dir
- database connection information (
db.url
,db.driver
,db.dialect
,db.username
,db.password
,db.schema
) - All other fields are optional, and can be specified at a later time, or not at all. (As you'll read later on in these instructions, any configuration can also be added to your local.cfg).
- Build/Compile/Install as normal
mvn clean package
ant fresh_install
(orant update
)
- Once DSpace is installed, your local.cfg will be copied over to your
[dspace.dir]/config/
location. At that time you can optionally tweak it further (see local.cfg documentation below)
...
Warning | ||
---|---|---|
| ||
If you are upgrading from an earlier version of DSpace, you will need to be aware that many configuration names/keys have changed. Because Apache Commons Configuration allows for auto-overriding of configurations, all configuration names/keys in different In order to compensate for this, all Additionally, while the This means that DSpace 5.x (or below) configurations are NOT compatible with the Enhanced Configuration Scheme. While you obviously can use your old configurations as a reference, you will need to start with fresh copy of all configuration files, and reapply any necessary configuration changes (this has always been the recommended procedure). However, as you'll see in the next section, you'll likely want to do that anyways in order to take full advantage of the new |
...
Info |
---|
Link to local.cfg.EXAMPLE on Tim's DS-2654 branch: https://github.com/tdonohueDSpace/DSpace/blob/DS-2654-common-configmaster/local.cfg.EXAMPLE |
config-definition.xml
Info |
---|
Link to config-definition.xml on Tim's DS-2654 branch: https://github.com/tdonohueDSpace/DSpace/blob/DS-2654-common-configmaster/dspace/config/config-definition.xml |
The [dspace.dir]/config/config-definition.xml
file defines the Apache Commons Configuration settings that DSpace utilizes by default. It is a valid "configuration definition" file as defined by Apache Commons Configuration. See the Configuration File Documentation for more details.
...
- All DSpace configurations are loaded via Properties files
- Note: Apache Commons Configuration does support other configuration sources such as XML configurations or database configurations . See (see its Overview documentation).)
- Configuration Files/Sources: By default, only two configuration files are loaded into Apache Commons Configuration:
local.cfg
(see documentation on local.cfg above.)dspace.cfg
(NOTE: however that allmodules/*.cfg
are loaded bydspace.cfg
via "include=
" statements at the end of that configuration file.)
- Configuration Override Scheme: The configuration override scheme is defined as follows. Configurations specified in earlier locations will automatically override any later values:
- System Properties (-D[setting]=[value]) override all other options
- Environment Variables
local.cfg
dspace.cfg
(and allmodules/*.cfg
files) contain the default values for all settings.
- Configuration Auto-Reload: By default, all configuration files are automatically checked each minute for changes. If they have changed, they are automatically reloaded.
...
ConfigurationManager vs ConfigurationService
In the DSpace 5 Java Java API, we had two types of Configuration objects: org.dspace.coreConfigurationManager
and org.dspace.services.ConfigurationService
.
...