Doug,
Thanks for the insights. Since the paint's not even dry yet on my shiny new knowledge of Cairngorm, I don't think it's a good idea for me to wade into the core classes and start ripping out stuff ;-) I will however take your suggestion of using an interface for my delegates under advisement - though I must say I'm not excited about doubling the number of classes just to have two different sources for my services. Let me know when you write a cool solution for this problem - I'd love to see it! Thanks for your help. Ben ________________________________ From: [email protected] [mailto:[email protected]] On Behalf Of Douglas Knudsen Sent: Monday, February 23, 2009 2:00 PM To: [email protected] Subject: Re: [AFFUG Discuss] Using Local Data in Cairngorm One thing you could do is check out adding a Services.initServices(). In this method, check the swfs current URL for http or local and decide which services to init. Ah...bugger, yeah, AbstractServices.register does some stuff you may need to play with to do this. I've hacked this up recently to load service settings from a XML file at runtime, but had to change some base Cairngorm code plus its for a client. That said I've been planning to look at a more elegant way to do this...maybe soon. The basic approach I was using is to look at a Services.initServices() method that sets up the services in AS. The fun part is the way Cairngorm registers its services. I believe Mate handles this better :) THe other issue, you shouldn't have to play wrap delegate calls to services in conditionals. Make use of interfaces there. So, have say IProjectDelegate with your contract. Then you could have ProjectLocalDelegate implements IProjectDelegate and similarly ProjectRemotingDelegate. Follow a similar approach with data translator objects. HTH somewhat! Douglas Knudsen http://www.cubicleman.com this is my signature, like it? On Mon, Feb 23, 2009 at 12:23 PM, Ben Wakeman <[email protected]> wrote: Hey Everyone, Our shop is in the process of working through our first few Flex Cairngorm projects - one most recently implementing the UM Extensions. I have a question regarding best practice when it comes to working with local data services. In other apps I've built I have set a var in my Model to toggle between using "live" data and local stub data when I don't have an Internet connection. I began to think about how I might implement this same idea in Cairngorm but started to scratch my head when I realized that I though I could make two different versions of my ServiceLocator, there would be a number of other files that would have to change in the process when switching between live and local data mode. For instance, all the delegate classes which refer to specific methods in my remoting objects would have to be wrapped in conditionals. I know there must be an elegant pattern for handling this scenario using Cairngorm with Extensions. Can anybody out there shed some light or maybe share some sample code that solves this problem? I know there must be a way to completely isolate the services to decouple them from the rest of the app. Thanks! Ben Wakeman Director of Application Development ______________________________________ Digital Positions, Inc. 2289 Peachtree Road NE Atlanta, GA 30309 404-351-6226 phone 404-351-4055 fax http://www.d-p.com/ ------------------------------------------------------------- To unsubscribe from this list, simply email the list with unsubscribe in the subject line For more info, see http://www.affug.com Archive @ http://www.mail-archive.com/discussion%40affug.com/ List hosted by FusionLink <http://www.fusionlink.com> ------------------------------------------------------------- ------------------------------------------------------------- To unsubscribe from this list, simply email the list with unsubscribe in the subject line For more info, see http://www.affug.com Archive @ http://www.mail-archive.com/discussion%40affug.com/ List hosted by http://www.fusionlink.com -------------------------------------------------------------
