Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Declarative Service : Delayed Component vs Factory Component
Declarative Service : Delayed Component vs Factory Component [message #73575] Sun, 24 September 2006 19:37
Eclipse UserFriend
Originally posted by: olivier.XXXXgenericXXX-XXXconcept.com

Hi,

I try to find the best way to implement services in my work :

I have a bundle called 'core' which own a service 'ChromeProvider'
(interface and impl).. I want that 'client' bundles use this service using
the declarative services. The ChromeProvider service needs to now and store
the registering bundle (because this bundle access to internal resources).

Delayed Component :
with this declaration (in client bundle):
<scr:component name="chromeProvider" enabled="true">

<implementation class="core.chrome.ChromeProviderImpl" />

<property name="authority.test" value="/test/toto" />

<service>

<provide interface="core.chrome.ChromeProvider" />

</service>

</scr:component>

Everything works fine, BUT the implementation must be visible to client
bundles (not internal). Of course, I can extends visible implementation by
an internal one!

Factory Component :
Using this :
<scr:component name="chromeProvider" factory="chromeProviderFactory">

<implementation class="core.chrome.ChromeProviderImpl" />

<service>

<provide interface="core.chrome.ChromeProvider" />

</service>

</scr:component>

and using newInstance(..), I can put implementation into 'internal'
packages, so everything goes right, BUT I cannot know the calling bundle
from inside "activate" method. The usingBundle is null (as explained in the
doc), and the ComponentContext.getBundleContext() returns the 'core'
bundleContext.

What can I do ?

IS there something I didn't understand in coponent factory ?

Is there a better way to respect Visible/Internal framework habits ?

Regards,

Olivier Moises
Previous Topic:demo application integrating JSP/JSTL, Struts...
Next Topic:Deploy demo application sample-http on Tomcat
Goto Forum:
  


Current Time: Thu Apr 25 16:42:01 GMT 2024

Powered by FUDForum. Page generated in 0.02526 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top