EasyBeans

With Equinox Configuration Admin Service the Configuration can not be found with "(service.pid=org.ow2.easybeans.configuration)"

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Won't Fix
  • Affects Version/s: EasyBeans 1.1.0
  • Fix Version/s: EasyBeans 1.1.0 M1
  • Component/s: OSGi
  • Description:
    Hide
    In the OSGI bundle org.ow2.easybeans.agent, its Activator class org.ow2.easybeans.osgi.agent.Activator looks for a Configuration filtered with "(service.pid=org.ow2.easybeans.configuration)". With the Eclipse Equinox Configuration Admin Service when a Configuration is created with the statement createFactoryConfiguration( "org.ow2.easybeans.configuration", null) the pid is the factoryPid (org.ow2.easybeans.configuration) plus some extra numbers, so the statement listConfigurations("(service.pid=org.ow2.easybeans.configuration)") in this Activator class does not find the Configuration. It would be nice to change this statement to filter on the factoryPid as follows: listConfigurations("(service.factoryPid=org.ow2.easybeans.configuration)"), so that it works with Eclipse Equinox.
    Show
    In the OSGI bundle org.ow2.easybeans.agent, its Activator class org.ow2.easybeans.osgi.agent.Activator looks for a Configuration filtered with "(service.pid=org.ow2.easybeans.configuration)". With the Eclipse Equinox Configuration Admin Service when a Configuration is created with the statement createFactoryConfiguration( "org.ow2.easybeans.configuration", null) the pid is the factoryPid (org.ow2.easybeans.configuration) plus some extra numbers, so the statement listConfigurations("(service.pid=org.ow2.easybeans.configuration)") in this Activator class does not find the Configuration. It would be nice to change this statement to filter on the factoryPid as follows: listConfigurations("(service.factoryPid=org.ow2.easybeans.configuration)"), so that it works with Eclipse Equinox.
  • Environment:
    Eclipse Equinox 3.4, Red Hat Enterprise Linux 5.2

Activity

Hide
Simon Kelly added a comment - 27/Sep/08 5:11 PM
instead of using createFactoryConfiguration( "org.ow2.easybeans.configuration") you can call getConfiguration( "org.ow2.easybeans.configuration"). This creates a new Configuration if there is no existing service with the same PID.

An example of working code is:

ServiceReference configAdminReference = context
.getServiceReference(ConfigurationAdmin.class.getName());

if (configAdminReference == null)
throw new IllegalStateException(
"The OSGi ConfigAdmin Service is not available.");

Dictionary<String, String> props = new Hashtable<String, String>();
props.put("configuration.content", getXMLContent(context));

ConfigurationAdmin configAdminService = (ConfigurationAdmin) context
.getService(configAdminReference);
Configuration config = configAdminService
.getConfiguration("org.ow2.easybeans.configuration");
config.update(props);
Show
Simon Kelly added a comment - 27/Sep/08 5:11 PM instead of using createFactoryConfiguration( "org.ow2.easybeans.configuration") you can call getConfiguration( "org.ow2.easybeans.configuration"). This creates a new Configuration if there is no existing service with the same PID. An example of working code is: ServiceReference configAdminReference = context .getServiceReference(ConfigurationAdmin.class.getName()); if (configAdminReference == null) throw new IllegalStateException( "The OSGi ConfigAdmin Service is not available."); Dictionary<String, String> props = new Hashtable<String, String>(); props.put("configuration.content", getXMLContent(context)); ConfigurationAdmin configAdminService = (ConfigurationAdmin) context .getService(configAdminReference); Configuration config = configAdminService .getConfiguration("org.ow2.easybeans.configuration"); config.update(props);
Hide
Guillaume Sauthier added a comment - 29/Sep/08 11:39 AM
Yep, i guess that Simon is right.

Looking at the OSGI-INF/core-service.xml, you can also see that the core component has not been described has a factory, and that it also exposes a property named service.pid with the o.o.ezb.core value.

I will mark this issue as a "Won't fix", if you're OK with this ekke, please close the bug, or argument more ;)
Show
Guillaume Sauthier added a comment - 29/Sep/08 11:39 AM Yep, i guess that Simon is right. Looking at the OSGI-INF/core-service.xml, you can also see that the core component has not been described has a factory, and that it also exposes a property named service.pid with the o.o.ezb.core value. I will mark this issue as a "Won't fix", if you're OK with this ekke, please close the bug, or argument more ;)
Hide
Guillaume Sauthier added a comment - 29/Sep/08 11:40 AM
marked "won't fix" as per last comment
Show
Guillaume Sauthier added a comment - 29/Sep/08 11:40 AM marked "won't fix" as per last comment
Hide
Guillaume Sauthier added a comment - 29/Sep/08 11:41 AM
Ooops, replace "Ekke" by "Eric" :)
Apologies
Show
Guillaume Sauthier added a comment - 29/Sep/08 11:41 AM Ooops, replace "Ekke" by "Eric" :) Apologies
Hide
Eric Glass added a comment - 29/Sep/08 2:33 PM
Thanks Simon for the correct solution to my issue. I will implement this solution into our application.

Guillaume, I am okay with closing this issue; and no problem with the mis-spelling of my name.
Show
Eric Glass added a comment - 29/Sep/08 2:33 PM Thanks Simon for the correct solution to my issue. I will implement this solution into our application. Guillaume, I am okay with closing this issue; and no problem with the mis-spelling of my name.

People

Dates

  • Created:
    29/Jul/08 6:26 PM
    Updated:
    29/Sep/08 3:02 PM
    Resolved:
    29/Sep/08 11:40 AM