Running H/F 1 455
Notifying the view when the operation execution is finished. You may have
noticed that when carrying out visual composition, you were setting the
attribute DSE_dataName of the input and output components as the ID of the
fields from the operation context. This is all that you require to define which
fields will interact with the operation context.
In order to create a client operation instance, initialize the Branch Transformation
Toolkit environment. In this sample, since you are working in a client/server
environment, initialize the complete Branch Transformation Toolkit client
environment. To do this, use the initialize() method of the view that has been
automatically created.
1. Navigate to the class declaration of the WithdrawalView (right-click it and
select Open With → Java Editor), add a statement to import the contents of
the com.ibm.dse.base package, as shown in Example 8-40.
Example 8-40 Add import class
...
import java.io.BufferedInputStream;
import com.ibm.btt.dse.base.*;
import com.ibm.dse.clientserver.CSClientService;
...
2. Create a new method named initEnv() in the class WithdrawalView that
throws Exception. This method initializes the entire Branch Transformation
Toolkit client environment.The source code is shown in Example 8-41.
Example 8-41 Add method initEnv
...
private void initEnv() throws Exception{
String iniPath =
"http://127.0.0.1:9080/BTTBankAppClientWeb/dse/dse.ini";//$NON-NLS-1$
Context.reset();
Settings.reset(iniPath);
Settings.initializeExternalizers(Settings.MEMORY);
Context context= (Context)Context.readObject("workstationCtx");
System.out.println(context);
System.out.println(context.getService("CSClient"));
((CSClientService) context.getService("CSClient")).establishSession();
ClientOperation anOp =
(ClientOperation)DSEOperation.readObject("startupClientOp");
anOp.execute();
}
...