Hi,

Am Montag, den 10.01.2011, 23:31 +0000 schrieb David Jencks: 
> Based on studying the DS spec and FELIX-2563 I think the answer is "yes" but 
> I'd like to double check.

Yes, a component is a single class, which is also used as the service if
it declares one or more Service elements.

> 
> I want to have a factory class as my DS Component that creates a single 
> framework-wide instance of the service that will get registered (configured 
> from the properties the component gets).  I don't want the factory component 
> class to implement any of the service interfaces.  Is there any way to do 
> this?

If you declare your component to be delayed (the default for components
to be registered as services), there is internally a factory (a
ServiceFactory actually) which creates a single instance of the
component as soon as the first client is requesting it, that is
accessing the service.

This is much like a ServiceFactory where each bundle actually gets the
same instance instead of a different instance for each bundle.

Now, what exactly should that factory you envision have to do ?

Should it only create the component, once configuration is available ?
This can easily be achieved by the configuration-policy=required on the
Component element. And this is still handled by DS.

> 
> The workaround I've found is to have the component delegate to the service 
> implementation class instance and implement all the desired service 
> interfaces.  This seems less than ideal.
> 
> thanks
> david jencks
> 

-- 
[email protected]
+41 61 226 98 44

Reply via email to