The common lib provides base functionality for:
- configuration
- database requests
- http client requests
- java resource access
- assertions
Configuration
The configuration part is widely used over all our bundles, e.g. data-provider, devicemanager or mountpoint-registrar.
example config file:
[es] #hosturl esHosts=${SDNRDBURL} #time limit to keep increasing data in database [in seconds] #60*60*24*30 (30days) esArchiveLifetimeSeconds=2592000 esCluster= esArchiveCheckIntervalSeconds=0 esNode=elasticsearchnode esAuthUsername=${SDNRDBUSERNAME} esAuthPassword=${SDNRDBPASSWORD} esTrustAllCerts=${SDNRDBTRUSTALLCERTS}
A config file is separated into Sections.
- each section starts with a keyword in square brackets
- each parameter in a seperate line
- comments with starting #
- values as environment variables with encosing ${}
Code example for a specific config implementation:
usage:
final ConfigurationFileRepresentation configuration = new ConfigurationFileRepresentation("etc/dataprovider.properties"); final EsConfig esConfig = new EsConfig(configuration); ElasticSearchDataProvider dataProvider = new ElasticSearchDataProvider(esConfig.getHosts(),esConfig.getBasicAuthUsername(),esConfig.getBasicAuthPassword());