Sync Server 管理指南


提供您自己的错误处理逻辑

几乎所有错误信息都要求您执行一些操作来解决消息文本中所指示的问题。要简化日常的同步管理,您可选择添加您自己的逻辑,以在发出特定的错误信息号时自动执行这些操作。

要定义对错误的自动处理:

  1. 使用您选择的文本编辑器,打开下列文件进行编辑:
    DSYUserExits.properties
    
    此文件会将消息号与在其被写入日志时运行的例程或程序相关联。此属性文件支持许多不同的参数。
    # Formats:
    # {DSY message id}={class to execute} {environment parameters}
    # {DSY message id}={command to execute} {environment parameters}
    #   where
    #     {DSY message id}:
    #       a DSY* message id that you want to define a user exit for (such as 
    #       DSYD000E)
    #     {class to execute}:
    #       the name the Java .class to execute. This class must implement the
    #       com.ibm.mobileservices.DSYUserExitsInterface
    #     {command to execute}:
    #       the name the command to execute (such as pager.exe)
    #     {environment parameters}:
    #       a series of parameters to pass in to the class or command to execute
    #
    #   Optional command tags:
    #     <DSYID>            = the message id
    #     <DSYIDMSG>         = the message id message text
    #     <DSYIDMSG_>        = the message id message text, but all blanks are 
    #                          converted to underscores
    #     <DSYMSG>           = the message text
    #     <DSYMSG_>          = the message text, but all blanks are converted to 
    #                          underscores.
    #     <SERVER_IPADDRESS> = the server ip address (such as 9.112.19.143)
    #     <SERVER_NAME>      = the server name (such as mpauser.stl.ibm.com)
    #
    # Refer to the messages section for available DSY message ids.
    #
    # Example 1:
    #   If you wanted to have user exists for DSYD000E, you would add a line 
    #   similar to the following:
    #
    # DSYD000E=pager.exe number=5551234 id=<DSYID> msg=<DSYMSG_>
    #
    # When a DSYD000E message was issued, the pager.exe command would be executed
    # with two environment parameters would be set: number=5551234, id=DSYD000E
    # and msg=DSY message text, substituting an underscore (_) for blanks.
    #
    # Example 2:
    #   If you wanted to have a class executed when a DSYD020E was encountered,
    #   you would add a line similar to the following:
    #
    # DSYD020E=com.ibm.mobileservices.DSYUserExitsSample.class
    #
    # When a DSYD020E was issued, the com.ibm.mobileservices.DSYUserExitsSample 
    # class would be executed.
    
  2. 在文件末尾,将消息号与将该消息写入日志时执行的操作进行配对。这些操作可以是命令 (例如,可执行文件或批处理文件)或 Java 类。使用以下格式:
    message_number=action parameter=value
    

    其中:

    message_number
    是消息的编号。参见附录 A, 错误信息以了解信息代码及其相关联的文本。

    action
    引用所调用的命令或 Java 类的文件。Java 类必须实现 com.ibm.mobileservices.DSYUserExitsInterface。

    parameter=value
    参数集系列 (例如,lastname=Doefirstname=John),每个参数集用空格隔开。

    要执行的操作必须是对有效例程或程序的引用。

例如,假设您想包括用来在每次发出消息 DSYD000E 时都会通知您的用户出口。可以编写一个名为 pager.exe 的程序,它会拨叫您的寻呼机,并包括寻呼号作为参数。DSYUserExits 文件中的该行可能类似如下所示:

DSYD000E=pager.exe number=9980674

还可随命令包括下列参数和变量:

ID
使用此参数来编写信息代码。对于参数值,指定变量 DSYID

MSG
使用此参数来编写消息文本。对于参数值,指定 DSYMSG 来编写实际的消息文本,或者指定 DSYMSG_ 来编写消息文本,但应将文本中的所有空格转换为下划线字符。

以下示例将拨叫同一寻呼机,但是要同时提交消息号及其文本作为参数,因此,在寻呼机窗口中它们看起来将会如下所示:

DSYD000E=pager.exe number=9980674 id=dsyid msg=dsymsg

Sync Server 不会检查 DSYUserExits 文件中各项的有效性,也不会验证与信息相关联的操作是否完成。

要测试用户出口例程,包括了 DSYUserExitsTest.bat 文件工具。要使用 DSYUserExitsTest 工具来测试用户出口例程,使用以下格式:

DSYUserExitsTest.bat dsy_message_id

其中,dsy_message_id 是您想模拟的消息号。如果不提供消息标识,则会显示可用的消息标识的列表。

具有消息标识 DSYS001I 的示例命令:

DSYUserExitsTest.bat dsys001i

生成了 DSYS001I 消息,并且启动了为此消息号定义的用户出口。

具有无效消息号的示例命令:

DSYUserExitsTest.bat zzz

DSYUserExitsTest 工具的输出是:

DSYUserExitsTest
找不到 DSY 消息标识‘ZZZ’。有效的 DSY 消息标识是:
DSYA000E, DSYA001E, DSYD000E, DSYD002E, DSYD006E, DSYD007E, ...


[ 页的顶部 | 上一页 | 下一页 | 目录 | 索引 ]