Service Factories

3 views
Skip to first unread message

Thomas Calmant

unread,
Mar 11, 2017, 12:16:40 PM3/11/17
to ipopo...@googlegroups.com, ipop...@googlegroups.com
Hi,

Even if few people have answered the usage survey [1], a feature seems to be expected a lot more than others: the support for service factories.

I've prepared an issue on GitHub [2] to group the references and some steps required to make them work.

It doesn't mean that they'll be implemented right now, but they should be available in the next release (no release date for now).

[1] https://docs.google.com/forms/d/1zx18_Rg27mjdGrlbtr9fWFmVnZNINo9XCfrYJbr4oJI
[2] https://github.com/tcalmant/ipopo/issues/75

Cheers,
Thomas

Thomas Calmant

unread,
Apr 6, 2017, 5:16:55 PM4/6/17
to ipopo...@googlegroups.com, ipop...@googlegroups.com
Hi,

I've just pushed the first version of the support for OSGi Service Factories.
It is available on the "service_factories" branch of the project [1].
A sample provider can be found in the tests [2].

Each service factory must provide two methods:
- get_service(bundle, registration):
    - this method is called each time a new bundle requests this service.
    - Its parameters are the Bundle object describing the caller and the ServiceRegistration corresponding to the requested service
- unget_service(bundle, registration):
    - this method is called once a bundle has released all of its services
    - the parameters are the same as get_service()

When registering a service factory, it necessary to add the "factory=True" flag to BundleContext.register_service().

It is an early release, so it is buggy: all bug reports are more than welcome.
One of the main issue is that the services created with a factory are not cleaned up automatically after a bundle is stopped.
Also, it doesn't support Prototype Service Factories.

Darren G

unread,
Apr 6, 2017, 6:08:30 PM4/6/17
to ipopo...@googlegroups.com, ipop...@googlegroups.com
Thomas,
    This is great stuff. Thanks for all your enduring brilliant work and gracious support.


--
Vous recevez ce message, car vous êtes abonné au groupe Google Groupes "ipopo-users".
Pour vous désabonner de ce groupe et ne plus recevoir d'e-mails le concernant, envoyez un e-mail à l'adresse ipopo-users+unsubscribe@googlegroups.com.
Pour obtenir davantage d'options, consultez la page https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages