One of the most powerful programming features of OpenInsight is the “Promoted Event” model, allowing you to write “global” event handing code that can be triggered for a variety of situations, such as for all objects of a certain type, or for all objects in an application, and so on. This helps to centralize your code-base and restrict unnecessary duplication, thereby making development faster and more robust.
However, promoted events have also been one of the most opaque parts of the system and their use is somewhat awkward and error-prone because they rely on the dark art of naming conventions and manual record copying between tables. In an effort to rectify this we’ve integrated them into the OpenInsight Repository so they can be tracked properly and you can see at a glance exactly what is in your system.
Promoted events fall into one of 5 generic categories:
Category Example SYSREPOSEVENTS key ======== ========================== 1) EVENT/CLASS/TYPE specific -> SYSPROG*ACTIVATED.WINDOW.OIWIN* 2) EVENT/TYPE specific -> SYSPROG*ACTIVATED..OIWIN* 3) TYPE specific -> SYSPROG*..OIWIN* 4) EVENT/CLASS specific -> SYSPROG*ACTIVATED.WINDOW* 5) EVENT specific -> SYSPROG*ACTIVATED*
So to enable their integration we’ve added three new entity types:
- PROMOTEDEVENT (source code)
- PROMOTEDEVENTDBG (debugger symbol table)
- PROMOTEDEVENTEXE (object code)
Each of these types has a Repository key structure that derives from the actual promoted event key itself like so:
SYSREPOSEVENTS key Repository key ================== ============== SYSPROG*ACTIVATED.WINDOW.OIWIN* -> SYSPROG*PROMOTEDEVENT*ACTIVATED*WINDOW.OIWIN SYSPROG*ACTIVATED..OIWIN* -> SYSPROG*PROMOTEDEVENT*ACTIVATED*_.OIWIN SYSPROG*..OIWIN* -> SYSPROG*PROMOTEDEVENT*_*.OIWIN SYSPROG*ACTIVATED.WINDOW* -> SYSPROG*PROMOTEDEVENT*ACTIVATED*WINDOW SYSPROG*ACTIVATED* -> SYSPROG*PROMOTEDEVENT*ACTIVATED*_
Some of you may look twice at the use of the “_” character for the CLASSID and ENTID Repository key parts: This is actually used as a placeholder to denote a null part in the promoted event key itself – their use is necessary because the Repository reacts poorly to a null CLASSID or ENTID.
We’ve also added a new stored procedure called SYNCH_REPOS_PROMOTED_EVENTS which can scan your SYSREPOSEVENTS and SYSREPOSEVENTEXES tables to create any missing entities so it’s easy to bring your existing promoted events into the Repository,
Of course integration with the Repository isn’t the end of the story – now that promoted events are recognized as first-class citizens we need to provide the tools in the IDE to create and maintain them… but that’s a story for another time…
(Disclaimer: This article is based on preliminary information and may be subject to change in the final release version of OpenInsight 10).