Thanks Robin and Steven.  That makes total sense.  I have been approaching my current implementation with a background in Java and JSPs not in Cold Fusion or even thinking about it by doing what I would call a poor mans version of web services (xml sans SOAP).  I have been lucky enough to be using the AMF gateway for this.  In the end I am left with the following network architecture:

 

Flex Side                     Network                     J2EE Server

 ---------       ----------     ||     ---------       -------------------       ------

| Command | <=> | Delegate | <= || => | Command | <=> | Business Delegate | <=> | EJBs |

 ---------       ----------     ||     ---------       -------------------       ------

 

By doing this I allow Struts to be a Command on the server side and can keep my Business Delegate clean of any HTTPRequest or AMF processing knowledge.  I guess the only open question is would you still pass different Command objects to the Delegate on the Flex side and have more then one function in the delegate that does processing or would you keep it as a one to one relationship between Commands and Delegates to avoid accidental calls of the wrong onResult handler?

 

BTW Once I finally got a grasp on the basics of Cairngorm and Flex my development has been able to movie very fast.  Now to figure out all the nuances in Flex containers to add the polish.

 

            -Kent


From: [email protected] [mailto:[email protected]] On Behalf Of Robin Hilliard
Sent: Thursday, June 16, 2005 4:25 AM
To: [email protected]
Subject: Re: [flexcoders] Flash + Cairngorm Example With Source Code

 

So for Kent, the above is one instance of the separation of the Command/Delegate being useful by hiding a server specific issue (ColdFusion's loose typing) in the Delegate.  Another similar example is a Flex application we're working on that communicates in xml request/response strings with the server.  All the creation of the xml request string and the parsing of the response are handled in the delegates - if we swap to a non-xml format later then the Commands will be none the wiser, they work exclusively with VOs.

 

Finally, in the same application we have a few commands that trigger off a string of four or more server calls via delegates in a row, so the mapping of commands to delegates is 1:many (I've written a little state-machine logic in my commands onResult using (gasp) a case statement - unfortunately I haven't seen Steven's solution for this in 0.99 at this point, will have a look soon but it may take a bit to tear me from my state machines, which work rather nicely).

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to