2010年12月15日水曜日

5.2.2 サービスインターフェース (Service Interfaces)

サービスインターフェースはサービスの public メソッド群の仕様である.

A service interface is the specification of the service's public methods.

実際には, バンドル開発者がサービスのインターフェースを実装してサービスオブジェクトを作成し, そのサービスをフレームワークサービスレジストリーに登録することになる. バンドルがあるインターフェース名のもとにサービスを登録すると, 他のバンドルは, 関連付けられたサービスをそのインターフェース名において取得することができ, そのサービスインターフェースを通じてメソッドにアクセスすることができる. フレームワークはまた, クラス名のもとにサービスオブジェクトを登録することもサポートしている. そのため, この仕様内においてサービスインターフェースとして言及されるものは, インターフェースもしくはクラスと解釈することができる.

In practice, a bundle developer creates a service object by implementing its service interface and registers the service with the Framework service registry. Once a bundle has registered a service object under an interface name, the associated service can be acquired by bundles under that interface name, and its methods can be accessed by way of its service interface. The Framework also supports registering service objects under a class name, so references to service interface in this specification can be interpreted to be an interface or class.

フレームワークにサービスオブジェクトを要求するとき, バンドルは要求するサービスオブジェクトが実装していなければならないサービスインターフェースの名前を指定することができる. その要求において, バンドルはまた検索対象を限定するためのフィルター文字列を指定してもよい.

When requesting a service object from the Framework, a bundle can specify the name of the service interface that the requested service object must implement. In the request, the bundle may also specify a filter string to narrow the search.

多くのサービスインターフェースが OSGi アライアンス等の組織により定義されて詳述されている. 標準として受け入れられたサービスインターフェースは, 多くのバンドル開発者が実装し, また, 使用することができる.

Many service interfaces are defined and specified by organizations such as the OSGi Alliance. A service interface that has been accepted as a standard can be implemented and used by any number of bundle developers.