API Settings

Global settings for REST API, will be evaluated once when restarting TOMCAT server.

Settings stored in TOMCAT Server as JSON File: WEB-INF/settings.json

Internally, settings class is a singleton and it’s constructor evaluates the json data once by the very first API call.

KEY VALUE Description
USE String <id> The specific json record, that will be used.
<id> String Specify different setting records.
SYS_MODE String ENUM Select Log Mode {DEBUG|STAGE|PRODUCTION}
PUBLIC_XSD_URL String XSD Scheme used for product model validation.
LOCAL_XSD_PATH String Location of xsd file for /xsd-schema.
MYSQL_SRV_ADDR String JDBC MySQL Server connection URL.
DATABASE String Database name.
DB_USER String User account for specified mysql database.
DB_USER_PW String Password for mysql user.
SESSION_LIFETIME Integer (Minutes) Lifetime of /cli-credentials session token
ERROR_LOG_PATH String Path, where to save error log files.

PUBLIC_XSD_URL This XSD scheme will be used for validation of product model provided to API (/initprduct or post /product). If nothing is specified, the XSD Resource provided by the API itself will by used (/xsd-scheme). Intended to be used as the global overall reference to XSD Schema.

LOCAL_XSD_PATH The API provides a public ressource /xsd-schema. This parameter tells the Webservice, where to find the local xsd file to be used for /xsd-schema.

Note

LOCAL_XSD_PATH sets the location of local XSD file, that is used to provide API Ressource /xsd-schema. The specified resource of PUBLIC_XSD_URL is used for validation of product XML. It’s your choice, PUBLIC_XSD_URL can be either the API HTTP GET /xsd-schema or any other resource that provides XSD info.

Why this is differentiated ?
  • versioning
  • option for costumer specific XSD manipulation using clones of the REST Service
  • debug / dev mode using different version of xsd file
  • later on, we will maybe provide different versions of XSD schema (deprecated old versions as well as current or dev)

For sake of speed, it’s intended to go beyond this later on: If no public XSD Path is provided by PUBLIC_XSD_URL, use direct file access by LOCAL_XSD_PATH, instead of reading it’s own resource. Currently, this throws an Exception since no XSD Schema is provided for validation. This change will not influence user access to API.

AUTO Settings

The Rest API also evaluates the URI and the Context (for local path completion to access web-inf data like settings and XSD Scheme)

Example

{
  "USE" : "DEV_SETTING",
  "DEV_SETTING" : {
    "MODE" : "DEBUG",
    "LOCAL_XSD_PATH" : "/WEB-INF/configuration.xsd",
    "MYSQL_SRV_ADDR" : "jdbc:mysql://localhost",
    "DATABASE" : "dvconfigapi",
    "DB_USER" : "<username>",
    "DB_USER_PW" : "<password>",
    "SESSION_LIFETIME" : "30"
    },
  "YOUR_OWN_SETTING" : {
    "MODE" : "{DEBUG|STAGE|PRODUCTION}",
    "PUBLIC_XSD_URL" : "{public resource for xsd, get by http}",
    "LOCAL_XSD_PATH" : "{path-and-filename-to-local-xsd-scheme}",
    "MYSQL_SRV_ADDR" : "<your mysql database address>",
    "DATABASE" : "dvconfigapi",
    "DB_USER" : "<username>",
    "DB_USER_PW" : "<password>",
    "SESSION_LIFETIME" : "30"
    }
}

USE

USE tells the settings, which settings should be used. If the environment variable DVCONFIG_RESTSERVICE_USE_SETTINGS is set, this is used instead of ‘USE’.