The new Shared Object implementation in the UcompOS Rich Productivity Framework provides an additional model for achieving inter-application and sub-application communication and data exchange in a manner that is grounded in the MVC (Model-View-Controller) Design Pattern.
The term Shared Object in the context of the UcompOS RPF is similar in principle to the concept of the Local Shared Object infrastructure that has been in the Flash Player since the days of Flash 4 but in our case, the UcompOS RPF Shared Object is a run-time Object that does not get saved locally (unless you of course configure your own implementation to do so).
In the UcompOS Portal is an Object that gets instantiated into the application’s run-time memory upon authentication.
This Object is then freely available for all UcompOS entities to access using the GlobalManager.setSharedObject, GlobalManager.getSharedObject, and GlobalManager.getSharedObjects public API methods sponsored by the UcompOS Portal.
The UcompOSGlobalManagerProxy class in the UcompOS SDK has an API to these methods in the public methods of the class as indicated below:
public function setSharedObject(key:String, value:Object):void public function getSharedObject(key:String):void public function getSharedObjects(keys:Array):void
One of the more important aspects of the Shared Object implementation is that the UcompOS Portal dispatches a Continuum Event of type SDKEvent.SHARED_OBJECT whenever a property of the Shared Object changes.
A Continuum Event is an event dispatched to every entity in the UcompOS Continuum.
An entity can attach a listener to the UcompOSGlobalManagerProxy Singleton listening for SDKEvent.SHARED_OBJECT events.
The event Object will have a key and a value property representing the property on the Shared Object that was just modified and its associated value.
As a very simple example of what we can do with this, I set up a basic UcompOS implementation.
The implementation involves a UcompOS background application that launches a UcompOS Window with a text area. Upon initialization, this application launches another UcompOS Window with a sub-application in it next to the initial window This sub-application also has a text area.
When text is entered in the primary application window’s text area, the text is instantly displayed in the sub-application window’s text area.
The mechanics for this employ the UcompOS Shared Object.
I’ll share the code below so you can get an understanding of how it was configured:
The Dock Manifest
<applications> <application background="true"> http://desktop.ucompass.com/Shared_Object/manifest.xml </application> </applications>
The Application Manifest
<application selfLoading="true" width="500" height="500" x="0" y="100"> <source> <base>http://desktop.ucompass.com/Shared_Object/windowA.html</base> </source> <titles> <title locale="en_US">Shared Object Example</title> </titles> </application>
The Application Code
The Sub-Application Code