迁移后的任务
完成 J2C 服务迁移过程之后,可能需要执行一些迁移后应执行的任务。
根据要迁移的程序的类型,可能需要执行某些迁移后应执行的步骤。
- 用户定制代码:由于迁移工具不会迁移用户定制代码,因此,在新项目中应对此代码进行更新。
- 消息格式处理程序:如果要在客户机应用程序代码中使用消息格式处理程序,则需要替换对 formatHandler 的引用。但是,需要使用生成的输入或输出 bean 来直接获取字节大小。以下代码是一个示例:
// ---------------------------------------------------
// Populate the IMS transaction input message with
// data. Use the input message format handler method
// getSize() to set the LL field of the input message.
// ---------------------------------------------------
//INPUTMSGFormatHandler inFmtHndlr =new INPUTMSGFormatHandler();
//INPUTMSG input = (INPUTMSG) inFmtHndlr.getObjectPart();
// input.setIn__ll((short) inFmtHndlr.getSize());
//new J2C code
INPUTMSG input = new INPUTMSG();
input.setIn__ll((short) input.getSize());
// ---------------------------------------------------
// Retrieve the multi-segment output message as a
// byte array using the output message format
// handler method getBytes().
// ---------------------------------------------------
// OutMsgFormatHandler outFmtHndlr =
// (OutMsgFormatHandler) output._getFormatHandler();
// segBytes = outFmtHndlr.getBytes();
//new J2C code
segBytes = output.getBytes();
//-----old wsadie code----------------------------------------------
// Create and populate segment object from byte array.
//-------------------------------------------------------------------------
//OUTPUTSEG1FormatHandler outSeg1FH =
//new OUTPUTSEG1FormatHandler();
// outSeg1FH.setBytes(buff);
//OUTPUTSEG1 S1 =
//(OUTPUTSEG1) outSeg1FH.getObjectPart();
//new J2C code
OUTPUTSEG1 S1 = new OUTPUTSEG1();
S1.setBytes(buff);
- 其他工件:如果想要生成其他工件(例如,JSP、EJB 或 Web Service),可以通过从 J2C Java™ Bean 向导调用 Web 页面、Web Service 和 EJB 来实现。