Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: Commands and sequential execution  (Read 6770 times)
wgiesler
Newbie
*
Posts: 1


View Profile Email
« on: August 20, 2008, 08:51:54 »

In my first attempt to learn PureMVC I have chosen to code a rudimentary IMAP-Reader and are stuck with what to do where.
I have a 3-part vertically split window with an ApplicationControlBar handling the login selection on top, a DataGrid for the header list (sender, date, subject) below and TextArea for the selected message's body text, each with its mediators.
Corresponding entities on the model side are an AccountProxy for the ApplicationControlBar, a HeaderProxy for the DataGrid and a BodyProxy. The AccountProxy opens a socket to the IMAP and has a receiveData event handler that assembles the IMAP server's answers. Works fine to the point where it sends a notification about a successful login.

The next task would be to fetch the headers. This requires a sequence of first "select"ing the inbox and then, based on the select's answer, try to fetch the separate message headers sequentially in order to assemble an ArrayCollection of HeaderVOs as the DataGrid's model. The HeaderVO collection is going to be the dataObject of the HeaderProxy. As the AccountProxy "possesses" the socket connection, its sendData() function and the event handlers should be re-used for fetching the data.

My view: Assembling the data model's ArrayCollection is "domain logic" and should be done by a Proxy, here the HeaderProxy and the BodyProxy respectively. The HeaderProxy would be notified from a successful login and it would retrieve the current header list once (and timed every 30 seconds thereafter). This would require to send the IMAP request strings sequentially to the AccountProxy and to get its answers as the payload of a notification. This however is not allowed and not possible as a proxy can't receive notifications.
A command on the other hand seems not to be fit to hold data (like the list of message ids that the IMAP reports as new) between sequential executes.

To be compliant to PureMVC I would have to set up a command to receive the answer message notifications from the Account to merely rewrap them into function calls to the HeaderProxy which in my eyes is an unnecessary deviation. Or to put all the logic into one "ImapProxy" that serves three data models at a time which I would prefer although this might get a heavy chunk.

I have the feeling I'm missing the right way to do it. Any hints?
Walter
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: August 23, 2008, 11:51:48 »

Have a look at Trilec's Notification Chaining utility: http://forums.puremvc.org/index.php?topic=422.0

-=Cliff>

Logged
Pages: [1]
Print