/**
 * Copyright (c) 2014-2015 openHAB UG (haftungsbeschraenkt) and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 */
package org.eclipse.smarthome.core.binding.xml.internal;

import java.util.List;

import org.eclipse.smarthome.config.core.ConfigDescription;
import org.eclipse.smarthome.config.core.ConfigDescriptionParameter;
import org.eclipse.smarthome.config.core.FilterCriteria;
import org.eclipse.smarthome.config.xml.ConfigDescriptionConverter;
import org.eclipse.smarthome.config.xml.ConfigDescriptionParameterConverter;
import org.eclipse.smarthome.config.xml.FilterCriteriaConverter;
import org.eclipse.smarthome.config.xml.util.NodeAttributes;
import org.eclipse.smarthome.config.xml.util.NodeAttributesConverter;
import org.eclipse.smarthome.config.xml.util.NodeList;
import org.eclipse.smarthome.config.xml.util.NodeValue;
import org.eclipse.smarthome.config.xml.util.NodeValueConverter;
import org.eclipse.smarthome.config.xml.util.XmlDocumentReader;

import com.thoughtworks.xstream.XStream;

/**
 * The {@link BindingInfoReader} reads XML documents, which contain the {@code binding} XML tag,
 * and converts them to {@link BindingInfoXmlResult} objects.
 * <p>
 * This reader uses {@code XStream} and {@code StAX} to parse and convert the XML document.
 *
 * @author Michael Grammling - Initial Contribution
 * @author Alex Tugarev - Extended by options and filter criteria
 */
public class BindingInfoReader extends XmlDocumentReader<BindingInfoXmlResult> {

    /**
     * The default constructor of this class.
     */
    public BindingInfoReader() {
        super.setClassLoader(BindingInfoReader.class.getClassLoader());
    }

    @Override
    public void registerConverters(XStream xstream) {
        xstream.registerConverter(new NodeAttributesConverter());
        xstream.registerConverter(new NodeValueConverter());
        xstream.registerConverter(new BindingInfoConverter());
        xstream.registerConverter(new ConfigDescriptionConverter());
        xstream.registerConverter(new ConfigDescriptionParameterConverter());
        xstream.registerConverter(new FilterCriteriaConverter());
    }

    @Override
    public void registerAliases(XStream xstream) {
        xstream.alias("binding", BindingInfoXmlResult.class);
        xstream.alias("name", NodeValue.class);
        xstream.alias("description", NodeValue.class);
        xstream.alias("author", NodeValue.class);
        xstream.alias("service-id", NodeValue.class);
        xstream.alias("config-description", ConfigDescription.class);
        xstream.alias("config-description-ref", NodeAttributes.class);
        xstream.alias("parameter", ConfigDescriptionParameter.class);
        xstream.alias("options", NodeList.class);
        xstream.alias("option", NodeValue.class);
        xstream.alias("filter", List.class);
        xstream.alias("criteria", FilterCriteria.class);
    }

}

@@ -526,24 +526,98 @@
 nParameter;%0A
+import org.eclipse.smarthome.config.core.ConfigDescriptionParameterGroup;%0A
 import org.e
@@ -661,16 +661,16 @@
 iteria;%0A
-
 import o
@@ -798,32 +798,114 @@
 meterConverter;%0A
+import org.eclipse.smarthome.config.xml.ConfigDescriptionParameterGroupConverter;%0A
 import org.eclip
@@ -1750,16 +1750,64 @@
 riteria%0A
+ * @author Chris Jackson - Add parameter groups%0A
  */%0Apubl
@@ -2455,32 +2455,115 @@
 erConverter());%0A
+        xstream.registerConverter(new ConfigDescriptionParameterGroupConverter());%0A
         xstream.
@@ -3086,32 +3086,32 @@
 ributes.class);%0A
-
         xstream.
@@ -3156,32 +3156,113 @@
 rameter.class);%0A
+        xstream.alias(%22parameter-group%22, ConfigDescriptionParameterGroup.class);%0A
         xstream.

Add support for parameter groups to binding xml