このタスクでは、既存の OSGi サービスを記述子 XML ファイルに
追加して、WebSphere® eXtreme
Scale コンテナーが OSGi 対応プラグインを
正しく認識し、ロードできるようにします。
始める前に
プラグインを構成するときは、必ず以下を実行してください。
- パッケージを作成し、OSGi デプロイメントのために動的プラグインを使用可能にする。
- プラグインを表す OSGi サービスの名前を用意しておく。
このタスクについて
プラグインをラップする OSGi サービスの作成は完了しています。次は、これらの
サービスを
objectgrid.xml ファイル内に
定義して、
eXtreme Scale コンテナーがプラグインを
正常にロードおよび構成できるようにする必要があります。
手順
- グリッド固有のプラグイン (TransactionCallback など) は、objectGrid エレメントの
下に指定しなければなりません。 objectgrid.xml ファイルの次の例を参照してください。
<?xml version="1.0" encoding="UTF-8"?>
<objectGridConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ibm.com/ws/objectgrid/config ../objectGrid.xsd"
xmlns="http://ibm.com/ws/objectgrid/config">
<objectGrids>
<objectGrid name="MyGrid" txTimeout="60">
<bean id="myTranCallback" osgiService="myTranCallbackFactory"/>
...
</objectGrid>
...
</objectGrids>
...
/objectGridConfig>
重要: osgiService 属性値は、myTranCallback PluginServiceFactory で
サービスが定義された blueprint XML ファイルに
指定されている ref 属性値と一致しなければなりません。
- マップ固有のプラグイン (例えば、ローダー、シリアライザーなど) は、backingMapPluginCollections エレメント内に
指定し、backingMap エレメントから参照されなければなりません。 objectgrid.xml ファイルの次の例を参照してください。
<?xml version="1.0" encoding="UTF-8"?>
objectGridConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ibm.com/ws/objectgrid/config ../objectGrid.xsd"
xmlns="http://ibm.com/ws/objectgrid/config">
<objectGrids>
<objectGrid name="MyGrid" txTimeout="60">
<backingMap name="MyMap1" lockStrategy="PESSIMISTIC"
copyMode="COPY_TO_BYTES" nullValuesSupported="false"
pluginCollectionRef="myPluginCollectionRef1"/>
<backingMap name="MyMap2" lockStrategy="PESSIMISTIC"
copyMode="COPY_TO_BYTES" nullValuesSupported="false"
pluginCollectionRef="myPluginCollectionRef2"/>
...
</objectGrid>
...
</objectGrids>
...
<backingMapPluginCollections>
<backingMapPluginCollection id="myPluginCollectionRef1">
<bean id="MapSerializerPlugin" osgiService="mySerializerFactory"/>
</backingMapPluginCollection>
<backingMapPluginCollection id="myPluginCollectionRef2">
<bean id="MapSerializerPlugin" osgiService="myOtherSerializerFactory"/>
<bean id="Loader" osgiService="myLoader"/>
</backingMapPluginCollection>
...
</backingMapPluginCollections>
...
</objectGridConfig>
タスクの結果
この例の
objectgrid.xml ファイルは、
MyMap1 と
MyMap2 の
2 つのマップを持つ
MyGrid というグリッドを作成するよう
eXtreme Scale に指示します。
MyMap1 マップは、OSGi サービス
mySerializerFactory によって
ラップされるシリアライザーを使用します。
MyMap2 マップは、OSGi サービス
myOtherSerializerFactory の
シリアライザーと、OSGi サービス
myLoader のローダーを使用します。