Skip to main content



      Home
Home » Eclipse Projects » Virgo » Using the Config admin service
Using the Config admin service [message #1044191] Thu, 18 April 2013 11:45 Go to next message
Eclipse UserFriend
I am wondering how to use the config admin service from my bundles deployed in Virgo, I must be missing something fundamental.

I have my configuration artifact properly listed in the admin console, with the right service.pid;

I register my service from a BundleActivator, and debugging shows that the call happens and uses the right PID.

My ManagedService.updated method however never gets called. The only thing I did config-wise is to declare my service class as implementing ManagedService, and implementing the updated method.

If I understand correctly the Config admin service is supposed to immediately call updated upon registration (even if no config has been set yet), what am I missing?

Is the config admin service running in the user region by default?

Thanks!
Franck

public void start(BundleContext context) throws Exception
{
	Dictionary<String, Object> config = new Hashtable<String, Object>();
	config.put(Constants.SERVICE_PID, SERVICE_ID);
	context.registerService(SERVICE_ID, this, config);
}

public void updated(Dictionary<String, ?> config) throws ConfigurationException
{
...
}


Edit: Answered the last question - the service is up and running according to the user region console:
{org.osgi.service.cm.ConfigurationAdmin}={service.id=59}
"Registered by bundle:" org.eclipse.equinox.cm_1.0.400.v20120319-2029 [15]
"Bundles using service"
org.eclipse.equinox.ds_1.4.0.v20120112-1400 [19]
org.eclipse.gemini.management_1.0.5.RELEASE [26]
org.eclipse.virgo.nano.core_3.6.1.RELEASE [41]
org.eclipse.virgo.medic.core_3.6.1.RELEASE [38]
org.eclipse.virgo.kernel.osgi_3.6.1.RELEASE [33]
org.eclipse.virgo.kernel.services_3.6.1.RELEASE [34]
org.eclipse.virgo.kernel.userregionfactory_3.6.1.RELEASE [35]
org.eclipse.virgo.kernel.model_3.6.1.RELEASE [32]

[Updated on: Thu, 18 April 2013 11:48] by Moderator

Re: Using the Config admin service [message #1044610 is a reply to message #1044191] Fri, 19 April 2013 01:55 Go to previous messageGo to next message
Eclipse UserFriend
Hello Franck,

Have you checked if your ManagedService is registered as a service at all?

Regards,
Lazar
Re: Using the Config admin service [message #1044826 is a reply to message #1044610] Fri, 19 April 2013 07:40 Go to previous messageGo to next message
Eclipse UserFriend
Yes it is, and properly resolved by another service which is able to invoke it... at which point everything fails because the called service has not been configured.

I have been trying to debug the ConfigAdmin code, got lost in the maze of eclipse plugins... a Maven repo of the plugin versions used by Virgo would be very nice...

Anyway, still no clue as to what is happening here.

Franck
index.php/fa/14434/0/
  • Attachment: Capture.PNG
    (Size: 22.66KB, Downloaded 671 times)
Re: Using the Config admin service [message #1044940 is a reply to message #1044826] Fri, 19 April 2013 10:34 Go to previous message
Eclipse UserFriend
Well, there seems to be something fundamental I don't understand about OSGI service registrations.
Looking at one example that works with config admin, org.eclipse.virgo.kernel.userregion.internal.ConsoleConfigurationConvertor, I find this:

this.configuratorRegistration = this.context.registerService(ManagedService.class, new ConsoleConfigurator(), consoleProperties)

I thought the first argument to registerService was the "the class name under which the service can be located" (quoting the javadoc)??

Or... should I understand that I must contribute one service to receive config updates, and one service to implement whatever features I want to provide?

Confused...

Edit: two services seems to be the idea, according to the Log Service description below. Went through at least 20 config admin tutorial page and not a single one explained that clearly... sigh

Everything works fine with a dedicated ManagedService to receive updates in addition to the real service.

http://dz.prosyst.com/pdoc/mBS_SDK/um/runtime/osgi/docs/framework/bundles/osgi/log/log.html#manserv

[Updated on: Fri, 19 April 2013 10:49] by Moderator

Previous Topic:Eclipse plug-ins and extension points
Next Topic:Virgo Integration Test - Step by Step Guide
Goto Forum:
  


Current Time: Wed Jul 23 05:05:22 EDT 2025

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

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

Back to the top