< 前へ | 次へ >

レッスン 2.4: Google Protocol Buffers バンドルとサンプル・プラグイン・バンドルのインストール

このチュートリアルでは、Equinox OSGi コンソールを使用して、protobuf-java-2.4.0a-bundle.jar バンドルと ProtoBufSamplePlugins-1.0.0.jar プラグイン・バンドルをインストールします。

Google Protocol Buffers プラグインのインストール

次のステップを実行して、Google Protocol Buffers プラグインをインストールします。
OSGI コンソールで、次のコマンドを入力して、プラグインをインストールします。
osgi> install file:///wxs_sample_osgi_root/lib/com.google.protobuf_2.4.0a.jar
以下の出力が表示されます。
Bundle ID is 21

サンプル・プラグイン・バンドルの概要

OSGi サンプルには、カスタム ObjectGridEventListener や MapSerializerPlugin プラグインなどの eXtreme Scale プラグインを含む 5 つのサンプル・バンドルが含まれています。MapSerializerPlugin プラグインは Google Protocol Buffers サンプルと、MapSerializerPlugin サンプルが提供するメッセージを使用します。

次のバンドル、ProtoBufSamplePlugins-1.0.0.jarProtoBufSamplePlugins-2.0.0.jar は、wxs_sample_osgi_root/lib ディレクトリーにあります。

blueprint.xml ファイルの内容は 次のとおりです (コメントは削除してあります)。
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
	<bean id="myShardListener" class="com.ibm.websphere.samples.xs.proto.osgi.MyShardListenerFactory"/>
	<service ref="myShardListener" interface="com.ibm.websphere.objectgrid.plugins.osgi.PluginServiceFactory" ranking="1">
	</service>

	<bean id="myProtoBufSerializer" class="com.ibm.websphere.samples.xs.proto.osgi.ProtoMapSerializerFactory">
		<property name="keyType" value="com.ibm.websphere.samples.xs.serializer.app.proto.DataObjects1$OrderKey" />
		<property name="valueType" value="com.ibm.websphere.samples.xs.serializer.app.proto.DataObjects1$Order" />
	</bean>

	<service ref="myProtoBufSerializer" interface="com.ibm.websphere.objectgrid.plugins.osgi.PluginServiceFactory"
		ranking="1">
	</service>
</blueprint>

Blueprint XML ファイルは 2 つの サービス、myShardListenermyProtoBufSerializer をエクスポートします。 これら 2 つのサービスは、protoBufObjectgrid.xml ファイル内で参照されます。

サンプル・プラグイン・バンドルのインストール

次のステップを実行して、ProtoBufSamplePlugins-1.0.0.jar バンドルをインストールします。

Equinox OSGi コンソールで次のコマンドを実行して、ProtoBufSamplePlugins-1.0.0.jar プラグイン・バンドルをインストールします。
osgi> install file:///wxs_sample_osgi_root/lib/ProtoBufSamplePlugins-1.0.0.jar
以下の出力が表示されます。
Bundle ID is 22

レッスンのチェックポイント

このレッスンでは、protobuf-java-2.4.0a-bundle.jar バンドルと ProtoBufSamplePlugins-1.0.0.jar プラグイン・バンドルをインストールしました。

< 前へ | 次へ >