Chapter 6. Post-migration activities 171
For accountStatementServerOp.snippets.initial, add the need to import class
code on top:
import com.ibm.btt.base.Context;
import com.ibm.btt.formatter.client.FormatElement;
import com.ibm.btt.services.jdbcjournalservice.JDBCJournal;
import com.ibm.btt.services.jdbcjournalservice.Journal;
In execute() method add code:
try{
if(getContext().getParent()==null)
//getContext().chainTo(Context.getContextNamed("javaSessionCtx"));
getContext().chainTo(Context.getContextByInstanceID(getSystemData().getInst
anceId()));
Journal journal;
setValueAt("HostBuff",((FormatElement)getFormat("accountStatementSendFmt"))
.format(getContext()));//$NON-NLS-2$//$NON-NLS-1$
// writes to the journal using the appropriate format
journal = (Journal)getService("JournalService");
journal.addRecord(getContext(),"preSendJournalFmt ");//$NON-NLS-1$
journal.releaseServiceRequester();
} catch(Exception e){
e.printStackTrace();
}
Change "return 0" to" return 1".
For accountStatementServerOp.snippets.state2, add the need to import class
code on top:
import java.util.Hashtable;
import javax.resource.cci.*;
import com.ibm.btt.base.*;
import com.ibm.btt.samples.business.sna.lu0.DummyLu0ConnectionSpec;
import com.ibm.btt.samples.business.sna.lu0.DummyLu0InteractionSpec;
import com.ibm.btt.samples.business.sna.lu0.DummyLu0Record;
import com.ibm.btt.services.*;
import com.ibm.btt.services.jdbcjournalservice.Journal;
import com.ibm.btt.formatter.client.FormatElement;
In execute() method add code:
try{
javax.naming.Context initialContext = null;
ConnectionFactory connectionFactory = null;
if (initialContext == null) {
initialContext = new javax.naming.InitialContext();
connectionFactory = (ConnectionFactory)
initialContext.lookup("snalu0");