同期サーバー 管理ガイド


独自のエラー処理論理の作成

ほとんどすべてのエラー・メッセージは、メッセージ・テキストに示された問題を解決するために処置を行うように要求します。日常の同期管理を単純化するために、特定のエラー・メッセージ番号が発行されたときに、これらの処置を自動的に実行する独自の論理を追加することができます。

エラーの自動処理を定義するには、次のようにします。

  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=Doe firstname=John など) であり、各セットはスペースによって区切られます。

    実行されるアクションは、有効なルーチンまたはプログラムを指していなければなりません。

たとえば、メッセージ DSYD000E が発行されたときに、ページ表示を行うユーザー出口を組み込むと仮定します。ページャーにダイヤルする pager.exe と呼ばれるプログラムを作成し、ページャー番号をパラメーターとして指定することができます。 DSYUserExits における行は次のようになります。

DSYD000E=pager.exe number=9980674

コマンドで次のパラメーターおよび変数を指定することもできます。

ID
このパラメーターを使用して、メッセージ・コードの書き込みを行います。パラメーター値については、変数 DSYID を指定します。

MSG
このパラメーターを使用して、メッセージ・テキストの書き込みを行います。パラメーター値については、DSYMSG を指定して実際のメッセージ・テキストを書き込むか、DSYMSG_ を使用してメッセージ・テキストを書き込みますが、テキストにおけるすべてのブランク・スペースは下線文字に変換します。

次の例は同一のページャーにダイヤルしますが、メッセージ番号およびそのテキストが「Pager (ページャー)」ウィンドウに表示されるように、それらの両方をパラメーターとして実行依頼します。

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

同期サーバーは DSYUserExits ファイル内の項目の妥当性検査は行わず、メッセージに関連したアクションが完了しているかどうかのチェックも行いません。

ユーザー出口ルーチンをテストするため、DSYUserExitsTest.bat ファイル・ツールが組み込まれています。 DSYUserExitsTest ツールを使用してユーザー出口ルーチンをテストするには、次の形式を使用します。

DSYUserExitsTest.bat dsy_message_id

ここで、dsy_message_id は、シミュレートするメッセージ番号です。メッセージ ID を指定しないと、使用可能なメッセージ ID のリストが表示されます。

メッセージ ID が DSYS001I のコマンド例は次のとおりです。

DSYUserExitsTest.bat dsys001i

DSYS001I メッセージが生成され、このメッセージ番号に定義されているユーザー出口が開始されます。

以下は、無効なメッセージ番号を指定したコマンド例です。

DSYUserExitsTest.bat zzz

DSYUserExitsTest ツールの出力は以下のようになります。

DSYUserExitsTest
    DSY message id 'ZZZ' not found. Valid DSY message id's are: 
DSYA000E, DSYA001E, DSYD000E, DSYD002E, DSYD006E, DSYD007E, ...


[ ページのトップ | 前ページ | 次ページ | 目次 | 索引 ]