O'Reilly logo

Professional Cairngorm™ by Jeremy Wischusen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

3.5. Summary

In this chapter you looked at the classes and interfaces associated with the Cairngorm ServiceLocator. These included:

  • AbstractServices

  • HTTPServices

  • IServiceLocator

  • IServices

  • RemoteObjects

  • Responder

  • ServiceLocator

  • WebServices

The ServiceLocator acts a centralized repository where your remote classes such as HTTPService, WebService, and RemoteObject are created and accessed.

Services are looked up by instance name using to corresponding function for the type of service that you are looking for. These functions are getHTTPService, getRemoteObject, and getWebService.

The ServiceLocator is not intended to be used outside the control layer.

The ServiceLocator is implemented as an MXML file, normally in the business package. You register services by adding the appropriate tags to the ServiceLocator MXML file.

You need to have an instance of the ServiceLocator MXML file in your main application; however, this instance is not directly accessed. Instead you use the singleton getInstance method to refer to the instance and then call the desired methods on the returned instance.

Once you have retrieved a service from the ServiceLocator, working with it becomes the same as working with that service in any Flex project.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required