-
Notifications
You must be signed in to change notification settings - Fork 782
Conversation
Signed-off-by: Karel Goderis <karel.goderis@me.com>
I am just wondering if we should have the UID of Notifications set by the NotificationManager (using java.util.UUID), and have the add() method return that UID. |
Returning the UID on add sounds like a good idea, using java.util.UUID not - I would stick to a String, so that producers have a chance to define their own. |
I see merit in being able to set your own id but what does that mean for the notification consumers? They will have no means to decode potential information stored in the id itself, and so, imagine that we do have to distinguish between sources of notifications, then maybe we have to standardise how the source field is encoded? For example 'class name:hashcode' or alike. Or we have ids that are part free text and part set by the notification manager? |
The id is an id, it should have no meaning that anybody should interpret (with the exception of the producer itself, maybe). To distiguish between sources, we have the source property (which again should have no further meaning than different Strings mean different producers). |
Signed-off-by: Karel Goderis <karel.goderis@me.com>
Anything that can be done to push this a bit forward? |
Hi @kgoderis, |
A bit inbetween I would say. We discussed the architecture quite a bit in the thread mentioned above, but I didn't yet find the time to have a closer look at the code of this PR - and as usual, many questions/ideas about the functional design only come up when looking at some real code. |
Probably creating fewer other "urgent" PRs ;-) No, seriously, you know that all your contributions are very welcome, but I am struggling a lot to find the time to do the detailed reviews as this is quite time consuming as well - and there are so many other discussions and PRs going on as well. |
cp -p /kai /kai2 ? /me not being a code developper by trade, I think I do not qualify to do code reviews. However, if you would ask me if I would forego code quality for speed of integration, then I would say yes, as bugs can be always fixed afterwards, even by the strong user base of OH2/ESH. "Use the force, Luke" ;-) |
I’ve had a bit of a look over the notification system - it's not a code review - just trying to work out how it is meant to work and have a few thoughts/comments. Firstly, from Karels comment above -:
I couldn’t find this interface in the source?
I couldn’t find this interface, but I assume that the notifications are published in the standard way, so it’s just sent using SSE to the UI. Actually, looking at the diagram on the Eclipse forum, it looks like these notifications aren't sent using SSE, although I did see an event factory in the code, but this doesn't seem to be in the UML?
I don’t want to have to define anything in the model (I assume that’s what the .notify is?). I would just want the information to be sent to the UI – filtering out notifications might not be good.
where are these types defined? Would they go into a class/enum or something?
How is this defined? I couldn’t see anything in the notification builder about specifying persistence. This would definitely need to be disabled for these type of notifications or things could get VERY confusing. My use case for the binding notifications should be delivered in real-time, or not at all. For the implementation -: I guess it’s possible to have different implementations of Notification? Eg can we extend NotificationImpl at all? If so maybe this is a good way to provide a class of notifications useful for binding events, or user admin interface type of events? I suspect that additional information may be needed to allow bindings to provide information to UIs. As I said in earlier posts, I can see a case where we want to provide a string that every UI can use to present a common, meaningful representation of the event. However, I would like to make it extendable such that a binding could provide binding specific information that could be presented by a binding specific plugin in the UI. This could be an extended event, or could use a map of properties that could be added to the event. I’m a bit confused by the event topic ("smarthome/notifications/{notificationUID}/added"). What is the UID here? I thought the UID was generated when you create a notification - ie it uniquely identifies that speficic notification so it could be cancelled later? I couldn’t see any way to disable persistence. I was mainly looking at the notification builder, but there’s nothing there that allows certain events to be persisted or not. Can this only be done in some static definition? There's a LOT of files here. I'm not really sure how the models fit into this at all, and this PR seems to mix the concept and the implementation (am I right?). For example I see email and pushover in here - I wonder if it might not be easier to review and get approved with a subset, and then add the different notification implementations as separate PRs? (just a thought to try and make it easier to review, and quicker to approve). |
@cdjackson will get back to you when I have more time to go through yr comments, but the implementation does indeed differ from the diagram, and does a bit more than the diagram, e.g. pushover and other "sample" implementations. Notifications are in fact "encapsulated" into the already existing Events. I had some discussion with Kai regarding the ID these Notifications should get, but the idea was that it was up to the instance generating the Notification to come up with an ID To rephrase a bit, the instance consuming the Notifications would implement NotificationService, or alternatively, be an EventSubscriber if it directly wants to listen to NotificationAdded Events for example; The instance generating them should bind via OSGi to the NotificationManager, and use the NotificationBuilder to create notifications and post them to the NotificationManager Sorry for the confusion, has been a along time since I wrote this code. |
Any further thoughts on this anyone? |
No, not as long as we have urgent startup problems to solve... |
Sorry @kaikreuzer - I should have stated this was really for @kgoderis as he said he would comment further on my comments |
@cdjackson Chris, I lost this from sight as I was rather busy trying to get my ops env on the Karaf distribution. I will be travelling shortly and do not plan to take my pc with me, so I will get back to this in a few weeks time. |
<properties> | ||
<bundle.symbolicName>org.eclipse.smarthome.model.notification.runtime</bundle.symbolicName> | ||
<bundle.namespace>org.eclipse.smarthome.model.notification.runtime</bundle.namespace> | ||
</properties> |
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.
Please remove these properties. See #6060.
<bundle.namespace>org.openhab.action.pushover</bundle.namespace> | ||
<deb.name>openhab-addon-action-pushover</deb.name> | ||
<deb.description>${project.name}</deb.description> | ||
</properties> |
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.
Please remove the bundle.symbolicName
and bundle.namespace
properties. See #6060.
The deb.name
and deb.description
properties should also be removed because this is no openHAB project.
org.eclipse.jdt.core.compiler.compliance=1.7 | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.source=1.7 |
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.
Please remove this file because it causes the default Eclipse project settings to be overridden. See also #6106.
@@ -0,0 +1,2 @@ | |||
eclipse.preferences.version=1 | |||
encoding/<project>=UTF-8 |
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.
Please remove this file because it causes the default Eclipse project settings to be overridden. See also #6106.
org.eclipse.jdt.core.compiler.compliance=1.7 | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.source=1.7 |
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.
Please remove this file because it causes the default Eclipse project settings to be overridden. See also #6106.
@@ -0,0 +1,2 @@ | |||
eclipse.preferences.version=1 | |||
encoding/<project>=UTF-8 |
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.
Please remove this file because it causes the default Eclipse project settings to be overridden. See also #6106.
org.eclipse.jdt.core.compiler.compliance=1.7 | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.source=1.7 |
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.
Please remove this file because it causes the default Eclipse project settings to be overridden. See also #6106.
org.eclipse.jdt.core.compiler.compliance=1.7 | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.source=1.7 |
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.
Please remove this file because it causes the default Eclipse project settings to be overridden. See also #6106.
org.eclipse.jdt.core.compiler.compliance=1.7 | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.source=1.7 |
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.
Please remove this file because it causes the default Eclipse project settings to be overridden. See also #6106.
org.eclipse.jdt.core.compiler.compliance=1.7 | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.source=1.7 |
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.
Please remove this file because it causes the default Eclipse project settings to be overridden. See also #6106.
org.eclipse.jdt.core.compiler.compliance=1.7 | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.source=1.7 |
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.
Please remove this file because it causes the default Eclipse project settings to be overridden. See also #6106.
org.eclipse.jdt.core.compiler.compliance=1.7 | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.source=1.7 |
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.
Please remove this file because it causes the default Eclipse project settings to be overridden. See also #6106.
This pull request has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/roadmap-to-happiness-what-is-missing-from-the-core-framework/54522/3 |
This pull request has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/roadmap-to-happiness-what-is-missing-in-the-core-framework/54522/1 |
This pull request has been mentioned on openHAB Community. There might be relevant details there: |
What has to be done here? If this is mereley incoproration of @wborn's review comments I could do that. |
It is marked WIP and it is 3 years old - so I'd assume that there's still some work to do. Definitely worth to read through the past discussion at https://www.eclipse.org/forums/index.php/t/1070058/. My suggestion is to wait at least until the open tasks of https://community.openhab.org/t/the-road-ahead-reintegrating-esh/64670 are through and we can continue with maintaining this code at openhab-core. |
I'll close this PR here now as ESH is EOL. If anybody wants to revive this work (and I personally think the feature is great, once it is ready), feel free to port the code to https://github.com/openhab/openhab-core and create a new PR there. |
Based on https://www.eclipse.org/forums/index.php/t/1070058/
Just a few words of explanation with respect to the consumer/producer code. I have split the initial code (#436) into two parts, in order to show the capabilities of the framework:
Signed-off-by: Karel Goderis karel.goderis@me.com