<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	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/"
	>

<channel>
	<title>Christophe Herreman &#187; Inversion of Control</title>
	<atom:link href="http://www.herrodius.com/blog/category/inversion-of-control/feed" rel="self" type="application/rss+xml" />
	<link>http://www.herrodius.com/blog</link>
	<description>Thoughts from a software developer</description>
	<lastBuildDate>Thu, 15 Sep 2011 21:50:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<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-2"><a href="#" onclick="javascript:showPlainTxt('xml-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">XML:</span>
<div id="xml-2">
<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>
]]></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>
]]></content:encoded>
			<wfw:commentRss>http://www.herrodius.com/blog/350/feed</wfw:commentRss>
		<slash:comments>2</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-7"><a href="#" onclick="javascript:showPlainTxt('actionscript-7'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-7">
<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-8"><a href="#" onclick="javascript:showPlainTxt('xml-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">XML:</span>
<div id="xml-8">
<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-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: #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-10"><a href="#" onclick="javascript:showPlainTxt('xml-10'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">XML:</span>
<div id="xml-10">
<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>
]]></content:encoded>
			<wfw:commentRss>http://www.herrodius.com/blog/307/feed</wfw:commentRss>
		<slash:comments>11</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>
]]></content:encoded>
			<wfw:commentRss>http://www.herrodius.com/blog/273/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Spring ActionScript Devoxx slides</title>
		<link>http://www.herrodius.com/blog/255</link>
		<comments>http://www.herrodius.com/blog/255#comments</comments>
		<pubDate>Thu, 19 Nov 2009 20:50:22 +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>
		<category><![CDATA[Talks]]></category>

		<guid isPermaLink="false">http://www.herrodius.com/blog/?p=255</guid>
		<description><![CDATA[Here are the slides of the presentation I did on Spring ActionScript at the Devoxx conference 2009. The sample application will be available in the upcoming 0.9 release, so stay tuned. A pdf version is also available here. If you have any specific questions you can post them in the comments or check our forum. [...]]]></description>
			<content:encoded><![CDATA[<p>Here are the slides of the presentation I did on Spring ActionScript at the <a href="http://www.devoxx.com">Devoxx</a> conference 2009. The sample application will be available in the upcoming 0.9 release, so stay tuned. A pdf version is also available <a href="http://www.herrodius.com/upload/spring-actionscript-devoxx-2009.pdf">here</a>.</p>
<p>If you have any specific questions you can post them in the comments or check our <a href="http://forum.springsource.org/forumdisplay.php?f=60">forum</a>.</p>
<p>Enjoy.</p>
<p><center>
<div style="width:425px;text-align:left" id="__ss_2539723"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" href="http://www.slideshare.net/herrodius/spring-actionscript-at-devoxx" title="Spring Actionscript at Devoxx">Spring Actionscript at Devoxx</a><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=spring-actionscript-091119143443-phpapp01&#038;stripped_title=spring-actionscript-at-devoxx" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=spring-actionscript-091119143443-phpapp01&#038;stripped_title=spring-actionscript-at-devoxx" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;">View more <a style="text-decoration:underline;" href="http://www.slideshare.net/">presentations</a> from <a style="text-decoration:underline;" href="http://www.slideshare.net/herrodius">herrodius</a>.</div>
</div>
<p></center></p>
]]></content:encoded>
			<wfw:commentRss>http://www.herrodius.com/blog/255/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Thoughts on Cairngorm 3 and Application Architecture</title>
		<link>http://www.herrodius.com/blog/216</link>
		<comments>http://www.herrodius.com/blog/216#comments</comments>
		<pubDate>Tue, 06 Oct 2009 20:40:25 +0000</pubDate>
		<dc:creator>Christophe</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[AS3Commons]]></category>
		<category><![CDATA[Cairngorm]]></category>
		<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Inversion of Control]]></category>
		<category><![CDATA[Lessons learned]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Spring ActionScript]]></category>

		<guid isPermaLink="false">http://www.herrodius.com/blog/?p=216</guid>
		<description><![CDATA[Cairngorm 3 was recently announced by Tom Sugden and Alex Uhlmann and has now been released in beta on the Adobe Opensource site. Don't expect an updated version of the Cairngorm framework as you know it though. Cairngorm 3 is not aiming to be an MVC implementation, and thus moves away from what version 1 [...]]]></description>
			<content:encoded><![CDATA[<p>Cairngorm 3 was recently announced by <a href="http://blogs.adobe.com/tomsugden/2009/09/coming_soon_cairngorm_3_1.html">Tom Sugden</a> and <a href="http://blogs.adobe.com/auhlmann/archives/2009/10/cairngorm_3_bet.html">Alex Uhlmann</a> and has now been <a href="http://opensource.adobe.com/wiki/display/cairngorm/Cairngorm+3">released in beta</a> on the Adobe Opensource site.</p>
<p>Don't expect an updated version of the Cairngorm framework as you know it though. Cairngorm 3 is not aiming to be an MVC implementation, and thus moves away from what version 1 and 2 were, but now consists of a set of patterns and practices, together with a series of libraries that can help to solve common problems.</p>
<p>The Patterns &#038; Practices Group at Microsoft have been promoting <a href="http://www.codeplex.com/CompositeWPF">a similar mindset</a> for quite some time actually: Prism - patterns &#038; practices Composite Application Guidance for WPF</p>
<p>I can only encourage this decision as it is exactly how I personally think about application design and architecture, especially in Flex and AIR applications. This is also what we are trying to do with <a href="http://www.springactionscript.org">Spring ActionScript</a>: our main goal is to provide a solid Inversion of Control container that supports multiple configuration options (XML, MXML, metadata driven component scanning, ...) and promote it as a foundation to build applications (and frameworks), with or without your favorite MVC framework. Although we are working on a set of base classes that provide infrastructure for your application (under the name MVCS) with Application Events, Controllers, Abstractions for service layers, ... by no means do we want to market the Spring ActionScript framework as yet another MVC implementation. (You might wonder why we are calling it MVCS then, and I'm actually wondering the same... I guess marketing and buzzwords in the opensource world are also important. All kidding aside, the name is certainly subject to change).</p>
<p><strong>What's in a name</strong></p>
<p>Since this is a complete change of direction for the Cairngorm framework (which it actually no longer is) I would have expected a new name. Continuing to use Cairngorm as a name is in my opinion a bad move and will cause major confusion amongst developers and other people involved in the development process. I think the best thing for Adobe, or at least their Technical Services department, would be to let go of the name and choose a new, fresh name that moves away from the past. (Besides that, who can pronounce "Cairngorm".)</p>
<p><strong>Dependencies</strong></p>
<p>I noticed that some of the modules that Cairngorm 3 provides depend on other libraries/frameworks, and in general the <a href="http://www.spicefactory.org/parsley/">Parsley</a> application framework. While Parsley is certainly a major player amongst the IoC/application frameworks, and I sincerely respect the author's work, I don't think this is a good decision. In case you are wondering: Yes, I would say the same thing if they decided to depend on Spring ActionScript.</p>
<p>The usage and choice of a concrete dependency will have consequences for the adoption and integration of the libraries that Cairngorm 3 provides. Think about it: Why would you want to pull in Parsley, perhaps only to use some of its Reflection API, if you are already running on Spring ActionScript or any other IoC container?</p>
<p>We, the Spring ActionScript team, have actually questioned ourselves about this in the past and have therefore decided to move all the common and reusable code from Spring ActionScript into a set of libraries known as the <a href="http://www.as3commons.org">AS3Commons</a> project. In that respect, I'm a bit disappointed that for instance the <a href="http://www.as3commons.org/as3-commons-reflect">AS3Commons Reflect</a> library is not used for reflection purposes, since I think it is more abstracted and unintrusive than a subset of an all-encompassing application framework. Perhaps this may be our fault of not promoting the libraries and the project enough. However, I certainly think that AS3Commons could be a wonderful project and would help to provide common libraries not only to Flex and AIR developers, but to ActionScript 3 developers in general, if it were embraced by the community.</p>
<p><strong>Flex and MVC</strong></p>
<p>Given that RIA technolgies are still evolving at a very fast pace, it is really remarkable to see the huge amount of MVC implementations appear. Not specifically aimed at Cairngorm (at least the previous versions), but rather at almost all MVC architectures available for Flex development, my personal feeling and experience is that the use of MVC architectures in the Adobe RIA space is almost a dogmatic thing and is not needed in most cases. The problem is that people just take an MVC framework as it is and implement it in their applications. More than often not questioning whether or not its usage is justified. Things that could easily and cleverly be solved are ripped apart across layers of the architecture, introducing levels of indirection that are in most cases not needed. The only thing they add is complexity and counter-intuitive development practices.</p>
<p>One of the main arguments for using an MVC framework is that the code is "easy to understand". Of course the code will be easy to understand if you have been developing with the framework of choice for the N-th time or if you have been digging into the code for a serious amount of time, but ask a newcomer to look at the code and try to explain to you what it is actually doing... I think you'll be surprised by the responses.</p>
<p>I'm not saying that the use of a particular MVC framework is de facto a bad thing, but the "religious" use and the blind adoption and implementation make a framework a killer for your application. I would encourage everyone to start their next project without an MVC framework and just use the Flex framework with a healthy knowledge of design and presentation patterns. And even if you are using an MVC implementation, think about each layer you introduce, why you need it and the pros and cons it brings.</p>
<p><strong>Conclusion</strong></p>
<p>It's good to see that Adobe is rethinking their approach to RIA architecture and development practices. I also hope that they will be more open to community input and feedback than they were in the past. Although they did several attempts at engaging the community, I don't think they really succeeded in that. If not open enough, people will just continue to fork the "framework" and provide extensions that will end up in alternative implementations anyway.</p>
<p>I'm looking forward to seeing how all of this evolves.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.herrodius.com/blog/216/feed</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Spring ActionScript: site and documentation update</title>
		<link>http://www.herrodius.com/blog/164</link>
		<comments>http://www.herrodius.com/blog/164#comments</comments>
		<pubDate>Tue, 02 Jun 2009 08:00:23 +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/164</guid>
		<description><![CDATA[Some quick news about the status of the project. The Spring ActionScript project has a new home at http://www.springactionscript.org! We have been updating the documentation extensively and although this is still a work in progress, this should be a valuable resource to get started with the framework. Please see the "Documentation" section for more info [...]]]></description>
			<content:encoded><![CDATA[<p>Some quick news about the status of the project.</p>
<p>The Spring ActionScript project has a new home at <a href="http://www.springactionscript.org">http://www.springactionscript.org</a>!</p>
<p>We have been updating the documentation extensively and although this is still a work in progress, this should be a valuable resource to get started with the framework. Please see the "Documentation" section for more info and available doc formats.</p>
<p>There are also some neat new features like advanced autowiring and support for custom XML namespaces (available in SVN) that will be distributed with the new 0.8 release, expected to be released by the end of this week.</p>
<p>As usual, we appreciate any feedback. Join our <a href="http://groups.google.com/group/springactionscript-dev">Google developers group</a> or the <a href="http://forum.springsource.org/forumdisplay.php?f=60">forum</a>.</p>
<p>Have fun coding!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.herrodius.com/blog/164/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Spring ActionScript 0.7.1 Released</title>
		<link>http://www.herrodius.com/blog/161</link>
		<comments>http://www.herrodius.com/blog/161#comments</comments>
		<pubDate>Fri, 06 Feb 2009 08:38: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[Inversion of Control]]></category>
		<category><![CDATA[Spring ActionScript]]></category>

		<guid isPermaLink="false">http://www.herrodius.com/blog/161</guid>
		<description><![CDATA[Dear Community, I'm pleased to announce that the Spring ActionScript 0.7.1 release is now available. Download&#160;&#124;&#160;API Documentation&#160;&#124;&#160;Changelog This is a minor release that fixes 2 blocking issues: - import nodes were not parsed correctly, which resulted in the imported nodes not being created. - circular reference error when 2 objects have bidirectional references. We also [...]]]></description>
			<content:encoded><![CDATA[<p>Dear Community,</p>
<p>I'm pleased to announce that the Spring ActionScript 0.7.1 release is now available.</p>
<p align='center'><a href="https://sourceforge.net/project/showfiles.php?group_id=194107&#038;package_id=306949">Download</a>&nbsp;|&nbsp;<a href="http://www.pranaframework.org/docs/0.7.1/api/">API Documentation</a>&nbsp;|&nbsp;<a href="http://www.pranaframework.org/docs/0.7.1/changelog.txt">Changelog</a></p>
<p>This is a minor release that fixes 2 blocking issues:<br />
- import nodes were not parsed correctly, which resulted in the imported nodes not being created.<br />
- circular reference error when 2 objects have bidirectional references.</p>
<p>We also added some extra classes to the domain package.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.herrodius.com/blog/161/feed</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Spring ActionScript 0.7 Released</title>
		<link>http://www.herrodius.com/blog/160</link>
		<comments>http://www.herrodius.com/blog/160#comments</comments>
		<pubDate>Tue, 20 Jan 2009 16:10:06 +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/160</guid>
		<description><![CDATA[Dear Community, I'm pleased to announce that the Spring ActionScript 0.7 release is now available. Download&#160;&#124;&#160;API Documentation&#160;&#124;&#160;Changelog This is the first official release after switching from the Prana Framework to Spring ActionScript. Note that this release does not contain the Cairngorm and PureMVC extensions since these will later be released as separate extension libraries to [...]]]></description>
			<content:encoded><![CDATA[<p>Dear Community,</p>
<p>I'm pleased to announce that the Spring ActionScript 0.7 release is now available.</p>
<p align='center'><a href="https://sourceforge.net/project/showfiles.php?group_id=194107&#038;package_id=306949">Download</a>&nbsp;|&nbsp;<a href="http://www.pranaframework.org/docs/0.7/api/">API Documentation</a>&nbsp;|&nbsp;<a href="http://www.pranaframework.org/docs/0.7/changelog.txt">Changelog</a></p>
<p>This is the first official release after switching from the Prana Framework to Spring ActionScript. Note that this release does not contain the Cairngorm and PureMVC extensions since these will later be released as separate extension libraries to the framework.</p>
<p>Some of the major changes and enhancements include:</p>
<p><strong>Reflection API is now AS3Reflect</strong></p>
<p>The reflection API is now provided as a separate project named AS3Reflect. This was a demand from several developers that wanted to use the reflection classes without having to use the whole Spring ActionScript codebase. For more info, please see <a href="http://code.google.com/p/as3reflect/">http://code.google.com/p/as3reflect/</a></p>
<p><strong>MVCS Support</strong></p>
<p>Inspired by the <a href="http://joeberkovitz.com/blog/reviewtube/">MVCS</a> principles that <a href="http://joeberkovitz.com/blog">Joe Berkovitz</a> describes, we created some experimental classes to support the MVCS workflow. Combining these principles with the IoC container of Spring ActionScript is actually very powerfull. Especially if you incorporate a presentation pattern like Presentation Model, you get maximum flexibility and simplicity by autowiring presentation models from the application context into the view layer of your application. I really recommend reading the MVCS and Presentation Model/Autowiring parts of a <a href="http://www.herrodius.com/blog/158">previous blog post</a> I wrote about this.</p>
<p><strong>IoC Container</strong></p>
<p>We have improved many things in the IoC container and added support for new things like parent and dependant objects. We will continue to improve the core container as we work towards a 1.0 release and will add support for new tags and attributes based on community feedback. So be sure to get in touch with and give us your feedback.</p>
<p>If you feel like helping us out, we could certainly use your help. This project is entirely created on a volunteer basis and in our spare (and limited) free time so needless to say that the more people, the faster we can deliver new releases and guarantee the quality of the framework. So if you think you have someting to offer, be it as a developer, tester, documentation writer, sample creator, ... please contact me or leave something in the comments. All help is more than welcome.</p>
<p>Enjoy this release and have fun coding!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.herrodius.com/blog/160/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Spring ActionScript at FlexCamp 2008 Belgium</title>
		<link>http://www.herrodius.com/blog/158</link>
		<comments>http://www.herrodius.com/blog/158#comments</comments>
		<pubDate>Fri, 12 Dec 2008 10:18:31 +0000</pubDate>
		<dc:creator>Christophe</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Conferences]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Inversion of Control]]></category>
		<category><![CDATA[Spring ActionScript]]></category>
		<category><![CDATA[Talks]]></category>

		<guid isPermaLink="false">http://www.herrodius.com/blog/158</guid>
		<description><![CDATA[Here's a rundown of the presentation I did on Spring ActionScript at the FlexCamp in Antwerp, Belgium. In 40 minutes I tried to cover the basic theory on Inversion of Control, Dependency Injection and the Spring ActionScript project in general. We then dove right into some code we've been writing for an enterprise app that [...]]]></description>
			<content:encoded><![CDATA[<p>Here's a rundown of the presentation I did on Spring ActionScript at the FlexCamp in Antwerp, Belgium. In 40 minutes I tried to cover the basic theory on Inversion of Control, Dependency Injection and the Spring ActionScript project in general. We then dove right into some code we've been writing for an enterprise app that extensively uses Spring ActionScript's IoC container.</p>
<p><center>
<div style="width:425px;text-align:left" id="__ss_840353"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" href="http://www.slideshare.net/herrodius/spring-actionscript-presentation?type=powerpoint" title="Spring ActionScript">Spring ActionScript</a><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slideshare.net/swf/ssplayer2.swf?doc=springactionscript-1229072979837175-2&#038;stripped_title=spring-actionscript-presentation" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slideshare.net/swf/ssplayer2.swf?doc=springactionscript-1229072979837175-2&#038;stripped_title=spring-actionscript-presentation" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;">View SlideShare <a style="text-decoration:underline;" href="http://www.slideshare.net/herrodius/spring-actionscript-presentation?type=powerpoint" title="View Spring ActionScript on SlideShare">presentation</a> or <a style="text-decoration:underline;" href="http://www.slideshare.net/upload?type=powerpoint">Upload</a> your own. (tags: <a style="text-decoration:underline;" href="http://slideshare.net/tag/flash">flash</a> <a style="text-decoration:underline;" href="http://slideshare.net/tag/air">air</a>)</div>
</div>
<p></center></p>
<p>Since time was limited (or in case you were not there), I'll run through the key features of the code I ran through and try to give some more explanation.</p>
<p><strong>Targeting BlazeDS via remoting and messaging</strong></p>
<p>Whenever I'm hitting a backend, I try to have the endpoints externally configured. This allows me to switch between different endpoints - different test or production servers for instance - just by specifying the ip and port in an external properties file. This means that you don't have to specify any compiler arguments that point to the services-config.xml or messaging-config.xml files.</p>
<p>You can set up a channelset and a consumer with the following code. Notice the "method-invocation" element that allows you to execute a method on the object you create. This allows us to directly pass in a channel to the channelset. (In case you are interested, the method-invocation element is preprocessed to an instance of MethodInvokingFactoryObject)</p>
<div class="igBar"><span id="lcode-23"><a href="#" onclick="javascript:showPlainTxt('code-23'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-23">
<div class="code">
<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;">&lt;object id=<span style="color:#CC0000;">"channelSet"</span> class=<span style="color:#CC0000;">"mx.messaging.ChannelSet"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;method-invocation name=<span style="color:#CC0000;">"addChannel"</span>&gt;</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; &nbsp; &nbsp; &lt;arg&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;object id=<span style="color:#CC0000;">"streamingAMFChannel"</span> class=<span style="color:#CC0000;">"mx.messaging.channels.StreamingAMFChannel"</span>&gt;</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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;property name=<span style="color:#CC0000;">"url"</span> value=<span style="color:#CC0000;">"http://${host}:${port}/${context-root}/messagebroker/streamingamf"</span> /&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/object&gt;</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; &nbsp; &nbsp; &lt;/arg&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/method-invocation&gt;</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;">&lt;/object&gt;</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;">&lt;object id=<span style="color:#CC0000;">"eventMessageFeedConsumer"</span> class=<span style="color:#CC0000;">"mx.messaging.Consumer"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;property name=<span style="color:#CC0000;">"destination"</span> value=<span style="color:#CC0000;">"eventMessageFeed"</span> /&gt;</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; &lt;property name=<span style="color:#CC0000;">"channelSet"</span> ref=<span style="color:#CC0000;">"channelSet"</span> /&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/object&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Have you noticed the placeholders "${...}" for the host, port and context-root? These are loaded from a properties file that is referenced in the application context file.</p>
<p>Here's the external properties file:</p>
<div class="igBar"><span id="lcode-24"><a href="#" onclick="javascript:showPlainTxt('code-24'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-24">
<div class="code">
<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;">host=<span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">134</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">port=<span style="color:#800000;color:#800000;">8081</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;">context-root=server-web </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>And here's the import declaration in the application context xml file:</p>
<div class="igBar"><span id="lcode-25"><a href="#" onclick="javascript:showPlainTxt('code-25'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-25">
<div class="code">
<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;">&lt;property file=<span style="color:#CC0000;">"application-context.properties.txt"</span> /&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Of course, you can also specify remote objects in the application context. Here's an example:</p>
<div class="igBar"><span id="lcode-26"><a href="#" onclick="javascript:showPlainTxt('code-26'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-26">
<div class="code">
<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;">&lt;object id=<span style="color:#CC0000;">"remoteObject"</span> class=<span style="color:#CC0000;">"mx.rpc.remoting.mxml.RemoteObject"</span> abstract=<span style="color:#CC0000;">"true"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;property name=<span style="color:#CC0000;">"endpoint"</span> value=<span style="color:#CC0000;">"http://${host}:${port}/${context-root}/messagebroker/amf"</span> /&gt;</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; &lt;property name=<span style="color:#CC0000;">"showBusyCursor"</span> value=<span style="color:#CC0000;">"true"</span> /&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/object&gt;</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;">&lt;object id=<span style="color:#CC0000;">"userRemoteObject"</span> parent=<span style="color:#CC0000;">"remoteObject"</span>&gt;</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; &lt;property name=<span style="color:#CC0000;">"destination"</span> value=<span style="color:#CC0000;">"userService"</span> /&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/object&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Notice that we actually split this up into 2 objects. The first object is an abstract remote object which we use as a parent object for concrete remote objects. Notice the "abstract=true" and the "parent=remoteObject" properties on these objects.</p>
<p><strong>MVCS support</strong></p>
<p>As part of the project we are working on, we also starting working on some experimental MVCS support. If you haven't heard of MVCS, be sure to check out at <a href="http://joeberkovitz.com/blog/reviewtube/">Joe Berkovitz' blog</a>.</p>
<p>What we provide so far are some interfaces and abstract base classes for services, operations and commands. Let's look at some code for services and operations.</p>
<p>Here's an interface for a user service, which defines a "getAll" method.</p>
<div class="igBar"><span id="lcode-27"><a href="#" onclick="javascript:showPlainTxt('code-27'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-27">
<div class="code">
<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;">public interface IUserService <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; function getAll<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>:IAsyncOperation;</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:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>We now want to create a concrete service for that interface. For instance, this could be a remote object enabled service. For that, we have a abstract remote object service base class.</p>
<div class="igBar"><span id="lcode-28"><a href="#" onclick="javascript:showPlainTxt('code-28'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-28">
<div class="code">
<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;">public class UserRemoteObjectService extends AbstractRemoteObjectService implements IUserService <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &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; &nbsp; public function UserRemoteObjectService<span style="color:#006600; font-weight:bold;">&#40;</span>remoteObject:RemoteObject<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; super<span style="color:#006600; font-weight:bold;">&#40;</span>remoteObject<span style="color:#006600; font-weight:bold;">&#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; &nbsp; <span style="color:#006600; font-weight:bold;">&#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; &nbsp; public function getAll<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>:IAsyncOperation <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; var token:AsyncToken = remoteObject.<span style="">getAll</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#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; &nbsp; &nbsp; &nbsp; token.<span style="">addResponder</span><span style="color:#006600; font-weight:bold;">&#40;</span>new Responder<span style="color:#006600; font-weight:bold;">&#40;</span>onGetAllResult, onGetAllFault<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; return getOperation<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"getAll"</span><span style="color:#006600; font-weight:bold;">&#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; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &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; &nbsp; private function onGetAllResult<span style="color:#006600; font-weight:bold;">&#40;</span>event:ResultEvent<span style="color:#006600; font-weight:bold;">&#41;</span>:void <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; getOperation<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"getAll"</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="">dispatchEvent</span><span style="color:#006600; font-weight:bold;">&#40;</span>new AsyncOperationResultEvent<span style="color:#006600; font-weight:bold;">&#40;</span>event.<span style="">result</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#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; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &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; &nbsp; private function onGetAllFault<span style="color:#006600; font-weight:bold;">&#40;</span>event:FaultEvent<span style="color:#006600; font-weight:bold;">&#41;</span>:void <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; getOperation<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"getAll"</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="">dispatchEvent</span><span style="color:#006600; font-weight:bold;">&#40;</span>new AsyncOperationErrorEvent<span style="color:#006600; font-weight:bold;">&#40;</span>event.<span style="">fault</span>.<span style="">faultDetail</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#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; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>For testing purposes, we could also create a mock user service:</p>
<div class="igBar"><span id="lcode-29"><a href="#" onclick="javascript:showPlainTxt('code-29'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-29">
<div class="code">
<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;">public class UserMockService extends AbstractService implements IUserService <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &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; &nbsp; private static var logger:ILogger = Log.<span style="">getLogger</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"UserMockService"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &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; &nbsp; public function UserMockService<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; logger.<span style="">warn</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"Mock user service instantiated."</span><span style="color:#006600; font-weight:bold;">&#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; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &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; &nbsp; public function getAll<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>:IAsyncOperation <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; var users:ArrayCollection = new ArrayCollection<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#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; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; var user1:User= new User<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#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; &nbsp; &nbsp; &nbsp; user1.<span style="">name</span> = <span style="color:#CC0000;">"John"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; users.<span style="">addItem</span><span style="color:#006600; font-weight:bold;">&#40;</span>user1<span style="color:#006600; font-weight:bold;">&#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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; var user2:User= new User<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#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; &nbsp; &nbsp; &nbsp; user2.<span style="">name</span> = <span style="color:#CC0000;">"Peter"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; users.<span style="">addItem</span><span style="color:#006600; font-weight:bold;">&#40;</span>user2<span style="color:#006600; font-weight:bold;">&#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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; setTimeout<span style="color:#006600; font-weight:bold;">&#40;</span>onGetUsersResult, Math.<span style="">random</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>*<span style="color:#800000;color:#800000;">3000</span>, users<span style="color:#006600; font-weight:bold;">&#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; &nbsp; &nbsp; &nbsp; &nbsp; CursorManager.<span style="">setBusyCursor</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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; &nbsp; &nbsp; &nbsp; return getOperation<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"getAll"</span><span style="color:#006600; font-weight:bold;">&#41;</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:#006600; font-weight:bold;">&#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; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; private function onGetUsersResult<span style="color:#006600; font-weight:bold;">&#40;</span>users:ArrayCollection<span style="color:#006600; font-weight:bold;">&#41;</span>:void <span style="color:#006600; font-weight:bold;">&#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; &nbsp; &nbsp; var operation:IAsyncOperation = getOperation<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"getAll"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; operation.<span style="">dispatchEvent</span><span style="color:#006600; font-weight:bold;">&#40;</span>new AsyncOperationResultEvent<span style="color:#006600; font-weight:bold;">&#40;</span>users<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#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; &nbsp; &nbsp; &nbsp; CursorManager.<span style="">removeBusyCursor</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</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:#006600; font-weight:bold;">&#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;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>We can now define these objects in the application context as follows:</p>
<div class="igBar"><span id="lcode-30"><a href="#" onclick="javascript:showPlainTxt('code-30'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-30">
<div class="code">
<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;">&lt;object id=<span style="color:#CC0000;">"userService"</span> class=<span style="color:#CC0000;">"UserMockService"</span>/&gt;</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="">or</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;">&lt;object id=<span style="color:#CC0000;">"userService"</span> class=<span style="color:#CC0000;">"UserRemoteObjectService"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;constructor-arg&gt;</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; &nbsp; &nbsp; &lt;object id=<span style="color:#CC0000;">"userRemoteObject"</span> parent=<span style="color:#CC0000;">"remoteObject"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;property name=<span style="color:#CC0000;">"destination"</span> value=<span style="color:#CC0000;">"detectorGroupService"</span> /&gt;</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; &nbsp; &nbsp; &lt;/object&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/constructor-arg&gt;</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;">&lt;/object&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>You can now use one of these implementations by calling the getAll() method. Make sure that you type the service to IUserService and not to a concrete implementation:</p>
<div class="igBar"><span id="lcode-31"><a href="#" onclick="javascript:showPlainTxt('code-31'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-31">
<div class="code">
<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;">public function getUsers<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>:void <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; var operation:IAsyncOperation = _userService.<span style="">getAll</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#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; &nbsp; operation.<span style="">addEventListener</span><span style="color:#006600; font-weight:bold;">&#40;</span>AsyncOperationEvent.<span style="">RESULT</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; function<span style="color:#006600; font-weight:bold;">&#40;</span>e:AsyncOperationResultEvent<span style="color:#006600; font-weight:bold;">&#41;</span>:void <span style="color:#006600; font-weight:bold;">&#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; &nbsp; &nbsp; &nbsp; &nbsp; logger.<span style="">info</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"Users loaded successfully."</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var users:ArrayCollection = ArrayCollection<span style="color:#006600; font-weight:bold;">&#40;</span>e.<span style="">result</span><span style="color:#006600; font-weight:bold;">&#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; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</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:#006600; font-weight:bold;">&#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; &nbsp; operation.<span style="">addEventListener</span><span style="color:#006600; font-weight:bold;">&#40;</span>AsyncOperationEvent.<span style="">ERROR</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; function<span style="color:#006600; font-weight:bold;">&#40;</span>e:AsyncOperationErrorEvent<span style="color:#006600; font-weight:bold;">&#41;</span>:void <span style="color:#006600; font-weight:bold;">&#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; &nbsp; &nbsp; &nbsp; &nbsp; logger.<span style="">error</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"An error occurred when loading the users: "</span> + e.<span style="">fault</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#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; &nbsp; <span style="color:#006600; font-weight:bold;">&#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:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>To implement your own services, you don't necessarely need to extend the AbstractService or AbstractRemoteObjectService class. These base classes just provide you with some convenient methods, like "getOperation" that creates a generic AsyncOperation for you.</p>
<p>You could of course also create an own implementation of the IAsyncOperation interface for your specific needs. For instance, you could create a GetAllUsersOperation that has all the logic for invoking a method on a remote object and that also deals with the result and fault handling of the remote call.</p>
<p><strong>Presentation Model and Autowiring</strong></p>
<p>I mentioned that we were using <a href="http://martinfowler.com/eaaDev/PresentationModel.html">Presentation Model</a> to seperate our UI state and logic from our views. This has worked surprisingly well for us and it certainly allows us to write better tests (for the presentation model). If you are new to Presentation Model and Presentation Patterns in general, I really recommend taking a look at the writings by <a href="http://martinfowler.com/eaaDev/">Martin Fowler</a> and <a href="http://weblogs.macromedia.com/paulw/">Paul Williams</a>.</p>
<p>Seperating logic and state from the view is one thing, but of course in order to use this combination you have to provide your view with an instance of a presentation model at some point. It's easy to read a presentation model from an application context, but injecting it is not that easy. Especially if your view component is nested a few levels deep inside other view components, it can be tricky to pass in the instance of the presentation model. We started of by passing in the presentation models from the root of the application through all components until we had finally reached the component that needed the presentation model. Needless to say that this approach required us to write a lot of extra code that really wasn't supposed to exist...</p>
<p>Enter custom metadata and SystemManager! Using the systemManager, you can listen to events that get fired when view components are added to the stage. This was exactly what we needed to know. Combined with a custom metadata element [Autowired], we now support dependencies being injected into views automatically.</p>
<p>Here's how it works. Suppose you have a UserPanel and a UserPanelPresentationModel. In you UserPanel you'll have a reference to that presentation model so you can actually use it in your view component. By adding the extra [Autowired] metadata you can mark a property (the presentation model) as a property that needs to be autowired when the view is created and added to the stage.</p>
<p>In your UserPanel.mxml file, you declare the presentation model as follows.</p>
<div class="igBar"><span id="lcode-32"><a href="#" onclick="javascript:showPlainTxt('code-32'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-32">
<div class="code">
<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:#006600; font-weight:bold;">&#91;</span>Bindable<span style="color:#006600; font-weight:bold;">&#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:#006600; font-weight:bold;">&#91;</span>Autowired<span style="color:#006600; font-weight:bold;">&#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;">public var presentationModel:UserPanelPresentationModel; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Now all we need to do is listen to the ADDED event on the systemManager and write some glue code that injects the presentation models defined in the application context into the view components. This code goes in your main application file.</p>
<div class="igBar"><span id="lcode-33"><a href="#" onclick="javascript:showPlainTxt('code-33'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-33">
<div class="code">
<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;">import mx.<span style="">utils</span>.<span style="">DescribeTypeCache</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">import mx.<span style="">utils</span>.<span style="">DescribeTypeCacheRecord</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;">...</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="">systemManager</span>.<span style="">addEventListener</span><span style="color:#006600; font-weight:bold;">&#40;</span>Event.<span style="">ADDED</span>, onAdded<span style="color:#006600; font-weight:bold;">&#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;">...</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="">private</span> function onAdded<span style="color:#006600; font-weight:bold;">&#40;</span>event:Event<span style="color:#006600; font-weight:bold;">&#41;</span>:void <span style="color:#006600; font-weight:bold;">&#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; var autowiredObject:Object = event.<span style="">target</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; var typeInfo:DescribeTypeCacheRecord = DescribeTypeCache.<span style="">describeType</span><span style="color:#006600; font-weight:bold;">&#40;</span>autowiredObject<span style="color:#006600; font-weight:bold;">&#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;">&nbsp; for each <span style="color:#006600; font-weight:bold;">&#40;</span>var metaDataNode:XML in typeInfo.<span style="">typeDescription</span>..<span style="">metadata</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#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; if <span style="color:#006600; font-weight:bold;">&#40;</span>metaDataNode.<span style="">attribute</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"name"</span><span style="color:#006600; font-weight:bold;">&#41;</span> == <span style="color:#CC0000;">"Autowired"</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; var propertyNode:XML = metaDataNode.<span style="">parent</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#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; &nbsp; &nbsp; var property:String = propertyNode.@name.<span style="">toString</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; var objectName:String = property;</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; &nbsp; var autowireByType:Boolean = true;</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; &nbsp; &nbsp; for each <span style="color:#006600; font-weight:bold;">&#40;</span>var arg:XML in metaDataNode.<span style="">arg</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; if <span style="color:#006600; font-weight:bold;">&#40;</span>arg.<span style="">attribute</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"value"</span><span style="color:#006600; font-weight:bold;">&#41;</span> == <span style="color:#CC0000;">"byName"</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#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; &nbsp; &nbsp; &nbsp; autowireByType = false;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#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; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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; &nbsp; &nbsp; if <span style="color:#006600; font-weight:bold;">&#40;</span>autowireByType<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; var clazz:Class = ClassUtils.<span style="">forName</span><span style="color:#006600; font-weight:bold;">&#40;</span>propertyNode.@type.<span style="">toString</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#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; &nbsp; &nbsp; &nbsp; var objectNames:Array = m_applicationContext.<span style="">getObjectNamesForType</span><span style="color:#006600; font-weight:bold;">&#40;</span>clazz<span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; if <span style="color:#006600; font-weight:bold;">&#40;</span>objectNames.<span style="">length</span> == <span style="color:#800000;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#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; &nbsp; &nbsp; &nbsp; objectName = objectNames<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#800000;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#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; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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; &nbsp; &nbsp; autowiredObject<span style="color:#006600; font-weight:bold;">&#91;</span>property<span style="color:#006600; font-weight:bold;">&#93;</span> = m_applicationContext.<span style="">getObject</span><span style="color:#006600; font-weight:bold;">&#40;</span>objectName<span style="color:#006600; font-weight:bold;">&#41;</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:#006600; font-weight:bold;">&#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; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>You may have noticed that we do some extra checks on the attributes of the Autowired metadata. This is because the code above support autowiring by type (the default) and autowiring by name. Autowiring by type means that we will look in the context for objects that are of a certain type. If we find one, we will inject it. Autowiring by name means that we will look for objects in the context that have a certain id.</p>
<p>You can set up autowiring by name as follows:</p>
<div class="igBar"><span id="lcode-34"><a href="#" onclick="javascript:showPlainTxt('code-34'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-34">
<div class="code">
<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:#006600; font-weight:bold;">&#91;</span>Bindable<span style="color:#006600; font-weight:bold;">&#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:#006600; font-weight:bold;">&#91;</span>Autowired<span style="color:#006600; font-weight:bold;">&#40;</span>mode=<span style="color:#CC0000;">"byName"</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#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;">public var presentationModel:UserPanelPresentationModel; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>Conclusion</strong></p>
<p>I hope you now got a good understanding of some of the key features, best practices and what we are doing with Spring ActionScript in general. Don't hesitate to join our forum or the team if you want to help us out. We are really looking for more people to join, especially for working on samples and documentation.</p>
<p><a href="http://forum.springframework.org/forumdisplay.php?f=60"></p>
<p>http://forum.springframework.org/forumdisplay.php?f=60</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.herrodius.com/blog/158/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

