Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Difference between component factory and service factory
Difference between component factory and service factory [message #96526] Tue, 04 September 2007 10:01 Go to next message
Pedro Silva is currently offline Pedro SilvaFriend
Messages: 25
Registered: July 2009
Junior Member
Hi,

I was reading the Declarative Service Specification in OSGI compendium
and noticed that there are to kinds of factory settings:
- Component factory
- Service factory

What I can't seem to understand is what exactly are the differences
between them. From what I've read they are about the same thing,
especially because you have to use only one of them. If you use service
factory setting the framework instantiates a new configuration, which is
what the component factory does...

Am I getting this wrong? Are they really different?

Thanks,
Pedro Silva
Re: Difference between component factory and service factory [message #96557 is a reply to message #96526] Tue, 04 September 2007 20:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: 9simmend.informatik.uni-hamburg.de

Pedro Silva schrieb:
> Hi,
>
> I was reading the Declarative Service Specification in OSGI compendium
> and noticed that there are to kinds of factory settings:
> - Component factory
> - Service factory
>
> What I can't seem to understand is what exactly are the differences
> between them. From what I've read they are about the same thing,
> especially because you have to use only one of them. If you use service
> factory setting the framework instantiates a new configuration, which is
> what the component factory does...
>
> Am I getting this wrong? Are they really different?
>
> Thanks,
> Pedro Silva

I used the servicefactory="true" option to create a new service instance
for each client. But there is no possibility to influence the kind of
instance being created. There is also no possibility to influence the
activation of the component, because it is a service you create.
The ComponentFactory instead leaves the activation to the client
requesting the component. Therfore it is no service but a component.
Using the componentfactory to create service doesnt make sense.

This is what i understood from the spec.

correct me if i am wrong
Re: Difference between component factory and service factory [message #96627 is a reply to message #96557] Wed, 05 September 2007 10:49 Go to previous message
Pedro Silva is currently offline Pedro SilvaFriend
Messages: 25
Registered: July 2009
Junior Member
Hi,

I've been thinking and reading about this issue. From what you said and
what I've been able to figure out this:

- Component Factory
Each client is responsible for creating a new component instance with
the newInstance() method from ComponentFactory interface (didn't find
any example of this yet). Clients can configure their components
accordingly by using properties that are passed in the newInstance()
method. SCR is responsible for registering each of the services that are
provided in the component.

- Service factory
SCR return a new component instance as a service to each of the
requesting clients but they all have the same component properties. This
means that everything is handled in the background by the framework.


I really would like to have this confirmed in order to choose correctly
what to use if I want to use the factory concept of the framework.

Thanks,
Pedro Silva


Felix Simmendinger wrote:
> Pedro Silva schrieb:
>> Hi,
>>
>> I was reading the Declarative Service Specification in OSGI compendium
>> and noticed that there are to kinds of factory settings:
>> - Component factory
>> - Service factory
>>
>> What I can't seem to understand is what exactly are the differences
>> between them. From what I've read they are about the same thing,
>> especially because you have to use only one of them. If you use
>> service factory setting the framework instantiates a new
>> configuration, which is what the component factory does...
>>
>> Am I getting this wrong? Are they really different?
>>
>> Thanks,
>> Pedro Silva
>
> I used the servicefactory="true" option to create a new service instance
> for each client. But there is no possibility to influence the kind of
> instance being created. There is also no possibility to influence the
> activation of the component, because it is a service you create.
> The ComponentFactory instead leaves the activation to the client
> requesting the component. Therfore it is no service but a component.
> Using the componentfactory to create service doesnt make sense.
>
> This is what i understood from the spec.
>
> correct me if i am wrong
Previous Topic:Equinox and extension-points forces singleton:=true
Next Topic:Checking for service availability
Goto Forum:
  


Current Time: Thu Apr 25 09:51:36 GMT 2024

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

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

Back to the top