Search the web
Sign In
New User? Sign Up
cairngorm-devel · Cairngorm Developers
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Cairngorm ServiceLocator Question.   Message List  
Reply | Forward Message #206 of 210 |
Re: [cairngorm-devel] Cairngorm ServiceLocator Question.

Gareth,

I'm a little late to this discussion, but I thought I through in my two cents.  In your service locator you can bind the channelSet attribute to a dynamically created channelSet that is stored in your model locator.  You create functions/ui to manipulate that model and the service locator, as a binding destination, will "know" about the model.  However, I wouldn't kludge up your service locator - sure make it so you can manipulate it, but I would keep focused - just a service locator and nothing more.  You could split hairs about where the manipulation logic lives.  I happen to like using model locators and using binding.

As far as your logic to test the various services, I'd definitely create a command class and delegates to do that.  There's absolutely no reason why your Command class can't recursively check for status on a number of services and and when complete, modify your model locator, which in turn will notify the user of the results via the view.  I've had good luck with using application states and binding the state to my model locator. This allows me to drive any number of transitions, property settings and functions when the application enters a state such as "SERVICES_INITTED".  

Jeff


On Apr 1, 2008, at 6:05 PM, Gareth Edwards wrote:

Robin,

Thanks for your response, I understand MVC most of the time, but I was a little unsure because of the nature of the service locator.
So is o.k for my view to know about the service locator?

To add methods to my service locator I will have to modify the Cairngorm EnterpriseServiceLocator, is this correct? 
I have already modified it to work with BlazeDS (Messaging, without LC) so I don't have a big issue doing this if it is what is required.

Cheers
Gareth.

Robin Hilliard wrote:

Hi Gareth,


Here's some answers assuming you subscribe to the gist of the MVC presentation I gave at WebDU last year


On 01/04/2008, at 8:51 AM, Gareth Edwards wrote:
I have created a some what complicated services.as 
(EnterpriseServiceLocator) and I'm trying to give some limited control 
back to the end user, and allow them to select from a list of available 
AMFChannels. I almost have it all working, but have a couple of 
questions before I continue to finish the work in this area.


- Is it o.k for my Service Locator to access the Model locator?

Strictly speaking no, because the ServiceLocator is part of the business layer, and this would introduce a dependency on a particular model from your business layer (you could imagine the business layer being useful to many distinct Flex apps with different models).  That said the model changes the least out of the MVC players so in some situations where the model and service were very closely interdependent you could argue that this wasn't too great a loss.


- Is it o.k for my Service Locator to modify the values in the Model?


See above.

- How would you best manage your application to "WAIT" until various 
checks on the AMFChannels are done before doing anything further ?

I'd queue the requests, going with the philosophy that like DAOs on the server you are trying to hide the complexity of how the services work from the rest of the application.  As far as the command knows, it makes the asynchronous call and it just takes a while to come back while some tests are done.  In fact something like this happens anyway when Flash tests for the appropriate  cross domain file on the server before making an RPC call.


- Would it be better to create an Event / Command to do the required 
logic to determine the AMFChannels and then use this to set the Model, 
then have the service locator access the Model for read only?


I would be inclined to keep the details of the selected channel in the Service Locator or a service in the Service Locator and not in the model. 


- When the user selects an available AMFChannel, the system needs to 
move the selected Channel to the TOP of the ChannelSet
- I'm doing this by creating an array of AMFChannels, storing these 
in the Model, then reading them into the service locator and ChannelSet 
when required.
- How do I ensure no further actions take place until this update is 
done.

I'd add methods to the service to get lists of channel set names and select the channel - the rest of the app doesn't need to know that they're channel sets, just choices like "unsecure", "secure" or whatever you have.

You could queue the calls - the neatest way (maybe gold-plating, but cute and useful) to do this would be to create a Proxy subclass that decorated your service and queued up function calls that it would play back when you set an enabled property to true.  This is like the access control proxy pattern.  There might be something in the SDK that does this already.

HTH,

Robin



   
 ROBIN HILLIARD
Chief Executive Officer
robin@rocketboots.com.au

RocketBoots Pty Ltd
Level 11
189 Kent Street
Sydney NSW 2001
Phone +61 2 9323 2507
Facsimile +61 2 9323 2501
Mobile +61 418 414 341
www.rocketboots.com.au
 
   
 





Wed Apr 2, 2008 10:08 am

jbarts1000
Offline Offline
Send Email Send Email

Forward
Message #206 of 210 |
Expand Messages Author Sort by Date

I have created a some what complicated services.as (EnterpriseServiceLocator) and I'm trying to give some limited control back to the end user, and allow them...
Gareth Edwards
garethe_work
Offline Send Email
Apr 1, 2008
10:44 am

Hi Gareth, Here's some answers assuming you subscribe to the gist of the MVC presentation I gave at WebDU last year ...
Robin Hilliard
robinhilliardau
Offline Send Email
Apr 1, 2008
6:02 pm

Robin, Thanks for your response, I understand MVC most of the time, but I was a little unsure because of the nature of the service locator. So is o.k for my...
Gareth Edwards
garethe_work
Offline Send Email
Apr 2, 2008
8:20 am

Gareth, I'm a little late to this discussion, but I thought I through in my two cents. In your service locator you can bind the channelSet attribute to a...
Jeffrey Battershall
jbarts1000
Offline Send Email
Apr 2, 2008
10:20 am

My last couple of applications have followed the same kind of workflow, as well. I haven't stored channelsets, but generally, if you have any kind of data ...
sLangeberg
scoobeedogg
Offline Send Email
Apr 2, 2008
3:12 pm

... Hi Jeff - I can be as pragmatic as the next developer but here's a sketch of the hair splitting version for your enjoyment :-). <?xml version="1.0"...
Robin Hilliard
wzp193
Offline Send Email
Apr 3, 2008
8:55 am

... Hi Jeff - I can be as pragmatic as the next developer but if you're interested here's a sketch of the hair splitting version :-). <?xml version="1.0"...
Robin Hilliard
robinhilliardau
Offline Send Email
Apr 3, 2008
8:55 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help