ヘッダーをスキップ
Oracle Application Server Adapter for CICSユーザーズ・ガイド
10g (10.1.3.1.0)
B31896-01
  目次へ
目次
索引へ
索引

前へ
前へ
 
次へ
次へ
 

3 OC4JとのOracleAS Adapters for CICSの統合

OracleAS Adapters for CICSをデプロイし、Oracle Application Server Containers for J2EE(OC4J)と統合するには、J2CA 1.5 CICSアダプタを構成する必要があります。

この項の構成は、次のとおりです。

OC4JとのOracleAS Adapters for CICSの統合の概要

Oracle Application Serverは、標準Java Development Kit(JDK)のJava仮想マシン(JVM)で動作する完全なJava 2 Enterprise Edition(J2EE)環境を提供します。OC4Jは、J2EEに認定されており、J2EE固有のコンテナ、APIおよびサービスをすべて提供します。 OC4JはJ2CA 1.5標準をサポートしています。

J2CAは、EISとのアプリケーションの統合を単純化する標準Javaインタフェースを定義します。 OracleASアダプタは、リソース・アダプタ(RA)としてOC4Jコンテナ内にデプロイされます。

OC4Jクライアント・アプリケーションとリソース・アダプタとの規約は、Common Client Interface(CCI)によって定義されます。OC4Jコンテナとリソース・アダプタとの規約は、サービス・プロバイダ・インタフェース(SPI)によって定義されます。SPI APIは、接続管理、トランザクション管理およびセキュリティ管理を取り扱います。

接続管理により、アプリケーション・コンポーネントは、EISに接続し、アプリケーション・サーバーが提供する接続プーリングを利用できるようになります。

トランザクション管理により、アプリケーション・サーバーは、トランザクション・マネージャを使用して複数のリソース・マネージャ全体のトランザクションを管理できるようになります。

ライフサイクルの管理規約により、アプリケーション・サーバーは、アダプタのデプロイ時またはアプリケーション・サーバーの起動時にリソース・アダプタ・インスタンスを初期化できます。 さらに、サーバーの停止時またはアダプタのアンデプロイ時には、そのことをアプリケーション・サーバーからリソース・アダプタ・インスタンスに通知できます。

ライフサイクル規約により、アプリケーション・サーバーがリソース・アダプタ・インスタンスのライフサイクルを管理するメカニズムが提供されます。

作業管理規約により、リソース・アダプタは、自らスレッドを作成するかわりに、アプリケーション・サーバーがディスパッチしたスレッドを使用してロジックを実行できます。 ハンドシェイクはWorkインスタンスの発行を介して実行されます。 これにより、実行コンテキスト(セキュリティおよびトランザクションなど)がより制御され、アプリケーション・サーバーのスレッド管理が効率的になります。

メッセージのインフロー規約により、メッセージのスタイル、セマンティックまたは送信インフラストラクチャにかかわらず、リソース・アダプタがアプリケーション・サーバーのメッセージ・エンドポイントに非同期メッセージを送信できます。 これにより、リソース・アダプタを介してアプリケーション・サーバーに様々なメッセージ・プロバイダ(Java Message Service(JMS)またはJava API for XML(JAXM)など)をプラグインできます。


関連項目:

『Oracle Application Server Adapter概要』、『Oracle Application Server Containers for J2EEユーザーズ・ガイド』、『Oracle Application Server Containers for J2EEサービス・ガイド』および『Oracle Application Server Containers for J2EEセキュリティ・ガイド』

アウトバウンド用のJ2CA 1.5 CICSアダプタの統合

この項の構成は、次のとおりです。

アウトバウンド用のJ2CA 1.5 CICSアダプタの構成

