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.3. How Do You Create It?

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.

Figure 3.1. Figure 3-1

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).

Figure 3.2. 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>

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