-
-
Notifications
You must be signed in to change notification settings - Fork 431
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Andrew Fiddian-Green <[email protected]>
- Loading branch information
Showing
20 changed files
with
1,172 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
bundles/org.openhab.core.addon/schema/addon-info-list-1.0.0.xsd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?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:addon-info-list="https://openhab.org/schemas/addon-info-list/v1.0.0" | ||
targetNamespace="https://openhab.org/schemas/addon-info-list/v1.0.0"> | ||
|
||
<xs:import namespace="https://openhab.org/schemas/addon/v1.0.0" schemaLocation="addon-1.0.0.xsd"/> | ||
|
||
<xs:element name="addon-info-list"> | ||
<xs:complexType> | ||
<xs:sequence> | ||
<xs:element name="addons" type="addon-info-list:addons"/> | ||
</xs:sequence> | ||
</xs:complexType> | ||
</xs:element> | ||
|
||
<xs:complexType name="addons"> | ||
<xs:sequence> | ||
<xs:element name="addon" type="addon:addonInfo" maxOccurs="unbounded"/> | ||
</xs:sequence> | ||
</xs:complexType> | ||
|
||
</xs:schema> |
81 changes: 81 additions & 0 deletions
81
...les/org.openhab.core.addon/src/main/java/org/openhab/core/addon/AddonDiscoveryMethod.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/** | ||
* Copyright (c) 2010-2023 Contributors to the openHAB project | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package org.openhab.core.addon; | ||
|
||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.eclipse.jdt.annotation.Nullable; | ||
|
||
/** | ||
* DTO for serialization of a suggested addon discovery method. | ||
* | ||
* @author Andrew Fiddian-Green - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class AddonDiscoveryMethod { | ||
private @NonNullByDefault({}) String serviceType; | ||
private @Nullable String mdnsServiceType; | ||
private @Nullable List<AddonMatchProperty> matchProperties; | ||
|
||
public String getServiceType() { | ||
return serviceType.toLowerCase(); | ||
} | ||
|
||
public String getMdnsServiceType() { | ||
String mdnsServiceType = this.mdnsServiceType; | ||
return mdnsServiceType != null ? mdnsServiceType : ""; | ||
} | ||
|
||
public List<AddonMatchProperty> getMatchProperties() { | ||
List<AddonMatchProperty> matchProperties = this.matchProperties; | ||
return matchProperties != null ? matchProperties : List.of(); | ||
} | ||
|
||
public AddonDiscoveryMethod setServiceType(String serviceType) { | ||
this.serviceType = serviceType.toLowerCase(); | ||
return this; | ||
} | ||
|
||
public AddonDiscoveryMethod setMdnsServiceType(@Nullable String mdnsServiceType) { | ||
this.mdnsServiceType = mdnsServiceType; | ||
return this; | ||
} | ||
|
||
public AddonDiscoveryMethod setMatchProperties(@Nullable List<AddonMatchProperty> matchProperties) { | ||
this.matchProperties = matchProperties; | ||
return this; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(serviceType, mdnsServiceType, matchProperties); | ||
} | ||
|
||
@Override | ||
public boolean equals(@Nullable Object obj) { | ||
if (this == obj) { | ||
return true; | ||
} | ||
if (obj == null) { | ||
return false; | ||
} | ||
if (getClass() != obj.getClass()) { | ||
return false; | ||
} | ||
AddonDiscoveryMethod other = (AddonDiscoveryMethod) obj; | ||
return Objects.equals(serviceType, other.serviceType) && Objects.equals(mdnsServiceType, other.mdnsServiceType) | ||
&& Objects.equals(matchProperties, other.matchProperties); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
bundles/org.openhab.core.addon/src/main/java/org/openhab/core/addon/AddonInfoList.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/** | ||
* Copyright (c) 2010-2023 Contributors to the openHAB project | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package org.openhab.core.addon; | ||
|
||
import java.util.List; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.eclipse.jdt.annotation.Nullable; | ||
|
||
/** | ||
* DTO containing a list of {@code AddonInfo} | ||
* | ||
* @author Andrew Fiddian-Green - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class AddonInfoList { | ||
protected @Nullable List<AddonInfo> addons; | ||
|
||
public List<AddonInfo> getAddons() { | ||
List<AddonInfo> addons = this.addons; | ||
return addons != null ? addons : List.of(); | ||
} | ||
|
||
public AddonInfoList setAddons(@Nullable List<AddonInfo> addons) { | ||
this.addons = addons; | ||
return this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.