-
-
Notifications
You must be signed in to change notification settings - Fork 429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AddonInfo extensions #3865
Merged
Merged
AddonInfo extensions #3865
Changes from 7 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
236c8f2
[addoninfo] core extensions
andrewfg dd09a15
[addoninfo] remove addon installer; add code to core
andrewfg 418164d
[addoninfo] fix path name
andrewfg ff2ddaa
[addoninfo] xml schemas
andrewfg c0d48dd
[addoninfo] xml schemas (again)
andrewfg 720b581
[addoninfo] update AddonsInfoProvider
andrewfg b786ac8
Merge branch 'openhab:main' into addon-dto-extension
andrewfg 16845c5
[addoninfp] adopt reviewer suggestions
andrewfg 6b1d750
Merge branch 'openhab:main' into addon-dto-extension
andrewfg 164187c
[addonInfo extensions] adopt reviewer suggestions
andrewfg d249146
[addonInfo extensions] adopt reviewer suggestions
andrewfg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happened here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Umm. Not sure. I think Eclipse did it automagically when I wrote a new JUnit test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you simply revert the changes so that this PR leaves the file untouched?