Вы находитесь на странице: 1из 8

What is Cairngorm?

• A methodology for breaking up your application code by logical functions

• This is routinely referred to as MVC, or Model, View, and Control.

The Pieces of Cairngorm :

 Model Locator

 View

 Front Controller

 Command

 Delegate

 Service
Cairngorm 2 Microarchitecture
Cairngorm package behaviors

Model Locator: Stores all of your application’s Value Objects (data) and
shared variables, in one place. Similar to an HTTP Session object, except that
its stored client side in the Flex interface instead of server side within a
middle tier application server.

View: One or more Flex components (button, panel, combo box, Tile, etc)
bundled together as a named unit, bound to data in the Model Locator, and
generating custom Cairngorm Events based on user interaction (clicks,
rollovers, dragndrop.)

Front Controller: Receives Cairngorm Events and maps them to Cairngorm


Commands.

Command: Handles business logic, calls Cairngorm Delegates and/or other


Commands, and updates the Value Objects and variables stored in the Model
Locator

Delegate: Created by a Command, they instantiate remote procedure calls


(HTTP, Web Services, etc) and hand the results back to that Command.

Service: Defines the remote procedure calls (HTTP, Web Services, etc) to
connect to remote data stores.
CARE Folder Structure

Cairngorm Folder
Structure for care
project
Folder Content
 Your main MXML application will be placed in the
main project folder.

 You must keep all the images in the image folder


below assets which you are using in the project.

 Place all the style sheet files inside the css folder
under assets.

 Place all the components in the View folder and


you call those components in the main MXML

 Application using xmlns:<component name> =


”Component path ”.

 Keep all the custom components in the


components folder.

 Keep all the renderers in the renderers folder.


How Values are retrieved from Business Layer

1. Design the folder as shown above that is the way to achieve the value retrieval from
business model,

2. Create the design mxml Application as per the requirements,

3. The designs should be placed inside the view folder. If you are required to create different
view, create separate folder for each pattern and shell all the folders into the view folder,

4. The values are retrieved from the model in the basics of Cairngorm architecture,

5. Front Controller Listens for User Gestures such as - pressing buttons, dragging and
dropping icons, double-clicking rows or submitting forms,

6. Cairngorm translates these user gestures into Cairngorm events,

7. Once the Front Controller recognizes an event it calls the execute () method on the
command and the command does its specific work,
How Values are retrieved from Business Layer (Cont)

1. Commands prefer to delegate the responsibility for server-side business logic


to another class. So whenever you have business logic, put it into a Business
Delegate class So that your commands can invoke methods on it.

• Business Delegate uses the Service Locator to locate services by name.


Business Delegate knows that the command will have an onResult() method to
handle all results and an onFault() method to handle any errors.

10. Finally, your application must be able to communicate back to the user.

11. When your Command classes ask the Business Delegate to call some server-side
business logic on your user's behalf, they implement the Responder interface and
receive either Value Objects or collections of Value Objects in the onResult() method.
Code Flow

Input
Output

Вам также может понравиться