In a typical Cairngorm project, the ServiceLocator is created in the business package (Figure 3-1). This is the case in both the Cairngorm Store application and the FStop application.
Creating the ServiceLocator is a bit different from creating the other Cairngorm classes in that the ServiceLocator is created as an MXML file.
It's simple to create a ServiceLocator.
In the business package, create a new component. Some developers simply name the file Services; others include the project name, as in (Figure 3-2).
You will have to fully type in the name ServiceLocator in the "Based on" field, since the ServiceLocator will not be an option in the list.
Once the component has been created, you need to make a few modifications. You need to change the default namespace from "*" to something like xmlns:services="com.adobe.cairngorm.business.*". Once you have done that, you need to add the prefix you created to the beginning and ending tags, as in the following:
<?xml version="1.0" encoding="utf-8"?> <services:ServiceLocator xmlns:services="com.adobe.cairngorm.business.*" xmlsn:mx="http://www.adobe.com/2006/mxml"> </services:ServiceLocator>