Datastore Helper implementation within MR

This page provides implementation details about the usage of the Datastore Helper 2.0 library within Atoti Market Risk, focusing on the wiring between different datastore definitions and customizations. For documentation of the library itself, see the Datastore Helper Documentation.

Implementations of the AConfigurableSchema class

All the MR libraries datastores are provided as extensions of the AConfigurableSchema and AScalarDataAwareSchema classes. These classes are annotated as @Configuration, then collected and applied to the IDatastoreConfigurator object in the DatastoreConfiguratorSetup class.

The full list is as follows:

Class Datastore types
DatastoreDescriptionConfig FX, rounding, and quantiles stores for all cubes.
StandardDatastoreDescriptionConfig Trade and organizational stores for all cubes.
VaRDatastoreDescriptionConfig Standard VaR datastores.
PnLDatastoreDescriptionConfig Standard PnL datastores.
SensiDatastoreDescriptionConfig Vectorized and scalar Sensitivity datastores.
VaRFlatDatastoreDescriptionConfig Denormalized datastores for VaR store-level imports.
PnLFlatDatastoreDescriptionConfig Denormalized datastores for PnL store-level imports.
SensiFlatDatastoreDescriptionConfig Denormalized datastores for vectorized and scalar Sensitivity store-level imports.
VaRAggregatedDatastoreDescriptionConfig Denormalized datastores for VaR aggregated imports.
PnLAggregatedDatastoreDescriptionConfig Denormalized datastores for PnL aggregated imports.
SensiAggregatedDatastoreDescriptionConfig Denormalized datastores for vectorized and scalar Sensitivity aggregated imports.
ParameterDatastoreDescriptionConfig ActiveMonitor parameter store.
WhatIfDatastoreDescriptionConfig What-If tool datastore.

The DatastoreConfiguratorSetup class

All Spring beans are collected in the DatastoreConfiguratorSetup class. The@Configuration classes are expected to be made conditional on application properties and thus result in the correct set of datastores for each run mode.

The configurator consumers

Due to the usage of Spring profiles within the application, all configured schemas and customizations are enabled via auto-wired Spring beans, instantiated for particular profiles.

The class auto-wires two Consumer<IConfigurator> objects:

      @Autowired  
      @Qualifier(SP_QUALIFIER__SCHEMAS)  
    Consumer<IDatastoreConfigurator> schemaEnabler;  

      @Autowired(required = false)  
      @Qualifier(SP_QUALIFIER__CUSTOMISATIONS)  
      List<Consumer<IDatastoreConfigurator>> customisations;

The SP_QUALIFIER__SCHEMAS consumer controls which of the configured schemas (see AConfigurableSchema implementations) are enabled for a given set of enabled application profiles.

The SP_QUALIFIER__CUSTOMISATIONS consumer applies customizations defined elsewhere in the application configuration. See Customizations classes

The schema enabler

The schema enabler consumer is instantiated within the DatastoreConfiguratorSetup class, with different configurations depending on the active profile.

Customizations classes

Atoti Market Risk contains two customization classes that instantiate beans auto-wired into the SP_QUALIFIER__CUSTOMISATIONS consumer list.

Class Usage
DatastoreCustomisations Empty class intended to provide a place to define simple customizations.
ProductControlDatastoreCustomisations Operates on the PnL base store. Makes the Type field a key field and adds Monthly, Yearly and Lifetime value fields.