Like ReviewTube before it, the Faces example from the Allurent guys
has some useful techniques. I like their approach to ServiceLocator
(note: services in this case are really more analogous to delegates
for you Cairngorm folk):
Usage looks like this:
DocumentService(context.services.findService(DocumentService)).search(_term,
responder);
and config like this (my variation):
<serviceutil:ServiceLocator id="services">
<serviceutil:services>
<service:DocumentService
host="{config.hostName}"
searchAction="/search.action"
>
</service:DocumentService>
</serviceutil:services>
</serviceutil:ServiceLocator>
The ServiceLocator class has an array property called "services" and
implements find by class.
Now. The DocumentService class could have multiple methods, each of
which requires a different HTTPService. I could set a property for
each "action" (like "searchAction above), and then instantiate the
HTTPService in the service methods, using host + action as the URL.
However, I thought it might be nice to embed the HTTPService
configuration within the DocumentService declaration above. The
following results in a parse error:
<serviceutil:ServiceLocator id="services">
<serviceutil:services>
<service:DocumentService
host="{config.hostName}"
>
<mx:HTTPService id="searchAction">
...
</mx:HTTPService>
</service:DocumentService>
</serviceutil:services>
</serviceutil:ServiceLocator>
Thoughts on this approach and what I'm missing? Thanks.