Oracle Application Server下のJ2CA 1.5 CICSアダプタに接続するには、コネクション・ファクトリの関連パラメータを設定する必要があります。 このタスクを実行するには、Oracle Enterprise Managerを使用するか、次の手順を実行します。

  1. エディタで次のファイルを開きます。

    root\j2ee\home\application-deployment\default\oracle\oc4j-ra.xml
    

    rootは、Oracle Application Serverのルート・ディレクトリを示します。

  2. このファイルで、各接続に対して、次のパラメータを設定します。

    <oc4j-connector-factories>
      <connector-factory location=" " connector-name="Oracle Legacy Adapter">
        <config-property name="userName" value=" "/>
        <config-property name="password" value=" "/>
        <config-property name="eisName" value=" "/>
        <config-property name="serverName" value=" "/>
        <config-property name="workspace" value=" "/>
        <config-property name="portNumber" value=" "/>
        <config-property name="persistentConnection" value=" "/>
        <config-property name="keepAlive" value=" "/>
        <config-property name="firewallProtocol" value=""/>
        <config-property name="connectTimeout" value=""/>
        <config-property name="encryptionProtocol" value=""/>
        <config-property name="encryptionKeyName" value=""/>
        <config-property name="encryptionKeyValue" value=""/>
        <config-property name="fakeXA" value=" "/>
        <config-property name="useNamespace" value=" "/>
        <config-property name="networkXMLProtocol" value=" "/>
        <config-property name="exposeEventStreamMetadata" value=" "/>
      </connector-factory>
    </oc4j-connector-factories>
    
    

    注意:

    locationは、Oracle Application Serverがアプリケーション・コンポーネントのコネクション・ファクトリ・インスタンスをバインドするJNDIロケーションを指定する属性です。

    表3-1で、これらのパラメータを詳細に説明します。

    表3-1 アウトバウンド相互作用のOC4J接続プロパティ

    プロパティ 説明

    eisName

    必須。使用するアダプタの名前を設定します。 アダプタはOracle Studioを使用してOracle Connectサーバーで定義します。

    serverName

    必須。Oracle Connectデーモンが動作しているTCP/IPアドレスまたはホスト名を設定します。

    workspace

    オプション。 使用するOracle Connectサーバー・ワークスペースの名前を指定します。 デフォルトのワークスペースはNavigatorです。

    portNumber

    オプション。サーバー上でOracle Connectデーモンが動作しているTCP/IPポートを指定します。 デフォルトのポートは2551です。

    userName

    オプション。Oracle Connectサーバーにアクセスできるユーザーを指定します。Oracle Connectデーモンの構成で定義されたユーザーです。

    関連項目: Oracle Connectサーバーへのアクセスを許可するユーザーの詳細は、「デーモン・セキュリティ」および「ワークスペース・セキュリティ」を参照してください。

    password

    オプション。 ユーザーの有効なパスワードを指定します。

    persistentConnection

    オプション。 trueまたはfalseに設定します。 trueに設定した場合、接続は、複数のリクエストまたは複数の接続コンテキストの変更全体にわたって存続できます。 このプロパティはtrueに設定することをお薦めします。

    keepAlive

    オプション。 trueまたはfalseに設定します。 trueに設定すると、接続に使用するソケットが常にオープン状態となります。 このプロパティはtrueに設定することをお薦めします。

    firewallProtocol

    オプション。 使用するファイアウォール・プロトコルを指定します。noneまたはfixedNat(デーモンの固定アドレスを使用するNatプロトコル)を指定します。 デフォルトはnoneです。

    connectTimeout

    オプション。接続のタイムアウト(秒単位)を指定します。 デフォルトは0(ゼロ)です。これは、接続がタイムアウトしないことを意味します。

    encryptionProtocol

    オプション。使用する暗号化プロトコルの名前を指定します。 デフォルトはnullです。RC4プロトコルがサポートされます。

    encryptionKeyName

    オプション。使用する対称暗号鍵の名前を指定します。

    encryptionKeyValue

    オプション。使用する対称暗号鍵の値を指定します。

    fakeXa

    オプション。 対応するCICSアダプタのtransaction supportプロパティの値に基づき、trueまたはfalseに設定します。 trueに設定すると、XA APIがローカル・トランザクションAPIに内部的に変換されます。

    useNamespace

    オプション。 trueまたはfalseに設定します。 trueに設定すると、メタデータ・レコード・スキーマはネームスペースを使用します。

    networkXMLProtocol

    オプション。 XMLがネットワーク上で渡される方法を指定します。 BinaryまたはTextを選択します。

    exposeEventStreamMetadata

    オプション。 trueに設定すると、CICS/Qアダプタのインバウンド・イベント・メタデータに標準XSDスキーマが使用されます。 falseの場合、ネイティブ・スキーマが使用されます。


複数のアダプタの構成

各J2CA 1.5 CICSアダプタには、「アウトバウンド用のJ2CA 1.5 CICSアダプタの構成」に説明されているように、oc4j-ra.xmlファイルにエントリが必要です。


関連項目:

『Oracle Application Server Adapter概要』

構成情報の更新

リソース・アダプタの構成設定を変更するには、oc4j-ra.xmlファイルで関連するconnector-factoryエントリを編集します。 変更内容を有効にするには、Oracle Application Serverを停止して、再起動する必要があります。

CCI APIを使用したアプリケーションの開発

Common Client Interface(CCI)APIを使用して、アダプタ相互作用を実行するアプリケーションを開発できます。

J2CA 1.5 CICSアダプタでCCI APIを使用する手順は、次のとおりです。

  1. J2CA 1.5 CICSアダプタのConnectionFactoryオブジェクトを選択します。

  2. 選択したConnectionFactoryを使用してConnectionオブジェクトを作成します。Connectionは、EISへの基礎となるネットワーク接続に対するハンドルです。serverNameプロパティを使用してoc4j-ra-xmlファイルで識別されます。

  3. 選択したConnectionFactoryを使用してConnectionオブジェクトを作成します。AttuInteractionSpecオブジェクトを使用して相互作用プロパティを指定します。AttuInteractionSpecオブジェクトの書式は次のとおりです。

    AttuInteractionSpec(java.lang.String name, int verb, int timeOut)
    
    

    次の表に、指定できるプロパティを示します。

    表3-2 相互作用仕様プロパティ

    プロパティ 説明

    name

    実行する相互作用名を指定します。

    verb

    相互作用のモード(SYNC_SENDSYNC_SEND_RECEIVEまたはSYNC_RECEIVE)を指定します。

    timeOut

    指定された相互作用の実行に対して、EISが待機する時間(ミリ秒単位)を指定します。


    次に、InteractionSpecのサンプルを示します。

    AttuInteractionSpec iSpeq = new AttuInteractionSpec("query", javax.resource.cci.InteractionSpec.SYNC_RECEIVE, 60);javax.resource.cci.RecordFactory rf = new AttuRecordFactory(con, mcf.getLogger());
    javax.resource.cci.MappedRecord queryRecord = rf.createMappedRecord("query"), queryRecord.put("##text", "select * from disam:nation"); javax.resource.cci.Record oRec = interaction.execute(iSpec, queryRecord);
    
    
  4. interactionexecuteメソッドを起動し、EISへのコールを開始します。相互作用に対するデータは、入出力レコードとして渡します。

  5. 相互作用による処理の終了後、InteractionおよびConnectionオブジェクトを閉じます。

インバウンド用のJ2CA 1.5 CICS Queueアダプタの統合

この項の構成は、次のとおりです。

インバウンド用のJ2CA 1.5 CICS Queueアダプタの構成

エンドポイントのプロバイダは、エンドポイントのejb-jar.xmlというデプロイメント・ディスクリプタ・ファイルに次の情報を入力する必要があります。

  • CICS QueueアダプタのActivationSpecクラスのプロパティ

  • エンドポイントで実装されているメッセージ・リスナーのタイプ

orion-ejb.xmlファイルに、リソース・アダプタの名前を入力する必要があります。

OC4Jは、リソース・アダプタのデプロイメント・ディスクリプタでメッセージ・リスナー・タイプを検索し、対応するActivationSpecクラス用にエンドポイントのデプロイメント・ディスクリプタ・ファイルで定義されているプロパティを設定します。

リソース・アダプタは、次のメッセージ・リスナー・タイプおよびActivationSpecクラスをサポートしています。

表3-3 メッセージ・リスナーのタイプとそのActivationSpecクラス

メッセージ・リスナーのタイプ ActivationSpecクラス

javax.resource.cci.MessageListener

com.attunity.adapter.AttuActivationSpec

oracle.tip.adapter.api.OracleMessageListener

com.attunity.adapter.AttuOracleActivationSpec


例3-1 エンドポイントのデプロイメント・ディスクリプタ(ejb-jar.xml)

