You configure the locations that SpringSource dm Server includes in its provisioning repository
by editing the repository.properties
file in the $SERVER_HOME/config
directory.
When you specify a property in the file, use the format repository-name.property=value
, where:
repository-name
refers to the name of the local repository.property
refers to the name of a particular property.value
refers to the value of the property.
For example, bundles-usr.type=external
specifies that the type
property of the repository
with name bundles-usr
is external
.
For each specific repository, you configure a number of properties, such as its type (external, watched, or remote) and its searchpath, watched directory, or URI that specifies the actual location of the bundles and libraries. The particular properties that configure these options are listed in the table after the example.
The chain
property specifies the order in which SpringSource dm Server searches the searchpaths
when it looks for dependencies;
the first path listed specifies the first actual directory that SpringSource dm Server searches, until the last listed path.
The chain
property uses the names of the searchpaths as specified in the individual repository properties;
for example, in the property bundles-usr.type=external
, the name of the repository is bundles-usr
.
The default repository configuration for a newly installed SpringSource dm Server is as follows:
bundles-subsystems.type=external bundles-subsystems.searchPattern=repository/bundles/subsystems/{subsystem}/{component} bundles-ext.type=external bundles-ext.searchPattern=repository/bundles/ext/{bundle} bundles-usr.type=external bundles-usr.searchPattern=repository/bundles/usr/{bundle} libraries-ext.type=external libraries-ext.searchPattern=repository/libraries/ext/{library} libraries-usr.type=external libraries-usr.searchPattern=repository/libraries/usr/{library} chain=bundles-subsystems,bundles-ext,bundles-usr,libraries-ext,libraries-usr
The default configuration shown above has five searchpaths, each of which SpringSource dm Server searches when locating entries
for inclusion in the repository.
The chain
property shows the order in which SpringSource dm Server searches the searchpaths.
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 searchpaths as you wish.
The following table lists all the available properties that you can use to describe a named path and the
repository search chain in the repository.properties
file.
Table 7.5. Repository Properties in repository.properties
Property | Description |
---|---|
repository-name.type |
Specifies the type of path. You can set this property to one of the following three valid values:
See Watched or External Repository? for additional information about when to configure watched or external repositories for your particular environment. |
repository-name.searchPattern | Specifies the pattern that an external repository uses when deciding which local directories it should search
when identifying artifacts. Use this property together with |
repository-name.watchDirectory | Specifies the single directory of a watched repository.
You can specify either an absolute or relative pathname for the directory.
If you specify a relative pathname, it is relative to the root of the dm Server installation ( |
repository-name.watchInterval | Specifies the interval in seconds between checks of a watched directory by a watched repository.
This property is optional, if it is not specified the default interval of 5 seconds is used.
Use this property together with |
repository-name.uri | Specifies the URI of the hosted repository to which a remote repository connects. The value of this property takes the following format:
where:
Use this property together with |
repository-name.indexRefreshInterval |
Specifies the interval in seconds between checks by a remote repository that its local copy of the hosted repository index is up-to-date (a remote repository acts as a proxy for a hosted repository and thus it holds a local copy of the hosted repository’s index). This property is optional, if it is not specified the default interval of 5 seconds is used. Use this property together with |
The main difference between a watched and an external repository is that SpringSource dm Server regularly scans watched directories
and automatically picks up any changed bundles or libraries,
while dm Server scans external directories only at startup, and then only if there is no cached index available.
This means that dm Server always performs a scan of an external repository when you start the server
with the -clean
(as this deletes the index) and only scans during a normal startup if the index isn’t there because,
for example, this is the first time you start the server.
There is a performance cost associated with using a watched repository due to dm Server using resources to scan the directory at the configured interval. The cost is small if the watched repository contains just a few artifacts; however, the performance cost increases as the number of artifacts increases.
For this reason, SpringSource recommends that you put most of your dependencies in external repositories,
even when in development mode.
If you make any changes to the artifacts in the external repositories,
remember to restart dm Server with the -clean
option so that the server picks up any changes.
Use watched directories for artifacts that you are prototyping, actively updating, or when adding new dependencies
so that dm Server quickly and easily picks them up.
To increase performance even during development, however, you can use an external repository for most of your dependencies,
in particular the ones that are fairly static.
In production environments, where dependencies should not change, SpringSource recommends that you use only external repositories.
The repository-name.searchPattern
and
repository-name.watchDirectory
properties specify search paths
for external and watched repositories, respectively,
that define a physical location that SpringSource dm Server searches when looking for a library or bundle dependency.
If a search path is relative, its location is relative to the root of the installation,
in other words, the SERVER_HOME
directory.
Search paths specified with the repository-name.searchPattern
property
provide support for wildcards.
In the entries above, the path segments surrounded by curly braces,
for example {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,
that is *
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.
You can use system properties when specifying the values of the repository-name.searchPattern
,
repository-name.watchDirectory
,
repository-name.watchInterval
repository-name.uri
,
and repository-name.indexRefreshInterval
properties.
You reference system properties as ${system.property.name}
;
for example, a search path of ${user.home}/repository/bundles
references 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.
bundles-subsystems.type=external bundles-subsystems.searchPattern=repository/bundles/subsystems/{subsystem}/{component} bundles-ext.type=external bundles-ext.searchPattern=repository/bundles/ext/{bundle} bundles-usr.type=external bundles-usr.searchPattern=${user.home}/.ivy2/cache/{org}/{name}/{version}/{bundle}.jar libraries-ext.type=external libraries-ext.searchPattern=repository/libraries/ext/{library} libraries-usr.type=external libraries-usr.searchPattern=repository/libraries/usr/{library} chain=bundles-subsystems,bundles-ext,bundles-usr,libraries-ext,libraries-usr
bundles-subsystems.type=external bundles-subsystems.searchPattern=repository/bundles/subsystems/{subsystem}/{component} bundles-ext.type=external bundles-ext.searchPattern=repository/bundles/ext/{bundle} bundles-usr.type=external bundles-usr.searchPattern=${user.home}/.m2/repository/**/{bundle}.jar libraries-ext.type=external libraries-ext.searchPattern=repository/libraries/ext/{library} libraries-usr.type=external libraries-usr.searchPattern=repository/libraries/usr/{library} chain=bundles-subsystems,bundles-ext,bundles-usr,libraries-ext,libraries-usr
The following example shows the default repository.properties
file
from a freshly-installed dm Server, but then updated to include new remote and watched repositories.
Both of these repositories are part of the repository chain.
The remote repository is called remote-repo
.
The URI of the hosted repository from which remote-repo
gets its artifacts is
http://my-host:8080/com.springsource.server.repository/my-hosted-repo
;
this means that there is a dm Server instance running on host my-host
whose Tomcat server listens at the default port, 8080
,
and this server instance hosts a repository called my-hosted-repo
,
configured in the hostedRepository.properties
file of the remote server instance.
The remote repository checks for changes in the hosted repository every 30 seconds.
The watched repository is called watched-repo
and the directory that holds the artifacts
is repository/watched
,
relative to the installation directory of the dm Server instance.
The server checks for changes in this watched repository every 5 seconds.
bundles-subsystems.type=external bundles-subsystems.searchPattern=repository/bundles/subsystems/{subsystem}/{component} bundles-ext.type=external bundles-ext.searchPattern=repository/bundles/ext/{bundle} bundles-usr.type=external bundles-usr.searchPattern=repository/bundles/usr/{bundle} libraries-ext.type=external libraries-ext.searchPattern=repository/libraries/ext/{library} libraries-usr.type=external libraries-usr.searchPattern=repository/libraries/usr/{library} remote-repo.type=remote remote-repo.uri=http://my-host:8080/com.springsource.server.repository/my-hosted-repo remote-repo.indexRefreshInterval=30 watched-repo.type=watched watched-repo.watchedDirectory=repository/watched watched-repo.watchedInterval=5 chain=bundles-subsystems,bundles-ext,bundles-usr,libraries-ext,libraries-usr,remote-repo,watched-repo