Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Configuring a ManagedServiceFactory with org.eclipse.equinox.cm
Configuring a ManagedServiceFactory with org.eclipse.equinox.cm [message #1714409] Thu, 12 November 2015 13:10 Go to next message
Antoni Mylka is currently offline Antoni MylkaFriend
Messages: 14
Registered: January 2015
Junior Member
How to make a ManagedServiceFactory work in an Eclipse RAP Launch configuration running on Equinox?

In our app, we have a number of configurations for ManagedServices in files that follow the convention:

configurations/services/<SERVICE_PID>.properties

But when I try to use a ManagedServiceFactory this doesn't work (inspired by a similar convention from felix configadmin under Karaf):

configurations/services/<SERVICE_FACTORY_PID>-<INSTANCE_NAME>.properties

All bundles seem to be there, but the ManagedServiceFactory is NOT called by the CM service tracker as if it did not see those configuration files at all.

I looked at http://git.eclipse.org/c/equinox/rt.equinox.bundles.git/tree/bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/ConfigurationStore.java but it doesn't seem to use the configurations/services folder at all, so there must be some other mechanism here.
Re: Configuring a ManagedServiceFactory with org.eclipse.equinox.cm [message #1714410 is a reply to message #1714409] Thu, 12 November 2015 13:14 Go to previous messageGo to next message
Thomas Watson is currently offline Thomas WatsonFriend
Messages: 503
Registered: July 2009
Senior Member
configurations/services folder is not OSGI specified. That must be something specific to Karaf that reads these resources and then uses config admin to configure the pids.
Re: Configuring a ManagedServiceFactory with org.eclipse.equinox.cm [message #1714421 is a reply to message #1714410] Thu, 12 November 2015 14:27 Go to previous messageGo to next message
Antoni Mylka is currently offline Antoni MylkaFriend
Messages: 14
Registered: January 2015
Junior Member
Thanks for the answer.

It is indeed not OSGI-specified. I stumbled upon a bundle in my target platform named pax-confman-propsloader-0.2.3.jar and found it's this:

https://ops4j1.jira.com/wiki/display/ops4j/Pax+ConfMan

Its sources are currently located in

https://github.com/ops4j/org.ops4j.pax.confman

It reads properties files from configurations/services and configurations/factories.

Most importantly this source file

https://github.com/ops4j/org.ops4j.pax.confman/blob/master/propsloader/src/main/java/org/ops4j/pax/configmanager/internal/handlers/PropertiesFileConfigurationHandler.java

has a method called getServicePID which clearly proves that it doesn't understand that files may have a name between service PID and .properties.

So the answer is: It doesn't work, because I use an outdated library to read config files, that doesn't support ManagedServiceFactories and has been effectively dead since October 2012. I should migrate to a different one.
Re: Configuring a ManagedServiceFactory with org.eclipse.equinox.cm [message #1714492 is a reply to message #1714421] Fri, 13 November 2015 07:56 Go to previous message
Antoni Mylka is currently offline Antoni MylkaFriend
Messages: 14
Registered: January 2015
Junior Member
Just for the record.

It turns out pax.confman does support ManagedServiceFactories. The syntax is different from the one used by Felix though. You need to place one file per factory in:

configurations/factories/<FACTORY_PID>.properties

That file configures all requested service instances according to a rather awkward syntax whose only documentation is in the Javadoc of this class:

https://github.com/ops4j/org.ops4j.pax.confman/blob/master/propsloader/src/main/java/org/ops4j/pax/configmanager/internal/ManagedFactoryPropertiesProcessor.java

So while it is indeed a dead project and using something else is still a good idea it is possible to get it to configure a managed service factory. It also works with org.eclipse.equinox.cm without further issues.
Previous Topic:[P2] Avoid recreation of config.ini, update other files then Bundles
Next Topic:Exporting Service from Composite Subsystem
Goto Forum:
  


Current Time: Thu Oct 03 18:03:43 GMT 2024

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

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

Back to the top