<ejb-jar>
 <display-name>AttuMDB1</display-name>
   <enterprise-beans>
   <message-driven>
      <display-name>Attu Test Receiver Bean</display-name>
      <ejb-name>AttuTestReceiverBean</ejb-name>
      <ejb-class>attutestreceiverbean.AttuTestReceiverBean</ejb-class>
      <messaging-type>javax.resource.cci.MessageListener</messaging-type>
      <transaction-type>Container</transaction-type>
      <activation-config>
        <activation-config-property>
          <activation-config-property-name>userName</activation-config-              property-name>
        </activation-config-property>
        <activation-config-property>
          <activation-config-property-name>password</activation-config-               property-name>
        </activation-config-property>
        <activation-config-property>
          <activation-config-property-name>firewallProtocol</activation-config-               property-name>
        </activation-config-property>
        <activation-config-property>
          <activation-config-property-name>connectTimeout</activation-config-               property-name>
        </activation-config-property>
        <activation-config-property>
          <activation-config-property-name>encryptionProtocol</activation-config-               property-name>
        </activation-config-property>
        <activation-config-property>
          <activation-config-property-name>encryptionKeyName</activation-config-               property-name>
        </activation-config-property>
        <activation-config-property>
          <activation-config-property-name>encryptionKeyValue</activation-config-               property-name>
        </activation-config-property>
        <activation-config-property>
          <activation-config-property-name>workspace</activation-config-               property-name>
          <activation-config-property-value>YTEST</activation-config-               property-value>
        </activation-config-property>
        <activation-config-property>
          <activation-config-property-name>portNumber</activation-config-              property-name>
          <activation-config-property-value>4820</activation-config-              property-value>
        </activation-config-property>
        <activation-config-property>
          <activation-config-property-name>useNamespace</activation-config-              property-name>
          <activation-config-property-value>true</activation-config-              property-value>
        </activation-config-property>
        <activation-config-property>
          <activation-config-property-name>networkXMLProtocol</activation-config-               property-name>
        </activation-config-property>
        <activation-config-property>
          <activation-config-property-name>idleTimeout</activation-config-               property-name>
        </activation-config-property>
        <activation-config-property>
          <activation-config-property-name>messagesInBatch</activation-config-              property-name>
          <activation-config-property-value>1</activation-config-              property-value>
        </activation-config-property>
        <activation-config-property>
          <activation-config-property-name>support2PC</activation-config-              property-name>
          <activation-config-property-value>true</activation-config-              property-value>
        </activation-config-property>
        <activation-config-property>
          <activation-config-property-name>waitTime</activation-config-              property-name>
          <activation-config-property-value>5</activation-config-              property-value>
        </activation-config-property>
        <activation-config-property>
          <activation-config-property-name>retryInterval</activation-config-              property-name>
          <activation-config-property-value>10</activation-config-              property-value>
        </activation-config-property>
        <activation-config-property>
          <activation-config-property-name>eisName</activation-config-              property-name>
          <activation-config-property-value>QVREAD</activation-config-              property-value>
        </activation-config-property>
        <activation-config-property>
          <activation-config-property-name>serverName</activation-config-              property-name>
          <activation-config-property-value>mvs5</activation-config-              property-value>
        </activation-config-property>
        <activation-config-property>
          <activation-config-property-name>exposeEventStreamMetadata</activation-              config-property-name>
          <activation-config-property-value>true</activation-config-              property-value>
        </activation-config-property>
     </activation-config>
     </message-driven>
   </enterprise-beans>
   <assembly-descriptor>
   <!-- NotSupported, Supports, Required, RequiresNew, Mandatory or Never  -->
    <container-transaction>
      <method>
        <ejb-name>
          AttuTestReceiverBean
        </ejb-name>
        <method-name>
          onMessage
        </method-name>
        <method-params>
        <method-param>javax.resource.cci.Record</method-param>
        </method-params>
      </method>
      <trans-attribute>
        Required
      </trans-attribute>
    </container-transaction>
    </assembly-descriptor>
</ejb-jar>

次の表に、インバウンド相互作用に関連のあるプロパティを示します。

表3-4 インバウンド相互作用のOC4J接続プロパティ

プロパティ 説明

eisName

必須。使用するアダプタの名前を設定します。 アダプタはOracle Studioを使用してOracle Connectサーバーで定義します。

