System properties

A number of TDS configuration settings can be set as Java system properties. Default values for some of these properties are defined in the TDS properties file: ${TOMCAT_HOME}/webapps/thredds/WEB-INF/classes/thredds/server/tds.properties.

Modifying tds.properties is an alternative means of changing those configuration settings. However, tds.properties lives in the ${TOMCAT_HOME}/webapps/ directory, meaning that it’ll be overwritten whenever the TDS is upgraded. So, if you make any edits to that file, make sure to back them up before deploying a new version of thredds.war, and then restore them after depoloyment.

The Java system properties that TDS uses for configuration are:

Property name Description Default value from tds.properties

tds.content.root.path

Root path for TDS content directory

None. The user must provide this value.

tds.version

TDS version number

${project.version} (actual value substituted during build)

tds.version.builddate

TDS build date

${build.timestamp} (actual value substituted during build)

tds.install.url

URL to the top level of the TDS installation

"catalog.html"

tds.url

TDS web page URL

"/tds/4.6/adminguide/TDS.html"

tds.documentation.url

TDS documentation URL

"/tds/4.6/adminguide/reference/index.html"

tds.logo.url

TDS logo URL

"threddsIcon.gif"

tds.logo.alt

TDS logo alternate text

"TDS"

tds.content.path

Full path for TDS content directory (relative to tds.content.root.path)

"thredds"

tds.content.startup.path

Location of default startup files. Used if catalog.xml or threddsConfig.xml are missing.

"WEB-INF/altContent/startup"

tds.config.file

Name of TDS configuration file (relative to tds.content.path).

"threddsConfig.xml"

Content Root

tds.content.root.path must be found before anything else is done. Typically, Tomcat is started from ${TOMCAT_HOME}/bin, and the content root is ${TOMCAT_HOME}/content.

Catalog Substitution

It’s possible to define property keys and use them in configuration catalogs. Values for those properties will be substituted at runtime. In ${TOMCAT_HOME}/webapps/thredds/WEB-INF/applicationContext-tdsConfig.xml, you’ll find:

<util:map id="dataRootLocationAliasExpanders" map-class="java.util.HashMap">
  <entry key="cdmUnitTest" value="${unidata.testdata.path}/cdmUnitTest/"/>
</util:map>

Here we’ve defined a property called cdmUnitTest that will be assigned the value of ${unidata.testdata.path}/cdmUnitTest/ [1] at runtime. You can define more by adding additional entry elements to the util:map.

Implementation Details

The dataRootLocationAliasExpanders map will be injected into the thredds.servlet.DataRootHandler class by Spring:

@Resource(name = "dataRootLocationAliasExpanders")
public void setDataRootLocationAliasExpanders(Map<String, String> aliases) {
  dataRootLocationAliasExpanders = PathAliasReplacementImpl.makePathAliasReplacements(aliases);
}

If a path in a catalog starts with a defined alias, the value will be substituted in the following places:

  1. when DataRootHandler.addRoot() is called

  2. the dataRootLocationAliasExpanders are injected into thredds.catalog.parser.jdom.InvCatalogFactory10:

    1. readFeatureCollection(): spec string

    2. readDatasetRoot(): location / dirLocation

    3. readDatasetScan(): dirLocation

    4. readDatasetScanNew(): location

Note: the thredds.featurecollection.FeatureCollectionConfig objects themselves are not modified. This is a problem with TDS.


1. unidata.testdata.path is a system property we use internally for testing.