Jai’s Weblog – Tech, Security & Fun…

Tech, Security & Fun…

  • Jaibeer Malik

    Jaibeer Malik
  • View Jaibeer Malik's profile on LinkedIn
  • Subscribe

  • Feedburner

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 16 other followers

  • Archives

  • Categories

  • Stats

    • 236,338
  • Live Traffic

Flex: Cairngorm (MVC), SpringActionscript (IOC) and other Cairngorm Extensions

Posted by Jai on August 19, 2009

In this post I will cover brief about the flex Cairngorm framework , integration with SpringActionscript framework, SpringActionscript Cairngorm extension and other available cairngorm extensions and which may fit where in terms of specific tasks.

On a whole, agenda is:

  • Cairngorm framework – Flex MVC framework, available resources and how to get started.
  • SpringActionscript framework – IOC framework, how to get started and how it helps.
  • SpringActionscript Cairngorm extension – How it helps in following best practices and how to use it.
  • Cairngorm UM extension – UM extension for specific operations.

Cairngorm

There are many Flex MVC frameworks available and why Cairngorm for me, please have a look at Flex now, then & tomorrow…

The first impression of the cairngorm you will have is the lightweight micro-architecture. What it means that it will give you the direction to follow the best practices of flex in easy and quick way and as you move adopt as per the requirements.

Official Website: Cairngorm Download and get started.

Plugin: IDE plugin available at site. (helps in creating command and controller).

Discussion Group: Follow the discussion group.

Few Nice Tutorials: Documentation, Getting started with cairngorm, Cairngorm For Beginners, Cairngorm Tips,

Maven Integration: Use the below code for maven dependency.


                <dependency>
			<groupId>com.adobe.cairngorm</groupId>
			<artifactId>cairngorm</artifactId>
			<version>2.2.1</version>
			<type>swc</type>
		</dependency>

SpringActionscript

There are few IOC framework available but being a java developer, I am fan of Spring and here it is an extension of that SpringActionscript :), earlier known as Prana Framework. Like spring, you can use this framework for object injection.  Have a look at the home page to get started.

Maven Integration: Use the following dependencies and repository entries to get started.

repository:


               <repository>
			<id>yoolab.org-releases</id>
			<name>Yoolab.org releases repository</name>
			<url>http://dev.yoolab.org/maven/content/repositories/</url>
			<layout>default</layout>
		</repository>

dependencies:


<dependency>
	<groupId>org.springextensions.actionscript</groupId>
	<artifactId>spring-actionscript-cairngorm</artifactId>
	<version>0.8</version>
	<type>swc</type>
</dependency>

<dependency>
	<groupId>org.springextensions.actionscript</groupId>
	<artifactId>spring-actionscript-core</artifactId>
	<version>0.8</version>
	<type>swc</type>
</dependency>

<dependency>
	<groupId>org.as3commons</groupId>
	<artifactId>as3commons-reflect</artifactId>
	<version>1.0.0</version>
	<type>swc</type>
</dependency>

<dependency>
	<groupId>org.as3commons</groupId>
	<artifactId>as3commons-lang</artifactId>
	<version>1.0.0-SNAPSHOT</version>
	<type>swc</type>
</dependency>

<dependency>
	<groupId>org.as3commons</groupId>
	<artifactId>as3commons-logging</artifactId>
	<version>1.0.0</version>
	<type>swc</type>
</dependency>

Sometimes the best way to learn about the best practices is to go through the open source code available. The available IOC frameworks for Flex, have a look at the sample code examples and the source code here gives good idea to structure your code.

SpringActionscript Cairngorm Extension

Have a look the tutorial explaining that how you can integrate springactionscript with cairngorm.

If we talk about the dependencies and different mappings in Cairngorm, what we need is:

  • Event name and command mapping in front controller:define it in context file
  • Command needs models: inject it through context configuration file
  • Command needs delegate: define and inject through context file
  • Delete needs service: define it in context file, helps in testing to define the mock objects
  • Services and Amf channel configurations: configure it in context file

I am planning to cover all this with a sample example in the coming posts (will be too much to put everything here).

Cairngorm UM (UniversalMind) Extension

Have a look at Home page for list of add-ons provided by flexcairngorm.

Specially the one I like is the view notification implementation. You can either use the same extension or have a look at the implementation that how it is done and make changes in the base command and event classes to have the similar approach.

I will be posting soon the different approaches for the view notification and what all changes you need to do.

Cairngorm 3

Have a look at ideas suggested by Marcin at the page and see how it fits in your case. Haven’t explored what this guy has suggested but feel free to explore more yourself.

Stay tuned for the sample code examples on how to use these frameworks to solve specific problems. I am planning to cover sample code for SpringActionscript cairngorm extension integration and custom implementation of UM extension for view notifications.

Flex object injection using SpringActionscript

http://www.springactionscript.org/

http://www.pranaframework.org/

Maven integration:

repository:

<repository>

<id>yoolab.org-releases</id>

<name>Yoolab.org releases repository</name>

<url>http://dev.yoolab.org/maven/content/repositories/</url&gt;

<layout>default</layout>

</repository>

dependency:

<dependency>

<groupId>org.springextensions.actionscript</groupId>

<artifactId>spring-actionscript-cairngorm</artifactId>

<version>0.8</version>

<type>swc</type>

</dependency>

<dependency>

<groupId>org.springextensions.actionscript</groupId>

<artifactId>spring-actionscript-core</artifactId>

<version>0.8</version>

<type>swc</type>

</dependency>

<dependency>

<groupId>org.as3commons</groupId>

<artifactId>as3commons-reflect</artifactId>

<version>1.0.0</version>

<type>swc</type>

</dependency>

<dependency>

<groupId>org.as3commons</groupId>

<artifactId>as3commons-lang</artifactId>

<version>1.0.0-SNAPSHOT</version>

<type>swc</type>

</dependency>

<dependency>

<groupId>org.as3commons</groupId>

<artifactId>as3commons-logging</artifactId>

<version>1.0.0</version>

<type>swc</type>

</dependency>

Cairngorm extension:

http://www.springactionscript.org/docs/reference/html/extensions-documentation.html#cairngorm

Sometimes the best way to learn about the best practices is to go through the open source code available.

The available IOC frameworks for Flex, have a look at the xode examples

http://flex-ioc-examples.googlecode.com/svn/

The source code here gives good idea to structure your code.

http://igenko.googlecode.com/svn/

About these ads

4 Responses to “Flex: Cairngorm (MVC), SpringActionscript (IOC) and other Cairngorm Extensions”

  1. lily said

    usefule. thanks.

  2. [...] Flex: Cairngorm(MVC), SpringActionSCript(IOC) and other Cairngorm Extensions Share and Enjoy: [...]

  3. Scott said

    Hello. Are you still able to use the above Maven code? I keep getting ‘resource not found’ errors.

    [INFO] Failed to resolve artifact.

    • Jai said

      Hi Scott,

      Check the maven repository entry shared in the post. If you browse it, you can see the required dependencies there.

      To use it either update your pom for repository entries or your settings.xml file.

      -HTH

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

%d bloggers like this: