| Difference between component factory and service factory [message #96526] |
Tue, 04 September 2007 06:01  |
Eclipse User |
|
|
|
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 #96627 is a reply to message #96557] |
Wed, 05 September 2007 06:49  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.03830 seconds