<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Espenskogen&#039;s Blog</title>
	<atom:link href="http://espenskogen.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://espenskogen.wordpress.com</link>
	<description>Thoughts on technology</description>
	<lastBuildDate>Wed, 09 Feb 2011 08:39:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='espenskogen.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Espenskogen&#039;s Blog</title>
		<link>http://espenskogen.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://espenskogen.wordpress.com/osd.xml" title="Espenskogen&#039;s Blog" />
	<atom:link rel='hub' href='http://espenskogen.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Encapsulating implementations with Flex and Parsley</title>
		<link>http://espenskogen.wordpress.com/2010/04/01/encapsulating-implementations-with-flex-and-parsley/</link>
		<comments>http://espenskogen.wordpress.com/2010/04/01/encapsulating-implementations-with-flex-and-parsley/#comments</comments>
		<pubDate>Thu, 01 Apr 2010 11:10:47 +0000</pubDate>
		<dc:creator>espenskogen</dc:creator>
				<category><![CDATA[Parsley]]></category>
		<category><![CDATA[RIA Development]]></category>

		<guid isPermaLink="false">http://espenskogen.wordpress.com/?p=53</guid>
		<description><![CDATA[Simple solution to enforce strong encapsulation in Flex4<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=espenskogen.wordpress.com&amp;blog=7635345&amp;post=53&amp;subd=espenskogen&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>On a project I was working on, there was a requirement to encapsulate the implementations in such a way that consumers of the API were forced to program to interfaces rather than implementations. This is a fairly common requirement, and one that is commonly solved in Java using default access rather than public implementations, and public factories to instantiate these.<br />
This has some disadvantages however, namely that you either end up with a number of identical factories, only distinguished by what implementation it instantiates, and the package it&#8217;s living in.</p>
<p>I created a generic factory which instantiates classes using reflection, and then casting the instance to the interface specified. The salient feature looks much like this &#8211; Where implementation Name is the fully qualified class name of the implementation and interfaze is the interface which we want to return the object as.</p>
<pre class="brush: plain;">			var implementation : * = getDefinitionByName(implementationName);
			return interfaze(new implementation());
</pre>
<p>This will then create an instance of the implementation which we can then use parsley to inject in the appropriate places.  This leaves us with the issue that a dev unaware of the pattern could instantiate the implementation directly. There is an easy fix to this. Simply create a custom namespace:</p>
<pre class="brush: plain;">
package some.package.namespaces
{
	public namespace OUR_Namespace_Internal
	{
	}
}
</pre>
<p>and add the following line prior to the class definition of your implementation:</p>
<pre class="brush: plain;">
	use namespace OUR_Namespace_Internal;
	[ExcludeClass]
	public class SomeClass implements SomeInterface {
</pre>
<p>The net result? An implementation that cannot be instantiated unless the consumer explicitely uses our new namespace, and a factory enforcing interface use.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/espenskogen.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/espenskogen.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/espenskogen.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/espenskogen.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/espenskogen.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/espenskogen.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/espenskogen.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/espenskogen.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/espenskogen.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/espenskogen.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/espenskogen.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/espenskogen.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/espenskogen.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/espenskogen.wordpress.com/53/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=espenskogen.wordpress.com&amp;blog=7635345&amp;post=53&amp;subd=espenskogen&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://espenskogen.wordpress.com/2010/04/01/encapsulating-implementations-with-flex-and-parsley/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/02c8642eeb41b8740670fd3bc094487a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">espenskogen</media:title>
		</media:content>
	</item>
		<item>
		<title>Before for loops were invented&#8230;</title>
		<link>http://espenskogen.wordpress.com/2010/03/05/before-for-loops-were-invented/</link>
		<comments>http://espenskogen.wordpress.com/2010/03/05/before-for-loops-were-invented/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 14:11:07 +0000</pubDate>
		<dc:creator>espenskogen</dc:creator>
				<category><![CDATA[RIA Development]]></category>

		<guid isPermaLink="false">http://espenskogen.wordpress.com/?p=49</guid>
		<description><![CDATA[A friend of mine showed me this piece of code, gathered from a project he was working on: else { row.createCell((short)col++).setCellValue(&#34;&#34;); row.createCell((short)col++).setCellValue(&#34;&#34;); row.createCell((short)col++).setCellValue(&#34;&#34;); row.createCell((short)col++).setCellValue(&#34;&#34;); row.createCell((short)col++).setCellValue(&#34;&#34;); row.createCell((short)col++).setCellValue(&#34;&#34;); row.createCell((short)col++).setCellValue(&#34;&#34;); row.createCell((short)col++).setCellValue(&#34;&#34;); row.createCell((short)col++).setCellValue(&#34;&#34;); row.createCell((short)col++).setCellValue(&#34;&#34;); row.createCell((short)col++).setCellValue(&#34;&#34;); row.createCell((short)col++).setCellValue(&#34;&#34;); row.createCell((short)col++).setCellValue(&#34;&#34;); row.createCell((short)col++).setCellValue(&#34;&#34;); row.createCell((short)col++).setCellValue(&#34;&#34;); row.createCell((short)col++).setCellValue(&#34;&#34;); row.createCell((short)col++).setCellValue(&#34;&#34;); row.createCell((short)col++).setCellValue(&#34;&#34;); row.createCell((short)col++).setCellValue(&#34;&#34;); row.createCell((short)col++).setCellValue(&#34;&#34;); row.createCell((short)col++).setCellValue(&#34;&#34;); row.createCell((short)col++).setCellValue(&#34;&#34;); row.createCell((short)col++).setCellValue(&#34;&#34;); row.createCell((short)col++).setCellValue(&#34;&#34;); row.createCell((short)col++).setCellValue(&#34;&#34;); row.createCell((short)col++).setCellValue(&#34;&#34;); row.createCell((short)col++).setCellValue(&#34;&#34;); row.createCell((short)col++).setCellValue(&#34;&#34;); row.createCell((short)col++).setCellValue(&#34;&#34;); row.createCell((short)col++).setCellValue(&#34;&#34;); row.createCell((short)col++).setCellValue(&#34;&#34;); row.createCell((short)col++).setCellValue(&#34;&#34;); row.createCell((short)col++).setCellValue(&#34;&#34;); row.createCell((short)col++).setCellValue(&#34;&#34;); row.createCell((short)col++).setCellValue(&#34;&#34;); [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=espenskogen.wordpress.com&amp;blog=7635345&amp;post=49&amp;subd=espenskogen&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A friend of mine showed me this piece of code, gathered from a project he was working on:</p>
<pre class="brush: plain;">
	else
				{
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
					row.createCell((short)col++).setCellValue(&quot;&quot;);
				}
</pre>
<p>Guess for loops weren&#8217;t invented when this stuff was written&#8230;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/espenskogen.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/espenskogen.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/espenskogen.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/espenskogen.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/espenskogen.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/espenskogen.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/espenskogen.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/espenskogen.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/espenskogen.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/espenskogen.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/espenskogen.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/espenskogen.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/espenskogen.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/espenskogen.wordpress.com/49/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=espenskogen.wordpress.com&amp;blog=7635345&amp;post=49&amp;subd=espenskogen&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://espenskogen.wordpress.com/2010/03/05/before-for-loops-were-invented/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/02c8642eeb41b8740670fd3bc094487a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">espenskogen</media:title>
		</media:content>
	</item>
		<item>
		<title>Injecting dependencies in unit tests</title>
		<link>http://espenskogen.wordpress.com/2009/12/08/injecting-dependencies-in-unit-tests/</link>
		<comments>http://espenskogen.wordpress.com/2009/12/08/injecting-dependencies-in-unit-tests/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 07:37:40 +0000</pubDate>
		<dc:creator>espenskogen</dc:creator>
				<category><![CDATA[RIA Development]]></category>

		<guid isPermaLink="false">http://espenskogen.wordpress.com/?p=37</guid>
		<description><![CDATA[In Parsley, the injection framework is based around the view hierarchy, and Parsley relies on the build in event bubbling in Flash to configure view-components for IOC. But what if you want to wire up a unit test with Parsley instead? The unit test does not sit in the view hierarchy so you can&#8217;t use [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=espenskogen.wordpress.com&amp;blog=7635345&amp;post=37&amp;subd=espenskogen&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In Parsley, the injection framework is based around the view hierarchy, and Parsley relies on the build in event bubbling in Flash to configure view-components for IOC.</p>
<p>But what if you want to wire up a unit test with Parsley instead? The unit test does not sit in the view hierarchy so you can&#8217;t use the configure event or the inject tag I wrote about earlier in the week, because the configure events simply won&#8217;t bubble up to the view manager.</p>
<p>Fortunately there is an easy solution. The Parsley context contains a dynamic context, designed to wire up view components. This is also the right place to wire up the test cases.</p>
<p>Parsley makes this ever so easy, and to wire up your test case, all you need to do is configure the context and add the testcase to the dynamic context.</p>
<pre class="brush: plain;">public class ContextAwareTestCase extends TestCase
{
public var contextClass : Class

override public function setUp() : void
{

var context : Context = FlexContextBuilder.build(contextClass);
context.createDynamicContext().addObject(this);

}

}</pre>
<p>So as you can see, it&#8217;s very easy.  A few gotcha&#8217;s though &#8211; The context must be created in the setup method. This is because the lifecycle of a test case is different than a regular object, so if you try and create the context in the constructor, you&#8217;ll be in a world of pain.</p>
<p>You also want to create the context in the constructor to make sure that any objects you inject into the testcase are in a clean state &#8211; to avoid the old issue of testing singletons, where they change state once you&#8217;ve used them once.</p>
<p>This kind of thing can be useful to inject mock objects for remote objects for example, or if like me, you&#8217;re too lazy to programmatically define dependencies in your test cases;)</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/espenskogen.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/espenskogen.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/espenskogen.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/espenskogen.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/espenskogen.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/espenskogen.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/espenskogen.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/espenskogen.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/espenskogen.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/espenskogen.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/espenskogen.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/espenskogen.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/espenskogen.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/espenskogen.wordpress.com/37/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=espenskogen.wordpress.com&amp;blog=7635345&amp;post=37&amp;subd=espenskogen&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://espenskogen.wordpress.com/2009/12/08/injecting-dependencies-in-unit-tests/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/02c8642eeb41b8740670fd3bc094487a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">espenskogen</media:title>
		</media:content>
	</item>
		<item>
		<title>View injection with Parsley and flex</title>
		<link>http://espenskogen.wordpress.com/2009/12/02/view-injection-with-parsley-and-flex/</link>
		<comments>http://espenskogen.wordpress.com/2009/12/02/view-injection-with-parsley-and-flex/#comments</comments>
		<pubDate>Wed, 02 Dec 2009 17:47:00 +0000</pubDate>
		<dc:creator>espenskogen</dc:creator>
				<category><![CDATA[IOC]]></category>
		<category><![CDATA[Parsley]]></category>
		<category><![CDATA[RIA Development]]></category>

		<guid isPermaLink="false">http://espenskogen.wordpress.com/?p=29</guid>
		<description><![CDATA[Optimize view injection in Parsley by avoiding Configure events<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=espenskogen.wordpress.com&amp;blog=7635345&amp;post=29&amp;subd=espenskogen&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The current parsley implementation is using the configure event to configure views &#8211; This is fine for a small application, but the reflection performed on the view hierarchy is heavy so it&#8217;s not ideal for large projects where performance is an issue.</p>
<p>To address this issue on a project I worked on recently,we created a custom inject tag which will inject the dependencies without performing the full configure on the view component. This works well, because you don&#8217;t really want to be dispatching or handling managed events from the view, and there isn&#8217;t really any reason to use [Init] or [Destroy] on the view either.</p>
<p>So how did we do this? Well, we implemented the tag, which specifies a couple of parameters, namely property and idRef &#8211; Property being the property name you want to inject into and idRef being the ID of the object you want to inject.</p>
<pre class="brush: plain;">
&lt;Inject
property=&quot;someObject&quot;
idRef=&quot;bob&quot;/&gt;</pre>
<p>This tag replaces the configure event or the &lt;Configure/&gt; tag from Parsley.</p>
<p>The implementation is like this:</p>
<pre class="brush: plain;">
package parsley.tags
{
	import flash.events.Event;
	import flash.events.EventDispatcher;

	import mx.core.IMXMLObject;

	import org.spicefactory.parsley.core.context.Context;

	import parsley.event.InjectEvent;

	public class Inject extends EventDispatcher implements IMXMLObject
	{

		public var property : String;
		public var idRef : String;

		private var context : Context;
		private var document : Object;

		public function initialized(document:Object, id:String):void
		{
			if( !property || !idRef ) throw new Error(&quot;Cannot inject unless property and idRef is provided&quot;);
			this.document = document;
			document.addEventListener( Event.ADDED_TO_STAGE, onAddedToStage);
		}

		private function onAddedToStage( event : Event ) : void
		{
			document.dispatchEvent( new InjectEvent( property, idRef ));
		}
	}
}
</pre>
<p>This tag dispatches an Inject event on the view object which bubbles up to the viewManager. We created a custom view manager which listens for the Inject event, and once it&#8217;s caught, it&#8217;s retrieving the object from the context and assigning it to the target of the event.</p>
<pre class="brush: plain;">
package parsley
{
	import flash.display.DisplayObject;
	import flash.system.ApplicationDomain;

	import mx.core.UIComponent;

	import org.spicefactory.parsley.core.context.Context;
	import org.spicefactory.parsley.core.factory.impl.GlobalFactoryRegistry;
	import org.spicefactory.parsley.core.view.impl.DefaultViewManager;

	import parsley.event.InjectEvent;

	public class InjectAwareViewManager extends DefaultViewManager
	{

		protected var parent : Context;

		public function InjectAwareViewManager(context:Context, domain:ApplicationDomain)
		{
			super(context, domain);
			this.parent = context;
		}

		override public function addViewRoot(view:DisplayObject) : void
		{
			view.addEventListener( InjectEvent.INJECT_EVENT, onInject );
		}

		protected function onInject( event : InjectEvent ) : void
		{
			var target : UIComponent = event.target as UIComponent;
			var property : String = event.property;
			var idRef : String = event.idRef;
			if( idRef )
			{
				target[property] = parent.getObject( idRef );
			}
			event.stopImmediatePropagation();
		}
	}
}
</pre>
<p>This is far more performant than the configure tag, and serves the purpose in most view implementations.</p>
<p>To get this to work, you&#8217;d need to create a new ViewManagerFactory which returns the custom viewManager, and register this with the GlobalFactoryRegistry.</p>
<p>Simples, as Alexander from Meerkat.com says&#8230;.</p>
<p>Thanks to Tom Sugden at Adobe for his thoughts on how to do this.</p>
<p>Edit: In Parsley 2.2 this feature is included as the  tag &#8211; Use this rather than a custom implementation if you can.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/espenskogen.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/espenskogen.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/espenskogen.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/espenskogen.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/espenskogen.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/espenskogen.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/espenskogen.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/espenskogen.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/espenskogen.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/espenskogen.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/espenskogen.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/espenskogen.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/espenskogen.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/espenskogen.wordpress.com/29/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=espenskogen.wordpress.com&amp;blog=7635345&amp;post=29&amp;subd=espenskogen&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://espenskogen.wordpress.com/2009/12/02/view-injection-with-parsley-and-flex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/02c8642eeb41b8740670fd3bc094487a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">espenskogen</media:title>
		</media:content>
	</item>
		<item>
		<title>Windows 7 playing catchup&#8230;</title>
		<link>http://espenskogen.wordpress.com/2009/09/26/windows-7-playing-catchup/</link>
		<comments>http://espenskogen.wordpress.com/2009/09/26/windows-7-playing-catchup/#comments</comments>
		<pubDate>Sat, 26 Sep 2009 07:42:34 +0000</pubDate>
		<dc:creator>espenskogen</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Operating systems]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://espenskogen.wordpress.com/?p=14</guid>
		<description><![CDATA[I&#8217;ve been evaluating windows 7 over the last few days, and found this feature, which I thought I&#8217;d share. I suspect most of you will recognize the similarity to the sticky notes which were released in Mac OS 7.5, around 1994.        And who said Microsoft didn&#8217;t imitate Apple?!<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=espenskogen.wordpress.com&amp;blog=7635345&amp;post=14&amp;subd=espenskogen&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span id="more-14"></span>I&#8217;ve been evaluating windows 7 over the last few days, and found this feature, which I thought I&#8217;d share. I suspect most of you will recognize the similarity to the sticky notes which were released in Mac OS 7.5, around 1994.</p>
<p style="padding-left:60px;"><img class="alignnone size-medium wp-image-22" title="stickyNotes in Windows 7" src="http://espenskogen.files.wordpress.com/2009/09/stickynotes1.png?w=190&#038;h=300" alt="stickyNotes in Windows 7" width="190" height="300" />     <img src="http://upload.wikimedia.org/wikipedia/en/thumb/3/35/Stickies_1.0.4_on_Mac_OS_9.2.2.png/250px-Stickies_1.0.4_on_Mac_OS_9.2.2.png" alt="Stick notes on Mac OS 9.2.2" width="250" height="188" /></p>
<div class="mceTemp"> </div>
<p>And who said Microsoft didn&#8217;t imitate Apple?!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/espenskogen.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/espenskogen.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/espenskogen.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/espenskogen.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/espenskogen.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/espenskogen.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/espenskogen.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/espenskogen.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/espenskogen.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/espenskogen.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/espenskogen.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/espenskogen.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/espenskogen.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/espenskogen.wordpress.com/14/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=espenskogen.wordpress.com&amp;blog=7635345&amp;post=14&amp;subd=espenskogen&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://espenskogen.wordpress.com/2009/09/26/windows-7-playing-catchup/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/02c8642eeb41b8740670fd3bc094487a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">espenskogen</media:title>
		</media:content>

		<media:content url="http://espenskogen.files.wordpress.com/2009/09/stickynotes1.png?w=190" medium="image">
			<media:title type="html">stickyNotes in Windows 7</media:title>
		</media:content>

		<media:content url="http://upload.wikimedia.org/wikipedia/en/thumb/3/35/Stickies_1.0.4_on_Mac_OS_9.2.2.png/250px-Stickies_1.0.4_on_Mac_OS_9.2.2.png" medium="image">
			<media:title type="html">Stick notes on Mac OS 9.2.2</media:title>
		</media:content>
	</item>
		<item>
		<title>More DPHibernate</title>
		<link>http://espenskogen.wordpress.com/2009/06/04/more-dphibernate/</link>
		<comments>http://espenskogen.wordpress.com/2009/06/04/more-dphibernate/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 13:03:55 +0000</pubDate>
		<dc:creator>espenskogen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[DPHibernate]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[RIA]]></category>

		<guid isPermaLink="false">http://espenskogen.wordpress.com/2009/06/04/more-dphibernate/</guid>
		<description><![CDATA[It appears a colleague has been looking at the exact same issue as I was looking at, albeit from another angle. Have a look at his blog, and see how he&#8217;s got on with dpHibernate: http://martypitt.wordpress.com/2009/05/28/dphibernate-and-spring-transactions/<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=espenskogen.wordpress.com&amp;blog=7635345&amp;post=9&amp;subd=espenskogen&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>It appears a colleague has been looking at the exact same issue as I was looking at, albeit from another angle.<br />
Have a look at his blog, and see how he&#8217;s got on with dpHibernate:</p>
<p><a title="Marty Pitt's blog" href="http://martypitt.wordpress.com/2009/05/28/dphibernate-and-spring-transactions/" target="_blank">http://martypitt.wordpress.com/2009/05/28/dphibernate-and-spring-transactions/</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/espenskogen.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/espenskogen.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/espenskogen.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/espenskogen.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/espenskogen.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/espenskogen.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/espenskogen.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/espenskogen.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/espenskogen.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/espenskogen.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/espenskogen.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/espenskogen.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/espenskogen.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/espenskogen.wordpress.com/9/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=espenskogen.wordpress.com&amp;blog=7635345&amp;post=9&amp;subd=espenskogen&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://espenskogen.wordpress.com/2009/06/04/more-dphibernate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/02c8642eeb41b8740670fd3bc094487a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">espenskogen</media:title>
		</media:content>
	</item>
		<item>
		<title>Transaction boundaries in Spring with BlazeDS</title>
		<link>http://espenskogen.wordpress.com/2009/05/05/transaction-boundries-in-spring-with-blazeds/</link>
		<comments>http://espenskogen.wordpress.com/2009/05/05/transaction-boundries-in-spring-with-blazeds/#comments</comments>
		<pubDate>Tue, 05 May 2009 23:27:02 +0000</pubDate>
		<dc:creator>espenskogen</dc:creator>
				<category><![CDATA[RIA Development]]></category>
		<category><![CDATA[BlazeDS]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Hibernate]]></category>
		<category><![CDATA[Spring]]></category>

		<guid isPermaLink="false">http://espenskogen.wordpress.com/?p=3</guid>
		<description><![CDATA[Hi all, and welcome to my first blog post on wordpress. I was working on a RIA recently using BlazeDS and Spring with Hibernate3, and sure enough, I came across the issue of the transaction having ended before the entity was fully loaded. Using JPA this is a bit of a problem because it is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=espenskogen.wordpress.com&amp;blog=7635345&amp;post=3&amp;subd=espenskogen&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Hi all, and welcome to my first blog post on wordpress.</p>
<p>I was working on a RIA recently using BlazeDS and Spring with Hibernate3, and sure enough, I came across the issue of the transaction having ended before the entity was fully loaded. Using JPA this is a bit of a problem because it is very difficult to get Hibernate to use Eager fetching on anything but a single collection in your object hierarchy. Sure enough, this turned out to be a requirement, so I started looking for solutions.</p>
<p>For the time being I simply implemented the &#8216;OpenEntityManagerInView&#8217; filter. What does it do? It simply manages the transaction boundries so that Hibernate entities are available within servlets, JSP pages&#8230; And within Blaze&#8217;s serializer. (Since Blaze is implemented as a servlet, it makes it all relatively easy.)</p>
<p>So easy enough fix &#8211; All that was required was</p>
<p><code>&lt;filter&gt;<br />
&lt;filter-name&gt;hibernateFilter&lt;/filter-name&gt;<br />
&lt;filter-class&gt;<br />
org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter<br />
&lt;/filter-class&gt;<br />
&lt;/filter&gt;</code></p>
<p>and an appropriate filter mapping, and problem was solved. This might seem like a basic Spring feature to most of you, however &#8211; And this is indeed not why I&#8217;m posting all this.</p>
<p>In the process of solving this problem I came across an opensource project called DPHibernate (<a href="http://code.google.com/p/dphibernate/" target="_blank">http://code.google.com/p/dphibernate/</a>), and this project goes some way towards addressing the lazy loading issue with Hibernate and Flex Remote Objects.  In summary, it seems to allow the persistenceBag proxies in the lazy hibernate objects to be serialized in their own rights, and that the library will then manage the loading when flex accesses the lazy objects.</p>
<p>This is excellent news, as this kind of thing was a pain to do in the past. Haven&#8217;t managed to test this yet, but when I do, I believe it will deserve another post.</p>
<p>To be continued.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/espenskogen.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/espenskogen.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/espenskogen.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/espenskogen.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/espenskogen.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/espenskogen.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/espenskogen.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/espenskogen.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/espenskogen.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/espenskogen.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/espenskogen.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/espenskogen.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/espenskogen.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/espenskogen.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=espenskogen.wordpress.com&amp;blog=7635345&amp;post=3&amp;subd=espenskogen&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://espenskogen.wordpress.com/2009/05/05/transaction-boundries-in-spring-with-blazeds/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/02c8642eeb41b8740670fd3bc094487a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">espenskogen</media:title>
		</media:content>
	</item>
	</channel>
</rss>
