public interface OsgiServiceRegistry
Use this registry to obtain services published this way from CORE code only.
This registry can be used as a factory bean so that client code can remain agnostic of this class.
The following example spring config creates the ContentPropertyService using the osgiServiceRegistry as a factory bean :
<bean id="contentPropertyService" factory-bean="osgiServiceRegistry" factory-method="getService" > <constructor-arg type="java.lang.Class" value="com.atlassian.confluence.api.service.content.ContentPropertyService"/> </bean>
NOTE: this registry's intended behaviour pretty closely overlaps a very small subset of what Gemini / Spring DM offers, but we don't want to depend on those tools for what is a moderately straightforward task.
Modifier and Type | Method and Description |
---|---|
<T> T |
getService(Class<T> clazz)
Provides an implementation of the given interface T that is guaranteed to be backed by the highest ranked
OSGI service implementing T.
|
<T> T getService(Class<T> clazz)
It is expected callers will use this method to obtain services that they will invoke later in response to user activity. Invoking methods on returned implementation immediately will probably not work, unless you know what you're doing.
Copyright © 2003–2017 Atlassian. All rights reserved.