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 yearOn 01/04/2008, at 8:51 AM, Gareth Edwards wrote: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 interdependeI 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 availableAMFChannels. I almost have it all working, but have a couple ofquestions before I continue to finish the work in this area.
- Is it o.k for my Service Locator to access the Model locator?nt 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.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.- How would you best manage your application to "WAIT" until various
checks on the AMFChannels are done before doing anything further ?
- 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.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.
- 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.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