2010年12月18日土曜日

5.2.8 サービスプロパティーの取得 (Getting Service Properties)

サービスオブジェクに関する問い合わせに応えるため, ServiceReference インターフェースは次の二つのメソッドを定義している:

To allow for interrogation of service objects, the ServiceReference interface defines these two methods:

  • getPropertyKeys() ─ 利用可能なプロパティーキー群の配列を返す.
  • getProperty(String) ─ プロパティーの値を返す.

  • getPropertyKeys() - Returns an array of the property keys that are available.
  • getProperty(String) - Returns the value of a property.

これらのメソッドは両方とも, 参照されているサービスオブジェクトがフレームワークから削除された後も, それに関する情報を提供し続けなければならない. ログサービスに ServiceReference オブジェクトが格納されたときに, この要求事項が有用となる.

Both of these methods must continue to provide information about the referenced service object, even after it has been unregistered from the Framework. This requirement can be useful when a ServiceReference object is stored with the Log Service.