[
https://issues.apache.org/jira/browse/FELIX-901?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Felix Meschberger closed FELIX-901.
-----------------------------------
Resolution: Duplicate
I assume this can be closed a duplicate
> Webconsole creates a new configuration everytime a factory configuration is
> updated
> -----------------------------------------------------------------------------------
>
> Key: FELIX-901
> URL: https://issues.apache.org/jira/browse/FELIX-901
> Project: Felix
> Issue Type: Bug
> Components: Web Console
> Affects Versions: webconsole-1.2.2
> Environment: felix-1.4.1
> org.apache.felix.configadmin-1.0.4
> org.apache.felix.metatype-1.0.2
> org.apache.felix.webconsole-1.2.2
> org.osgi.compendium-1.2.0
> pax-web-service-0.5.1
> Reporter: Paul Neyens
> Assignee: Felix Meschberger
>
> When using the webconsole to update/edit configurations for a
> ManagedServiceFactory, it always creates a new configuration when pressing
> the 'save' button.
> Note:
> I 'm not sure how to set the 'pid' attribute in the metatype's Designate
> element when a factory pid is available. In any case, the factory does not
> show up in the webconsole unless the 'pid' value is identical to the
> 'factoryPid' value.
> Tested with following code: (I can provide a bundle if required)
> package trial;
> import org.osgi.framework.BundleActivator;
> import org.osgi.framework.BundleContext;
> import org.osgi.framework.Constants;
> import org.osgi.service.cm.ConfigurationException;
> import org.osgi.service.cm.ManagedServiceFactory;
> import java.util.Dictionary;
> import java.util.HashSet;
> import java.util.Set;
> import java.util.Hashtable;
> public class TrialManagedServiceFactory implements ManagedServiceFactory,
> BundleActivator {
> private static final String PID = "trial.TrialManagedServiceFactory";
> private Set<String> pids = new HashSet<String>();
> public void start(BundleContext bundleContext) throws Exception {
> Hashtable props = new Hashtable(5);
> props.put(Constants.SERVICE_PID, PID);
>
> bundleContext.registerService("org.osgi.service.cm.ManagedServiceFactory",
> this, props);
> }
> public void stop(BundleContext bundleContext) throws Exception {
> }
> public String getName() {
> return PID;
> }
> public void updated(String s, Dictionary dictionary) throws
> ConfigurationException {
> if (pids.add(s)) {
> System.out.println("TrialManagedServiceFactory: Received new pid
> " + s);
> } else {
> System.out.println("TrialManagedServiceFactory: Received pid
> update " + s);
> }
> System.out.println(dictionary);
> }
> public void deleted(String s) {
> if (pids.remove(s)) {
> System.out.println("TrialManagedServiceFactory: Deleted pid " +
> s);
> } else {
> System.out.println("TrialManagedServiceFactory: Cannot delete
> unknown pid " + s);
> }
> }
> }
> metatype:
> <?xml version="1.0" encoding="UTF-8"?>
> <MetaData xmlns="http://www.osgi.org/xmlns/metatype/v1.0.0">
> <OCD name="Trial Factory" id="trial.TrialManagedServiceFactory"
> description="Trial ManagedServiceFactory">
> <AD name="Param 1" id="trial.param.1" type="String"/>
> <AD name="Param 2" id="trial.param.2" type="Integer"/>
> </OCD>
> <Designate pid="trial.TrialManagedServiceFactory"
> factoryPid="trial.TrialManagedServiceFactory">
> <Object ocdref="trial.TrialManagedServiceFactory"/>
> </Designate>
> </MetaData>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.