0

iPOJO では、サービス コンシューマーでサービス プロパティ ( getProperty(key) など) を読み取る方法はありますか? パブリッシャーは非常に簡単ですが、コンシューマーではフィルターしか使用できないようです。

ありがとう

4

1 に答える 1

1

サービス プロパティを取得するには、コールバックを使用する必要があります。

@Bind
public void bindService(HelloService hello, Dictionary<String, Object> properties) {
      // ...
}

また

@Bind
public void bindService(HelloService hello, Map<String, Object> properties) {
  // ...
}

OSGi サービス登録を取得することもできます。

@Bind
public void bindService(HelloService hello, ServiceReference<HelloService> reference) {
  // ...
}

詳細はすべてhttp://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/service-requirement-handler.html#note-about-callbacksにあります。

于 2013-11-15T06:33:19.917 に答える