Running H/F 1 375
2. In the pop-up window, select Java JAR Dependencies from the left
navigation panel, and check DummyJournal.jar in the right panel. Click
Apply, as shown in Figure 8-109.
Figure 8-109 Add DummyJournal project JAR as the dependent JAR
3. Select Java Build Path from the left navigation panel, and select the
Projects tab from the right panel. Select DummyJournal and then click OK.
Invoking the Dummy Journal service in the withdrawal
operation
This section describes the process involved in modifying the execute method of
the WithdrawalServerOpBean to utilize the dummy journal service. For the
service mechanism to work correctly, you should take care of a series of
properties files as well.
376 IBM Branch Transformation Toolkit 5.1 Migration and Usage Guidelines
Configuring the BTTBankEJB project
To configure the BTTBankEJB project, follow these steps:
1. In the J2EE perspective, right-click the BTTBankEJB project. Select
Properties from the context menu.
2. In the pop-up window, select Java JAR Dependencies in the left navigation
panel, and check bttjdbjsvc.jar, bttjdbtsvc.jar, and DummyJournal.jar in
the right panel. Click Apply.
3. Select Java Build Path in the left navigation panel, click the Projects tab,
and check the DummyJournal project. Click the Libraries tab. Click Add
JARs to add bttjdbjsvc.jar and bttjdbtsvc.jar from the BTTBank project.
4. Click OK.
Adding the Dummy Journal service to withdrawal Single Action EJB
To modify the withdrawal business Single Action EJB, do the following:
1. In BTTBankEJB project, open the WithdrawalServerOpBean.java file from
the ejbModule/btt/bank/business/logic folder.
2. Add more import statements, as shown in Example 8-24.
Example 8-24 More import statements required by adding journal service
import com.ibm.btt.services.jdbcjournalservice.Journal;
3. Modify the execute method as shown in bold in Example 8-25.
Example 8-25 Add journal service code into WithdrawalServerOp EJB
public Hashtable execute(BTTSystemData sysData, Hashtable reqData)
throws Exception {
Hashtable result = null;
try {
// initialize context hierarchy
initialize(sysData);
Context SAEContext = getContext();
if (SAEContext.getParent() == null) {
Context parent = Context.getContextByInstanceID(getInstanceId());
SAEContext.chainTo(parent);
}
// set request data to withdrawalServerCtx
SAEContext.setValueAt("BranchId", (String)reqData.get("BranchId"));
SAEContext.setValueAt("AccountNumber",
(String)reqData.get("AccountNumber"));
SAEContext.setValueAt("Date", (Date)reqData.get("Date"));
SAEContext.setValueAt("Amount", (Float)reqData.get("Amount"));
String hostBuff = ((FormatElement)getFormat("withdrawalCSRequestFmt"))
Running H/F 1 377
.format(SAEContext);
setValueAt("HostBuff", hostBuff);
System.out.println("withdrawalServerOp SAE context:\n" +
SAEContext.getKeyedCollection());
// Add an electronic journal record
Journal journal = (Journal)getService("JournalService");
int recordNum = journal.addRecord(getContext(),"preSendJournalFmt");
// set hard-coded response data to withdrawalServerCtx
SAEContext.setValueAt("TrxReplyCode", "00");
SAEContext.setValueAt("AccountBalance", "10000");
SAEContext.setValueAt("TrxErrorMessage", "withdrawalOK");
// Update the electronic journal record
journal.updateRecord(recordNum, getContext(), "afterRecJournalFmt");
journal.releaseServiceRequester();
result = ((FormatElement)getFormat("afterRecJournalFmt"))
.formatHashtable(SAEContext);
}
catch (Exception e) {
e.printStackTrace();
throw e;
}
return result;
}
4. Save and close the Java File Editor.
In order to let the withdrawal Single Action EJB invoke the Dummy Journal
service properly, you should add at least three properties files in the ejbModule
folder, as shown in Example 8-26, Example 8-27, and Example 8-28 on
page 378.
Example 8-26 ServiceRequesterIDs.properties
# Property file for Service Requester Definition
# Definition is:
# ServiceRequesterID = ResourceBundle
JournalService=DummyJournal
# Include Invocation information
LocalJava=LocalJava
RemoteEJB=RemoteEJB
WSIFEJB=WSIFEJB
WSIFSoap=WSIFSoap
378 IBM Branch Transformation Toolkit 5.1 Migration and Usage Guidelines
Example 8-27 DummyJournal.properties
# Property file for dummy journal requester
ServiceRequester=btt.bank.services.DummyJournal
ServiceType=Journal
CachingEnabled=false
# The value of service invocation has to match the id in
# ServiceRequesterIDs.properties
ServiceInvocation=RemoteEJB
Example 8-28 RemoteEJB.properties
# Property file for Remote EJB Invocation Type
ServiceRequester=com.ibm.btt.services.EJBInvocation
# Information of Remote EJB invocation
JndiName=ejb/com/ibm/btt/services/BTTServiceHolderEJBHome
ProviderURL=IIOP://localhost:2809/
The flowchart in Figure 8-110 shows the invocation steps of the three properties
files.
Figure 8-110 The service invocation process
Service Client
(For example, SAE)
ServiceID =
"JournalService"
Look up ServiceRequesterIDs.properties file, based on client
provided ServideID "JournalService". It will then access the
DummyJournal.properties (JournalService=DummyJournal).
Retrieve the ServiceRequester information from the
DummyJournal.properties, and know the invocation definition
is RemoteEJB (ServiceInvocation=RemoteEJB).
Look up ServiceRequesterIDs.properties file again, and find
out the RemoteEJB.properties file defines the invocation
related details (RemoteEJB=RemoteEJB).
Get Service Invocation information from the file
RemoteEJB.properties, and access to the service server via
the information.
Running H/F 1 379
Registering the Dummy Journal service
The enhancement is almost complete. The final step is to register the service into
dse.ini. To do this, perform the following tasks:
1. Create the service definition file dsesrvce.xml.
a. In J2EE perspective, click the Project Navigator view. Right-click the
business folder in the BTTBankBTT project, and select New Other
from the context menu.
b. In the New pop-up dialog box, select Simple in the left navigation panel,
and select File in the right panel. Click Next.
c. Type dsesrvce.xml in the File name field of the next window. Click Finish.
d. The XML Editor would have started without content. Click the Source tab,
copy and paste the snippet in Example 8-29 into the editor.
e. Press Ctrl+S to save the change.
f. Put this file in the c:\dse directory for runtime execution.
Example 8-29 The dsesrvce.xml file
<?xml version="1.0"?>
<dsesrvce.xml>
<DummyDB2Journal autoCommit="false" id="Journal" schema="SCHEMA01">
<column dataName="UserId" id="USERID"/>
<column dataName="TID" id="TERMINALID"/>
<column dataName="HostBuff" id="DATABUFFER"/>
</DummyDB2Journal>
</dsesrvce.xml>
2. Change the settings in the dse.ini file, by doing the following:
a. Double-click BTTBankBusiness.chae to start the CHA Editor. Click the
dse.ini tab. Set field id=showMessagesOnServer’s value property as true
in the settings keyed collection. If the field is not there, add it as shown in
Example 8-30.
Example 8-30 Adding setting in the dse.ini
<dse.ini>
<kColl id="settings" dynamic="false" >
...
<field id="showMessagesOnServer" value="true" description="" />
...
</kColl>
</dse.ini>

Get IBM Branch Transformation Toolkit 5.1 Migration and Usage Guidelines now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.