コンポーネントの削除

ComponentInstanceManager.deleteComponentInstance()メソッドをコールして、指定されたコンポーネント・インスタンス(レコード・ストア)を削除します。

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

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. deleteComponentInstance()をコールし、レコード・ストア・インスタンス名を指定して、レコード・ストア・インスタンス名を削除します。たとえば、次のようになります。
    cim.deleteComponentInstance(new ComponentInstanceId("rs1");

ComponentInstanceManager.deleteComponentInstance()メソッドが失敗した場合、例外が発生します。

これらの例外を捕捉するには、メソッドをコールする際にtryブロックを使用します。