<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" version="2.0">

<channel>
	<title>Christophe Herreman</title>
	
	<link>http://www.herrodius.com/blog</link>
	<description>Thoughts from a software developer</description>
	<lastBuildDate>Wed, 15 Feb 2012 21:29:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/herrodius" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="herrodius" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>GradleFX @ Belgian Flex Usergroup (live blog)</title>
		<link>http://www.herrodius.com/blog/400</link>
		<comments>http://www.herrodius.com/blog/400#comments</comments>
		<pubDate>Wed, 15 Feb 2012 16:56:55 +0000</pubDate>
		<dc:creator>Christophe</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Air]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.herrodius.com/blog/?p=400</guid>
		<description><![CDATA[Yennick Trevels is speaking about GradleFX this evening. The session starts at 19:00 CET. Check back here for updates and feel free to ask questions in the comments. Please use the #beflug hashtag when tweeting about this event. GradleFX View more presentations from Christophe Herreman. What is GradleFX From the website: &#8220;GradleFx is a Gradle [...]]]></description>
			<content:encoded><![CDATA[<p>Yennick Trevels is speaking about <a href="http://gradlefx.github.com/">GradleFX</a> this evening. The session starts at 19:00 CET. Check back here for updates and feel free to ask questions in the comments. Please use the #beflug hashtag when tweeting about this event.</p>
<div style="width:425px" id="__ss_11591786"><strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/herrodius/gradlefx" title="GradleFX">GradleFX</a></strong><object id="__sse11591786" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=gradlefx-120215115323-phpapp01&#038;stripped_title=gradlefx&#038;userName=herrodius" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><param name="wmode" value="transparent"/><embed name="__sse11591786" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=gradlefx-120215115323-phpapp01&#038;stripped_title=gradlefx&#038;userName=herrodius" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" wmode="transparent" width="425" height="355"></embed></object>
<div style="padding:5px 0 12px">View more <a href="http://www.slideshare.net/">presentations</a> from <a href="http://www.slideshare.net/herrodius">Christophe Herreman</a>.</div>
</div>
<p><strong>What is GradleFX</strong></p>
<p>From the website: &#8220;GradleFx is a Gradle plugin for building Flex and Actionscript applications. It provides a set of useful tasks that will make building your project a breeze. All the build logic is encapsulated by the plugin and all you need to do is some configuration. Because GradleFx uses the convention-over-configuration principle it has a set of sensible defaults for most configuration properties, so you only need to specify those if you want to deviate from the convention.&#8221;</p>
<p>More info: <a href="http://gradlefx.github.com/">http://gradlefx.github.com/</a></p>
<p><strong>What is Gradle</strong></p>
<p>From the website: &#8220;Gradle is build automation evolved. Gradle can automate the building, testing, publishing, deployment and more of software packages or other types of projects such as generated static websites, generated documentation or indeed anything else.</p>
<p>Gradle combines the power and flexibility of Ant with the dependency management and conventions of Maven into a more effective way to build. Powered by a Groovy DSL and packed with innovation, Gradle provides a declarative way to describe all kinds of builds through sensible defaults. Gradle is quickly becoming the build system of choice for many open source projects, leading edge enterprises and legacy automation challenges.&#8221;</p>
<p>More info: <a href="http://gradle.org/">http://gradle.org/</a></p>
<p><strong>Session notes (live)</strong></p>
<p><strong>19:20</strong> Here we go! About 15 people in the room.</p>
<p><strong>19:25</strong> Yennick explains Gradle before diving into GradleFX. Show of hands of Ant and Maven users. Most have used both. Gradle combines the best of both worlds Yennick states.</p>
<p>Gradle has built-in tasks for compiling and testing etc, but you can create your own tasks as well. Everything is written in Groovy. Gradle uses Configuration Injection instead of configuration inheritance like Maven for subprojects.</p>
<p><strong>19:30</strong> Yennick shows how to create a simple task in Gradle and how you can configure existing tasks. Executing a task: command line > &#8220;gradle {taskName}&#8221;</p>
<p><strong>19:35</strong> Example of a custom task class in Groovy. You can extend DefaultTask and provide custom task logic.</p>
<p>Default properties in the build scripts allow you to have small build scripts if you use the conventions.</p>
<p>Remote repositories can be used from Ivy and Maven repositories. You can add mavenCentral(), mavenLocal(), or a custom repository in the &#8220;repositories&#8221; section.</p>
<p><strong>19:40</strong> Gradle has a 3-phase build: initialization, configuration, execution.</p>
<p>You can use project.afterEvaluate to add extra tasks or properties after the configuration is read. This allows you to add certain tasks conditionally, e.g. add package task only if the project is an AIR application.</p>
<p>ant.java allows you to execute Ant code from Gradle. You can use ant.properties to read Ant defined properties.</p>
<p><strong>19:45</strong> Maven support in Gradle: you can locally install artifacts to your Maven repository.</p>
<p>Gradle Wrapper is a shell script that run Gradle even if you don&#8217;t have Gradle installed. You can specify the Gradle version to make sure people build your project with the correct Gradle version. Use &#8220;gradlew&#8221; to execute.</p>
<p><strong>19:50</strong> Now to GradleFX. Adds tasks to compile SWF, SWC and AIR, running unit tests and generating HTML wrappers.</p>
<p>Tasks: clean, compile, package, copyResources, publish, createHtmlWrapper, test</p>
<p><strong>19:55</strong> Setup: specify FLEX_HOME environment variable or set the flexHome convention property.</p>
<p>The GradleFX dependency is org.gradlefx.gradlefx, currently version 0.4.1</p>
<p><strong>20:00</strong> You can also generate AIR descriptor files and certificates in PKCS12 format, a password is required.</p>
<p>FlexUnit support: specify the FLEXUNIT_HOME and the FLASH_PLAYER_EXE environment variable.</p>
<p><strong>20:05</strong> Taking a short break. Demo time when we return.</p>
<p><strong>20:25</strong> Demo time.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/oz0xYtUr1b_OnyyVddVq-7uxHrs/0/da"><img src="http://feedads.g.doubleclick.net/~a/oz0xYtUr1b_OnyyVddVq-7uxHrs/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/oz0xYtUr1b_OnyyVddVq-7uxHrs/1/da"><img src="http://feedads.g.doubleclick.net/~a/oz0xYtUr1b_OnyyVddVq-7uxHrs/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/herrodius/~4/Y5U-Y2yOnaI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.herrodius.com/blog/400/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introducing AS3Commons AOP</title>
		<link>http://www.herrodius.com/blog/382</link>
		<comments>http://www.herrodius.com/blog/382#comments</comments>
		<pubDate>Thu, 15 Sep 2011 21:50:30 +0000</pubDate>
		<dc:creator>Christophe</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[AOP]]></category>
		<category><![CDATA[AS3Commons]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.herrodius.com/blog/?p=382</guid>
		<description><![CDATA[The AS3Commons AOP library offers a core API with functionality to implement Aspect Oriented Programming (AOP) concepts in your application or framework. The library uses standard API terminology so that developers who are already familiar with AOP should feel immediately comfortable. What is AOP? For those new to AOP, here is a short explanation of [...]]]></description>
			<content:encoded><![CDATA[<p>The AS3Commons AOP library offers a core API with functionality to implement Aspect Oriented Programming (AOP) concepts in your application or framework. The library uses standard API terminology so that developers who are already familiar with AOP should feel immediately comfortable.</p>
<p><strong>What is AOP?</strong></p>
<p>For those new to AOP, here is a short explanation of the general idea. (If you are already familiar with AOP concepts, you might want to skip this part and go directly to the examples).</p>
<p>The basic idea behind AOP is that an application can be broken down into functional parts that can be conditionally applied to existing code. A classic example is logging, where debug information about certain methods is written to the console in order to get runtime information about the execution of the code. One approach might be to add log statements at the beginning and the end of the methods that you would like to debug. This is quite a tedious task as you need to manually add code to several places. If you ever wanted to get rid of the log statements, you would have to remove the log statements again. With AOP, you can write the logging code in a separate class and then use that class as an Advice on the class that you want to debug. You can then easily reuse the logging code on other methods of other classes.</p>
<p><strong>Terminology</strong></p>
<ul>
<li><strong>Aspect</strong>: the general concept of a cross-cutting concern. Logging, Error Handling, Method Run-Time Monitoring are useful examples.</li>
<li><strong>Advice</strong>: an extra piece of code that needs to be applied. E.g. writing a log statement to the console.</li>
<li><strong>Pointcut</strong>: a rule about when an Advice should be applied. For instance: all public methods of a class, all methods starting with "load", all methods that take a String parameter, ...</li>
<li><strong>Advisor</strong>: the combination of an Advice and a Pointcut. This term is not general AOP vocabulary. It was introduced in the Spring AOP framework and is also used in AS3Commons AOP.</li>
<li><strong>Joinpoint</strong>: a single point in the execution of the code where Advice is applied because the rule of a Pointcut has been satisfied.</li>
</ul>
<p><strong>Types of Advice</strong></p>
<p>Advice comes in different forms, depending on what and when you want to intercept. The general types are listed below and can be applied to a Constructor, a Method or an Accessor (Getter/Setter):</p>
<ul>
<li><strong>Before</strong>: executes before the invocation</li>
<li><strong>After</strong>: executes after the invocation</li>
<li><strong>After Throwing</strong>: executes after the invocation threw an error</li>
<li><strong>After Returning</strong>: executes after normal invocation (when no error was thrown)</li>
<li><strong>Around</strong>: combines all of the above</li>
</ul>
<p>The AS3Commons AOP library contains interfaces for all of these kinds of advice. This makes it fairly easy to implement specific advice. Interceptors can also be created that give the developer more control over the invocation than the basic advice interfaces.</p>
<p><strong>How does this work?</strong></p>
<p>Applying Advice to existing code is done at run-time. For this, we create a typed-proxy (also at run-time) of a class or instance that is basically a decorator (or wrapper) around the original class or object that we created. A client then works with the proxy object instead of the original object, which is completely transparent to the caller. Calls to the proxy object are then redirected to the inner (original) object during which extra logic can be executed.</p>
<p>Note: Creating typed-proxies at run-time is made possible by the <a href="http://www.as3commons.org/as3-commons-bytecode/">AS3Commons-Bytecode</a> library.</p>
<p><strong>Example</strong></p>
<p>Consider the following MessageWriter class, which takes an optional message as a constructor argument and has a method to write the message to the console.</p>
<div class="igBar"><span id="lactionscript-8"><a href="#" onclick="javascript:showPlainTxt('actionscript-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-8">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MessageWriter <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _message:<span style="color: #0066CC;">String</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> MessageWriter<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">message</span>:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">""</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; _message = <span style="color: #0066CC;">message</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> writeMessage<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Message: '"</span> + _message + <span style="color: #ff0000;">"'"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>We can now create an advice that writes an extra message to the console whenever the writeMessage() method is called. This type of advice is "method before" advice, for which the IMethodBeforeAdvice interface can be implemented.</p>
<div class="igBar"><span id="lactionscript-9"><a href="#" onclick="javascript:showPlainTxt('actionscript-9'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-9">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MethodTracerAdvice <span style="color: #0066CC;">implements</span> IMethodBeforeAdvice <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> MethodTracer<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> beforeMethod<span style="color: #66cc66;">&#40;</span>method:Method, args:<span style="color: #0066CC;">Array</span>, <span style="color: #0066CC;">target</span>:*<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"* before '"</span> + method.<span style="color: #0066CC;">name</span> + <span style="color: #ff0000;">"'"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>We can now create a simple application where a proxy is created for the MessageWriter class and the MethodTracerAdvice is applied.</p>
<div class="igBar"><span id="lactionscript-10"><a href="#" onclick="javascript:showPlainTxt('actionscript-10'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-10">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> factory:AOPProxyFactory = <span style="color: #000000; font-weight: bold;">new</span> AOPProxyFactory<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">factory.<span style="color: #0066CC;">target</span> = MessageWriter;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">factory.<span style="color: #006600;">addAdvice</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> MethodTracerAdvice<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> handler:<span style="color: #000000; font-weight: bold;">Function</span> = <span style="color: #000000; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>event:OperationEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">var</span> messageWriter:MessageWriter = factory.<span style="color: #006600;">getProxy</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">"Hello World!"</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; messageWriter.<span style="color: #006600;">writeMessage</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> operation:IOperation = factory.<span style="color: #0066CC;">load</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">operation.<span style="color: #006600;">addCompleteListener</span><span style="color: #66cc66;">&#40;</span>handler<span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The console output would be as follows:</p>
<div class="igBar"><span id="lactionscript-11"><a href="#" onclick="javascript:showPlainTxt('actionscript-11'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-11">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">* before <span style="color: #ff0000;">'writeMessage'</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">Message</span>: <span style="color: #ff0000;">'Hello World!'</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Notice the following things:</p>
<ul>
<li>The target of the AOPProxyFactory is a class. For now, only classes can be proxied but it will also be possible to proxy existing instances.</li>
<li>The MethodTracerAdvice class implements the IMethodBeforeAdvice interface. This allows the framework to know when the advice must be executed, namely before the method invocation.</li>
<li>There is an asynchronous step in loading the proxy factory, after which the proxy can be requested. If you want to create proxies for more classes, consider using the AOPBatchProxyFactory instead. Note that even with the AOPProxyFactory, you can get multiple instances of a proxy.</li>
<li>You can pass constructor arguments to the proxy factory that will be used when creating the proxy. Although not shown in this example, it is possible to intercept and change the constructor arguments using an IConstructorBeforeAdvice.</li>
</ul>
<p><strong>Example with Pointcut</strong></p>
<p>The previous example applies the "method before" advice on every method call. If we would add another method to the MessageWriter class, say "writeAnotherMessage", then the advice would also be invoked on that method. To control when this advice is applied, we can specify a Pointcut that will instruct the framework about when to apply the advice.</p>
<p>Here is the modified MessageWriter class and example.</p>
<div class="igBar"><span id="lactionscript-12"><a href="#" onclick="javascript:showPlainTxt('actionscript-12'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-12">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MessageWriter <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _message:<span style="color: #0066CC;">String</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> MessageWriter<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">message</span>:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">""</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; _message = <span style="color: #0066CC;">message</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> writeMessage<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Message: '"</span> + _message + <span style="color: #ff0000;">"'"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> writeAnotherMessage<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Message: 'Konnichiwa!'"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<div class="igBar"><span id="lactionscript-13"><a href="#" onclick="javascript:showPlainTxt('actionscript-13'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-13">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> factory:AOPProxyFactory = <span style="color: #000000; font-weight: bold;">new</span> AOPProxyFactory<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> pointcut:IPointcut = <span style="color: #000000; font-weight: bold;">new</span> MethodNameMatchPointcut<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"writeMessage"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> advice:IAdvice = <span style="color: #000000; font-weight: bold;">new</span> MethodTracerAdvice<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">factory.<span style="color: #006600;">addAdvisor</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> PointcutAdvisor<span style="color: #66cc66;">&#40;</span>pointcut, advice<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">factory.<span style="color: #0066CC;">target</span> = MessageWriter;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> handler:<span style="color: #000000; font-weight: bold;">Function</span> = <span style="color: #000000; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>event:OperationEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">var</span> messageWriter:MessageWriter = factory.<span style="color: #006600;">getProxy</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">"Hello World!"</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; messageWriter.<span style="color: #006600;">writeMessage</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; messageWriter.<span style="color: #006600;">writeAnotherMessage</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> operation:IOperation = factory.<span style="color: #0066CC;">load</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">operation.<span style="color: #006600;">addCompleteListener</span><span style="color: #66cc66;">&#40;</span>handler<span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The console output would now be as follows:</p>
<div class="igBar"><span id="lactionscript-14"><a href="#" onclick="javascript:showPlainTxt('actionscript-14'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-14">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">* before <span style="color: #ff0000;">'writeMessage'</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">Message</span>: <span style="color: #ff0000;">'Hello World!'</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">Message</span>: <span style="color: #ff0000;">'Konnichiwa!'</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Notice the following:</p>
<ul>
<li>A Pointcut is defined to specify that advice should only be applied if the method name is "writeMessage"</li>
<li>The Advice and Pointcut are defined separately and then combined with a PointcutAdvisor. This allows us to reuse Pointcuts and Advice in other scenarios.</li>
</ul>
<p><strong>Other Types of Advice</strong></p>
<p>The examples shown above only show IMethodBeforeAdvice, but there are a lot more advice interfaces that you can use. As mentioned earlier you can also intercept after invocation. This is not limited to method invocations, but you can also do this for Constructors, Getter and Setters. (Note that there are still some glitches in the alpha code concerning these types of advice.)</p>
<p><strong>Conclusion</strong></p>
<p>The current code is not production ready, but is certainly worth a look if you are interested in using AOP in your application or framework. We will release a first alpha release in the coming days with some samples and documentation. You can already check out the code at the <a href="http://as3-commons.googlecode.com/svn/trunk/as3-commons-aop/">AS3Commons Google Code</a> site.</p>
<p>It is still early in the development so the API might change a bit before the official 1.0 release. If you have any ideas or comments about certain implementations, we're always eager to hear from you.</p>
<p>Some of the things on the roadmap that should make it into the release:</p>
<ul>
<li>AspectJ expression language for pointcuts</li>
<li>Composite Pointcuts</li>
<li>Proxying of existing object instances</li>
</ul>
<p>Looking forward to hearing your thoughts and enjoy coding!</p>

<p><a href="http://feedads.g.doubleclick.net/~a/gJoGs1eZdmSoHcg-rZ565A61buo/0/da"><img src="http://feedads.g.doubleclick.net/~a/gJoGs1eZdmSoHcg-rZ565A61buo/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/gJoGs1eZdmSoHcg-rZ565A61buo/1/da"><img src="http://feedads.g.doubleclick.net/~a/gJoGs1eZdmSoHcg-rZ565A61buo/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/herrodius/~4/bhB_EXOPoiI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.herrodius.com/blog/382/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Programmaticaly sorting a column in an AdvancedDataGrid</title>
		<link>http://www.herrodius.com/blog/374</link>
		<comments>http://www.herrodius.com/blog/374#comments</comments>
		<pubDate>Mon, 14 Feb 2011 13:08:26 +0000</pubDate>
		<dc:creator>Christophe</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[tips 'n tricks]]></category>

		<guid isPermaLink="false">http://www.herrodius.com/blog/?p=374</guid>
		<description><![CDATA[Here's a quick tip: If you want to sort a column of an AdvancedDataGrid, without having to set up a sort on the dataprovider, you can dispatch an AdvancedDataGridEvent of type AdvancedDataGridEvent.SORT from the datagrid. This can be useful if you have a custom sort function on a datagrid column and you want the datagrid [...]]]></description>
			<content:encoded><![CDATA[<p>Here's a quick tip: If you want to sort a column of an AdvancedDataGrid, without having to set up a sort on the dataprovider, you can dispatch an AdvancedDataGridEvent of type AdvancedDataGridEvent.SORT from the datagrid.</p>
<p>This can be useful if you have a custom sort function on a datagrid column and you want the datagrid to be sorted initially without requiring the user to click the column header.</p>
<div class="igBar"><span id="lactionscript-16"><a href="#" onclick="javascript:showPlainTxt('actionscript-16'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-16">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> sortEvent:AdvancedDataGridEvent = <span style="color: #000000; font-weight: bold;">new</span> AdvancedDataGridEvent<span style="color: #66cc66;">&#40;</span>AdvancedDataGridEvent.<span style="color: #0066CC;">SORT</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sortEvent.<span style="color: #006600;">columnIndex</span> = <span style="color: #cc66cc;color:#800000;">0</span>; <span style="color: #808080; font-style: italic;">// first column</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">dataGrid.<span style="color: #006600;">dispatchEvent</span><span style="color: #66cc66;">&#40;</span>sortEvent<span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>

<p><a href="http://feedads.g.doubleclick.net/~a/gOYJQZjahKXJBb6UKYlqSZQjjJ8/0/da"><img src="http://feedads.g.doubleclick.net/~a/gOYJQZjahKXJBb6UKYlqSZQjjJ8/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/gOYJQZjahKXJBb6UKYlqSZQjjJ8/1/da"><img src="http://feedads.g.doubleclick.net/~a/gOYJQZjahKXJBb6UKYlqSZQjjJ8/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/herrodius/~4/ChT_sIPW5UA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.herrodius.com/blog/374/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Spring ActionScript 1.1 Released</title>
		<link>http://www.herrodius.com/blog/368</link>
		<comments>http://www.herrodius.com/blog/368#comments</comments>
		<pubDate>Thu, 28 Oct 2010 20:20:09 +0000</pubDate>
		<dc:creator>Christophe</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Air]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Inversion of Control]]></category>
		<category><![CDATA[Spring ActionScript]]></category>

		<guid isPermaLink="false">http://www.herrodius.com/blog/?p=368</guid>
		<description><![CDATA[Dear community, We're pleased to announce that Spring ActionScript 1.1 is now available. Download&#160;&#124;&#160;API Documentation&#160;&#124;&#160;HTML Docs&#160;&#124;&#160;Changelog Besides a series of bugfixes, this release adds the following new features and enhancements: Component Scanning &#038; Context XML Namespace Just like XML and MXML configuration, component scanning is a way to configure objects to be used in the [...]]]></description>
			<content:encoded><![CDATA[<p>Dear community,</p>
<p>We're pleased to announce that Spring ActionScript 1.1 is now available.</p>
<p align='center'><a href="http://www.springactionscript.org/downloads/spring-actionscript-1.1-distribution-with-dependencies.zip">Download</a>&nbsp;|&nbsp;<a href="http://www.springactionscript.org/asdoc/index.html">API Documentation</a>&nbsp;|&nbsp;<a href="http://www.springactionscript.org/docs/reference/html/springactionscript.html">HTML Docs</a>&nbsp;|&nbsp;<a href="http://www.springactionscript.org/changes-report.html">Changelog</a></p>
<p>Besides a series of bugfixes, this release adds the following new features and enhancements:</p>
<p><b>Component Scanning &#038; Context XML Namespace</b></p>
<p>Just like XML and MXML configuration, component scanning is a way to configure objects to be used in the application context. This is done by adding [Component] metadata to classes that you want to expose as objects to the container. The container will then scan all classes or the classes in a package you specify and create object definitions for the classes that have Component metadata. This means that you can configure your application with a minimum of XML or MXML configuration.</p>
<p>The newly added "context" namespace currently contains a "component-scan" and a "metadata-config" element. The first one enables component scanning as described above. The "metadata-config" registers common metadata processors and reduces the configuration needed to use these processors.</p>
<div class="igBar"><span id="lxml-18"><a href="#" onclick="javascript:showPlainTxt('xml-18'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">XML:</span>
<div id="xml-18">
<div class="xml">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;context</span>:component-scan<span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;context</span>:metadata-config<span style="font-weight: bold; color: black;">/&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>For more info, see the documentation: <a href="http://www.springactionscript.org/docs/reference/html/the_component_scanner.html">Component Scanning</a></p>
<p><b>Test Framework</b></p>
<p>The Spring ActionScript integration testing support framework provides several abstract support classes that can simplify writing integration tests. These base test classes provide well defined hooks into the testing framework. Currently, only FlexUnit 4 is supported.</p>
<p>More info can be found in the <a href="http://www.springactionscript.org/docs/reference/html/the_testing_api.html">Test Framework</a> section of the documentation.</p>
<p><b>PostConstruct, PreDestroy and Inject Metadata</b></p>
<p>To be in line with industry standards, we added support for the PostConstruct, PreDestroy and Inject metadata.</p>
<p>PostConstruct and PreDestroy are annotations that allow you to call methods in a specific phase in the lifecycle of a component. The Inject metadata is used as an alias for the Autowired metadata.</p>
<p><strong>More Information</strong></p>
<p>For more general information on the Spring ActionScript framework, please see the following links:</p>
<ul>
<li><a href="http://www.springactionscript.org/">Spring ActionScript Homepage</a></li>
<li><a href="http://www.springactionscript.org/docs/reference/html/springactionscript.html">Reference Documentation</a></li>
<li><a href="http://www.springactionscript.org/asdoc/index.html">API Documentation</a></li>
<li><a href="http://www.springactionscript.org/samples.html">Sample Applications</a></li>
<li><a href="http://forum.springsource.org/forumdisplay.php?f=60">User Forum</a></li>
<li><a href="https://jira.springframework.org/browse/SESPRINGACTIONSCRIPTAS">Jira</a></li>
</ul>
<p>Enjoy this release and have fun coding!</p>

<p><a href="http://feedads.g.doubleclick.net/~a/gadYvprxloS_L2m_tDWIDrRc0MU/0/da"><img src="http://feedads.g.doubleclick.net/~a/gadYvprxloS_L2m_tDWIDrRc0MU/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/gadYvprxloS_L2m_tDWIDrRc0MU/1/da"><img src="http://feedads.g.doubleclick.net/~a/gadYvprxloS_L2m_tDWIDrRc0MU/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/herrodius/~4/Vz4OnPcrIs8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.herrodius.com/blog/368/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Spring ActionScript 1.0 Released</title>
		<link>http://www.herrodius.com/blog/350</link>
		<comments>http://www.herrodius.com/blog/350#comments</comments>
		<pubDate>Mon, 13 Sep 2010 06:30:21 +0000</pubDate>
		<dc:creator>Christophe</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Inversion of Control]]></category>
		<category><![CDATA[Spring ActionScript]]></category>

		<guid isPermaLink="false">http://www.herrodius.com/blog/?p=350</guid>
		<description><![CDATA[Dear community, We're pleased to announce that Spring ActionScript 1.0 is now available. Download&#160;&#124;&#160;API Documentation&#160;&#124;&#160;HTML Docs&#160;&#124;&#160;Changelog Spring ActionScript is an offshoot of the Java Spring Framework written in ActionScript 3.0. The framework contains the following core features: Inversion of Control container, configurable with XML or MXML EventBus supporting loose communication between application components Metadata/annotation processing [...]]]></description>
			<content:encoded><![CDATA[<p>Dear community,</p>
<p>We're pleased to announce that Spring ActionScript 1.0 is now available.</p>
<p align='center'><a href="http://www.springactionscript.org/downloads/spring-actionscript-1.0-distribution-with-dependencies.zip">Download</a>&nbsp;|&nbsp;<a href="http://www.springactionscript.org/asdoc/index.html">API Documentation</a>&nbsp;|&nbsp;<a href="http://www.springactionscript.org/docs/reference/html/springactionscript.html">HTML Docs</a>&nbsp;|&nbsp;<a href="http://www.springactionscript.org/changes-report.html">Changelog</a></p>
<p>Spring ActionScript is an offshoot of the Java Spring Framework written in ActionScript 3.0. The framework contains the following core features:</p>
<ul>
<li>Inversion of Control container, configurable with <a href="http://www.springactionscript.org/docs/reference/html/container-documentation.html#the_container">XML</a> or <a href="http://www.springactionscript.org/docs/reference/html/container-documentation.html#composing_mxml_based_configuration_metadata">MXML</a></li>
<li><a href="http://www.springactionscript.org/docs/reference/html/the_eventbus.html">EventBus</a> supporting loose communication between application components</li>
<li>Metadata/annotation processing used for autowiring, event handling, ...</li>
<li><a href="http://www.springactionscript.org/docs/reference/html/the_operation_api.html">Operation</a>, <a href="http://www.springactionscript.org/docs/reference/html/the_operation_api.html#commands">Command</a> and <a href="http://www.springactionscript.org/docs/reference/html/the_operation_api.html#tasks">Task</a> API</li>
<li>Utilities for abstracting server communication</li>
<li>Support for Modules</li>
<li>Extensions for the Cairngorm and PureMVC frameworks</li>
</ul>
<p>The Spring Actionscript team would like to take this opportunity to thank everyone who took the time to report bugs, give suggestions and help out in any other kind of way. Without the dedicated Spring community behind us, the framework would not be where it is today. Thank all of you!</p>
<p>We would also like to thank the nice folks at SpringSource and especially Jeremy Grelle, our project sponsor, and Russel Miles, the Spring Extensions lead. Thanks guys for the support and the opportunity that you gave us.</p>
<p>As always, we're on the look out for new members to join the team. If you are willing to invest some of your spare time to write documentation, sample applications, fix bugs or develop new functionality then please don't hesitate to get in touch with us!</p>
<p>For the full list of changes please check the <a href="http://www.springactionscript.org/changes-report.html#a1.0">changelog</a>. If you have any suggestions for new functionality or improvements to the existing code base, then please use JIRA to submit a feature request.</p>
<p><strong>More Information</strong></p>
<p>For more information on the Spring ActionScript framework, please see the following links:</p>
<ul>
<li><a href="http://www.springactionscript.org/">Spring ActionScript Homepage</a></li>
<li><a href="http://www.springactionscript.org/docs/reference/html/springactionscript.html">Reference Documentation</a></li>
<li><a href="http://www.springactionscript.org/asdoc/index.html">API Documentation</a></li>
<li><a href="http://www.springactionscript.org/samples.html">Sample Applications</a></li>
<li><a href="http://forum.springsource.org/forumdisplay.php?f=60">User Forum</a></li>
<li><a href="https://jira.springframework.org/browse/SESPRINGACTIONSCRIPTAS">Jira</a></li>
</ul>
<p>Enjoy this release and have fun coding!</p>

<p><a href="http://feedads.g.doubleclick.net/~a/OS17S7-eujvpV26PUZ_hfHkx4us/0/da"><img src="http://feedads.g.doubleclick.net/~a/OS17S7-eujvpV26PUZ_hfHkx4us/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/OS17S7-eujvpV26PUZ_hfHkx4us/1/da"><img src="http://feedads.g.doubleclick.net/~a/OS17S7-eujvpV26PUZ_hfHkx4us/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/herrodius/~4/gz8ysnRkNFE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.herrodius.com/blog/350/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Speaking at the Flex on Java eXchange in London</title>
		<link>http://www.herrodius.com/blog/344</link>
		<comments>http://www.herrodius.com/blog/344#comments</comments>
		<pubDate>Thu, 10 Jun 2010 19:06:03 +0000</pubDate>
		<dc:creator>Christophe</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Air]]></category>
		<category><![CDATA[Conferences]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Spring ActionScript]]></category>
		<category><![CDATA[Talks]]></category>

		<guid isPermaLink="false">http://www.herrodius.com/blog/?p=344</guid>
		<description><![CDATA[I'll be speaking at the first Flex on Java eXchange in London on June 16th. My talk will be an introduction to the Spring ActionScript framework, along with other presentations on Flex and Java connectivity and enterprise Flex development. From the Skills Matter website: Skills Matter is pleased to organise the first Flex on Java [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.herrodius.com/blog/wp-content/uploads/2010/06/flex-on-java-exchange_670x180.gif"><img src="http://www.herrodius.com/blog/wp-content/uploads/2010/06/flex-on-java-exchange_670x180.gif" alt="" title="flex-on-java-exchange_670x180" width="670" height="180" class="aligncenter size-full wp-image-347" /></a></p>
<p>I'll be speaking at the first Flex on Java eXchange in London on June 16th. My talk will be an introduction to the Spring ActionScript framework, along with other presentations on Flex and Java connectivity and enterprise Flex development.</p>
<p>From the Skills Matter website:</p>
<blockquote><p>Skills Matter is pleased to organise the first Flex on Java eXchange. This Annual Flex and Java conference brings together the leading experts on RIA, Flex, Java, Spring and Grails with London's JEE and web development community, for an informal day of deep technical insight and friendly discussion.</p>
<p>Come learn about Java and Flex integration technologies, MVC frameworks, tools, plugins, best practices and innovative ideas from the creators of those technologies and from the industry's innovators. </p></blockquote>
<p>In case you're in the neighborhood, be sure to join!</p>
<p>More info: <a href="http://skillsmatter.com/event/java-jee/flex-on-java-exchange-2010">http://skillsmatter.com/event/java-jee/flex-on-java-exchange-2010</a></p>

<p><a href="http://feedads.g.doubleclick.net/~a/hi7kS6f55E0En8aPS1G1qHY7fgI/0/da"><img src="http://feedads.g.doubleclick.net/~a/hi7kS6f55E0En8aPS1G1qHY7fgI/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/hi7kS6f55E0En8aPS1G1qHY7fgI/1/da"><img src="http://feedads.g.doubleclick.net/~a/hi7kS6f55E0En8aPS1G1qHY7fgI/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/herrodius/~4/zcSMYDEsRJo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.herrodius.com/blog/344/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Join us at the AUG RIA event</title>
		<link>http://www.herrodius.com/blog/334</link>
		<comments>http://www.herrodius.com/blog/334#comments</comments>
		<pubDate>Wed, 28 Apr 2010 11:32:39 +0000</pubDate>
		<dc:creator>Christophe</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Air]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Adobe]]></category>

		<guid isPermaLink="false">http://www.herrodius.com/blog/?p=334</guid>
		<description><![CDATA[Just a quick note to inform you about the Adobe Usergroup RIA event that is happening Thursday, April 29th in Brussels. Besides some interesting presentations there will also be a panel discussion on Flex frameworks in which I will participate. Adobe LiveCycle ES2 Mosaic Marc Meewis, Adobe Marc will talk about Mosaic, one of the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.herrodius.com/blog/wp-content/uploads/2010/04/aug_logo.jpg"><img src="http://www.herrodius.com/blog/wp-content/uploads/2010/04/aug_logo-300x106.jpg" alt="" title="aug_logo" width="300" height="106" class="alignleft size-medium wp-image-339" /></a>Just a quick note to inform you about the Adobe Usergroup RIA event that is happening Thursday, April 29th in Brussels.</p>
<p>Besides some interesting presentations there will also be a panel discussion on Flex frameworks in which I will participate.</p>
<p><strong>Adobe LiveCycle ES2 Mosaic</strong><br />
Marc Meewis, Adobe<br />
Marc will talk about Mosaic, one of the new products in LiveCycle ES2 for creating contextual workspaces using Flex and AIR.<br />
<a href="http://www.adobe.com/products/livecycle/mosaic/">http://www.adobe.com/products/livecycle/mosaic/</a></p>
<p><strong>Interaction Design</strong><br />
Namahn<br />
Namahn is a Human-Centered Design consultancy agency from Brussels and will talk about the methods and techniques they use when Designing for user interaction.<br />
<a href="http://www.namahn.be/">http://www.namahn.be/</a></p>
<p><strong>Workflow</strong><br />
Paul Reijnierse, De Monsters<br />
The Monsters from Amsterdam are Interaction Designers and Paul will talk about how they work and the products they develop.<br />
<a href="http://www.demonsters.com/">http://www.demonsters.com/</a></p>
<p><strong>Flex Frameworks Panel Discussion</strong><br />
Christophe Herreman, Roland Zwaga, Steven Peeters, Ferdi Koomen, Jan Van Coppenolle, …<br />
It’s quite a jungle out there if you need to pick a reliable framework for large Flex applications. This panel of community members will discuss architecture, best practices and the tools they use in their everyday projects.</p>
<p>Doors open at 17:30, sessions start at 18:00.</p>
<p>Date: don, 29/04/2010 - 17:30<br />
Location: Hogeschool Universiteit Campus Stormstraat - Stormstraat 2, 1000 Brussel</p>
<p>For more info and reservations see <a href="http://www.adobeusergroup.be/events/ria-sig-event">http://www.adobeusergroup.be/events/ria-sig-event</a></p>

<p><a href="http://feedads.g.doubleclick.net/~a/IAcAPH471QJMJUlpvqoSmTVsUX8/0/da"><img src="http://feedads.g.doubleclick.net/~a/IAcAPH471QJMJUlpvqoSmTVsUX8/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/IAcAPH471QJMJUlpvqoSmTVsUX8/1/da"><img src="http://feedads.g.doubleclick.net/~a/IAcAPH471QJMJUlpvqoSmTVsUX8/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/herrodius/~4/c14TWZoNRyA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.herrodius.com/blog/334/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Spring ActionScript: Café Townsend sample application</title>
		<link>http://www.herrodius.com/blog/307</link>
		<comments>http://www.herrodius.com/blog/307#comments</comments>
		<pubDate>Sun, 07 Mar 2010 14:42:59 +0000</pubDate>
		<dc:creator>Christophe</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Air]]></category>
		<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[Domain-Driven Design]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flash Builder]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Flex Builder]]></category>
		<category><![CDATA[Inversion of Control]]></category>
		<category><![CDATA[Spring ActionScript]]></category>

		<guid isPermaLink="false">http://www.herrodius.com/blog/?p=307</guid>
		<description><![CDATA[A new Spring ActionScript sample application is now available. This is the Café Townsend application, originally created as a sample application for the Cairngorm framework, that we ported to Spring ActionScript. This should make it easier to compare this implementation with the implementations of some of the other frameworks. Open the Café Townsend sample. (Be [...]]]></description>
			<content:encoded><![CDATA[<p>A new Spring ActionScript sample application is now available. This is the Café Townsend application, originally created as a sample application for the Cairngorm framework, that we ported to Spring ActionScript. This should make it easier to compare this implementation with the implementations of some of the other frameworks.</p>
<p><a href="http://www.herrodius.com/examples/cafe-townsend/" target="new">Open the Café Townsend sample.</a><br />
(Be sure to check the source by right-clicking and choosing "View Source" from the context menu, click <a href="http://www.herrodius.com/examples/cafe-townsend/srcview/index.html" target="new">here</a> to go to the source directly.)</p>
<p><a href="http://www.herrodius.com/examples/cafe-townsend/cafe-townsend.zip">Download the Flex/Flash Builder project and sources.</a></p>
<p><strong>Discussion</strong></p>
<p>In what follows, we will discuss the implementation details and motivate certain choices made in this design.</p>
<p><strong>Package Structure</strong></p>
<p>The first thing you might notice is the package structure, that might seem a bit odd at first since it is different from what most frameworks use or prescribe. This example follows the Layered Architecture, described by Eric Evans in the book <a href="https://www.amazon.com/dp/0321125215?tag=christherrem-20&#038;camp=0&#038;creative=0&#038;linkCode=as1&#038;creativeASIN=0321125215&#038;adid=1BZQW3KXDC2XEGJEWAYC&#038;">Domain-Driven Design: Tackling Complexity in the Heart of Software</a> (recommended reading). This architecture makes it easy to detect and apply the different layers of the application and forces us somewhat to have a clean separation of the responsibilities of each layer.</p>
<p>The layered architecture consists of four layers, as shown on the image below:</p>
<p><img src="http://www.herrodius.com/blog/wp-content/uploads/2010/03/LayeredArchitecture.png" alt="" title="LayeredArchitecture" width="320" height="293" class="aligncenter size-full wp-image-312" /></p>
<ul>
<li><strong>Presentation Layer</strong>: contains the user interface (the view component and in this example the presentation models)</li>
<li><strong>Application Layer</strong>: coordinates the application and forms a communication channel between the UI and the domain</li>
<li><strong>Domain Layer</strong>: the core of the software. This layer defines the entities and repositories/services that form the business logic of the application. For the most part only the interfaces for the services will be written here. This layer does not contain any implementation details.</li>
<li><strong>Infrastructure Layer</strong>: provides implementation details for all other layers. Concrete implementations of services will be put here.</li>
</ul>
<p>Note that it is certainly not needed to structure your application like this. Spring ActionScript does not impose or prescribe this structure, but we certainly think it is useful and wanted to introduce it in this example. Also note that while we have applied this architecture as packages in the same application, you might want to create different swc's or libraries for each of these layers so that they can easily be reused.</p>
<p><strong>Presentation Layer &#038; Presentation Models</strong></p>
<p>This example uses the Presentation Model (PM) as the main presentation pattern for the UI layer. The PM allows us to extract all state and controller logic for the view into a separate class that is view agnostic. A view component contains a reference to its corresponding PM and delegates all UI actions to it. The view component can either instantiate the PM directly, or it can be given one, either by a parent component or by having it "injected" by the Spring ActionScript framework. The process of automatically injecting properties into a (view) component is known as "Autowiring" in Spring ActionScript. Note that since the PM is not a UI component and does not know anything about the view, it can be easily unit tested.</p>
<p>An example of autowiring can be found in the EmployeeLogin.mxml class:</p>
<div class="igBar"><span id="lactionscript-23"><a href="#" onclick="javascript:showPlainTxt('actionscript-23'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-23">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#91;</span>Autowired<span style="color: #66cc66;">&#93;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> presentationModel:EmployeeLoginPresentationModel; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The PMs used in this example will either delegate directly to the business logic (for instance for loading the employees) or will delegate to the Application Layer (for instance for logging the user out of the application). Here again, there is no strict rule to follow, but you can decide for your own what approach seems the bests.</p>
<p>Note that autowiring is disabled by default. This is because in bigger applications, there might be a significant performance hit when autowiring is used. It is adviced to finetune the autowiring by configuring the autowire processor to include or exclude certain classes. To enable autowiring, simply add the following to the XML configuration:</p>
<div class="igBar"><span id="lxml-24"><a href="#" onclick="javascript:showPlainTxt('xml-24'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">XML:</span>
<div id="xml-24">
<div class="xml">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;object</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"autowiringStageProcessor"</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"org.springextensions.actionscript.stage.DefaultAutowiringStageProcessor"</span><span style="font-weight: bold; color: black;">/&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>Application Layer</strong></p>
<p>In some cases, the UI will delegate responsibilities to the Application Layer. Since the UI does not know about this layer, it needs a loosely coupled way of communicating with it. The communication channel that provides this capability in Spring ActionScript is the EventBus. It is implemented on top of Flash's event dispatching capability and forms a centralized medium for component and layer interaction.</p>
<p>In the example, the code behind the Logout button will dispatch an event via the EventBus. The application controller listens for this event and will handle it by invoking the logout method on the authentication service. Notice that the application controller takes the authentication service as a constructor argument and that the service is typed to the interface IAuthenticationService. The actual instance is provided in the (XML) configuration, were both the application controller and the authentication service and defined and linked to eachother.</p>
<p>Notice that the application controller does not explicitely listen for the logout event. Instead, it is sufficient to create a method and annotate it with the <strong>[EventHandler]</strong> metadata. Spring ActionScript will then introspect the controller, pick up all annotated methods and link them automatically with the event received from the EventBus.</p>
<p>Here's what the logout method looks like in the application controller:</p>
<div class="igBar"><span id="lactionscript-25"><a href="#" onclick="javascript:showPlainTxt('actionscript-25'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-25">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#91;</span>EventHandler<span style="color: #66cc66;">&#93;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> logout<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">var</span> operation:IOperation = _authenticationService.<span style="color: #006600;">logout</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; operation.<span style="color: #006600;">addCompleteListener</span><span style="color: #66cc66;">&#40;</span>logout_completeHandler<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Notice that the name of the logout method corresponds to the event being dispatched, namely "logout" (see the ApplicationEvents class for that). You can however also choose the name of this method as you like and specify the name of the event as an attribute of the EventHandler metadata.</p>
<p>As with autowiring, the processing of the EventHandler metadata is not enabled by default. If you want to use this in your application, simply add the following to the XML configuration:</p>
<div class="igBar"><span id="lxml-26"><a href="#" onclick="javascript:showPlainTxt('xml-26'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">XML:</span>
<div id="xml-26">
<div class="xml">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;object</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"eventHandlerProcessor"</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"org.springextensions.actionscript.ioc.factory.config.EventHandlerMetaDataPostProcessor"</span><span style="font-weight: bold; color: black;">/&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>For more information on the EventBus, please refer to the <a href="http://www.springactionscript.org/docs/reference/html/the_eventbus.html">documentation</a>.</p>
<p><strong>Domain Layer</strong></p>
<p>The domain for this application is extremely simple. All it contains is an Employee entity and an employee service in the form of the IEmployeeService. Except for the actual entities of the domain, this layer does not contain any implementation details for the services it provides, but merely defines the interfaces for those services.</p>
<p><strong>Infrastructure Layer</strong></p>
<p>The infrastructure layer is where the technical details of the applications live. This layer provides the actual implementation of the services found in the other layers. Depending on the different contexts the application needs to be able to run in, you might provide different implementations of the services here. The implementations used in the application can then be defined the a Spring ActionScript Application Context. As an example, think of an application that needs to be able to connect to a set of services using Remote Objects in one scenario and needs to connect to a set of Webservices in another scenario. If we provide both implementations, we can easily reconfigure the application by changing the XML configuration of the application context.</p>
<p><strong>Application Context</strong></p>
<p>Once we have all components, we can bundle them together and prepare them to be used in the application. By doing this, we are configuring the <strong>context</strong> of the application. In Spring ActionScript this is done by instantiating a FlexXMLApplicationContext (in case you are working with Flex).</p>
<p>The application context in this example is configured using XML, but it could just as easily be configured using an MXML configuration. Both approaches have there pros and cons and you should decide what fits best for you project.</p>
<p>Looking at the Main.mxml class, which is the entry point of the application, we can see that a FlexXMLApplicationContext is instantiated and given the path to the external XML file (application-context.xml) that forms the application context's configuration. Now all we need to do is wait for the context to load before starting the application.</p>
<p><strong>Conclusion</strong></p>
<p>This example contains significantly less code than the original Cairngorm version. This is mainly because Spring ActionScript does not impose any strict architectural rules and provides the developer with plenty of choice for architecting things that best fit the application being developed. What might work in application A might not necessarily work well for application B or C. Being given so much freedom and choice might feel awkward at first, but you will notice that this is actual a good thing and you will benefit greatly from it.</p>
<p>If you have any remarks on this post, please leave them in comments or contact me. Whether they are errors, things that are unclear, or general questions... all feedback is welcome.</p>
<p>General information and document about Spring ActionScript can be found at <a href="http://www.springactionscript.org/">http://www.springactionscript.org/</a></p>
<p>Related articles:</p>
<ul>
<li><a href="http://www.herrodius.com/blog/284">The Operation API</a></li>
<li><a href="http://www.herrodius.com/blog/273">Spring ActionScript 1.0 RC1 Released</a></li>
<li><a href="http://www.herrodius.com/blog/255">Spring ActionScript Devoxx slides</a></li>
</ul>

<p><a href="http://feedads.g.doubleclick.net/~a/Rq0XXMBt6LeqWT8oRTaqqsMLikg/0/da"><img src="http://feedads.g.doubleclick.net/~a/Rq0XXMBt6LeqWT8oRTaqqsMLikg/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/Rq0XXMBt6LeqWT8oRTaqqsMLikg/1/da"><img src="http://feedads.g.doubleclick.net/~a/Rq0XXMBt6LeqWT8oRTaqqsMLikg/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/herrodius/~4/yKTQfCstIZQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.herrodius.com/blog/307/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Spring ActionScript: The Operation API</title>
		<link>http://www.herrodius.com/blog/284</link>
		<comments>http://www.herrodius.com/blog/284#comments</comments>
		<pubDate>Thu, 04 Mar 2010 20:39:50 +0000</pubDate>
		<dc:creator>Christophe</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Air]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Spring ActionScript]]></category>

		<guid isPermaLink="false">http://www.herrodius.com/blog/?p=284</guid>
		<description><![CDATA[Introduction As Flex and Flash developers, we are used to working with asynchronous code. Whenever we load data from a server for instance, we need to wait for the result to come back as we can't just read the result of such a call directly. The way in which we wait for these asynchronous calls [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Introduction</strong></p>
<p>As Flex and Flash developers, we are used to working with asynchronous code. Whenever we load data from a server for instance, we need to wait for the result to come back as we can't just read the result of such a call directly. The way in which we wait for these asynchronous calls to complete differs from API to API. There are events, async tokens, callback functions, ... The fact that there is no unified approach to this, is a core problem in our opinion of Flash. It is not only confusing to developers, but it also prevents us from easily integrating these various techniques and abstracting away their details.</p>
<p>Consider a service that manages User objects by providing basic operations on these entities like create, read, update and delete (CRUD). If you plan on creating an interface for this user service so you can vary the implementation easily, what return type would the methods have?</p>
<div class="igBar"><span id="lactionscript-35"><a href="#" onclick="javascript:showPlainTxt('actionscript-35'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-35">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">public</span> <span style="color: #0066CC;">interface</span> IUserService <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">function</span> addUser<span style="color: #66cc66;">&#40;</span>user:User<span style="color: #66cc66;">&#41;</span>: ? ;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">function</span> deleteUser<span style="color: #66cc66;">&#40;</span>user:User<span style="color: #66cc66;">&#41;</span>: ? ;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">function</span> saveUser<span style="color: #66cc66;">&#40;</span>user:User<span style="color: #66cc66;">&#41;</span>: ? ;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">function</span> loadAllUsers<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>: ? ;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>We could either:</p>
<ul>
<li>return nothing and wait for events to be dispatched by the service when its methods have executed: this has the disadvantage that there is no real contract on the method.</li>
<li>return nothing and pass in a Responder or result and fault handler callback functions: this has the disadvantage that it blurs the signature of the service method with technical details.</li>
<li>return an AsyncToken: this is a stricter contract, but it would tie our code to the Flex framework and it would only work if you create implementations that support AsyncToken</li>
</ul>
<p>In general, the biggest problem is that there is no standard way of defining an asynchronous execution in the Flash Player.</p>
<p><strong>Operation API</strong></p>
<p>The solution Spring ActionScript provides comes in the form of the Operation API. This is a set of interfaces and classes that enables developers to work with asynchronous processes in a uniform fashion. An "operation" in Spring ActionScript vocabulary is the term used for an asynchronous execution and is defined by the IOperation interface. Once an operation is created, it executes immediately and when it is done executing, it either dispatches a "complete" event or an "error" event.</p>
<p>Going back to our user service, this means that we would type all return types of its (asynchronous) methods to IOperation:</p>
<div class="igBar"><span id="lactionscript-36"><a href="#" onclick="javascript:showPlainTxt('actionscript-36'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-36">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">public</span> <span style="color: #0066CC;">interface</span> IUserService <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">function</span> addUser<span style="color: #66cc66;">&#40;</span>user:User<span style="color: #66cc66;">&#41;</span>:IOperation;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">function</span> deleteUser<span style="color: #66cc66;">&#40;</span>user:User<span style="color: #66cc66;">&#41;</span>:IOperation;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">function</span> saveUser<span style="color: #66cc66;">&#40;</span>user:User<span style="color: #66cc66;">&#41;</span>:IOperation;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">function</span> loadAllUsers<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:IOperation;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Whether you now have an implementation that uses Remote Objects, Webservices, locally loaded XML data, a local SQLite database, ... clients working with the user service should not know and care about implementation details. All that they know is that asynchronous methods return an operation to which they can attach listeners to for dealing with the result or error of the call.</p>
<p>A client calling one of these methods might to something like the following, considering there is a userService of type IUserService:</p>
<div class="igBar"><span id="lactionscript-37"><a href="#" onclick="javascript:showPlainTxt('actionscript-37'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-37">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> user:User = <span style="color: #000000; font-weight: bold;">new</span> User<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"John"</span>, <span style="color: #ff0000;">"Doe"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> operation:IOperation = userService.<span style="color: #006600;">saveUser</span><span style="color: #66cc66;">&#40;</span>user<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">operation.<span style="color: #006600;">addCompleteListener</span><span style="color: #66cc66;">&#40;</span>saveUser_completeHandler<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">operation.<span style="color: #006600;">addErrorListener</span><span style="color: #66cc66;">&#40;</span>saveUser_errorHandler<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> saveUser_completeHandler<span style="color: #66cc66;">&#40;</span>event:OperationEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #808080; font-style: italic;">// user was saved</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #808080; font-style: italic;">// event.result contains an optional result of the asynchronous method</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> saveUser_errorHandler<span style="color: #66cc66;">&#40;</span>event:OperationEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #808080; font-style: italic;">// user was not saved, since an error occurred</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #808080; font-style: italic;">// event.error contains error information</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Notice that each operation has the convenience methods "addCompleteListener" and "addErrorListener" for listening to the events dispatched by the operation. The handlers for these events receive an instance of the OperationEvent which contains either the result or the error details.</p>
<p>We have also included some base classes that make it easy to create operations and services. The AbstractOperation class for instance provides a basic implementation of the IOperation interface and implements the event dispatching functionality. You might want to extend this class if you create your own operations.</p>
<p>Here's an example of a custom operation:</p>
<div class="igBar"><span id="lactionscript-38"><a href="#" onclick="javascript:showPlainTxt('actionscript-38'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-38">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MyOperation <span style="color: #0066CC;">extends</span> AbstractOperation <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> MyOperation<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// execute something asynchronously</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// the resultHandler and errorHandler deal with the result of fault</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> resultHandler<span style="color: #66cc66;">&#40;</span>aResult:<span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; dispatchCompleteEvent<span style="color: #66cc66;">&#40;</span>aResult<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> errorHandler<span style="color: #66cc66;">&#40;</span>anError:<span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; dispatchErrorEvent<span style="color: #66cc66;">&#40;</span>anError<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Notice that we call the "dispatchCompleteEvent" and "dispatchErrorEvent" on either success or failure. We pass in the result or the error we received. These will internally be set on the operation so that clients can request them via the OperationEvent.</p>
<p>The Spring ActionScript framework also contains a series of operation implementations for working with Remote Objects, NetConnections, etc.</p>
<p><strong>Combining Operations into Services</strong></p>
<p>Taking this a step further, we also provide base classes for creating services that consist of operations. Going back to our user service, we might create an implementation that uses RemoteObject by subclassing the RemoteObjectService class. This class provides basic functionality for delegating to the underlying Remote Object. Here's an example:</p>
<div class="igBar"><span id="lactionscript-39"><a href="#" onclick="javascript:showPlainTxt('actionscript-39'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-39">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> UserService <span style="color: #0066CC;">extends</span> RemoteObjectService <span style="color: #0066CC;">implements</span> IUserService <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> UserService<span style="color: #66cc66;">&#40;</span>remoteObject:RemoteObject<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">super</span><span style="color: #66cc66;">&#40;</span>remoteObject<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> addUser<span style="color: #66cc66;">&#40;</span>user:User<span style="color: #66cc66;">&#41;</span>:IOperation <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0066CC;">call</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"addUser"</span>, user<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> deleteUser<span style="color: #66cc66;">&#40;</span>user:User<span style="color: #66cc66;">&#41;</span>:IOperation <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0066CC;">call</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"deleteUser"</span>, user<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> saveUser<span style="color: #66cc66;">&#40;</span>user:User<span style="color: #66cc66;">&#41;</span>:IOperation <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0066CC;">call</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"saveUser"</span>, user<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> loadAllUsers<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:IOperation <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0066CC;">call</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"loadAllUsers"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Notice how easy it is to abstract away the use of a remote object and make clients unaware of this by only providing them with the IUserService interface. The "call" method is a very convenient method to forward the call to the remote object, without having to take care of AsyncTokens and Reponders.</p>
<p><strong>Progress Operations</strong></p>
<p>For operations that take longer to execute the IOperation interface has a subinterface called IProgressOperation. This might for instance be the loading of a sound file, a module, etc. Implementations of this interface can let clients know about the progress the operation made by dispatching progress events at certain intervals. When listening for these events, via the "addProgressListener" method, a ProgressOperationEvent is received that contains a "progress" and "total" property.</p>
<div class="igBar"><span id="lactionscript-40"><a href="#" onclick="javascript:showPlainTxt('actionscript-40'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-40">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> loadSoundOperation:IProgressOperation = <span style="color: #000000; font-weight: bold;">new</span> MyLoadSoundOperation<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"aSoundFile.mp3"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">loadSoundOperation.<span style="color: #006600;">addProgressListener</span><span style="color: #66cc66;">&#40;</span>loadSoundOperation_progressHandler<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> loadSoundOperation_progressHandler<span style="color: #66cc66;">&#40;</span>event:ProgressOperationEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Loaded "</span> + event.<span style="color: #006600;">progress</span> + <span style="color: #ff0000;">" of "</span> + event.<span style="color: #006600;">total</span> + <span style="color: #ff0000;">" bytes"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>Batch Operations</strong></p>
<p>When you are in a scenario where you need to execute several operations and you don't care about the order in which they finish, you might want to use the OperationQueue class. This is an implementation of the IProgressOperation interface that lets you add operations to a queue and receive information about the progress of the complete execution. Since this also is an IOperation, we can listen to the completion of the queue via the "addCompleteListener" method.</p>
<div class="igBar"><span id="lactionscript-41"><a href="#" onclick="javascript:showPlainTxt('actionscript-41'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-41">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> queue:OperationQueue = <span style="color: #000000; font-weight: bold;">new</span> OperationQueue<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// setup event listeners</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">queue.<span style="color: #006600;">addCompleteListener</span><span style="color: #66cc66;">&#40;</span>queue_completeHandler<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">queue.<span style="color: #006600;">addProgressListener</span><span style="color: #66cc66;">&#40;</span>queue_progressHandler<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// add operations to the queue</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">queue.<span style="color: #006600;">addOperation</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> AnOperation<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">queue.<span style="color: #006600;">addOperation</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> AnotherOperation<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">queue.<span style="color: #006600;">addOperation</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> YetAnotherOperation<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> queue_completeHandler<span style="color: #66cc66;">&#40;</span>event:OperationEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Queue is done executing."</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> queue_progressHandler<span style="color: #66cc66;">&#40;</span>event:ProgressOperationEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Executed "</span> + event.<span style="color: #006600;">progress</span> + <span style="color: #ff0000;">" of "</span> + event.<span style="color: #006600;">total</span> + <span style="color: #ff0000;">" operations"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>Mocking Operations</strong></p>
<p>During development it is often good to have mock or stub implementations of the services that normally connect to a backend. The main reason is that this provides a way of (unit) testing the use of the services without the backend running. Spring ActionScript provides a class called MockOperation for this purpose. Its constructor takes the following arguments:</p>
<ul>
<li>result: the result returned by the operation</li>
<li>delay (optional): the time the operations waits before completing, in milliseconds (default = 1000)</li>
<li>returnError (optional): a flag indicating wether or not the operation should return an error at random times (default = false)</li>
</ul>
<p>If you would mock the user service, you could do this as follows (only one method is implemented):</p>
<div class="igBar"><span id="lactionscript-42"><a href="#" onclick="javascript:showPlainTxt('actionscript-42'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-42">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> loadAllUsers<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:IOperation <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">var</span> users:ArrayCollection = <span style="color: #000000; font-weight: bold;">new</span> TypedCollection<span style="color: #66cc66;">&#40;</span>User<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; users.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> User<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"John"</span>, <span style="color: #ff0000;">"Doe"</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; users.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> User<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Mitch"</span>, <span style="color: #ff0000;">"Hedberg"</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">new</span> MockOperation<span style="color: #66cc66;">&#40;</span>users<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>Conclusion</strong></p>
<p>The Operation API provides a neat way of abstracting away technical details and makes it easier to swap implementations without affecting any code. It unifies asynchronous programming for the Flash Player into a simple set of interfaces and base classes. You will also see that it is the basis for other APIs in the Spring ActionScript framework such as the Command and Task API.</p>
<p>For more information on Spring ActionScript, refer to <a href="http://www.springactionscript.org">www.springactionscript.org</a></p>

<p><a href="http://feedads.g.doubleclick.net/~a/mhayjvz9FTYhrGC0kAP6fpyQTbc/0/da"><img src="http://feedads.g.doubleclick.net/~a/mhayjvz9FTYhrGC0kAP6fpyQTbc/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/mhayjvz9FTYhrGC0kAP6fpyQTbc/1/da"><img src="http://feedads.g.doubleclick.net/~a/mhayjvz9FTYhrGC0kAP6fpyQTbc/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/herrodius/~4/TfQD862dKtY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.herrodius.com/blog/284/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Spring ActionScript 1.0RC1 Released</title>
		<link>http://www.herrodius.com/blog/273</link>
		<comments>http://www.herrodius.com/blog/273#comments</comments>
		<pubDate>Mon, 01 Mar 2010 19:53:52 +0000</pubDate>
		<dc:creator>Christophe</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Air]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Inversion of Control]]></category>
		<category><![CDATA[Spring ActionScript]]></category>

		<guid isPermaLink="false">http://www.herrodius.com/blog/?p=273</guid>
		<description><![CDATA[Dear community, I'm pleased to announce that the first release candidate for Spring ActionScript 1.0 is now available. Download&#160;&#124;&#160;API Documentation&#160;&#124;&#160;HTML Docs&#160;&#124;&#160;Changelog This release is considered feature complete and announces the final stage before moving to a final 1.0 release. Amongst the many updates and fixes, these are the most important ones: - Operation API (docs, [...]]]></description>
			<content:encoded><![CDATA[<p>Dear community,</p>
<p>I'm pleased to announce that the first release candidate for Spring ActionScript 1.0 is now available.</p>
<p align='center'><a href="http://www.springactionscript.org/downloads/spring-actionscript-1.0RC1-distribution-with-dependencies.zip">Download</a>&nbsp;|&nbsp;<a href="http://www.springactionscript.org/asdoc/index.html">API Documentation</a>&nbsp;|&nbsp;<a href="http://www.springactionscript.org/docs/reference/html/springactionscript.html">HTML Docs</a>&nbsp;|&nbsp;<a href="http://www.springactionscript.org/changes-report.html">Changelog</a></p>
<p>This release is considered feature complete and announces the final stage before moving to a final 1.0 release. </p>
<p>Amongst the many updates and fixes, these are the most important ones:<br />
 - <strong>Operation API</strong> (<a href="http://www.springactionscript.org/docs/reference/html/the_operation_api.html">docs</a>, <a href="http://www.herrodius.com/blog/284">blog</a>)<br />
 - <strong>EventBus</strong> (<a href="http://www.springactionscript.org/docs/reference/html/the_eventbus.html">docs</a>)<br />
 - <strong>Task API</strong> (<a href="http://www.springactionscript.org/docs/reference/html/the_operation_api.html#tasks">docs</a>)<br />
 - <strong>MXML Configuration</strong> (<a href="http://www.springactionscript.org/docs/reference/html/container-documentation.html#composing_mxml_based_configuration_metadata">docs</a>)</p>
<p>These changes will be discussed in a couple of follow-up blogposts, so please check back soon for that. In the meantime, please refer to the documentation provided for more information.</p>
<p>I would like to thank all of you who have given us valuable feedback and provided interesting ideas, sent in patches, reported bugs or helped us out in whatever way possible. Your support has been priceless in the development of this framework and it would not be as rich as it is now without you.</p>
<p>Special thanks go out to Martino for mastering the Maven build system and fixing a lot of the problems that stopped us from releasing earlier, and to Roland who has written 99,9% of the AWESOME documentation and took a natural lead in the development of 1.0RC1. You guys rock!</p>
<p>Enjoy this release and have fun coding!</p>
<p><strong>Spring ActionScript 1.0RC1 Changelog</strong></p>
<ul>
<li>fixed constructor-arg type attribute was not declared in spring-actionscript-objects-1.0.xsd.<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/configuration-reference.html#anchor_objectType" target="_blank">config reference link</a></li>
<li>added unregisterStageProcessor() method to the IStageProcessorRegistry interface.<br/>
<p><a href="http://www.springactionscript.org/asdoc/org/springextensions/actionscript/stage/IStageProcessorRegistry.html#unregisterStageProcessor%28%29" target="_blank">ASDoc link</a></li>
<li>added DefaultFlexAutowireProcessor that handles binding using the [Autowired(name="objectName",property="property.chain")] metadata.<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/container-documentation.html#binding_a_stage_component_to_a_property_of_an_object_in_the_container" target="_blank">documentation link</a></li>
<li>added PureMVC documentation section.<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/extensions-documentation.html#puremvc" target="_blank">puremvc documentation link</a></li>
<li>added autowiring support for injecting external property values using [Autowired(externalProperty="propertyName")].<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/container-documentation.html#injecting_a_stage_component_property_with_an_external_property_value" target="_blank">documentation link</a></li>
<li>added parent context support to IObjectFactory interface and AbstractObjectFactory implementation.<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/container-documentation.html#instantiation_through_a_parent_factory" target="_blank">documentation link</a></li>
<li>added skip-postprocessor and skip-metadata support for ObjectDefinition.<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/container-documentation.html#autowiring_stage_components" target="_blank">skip-metadata link</a><br/></p>
<p><a href="http://www.springactionscript.org/docs/reference/html/container-documentation.html#customizing_objects_using_objectpostprocessors" target="_blank">skip-postprocessor link</a></li>
<li>added name and value attribute support to the property XML element, for defining external properties directly in the configuration instead of an external properties file.<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/container-documentation.html#define_external_properties_explicitly" target="_blank">docs link</a></li>
<li>added parent properties support to XMLObjectFactory.<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/container-documentation.html#a_simple_example_of_an_application_context_hierarchy" target="_blank">docs link</a></li>
<li>added IStageProcessorRegistry interface and FlexStageProcessorRegistry implementation to support stage wiring in a multi-module situation (Thanks to Arnoud for helping debug this).<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/container-documentation.html#the_istageprocessor_interface" target="_blank">docs link</a></li>
<li>added extra functionality to the CairngormFrontController that enables to add commands that are being created by the application context (basically using the context as a commandFactory).<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/extensions-documentation.html#using_the_application_context_as_a_command_factory" target="_blank">cairngorm docs link</a></li>
<li>renamed SASCairngormEvent to SASCairngormModuleEvent.<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/extensions-documentation.html#bubbling_your_cairngorm_events_up_to_the_cairngormfrontcontroller" target="_blank">cairngorm docs link</a></li>
<li>ObjectUtils no longer has a dependency on the Flex framework.</li>
<li>added core.* package containing the Operation API.<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/the_operation_api.html" target="_blank">operation docs link</a></li>
<li>added core.event.* package containing the EventBus classes.<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/the_eventbus.html" target="_blank">eventbus docs link</a></li>
<li>added EventHandlerMetaDataPostProcessor for automatic handling of EventBus events.<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/the_eventbus.html#eventbus_event_handling_using_metadata_annotations" target="_blank">eventbus docs link</a></li>
<li>added parallel or sequencential execution to CompositeCommand class.<br/>
<p><a href="http://www.springactionscript.org//docs/reference/html/the_operation_api.html#composite_commands" target="_blank">operation docs link</a></li>
<li>added core.task.* package.<br/>
<p><a href="http://www.springactionscript.org//docs/reference/html/the_operation_api.html#tasks" target="_blank">operation docs link</a></li>
<li>added support for property chain retrieval in the FieldRetrievingObjectFactory, for example: Application.application.systemManager.stage can now be retrieved.</li>
<li>added support for compound property names in XML config.</li>
<li>added support for factory-object in AbstractObjectFactory..<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/container-documentation.html#instantiation_using_a_factory_method_on a_different_instance" target="_blank">link</a></li>
<li>added TaskNamespaceHandler for core.task.* package.<br/>
<p><a href="http://www.springactionscript.org//docs/reference/html/the_operation_api.html#the_task_namespace_handler" target="_blank">link</a></li>
<li>added createInstance(clazz:Class, constructorArguments:Array = null) method to the IObjectFactory interface to enable a factory to create objects with only annotations and have no object definition.<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/container-documentation.html#instantiating_a_class_with_autowire_annotations" target="_blank">link</a></li>
<li>added operation and service for remoting via NetConnection.<br/>
<p><a href="http://www.springactionscript.org/asdoc/org/springextensions/actionscript/rpc/net/NetConnectionOperation.html" target="_blank">link</a></li>
<li>added support for vector type in XML configuration..<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/container-documentation.html#collections" target="_blank">link</a></li>
<li>Allow adding mx.flash.Event items to EventSequence and facilitate custom trigger calculation. (Thanks Jurgen).</li>
<li>Added modulePolicy of type ModulePolicy to FlexStageProcessorRegistry that determines how modules will be handled.</li>
<li>Minor documentation fixes. (Thanks Mark).</li>
<li>added RouteEventsMetaDataPostProcessor to re-route events from arbitrary objects through the EventBus.<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/the_eventbus.html#routing_other_events_through_the_eventbus" target="_blank">link</a></li>
<li>Added IApplicationDomainAware and ApplicationDomainAwarePostProcessor to automatically inject the context's application domain in objects that need a reference.</li>
<li>Added MethodInvokingFactoryObject to be able to inject method results from other objects.<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/container-documentation.html#injecting_method_invocation_results_from_other_objects" target="_blank">link</a></li>
<li>Added util:invoke element as a configuration shortcut for the MethodInvokingFactoryObject.<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/xml-schema-based-configuration.html#util_invoke" target="_blank">link</a></li>
<li>Added support for injecting the application context by using ref="this" in the configuration.<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/container-documentation.html#injecting_the_application_context_using_the_this_reference" target="_blank">link</a></li>
<li>Added Maven mojo to generate a flex-config file from an application context (Thanks Ryan).<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/Class-inclusion.html#using_maven" target="_blank">link</a></li>
</ul>

<p><a href="http://feedads.g.doubleclick.net/~a/nJRB9RE_EveEU-fI_77MDuHJU08/0/da"><img src="http://feedads.g.doubleclick.net/~a/nJRB9RE_EveEU-fI_77MDuHJU08/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/nJRB9RE_EveEU-fI_77MDuHJU08/1/da"><img src="http://feedads.g.doubleclick.net/~a/nJRB9RE_EveEU-fI_77MDuHJU08/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/herrodius/~4/BAWktGgRi_c" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.herrodius.com/blog/273/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

