Business components : Business components : Branch application components : Foreign Exchange : Tasks
  
Tasks
See
Configuring Foreign Exchange
Using Counters
Foreign Exchange
Configuring Foreign Exchange
Foreign Exchange component uses the UDTT ElementFactory as its IOC (Inversion of Control) container, so the configuration of Foreign Exchange component complies with the UDTT ElementFactory configuration rules. For more information about ElementFactory, see ElementFactory.
Configuring ForeignExchangeImpl
Following is an example of how to configure ForeignExchangeImpl:
<com.ibm.btt.bc.fx.impl.ForeignExchangeImpl id="ForeignExchange"
  homeCurrency="USD" ratesCacheRefreshInterval="1000"
  InitMethod="initialize">
  <ref Injection="ratesProvider" refId="ratesProvider" />
</com.ibm.btt.bc.fx.impl.ForeignExchangeImpl>
Where:
homeCurrency specifies the homeCurrency property of ForeignExchangeImpl.
ratesCacheRefreshInterval specifies the rates cache refresh interval.
The ratesProvider injection is used to inject the dependency on Rates Provider to the ForeignExchangeImpl.
Configuring Rates Provider
Following is an example of how to configure Rates Provider:
<com.ibm.btt.bc.fx.impl.RatesProviderImpl id="ratesProvider"
  conversionCurrency="USD" basicMonetaryItem="CA">
  <ref Injection="ratesRepository"
  refId="ratesRepositoryFileImpl" />
</com.ibm.btt.bc.fx.impl.RatesProviderImpl>
Where:
conversionCurrency specifies the conversation currency of the rates provider implementation.
basicMonetaryItem specifies the basic monetary item.
The ratesRepository injection is used to inject dependency on the Rates Repository layer.
Configuring Rates Repository
To configure Rates Repository, you need to prepare the Data Source, and configure RatesRepositoryDB2Impl.
For more information about Foreign Exchange Database structure, see Foreign Exchange Database structure.
Preparing Data Source
Start WebSphere Application Server v6.1 and configure WebSphere for Cash Drawer Management Service.
1 In Servers view of the Rational Software Development platform, select the WebSphere Application Server v6.1 and click This graphic is described in the surrounding text. to start server. Following is the screen capture of the start view:
screen capture of the start view
2 Right-click the WebSphere Application Server v6.1, and then click Run administrative console.
3 Configure JDBC Library Path.
Select Environment > WebSphere Variables. Update the DB2UNIVERSAL_JDBC_DRIVER_PATH and DB2_JDBC_DRIVER_PATH variables with the DB2 lib path, for example “C:\Program Files\IBM\SQLLIB\java”.
Following is the screen capture of updating variable:
screen capture of updating variable
4 Click OK to confirm the changes, and click Save to save the changes.
5 Create JDBC Providers.
Click Resources > JDBC Providers. All the database providers are listed here. Following is the screen capture of JDBC providers:
screen capture of JDBC providers
Click New to create a new JDBC Provider. In the new page, select DB2 as Database type; select DB2 Universal JDBC Driver Provider as Provider type; select XA data source as Implementation type; fill the Name with FX-DB2-XA-JDBCProvider. Following is a screen capture of creating a new JDBC Provider:
screen capture ofcreating a new JDBC Provider
Go to Step 3, click OK to save the changes.
6 Create Data Source.
7 Click Resources > JDBC Providers > FX-DB2-XA-JDBCProvider in this JDBC providers Configuration view. In the Additional Properties section, there is Data sources link. Following is the screen capture of configuration:
screen capture ofconfiguration
8 Click Data sources. All data sources are listed in this new page.
screen capture of data sources
9 Click New to create a new data source. In the new page, fill the Data source name with FXDataSource, fill the JNDI name with jndi/FXDB. Following is the screen capture of data source information:
screen capture of data source information
10 Click Create a new J2C authentication alias to create J2C authentication. Following is the screen capture of creating a new J2C authentication alias:
screen capture of creating a new J2C authenticationalias
11 Select new created FXAuthenticate as the J2C authentication data entries. Following is the screen capture of J2C authentication data entries:
screen capture of J2C authentication data entries
12 Fill the Database name, and Server name as “localhost” as in the example as follows:
screen capture of specific properties for the data source
13 Click Next > OK to save the changes.
Configuring RatesRepositoryDB2Impl
Following is an example of how to configure Rates Repository:
<com.ibm.btt.bc.fx.impl.RatesRepositoryDB2Impl
id="ratesRepositoryDB2Impl"
jndiName=”jndi/FXDB” dbSchema="FX">
</com.ibm.btt.bc.fx.impl.RatesRepositoryDB2Impl>
Because the Rates Repository layer is the bottom layer of the component and is tightly coupled with the datastorage, you can configure its attributes according to its implementation requirements. In this example, the attributes of the tag specifies jndi name of the data source, and the dbschema.
See also
Tasks
Using Foreign Exchange
The UNICOM® Digital Transformation Toolkit (UDTT™) ElementFactory organizes the dependency between different layers of the component according to the configuration. To instantiate the ForeignExchangeImpl, the client application is required to maintain a reference to the ElementFactory. To decouple with the implementation, the ForeignExchange interface has to be used to keep the reference of the ForeignExchangeImpl instance.
Example
ElementFactory factory = new UniversalElementFactory("jar:///foreignExchange.xml");
ForeignExchange fx = (ForeignExchange) factory.getElement("ForeignExchange");
See also
Tasks