This is my first progress report on my project.
I have spent last week learning JNI and Growl Cocoa API. Then I developed a simple proof-of-concept test application that sends notification messages to Growl and gets an indication when user clicks on them.
Now I need to come up with OSGi service that acts as an interface between SC and Growl. Here are my thoughts and questions:
First of all, I am a bit unsure why we need OSGi service, that is used only as an API to Growl. Wouldn't it be enough to add this functionality to GrowlNotificationServiceImpl?
Secondly, I am struggling to decide what to use as a clickContext in the OSGi service. Growl distinguishes messages by using clickContext object, which must be a dictionary, array, string, data, or number object. Then if the message is clicked, Growl daemon calls back a growlNotificationWasClicked method and passes clickContext as an argument. If it was not clicked, it calls back growlNotificationTimedOut method and passes clickContext as an argument.
A logical candidate would be to use the tag object from PopupMessage, but I am not really sure what kind of object it is and that it is always set. Using some king of number or string would be much easier. In my opinion, some kind of timestamp would suit the task best. Then the GrowlNotificationServiceImpl could maintain pairs of timestamps and associated PopupMessages. If the user ignores the notification, the growlNotificationTimedOut will remove the related <timestamp,
pair. And if the user clicks the notification,
GrowlNotificationServiceImpl will get back a timestamp corresponding to PopupMessage that was clicked.
Now comes the part that I am confused about: How to show the chat window that is related to the popup message?
Currently, apart from GrowlNotificationServiceImpl there are 2 other classes that implement PopupMessageHandler interface - PopupMessageHandlerTrayIconImpl and PopupMessageHandlerSwingImpl. Following the code of these two classes, I assume that GrowlNotificationServiceImpl should do the same - construct and fire a SystrayPopupMessageEvent object, which will be used by some listener to bring the appropriate chat window to front.
Or maybe the GrowlNotificationServiceImpl should deal with showing chat windows itself? It looks like UI Service is designed for this task. There is an example in documentation how to obtain a chat window having a Contact object. Is it the case that tags in PopupMessage objects are Contacts? Or maybe the component variable in PopupMessage is all I need to show the chat window? I am really unsure what these two variables of PopupMessage are used for.
Thanks in advance for your comments,