Apama 10.3 | Apama Capital Markets Foundation Documentation | Capital Markets Foundation | Analytics | Creating and configuring a currency converter | Configuring a currency converter factory | Setting currency converter factory parameters
 
Setting currency converter factory parameters
There are many configuration parameters associated with currency converter instances. If you want, you can set these parameters on a currency converter factory so that subsequent currency converters created from that factory have the same parameter settings.
The constant values used to specify these configuration parameters are defined in com.apama.ccyconverter.Consts.
When you use a currency converter factory to create a new currency converter instance, the created currency converter instance has the same configuration parameter values as the currency converter factory that created it. However, when you use a currency converter factory to connect to a remote currency converter instance, the returned currency converter has the same configuration parameter values as the currency converter instance it is connected to.
If the default configuration parameter settings meet your needs, you do not need to set currency converter factory parameters. See Default settings for currency converter parameters. However, if you want to configure the currency converter instances you create to have one or more common, non-default configuration parameter settings, you can set the appropriate parameter values on a currency converter factory instance. Any currency converters you create from that factory will have the parameter values you previously set on that factory.
To set a parameter on a currency converter factory:
1. Create a currency converter factory instance.
2. Create a com.apama.utils.Params object.
3. Add a parameter name/value pair to the parameters object you created.
4. Repeat the previous step for each parameter you want to set.
5. Execute the setParams() action on the currency converter factory instance and pass it the Params object you created.
After you set one or more configuration parameters on a currency converter factory instance, you can obtain the parameter values you set on that instance by executing com.apama.ccycurrency.CurrencyConverterFactory.getParams(). This action returns the factory configuration parameters you explicitly set and not any default settings for configuration parameters.
Setting currency converter factory parameters applies only to subsequently created currency converter instances.
After you create a currency converter instance, you can still change its configuration parameters. You do this by executing com.apama.ccyconverter.CurrencyConverter.setParams() on the currency converter instance. See Setting currency converter instance parameters.
The following example shows how to set a configuration parameter on a currency converter factory instance.
using com.apama.ccyconverter.CurrencyConverterFactory;
using com.apama.ccyconverter.Consts;
using com.apama.utils.Params;
 
monitor CurrencyConverterSample2 {
 
CurrencyConverterFactory factory;
Consts consts;
string baseCurrency := "USD";
sequence< string > currency := [ "EUR", "DKK" ];
sequence < string > symbols := [ "GBP/EUR" ];
dictionary < string, string > crossInfo := { "DKK":"EUR" };
 
action onload() {
 
Params params := new Params;
 
params.addParam(consts.CONFIG_BASE_CURRENCY, baseCurrency);
params.addStringSequenceParam(consts.CONFIG_CURRENCIES, currency);
params.addStringSequenceParam(consts.CONFIG_SYMBOLS, symbols);
params.addStringDictionaryParam(consts.CONFIG_CROSS_CURRENCY_INFO, crossInfo);
// Frequency in seconds for updating the currency values:
params.addFloatParam(consts.CONFIG_UPDATE_TIMEOUT, 3.0);

factory := new CurrencyConverterFactory;
factory.setParams(params);
 
...
}
}

Copyright © 2013-2018 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.