You configure the locations that SpringSource dm Server includes in its repository by editing the repository.config
file in the $SERVER_HOME/config
directory. This file inclues the following two components: repositories
and respositoryChain
.
The repository
component specifies the actual directories, or searchpaths, for the different types of bundles or libraries that can live in the repository, such as sub-system bundles or user-defined libraries. Each of the searchpaths is given a name, such as bundles-subsystems
or libraries-user
and whether the searchpath is external or internal. The repositoryChain
component specifies the order in which SpringSource dm Server searches the directories when it looks for dependencies. The repositoryChain
component uses the names of the searthpaths as specified in the repositories
component.
The default configuration is as follows:
"repositories" : { "bundles-subsystems" : { "type" : "external", "searchPattern" : "repository/bundles/subsystems/{subsystem}/{component}" }, "bundles-ext" : { "type" : "external", "searchPattern" : "repository/bundles/ext/{bundle}" }, "bundles-usr" : { "type" : "external", "searchPattern" : "repository/bundles/usr/{bundle}" }, "libraries-ext" : { "type" : "external", "searchPattern" : "repository/libraries/ext/{library}" }, "libraries-usr" : { "type" : "external", "searchPattern" : "repository/libraries/usr/{library}" } }, "repositoryChain" : [ "bundles-subsystems", "bundles-ext", "bundles-usr", "libraries-ext", "libraries-usr" ]
This default configuration shown above has five paths, each of which will be searched when locating entries for inclusion in the repository. The respositoryChain
component shows the order in which the paths are searched.
SpringSource dm Server requires that you always include the bundles-subsystem
, bundles-ext
, and libraries-ext
searchpaths, as shown above, in your repository configuration. You can configure the user-related paths as you wish.
Each search path defines a location that is included in that SpringSource dm Server's repository and will therefore be searched when looking for a
library or bundle dependency. If a search path is relative its location is taken as being relative to the root of the installation, i.e. the
SERVER_HOME
directory.
Search paths provide support for wildcards. In the entries above, the path segments surrounded by curly braces, e.g. {bundle}
and
{library}
, are wildcards entries for a directory with any name. Allowing wildcards to be named in this way is intended to improve
the readability of search path configuration.
In addition to supporting the above-described form of wildcards, SpringSource dm Server also supports Ant-style paths, i.e. *
and
**
can be used to represent any directory and any series of directories respectively. For example,
repository/bundles/usr/{bundle}
and repository/bundles/usr/*
are directly equivalent.
A common usage of the **
wildcard is to allow dependencies stored in a directory structure of varying depth, such as a local Maven repository, to be provisioned by the SpringSource dm Server.
In addition to support for wildcards, system properties can also be used within a search path. System properties are referenced as ${system.property.name}
; for example, a search path of ${user.home}/repository/bundles
will reference the repository/bundles
directory in the user's home directory.
The following examples provide sample configuration that could be used for some common use cases. The examples show only the repository
component of the respository.config
file.
"repositories" : { "bundles-subsystems" : { "type" : "external", "searchPattern" : "repository/bundles/subsystems/{subsystem}/{component}" }, "bundles-ext" : { "type" : "external", "searchPattern" : "repository/bundles/ext/{bundle}" }, "bundles-usr" : { "type" : "external", "searchPattern" : "${user.home}/.ivy2/cache/{org}/{name}/{version}/{bundle}.jar", }, "libraries-ext" : { "type" : "external", "searchPattern" : "repository/libraries/ext/{library}" }, "libraries-usr" : { "type" : "external", "searchPattern" : "repository/libraries/usr/{library}" } }
"repositories" : { "bundles-subsystems" : { "type" : "external", "searchPattern" : "repository/bundles/subsystems/{subsystem}/{component}" }, "bundles-ext" : { "type" : "external", "searchPattern" : "repository/bundles/ext/{bundle}" }, "bundles-usr" : { "type" : "external", "searchPattern" : "${user.home}/.maven/repository/**/{bundle}.jar", }, "libraries-ext" : { "type" : "external", "searchPattern" : "repository/libraries/ext/{library}" }, "libraries-usr" : { "type" : "external", "searchPattern" : "repository/libraries/usr/{library}" } }