Implementing the Configuration Service
The Configuration Service provides configuration to front-end applications.
Back-end requirements
The Configuration Service is available from version 3.49 of the FX Integration API.
Dependent front-end features
The following front-end application features depend on an implementation of the Configuration Service:
Application | Version | Feature |
---|---|---|
FX Sales |
2.14+ |
|
FX Professional |
3.22+ |
Historic Search |
Implementing the Configuration Service (versions 3.66–3.68)
For FX Integration API 3.66–3.68, follow the instructions in the sections below:
The string 'Tobo' in type names was renamed to 'TOBO' in version 3.58 of the FX Integration API. The type names below reflect this change. |
Configure subject routing
Follow the steps below to include subject-routing configuration in your adapter for Liberator:
-
Add the following object mapping to your adapter project’s
blade/Liberator/etc/rttpd.conf
file:object-map "/PRIVATE/FX/CONFIG" "/PRIVATE/%u/FX/CONFIG" object-map "/PRIVATE/FX/SALES/CONFIG/TOBOUSER/%1" "/PRIVATE/FX/SALES/CONFIG/TOBOUSER/%u/%1" object-map "/PRIVATE/FX/SALES/CONFIG" "/PRIVATE/FX/%u/SALES/CONFIG"
-
Add the following include patterns to the
add-data-service
block in your adapter project’sblade/Liberator/etc/rttpd.conf
file:add-data-service ... include-pattern "^/PRIVATE/[^/]+/FX/CONFIG" include-pattern "^/PRIVATE/FX/[^/]+/SALES/CONFIG" include-pattern "^/PRIVATE/FX/SALES/CONFIG/TOBOUSER/[^/]+/[^/]+" ... end-data-service
Grant permissions
To permit users to view the configuration subjects, add the following permissions to the global namespace:
Field | Description |
---|---|
Action |
VIEW |
Product |
^/PRIVATE/%u/FX/CONFIG |
Namespace |
|
Authorisation |
ALLOW |
Field | Description |
---|---|
Action |
VIEW |
Product |
^/PRIVATE/FX/[^/]+/SALES/CONFIG |
Namespace |
|
Authorisation |
ALLOW |
Field | Description |
---|---|
Action |
VIEW |
Product |
^/PRIVATE/FX/SALES/CONFIG/TOBOUSER/[^/]+/[^/]+ |
Namespace |
|
Authorisation |
ALLOW |
For more information on permissioning, see:
Register configuration providers
Configuration is served by three providers, registered with the FXConfigAdapter
class:
Which providers you need to register depends on the applications your adapter serves:
-
Adapter serves Caplin FX Professional:
-
FXConfigAdapter.registerConfigProvider()
-
-
Adapter serves Caplin FX Sales:
-
FXConfigAdapter.registerSalesConfigProvider()
-
FXConfigAdapter.registerTOBOConfigProvider()
-
The providers serve configuration implemented in the Config
, SalesConfig
, and TOBOConfig
classes respectively:
Search field configuration for Historic Search is implemented in the Features
class:
Follow the steps below to implement configuration for the Historic Search feature in Caplin FX Sales:
-
Create implementations of CachedObjectProvider for
SalesConfig
andTOBOConfig
:Implement CachedObjectProvider for SalesConfig objectpublic class MySalesConfigProvider implements CachedObjectProvider<SalesConfig, ConfigSubjectInfo> { @Override public void onRequest(ConfigSubjectInfo subject, Consumer<SalesConfig> publishObject) { List<Field> searchFields = Arrays.asList( new Field() .displayName("Trade ID") .field("TradeId") .type(FieldType.TEXT), new Field() .displayName("Amount") .field("Amount") .type(FieldType.TEXT), new Field() .displayName("Currency Pair") .field("CurrencyPair") .type(FieldType.TEXT) ); HistoricSearchExecution hse = new HistoricSearchExecution(); hse.setSearchFields(searchFields); HistoricSearch hs = new HistoricSearch(); hs.setExecution(hse); Features features = new Features(); features.setHistoricSearch(hs); SalesConfig salesConfig = new SalesConfig(); salesConfig.setFeatures(features); publishObject.accept(salesConfig); } @Override public void onDiscard(ConfigSubjectInfo subject) { // } }
In the
onRequest
method of yourCachedObjectProvider
implementation forSalesConfig
, instantiate a newSalesConfig
object. Apply your Historic Search configuration to it, where eachField
object represents a field in the Historic Search query builder. Publish the configuredSalesConfig
object using theConsumer
instance passed toonRequest
.Implement CachedObjectProvider for TOBOConfig objectpublic class MyTOBOConfigProvider implements CachedObjectProvider<TOBOConfig, SalesTOBOConfigSubjectInfo> { @Override public void onRequest(SalesTOBOConfigSubjectInfo subject, Consumer<TOBOConfig> publishObject) { List<Field> searchFields = Arrays.asList( new Field() .displayName("Trade ID") .field("TradeId") .type(FieldType.TEXT), new Field() .displayName("Amount") .field("Amount") .type(FieldType.TEXT), new Field() .displayName("Currency Pair") .field("CurrencyPair") .type(FieldType.TEXT) ); HistoricSearchExecution hse = new HistoricSearchExecution(); hse.setSearchFields(searchFields); HistoricSearch hs = new HistoricSearch(); hs.setExecution(hse); Features features = new Features(); features.setHistoricSearch(hs); TOBOConfig toboConfig = new TOBOConfig(); toboConfig.setFeatures(features); publishObject.accept(toboConfig); } @Override public void onDiscard(SalesTOBOConfigSubjectInfo subject) { // } }
In the
onRequest
method of yourCachedObjectProvider
implementation forTOBOConfig
, instantiate a newTOBOConfig
object. Apply your Historic Search configuration to it, where eachField
object represents a field in the Historic Search query builder. Publish the configuredTOBOConfig
object using theConsumer
instance passed toonRequest
. -
In the constructor of your config adapter, register new instances of
MySalesConfigProvider
andMyTOBOConfigProvider
with your adapter’sFXConfigAdapter
instance:public class MyConfigAdapter { private MyConfigAdapter(DataSource dataSource) throws IOException { final FXConfigAdapter fxAdapter = new FXConfigAdapter(dataSource); // Register sales configuration provider fxAdapter.registerSalesConfigProvider(new MySalesConfigProvider()); // Register TOBO configuration provider fxAdapter.registerSalesTOBOConfigProvider(new MyTOBOConfigProvider()); // ... other provider registrations } public static void main(final String[] args) throws IOException { final DataSource dataSource = DataSource.fromArgs(args); new MyConfigAdapter(dataSource); dataSource.start(); } }
For a working example of a config adapter, see the Novo Config Adapter example in the FX Integration API Kit 3.66+.
Implementing the Configuration Service (versions 3.55–3.65)
For FX Integration API 3.55–3.65, follow the instructions in the sections below:
The string 'Tobo' in type names was renamed to 'TOBO' in version 3.58 of the FX Integration API. The type names below reflect this change. |
Configure subject routing
Follow the steps below to include subject-routing configuration in your adapter for Liberator:
-
Add the following object mapping to your adapter project’s
blade/Liberator/etc/rttpd.conf
file:object-map "/PRIVATE/FX/CONFIG" "/PRIVATE/%u/FX/CONFIG" object-map "/PRIVATE/FX/SALES/CONFIG/TOBOUSER/%1" "/PRIVATE/FX/SALES/CONFIG/TOBOUSER/%u/%1" object-map "/PRIVATE/FX/SALES/CONFIG" "/PRIVATE/FX/%u/SALES/CONFIG"
-
Add the following include patterns to the
add-data-service
block in your adapter project’sblade/Liberator/etc/rttpd.conf
file:add-data-service ... include-pattern "^/PRIVATE/[^/]+/FX/CONFIG" include-pattern "^/PRIVATE/FX/[^/]+/SALES/CONFIG" include-pattern "^/PRIVATE/FX/SALES/CONFIG/TOBOUSER/[^/]+/[^/]+" ... end-data-service
Grant permissions
To permit users to view the configuration subjects, add the following permissions to the global namespace:
Field | Description |
---|---|
Action |
VIEW |
Product |
^/PRIVATE/%u/FX/CONFIG |
Namespace |
|
Authorisation |
ALLOW |
Field | Description |
---|---|
Action |
VIEW |
Product |
^/PRIVATE/FX/[^/]+/SALES/CONFIG |
Namespace |
|
Authorisation |
ALLOW |
Field | Description |
---|---|
Action |
VIEW |
Product |
^/PRIVATE/FX/SALES/CONFIG/TOBOUSER/[^/]+/[^/]+ |
Namespace |
|
Authorisation |
ALLOW |
For more information on permissioning, see:
Register configuration providers
Configuration is served by three providers, registered with the FXConfigAdapter
class:
Which providers you need to register depends on the applications your adapter serves:
-
Adapter serves Caplin FX Professional:
-
FXConfigAdapter.registerConfigProvider()
-
-
Adapter serves Caplin FX Sales:
-
FXConfigAdapter.registerSalesConfigProvider()
-
FXConfigAdapter.registerTOBOConfigProvider()
-
The providers serve configuration implemented in the Config
, SalesConfig
, and TOBOConfig
classes respectively:
Search field configuration for Historic Search is implemented in the Features
class:
Follow the steps below to implement configuration for the Historic Search feature in Caplin FX Sales:
-
Create implementations of CachedObjectProvider for
SalesConfig
andTOBOConfig
:Implement CachedObjectProvider for SalesConfig objectpublic class MySalesConfigProvider implements CachedObjectProvider<SalesConfig, ConfigSubjectInfo> { @Override public void onRequest(ConfigSubjectInfo subject, Consumer<SalesConfig> publishObject) { List<HistoricSearchField> searchFields = Arrays.asList( new HistoricSearchField() .displayName("Trade ID") .field("TradeId") .type(HistoricSearchSearchType.TEXT), new HistoricSearchField() .displayName("Amount") .field("Amount") .type(HistoricSearchSearchType.TEXT), new HistoricSearchField() .displayName("Currency Pair") .field("CurrencyPair") .type(HistoricSearchSearchType.TEXT) ); HistoricSearchExecution hse = new HistoricSearchExecution(); hse.setSearchFields(searchFields); HistoricSearch hs = new HistoricSearch(); hs.setExecution(hse); Features features = new Features(); features.setHistoricSearch(hs); SalesConfig salesConfig = new SalesConfig(); salesConfig.setFeatures(features); publishObject.accept(salesConfig); } @Override public void onDiscard(ConfigSubjectInfo subject) { // } }
In the
onRequest
method of yourCachedObjectProvider
implementation forSalesConfig
, instantiate a newSalesConfig
object. Apply your Historic Search configuration to it, where eachHistoricSearchField
object represents a field in the Historic Search query builder. Publish the configuredSalesConfig
object using theConsumer
instance passed toonRequest
.Implement CachedObjectProvider for TOBOConfig objectpublic class MyTOBOConfigProvider implements CachedObjectProvider<TOBOConfig, SalesTOBOConfigSubjectInfo> { @Override public void onRequest(SalesTOBOConfigSubjectInfo subject, Consumer<TOBOConfig> publishObject) { List<HistoricSearchField> searchFields = Arrays.asList( new HistoricSearchField() .displayName("Trade ID") .field("TradeId") .type(HistoricSearchSearchType.TEXT), new HistoricSearchField() .displayName("Amount") .field("Amount") .type(HistoricSearchSearchType.TEXT), new HistoricSearchField() .displayName("Currency Pair") .field("CurrencyPair") .type(HistoricSearchSearchType.TEXT) ); HistoricSearchExecution hse = new HistoricSearchExecution(); hse.setSearchFields(searchFields); HistoricSearch hs = new HistoricSearch(); hs.setExecution(hse); Features features = new Features(); features.setHistoricSearch(hs); TOBOConfig toboConfig = new TOBOConfig(); toboConfig.setFeatures(features); publishObject.accept(toboConfig); } @Override public void onDiscard(SalesTOBOConfigSubjectInfo subject) { // } }
In the
onRequest
method of yourCachedObjectProvider
implementation forTOBOConfig
, instantiate a newTOBOConfig
object. Apply your Historic Search configuration to it, where eachHistoricSearchField
object represents a field in the Historic Search query builder. Publish the configuredTOBOConfig
object using theConsumer
instance passed toonRequest
. -
In the constructor of your config adapter, register new instances of
MySalesConfigProvider
andMyTOBOConfigProvider
with your adapter’sFXConfigAdapter
instance:public class MyConfigAdapter { private MyConfigAdapter(DataSource dataSource) throws IOException { final FXConfigAdapter fxAdapter = new FXConfigAdapter(dataSource); // Register sales configuration provider fxAdapter.registerSalesConfigProvider(new MySalesConfigProvider()); // Register TOBO configuration provider fxAdapter.registerSalesTOBOConfigProvider(new MyTOBOConfigProvider()); // ... other provider registrations } public static void main(final String[] args) throws IOException { final DataSource dataSource = DataSource.fromArgs(args); new MyConfigAdapter(dataSource); dataSource.start(); } }
For a working example of a config adapter, see the Novo Config Adapter example in the FX Integration API Kit 3.55+.
Implementing the Configuration Service (version 3.54)
For FX Integration API 3.54, follow the instructions in the sections below:
Configure subject routing
Follow the steps below to include subject-routing configuration in your adapter for Liberator:
-
Add the following object mapping to your adapter project’s
blade/Liberator/etc/rttpd.conf
file:object-map "/PRIVATE/FX/CONFIG" "/PRIVATE/%u/FX/CONFIG" object-map "/PRIVATE/FX/SALES/CONFIG/TOBOUSER/%1" "/PRIVATE/FX/SALES/CONFIG/TOBOUSER/%u/%1" object-map "/PRIVATE/FX/SALES/CONFIG" "/PRIVATE/FX/%u/SALES/CONFIG"
-
Add the following include patterns to the
add-data-service
block in your adapter project’sblade/Liberator/etc/rttpd.conf
file:add-data-service ... include-pattern "^/PRIVATE/[^/]+/FX/CONFIG" include-pattern "^/PRIVATE/FX/[^/]+/SALES/CONFIG" include-pattern "^/PRIVATE/FX/SALES/CONFIG/TOBOUSER/[^/]+/[^/]+" ... end-data-service
Grant permissions
To permit users to view the configuration subjects, add the following permissions to the global namespace:
Field | Description |
---|---|
Action |
VIEW |
Product |
^/PRIVATE/%u/FX/CONFIG |
Namespace |
|
Authorisation |
ALLOW |
Field | Description |
---|---|
Action |
VIEW |
Product |
^/PRIVATE/FX/[^/]+/SALES/CONFIG |
Namespace |
|
Authorisation |
ALLOW |
Field | Description |
---|---|
Action |
VIEW |
Product |
^/PRIVATE/FX/SALES/CONFIG/TOBOUSER/[^/]+/[^/]+ |
Namespace |
|
Authorisation |
ALLOW |
For more information on permissioning, see:
Implement and register configuration providers
Configuration is served by three providers, registered with the FXConfigAdapter
class:
Which providers you need to register depends on the applications your adapter serves:
-
Adapter serves Caplin FX Professional:
-
FXConfigAdapter.registerConfigProvider()
-
-
Adapter serves Caplin FX Sales:
-
FXConfigAdapter.registerSalesConfigProvider()
-
FXConfigAdapter.registerToboConfigProvider()
-
The providers serve implementations of Config
, SalesConfig
, and ToboConfig
respectively:
Search field configuration for Historic Search is implemented in the Features
class:
Follow the steps below to implement configuration for the Historic Search feature in Caplin FX Sales:
-
Create implementations of com.caplin.motif.fx.config.SalesConfig and com.caplin.motif.fx.config.ToboConfig:
Implement SalesConfigpublic class MySalesConfig implements SalesConfig { @Override public Map<String, CurrencyPair> getCurrencyPairs() { return null; } @Override public Features getFeatures() { List<HistoricSearchField> searchFields = Arrays.asList( new HistoricSearchField() .displayName("Trade ID") .field("TradeId") .type(HistoricSearchSearchType.TEXT), new HistoricSearchField() .displayName("Amount") .field("Amount") .type(HistoricSearchSearchType.TEXT), new HistoricSearchField() .displayName("Currency Pair") .field("CurrencyPair") .type(HistoricSearchSearchType.TEXT) ); HistoricSearchExecution hse = new HistoricSearchExecution(); hse.setSearchFields(searchFields); HistoricSearch hs = new HistoricSearch(); hs.setExecution(hse); Features features = new Features(); features.setHistoricSearch(hs); return features; } }
Implement ToboConfigpublic class MyToboConfig implements ToboConfig { @Override public List<Account> getAccounts() { return null; } @Override public Map<String, CurrencyPair> getCurrencyPairs() { return null; } @Override public Features getFeatures() { List<HistoricSearchField> searchFields = Arrays.asList( new HistoricSearchField() .displayName("Trade ID") .field("TradeId") .type(HistoricSearchSearchType.TEXT), new HistoricSearchField() .displayName("Amount") .field("Amount") .type(HistoricSearchSearchType.TEXT), new HistoricSearchField() .displayName("Currency Pair") .field("CurrencyPair") .type(HistoricSearchSearchType.TEXT) ); HistoricSearchExecution hse = new HistoricSearchExecution(); hse.setSearchFields(searchFields); HistoricSearch hs = new HistoricSearch(); hs.setExecution(hse); Features features = new Features(); features.setHistoricSearch(hs); return features; } @Override public UserInfo getUserInfo() { return null; } }
Each
HistoricSearchField
object represents a field in the Historic Search query builder. -
Create implementations of CachedObjectProvider for
SalesConfig
andToboConfig
:Implement CachedObjectProvider for SalesConfig objectpublic class MySalesConfigProvider implements CachedObjectProvider<SalesConfig, ConfigSubjectInfo> { @Override public void onRequest(ConfigSubjectInfo subject, Consumer<SalesConfig> publishObject) { publishObject.accept(new MySalesConfig()); } @Override public void onDiscard(ConfigSubjectInfo subject) { // } }
Implement CachedObjectProvider for ToboConfig objectpublic class MyToboConfigProvider implements CachedObjectProvider<ToboConfig, SalesToboConfigSubjectInfo> { @Override public void onRequest(SalesToboConfigSubjectInfo subject, Consumer<ToboConfig> publishObject) { publishObject.accept(new MyToboConfig()); } @Override public void onDiscard(SalesToboConfigSubjectInfo subject) { // } }
-
In the constructor of your config adapter, register new instances of
MySalesConfigProvider
andMyToboConfigProvider
with your adapter’sFXConfigAdapter
instance:public class MyConfigAdapter { private MyConfigAdapter(DataSource dataSource) throws IOException { final FXConfigAdapter fxAdapter = new FXConfigAdapter(dataSource); // Register sales configuration provider fxAdapter.registerSalesConfigProvider(new MySalesConfigProvider()); // Register TOBO configuration provider fxAdapter.registerSalesToboConfigProvider(new MyToboConfigProvider()); // ... other provider registrations } public static void main(final String[] args) throws IOException { final DataSource dataSource = DataSource.fromArgs(args); new MyConfigAdapter(dataSource); dataSource.start(); } }
For a working example of a config adapter, see the Novo Config Adapter example in the FX Integration API Kit 3.54.
Implementing the Configuration Service (versions 3.49–3.53)
For FX Integration API 3.49–3.53, follow the instructions in the sections below:
Configure subject routing
Follow the steps below to include subject-routing configuration in your adapter for Liberator:
-
Add the following object mapping to your adapter project’s
blade/Liberator/etc/rttpd.conf
file:object-map "/PRIVATE/FX/CONFIG" "/PRIVATE/%u/FX/CONFIG"
-
Add the following include pattern to the
add-data-service
block in your adapter project’sblade/Liberator/etc/rttpd.conf
file:add-data-service ... include-pattern "^/PRIVATE/[^/]+/FX/CONFIG" ... end-data-service
Grant permissions
To permit users to view the configuration subject, add the following permission to the global namespace:
Field | Description |
---|---|
Action |
VIEW |
Product |
^/PRIVATE/%u/FX/CONFIG |
Namespace |
|
Authorisation |
ALLOW |
For more information on permissioning, see:
Implement and register configuration providers
In the FX Integration API versions 3.49–3.53, the Configuration Service provider is registered with the FXTradeAdapter
class:
Follow the steps below:
-
Create an implementation of the com.caplin.motif.fx.config.Config interface:
public class MyConfig implements Config { @Override public SearchConfig getExecutionSearchConfig() { return new SearchConfig( Arrays.asList( new SearchField("Trade ID", "TradeId", TEXT), new SearchField("Amount", "Amount", TEXT), new SearchField("Currency Pair", "CurrencyPair", TEXT) ) ); } }
In
MyConfig.getExecutionSearchConfig()
, instantiate and return a new aSearchConfig
object. Pass theSearchConfig
constructor ajava.util.List
ofSearchField
objects, where eachSearchField
object represents a field in the Historic Search query builder. -
Create an implementation of the CachedObjectProvider interface:
public class MyConfigProvider implements CachedObjectProvider<Config, ConfigSubjectInfo> { private ObjectPublisher<Config> publisher; @Override public void initialise(ObjectPublisher<Config> publisher) { this.publisher = publisher; } @Override public void onRequest(ConfigSubjectInfo subject) { publisher.publish(subject.getSubject(), new MyConfig()); } @Override public void onDiscard(ConfigSubjectInfo subject) { // } }
In
MyConfigProvider.onRequest
, publish an instance ofMyConfig
. -
In the constructor of your trade adapter, register a new instance of
MyConfigProvider
with your adapter’sFXTradeAdapter
instance:public class MyTradeAdapter { private MyTradeAdapter(DataSource dataSource) throws IOException { final FXTradeAdapter fxAdapter = new FXTradeAdapter(dataSource); // Register configuration provider fxAdapter.registerConfigProvider(new MyConfigProvider()); // ... other provider registrations } public static void main(final String[] args) throws IOException { final DataSource dataSource = DataSource.fromArgs(args); new MyTradeAdapter(dataSource); dataSource.start(); } }
For a working example of a trade adapter with a registered config provider, see the Novo Trading Adapter example in the FX Integration API Kit 3.50–3.53.
See also: