Skip to content

Commit

Permalink
Merge branch 'main' into generate_dsl
Browse files Browse the repository at this point in the history
  • Loading branch information
lolodomo committed Jan 30, 2025
2 parents 3c2f376 + 7b85d6d commit 331972d
Show file tree
Hide file tree
Showing 46 changed files with 616 additions and 688 deletions.
2 changes: 1 addition & 1 deletion bom/compile-model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
<dependency>
<groupId>io.github.classgraph</groupId>
<artifactId>classgraph</artifactId>
<version>4.8.172</version>
<version>4.8.176</version>
<scope>compile</scope>
</dependency>

Expand Down
17 changes: 8 additions & 9 deletions bom/compile/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

<properties>
<californium.version>2.7.4</californium.version>
<jetty.version>9.4.54.v20240208</jetty.version>
<pax.web.version>8.0.27</pax.web.version>
<jetty.version>9.4.57.v20241219</jetty.version>
<pax.web.version>8.0.30</pax.web.version>
<swagger.version>2.2.15</swagger.version>
</properties>

Expand Down Expand Up @@ -84,7 +84,7 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.14.0</version>
<version>3.17.0</version>
<scope>compile</scope>
</dependency>

Expand Down Expand Up @@ -117,11 +117,10 @@
</dependency>

<!-- Gson -->
<!-- The Orbit bundle is used because LSP4J imports com.google.gson.internal -->
<dependency>
<groupId>org.eclipse.orbit.bundles</groupId>
<artifactId>com.google.gson</artifactId>
<version>2.10.1.v20230109-0753</version>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.11.0</version>
<scope>compile</scope>
</dependency>

Expand Down Expand Up @@ -418,13 +417,13 @@
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>5.14.0</version>
<version>5.16.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna-platform</artifactId>
<version>5.14.0</version>
<version>5.16.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
Expand Down
42 changes: 24 additions & 18 deletions bom/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@

<properties>
<californium.version>2.7.4</californium.version>
<cxf.version>3.6.2</cxf.version>
<jackson.version>2.17.1</jackson.version>
<jetty.version>9.4.54.v20240208</jetty.version>
<pax.logging.version>2.2.7</pax.logging.version>
<pax.web.version>8.0.27</pax.web.version>
<cxf.version>3.6.4</cxf.version>
<jackson.version>2.18.2</jackson.version>
<jetty.version>9.4.57.v20241219</jetty.version>
<pax.logging.version>2.2.8</pax.logging.version>
<pax.web.version>8.0.30</pax.web.version>
<swagger.version>2.2.15</swagger.version>
</properties>

Expand Down Expand Up @@ -175,6 +175,12 @@
<artifactId>cxf-rt-rs-sse</artifactId>
<version>${cxf.version}</version>
</dependency>
<!-- needed as long as cxf3 requires wstx 6.x -->
<dependency>
<groupId>com.fasterxml.woodstox</groupId>
<artifactId>woodstox-core</artifactId>
<version>6.6.2</version>
</dependency>

<!-- JAX-RS 2.1 API with contract -->
<dependency>
Expand All @@ -194,7 +200,7 @@
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-osgi</artifactId>
<version>2.3.8</version>
<version>2.3.9</version>
</dependency>

<!-- Activation 1.2 API -->
Expand Down Expand Up @@ -404,12 +410,12 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.15.1</version>
<version>2.17.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.14.0</version>
<version>3.17.0</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -449,9 +455,9 @@

<!-- Gson -->
<dependency>
<groupId>org.eclipse.orbit.bundles</groupId>
<artifactId>com.google.gson</artifactId>
<version>2.10.1.v20230109-0753</version>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.11.0</version>
<scope>compile</scope>
</dependency>

Expand Down Expand Up @@ -780,21 +786,21 @@
<dependency>
<groupId>org.apache.xbean</groupId>
<artifactId>xbean-bundleutils</artifactId>
<version>4.24</version>
<version>4.26</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.xbean</groupId>
<artifactId>xbean-finder</artifactId>
<version>4.24</version>
<version>4.26</version>
<scope>compile</scope>
</dependency>

<!-- Google Commons / Guava -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>33.3.0-jre</version>
<version>33.3.1-jre</version>
<scope>compile</scope>
</dependency>

Expand All @@ -808,7 +814,7 @@
<dependency>
<groupId>io.github.classgraph</groupId>
<artifactId>classgraph</artifactId>
<version>4.8.174</version>
<version>4.8.176</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -906,7 +912,7 @@
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>9.7</version>
<version>9.7.1</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -1066,13 +1072,13 @@
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>5.14.0</version>
<version>5.16.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna-platform</artifactId>
<version>5.14.0</version>
<version>5.16.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
Expand Down
4 changes: 2 additions & 2 deletions bom/test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<name>openHAB Core :: BOM :: Test</name>

<properties>
<cxf.version>3.6.2</cxf.version>
<cxf.version>3.6.4</cxf.version>
<junit.version>5.10.0</junit.version>
<mockito.version>4.11.0</mockito.version>
</properties>
Expand All @@ -25,7 +25,7 @@
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-osgi</artifactId>
<version>2.3.8</version>
<version>2.3.9</version>
</dependency>
<dependency>
<groupId>org.eclipse.jdt</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
*/
package org.openhab.core.config.discovery.addon.ip;

import static org.openhab.core.config.discovery.addon.AddonFinderConstants.SERVICE_NAME_IP;
import static org.openhab.core.config.discovery.addon.AddonFinderConstants.SERVICE_TYPE_IP;
import static org.openhab.core.config.discovery.addon.AddonFinderConstants.*;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
Expand Down Expand Up @@ -79,7 +78,7 @@
/**
* This is a {@link IpAddonFinder} for finding suggested add-ons by sending IP packets to the
* network and collecting responses.
*
*
* This finder is intended to detect devices on the network which do not announce via UPnP
* or mDNS. Some devices respond to queries to defined multicast addresses and ports and thus
* can be detected by sending a single frame on the IP network.
Expand Down Expand Up @@ -363,10 +362,9 @@ private void scan() {
}
}
String macFormat = parameters.getOrDefault(PARAMETER_MAC_FORMAT, "%02X:");
try {
String.format(macFormat, 123);
} catch (IllegalFormatException e) {
if (!macFormatValid(macFormat)) {
logger.warn("{}: discovery-parameter '{}' invalid format specifier", candidate.getUID(), macFormat);
continue;
}

// handle known types
Expand Down Expand Up @@ -599,7 +597,7 @@ private boolean isAddonInstalled(String addonId) {

/**
* Get mac address bytes associated with the given Internet socket address
*
*
* @param inetSocketAddress the Internet address
* @return the mac address as an array of bytes
* @throws SocketException if address is not on this PC, or no mac address is associated
Expand All @@ -614,18 +612,57 @@ private byte[] macBytesFrom(InetSocketAddress inetSocketAddress) throws SocketEx

/**
* Use the given format specifier to format an array of mac address bytes
*
* @param format a standard format specifier; optionally ends with a delimiter e.g. "%02x:" or "%02X"
*
* @param format a standard format specifier; optionally ends with a delimiter e.g. {@code %02x:} or {@code %02X}
* @param bytes the mac address as an array of bytes
*
* @return e.g. '01:02:03:04:A5:B6:C7:D8', '01-02-03-04:a5:b6:c7:d8', or '01020304A5B6C7D8'
* @return e.g. '{@code 01:02:03:04:A5:B6:C7:D8}' or '{@code 01-02-03-04-a5-b6-c7-d8}' or '{@code 01020304A5B6C7D8}'
*/
private String macFormat(String format, byte[] bytes) {
StringBuilder result = new StringBuilder();
for (byte byt : bytes) {
result.append(String.format(format, byt));
}
boolean isDelimited = Set.of(':', '-', '.').contains(format.charAt(format.length() - 1));
boolean isDelimited = !Character.isLetterOrDigit(format.charAt(format.length() - 1));
return (isDelimited ? result.substring(0, result.length() - 1) : result).toString();
}

/**
* Check if the given mac format specifier is valid. A valid specifier comprises two parts -- namely
* 1) a numeric format specifier acceptable to the {@code String.format()} method, plus 2) a single
* [optional] delimiter (i.e. a non alphanumeric) character. Examples are as follows:
* <p>
* <li>{@code %02X} produces {@code 01020304A5B6C7D8}</li>
* <li>{@code %02x:} produces {@code 01:02:03:04:a5:b6:c7:d8} (lower case hex)</li>
* <li>{@code %02X-} produces {@code 01-02-03-04-A5-B6-C7-D8} (upper case hex)</li>
* <li>{@code %02X,} produces {@code 01,02,03,04,A5,B6,C7,D8}</li>
* <p>
*
* @return true if the format specifier is valid
*/
private boolean macFormatValid(String format) {
// use String.format() to check first part validity
try {
String.format(format, (byte) 123);
} catch (IllegalFormatException e) {
return false;
}
// get position of numeric format letter e.g. the 'X' in '%02X-'
int last = format.length() - 1;
int index = 0;
while (index <= last) {
if (Character.isLetter(format.charAt(index))) {
break;
}
index++;
}
// check for zero or one character(s) after numeric format letter
switch (last - index) {
case 0:
return true;
case 1:
// check this character is non alphanumeric i.e. a delimiter
return !Character.isLetterOrDigit(format.charAt(last));
}
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna-platform</artifactId>
<version>5.14.0</version>
<version>5.16.0</version>
</dependency>
</dependencies>

Expand Down
2 changes: 1 addition & 1 deletion bundles/org.openhab.core.io.jetty.certificate/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk18on</artifactId>
<version>1.77</version>
<version>1.78.1</version>
</dependency>
</dependencies>

Expand Down
2 changes: 1 addition & 1 deletion bundles/org.openhab.core.io.transport.modbus/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
<version>2.11.1</version>
<version>2.12.0</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion bundles/org.openhab.core.semantics/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>9.7</version>
<version>9.7.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
import org.openhab.core.items.ItemNotFoundException;
import org.openhab.core.items.ItemNotUniqueException;
import org.openhab.core.items.ItemRegistry;
import org.openhab.core.items.RegistryHook;
import org.openhab.core.library.items.CallItem;
import org.openhab.core.library.items.ColorItem;
import org.openhab.core.library.items.ContactItem;
Expand Down Expand Up @@ -1428,16 +1427,6 @@ public Item add(Item element) {
return itemRegistry.remove(itemName, recursive);
}

@Override
public void addRegistryHook(RegistryHook<Item> hook) {
itemRegistry.addRegistryHook(hook);
}

@Override
public void removeRegistryHook(RegistryHook<Item> hook) {
itemRegistry.removeRegistryHook(hook);
}

@Override
public @Nullable String getUnitForWidget(Widget w) {
String itemName = w.getItem();
Expand Down
Loading

0 comments on commit 331972d

Please sign in to comment.