-
-
Notifications
You must be signed in to change notification settings - Fork 422
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
[rest] Add semantic tag registry + API to manage user tags #3646
Conversation
Remains one comment from @splatch I have not yet answered:
|
I have now considered most of @splatch comments done in the old PR, the most important being the removal of static methods in SemanticTags that allowed to add tag class. |
A final effort would be required to remove the last remaining static stuff in SemanticsTat class. |
Done. |
Related to openhab#3619 New registry for semantic tags. New default semantic tags provider for all built-in semantic tags. New managed provider to add/remove/update user semantic tags. Storage of user semantic tags in a JSON DB file. New REST API to add/remove/update user tags in the semantic model. New REST API to get a sub-tree of the semantic tags. Semantic tag class annotations are removed. Semantic tag classes are now created at runtime. Classes Locations, Equipments, Points and Properties are removed Static methods SemanticTags.add removed The adding of semantic tag classes is now managed only by the tag registry. Avoids calling static method SemanticTags.getById when possible SemanticsMetadataProvider service now requires semanticTagRegistry to start. Signed-off-by: Laurent Garnier <lg.hc@free.fr>
It is now OK because |
@lolodomo See main...J-N-K:openhab-core:yaml It is more a proof-of-concept than a full implementation, but I think that's the way to do it. |
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Ok, thank you, I will do it, your example will really help me, in particular the watch service stuff. |
....core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/tag/TagResource.java
Outdated
Show resolved
Hide resolved
....core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/tag/TagResource.java
Outdated
Show resolved
Hide resolved
...st.core/src/main/java/org/openhab/core/io/rest/core/internal/tag/EnrichedSemanticTagDTO.java
Outdated
Show resolved
Hide resolved
...ore.semantics/src/main/java/org/openhab/core/semantics/internal/SemanticTagRegistryImpl.java
Outdated
Show resolved
Hide resolved
...ore.semantics/src/main/java/org/openhab/core/semantics/internal/SemanticTagRegistryImpl.java
Outdated
Show resolved
Hide resolved
...nhab.core.semantics/src/main/java/org/openhab/core/semantics/ManagedSemanticTagProvider.java
Outdated
Show resolved
Hide resolved
...nhab.core.semantics/src/main/java/org/openhab/core/semantics/ManagedSemanticTagProvider.java
Outdated
Show resolved
Hide resolved
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package org.openhab.core.semantics.model; |
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.
I think you should move this to the internal
(or semantics
) package, because that's where the managed provider is.
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.
I asked myself the question.
As it is a generated file, isn't it important to put it in a separate package to clearly identify it ?
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.
In other bundles we use src/generated/java/org/...
for that.
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.
Can you please tell me where I can find an example ?
I will have to add the generated
path in the build path.
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.
org.openhab.core.thing
would be an example. But the classes are generated on the fly during build, I think this is not the case here. So maybe we leave it in place now. In the long run (when we have a YAML based provider), we could convert the CSV to YAML and then load that immediately, when we add the YAML based provider.
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.
Good idea
...org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/SemanticTagRegistry.java
Outdated
Show resolved
Hide resolved
...org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/SemanticTagRegistry.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Also remove method isRemovable from registry interface. Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
The build failure has apparently no link with my PR:
|
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.
In general looks good. It's not so easy to review if the behavior is always the same as before because the general concept changed. But there are a lot of tests, also for the new classes and that all looks good to me.
I have left only some minor comments and would prefer to merge ASAP.
....core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/tag/TagResource.java
Outdated
Show resolved
Hide resolved
....core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/tag/TagResource.java
Outdated
Show resolved
Hide resolved
...org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/SemanticTagRegistry.java
Outdated
Show resolved
Hide resolved
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package org.openhab.core.semantics.model; |
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.
org.openhab.core.thing
would be an example. But the classes are generated on the fly during build, I think this is not the case here. So maybe we leave it in place now. In the long run (when we have a YAML based provider), we could convert the CSV to YAML and then load that immediately, when we add the YAML based provider.
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
I believe you can merge now ;) |
@lolodomo FYI, I wish to review changes later this or next week, in case I find anything I'll try to share them as a post-portem review. Sadly I ran out of spare time to catch up with what you did. |
IMHO, if this is fine for core maintainers, we should not delay the merge of this PR, considering the OH4 release planning and if we want a chance UI part to be implemented in time. If necessary, enhancements could be provided later. One of them is the config file provider I am starting to work on and I hope I can submit another PR during the weekend or next week. |
@lolodomo It seems there is a conflict after I merged the REST cache. Can you rebase? Thanks. |
Conflict resolved. |
Thank you @J-N-K . Can one of you trigger a new build of core framework so that we can then rebuild my HABot PR. We need to merge it ASAP now. Until that, HABot will no more compile in next snapshots. |
Refs openhab/openhab-core#3646. Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
) * Add semantic tag registry + REST API to manage user tags Related to openhab#3619 New registry for semantic tags. New default semantic tags provider for all built-in semantic tags. New managed provider to add/remove/update user semantic tags. Storage of user semantic tags in a JSON DB file. New REST API to add/remove/update user tags in the semantic model. New REST API to get a sub-tree of the semantic tags. Semantic tag class annotations are removed. Semantic tag classes are now created at runtime. Classes Locations, Equipments, Points and Properties are removed Static methods SemanticTags.add removed The adding of semantic tag classes is now managed only by the tag registry. Avoids calling static method SemanticTags.getById when possible SemanticsMetadataProvider service now requires semanticTagRegistry to start. Signed-off-by: Laurent Garnier <lg.hc@free.fr> GitOrigin-RevId: f86635f
Related to #3619
New registry for semantic tags.
New default semantic tags provider for all built-in semantic tags.
New managed provider to add/remove/update user semantic tags.
Storage of user semantic tags in a JSON DB file.
New REST API to add/remove/update user tags in the semantic model.
New REST API to get a sub-tree of the semantic tags.
Semantic tag class annotations are removed.
Semantic tag classes are now created at runtime.
Classes Locations, Equipments, Points and Properties are removed
Static methods SemanticTags.add removed
The adding of semantic tag classes is now managed only by the tag registry.
Avoids calling static method SemanticTags.getById when possible
SemanticsMetadataProvider service now requires semanticTagRegistry to start.
Signed-off-by: Laurent Garnier lg.hc@free.fr