Skip to content

Commit

Permalink
Redefine connection in addon.xsd (openhab#3563)
Browse files Browse the repository at this point in the history
* Redefine addon.xml connection
* Remove remains of author

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
GitOrigin-RevId: 4349be6
  • Loading branch information
jlaur authored and splatch committed Jul 12, 2023
1 parent f1c4751 commit 742282e
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 14 deletions.
23 changes: 20 additions & 3 deletions bundles/org.opensmarthouse.core.addon/schema/addon-1.0.0.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,26 @@

<xs:simpleType name="connectionType">
<xs:restriction base="xs:string">
<xs:enumeration value="local"/>
<xs:enumeration value="cloud"/>
<xs:enumeration value="cloudDiscovery"/>
<xs:enumeration value="none">
<xs:annotation>
<xs:documentation>No interaction with external systems at all</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="local">
<xs:annotation>
<xs:documentation>Interaction with external systems, without internet access</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="hybrid">
<xs:annotation>
<xs:documentation>Interaction with external systems, internet access required only for extended functionality (such as discovery)</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="cloud">
<xs:annotation>
<xs:documentation>Interaction with external systems, internet access required for normal operation</xs:documentation>
</xs:annotation>
</xs:enumeration>
</xs:restriction>
</xs:simpleType>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ public class AddonInfo implements Identifiable<String> {
private final String serviceId;
private @Nullable String sourceBundle;

private AddonInfo(String id, String type, String name, String description, @Nullable String author,
@Nullable String connection, List<String> countries, @Nullable String configDescriptionURI,
@Nullable String serviceId, @Nullable String sourceBundle) throws IllegalArgumentException {
private AddonInfo(String id, String type, String name, String description, @Nullable String connection,
List<String> countries, @Nullable String configDescriptionURI, @Nullable String serviceId,
@Nullable String sourceBundle) throws IllegalArgumentException {
// mandatory fields
if (id.isBlank()) {
throw new IllegalArgumentException("The ID must neither be null nor empty!");
Expand Down Expand Up @@ -153,7 +153,6 @@ public static class Builder {
private final String type;
private String name = "";
private String description = "";
private @Nullable String author;
private @Nullable String connection;
private List<String> countries = List.of();
private @Nullable String configDescriptionURI = "";
Expand Down Expand Up @@ -187,11 +186,6 @@ public Builder withDescription(String description) {
return this;
}

public Builder withAuthor(@Nullable String author) {
this.author = author;
return this;
}

public Builder withConnection(@Nullable String connection) {
this.connection = connection;
return this;
Expand Down Expand Up @@ -229,8 +223,8 @@ public Builder withSourceBundle(@Nullable String sourceBundle) {
* @throws IllegalArgumentException if any of the information in this builder is invalid
*/
public AddonInfo build() throws IllegalArgumentException {
return new AddonInfo(id, type, name, description, author, connection, countries, configDescriptionURI,
serviceId, sourceBundle);
return new AddonInfo(id, type, name, description, connection, countries, configDescriptionURI, serviceId,
sourceBundle);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<name>hue Binding</name>
<description>The hue Binding integrates the Philips hue system. It
allows to control hue lights.</description>
<connection>local</connection>

<!-- Dummy config -->
<config-description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
<name>ACME Weather Binding</name>
<description>The ACME Weather Binding requests the ACME Weather Service to show the current temperature, humidity and
pressure.</description>
<connection>cloud</connection>

</addon:addon>

0 comments on commit 742282e

Please sign in to comment.