Refactor XML handling (#3385)

* Refactor XML handling for things
* integrate config.xml and improve naming

Signed-off-by: Jan N. Klug <github@klug.nrw>
This commit is contained in:
J-N-K 2023-02-23 20:06:29 +01:00 committed by GitHub
parent f48200caa6
commit dff6f9b984
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
190 changed files with 499 additions and 907 deletions

View File

@ -66,7 +66,7 @@
</dependency>
<dependency>
<groupId>org.openhab.core.bundles</groupId>
<artifactId>org.openhab.core.addon.xml</artifactId>
<artifactId>org.openhab.core.addon</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
@ -88,12 +88,6 @@
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openhab.core.bundles</groupId>
<artifactId>org.openhab.core.thing.xml</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openhab.core.bundles</groupId>
<artifactId>org.openhab.core.transform</artifactId>
@ -352,12 +346,6 @@
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openhab.core.bundles</groupId>
<artifactId>org.openhab.core.config.xml</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openhab.core.bundles</groupId>
<artifactId>org.openhab.core.automation</artifactId>

View File

@ -20,6 +20,11 @@
<artifactId>org.openhab.core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.core.bundles</groupId>
<artifactId>org.openhab.core.addon</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.core.bundles</groupId>
<artifactId>org.openhab.core.automation</artifactId>

View File

@ -20,6 +20,11 @@
<artifactId>org.openhab.core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.core.bundles</groupId>
<artifactId>org.openhab.core.addon</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -6,6 +6,7 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src/generated/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
<attributes>
<attribute name="maven.pomderived" value="true"/>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.openhab.core.addon.xml</name>
<name>org.openhab.core.addon</name>
<comment></comment>
<projects>
</projects>

View File

@ -0,0 +1 @@

View File

@ -10,14 +10,14 @@
<version>4.0.0-SNAPSHOT</version>
</parent>
<artifactId>org.openhab.core.addon.xml</artifactId>
<artifactId>org.openhab.core.addon</artifactId>
<name>openHAB Core :: Bundles :: Add-on XML</name>
<dependencies>
<dependency>
<groupId>org.openhab.core.bundles</groupId>
<artifactId>org.openhab.core.config.xml</artifactId>
<artifactId>org.openhab.core.config.core</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

View File

@ -1,66 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:addon="https://openhab.org/schemas/addon/v1.0.0"
xmlns:config-description="https://openhab.org/schemas/config-description/v1.0.0"
targetNamespace="https://openhab.org/schemas/addon/v1.0.0">
<xs:import namespace="https://openhab.org/schemas/config-description/v1.0.0"
schemaLocation="https://openhab.org/schemas/config-description-1.0.0.xsd"/>
<xs:element name="addon">
<xs:complexType>
<xs:sequence>
<xs:element name="type" type="addon:addonType"/>
<xs:element name="name" type="xs:string"/>
<xs:element name="description" type="xs:string"/>
<xs:element name="connection" type="addon:connectionType" minOccurs="0"/>
<xs:element name="countries" type="addon:countryType" minOccurs="0">
<xs:annotation>
<xs:documentation>Comma-separated list of two-letter ISO country codes.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="service-id" type="xs:string" minOccurs="0">
<xs:annotation>
<xs:documentation>The ID (service.pid or component.name) of the main add-on service, which can be configured through OSGi configuration admin service. Should only be used in combination with a config description definition. The default value is &lt;type&gt;.&lt;name&gt;</xs:documentation>
</xs:annotation>
</xs:element>
<xs:choice minOccurs="0">
<xs:element name="config-description" type="config-description:configDescription"/>
<xs:element name="config-description-ref" type="config-description:configDescriptionRef"/>
</xs:choice>
</xs:sequence>
<xs:attribute name="id" type="config-description:idRestrictionPattern" use="required">
<xs:annotation>
<xs:documentation>The id is used to construct the UID of this add-on to &lt;type&gt;-&lt;name&gt;</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:simpleType name="addonType">
<xs:restriction base="xs:string">
<xs:enumeration value="automation"/>
<xs:enumeration value="binding"/>
<xs:enumeration value="misc"/>
<xs:enumeration value="persistence"/>
<xs:enumeration value="transformation"/>
<xs:enumeration value="ui"/>
<xs:enumeration value="voice"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="connectionType">
<xs:restriction base="xs:string">
<xs:enumeration value="local"/>
<xs:enumeration value="cloud"/>
<xs:enumeration value="cloudDiscovery"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="countryType">
<xs:restriction base="xs:string">
<xs:pattern value="[a-z]{2}(,[a-z]{2})*"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:addon="https://openhab.org/schemas/addon/v1.0.0"
xmlns:config-description="https://openhab.org/schemas/config-description/v1.0.0"
targetNamespace="https://openhab.org/schemas/addon/v1.0.0">
<xs:import namespace="https://openhab.org/schemas/config-description/v1.0.0"
schemaLocation="https://openhab.org/schemas/config-description-1.0.0.xsd"/>
<xs:element name="addon">
<xs:complexType>
<xs:sequence>
<xs:element name="type" type="addon:addonType"/>
<xs:element name="name" type="xs:string"/>
<xs:element name="description" type="xs:string"/>
<xs:element name="connection" type="addon:connectionType" minOccurs="0"/>
<xs:element name="countries" type="addon:countryType" minOccurs="0">
<xs:annotation>
<xs:documentation>Comma-separated list of two-letter ISO country codes.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="service-id" type="xs:string" minOccurs="0">
<xs:annotation>
<xs:documentation>The ID (service.pid or component.name) of the main add-on service, which can be configured through OSGi configuration admin service. Should only be used in combination with a config description definition. The default value is &lt;type&gt;.&lt;name&gt;</xs:documentation>
</xs:annotation>
</xs:element>
<xs:choice minOccurs="0">
<xs:element name="config-description" type="config-description:configDescription"/>
<xs:element name="config-description-ref" type="config-description:configDescriptionRef"/>
</xs:choice>
</xs:sequence>
<xs:attribute name="id" type="config-description:idRestrictionPattern" use="required">
<xs:annotation>
<xs:documentation>The id is used to construct the UID of this add-on to &lt;type&gt;-&lt;name&gt;</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:simpleType name="addonType">
<xs:restriction base="xs:string">
<xs:enumeration value="automation"/>
<xs:enumeration value="binding"/>
<xs:enumeration value="misc"/>
<xs:enumeration value="persistence"/>
<xs:enumeration value="transformation"/>
<xs:enumeration value="ui"/>
<xs:enumeration value="voice"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="connectionType">
<xs:restriction base="xs:string">
<xs:enumeration value="local"/>
<xs:enumeration value="cloud"/>
<xs:enumeration value="cloudDiscovery"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="countryType">
<xs:restriction base="xs:string">
<xs:pattern value="[a-z]{2}(,[a-z]{2})*"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>

View File

@ -0,0 +1,20 @@
<jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:xs="http://www.w3.org/2001/XMLSchema" jaxb:version="2.0">
<jaxb:globalBindings>
<xjc:serializable uid="1"/>
</jaxb:globalBindings>
<jaxb:bindings schemaLocation="../addon-1.0.0.xsd">
<jaxb:schemaBindings>
<jaxb:package name="org.openhab.core.addon.internal.dto"/>
<jaxb:nameXmlTransform>
<jaxb:typeName prefix="Xml"/>
<jaxb:anonymousTypeName prefix="Xml"/>
</jaxb:nameXmlTransform>
</jaxb:schemaBindings>
<jaxb:bindings node="//xs:element[@name='addon']">
<jaxb:class name="XmlAddon"/>
</jaxb:bindings>
</jaxb:bindings>
</jaxb:bindings>

View File

@ -16,8 +16,8 @@ import java.util.Locale;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.addon.internal.AddonI18nUtil;
import org.openhab.core.i18n.TranslationProvider;
import org.openhab.core.internal.addon.AddonI18nUtil;
import org.osgi.framework.Bundle;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;

View File

@ -10,7 +10,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.core.internal.addon;
package org.openhab.core.addon.internal;
import java.util.Locale;

View File

@ -10,7 +10,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.core.internal.addon;
package org.openhab.core.addon.internal;
import java.net.URI;
import java.util.Arrays;

View File

@ -10,7 +10,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.core.addon.xml.internal;
package org.openhab.core.addon.internal.xml;
import java.net.URI;
import java.util.List;
@ -21,9 +21,9 @@ import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.addon.AddonInfo;
import org.openhab.core.config.core.ConfigDescription;
import org.openhab.core.config.core.ConfigDescriptionBuilder;
import org.openhab.core.config.xml.util.ConverterAttributeMapValidator;
import org.openhab.core.config.xml.util.GenericUnmarshaller;
import org.openhab.core.config.xml.util.NodeIterator;
import org.openhab.core.config.core.xml.util.ConverterAttributeMapValidator;
import org.openhab.core.config.core.xml.util.GenericUnmarshaller;
import org.openhab.core.config.core.xml.util.NodeIterator;
import com.thoughtworks.xstream.converters.Converter;
import com.thoughtworks.xstream.converters.UnmarshallingContext;

View File

@ -10,7 +10,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.core.addon.xml.internal;
package org.openhab.core.addon.internal.xml;
import java.util.List;
@ -19,16 +19,16 @@ import org.openhab.core.config.core.ConfigDescription;
import org.openhab.core.config.core.ConfigDescriptionParameter;
import org.openhab.core.config.core.ConfigDescriptionParameterGroup;
import org.openhab.core.config.core.FilterCriteria;
import org.openhab.core.config.xml.ConfigDescriptionConverter;
import org.openhab.core.config.xml.ConfigDescriptionParameterConverter;
import org.openhab.core.config.xml.ConfigDescriptionParameterGroupConverter;
import org.openhab.core.config.xml.FilterCriteriaConverter;
import org.openhab.core.config.xml.util.NodeAttributes;
import org.openhab.core.config.xml.util.NodeAttributesConverter;
import org.openhab.core.config.xml.util.NodeList;
import org.openhab.core.config.xml.util.NodeValue;
import org.openhab.core.config.xml.util.NodeValueConverter;
import org.openhab.core.config.xml.util.XmlDocumentReader;
import org.openhab.core.config.core.xml.ConfigDescriptionConverter;
import org.openhab.core.config.core.xml.ConfigDescriptionParameterConverter;
import org.openhab.core.config.core.xml.ConfigDescriptionParameterGroupConverter;
import org.openhab.core.config.core.xml.FilterCriteriaConverter;
import org.openhab.core.config.core.xml.util.NodeAttributes;
import org.openhab.core.config.core.xml.util.NodeAttributesConverter;
import org.openhab.core.config.core.xml.util.NodeList;
import org.openhab.core.config.core.xml.util.NodeValue;
import org.openhab.core.config.core.xml.util.NodeValueConverter;
import org.openhab.core.config.core.xml.util.XmlDocumentReader;
import com.thoughtworks.xstream.XStream;

View File

@ -10,13 +10,13 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.core.addon.xml.internal;
package org.openhab.core.addon.internal.xml;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.addon.AddonInfo;
import org.openhab.core.config.core.ConfigDescription;
import org.openhab.core.config.xml.AbstractXmlConfigDescriptionProvider;
import org.openhab.core.config.xml.osgi.XmlDocumentProvider;
import org.openhab.core.config.core.xml.AbstractXmlConfigDescriptionProvider;
import org.openhab.core.config.core.xml.osgi.XmlDocumentProvider;
import org.osgi.framework.Bundle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -10,7 +10,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.core.addon.xml.internal;
package org.openhab.core.addon.internal.xml;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;

View File

@ -10,13 +10,13 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.core.addon.xml.internal;
package org.openhab.core.addon.internal.xml;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.config.core.ConfigDescription;
import org.openhab.core.config.core.ConfigDescriptionProvider;
import org.openhab.core.config.core.i18n.ConfigI18nLocalizationService;
import org.openhab.core.config.xml.AbstractXmlConfigDescriptionProvider;
import org.openhab.core.config.core.xml.AbstractXmlConfigDescriptionProvider;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;

View File

@ -10,7 +10,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.core.addon.xml.internal;
package org.openhab.core.addon.internal.xml;
import java.util.HashSet;
import java.util.Locale;
@ -25,12 +25,12 @@ import org.openhab.core.addon.AddonInfo;
import org.openhab.core.addon.AddonInfoProvider;
import org.openhab.core.common.ThreadPoolManager;
import org.openhab.core.config.core.ConfigDescriptionProvider;
import org.openhab.core.config.xml.AbstractXmlBasedProvider;
import org.openhab.core.config.xml.AbstractXmlConfigDescriptionProvider;
import org.openhab.core.config.xml.osgi.XmlDocumentBundleTracker;
import org.openhab.core.config.xml.osgi.XmlDocumentProvider;
import org.openhab.core.config.xml.osgi.XmlDocumentProviderFactory;
import org.openhab.core.config.xml.util.XmlDocumentReader;
import org.openhab.core.config.core.xml.AbstractXmlBasedProvider;
import org.openhab.core.config.core.xml.AbstractXmlConfigDescriptionProvider;
import org.openhab.core.config.core.xml.osgi.XmlDocumentBundleTracker;
import org.openhab.core.config.core.xml.osgi.XmlDocumentProvider;
import org.openhab.core.config.core.xml.osgi.XmlDocumentProviderFactory;
import org.openhab.core.config.core.xml.util.XmlDocumentReader;
import org.openhab.core.service.ReadyService;
import org.osgi.framework.Bundle;
import org.osgi.service.component.ComponentContext;

View File

@ -6,6 +6,7 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src/generated/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
<attributes>
<attribute name="maven.pomderived" value="true"/>

View File

@ -4,13 +4,17 @@
<xjc:serializable uid="1"/>
</jaxb:globalBindings>
<jaxb:bindings schemaLocation="update-description-1.0.0.xsd">
<jaxb:bindings schemaLocation="../config-description-1.0.0.xsd">
<jaxb:schemaBindings>
<jaxb:package name="org.openhab.core.thing.internal.update.dto"/>
<jaxb:package name="org.openhab.core.config.core.dto"/>
<jaxb:nameXmlTransform>
<jaxb:typeName prefix="Xml"/>
<jaxb:anonymousTypeName prefix="Xml"/>
</jaxb:nameXmlTransform>
</jaxb:schemaBindings>
</jaxb:bindings>
<jaxb:bindings schemaLocation="https://openhab.org/schemas/config-description-1.0.0.xsd">
<jaxb:bindings node="//xs:element[@name='config-descriptions']">
<jaxb:class name="XmlConfigDescriptions"/>
</jaxb:bindings>
<jaxb:bindings node="//xs:complexType[@name='parameter']">
<jaxb:bindings node=".//xs:attribute[@name='required']">
<jaxb:property name="RequiredAttribute"/>
@ -23,12 +27,4 @@
</jaxb:bindings>
</jaxb:bindings>
<jaxb:bindings schemaLocation="https://openhab.org/schemas/thing-description-1.0.0.xsd">
<jaxb:bindings node="//xs:complexType[@name='option']">
<jaxb:bindings node=".//xs:attribute[@name='value']">
<jaxb:property name="ValueAttribute"/>
</jaxb:bindings>
</jaxb:bindings>
</jaxb:bindings>
</jaxb:bindings>

View File

@ -10,7 +10,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.core.config.xml;
package org.openhab.core.config.core.xml;
import java.util.Collection;
import java.util.Iterator;

View File

@ -10,7 +10,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.core.config.xml;
package org.openhab.core.config.core.xml;
import java.net.URI;
import java.util.Collection;

View File

@ -10,7 +10,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.core.config.xml;
package org.openhab.core.config.core.xml;
import java.net.URI;
import java.net.URISyntaxException;
@ -24,9 +24,9 @@ import org.openhab.core.config.core.ConfigDescription;
import org.openhab.core.config.core.ConfigDescriptionBuilder;
import org.openhab.core.config.core.ConfigDescriptionParameter;
import org.openhab.core.config.core.ConfigDescriptionParameterGroup;
import org.openhab.core.config.xml.util.ConverterAttributeMapValidator;
import org.openhab.core.config.xml.util.GenericUnmarshaller;
import org.openhab.core.config.xml.util.NodeIterator;
import org.openhab.core.config.core.xml.util.ConverterAttributeMapValidator;
import org.openhab.core.config.core.xml.util.GenericUnmarshaller;
import org.openhab.core.config.core.xml.util.NodeIterator;
import com.thoughtworks.xstream.converters.ConversionException;
import com.thoughtworks.xstream.converters.Converter;

View File

@ -10,7 +10,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.core.config.xml;
package org.openhab.core.config.core.xml;
import java.math.BigDecimal;
import java.util.ArrayList;
@ -24,10 +24,10 @@ import org.openhab.core.config.core.ConfigDescriptionParameter.Type;
import org.openhab.core.config.core.ConfigDescriptionParameterBuilder;
import org.openhab.core.config.core.FilterCriteria;
import org.openhab.core.config.core.ParameterOption;
import org.openhab.core.config.xml.util.ConverterAttributeMapValidator;
import org.openhab.core.config.xml.util.ConverterValueMap;
import org.openhab.core.config.xml.util.GenericUnmarshaller;
import org.openhab.core.config.xml.util.NodeValue;
import org.openhab.core.config.core.xml.util.ConverterAttributeMapValidator;
import org.openhab.core.config.core.xml.util.ConverterValueMap;
import org.openhab.core.config.core.xml.util.GenericUnmarshaller;
import org.openhab.core.config.core.xml.util.NodeValue;
import com.thoughtworks.xstream.converters.ConversionException;
import com.thoughtworks.xstream.converters.Converter;

View File

@ -10,14 +10,14 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.core.config.xml;
package org.openhab.core.config.core.xml;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.config.core.ConfigDescriptionParameterGroup;
import org.openhab.core.config.core.ConfigDescriptionParameterGroupBuilder;
import org.openhab.core.config.xml.util.ConverterValueMap;
import org.openhab.core.config.xml.util.GenericUnmarshaller;
import org.openhab.core.config.core.xml.util.ConverterValueMap;
import org.openhab.core.config.core.xml.util.GenericUnmarshaller;
import com.thoughtworks.xstream.converters.UnmarshallingContext;
import com.thoughtworks.xstream.io.HierarchicalStreamReader;

View File

@ -10,7 +10,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.core.config.xml;
package org.openhab.core.config.core.xml;
import java.util.List;
import java.util.concurrent.Future;
@ -22,12 +22,12 @@ import org.openhab.core.common.ThreadPoolManager;
import org.openhab.core.config.core.ConfigDescription;
import org.openhab.core.config.core.ConfigDescriptionProvider;
import org.openhab.core.config.core.i18n.ConfigI18nLocalizationService;
import org.openhab.core.config.xml.internal.ConfigDescriptionReader;
import org.openhab.core.config.xml.internal.ConfigDescriptionXmlProvider;
import org.openhab.core.config.xml.osgi.XmlDocumentBundleTracker;
import org.openhab.core.config.xml.osgi.XmlDocumentProvider;
import org.openhab.core.config.xml.osgi.XmlDocumentProviderFactory;
import org.openhab.core.config.xml.util.XmlDocumentReader;
import org.openhab.core.config.core.xml.internal.ConfigDescriptionReader;
import org.openhab.core.config.core.xml.internal.ConfigDescriptionXmlProvider;
import org.openhab.core.config.core.xml.osgi.XmlDocumentBundleTracker;
import org.openhab.core.config.core.xml.osgi.XmlDocumentProvider;
import org.openhab.core.config.core.xml.osgi.XmlDocumentProviderFactory;
import org.openhab.core.config.core.xml.util.XmlDocumentReader;
import org.openhab.core.service.ReadyService;
import org.osgi.framework.Bundle;
import org.osgi.service.component.ComponentContext;

View File

@ -10,12 +10,12 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.core.config.xml;
package org.openhab.core.config.core.xml;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.config.core.FilterCriteria;
import org.openhab.core.config.xml.util.GenericUnmarshaller;
import org.openhab.core.config.core.xml.util.GenericUnmarshaller;
import com.thoughtworks.xstream.converters.UnmarshallingContext;
import com.thoughtworks.xstream.io.HierarchicalStreamReader;

View File

@ -10,7 +10,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.core.config.xml.internal;
package org.openhab.core.config.core.xml.internal;
import java.util.List;
@ -19,17 +19,17 @@ import org.openhab.core.config.core.ConfigDescription;
import org.openhab.core.config.core.ConfigDescriptionParameter;
import org.openhab.core.config.core.ConfigDescriptionParameterGroup;
import org.openhab.core.config.core.FilterCriteria;
import org.openhab.core.config.xml.ConfigDescriptionConverter;
import org.openhab.core.config.xml.ConfigDescriptionParameterConverter;
import org.openhab.core.config.xml.ConfigDescriptionParameterGroupConverter;
import org.openhab.core.config.xml.FilterCriteriaConverter;
import org.openhab.core.config.xml.util.NodeAttributes;
import org.openhab.core.config.xml.util.NodeAttributesConverter;
import org.openhab.core.config.xml.util.NodeList;
import org.openhab.core.config.xml.util.NodeListConverter;
import org.openhab.core.config.xml.util.NodeValue;
import org.openhab.core.config.xml.util.NodeValueConverter;
import org.openhab.core.config.xml.util.XmlDocumentReader;
import org.openhab.core.config.core.xml.ConfigDescriptionConverter;
import org.openhab.core.config.core.xml.ConfigDescriptionParameterConverter;
import org.openhab.core.config.core.xml.ConfigDescriptionParameterGroupConverter;
import org.openhab.core.config.core.xml.FilterCriteriaConverter;
import org.openhab.core.config.core.xml.util.NodeAttributes;
import org.openhab.core.config.core.xml.util.NodeAttributesConverter;
import org.openhab.core.config.core.xml.util.NodeList;
import org.openhab.core.config.core.xml.util.NodeListConverter;
import org.openhab.core.config.core.xml.util.NodeValue;
import org.openhab.core.config.core.xml.util.NodeValueConverter;
import org.openhab.core.config.core.xml.util.XmlDocumentReader;
import com.thoughtworks.xstream.XStream;

View File

@ -10,15 +10,15 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.core.config.xml.internal;
package org.openhab.core.config.core.xml.internal;
import java.util.List;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.config.core.ConfigDescription;
import org.openhab.core.config.core.ConfigDescriptionProvider;
import org.openhab.core.config.xml.AbstractXmlConfigDescriptionProvider;
import org.openhab.core.config.xml.osgi.XmlDocumentProvider;
import org.openhab.core.config.core.xml.AbstractXmlConfigDescriptionProvider;
import org.openhab.core.config.core.xml.osgi.XmlDocumentProvider;
import org.osgi.framework.Bundle;
/**

View File

@ -10,7 +10,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.core.config.xml.osgi;
package org.openhab.core.config.core.xml.osgi;
import java.net.URL;
import java.util.ArrayList;
@ -36,7 +36,7 @@ import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.common.ThreadPoolManager;
import org.openhab.core.config.xml.util.XmlDocumentReader;
import org.openhab.core.config.core.xml.util.XmlDocumentReader;
import org.openhab.core.service.ReadyMarker;
import org.openhab.core.service.ReadyMarkerUtils;
import org.openhab.core.service.ReadyService;

View File

@ -10,11 +10,11 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.core.config.xml.osgi;
package org.openhab.core.config.core.xml.osgi;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.config.xml.internal.ConfigDescriptionReader;
import org.openhab.core.config.core.xml.internal.ConfigDescriptionReader;
/**
* The {@link XmlDocumentProvider} is responsible managing any created objects

View File

@ -10,7 +10,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.core.config.xml.osgi;
package org.openhab.core.config.core.xml.osgi;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.NonNullByDefault;

View File

@ -10,7 +10,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.core.config.xml.util;
package org.openhab.core.config.core.xml.util;
import java.util.HashMap;
import java.util.Map;

View File

@ -10,7 +10,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.core.config.xml.util;
package org.openhab.core.config.core.xml.util;
import java.util.HashMap;
import java.util.List;

View File

@ -10,7 +10,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.core.config.xml.util;
package org.openhab.core.config.core.xml.util;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;

View File

@ -10,7 +10,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.core.config.xml.util;
package org.openhab.core.config.core.xml.util;
import java.util.Map;

View File

@ -10,7 +10,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.core.config.xml.util;
package org.openhab.core.config.core.xml.util;
import java.util.Map;

View File

@ -10,7 +10,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.core.config.xml.util;
package org.openhab.core.config.core.xml.util;
import java.util.ArrayList;
import java.util.Iterator;

View File

@ -10,7 +10,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.core.config.xml.util;
package org.openhab.core.config.core.xml.util;
import java.util.ArrayList;
import java.util.List;

View File

@ -10,7 +10,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.core.config.xml.util;
package org.openhab.core.config.core.xml.util;
import java.util.List;
import java.util.Map;

View File

@ -10,7 +10,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.core.config.xml.util;
package org.openhab.core.config.core.xml.util;
import org.eclipse.jdt.annotation.NonNullByDefault;

View File

@ -10,7 +10,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.core.config.xml.util;
package org.openhab.core.config.core.xml.util;
import java.util.Map;

View File

@ -10,7 +10,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.core.config.xml.util;
package org.openhab.core.config.core.xml.util;
import java.util.Map;

View File

@ -10,7 +10,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.core.config.xml.util;
package org.openhab.core.config.core.xml.util;
import java.net.URL;

View File

@ -13,7 +13,7 @@
package com.acme;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.config.xml.util.XmlDocumentReader;
import org.openhab.core.config.core.xml.util.XmlDocumentReader;
/**
* A class that is in a non-framework package.

View File

@ -28,6 +28,7 @@ import org.eclipse.jdt.annotation.Nullable;
import org.junit.jupiter.api.Test;
import org.openhab.core.config.core.ConfigDescription;
import org.openhab.core.config.core.ConfigDescriptionBuilder;
import org.openhab.core.config.core.xml.util.XmlDocumentReader;
import com.acme.Product;
import com.thoughtworks.xstream.XStream;

View File

@ -1,29 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="annotationpath" value="target/dependency"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="annotationpath" value="target/dependency"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@ -1,43 +0,0 @@
This content is produced and maintained by the openHAB project.
* Project home: https://www.openhab.org
== Declared Project Licenses
This program and the accompanying materials are made available under the terms
of the Eclipse Public License 2.0 which is available at
https://www.eclipse.org/legal/epl-2.0/.
== Source Code
https://github.com/openhab/openhab-core
== Third-party Content
xstream Version: 1.4.7
* License: New BSD License
* Project: http://xstream.codehaus.org/
* Source: http://svn.codehaus.org/xstream/tags/XSTREAM_1_4_7/xstream/
== Third-party license(s)
=== New BSD License
Copyright (c) 2003-2006, Joe Walnes
Copyright (c) 2006-2009, 2011 XStream Committers
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of
conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of
conditions and the following disclaimer in the documentation and/or other materials provided
with the distribution.
3. Neither the name of XStream nor the names of its contributors may be used to endorse
or promote products derived from this software without specific prior written
permission.

View File

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.openhab.core.bundles</groupId>
<artifactId>org.openhab.core.reactor.bundles</artifactId>
<version>4.0.0-SNAPSHOT</version>
</parent>
<artifactId>org.openhab.core.config.xml</artifactId>
<name>openHAB Core :: Bundles :: Configuration XML</name>
<dependencies>
<dependency>
<groupId>org.openhab.core.bundles</groupId>
<artifactId>org.openhab.core.config.core</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -15,6 +15,11 @@
<name>openHAB Core :: Bundles :: REST Interface :: Core</name>
<dependencies>
<dependency>
<groupId>org.openhab.core.bundles</groupId>
<artifactId>org.openhab.core.addon</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.core.bundles</groupId>
<artifactId>org.openhab.core.transform</artifactId>

View File

@ -20,6 +20,11 @@
<artifactId>org.openhab.core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.core.bundles</groupId>
<artifactId>org.openhab.core.addon</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.core.bundles</groupId>
<artifactId>org.openhab.core.config.core</artifactId>

View File

@ -64,7 +64,7 @@ public class SyntheticBundleInstaller {
private static final String BUNDLE_POOL_PATH = "/test-bundle-pool";
private static final String XML_THING_TYPE = "openhab.xmlThingTypes";
private static final String XML_BINDING_INFO = "openhab.xmlBindingInfo";
private static final String XML_ADDON_INFO = "openhab.xmlAddonInfo";
private static final String XML_CONFIG = "openhab.xmlConfig";
/**
@ -91,7 +91,7 @@ public class SyntheticBundleInstaller {
* Install synthetic bundle, denoted by its name, into the test runtime (by using the given bundle context).
*
* @param bundleContext the bundle context of the test runtime
* @param testBundleNamethe symbolic name of the sub-directory of {@value #BUNDLE_POOL_PATH}, which contains the
* @param testBundleName the symbolic name of the sub-directory of {@value #BUNDLE_POOL_PATH}, which contains the
* files
* for the synthetic bundle
* @param extensionsToInclude a list of extension to be included into the synthetic bundle. In order to use the list
@ -251,15 +251,15 @@ public class SyntheticBundleInstaller {
}
private static boolean isXmlThingTypeBundleAvailable(BundleContext context) {
return isBundleAvailable(context, "org.openhab.core.thing.xml");
return isBundleAvailable(context, "org.openhab.core.thing");
}
private static boolean isXmlBindingInfoBundleAvailable(BundleContext context) {
return isBundleAvailable(context, "org.openhab.core.binding.xml");
private static boolean isXmlAddonInfoBundleAvailable(BundleContext context) {
return isBundleAvailable(context, "org.openhab.core.addon");
}
private static boolean isXmlConfigBundleAvailable(BundleContext context) {
return isBundleAvailable(context, "org.openhab.core.config.xml");
return isBundleAvailable(context, "org.openhab.core.config");
}
/**
@ -271,8 +271,8 @@ public class SyntheticBundleInstaller {
if (isXmlThingTypeBundleAvailable(context)) {
waitForReadyMarker(context, XML_THING_TYPE, bundle);
}
if (isXmlBindingInfoBundleAvailable(context)) {
waitForReadyMarker(context, XML_BINDING_INFO, bundle);
if (isXmlAddonInfoBundleAvailable(context)) {
waitForReadyMarker(context, XML_ADDON_INFO, bundle);
}
if (isXmlConfigBundleAvailable(context)) {
waitForReadyMarker(context, XML_CONFIG, bundle);

View File

@ -1,35 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="annotationpath" value="target/dependency"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="annotationpath" value="target/dependency"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.openhab.core.thing.xml</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

View File

@ -1,30 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.openhab.core.bundles</groupId>
<artifactId>org.openhab.core.reactor.bundles</artifactId>
<version>4.0.0-SNAPSHOT</version>
</parent>
<artifactId>org.openhab.core.thing.xml</artifactId>
<name>openHAB Core :: Bundles :: Thing XML</name>
<dependencies>
<dependency>
<groupId>org.openhab.core.bundles</groupId>
<artifactId>org.openhab.core.thing</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.core.bundles</groupId>
<artifactId>org.openhab.core.config.xml</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -6,6 +6,7 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src/generated/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
<attributes>
<attribute name="maven.pomderived" value="true"/>

View File

@ -25,11 +25,6 @@
<artifactId>org.openhab.core.io.console</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>2.3.3</version>
</dependency>
<dependency>
<groupId>org.openhab.core.bundles</groupId>
<artifactId>org.openhab.core.test</artifactId>
@ -43,41 +38,10 @@
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.15.2</version>
<configuration>
<schemaDirectory>src/main/resources/xsd</schemaDirectory>
<noFileHeader>true</noFileHeader>
<locale>en</locale>
<episode>false</episode>
<extension>true</extension>
<args>
<arg>-Xxew</arg>
<arg>-Xxew:instantiate early</arg>
</args>
<plugins>
<plugin>
<groupId>com.github.jaxb-xew-plugin</groupId>
<artifactId>jaxb-xew-plugin</artifactId>
<version>1.10</version>
</plugin>
</plugins>
<schemaDirectory>schema/update</schemaDirectory>
<catalog>schema/catalog.cat</catalog>
</configuration>
<dependencies>
<dependency>
<!-- Required for JDK 17 compatibility, see: https://github.com/highsource/maven-jaxb2-plugin/issues/207 -->
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.6</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>generate-jaxb-sources</id>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

View File

@ -0,0 +1,38 @@
<jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:xs="http://www.w3.org/2001/XMLSchema" jaxb:version="2.0">
<jaxb:globalBindings>
<xjc:serializable uid="1"/>
</jaxb:globalBindings>
<jaxb:bindings schemaLocation="https://openhab.org/schemas/thing-description-1.0.0.xsd">
<jaxb:schemaBindings>
<jaxb:package name="org.openhab.core.thing.internal.dto"/>
<jaxb:nameXmlTransform>
<jaxb:typeName prefix="Xml"/>
<jaxb:anonymousTypeName prefix="Xml"/>
</jaxb:nameXmlTransform>
</jaxb:schemaBindings>
<jaxb:bindings node="//xs:element[@name='thing-descriptions']">
<jaxb:class name="XmlThingDescriptions"/>
</jaxb:bindings>
<jaxb:bindings node="//xs:complexType[@name='option']">
<jaxb:bindings node=".//xs:attribute[@name='value']">
<jaxb:property name="ValueAttribute"/>
</jaxb:bindings>
</jaxb:bindings>
</jaxb:bindings>
<jaxb:bindings schemaLocation="../update/update-description-1.0.0.xsd">
<jaxb:schemaBindings>
<jaxb:package name="org.openhab.core.thing.internal.update.dto"/>
<jaxb:nameXmlTransform>
<jaxb:typeName prefix="Xml"/>
<jaxb:anonymousTypeName prefix="Xml"/>
</jaxb:nameXmlTransform>
</jaxb:schemaBindings>
<jaxb:bindings node="//xs:element[@name='update-descriptions']">
<jaxb:class name="XmlUpdateDescriptions"/>
</jaxb:bindings>
</jaxb:bindings>
</jaxb:bindings>

View File

@ -0,0 +1 @@
REWRITE_SYSTEM "https://openhab.org/schemas" "file:${project.basedir}/xsd/thing"

View File

@ -27,12 +27,12 @@ import javax.xml.bind.Unmarshaller;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.thing.ThingTypeUID;
import org.openhab.core.thing.binding.ThingHandlerFactory;
import org.openhab.core.thing.internal.update.dto.AddChannel;
import org.openhab.core.thing.internal.update.dto.InstructionSet;
import org.openhab.core.thing.internal.update.dto.RemoveChannel;
import org.openhab.core.thing.internal.update.dto.ThingType;
import org.openhab.core.thing.internal.update.dto.UpdateChannel;
import org.openhab.core.thing.internal.update.dto.UpdateDescriptions;
import org.openhab.core.thing.internal.update.dto.XmlAddChannel;
import org.openhab.core.thing.internal.update.dto.XmlInstructionSet;
import org.openhab.core.thing.internal.update.dto.XmlRemoveChannel;
import org.openhab.core.thing.internal.update.dto.XmlThingType;
import org.openhab.core.thing.internal.update.dto.XmlUpdateChannel;
import org.openhab.core.thing.internal.update.dto.XmlUpdateDescriptions;
import org.openhab.core.util.BundleResolver;
import org.osgi.framework.Bundle;
import org.slf4j.Logger;
@ -68,25 +68,25 @@ public class ThingUpdateInstructionReader {
while (entries.hasMoreElements()) {
URL url = entries.nextElement();
try {
JAXBContext context = JAXBContext.newInstance(UpdateDescriptions.class);
JAXBContext context = JAXBContext.newInstance(XmlUpdateDescriptions.class);
Unmarshaller u = context.createUnmarshaller();
UpdateDescriptions updateDescriptions = (UpdateDescriptions) u.unmarshal(url);
XmlUpdateDescriptions updateDescriptions = (XmlUpdateDescriptions) u.unmarshal(url);
for (ThingType thingType : updateDescriptions.getThingType()) {
for (XmlThingType thingType : updateDescriptions.getThingType()) {
ThingTypeUID thingTypeUID = new ThingTypeUID(thingType.getUid());
UpdateInstructionKey key = new UpdateInstructionKey(factory, thingTypeUID);
List<ThingUpdateInstruction> instructions = new ArrayList<>();
List<InstructionSet> instructionSets = thingType.getInstructionSet().stream()
.sorted(Comparator.comparing(InstructionSet::getTargetVersion)).toList();
for (InstructionSet instructionSet : instructionSets) {
List<XmlInstructionSet> instructionSets = thingType.getInstructionSet().stream()
.sorted(Comparator.comparing(XmlInstructionSet::getTargetVersion)).toList();
for (XmlInstructionSet instructionSet : instructionSets) {
int targetVersion = instructionSet.getTargetVersion();
for (Object instruction : instructionSet.getInstructions()) {
if (instruction instanceof AddChannel addChannelType) {
if (instruction instanceof XmlAddChannel addChannelType) {
instructions.add(new UpdateChannelInstructionImpl(targetVersion, addChannelType));
} else if (instruction instanceof UpdateChannel updateChannelType) {
} else if (instruction instanceof XmlUpdateChannel updateChannelType) {
instructions
.add(new UpdateChannelInstructionImpl(targetVersion, updateChannelType));
} else if (instruction instanceof RemoveChannel removeChannelType) {
} else if (instruction instanceof XmlRemoveChannel removeChannelType) {
instructions.add(
new RemoveChannelInstructionImpl(targetVersion, removeChannelType.getId()));
} else {

View File

@ -23,8 +23,8 @@ import org.openhab.core.thing.ChannelUID;
import org.openhab.core.thing.Thing;
import org.openhab.core.thing.binding.builder.ChannelBuilder;
import org.openhab.core.thing.binding.builder.ThingBuilder;
import org.openhab.core.thing.internal.update.dto.AddChannel;
import org.openhab.core.thing.internal.update.dto.UpdateChannel;
import org.openhab.core.thing.internal.update.dto.XmlAddChannel;
import org.openhab.core.thing.internal.update.dto.XmlUpdateChannel;
import org.openhab.core.thing.type.ChannelTypeUID;
/**
@ -35,7 +35,7 @@ import org.openhab.core.thing.type.ChannelTypeUID;
*/
@NonNullByDefault
public class UpdateChannelInstructionImpl implements ThingUpdateInstruction {
private boolean removeOldChannel;
private final boolean removeOldChannel;
private final int thingTypeVersion;
private final boolean preserveConfig;
private final String channelId;
@ -44,7 +44,7 @@ public class UpdateChannelInstructionImpl implements ThingUpdateInstruction {
private final @Nullable String description;
private final @Nullable List<String> tags;
UpdateChannelInstructionImpl(int thingTypeVersion, UpdateChannel updateChannel) {
UpdateChannelInstructionImpl(int thingTypeVersion, XmlUpdateChannel updateChannel) {
this.removeOldChannel = true;
this.thingTypeVersion = thingTypeVersion;
this.channelId = updateChannel.getId();
@ -55,7 +55,7 @@ public class UpdateChannelInstructionImpl implements ThingUpdateInstruction {
this.preserveConfig = updateChannel.isPreserveConfiguration();
}
UpdateChannelInstructionImpl(int thingTypeVersion, AddChannel addChannel) {
UpdateChannelInstructionImpl(int thingTypeVersion, XmlAddChannel addChannel) {
this.removeOldChannel = false;
this.thingTypeVersion = thingTypeVersion;
this.channelId = addChannel.getId();

View File

@ -20,9 +20,9 @@ import java.util.Map;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.config.core.ConfigDescription;
import org.openhab.core.config.xml.util.ConverterAttributeMapValidator;
import org.openhab.core.config.xml.util.GenericUnmarshaller;
import org.openhab.core.config.xml.util.NodeIterator;
import org.openhab.core.config.core.xml.util.ConverterAttributeMapValidator;
import org.openhab.core.config.core.xml.util.GenericUnmarshaller;
import org.openhab.core.config.core.xml.util.NodeIterator;
import org.openhab.core.thing.type.AbstractDescriptionType;
import com.thoughtworks.xstream.converters.ConversionException;

View File

@ -16,7 +16,7 @@ import java.util.Map;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.config.xml.util.NodeIterator;
import org.openhab.core.config.core.xml.util.NodeIterator;
import org.openhab.core.thing.ThingTypeUID;
import com.thoughtworks.xstream.converters.ConversionException;

View File

@ -18,7 +18,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.config.core.ConfigDescription;
import org.openhab.core.config.core.ConfigDescriptionProvider;
import org.openhab.core.config.xml.util.NodeValue;
import org.openhab.core.config.core.xml.util.NodeValue;
import org.openhab.core.thing.ThingTypeUID;
import org.openhab.core.thing.type.BridgeType;

View File

@ -18,10 +18,10 @@ import java.util.Map;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.config.xml.util.ConverterAttributeMapValidator;
import org.openhab.core.config.xml.util.GenericUnmarshaller;
import org.openhab.core.config.xml.util.NodeIterator;
import org.openhab.core.config.xml.util.NodeValue;
import org.openhab.core.config.core.xml.util.ConverterAttributeMapValidator;
import org.openhab.core.config.core.xml.util.GenericUnmarshaller;
import org.openhab.core.config.core.xml.util.NodeIterator;
import org.openhab.core.config.core.xml.util.NodeValue;
import org.openhab.core.thing.type.AutoUpdatePolicy;
import com.thoughtworks.xstream.converters.ConversionException;

View File

@ -17,8 +17,8 @@ import java.util.Map;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.config.xml.util.ConverterAttributeMapValidator;
import org.openhab.core.config.xml.util.NodeIterator;
import org.openhab.core.config.core.xml.util.ConverterAttributeMapValidator;
import org.openhab.core.config.core.xml.util.NodeIterator;
import org.openhab.core.thing.type.ChannelGroupTypeUID;
import com.thoughtworks.xstream.converters.ConversionException;

View File

@ -23,9 +23,9 @@ import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.config.core.ConfigDescription;
import org.openhab.core.config.xml.util.ConverterAttributeMapValidator;
import org.openhab.core.config.xml.util.NodeIterator;
import org.openhab.core.config.xml.util.NodeValue;
import org.openhab.core.config.core.xml.util.ConverterAttributeMapValidator;
import org.openhab.core.config.core.xml.util.NodeIterator;
import org.openhab.core.config.core.xml.util.NodeValue;
import org.openhab.core.thing.type.AutoUpdatePolicy;
import org.openhab.core.thing.type.ChannelKind;
import org.openhab.core.thing.type.ChannelType;

View File

@ -19,7 +19,7 @@ import java.util.Objects;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.config.xml.util.NodeValue;
import org.openhab.core.config.core.xml.util.NodeValue;
import org.openhab.core.thing.type.AutoUpdatePolicy;
import org.openhab.core.thing.type.ChannelDefinition;
import org.openhab.core.thing.type.ChannelDefinitionBuilder;

View File

@ -14,10 +14,10 @@ package org.openhab.core.thing.xml.internal;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.config.xml.util.GenericUnmarshaller;
import org.openhab.core.config.xml.util.NodeIterator;
import org.openhab.core.config.xml.util.NodeList;
import org.openhab.core.config.xml.util.NodeValue;
import org.openhab.core.config.core.xml.util.GenericUnmarshaller;
import org.openhab.core.config.core.xml.util.NodeIterator;
import org.openhab.core.config.core.xml.util.NodeList;
import org.openhab.core.config.core.xml.util.NodeValue;
import org.openhab.core.types.CommandDescription;
import org.openhab.core.types.CommandDescriptionBuilder;
import org.openhab.core.types.CommandOption;

View File

@ -18,20 +18,20 @@ import java.util.Map;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.config.xml.util.GenericUnmarshaller;
import org.openhab.core.config.xml.util.NodeIterator;
import org.openhab.core.config.xml.util.NodeList;
import org.openhab.core.config.xml.util.NodeValue;
import org.openhab.core.config.core.xml.util.GenericUnmarshaller;
import org.openhab.core.config.core.xml.util.NodeIterator;
import org.openhab.core.config.core.xml.util.NodeList;
import org.openhab.core.config.core.xml.util.NodeValue;
import org.openhab.core.types.EventDescription;
import org.openhab.core.types.EventOption;
import com.thoughtworks.xstream.converters.ConversionException;
import com.thoughtworks.xstream.converters.Converter;
import com.thoughtworks.xstream.converters.UnmarshallingContext;
import com.thoughtworks.xstream.io.HierarchicalStreamReader;
/**
* The {@link EventDescriptionConverter} is a concrete implementation of the {@code XStream} {@link Converter} interface
* The {@link EventDescriptionConverter} is a concrete implementation of the {@code XStream}
* {@link com.thoughtworks.xstream.converters.Converter} interface
* used to convert a event description within an XML document into an {@link EventDescription} object.
* <p>
* This converter converts {@code state} XML tags.

View File

@ -20,11 +20,11 @@ import java.util.Optional;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.config.xml.util.ConverterAttributeMapValidator;
import org.openhab.core.config.xml.util.GenericUnmarshaller;
import org.openhab.core.config.xml.util.NodeIterator;
import org.openhab.core.config.xml.util.NodeList;
import org.openhab.core.config.xml.util.NodeValue;
import org.openhab.core.config.core.xml.util.ConverterAttributeMapValidator;
import org.openhab.core.config.core.xml.util.GenericUnmarshaller;
import org.openhab.core.config.core.xml.util.NodeIterator;
import org.openhab.core.config.core.xml.util.NodeList;
import org.openhab.core.config.core.xml.util.NodeValue;
import org.openhab.core.types.StateDescription;
import org.openhab.core.types.StateDescriptionFragmentBuilder;
import org.openhab.core.types.StateOption;

View File

@ -17,8 +17,8 @@ import java.util.Map;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.config.xml.util.ConverterAttributeMapValidator;
import org.openhab.core.config.xml.util.GenericUnmarshaller;
import org.openhab.core.config.core.xml.util.ConverterAttributeMapValidator;
import org.openhab.core.config.core.xml.util.GenericUnmarshaller;
import com.thoughtworks.xstream.converters.Converter;
import com.thoughtworks.xstream.converters.UnmarshallingContext;

View File

@ -19,17 +19,17 @@ import org.openhab.core.config.core.ConfigDescription;
import org.openhab.core.config.core.ConfigDescriptionParameter;
import org.openhab.core.config.core.ConfigDescriptionParameterGroup;
import org.openhab.core.config.core.FilterCriteria;
import org.openhab.core.config.xml.ConfigDescriptionConverter;
import org.openhab.core.config.xml.ConfigDescriptionParameterConverter;
import org.openhab.core.config.xml.ConfigDescriptionParameterGroupConverter;
import org.openhab.core.config.xml.FilterCriteriaConverter;
import org.openhab.core.config.xml.util.NodeAttributes;
import org.openhab.core.config.xml.util.NodeAttributesConverter;
import org.openhab.core.config.xml.util.NodeList;
import org.openhab.core.config.xml.util.NodeListConverter;
import org.openhab.core.config.xml.util.NodeValue;
import org.openhab.core.config.xml.util.NodeValueConverter;
import org.openhab.core.config.xml.util.XmlDocumentReader;
import org.openhab.core.config.core.xml.ConfigDescriptionConverter;
import org.openhab.core.config.core.xml.ConfigDescriptionParameterConverter;
import org.openhab.core.config.core.xml.ConfigDescriptionParameterGroupConverter;
import org.openhab.core.config.core.xml.FilterCriteriaConverter;
import org.openhab.core.config.core.xml.util.NodeAttributes;
import org.openhab.core.config.core.xml.util.NodeAttributesConverter;
import org.openhab.core.config.core.xml.util.NodeList;
import org.openhab.core.config.core.xml.util.NodeListConverter;
import org.openhab.core.config.core.xml.util.NodeValue;
import org.openhab.core.config.core.xml.util.NodeValueConverter;
import org.openhab.core.config.core.xml.util.XmlDocumentReader;
import org.openhab.core.types.CommandDescription;
import org.openhab.core.types.EventDescription;
import org.openhab.core.types.StateDescription;

View File

@ -21,10 +21,10 @@ import java.util.Map;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.config.xml.util.ConverterAttributeMapValidator;
import org.openhab.core.config.xml.util.NodeIterator;
import org.openhab.core.config.xml.util.NodeList;
import org.openhab.core.config.xml.util.NodeValue;
import org.openhab.core.config.core.xml.util.ConverterAttributeMapValidator;
import org.openhab.core.config.core.xml.util.NodeIterator;
import org.openhab.core.config.core.xml.util.NodeList;
import org.openhab.core.config.core.xml.util.NodeValue;
import org.openhab.core.thing.ThingTypeUID;
import com.thoughtworks.xstream.converters.ConversionException;

View File

@ -19,9 +19,9 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.config.core.ConfigDescription;
import org.openhab.core.config.core.ConfigDescriptionProvider;
import org.openhab.core.config.xml.AbstractXmlConfigDescriptionProvider;
import org.openhab.core.config.xml.osgi.XmlDocumentBundleTracker;
import org.openhab.core.config.xml.osgi.XmlDocumentProvider;
import org.openhab.core.config.core.xml.AbstractXmlConfigDescriptionProvider;
import org.openhab.core.config.core.xml.osgi.XmlDocumentBundleTracker;
import org.openhab.core.config.core.xml.osgi.XmlDocumentProvider;
import org.openhab.core.thing.binding.ThingTypeProvider;
import org.openhab.core.thing.type.ChannelGroupType;
import org.openhab.core.thing.type.ChannelType;

View File

@ -22,7 +22,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.config.core.ConfigDescription;
import org.openhab.core.config.core.ConfigDescriptionProvider;
import org.openhab.core.config.xml.util.NodeValue;
import org.openhab.core.config.core.xml.util.NodeValue;
import org.openhab.core.thing.ThingTypeUID;
import org.openhab.core.thing.type.ChannelDefinition;
import org.openhab.core.thing.type.ChannelGroupDefinition;

View File

@ -16,7 +16,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.config.core.ConfigDescription;
import org.openhab.core.config.core.ConfigDescriptionProvider;
import org.openhab.core.config.core.i18n.ConfigI18nLocalizationService;
import org.openhab.core.config.xml.AbstractXmlConfigDescriptionProvider;
import org.openhab.core.config.core.xml.AbstractXmlConfigDescriptionProvider;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;

View File

@ -17,7 +17,7 @@ import java.util.Locale;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.config.xml.AbstractXmlBasedProvider;
import org.openhab.core.config.core.xml.AbstractXmlBasedProvider;
import org.openhab.core.thing.UID;
import org.openhab.core.thing.i18n.ChannelGroupTypeI18nLocalizationService;
import org.openhab.core.thing.type.ChannelGroupType;

View File

@ -17,7 +17,7 @@ import java.util.Locale;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.config.xml.AbstractXmlBasedProvider;
import org.openhab.core.config.core.xml.AbstractXmlBasedProvider;
import org.openhab.core.thing.UID;
import org.openhab.core.thing.i18n.ChannelTypeI18nLocalizationService;
import org.openhab.core.thing.type.ChannelType;

View File

@ -22,12 +22,12 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.common.ThreadPoolManager;
import org.openhab.core.config.core.ConfigDescriptionProvider;
import org.openhab.core.config.xml.AbstractXmlBasedProvider;
import org.openhab.core.config.xml.AbstractXmlConfigDescriptionProvider;
import org.openhab.core.config.xml.osgi.XmlDocumentBundleTracker;
import org.openhab.core.config.xml.osgi.XmlDocumentProvider;
import org.openhab.core.config.xml.osgi.XmlDocumentProviderFactory;
import org.openhab.core.config.xml.util.XmlDocumentReader;
import org.openhab.core.config.core.xml.AbstractXmlBasedProvider;
import org.openhab.core.config.core.xml.AbstractXmlConfigDescriptionProvider;
import org.openhab.core.config.core.xml.osgi.XmlDocumentBundleTracker;
import org.openhab.core.config.core.xml.osgi.XmlDocumentProvider;
import org.openhab.core.config.core.xml.osgi.XmlDocumentProviderFactory;
import org.openhab.core.config.core.xml.util.XmlDocumentReader;
import org.openhab.core.service.ReadyService;
import org.openhab.core.thing.ThingTypeUID;
import org.openhab.core.thing.UID;

Some files were not shown because too many files have changed in this diff Show More