<?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>blog.solutionswaizu.com</title>
	<atom:link href="http://blog.solutionswaizu.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.solutionswaizu.com</link>
	<description></description>
	<lastBuildDate>Tue, 01 Jun 2010 18:17:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>The Big Switch: Rewiring the World, from Edison to Google</title>
		<link>http://blog.solutionswaizu.com/2010/06/01/the-big-switch-rewiring-the-world-from-edison-to-google/</link>
		<comments>http://blog.solutionswaizu.com/2010/06/01/the-big-switch-rewiring-the-world-from-edison-to-google/#comments</comments>
		<pubDate>Tue, 01 Jun 2010 18:17:59 +0000</pubDate>
		<dc:creator>Sylvain</dc:creator>
				<category><![CDATA[Books]]></category>

		<guid isPermaLink="false">http://blog.solutionswaizu.com/?p=203</guid>
		<description><![CDATA[If you’re looking to a highly entertaining book, make sure to get your hands on this one. The Author gives a history lesson, an optimistic look on the rapid pace of technology innovation and gives an excellent insight into the future we can expect if present trends continue. This book will provide a good past [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://amzn.to/a7K9EJ"><img class="size-full wp-image-205 alignleft" style="padding-right: 20px;" src="http://blog.solutionswaizu.com/wordpress/wp-content/uploads/2010/06/bigswitch.jpg" alt="bigswitch" width="105" height="149" /></a></p>
<p>If you’re looking to a highly entertaining book, make sure to get your hands on this one. The Author gives a history lesson, an optimistic look on the rapid pace of technology innovation and gives an excellent insight into the future we can expect if present trends continue.<br />
<span id="more-203"></span><br />
This book will provide a good past history and an idea of what could be coming. I believe this is a must read for serious IT professionals and even business people who want to stay ahead of the competition.</p>
<p>A special thank you to <a href="http://www.ovologic.com">Nicolas Roberge</a> for suggesting me this wonderful reading.</p>
<p><strong> The Big Switch: Rewiring the World, from Edison to Google</strong><br />
<strong>Author</strong>: Nicholas Carr<br />
<strong>Link</strong>: http://amzn.to/a7K9EJ</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.solutionswaizu.com/2010/06/01/the-big-switch-rewiring-the-world-from-edison-to-google/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Everything you know about CSS is wrong!</title>
		<link>http://blog.solutionswaizu.com/2009/04/06/everything-you-know-about-css-is-wrong/</link>
		<comments>http://blog.solutionswaizu.com/2009/04/06/everything-you-know-about-css-is-wrong/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 20:44:47 +0000</pubDate>
		<dc:creator>Sylvain</dc:creator>
				<category><![CDATA[Books]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://blog.solutionswaizu.com/?p=190</guid>
		<description><![CDATA[For theses of you who are struggling, like me, trying to deliver pixel perfect web site. That keeps trying to render exactly the same web page in IE6, IE7, Firefox, Safari. Then you should take a look at this book. This book draws a nice history line of CSS. From the dream to the nightmare [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://tiny.pl/zqrx" target="_blank"><img class="alignleft size-full wp-image-192" style="padding-right: 10px;" title="everythingyouknowabou-cssiswrong1" src="http://blog.solutionswaizu.com/wordpress/wp-content/uploads/2009/04/everythingyouknowabou-cssiswrong1.jpg" alt="everythingyouknowabou-cssiswrong1" width="115" height="151" /></a></p>
<p>For theses of you who are struggling, like me, trying to deliver<br />
pixel perfect web site. That keeps trying to render exactly the same web page in<br />
IE6, IE7, Firefox, Safari. Then you should take a look at this book.<br />
<span id="more-190"></span><br />
This book draws a nice history line of CSS. From the dream to the nightmare and<br />
from the nightmare to a possible CSS heaven.</p>
<p>With the arrival of IE8, the author takes you to a tour of CSS2.1 and CSS3, and demonstrates how the table layout can help us design in a more standard way, without the pain caused by the browser&#8217;s war.</p>
<p><strong>Author</strong>: Rachel Andrew<strong><br />
Publisher:</strong> SitePoint<br />
<strong><a href="http://tiny.pl/zqrx" target="_blank">Link to Amazon</a> </strong></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.solutionswaizu.com/2009/04/06/everything-you-know-about-css-is-wrong/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How to obtain a target object from an AOP proxy in Spring</title>
		<link>http://blog.solutionswaizu.com/2009/01/28/how-to-obtain-a-target-object-from-an-aop-proxy-in-spring/</link>
		<comments>http://blog.solutionswaizu.com/2009/01/28/how-to-obtain-a-target-object-from-an-aop-proxy-in-spring/#comments</comments>
		<pubDate>Wed, 28 Jan 2009 18:21:25 +0000</pubDate>
		<dc:creator>Sylvain</dc:creator>
				<category><![CDATA[AOP]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Spring]]></category>

		<guid isPermaLink="false">http://blog.solutionswaizu.com/?p=179</guid>
		<description><![CDATA[Have you ever been in a situation or you need to access the target object, proxied by Spring AOP or CGLIB ? Yes? Check out this obscure Interface that I&#8217;ve found in the Spring API: org.springframework.aop.framework.Advised Any AOP proxy obtained from Spring can be cast to this interface to allow manipulation of its AOP advice. [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever been in a situation or you need to access the target object, proxied by Spring AOP or CGLIB ?<br />
Yes?</p>
<p>Check out this obscure Interface that I&#8217;ve found in the Spring API:<br />
<strong><a title="org.springframework.aop.framework.Advised" href="http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/aop/framework/Advised.html" target="_blank">org.springframework.aop.framework.Advised</a></strong></p>
<p>Any AOP proxy obtained from Spring can be cast to this interface to  allow manipulation of its AOP advice. With this in mind, you can track down the target object, and get the information you need.</p>
<p>Here&#8217;s an example:</p>
<p><em>Object myBean = yourSpringContext.getBean(beanName);<br />
if(myBean instanceof Advised){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Advised advised = (Advised) actionBean;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Get the target object: The proxied object<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Object myObject = advised.getTargetSource().getTarget();<br />
}</em></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.solutionswaizu.com/2009/01/28/how-to-obtain-a-target-object-from-an-aop-proxy-in-spring/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Synchronizer Token Pattern in Struts</title>
		<link>http://blog.solutionswaizu.com/2009/01/19/synchronizer-token-pattern-in-struts/</link>
		<comments>http://blog.solutionswaizu.com/2009/01/19/synchronizer-token-pattern-in-struts/#comments</comments>
		<pubDate>Mon, 19 Jan 2009 19:10:59 +0000</pubDate>
		<dc:creator>Sylvain</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Struts]]></category>

		<guid isPermaLink="false">http://blog.solutionswaizu.com/?p=168</guid>
		<description><![CDATA[The main problem that this pattern is trying to solve is the double submissions of forms. For example, look at this list of event that can lead to a double submission. Clicking more than once on a submit control Using Refresh button Using the browser back button to resubmit form Using Browser history feature and [...]]]></description>
			<content:encoded><![CDATA[<p>The main problem that this pattern is trying to solve is the double submissions of forms.<br />
For example, look at this list of event that can lead to a double submission.</p>
<ul>
<li>Clicking more than once on a submit control</li>
<li>Using Refresh button</li>
<li>Using the browser back button to resubmit form</li>
<li>Using Browser history feature and re-submit form.</li>
<li>Malicious submissions to the server</li>
</ul>
<p><span id="more-168"></span><strong>How this work </strong></p>
<p>The concept basically works around the fact that struts assigns tokens to each page it serves and expecting those token back.</p>
<p>From the book, <a title="Sun Core J2EE Patterns" href="http://www.amazon.com/Core-J2EE-Patterns-Practices-Strategies/dp/0131422464/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1232389835&amp;sr=8-1" target="_blank">Sun Core J2EE Patterns</a>:</p>
<p>When that form is submitted, the synchronizer token in the form is compared<br />
to the synchronizer token in the session. The tokens should match the first<br />
time the form is submitted. If the tokens do not match, then the form submission<br />
can be disallowed and an error returned to the user.</p>
<p>On the other hand, if the two token values match, then we are confident that<br />
the flow of control is exactly as expected. At this point, the token value in the session<br />
is modified to a new value and the form submission is accepted.</p>
<p><strong>Struts implementation</strong></p>
<p>The token pattern basically works around the following 3 methods, which can be used within any Action Class:</p>
<p><strong>saveToken(HttpServletRequest req)</strong><br />
The method generates a random token using session id, current time and a MessageDigest and stores it in the session using a key name org.apache.struts.action.TOKEN (org.apache.struts.Globals.TRANSACTION_TOKEN_KEY)</p>
<p>In the JSP, you have to use the token as a hidden form field as follows:<br />
<em>&lt;c:set var=&#8221;tokenValue&#8221; value=&#8221;${sessionScope['org.apache.struts.action.TOKEN']}&#8221;<br />
scope=&#8221;request&#8221; /&gt;</em></p>
<p><em>&lt;input type=&#8221;hidden&#8221; name=&#8221;&lt;%=org.apache.struts.taglib.html.Constants.TOKEN_KEY%&gt;&#8221;</em><em><br />
value=&#8221;&lt;%= tokenValue %&gt;&#8221;&gt;</em></p>
<p><strong>isTokenValid(HttpServletRequest req)</strong><br />
compares the users session token with the token given as a request parameter through hidden form field.</p>
<p><strong>resetToken(HttpServletRequest req)</strong><br />
removes the token from the session.</p>
<p>Typically when a Struts action is going to forward to a page that will post information the action will call <em>Action.saveToken(HttpServletRequest).</em></p>
<p>When the client submits the form, the hidden field is also submitted. In the Action that handles the form submission, the token in the form submission is compared with the token in the session by using the isTokenValid() method.  The method compares the two tokens and returns true, if both are same (Be sure to pass reset=&#8221;true&#8221; in the isTokenValid() method to clear the token from session after comparison).</p>
<p>If the two tokens are equal, the form was submitted for the first time and you can go forward to process the information submitted. However, if the two tokens do not match or if there is no token in the session, then it is a duplicate submission. You should handle it in a way that is acceptable to your users.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.solutionswaizu.com/2009/01/19/synchronizer-token-pattern-in-struts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IPhone: The Holy Grail ?!?</title>
		<link>http://blog.solutionswaizu.com/2008/08/22/iphone-the-holy-grail/</link>
		<comments>http://blog.solutionswaizu.com/2008/08/22/iphone-the-holy-grail/#comments</comments>
		<pubDate>Fri, 22 Aug 2008 12:46:56 +0000</pubDate>
		<dc:creator>Sylvain</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://blog.solutionswaizu.com/?p=153</guid>
		<description><![CDATA[Since a week I’m a proud owner of a brand new IPhone 3G. Having a traditional cell phone since at least 10 years, switching to a mobile device that have a complete different design concept was a shock at first. The first question I was asking myself was: “What are you going to do with [...]]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal"><a class="thickbox" href="http://blog.solutionswaizu.com/wordpress/wp-content/gallery/blog/apple-iphone_0.jpg"><img class="alignleft" style="border: 0pt none; margin-left: 10px; margin-right: 10px;" src="http://blog.solutionswaizu.com/wordpress/wp-content/gallery/blog/apple-iphone_0.jpg" alt="apple-iphone_0.jpg" width="150" height="200" /></a><span lang="EN-CA">Since a week I’m a proud owner of a brand new IPhone 3G.</span></p>
<p class="MsoNormal"><span lang="EN-CA">Having a traditional cell phone since at least 10 years, switching to a mobile device that have a complete different design concept was a shock at first.</span></p>
<p>The first question I was asking myself was: “What are you going to do with this, just make some call ?!? Do you really need all that fluff!!” and the geekie answer was obvious: “Hell Ya!!!”</p>
<p><span style="font-size: 12pt; font-family: &quot;Times New Roman&quot;;">The iPhone is a smart phone and use state of the art technology which is extremely user friendly.</span></p>
<p><span id="more-153"></span></p>
<p><strong></strong></p>
<p><strong>Interactive Voice Mail</strong></p>
<p><a href="http://blog.solutionswaizu.com/wordpress/wp-content/gallery/blog/iphone-visual-voicemail.jpg"><img class="alignleft" style="border: 0pt none; margin-left: 12px; margin-right: 12px;" src="http://blog.solutionswaizu.com/wordpress/wp-content/gallery/blog/thumbs/thumbs_iphone-visual-voicemail.jpg" alt="iphone-visual-voicemail.jpg" width="100" height="75" /></a>The feature I like the most is the voice mail. The time that you need to listen to all your saved voice mails to get to the one that was important is now over. With the IPhone, all the voice messages are displayed like a list of sms (text message). You only need to select the one that you’re interested in and touch play !! Isn’t great!!</p>
<p><strong>Integration with the web</strong></p>
<p>I was searching a phone number in the yellow pages from the Safari web browser.<br />
After some research, I finally found the phone number I was looking for. In the result list, all phone number is an anchor. At my surprise, after clicking the link, the phone asks me if I want to dial it or not!! Wow, that’s a time saver!!!</p>
<p>The user can access the Safari Internet browser which comes with a zoom facility which is activated by the user simply tapping the multi touch screen.</p>
<p><strong>Cool stuff</strong></p>
<p>The iPhone automatically knows when the user lifts the phone to their ear to use and will switch off the display to prevent any touch controls being selected in error and by the fact end your call.</p>
<p class="MsoNormal"><span lang="EN-US">You have the option of moving around all applications icon in the way you want, even span on several screens.</span><span lang="EN-CA"></span></p>
<p class="MsoNormal"><strong><span lang="EN-CA">Contact List</span></strong></p>
<p class="MsoNormal"><span lang="EN-CA">Every phone has a contact list that you can manage and configure photo, ring tone and everything. For a single contact, you can enter any phone number, any email, web site and even a photo that you can take on the spot if the person is willing to let you take it. </span></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.solutionswaizu.com/2008/08/22/iphone-the-holy-grail/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Defining Advice</title>
		<link>http://blog.solutionswaizu.com/2008/08/21/defining-advice/</link>
		<comments>http://blog.solutionswaizu.com/2008/08/21/defining-advice/#comments</comments>
		<pubDate>Thu, 21 Aug 2008 18:25:04 +0000</pubDate>
		<dc:creator>Sylvain</dc:creator>
				<category><![CDATA[AOP]]></category>
		<category><![CDATA[Spring]]></category>

		<guid isPermaLink="false">http://blog.solutionswaizu.com/?p=126</guid>
		<description><![CDATA[Advice will be executed before, after and even around a method that have been selected by a pointcut. In this discussion, I will show you how to define Advice in various Again, for the purpose of my post, consider that I use AOP annotations. Advice Type Advice comes in many flavours. I will explain in [...]]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal"><span lang="EN-CA">Advice will be executed <strong>before</strong>, <strong>after</strong> and even <strong>around</strong> a method that have been selected by a pointcut. In this discussion, I will show you how to define Advice in various</span></p>
<p class="MsoNormal"><span lang="EN-US"> Again, for the purpose of my post, consider that I use AOP annotations.</span></p>
<p class="MsoNormal"><span lang="EN-CA"> </span><strong><span style="font-size: 13pt; font-family: Arial;">Advice Type</span></strong></p>
<p class="MsoNormal"><span lang="EN-CA">Advice comes in many flavours. I will explain in detail and demonstrate the differences that exist between them. Here’s the list that Spring AOP support.</span></p>
<ul>
<li><span lang="EN-CA">Before</span></li>
<li><span lang="EN-CA">After</span></li>
<li><span lang="EN-CA">After returning</span></li>
<li><span lang="EN-CA">After throwing</span></li>
<li><span lang="EN-CA">Around</span></li>
</ul>
<p><span id="more-126"></span></p>
<hr /><strong>Before Advice</strong></p>
<p>If defined, this advice will be executed BEFORE the method that has been selected by a pointcut.\</p>
<p><a class="thickbox" href="http://blog.solutionswaizu.com/wordpress/wp-content/gallery/blog/beforeadvice.jpg"><img class="ngg-singlepic ngg-none" src="http://blog.solutionswaizu.com/wordpress/wp-content/gallery/blog/beforeadvice.jpg" alt="beforeadvice.jpg" width="495" height="299" /></a></p>
<p><span style="color: #ff99cc;"><span style="text-decoration: underline;"><em>Annotation</em></span></span><br />
@Before(POINTCUT_EXPRESSION OR NAMED_POINTCUT)</p>
<p><span style="color: #ff99cc;"><span style="text-decoration: underline;"><em>Example</em></span></span></p>
<p>// With pointcut expression<br />
@Before(&#8220;execution(* com.xyz.service.*(..))&#8221;)<br />
public void doMyBeforeAdvice(){<br />
&#8230;<br />
}</p>
<p>// With pointcut expression<br />
@Pointcut(&#8220;execution(void Spring.MyClass.*Action(..))&#8221;)<br />
public void myPointcutExp(){}</p>
<p>@Before(&#8220;myPointcutExpr()&#8221;)<br />
public void doMyBeforeAdvice(){<br />
&#8230;<br />
}</p>
<hr /><strong>After Advice</strong></p>
<p>If defined, this advice will be executed AFTER the method that has been selected by a pointcut. This kind of Advice works exactly like the finally in a TRY/CATCH block.<br />
It will be execute regardless of the return condition (normal or exception).</p>
<p><a class="thickbox" href="http://blog.solutionswaizu.com/wordpress/wp-content/gallery/blog/afteradvice.jpg"><img class="ngg-singlepic ngg-none" src="http://blog.solutionswaizu.com/wordpress/wp-content/gallery/blog/afteradvice.jpg" alt="afteradvice.jpg" width="506" height="263" /></a></p>
<p><span style="color: #ff99cc;"><span style="text-decoration: underline;"><em><span>Annotation</span></em></span></span><br />
@After(POINTCUT_EXPRESSION OR NAMED_POINTCUT)</p>
<p><span style="color: #ff99cc;"><span style="text-decoration: underline;"><span><em>Example</em></span></span></span></p>
<p>// With pointcut expression<br />
@After(&#8220;execution(* com.xyz.service.*(..))&#8221;)<br />
public void doMyAfterAdvice(){<br />
&#8230;<br />
}</p>
<hr /><strong>After Returning</strong></p>
<p>This kind of advice will only be executed in the case of a successful return (no exception)</p>
<p><a class="thickbox" href="http://blog.solutionswaizu.com/wordpress/wp-content/gallery/blog/afterreturningadvice.jpg"><img class="ngg-singlepic ngg-none" src="http://blog.solutionswaizu.com/wordpress/wp-content/gallery/blog/afterreturningadvice.jpg" alt="afterreturningadvice.jpg" width="522" height="281" /></a></p>
<p><span style="color: #ff99cc;"><span style="text-decoration: underline;">Annotation</span></span><br />
@After(POINTCUT_EXPRESSION OR NAMED_POINTCUT)<br />
@After(pointcut=&#8221;POINTCUT_EXPRESSION OR NAMED_POINTCUT&#8221;,<br />
returning=&#8221;RETURN_VALUE_PARAM_NAME&#8221;)</p>
<p><span style="color: #ff99cc;"><span style="text-decoration: underline;">Example</span></span><br />
// With pointcut expression<br />
@ AfterReturning (&#8220;execution(* com.xyz.service.*(..))&#8221;)<br />
public void doMyAfterReturningAdvice(){<br />
&#8230;<br />
}</p>
<p>// With pointcut expression<br />
// <strong>pointcut: </strong>to associate a pointcut<br />
// <strong>throwing: </strong>give you access to the actual object returned by the target method<br />
// Using the returning parameter, your advice method must have a parameter<br />
// matching the name of the returning value.<br />
@ AfterReturning (pointcut=&#8221;execution(* com.xyz.service.*(..))&#8221;,<br />
returning=&#8221;<strong>retValue</strong>&#8221; )<br />
public void doMyAfterReturningAdvice(String <strong>retValue</strong>){<br />
&#8230;<br />
}</p>
<hr /><strong>After Throwing</strong></p>
<p>This kind of advice will only be when a method, which has been selected by a pointcut, throws an exception.</p>
<p><a class="thickbox" href="http://blog.solutionswaizu.com/wordpress/wp-content/gallery/blog/afterthrowingadvice.jpg"><img class="ngg-singlepic ngg-none" src="http://blog.solutionswaizu.com/wordpress/wp-content/gallery/blog/afterthrowingadvice.jpg" alt="afterthrowingadvice.jpg" width="518" height="281" /></a></p>
<p><span style="color: #ff99cc;"><span style="text-decoration: underline;">Annotation</span></span><br />
@ AfterThrowing (POINTCUT_EXPRESSION OR NAMED_POINTCUT)<br />
@ AfterThrowing (pointcut=&#8221;POINTCUT_EXPRESSION OR NAMED_POINTCUT&#8221;,<br />
throwing =&#8221;EXCEPTION_THROWN&#8221;)</p>
<p><span style="color: #ff99cc;"><span style="text-decoration: underline;">Example</span></span><br />
// With pointcut expression<br />
@ AfterThrowing (&#8220;execution(* com.xyz.service.*(..))&#8221;)<br />
public void doMyAfterThrowing Advice(){<br />
&#8230;<br />
}</p>
<p>// With annotation parameters<br />
// <strong>pointcut: </strong>to associate a pointcut<br />
// <strong>throwing: </strong>give you access to the actual exception object that was thrown<br />
// Using the throwing parameter, your advice method must have a parameter<br />
// matching the name of the throwing value.<br />
@ AfterThrowing (pointcut=&#8221;execution(* com.xyz.service.*(..))&#8221;,<br />
throwing =&#8221;<strong>myEx</strong>&#8221; )<br />
public void doMyAfterThrowingAdvice(String <strong>myEx</strong>){<br />
&#8230;<br />
}</p>
<hr /><strong>Around</strong></p>
<p>I’m pretty sure; you guessed the meaning of this one. This advice will be executed before and after the method that has been selected by a pointcut. In fact, it’s the only advice that gives you the control over the target method execution. With great power there must also come — great responsibility!</p>
<p>How a single Advice can be called before and after a method ?! Simple !<br />
You have the responsibility to call yourself the target method (See example section).</p>
<p>You must define the first parameter of type ProceedingJoinPoint. This is mandatory when defining an Around advice. From this parameter you’ll be able to execute the proceed() method that will call the target method being advice.</p>
<p>The value return by the Around advice will be the return value for the caller method.</p>
<p><a class="thickbox" href="http://blog.solutionswaizu.com/wordpress/wp-content/gallery/blog/aroundadvice.jpg"><img class="ngg-singlepic ngg-none" src="http://blog.solutionswaizu.com/wordpress/wp-content/gallery/blog/aroundadvice.jpg" alt="aroundadvice.jpg" width="514" height="306" /></a></p>
<p><span style="color: #ff99cc;"><span style="text-decoration: underline;">Annotation</span></span><br />
@ Around (POINTCUT_EXPRESSION OR NAMED_POINTCUT)</p>
<p><span style="color: #ff99cc;"><span style="text-decoration: underline;">Example</span></span><br />
// With pointcut expression<br />
@ Around (&#8220;execution(* com.xyz.service.*(..))&#8221;)<br />
public void doMyAroundAdvice(<strong>ProceedingJoinPoint jp</strong>){<br />
&#8230;<br />
}</p>
<hr /><strong>Advice Ordering</strong></p>
<p>Multiple advices can be selected to perform execution for the same jointpoint at the same time. Two cases can be observe using Spring AOP.</p>
<ul>
<li>2 Advices defined in two DIFFERENT Aspect<br />
Execution undefined unless the Aspect implements the Ordered interface (org.springframework.core.Ordered) or annotate the Aspect with the Order annotation.</p>
<p>In this case, the Aspect returning the lower value will have precedence.</li>
</ul>
<ul>
<li>2 Advices defined in the SAME Aspect<br />
Execution undefined. The only way to resolve this issue is to fragment the Aspect in two. This way you’ll be able to use the Order mechanism explained above.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.solutionswaizu.com/2008/08/21/defining-advice/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Defining Pointcuts</title>
		<link>http://blog.solutionswaizu.com/2008/07/27/defining-pointcuts/</link>
		<comments>http://blog.solutionswaizu.com/2008/07/27/defining-pointcuts/#comments</comments>
		<pubDate>Mon, 28 Jul 2008 02:55:58 +0000</pubDate>
		<dc:creator>Sylvain</dc:creator>
				<category><![CDATA[AOP]]></category>
		<category><![CDATA[Spring]]></category>

		<guid isPermaLink="false">http://blog.solutionswaizu.com/?p=26</guid>
		<description><![CDATA[Pointcut nomenclature Like I said in my post about Core AOP Concepts, Pointcut represent: An expression that select one or more joint points. In other words, pointcut select joint point that will be advised by an aspect and when the application reaches a join point, advice on that join point may run. Now, I’ll explain [...]]]></description>
			<content:encoded><![CDATA[<h3><span style="color: #ff0000;">Pointcut nomenclature</span></h3>
<p>Like I said in my post about Core AOP Concepts, Pointcut represent:</p>
<p>An expression that select one or more joint points. In other words, pointcut select joint point that will be advised by an aspect and when the application reaches a join point, advice on that join point may run.</p>
<p>Now, I’ll explain how pointcut actually works and how we can define it.<br />
For the purpose of my post, consider that I use AOP annotations.</p>
<p><strong>Important</strong></p>
<p>Protected and private methods are not intercepted; pointcut will be matched against public methods only!</p>
<p>Pointcut have two important parts that we’ll look in the next points.<br />
<span id="more-26"></span><em>POINTCUT_TYPE (EXPRESSION)</em></p>
<h3><span style="color: #ff99cc;">POINTCUT EXPRESSION</span></h3>
<p>The pointcut expression is a pattern that will decide which joint point will be select.<br />
The expression is composing of many parts.</p>
<p><em>POINTCUT_TYPE ([Modifiers?] returnType [ClassType?] MethodName ([Arguments])<br />
[throws ExceptionType]?)</em></p>
<ul>
<li> Modifiers (public, static, …)</li>
<li> Return Type (void, int , Object, …)</li>
<li> ClassType (Package, class name)</li>
<li> Method name</li>
<li> Input Parameter (..) or (*)</li>
<li>Throws</li>
</ul>
<p>&nbsp;&nbsp;</p>
<h3><span style="color: #ff99cc;">Wildcard</span></h3>
<p>In the Arguments part of the expression, theses wildcards can be used:</p>
<p>*: (1) represent exactly one parameter of any kind<br />
.. : (O:N) parameters</p>
<p>In the ClassType part of the expression, theses wildcards can be used:</p>
<p>*: represent anything (com.xyz.service.* [Any joint point in the service package])<br />
.. : represent sub-package (com.xyz.service..* [Any joint point in the service package or a sub-package of service (recursively)])<br />
+: Subtypes (com.xyz.service.MyService+ [Any joint point in MyService class or any subclass of MyService])</p>
<p>Anywhere else you can use these wildcards when permitted<br />
*: represent anything</p>
<h3><span style="color: #ff99cc;">Chaining expressions</span></h3>
<p>You can chain expressions to combine or narrow the result of the joint point selection, exactly like in a java if statement.</p>
<p>&amp;&amp;: and<br />
||: or<br />
!: Not</p>
<h3><span style="color: #ff99cc;">POINTCUT TYPE</span></h3>
<p><em>@pointcut (“POINTCUT_TYPE(  EXPRESSION )”)</em></p>
<p>Pointcut specify the actual join point that should be intercepted/watched. To help us get to the right joint point, many ways are made available to the developer.</p>
<hr /><strong>execution</strong>: matching method execution</p>
<p>Important point: If the execution pointcut expression specifies a declaring class type, the pointcut will only match methods declared in that type, or methods that override methods declared in or inherited by that type.</p>
<p>Example:</p>
<p><em>execution(void com.xyz.service.MyClass.*())</em></p>
<p>This pointcut expression will select all method executions for public methods returning void and having no arguments that are either declared in, or inherited by, MyClass, even if those methods are overridden in a subclass of MyClass.</p>
<hr /><strong>within</strong>: Select joint point that is defined in a class with a name that matches expression.</p>
<p><strong>@within</strong>: Select joint point that class types have annotation that matches expression.</p>
<p>Example:</p>
<p><em>within(com.xyz.service.*)</em></p>
<p>Selection of method joint point within the service package</p>
<p><em>within(com.xyz.service..*)</em></p>
<p>Using .. after the service package, will select joint point within the service package or in any sub-package recursively.</p>
<hr /><strong>this</strong>: Select joint point when the source-object (in our case: Spring AOP Proxy) type matches expression.</p>
<p>Example:</p>
<p><em>this(com.xyz.service.IAccountService)</em></p>
<p>Any join point where the proxy implements the IAccountService interface.</p>
<hr /><strong>target</strong>: Select joint point when the target-object (in our case: the target of the proxy)  type matches expression.</p>
<p><strong>@target</strong>: Select joint point when the target-object (in our case: the target of the proxy)  has an annotation of type expression</p>
<p>Example:</p>
<p><em>target(com.xyz.service.IAccountService)</em></p>
<p>Any join point where the target implements the IAccountService interface</p>
<hr /><strong>args</strong>: Matches joint point methods having arguments that match expression.</p>
<p><strong>@args</strong>: Matches joint point where the runtime type of the arguments passed has annotations of type expression.</p>
<p>Example:</p>
<p><em>args(java.lang.String)</em></p>
<p>Any join point which takes a single parameter, and, where the argument passed at runtime is a java.lang.String</p>
<hr /><strong>bean</strong>: Matches a particular named Spring bean (Only support in Spring AOP)</p>
<p>Important point: This pointcut type work at an instance level</p>
<p>Example:</p>
<p><em>bean(myBeanName)</em></p>
<p>Any join point that matches the bean name myBeanName.</p>
<hr /><strong>@annotation</strong>: Matches methods that have been marked with annotation that matches expression.</p>
<p>Example:</p>
<p><em>@annotation(org.springframework.transaction.annotation.Transactional)</em></p>
<p>Any join point method that have a @Transactional annotation</p>
<h3><span style="color: #ff99cc;">SCHEMA CONFIGURATION</span></h3>
<p><code> &lt;aop:config&gt;<br />
&lt;aop:pointcut id=”myPointcutName”<br />
expression=”@annotation(com.xyz.annotation.MyAnnotation)”/&gt;<br />
&lt;/aop:config&gt;<br />
</code></p>
<h3><span style="color: #ff99cc;">NAMING A POINTCUT</span></h3>
<p>You can name a pointcut for reuse purpose. The way to do that is simply to declare<br />
a method definition under the pointcut declaration. The method name will be use to refer to that pointcut.</p>
<p><code>@Pointcut("@within(com.xyz.annotation.MyAnnotation)")<br />
void <strong>myTransfertPointcut()</strong>{}</code></p>
<p>@Before(&#8220;<strong>myTransfertPointcut()</strong>&#8220;)<br />
private void callMyAdvice(JoinPoint tp){<br />
…<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.solutionswaizu.com/2008/07/27/defining-pointcuts/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>AOP Weaving</title>
		<link>http://blog.solutionswaizu.com/2008/07/11/aop-weaving/</link>
		<comments>http://blog.solutionswaizu.com/2008/07/11/aop-weaving/#comments</comments>
		<pubDate>Fri, 11 Jul 2008 18:54:43 +0000</pubDate>
		<dc:creator>Sylvain</dc:creator>
				<category><![CDATA[AOP]]></category>
		<category><![CDATA[Spring]]></category>

		<guid isPermaLink="false">http://blog.solutionswaizu.com/?p=27</guid>
		<description><![CDATA[What is AOP Weaving? It&#8217;s the process of inserting aspects logic into the application code at a specific jointpoint. Compile time weaving Runtime weaving What about Spring AOP!! Spring AOP use Runtime weaving and is based on proxies. Spring can generate two kind of proxy: JDK Dynamic Proxy (java.lang.reflect.Proxy) CGLIB proxy If the target object [...]]]></description>
			<content:encoded><![CDATA[<h3><strong>What is AOP Weaving?</strong></h3>
<p>It&#8217;s the process of inserting aspects logic into the application code at a specific jointpoint.</p>
<ul>
<li>Compile time weaving</li>
<li>Runtime weaving</li>
</ul>
<p><strong>What about Spring AOP!!</strong></p>
<p>Spring AOP use Runtime weaving and is based on proxies. Spring can generate two kind of proxy:</p>
<ul>
<li>JDK Dynamic Proxy (java.lang.reflect.Proxy)</li>
<li>CGLIB proxy</li>
</ul>
<p><span id="more-27"></span>If the target object implement at least one interface, the JDK Dynamic Proxy will be use and only the methods defined in this interface will be eligible for AOP. In any other case, CGLIB proxy will be use (You&#8217;ll need the CGLIB binaries on the classpath).   <strong></strong></p>
<p><strong>How proxy works!!</strong></p>
<p>Method call without proxy.<br />
<a class="thickbox" href="http://blog.solutionswaizu.com/wordpress/wp-content/gallery/blog/proxy1.gif"><img class="ngg-singlepic ngg-none" src="http://blog.solutionswaizu.com/wordpress/wp-content/gallery/blog/proxy1.gif" alt="proxy1.gif" /></a><br />
Method call with proxy.<br />
<a class="thickbox" href="http://blog.solutionswaizu.com/wordpress/wp-content/gallery/blog/proxy2.gif"><img class="ngg-singlepic ngg-none" src="http://blog.solutionswaizu.com/wordpress/wp-content/gallery/blog/proxy2.gif" alt="proxy2.gif" /></a></p>
<h3><strong>Configuration</strong></h3>
<p>When you declare AOP configuration, JDK Dynamic Proxy, will be use by default when declaring</p>
<pre>&lt;aop:config&gt; or &lt;aop:aspectj-autoproxy/&gt; tag</pre>
<pre>You can always force Spring to use CGLIB proxy simply be adding an
attribute to the &lt;aop:config&gt; tag.</pre>
<pre><span style="color: #ff00ff;">&lt;aop:config proxy-target-class="true" &gt;
. . .
&lt;/aop:config&gt;</span></pre>
<p>If you using the AOP annotations use</p>
<pre><span style="color: #ff00ff;">&lt;aop:aspectj-autoproxy proxy-target-class="true" &gt;</span></pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.solutionswaizu.com/2008/07/11/aop-weaving/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Core AOP Concepts</title>
		<link>http://blog.solutionswaizu.com/2008/06/14/core-aop-concepts/</link>
		<comments>http://blog.solutionswaizu.com/2008/06/14/core-aop-concepts/#comments</comments>
		<pubDate>Sun, 15 Jun 2008 02:41:31 +0000</pubDate>
		<dc:creator>Sylvain</dc:creator>
				<category><![CDATA[AOP]]></category>
		<category><![CDATA[Spring]]></category>

		<guid isPermaLink="false">http://blog.solutionswaizu.com/?p=23</guid>
		<description><![CDATA[With new technology comes new terminology to describe the technology and what can be done with it. I will define some key AOP concepts to give you a good comprehension that will help you all along my future articles on this subject. However these terms are not Spring specific and really belong to AOP. Jointpoint [...]]]></description>
			<content:encoded><![CDATA[<p>With new technology comes new terminology to describe the technology and what can be done with it.</p>
<p>I will define some key AOP concepts to give you a good comprehension that will help you all along my future articles on this subject. However these terms are not Spring specific and really belong to AOP.</p>
<div class="subject">Jointpoint</div>
<div class="subject"></div>
<ul>
<li>Well-defined point in the execution of an application</li>
<li>The point where you can insert additional logic to be execute</li>
<li>Examples of Jointpoint&#8217;s
<ul>
<li>Method invocation</li>
<li>Exception being thrown</li>
<li>Field modification</li>
</ul>
</li>
</ul>
<p>In Spring AOP a jointpoint <strong>always</strong> represents a method execution.<br />
<span id="more-23"></span></p>
<div class="subject">Pointcut</div>
<p>Expression that select one or more jointpoints.<br />
In other words, pointcut select jointpoint that will be advised by an aspect and when the application reaches a joinpoint, advice on that joinpoint may run.</p>
<p><strong>Example</strong>:</p>
<p>In a class containing different methods, each method have a jointpoint. Pointcut can select all jointpoint that match get*. In this example, all getter method will be advise.</p>
<p>Spring AOP use the AspectJ pointcut expression language.</p>
<div class="subject"><strong><span style="color: #ff99cc;"><span style="text-decoration: underline;">Advice</span></span></strong></div>
<p>Code that will be executed at a jointpoint that has been selected by a pointcut.</p>
<p><strong>Types of Advice</strong></p>
<ul>
<li>Before advice, this executes before joinpoint</li>
<li>After advice, this executes after joinpoint</li>
<li>Around advice, this executes around joinpoint</li>
</ul>
<p><strong><span style="color: #ff99cc;"><span style="text-decoration: underline;">Aspect</span></span></strong></p>
<p>Module that encapsulate pointcuts and advices</p>
<p><strong><span style="color: #ff99cc;"><span style="text-decoration: underline;">Summary</span></span></strong></p>
<p>Advice: what &amp; when apply advice code<br />
Poincut: where apply advice (jointpoint selection)<br />
Jointpoint: potential target</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.solutionswaizu.com/2008/06/14/core-aop-concepts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What Problem Does AOP Solve?</title>
		<link>http://blog.solutionswaizu.com/2008/06/11/what-problem-does-aop-solve/</link>
		<comments>http://blog.solutionswaizu.com/2008/06/11/what-problem-does-aop-solve/#comments</comments>
		<pubDate>Wed, 11 Jun 2008 13:58:39 +0000</pubDate>
		<dc:creator>Sylvain</dc:creator>
				<category><![CDATA[AOP]]></category>
		<category><![CDATA[Spring]]></category>
		<category><![CDATA[Spring AOP]]></category>

		<guid isPermaLink="false">http://blog.solutionswaizu.com/?p=22</guid>
		<description><![CDATA[OO applications can be seen as being built on top of a collection of classes. Each of these classes has a particular purpose, with responsibilities that are clearly defined. Those classes collaborates to achieve the application’s overall goal. However, generic functionalities like logging, security or even transactions are often needed in many places in the [...]]]></description>
			<content:encoded><![CDATA[<p>OO applications can be seen as being built on top of a collection of classes. Each of these classes has a particular purpose, with responsibilities that are clearly defined. Those classes collaborates to achieve the application’s overall goal.</p>
<p>However, generic functionalities like logging, security or even transactions are often needed in many places in the application. We can state that those functionalities cross-cut the application, and impact a lot of classes.<br />
<span id="more-22"></span><strong>The problem</strong></p>
<p>Cross-cutting concerns cannot be captured cleanly inside a single abstraction, and cannot even be reused. Therefore, we’re forced to write the same code over and over again (most of the time we simply copy and paste the code, and slightly adapting it to the context). By doing this, it&#8217;s clear that we&#8217;re failing to modularize our application, introducing code duplication (ex. logging) and coupling of concerns (ex. security check in an account method).</p>
<p>Of course, the code that handles these concerns can be added to each class separately, but wouldn&#8217;t that violates the principle that each class has well-defined responsibilities?</p>
<p><strong>Enter AOP</strong></p>
<p>AOP defines a new programming dimension, called an aspect. Aspects are used to capture cross-cutting functionalities in a separate programmatic entity.</p>
<p>AOP helps to modularize cross-cutting concerns and eliminates coupling and code duplication. With these aspects out of the way, developers can focus on core problems.</p>
<p>Examples of cross-cutting concerns</p>
<ul>
<li>Logging &amp; Tracing</li>
<li>Transaction management</li>
<li>Security</li>
<li>Caching</li>
<li>Locking</li>
<li>Event handling</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.solutionswaizu.com/2008/06/11/what-problem-does-aop-solve/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

