http://knopflerfish.org/releases/current/docs/javadoc/org/osgi/framework/ServiceFactory.html
먼저 간단하게 설명을 보면 아래와 같다.
Allows services to provide customized service objects in the OSGi environment.
When registering a service, a ServiceFactory
object can be used instead of a service object, so that the bundle developer can gain control of the specific service object granted to a bundle that is using the service.
example을 보면 쉽게 이해할 수 있을 듯 하다.
example)
registration = bundlecontext.registerService((com.samsung.xoa.test.lib.TestCaseLinkImpl.class).getName(), this, null); // (1)
this 는 MainAgent라는 class로 ServiceFactory를 implement한다. TestCaseLinkImpl과는 직접적인 상관이 없기 때문에 무언가 이상하게 보일 수 있다.
만일 another bundle에서
linkRef = context.getServiceReference((com.samsung.xoa.test.lib.TestCaseLinkImpl.class).getName());
하게되면
(1)에서 정의한 getService()가 호출된다.
'osgi' 카테고리의 다른 글
Clear the configuration area before launching (0) | 2009.01.20 |
---|---|
What is a service factory? (0) | 2009.01.17 |
Bundle lifecycle (0) | 2009.01.07 |
ServiceTracker (0) | 2008.12.26 |