コンポーネントの作成

ComponentInstanceManager.createComponentInstance()メソッドをコールして、指定されたID (レコード・ストア・インスタンス名)を持つ指定されたタイプ(RecordStore)のコンポーネント・インスタンスを作成します。

このメソッドの構文は、次のとおりです。
ComponentInstanceManager.createComponentInstance(ComponentTypeId componentTypeId, ComponentInstanceId componentInstanceId)

componentTypeIdパラメータは、"RecordStore"に設定する必要があるComponentTypeIdです。

componentInstanceIdパラメータは、レコード・ストア・インスタンス名であるComponentInstanceIdです。

コンポーネントを作成するには:

  1. ServiceAddressオブジェクトを作成し、Component Instance Managerを実行しているサーバーのホストおよびポートを指定し、WebLogicにIASをインストールしている場合は、さらにcontextPathを指定します。JettyにIASをインストールしている場合は、contextPathを空の文字列に設定します。
  2. ComponentInstanceManagerLocatorcreate()メソッドをコールし、ServiceAddressオブジェクトに渡します。たとえば、次のようになります。
    ServiceAddress address = new ServiceAddress("localhost", 8401, contextPath); 
    ComponentInstanceManagerLocator locator = ComponentInstanceManagerLocator.create(address);
  3. ComponentInstanceManagerオブジェクトを作成し、getService()をコールして、サーバーおよびComponent Instance Managerサービスへの接続を確立します。たとえば、次のようになります。
    ComponentInstanceManager cim = locator.getService();
  4. createComponentInstance()をコールし、RecordStoreおよびレコード・ストア・インスタンス名を指定して、レコード・ストア・インスタンスを作成します。たとえば、次のようになります。
    cim.createComponentInstance(new ComponentTypeId("RecordStore"),
    new ComponentInstanceId("rs1"));