412 IBM Branch Transformation Toolkit 5.1 Migration and Usage Guidelines
Adding code to the BTTBankProcess project
Implement the DepositSnippetImplement class by performing the following tasks:
1. Open DepositSnippetImplement.java from the
btt.bank.business.logic.snippets package.
2. Add the import statements shown in Example 8-33.
Example 8-33 Additional import statements for DepositSnippetImplement.java
import com.ibm.btt.base.Context;
import com.ibm.btt.formatter.client.FormatElement;
import com.ibm.btt.services.jdbcjournalservice.Journal;
3. Add the code shown in Example 8-34 in the execute method.
Example 8-34 The execute method for the DepositSnippetImplement class
public int execute() throws BTTBPException {
System.out.println("Executed depositServerOp.snippets.initial");
//User code here
try{
// initialize context hierarchy
Context BPContext = getContext() ;
if(BPContext.getParent() == null){
Context parent= Context.getContextByInstanceID(getSystemData()
.getInstanceId());
BPContext.chainTo(parent);
}
// set data to deposit context
String hostBuff = ((FormatElement)getFormat("withdrawalCSRequestFmt"))
.format(BPContext);
setValueAt("HostBuff", hostBuff);
System.out.println("deposit BP context:\n" +
BPContext.getKeyedCollection());
// writes to the journal using the appropriate format
Journal journal = (Journal)getService("JournalService");
int recordNum = journal.addRecord(BPContext,"preSendJournalFmt");
// Set hard coded response data to deposit context
BPContext.setValueAt("TrxReplyCode", "00");
BPContext.setValueAt("AccountBalance", "10000");
BPContext.setValueAt("TrxErrorMessage", "depositOK");
// Update the electronic journal record
journal.updateRecord(recordNum,getContext(),"afterRecJournalFmt");
journal.releaseServiceRequester();
} catch(Exception e){
Running H/F 1 413
e.printStackTrace();
}
System.out.println("deposit : executeJournalHostRequestDataStep ok!");
return 1;
}
4. Save and close the Java Editor for DepositSnippetImplement.java.
5. Copy three files, DummyJournal.properties, RemoteEJB.properties, and
ServiceRequesterIDs.properties from the ejbModule folder of the
BTTBankEJB project to the BTTBankProcess project as shown in
Figure 8-150.
Figure 8-150 Add three properties files into BTTBankProcess project
Generating deploy code for deposit.bpel
To generate the deply code, follow these steps:
1. Right-click the deposit.bpel file from the btt.bank.business.logic package of
the BTTBankProcess project. Select Enterprise Services Generate
Deploy Code from the context menu, as shown in Figure 8-151 on page 414.
414 IBM Branch Transformation Toolkit 5.1 Migration and Usage Guidelines
Figure 8-151 Generating deploy code
2. In the pop-up window, click ProcessPortType in the left navigation panel.
Select the SOAP/HTTP check box and then the Apache radio button. Click
OK, as shown in Figure 8-152.
Figure 8-152 Generate BPEL Deploy Code
Running H/F 1 415
The following projects are generated, containing the deploy code:
򐂰 BTTBankProcessEAR
򐂰 BTTBankProcessEJB
򐂰 BTTBankProcessWeb
You will see some errors. These can be fixed later (Can we say this? If the
solution is provided in this chapter/ book, shouldn’t we cross-reference it?).
Configuring generated projects
To configure BTTBankProcessEAR, perform the following tasks:
1. Ensure that both BTTBankProcess and DummyJournal projects are added
as the Project Utility JARs.
2. Import the following JARs from <BTT_install_dir>/jars to the
BTTBankProcessEAR project:
bttbase.jar
bttfmt.jar
bttjdbjsvc.jar
bttjdbtsvc.jar
bttsvcinfra.jar
bttsvcbean.jar
bttsvrflow.jar
To configure BTTBankProcessEJB, perform the following tasks:
1. In the Java JAR Dependencies panel, ensure that both DummyJournal and
BTTBankProcess are added as the dependent JARs.
2. In the Libraries page of the Java Build Path panel, do the following:
a. Ensure that the JRE System Library is WebSphere v5.1 EE JRE.
b. Ensure that these two JARs are added into the build path. If not, add them
by clicking Add Variable.
WAS_EE_V51/lib/wsadiebp.jar
WAS_EE_V51/lib/wsatlib.jar
c. Add the following JARs into the build path (use those that are there in the
BTTBankProcessEAR project):
bttbase.jar
bttfmt.jar
bttjdbjsvc.jar
bttjdbtsvc.jar
bttsvcinfra.jar
bttsvrflow.jar
416 IBM Branch Transformation Toolkit 5.1 Migration and Usage Guidelines
To configure BTTBankProcessWeb, in the Libraries page of the Java Build Path
panel, perform the following tasks:
a. Ensure that the JRE System Library is WebSphere v5.1 EE JRE.
b. Ensure that these two JARs are added into the build path. If not, add them
by clicking Add Variable.
WAS_EE_V51/lib/wsadiebp.jar
WAS_EE_V51/lib/wsatlib.jar
c. Add the following JARs into the build path (use those in the
BTTBankProcessEAR project):
bttbase.jar
bttfmt.jar
bttjdbjsvc.jar
bttjdbtsvc.jar
bttsvcinfra.jar
bttsvrflow.jar
To regenerate the deploy code for deposit.bpel, perform the following tasks:
1. Right-click the deposit.bpel file from the btt.bank.business.logic package of
the BTTBankProcess project. Select Enterprise Services Generate
Deploy Code from the context menu, as shown in Figure 8-151 on page 414.
2. In the pop-up window, click ProcessPortType in the left navigation panel.
Select the SOAP/HTTP check box and then the Apache radio button. Click
OK.
Laying out the presentation logic for the deposit operation
Go back to the Graphical Editor. You will see that the canvas looks like the one
shown in Figure 8-153 on page 417. All the three components use the
withdrawalServerCtx. You can reuse the withdrawal.gph Web diagram and the
struts-btt-withdrawal.xml Struts module here.

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.