serverName

必須。Oracle Connectデーモンが動作しているTCP/IPアドレスまたはホスト名を設定します。

messagesInBatch

オプション。 エンドポイントにバッチで移動できるメッセージの最大数を指定します。 デフォルトは1です。

support2PC

オプション。 2PCトランザクション・サポートを可能にします。 デフォルトはFalseです。 対応するイベントのtransaction supportプロパティの値に基づき、trueまたはfalseに設定します。

waitTime

オプション。 空のトランザクションを維持し、CICSアダプタが「no messages」レスポンスを返す(これによって現行のトランザクションが閉じられる)までの最大時間を秒単位で定義します。 デフォルトは30秒です。

retryInterval

オプション。 問題の検出後、インバウンド・アクティビティを再開するまでのスリープ時間を定義します。 デフォルトは15秒です。

workspace

オプション。 使用するOracle Connectサーバー・ワークスペースの名前を指定します。 デフォルトのワークスペースはNavigatorです。

portNumber

オプション。サーバー上でOracle Connectデーモンが動作しているTCP/IPポートを指定します。 デフォルトのポートは2551です。

userName

オプション。Oracle Connectサーバーにアクセスできるユーザーを指定します。Oracle Connectデーモンの構成で定義されたユーザーです。

関連項目: Oracle Connectサーバーへのアクセスを許可するユーザーの詳細は、「デーモン・セキュリティ」および「ワークスペース・セキュリティ」を参照してください。

password

オプション。 ユーザーの有効なパスワードを指定します。

firewallProtocol

オプション。 使用するファイアウォール・プロトコルを指定します。noneまたはfixedNat(デーモンの固定アドレスを使用するNatプロトコル)を指定します。 デフォルトはnoneです。

connectTimeout

オプション。接続のタイムアウト(秒単位)を指定します。 デフォルトは0(ゼロ)です。これは、接続がタイムアウトしないことを意味します。

encryptionProtocol

オプション。使用する暗号化プロトコルの名前を指定します。 デフォルトはnullです。RC4プロトコルがサポートされます。

encryptionKeyName

オプション。使用する対称暗号鍵の名前を指定します。

encryptionKeyValue

オプション。使用する対称暗号鍵の値を指定します。

useNamespace

オプション。 trueまたはfalseに設定します。 trueに設定すると、メタデータ・レコード・スキーマはネームスペースを使用します。

networkXMLProtocol

オプション。 XMLがネットワーク上で渡される方法を指定します。 BinaryまたはTextを選択します。

exposeEventStreamMetadata

オプション。 true(デフォルト)に設定すると、EventStreamスキーマがエンドポイントに送信されます。


CCI APIを使用したメッセージ・エンドポイント・アプリケーションの開発

エンドポイントはonMessageメソッドを実装する必要があります。 次の例に示すように、onMessageメソッドが受信するレコードはCoreDomRecordクラスです。

例3-2 onMessageメソッド

public Record onMessage(Record inMessage)throws javax.resource.ResourceException {

    …
    CoreDOMWriter domW;
    domW = new CoreDOMWriter(false);
    Element outEl = ((CoreDomRecord)inMessage).getDom();
    String xml = domW.toXMLString(outEl);
    …

 return null;

}

アダプタは戻り値を無視します。

CICS Queueアダプタがemployeeおよびdepartmentの2種類のメッセージを記述する場合、XMLデータは次の入力レコード構造を取ります。

  • exposeEventStreamMetadataプロパティがtrueの場合

    <eventStream>
      < EMPLOYEE>
         ...
      </ EMPLOYEE>
      <DEPARTMENT>
         ...
      </DEPARTMENT>
    </eventStream>
    
    
  • exposeEventStreamMetadataプロパティがfalseの場合

    <getEventsResponse xmlns="noNamespace://QVREAD">
    <event eventName="EMPLOYEE" timestamp="2005-08-23T15:23:18">
      < EMPLOYEE>
         ...
      </ EMPLOYEE>
    </event>
    <event eventName=" DEPARTMENT " timestamp="2005-08-23T15:23:18">
      <DEPARTMENT>
        ...
      </DEPARTMENT>
    </event>
    </getEventsResponse>