<?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>Kevin&#039;s Blog &#187; AJDT</title>
	<atom:link href="http://blog.lckymn.com/tag/ajdt/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.lckymn.com</link>
	<description>IT, Java, Ubuntu, Linux</description>
	<lastBuildDate>Thu, 12 Jan 2012 05:48:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>ROO So Cool!!! -04-</title>
		<link>http://blog.lckymn.com/2009/05/17/roo-so-cool-04/</link>
		<comments>http://blog.lckymn.com/2009/05/17/roo-so-cool-04/#comments</comments>
		<pubDate>Sun, 17 May 2009 01:03:43 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Spring Framework]]></category>
		<category><![CDATA[AJDT]]></category>
		<category><![CDATA[AspectJ]]></category>
		<category><![CDATA[AspectJ Development Tools]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Eclipse JEE]]></category>
		<category><![CDATA[Hibernate]]></category>
		<category><![CDATA[Inter-type declarations]]></category>
		<category><![CDATA[J2EE]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JavaBean]]></category>
		<category><![CDATA[JEE]]></category>
		<category><![CDATA[JPA]]></category>
		<category><![CDATA[M2Eclipse]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[Maven Integration for Eclipse]]></category>
		<category><![CDATA[Maven2]]></category>
		<category><![CDATA[Mixin]]></category>
		<category><![CDATA[Multiple Inheritance]]></category>
		<category><![CDATA[ORM]]></category>
		<category><![CDATA[Spring]]></category>
		<category><![CDATA[Spring ROO]]></category>
		<category><![CDATA[SpringSource Tool Suite]]></category>
		<category><![CDATA[STS]]></category>

		<guid isPermaLink="false">http://blog.lckymn.com/?p=283</guid>
		<description><![CDATA[<p>Continued from <a href="http://blog.lckymn.com/2009/05/17/roo-so-cool-03/" target="_blank">http://blog.lckymn.com/2009/05/17/roo-so-cool-03/</a></p> <p>There are two other aspects which are <code>Choice_Roo_Plural</code> and <code>Choice_Roo_ToString</code>.</p> <p><div id="attachment_243" class="wp-caption alignnone" style="width: 913px"><a href="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-22.jpg"><img src="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-22.jpg" alt="&#34;Choice&#34; in Plural Form, &#34;Choices&#34;" title="&#34;Choice&#34; in Plural Form, &#34;Choices&#34;" width="903" height="417" class="size-full wp-image-243" /></a><p class="wp-caption-text">&#34;Choice&#34; in Plural Form, &#34;Choices&#34;</p></div> <code>Choice_Roo_Plural</code> declares that the <code>Choice</code> has a method named <code>getPluralName()</code> which returns a String type value, &#8220;Choices&#8221; which is the plural form of &#8220;Choice&#8221;. I don&#8217;t really get why it is necessary though. I first thought it <p style="border: 3px solid rgb(243, 197, 52); padding: 5px; background-color: rgb(254, 254, 184); width: 600px; text-align: center;">[...Continue reading <a href="http://blog.lckymn.com/2009/05/17/roo-so-cool-04/">ROO So Cool!!! -04-</a>...]</p>]]></description>
			<content:encoded><![CDATA[<p>Continued from<br />
<a href="http://blog.lckymn.com/2009/05/17/roo-so-cool-03/" target="_blank">http://blog.lckymn.com/2009/05/17/roo-so-cool-03/</a></p>
<p>There are two other aspects which are <code>Choice_Roo_Plural</code> and <code>Choice_Roo_ToString</code>.</p>
<p><div id="attachment_243" class="wp-caption alignnone" style="width: 913px"><a href="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-22.jpg"><img src="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-22.jpg" alt="&quot;Choice&quot; in Plural Form, &quot;Choices&quot;" title="&quot;Choice&quot; in Plural Form, &quot;Choices&quot;" width="903" height="417" class="size-full wp-image-243" /></a><p class="wp-caption-text">&quot;Choice&quot; in Plural Form, &quot;Choices&quot;</p></div><br />
<code>Choice_Roo_Plural</code> declares that the <code>Choice</code> has a method named <code>getPluralName()</code> which returns a String type value, &#8220;Choices&#8221; which is the plural form of &#8220;Choice&#8221;. I don&#8217;t really get why it is necessary though.  I first thought it might be the name of the table with which the <code>Choice_Roo_Entity</code> matches, yet the table name is <code>choice</code>.</p>
<pre class="brush: plain; gutter: false; title: ; notranslate">
Bind entity com.springsource.vote.domain.Choice on table choice
</pre>
<p>It is probably for the future use as a name of domain object in plural form may be frequently required when displaying the list of it.</p>
<p>Now, let&#8217;s look at the last aspect.<br />
<div id="attachment_244" class="wp-caption alignnone" style="width: 919px"><a href="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-23.jpg"><img src="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-23.jpg" alt="toString() method for Choice" title="toString() method for Choice" width="909" height="417" class="size-full wp-image-244" /></a><p class="wp-caption-text">toString() method for Choice</p></div><br />
The last one is <code>Choice_Roo_ToString</code> which declare that Choice has <code>toString()</code> method.</p>
<pre class="brush: java; title: ; notranslate">
privileged aspect Choice_Roo_ToString {

    public java.lang.String Choice.toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(&quot;id: &quot;).append(getId()).append(&quot;, &quot;);
        sb.append(&quot;version: &quot;).append(getVersion()).append(&quot;, &quot;);
        sb.append(&quot;namingChoice: &quot;).append(getNamingChoice()).append(&quot;, &quot;);
        sb.append(&quot;description: &quot;).append(getDescription()).append(&quot;, &quot;);
        return sb.toString();
    }    

}
</pre>
<p>It returns String containing the information about <code>Choice</code> which includes all the values of the variables from the aspects as well. This String is used to display the information about Choice object in the view, <code>WEB-INF/jsp/vote/create.jsp</code>.</p>
<p>All these mixins can be good Separation of Concerns (SoC).  Each aspect has what should be a concern in a particular mixin only. For example, id and version of Choice are not really a concern of <code>Choice</code> itself as it does not have any meaning for Choice, yet it is very important for OR mapping. Thus it is separated from <code>Choice</code> and only occurs in <code>Choice_Roo_Entity</code> which plays the role of a persistent object.</p>
<p>It is not a completely new ways to write mixin using inter-type declarations in AspectJ (<a href="http://today.java.net/pub/a/today/2005/12/15/writing-mixins-with-aop.html" target="_blank">http://today.java.net/pub/a/today/2005/12/15/writing-mixins-with-aop.html</a>). Nevertheless, Spring ROO is still so cool as I have never seen any automatically generated code by Java frameworks uses mixins written using inter-type declarations as a nice way of SoC. I may need to call ROO RSoC (Real Separation of Concerns). <img src='http://blog.lckymn.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>OK, I am now running out of time so had better finish this post quickly.  </p>
<p>I would just finally like to point out some minor issues I found.</p>
<p>1. An error in dojo JS toolkit.<br />
<div id="attachment_165" class="wp-caption alignnone" style="width: 851px"><a href="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-15.jpg"><img src="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-15.jpg" alt="dojo JS Toolkit Error" title="dojo JS Toolkit Error" width="841" height="588" class="size-full wp-image-165" /></a><p class="wp-caption-text">dojo JS Toolkit Error</p></div></p>
<p>2. An error in roo.css file.<br />
<div id="attachment_245" class="wp-caption alignnone" style="width: 946px"><a href="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-24.jpg"><img src="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-24.jpg" alt="CSS Error" title="CSS Error" width="936" height="408" class="size-full wp-image-245" /></a><p class="wp-caption-text">CSS Error</p></div></p>
<pre class="brush: css; first-line: 38; highlight: [41]; title: ; notranslate">
#wrap {
	margin:0 auto;
  	position:relative;
  	float:center;
  	top: 0px;
  	left:0px;
  	width:800px;
  	text-align:left;  	

}
</pre>
<p><code>center</code> is not a float value.</p>
<p>3. Using a String&#8217;s equals() method to test for an empty String. This might be OK for a small application like the ROO example but it can bring about some performance issue for a big application with numerous simultaneous user requests.<br />
<div id="attachment_246" class="wp-caption alignnone" style="width: 913px"><a href="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-25.jpg"><img src="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-25.jpg" alt="Performance Issue - Test for Empty String" title="Performance Issue - Test for Empty String" width="903" height="405" class="size-full wp-image-246" /></a><p class="wp-caption-text">Performance Issue - Test for Empty String</p></div><br />
So the following code from <code>ChoiceEditor_Roo_Editor</code></p>
<pre class="brush: java; title: ; notranslate">
if (text == null || &quot;&quot;.equals(text))
</pre>
<p>had better be</p>
<pre class="brush: java; title: ; notranslate">
if (text == null || 0 == text.length())
</pre>
<p>I wrote more details about it here with performance tests.<br />
<a href="http://blog.lckymn.com/2009/05/17/test-for-empty-string/" target="_blank" style="color: blue; font-weight: bolder;">http://blog.lckymn.com/2009/05/17/test-for-empty-string/</a></p>
<p>Finally, it&#8217;s my wish. I found that aspect code is not really supported by the Eclipse functions for Java such as <code>Call Hierarchy</code> and <code>Open Declaration</code>. It would be much better if aspects are fully supported by the Eclipse functions for Java. However, it may have something to do with AJDT not Spring ROO integration.</p>
<p>Phew, I have eventually written this. <img src='http://blog.lckymn.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  Even though I tried ROO approximately two weeks ago, I did not have time to write about it.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lckymn.com/2009/05/17/roo-so-cool-04/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>ROO So Cool!!! -03-</title>
		<link>http://blog.lckymn.com/2009/05/17/roo-so-cool-03/</link>
		<comments>http://blog.lckymn.com/2009/05/17/roo-so-cool-03/#comments</comments>
		<pubDate>Sun, 17 May 2009 01:02:34 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Spring Framework]]></category>
		<category><![CDATA[AJDT]]></category>
		<category><![CDATA[AspectJ]]></category>
		<category><![CDATA[AspectJ Development Tools]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Eclipse JEE]]></category>
		<category><![CDATA[Hibernate]]></category>
		<category><![CDATA[Inter-type declarations]]></category>
		<category><![CDATA[J2EE]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JavaBean]]></category>
		<category><![CDATA[JEE]]></category>
		<category><![CDATA[JPA]]></category>
		<category><![CDATA[M2Eclipse]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[Maven Integration for Eclipse]]></category>
		<category><![CDATA[Maven2]]></category>
		<category><![CDATA[Mixin]]></category>
		<category><![CDATA[Multiple Inheritance]]></category>
		<category><![CDATA[ORM]]></category>
		<category><![CDATA[Spring]]></category>
		<category><![CDATA[Spring ROO]]></category>
		<category><![CDATA[SpringSource Tool Suite]]></category>
		<category><![CDATA[STS]]></category>

		<guid isPermaLink="false">http://blog.lckymn.com/?p=275</guid>
		<description><![CDATA[<p>Continued from <a href="http://blog.lckymn.com/2009/05/17/roo-so-cool-02/" target="_blank">http://blog.lckymn.com/2009/05/17/roo-so-cool-02/</a></p> <p>Now, let&#8217;s look at more interesting one that is the ROO generated source code!</p> <p>As you can see, there are many AspectJ aspects in the <code>com.springsource.vote.domain</code> package. So I&#8217;ll firstly try to look at the <code>Choice</code> class which is not an aspect.</p> <p><div id="attachment_239" class="wp-caption alignnone" style="width: 989px"><a href="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-18.jpg"><img src="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-18.jpg" alt="Domain object - Choice" title="Domain object - Choice" width="979" height="744" class="size-full wp-image-239" /></a><p class="wp-caption-text">Domain object - Choice</p></div> Wow! Is that it? Without the annotations, it <p style="border: 3px solid rgb(243, 197, 52); padding: 5px; background-color: rgb(254, 254, 184); width: 600px; text-align: center;">[...Continue reading <a href="http://blog.lckymn.com/2009/05/17/roo-so-cool-03/">ROO So Cool!!! -03-</a>...]</p>]]></description>
			<content:encoded><![CDATA[<p>Continued from<br />
<a href="http://blog.lckymn.com/2009/05/17/roo-so-cool-02/" target="_blank">http://blog.lckymn.com/2009/05/17/roo-so-cool-02/</a></p>
<p>Now, let&#8217;s look at more interesting one that is the ROO generated source code!</p>
<p>As you can see, there are many AspectJ aspects in the <code>com.springsource.vote.domain</code> package. So I&#8217;ll firstly try to look at the <code>Choice</code> class which is not an aspect.</p>
<p><div id="attachment_239" class="wp-caption alignnone" style="width: 989px"><a href="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-18.jpg"><img src="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-18.jpg" alt="Domain object - Choice" title="Domain object - Choice" width="979" height="744" class="size-full wp-image-239" /></a><p class="wp-caption-text">Domain object - Choice</p></div><br />
Wow! Is that it? Without the annotations, it consists of only two lines of code in the class.  Just two variable declarations.</p>
<p>So where are the others?</p>
<p>Check out the <code>Choice_Roo_Entity</code> aspect.<br />
<div id="attachment_240" class="wp-caption alignnone" style="width: 919px"><a href="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-19.jpg"><img src="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-19.jpg" alt="Persistent Object (Aspect)" title="Persistent Object (Aspect)" width="909" height="424" class="size-full wp-image-240" /></a><p class="wp-caption-text">Persistent Object (Aspect)</p></div><br />
It appears to be a persistent object class with a persistence manager which means it includes data access logic. This sounds like normal <a href="http://www.martinfowler.com/eaaCatalog/activeRecord.html" target="_blank">Active Record</a> yet if you closer look at the code, it uses AspectJ&#8217;s inter-type declaration to add more attributes and behaviours to the domain object <code>Choice</code>.</p>
<pre class="brush: java; title: ; notranslate">
    @javax.persistence.Id
    @javax.persistence.GeneratedValue(strategy = javax.persistence.GenerationType.AUTO)
    @javax.persistence.Column(name = &quot;id&quot;)
    private java.lang.Long Choice.id;
</pre>
<p>This code above is declaring long type id variable to the type Choice to use as an identifier for OR mapping.  Because it is declared as a private variable, it is impossible to access it inside the code of Choice but possible only inside this <code>Choice_Roo_Entity</code> aspect.</p>
<p>What about the <code>Choice_Roo_JavaBean</code>.<br />
<div id="attachment_241" class="wp-caption alignnone" style="width: 922px"><a href="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-20.jpg"><img src="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-20.jpg" alt="JavaBean (Aspect)" title="JavaBean (Aspect)" width="912" height="424" class="size-full wp-image-241" /></a><p class="wp-caption-text">JavaBean (Aspect)</p></div><br />
It has all the getters and setters for the <code>Choice</code> class and again inter-type declaration is used for adding these accessor methods.  So an instance of Choice type cannot only behave as a persistent object but also as a JavaBean object.  If you look into the jsp file, you can see it is used just like the methods belong to <code>Choice</code> class.<br />
In order to access the variables inside <code>Choice</code> object, the <code>Choice_Roo_JavaBean</code> is defined as <code>privileged</code> aspect.</p>
<pre class="brush: java; highlight: [1,4,8,12,16]; title: ; notranslate">
privileged aspect Choice_Roo_JavaBean {

    public java.lang.String Choice.getNamingChoice() {
        return this.namingChoice;
    }    

    public void Choice.setNamingChoice(java.lang.String namingChoice) {
        this.namingChoice = namingChoice;
    }    

    public java.lang.String Choice.getDescription() {
        return this.description;
    }    

    public void Choice.setDescription(java.lang.String description) {
        this.description = description;
    }    

}
</pre>
<p>So as shown above, <code>Choice_Roo_JavaBean</code> is a privileged aspect and therefore it can access <code>namingChoice</code> and <code>description</code> variables which are declared in <code>Choice</code>.</p>
<p>So what is it? It is a mixin.  <a href="http://en.wikipedia.org/wiki/Mixin" target="_blank">Mixin</a> is a class which provides a functionality to a subclass yet mixin itself is not supposed to stand alone.  So a class can collect its functionality by inheriting from one or more mixins through multiple inheritance.  However, as we all know, Java does not support multiple inheritance. So to use mixins in Java world, inter-type declarations in AspectJ can be used.</p>
<pre class="brush: java; highlight: [8,13]; title: ; notranslate">
privileged aspect Choice_Roo_Entity {

	(...)

    @javax.persistence.Id
    @javax.persistence.GeneratedValue(strategy = javax.persistence.GenerationType.AUTO)
    @javax.persistence.Column(name = &quot;id&quot;)
    private java.lang.Long Choice.id;    

    (...)

    public java.lang.Long Choice.getId() {
        return this.id;
    }
}
</pre>
<p>As seen in the aspect code above, a long type variable is added to the type Choice and a getId() method which returns a long type value that is the value in the variable, id, just added by the aspect. So an instance of Choice type can have getId() method even though it does not exist in the Choice class. Therefore, as mentioned, Choice type can have characteristics of both persistent object and JavaBean.  </p>
<p>AspectJ is also used to declare Choice type as a configurable type.<br />
<div id="attachment_242" class="wp-caption alignnone" style="width: 802px"><a href="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-21.jpg"><img src="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-21.jpg" alt="Make Choice @Configurable" title="Make Choice @Configurable" width="792" height="172" class="size-full wp-image-242" /></a><p class="wp-caption-text">Make Choice @Configurable</p></div><br />
This code reveals that <code>Choice</code> type has <code>@org.springframework.beans.factory.annotation.Configurable</code> annotation.</p>
<pre class="brush: java; title: ; notranslate">
privileged aspect Choice_Roo_Configurable {

    declare @type: Choice: @org.springframework.beans.factory.annotation.Configurable;    

}
</pre>
<p>Next:<br />
<a href="http://blog.lckymn.com/2009/05/17/roo-so-cool-04/" target="_blank">http://blog.lckymn.com/2009/05/17/roo-so-cool-04/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lckymn.com/2009/05/17/roo-so-cool-03/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>ROO So Cool!!! -02-</title>
		<link>http://blog.lckymn.com/2009/05/17/roo-so-cool-02/</link>
		<comments>http://blog.lckymn.com/2009/05/17/roo-so-cool-02/#comments</comments>
		<pubDate>Sun, 17 May 2009 01:01:45 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Spring Framework]]></category>
		<category><![CDATA[AJDT]]></category>
		<category><![CDATA[AspectJ]]></category>
		<category><![CDATA[AspectJ Development Tools]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Eclipse JEE]]></category>
		<category><![CDATA[Hibernate]]></category>
		<category><![CDATA[Inter-type declarations]]></category>
		<category><![CDATA[J2EE]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JavaBean]]></category>
		<category><![CDATA[JEE]]></category>
		<category><![CDATA[JPA]]></category>
		<category><![CDATA[M2Eclipse]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[Maven Integration for Eclipse]]></category>
		<category><![CDATA[Maven2]]></category>
		<category><![CDATA[Mixin]]></category>
		<category><![CDATA[Multiple Inheritance]]></category>
		<category><![CDATA[ORM]]></category>
		<category><![CDATA[Spring]]></category>
		<category><![CDATA[Spring ROO]]></category>
		<category><![CDATA[SpringSource Tool Suite]]></category>
		<category><![CDATA[STS]]></category>

		<guid isPermaLink="false">http://blog.lckymn.com/?p=273</guid>
		<description><![CDATA[<p>Continued from <a href="http://blog.lckymn.com/2009/05/17/roo-so-cool-01/" target="_blank">http://blog.lckymn.com/2009/05/17/roo-so-cool-01/</a></p> <p>Let&#8217;s run this project to see what it looks like.</p> <p><div id="attachment_159" class="wp-caption alignnone" style="width: 833px"><a href="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-09.jpg"><img src="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-09.jpg" alt="Run ROO Generated Application on Server" title="Run ROO Generated Application on Server" width="823" height="570" class="size-full wp-image-159" /></a><p class="wp-caption-text">Run ROO Generated Application on Server</p></div> Right click on the project -> Select the <code>Run As</code> option on the menu -> Select the <code>Run on Server</code>.</p> <p><div id="attachment_160" class="wp-caption alignnone" style="width: 626px"><a href="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-10.jpg"><img src="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-10.jpg" alt="Choose Server" title="Choose Server" width="616" height="709" <p style="border: 3px solid rgb(243, 197, 52); padding: 5px; background-color: rgb(254, 254, 184); width: 600px; text-align: center;">[...Continue reading <a href="http://blog.lckymn.com/2009/05/17/roo-so-cool-02/">ROO So Cool!!! -02-</a>...]</p>]]></description>
			<content:encoded><![CDATA[<p>Continued from<br />
<a href="http://blog.lckymn.com/2009/05/17/roo-so-cool-01/" target="_blank">http://blog.lckymn.com/2009/05/17/roo-so-cool-01/</a></p>
<p>Let&#8217;s run this project to see what it looks like.</p>
<p><div id="attachment_159" class="wp-caption alignnone" style="width: 833px"><a href="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-09.jpg"><img src="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-09.jpg" alt="Run ROO Generated Application on Server" title="Run ROO Generated Application on Server" width="823" height="570" class="size-full wp-image-159" /></a><p class="wp-caption-text">Run ROO Generated Application on Server</p></div><br />
Right click on the project -> Select the <code>Run As</code> option on the menu -> Select the <code>Run on Server</code>.</p>
<p><div id="attachment_160" class="wp-caption alignnone" style="width: 626px"><a href="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-10.jpg"><img src="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-10.jpg" alt="Choose Server" title="Choose Server" width="616" height="709" class="size-full wp-image-160" /></a><p class="wp-caption-text">Choose Server</p></div><br />
Select <code>Choose an existing server</code> -> Select any <code>Servlet Container</code> or <code>JEE Server</code> on which you would like ROO generated application to run (If you do not have any available ones, install set it up first). -> Click the <code>Next</code> button.</p>
<p><div id="attachment_161" class="wp-caption alignnone" style="width: 628px"><a href="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-11.jpg"><img src="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-11.jpg" alt="Click Finish to Run" title="Click Finish to Run" width="618" height="705" class="size-full wp-image-161" /></a><p class="wp-caption-text">Click Finish to Run</p></div><br />
Make sure <code>vote</code> project appears on the right-hand side and Click the <code>Finish</code> button.</p>
<p><div id="attachment_162" class="wp-caption alignnone" style="width: 913px"><a href="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-12.jpg"><img src="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-12.jpg" alt="ROO Generated Application is Running." title="ROO Generated Application is Running." width="903" height="695" class="size-full wp-image-162" /></a><p class="wp-caption-text">ROO Generated Application is Running.</p></div><br />
Now it&#8217;s running.</p>
<p>I opened Firefox 3 to test it instead of using the built-in browser of Eclipse.<br />
Let&#8217;s create a new choice.</p>
<p><div id="attachment_163" class="wp-caption alignnone" style="width: 849px"><a href="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-13.jpg"><img src="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-13.jpg" alt="Create New Choice (Firefox3)" title="Create New Choice (Firefox3)" width="839" height="688" class="size-full wp-image-163" /></a><p class="wp-caption-text">Create New Choice (Firefox3)</p></div><br />
Click the <code>Create New Choice</code> menu.</p>
<p><div id="attachment_164" class="wp-caption alignnone" style="width: 849px"><a href="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-14.jpg"><img src="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-14.jpg" alt="Create New Choice Form" title="Create New Choice Form" width="839" height="586" class="size-full wp-image-164" /></a><p class="wp-caption-text">Create New Choice Form</p></div><br />
It displays the <code>Create New Choice</code> form.</p>
<p>Wait a minute! Is that a JavaScript (JS) error that <a href="http://getfirebug.com/" target="_blank">Firebug</a> complains?<br />
<div id="attachment_165" class="wp-caption alignnone" style="width: 851px"><a href="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-15.jpg"><img src="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-15.jpg" alt="dojo JS Toolkit Error" title="dojo JS Toolkit Error" width="841" height="588" class="size-full wp-image-165" /></a><p class="wp-caption-text">dojo JS Toolkit Error</p></div><br />
Yes, it is but it looks like an error in <a href="http://dojotoolkit.org/" target="_blank">dojo</a> JS toolkit which Spring JS uses. Anyway, despite the error, it works fine.</p>
<p><div id="attachment_166" class="wp-caption alignnone" style="width: 849px"><a href="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-16.jpg"><img src="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-16.jpg" alt="Fill in the Form -&gt; Save" title="Fill in the Form -&gt; Save" width="839" height="582" class="size-full wp-image-166" /></a><p class="wp-caption-text">Fill in the Form -> Save</p></div><br />
Quickly fill in the form. -> Click the <code>Save</code> button.</p>
<p><div id="attachment_167" class="wp-caption alignnone" style="width: 850px"><a href="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-17.jpg"><img src="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-17.jpg" alt="New Choice Created" title="New Choice Created" width="840" height="588" class="size-full wp-image-167" /></a><p class="wp-caption-text">New Choice Created</p></div><br />
The entered data are added and a new Choice is created.</p>
<p>Next:<br />
<a href="http://blog.lckymn.com/2009/05/17/roo-so-cool-03/" target="_blank">http://blog.lckymn.com/2009/05/17/roo-so-cool-03/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lckymn.com/2009/05/17/roo-so-cool-02/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>ROO So Cool!!! -01-</title>
		<link>http://blog.lckymn.com/2009/05/17/roo-so-cool-01/</link>
		<comments>http://blog.lckymn.com/2009/05/17/roo-so-cool-01/#comments</comments>
		<pubDate>Sun, 17 May 2009 01:00:26 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Spring Framework]]></category>
		<category><![CDATA[AJDT]]></category>
		<category><![CDATA[AspectJ]]></category>
		<category><![CDATA[AspectJ Development Tools]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Eclipse JEE]]></category>
		<category><![CDATA[Hibernate]]></category>
		<category><![CDATA[Inter-type declarations]]></category>
		<category><![CDATA[J2EE]]></category>
		<category><![CDATA[JavaBean]]></category>
		<category><![CDATA[JEE]]></category>
		<category><![CDATA[JPA]]></category>
		<category><![CDATA[M2Eclipse]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[Maven Integration for Eclipse]]></category>
		<category><![CDATA[Maven2]]></category>
		<category><![CDATA[Mixin]]></category>
		<category><![CDATA[Multiple Inheritance]]></category>
		<category><![CDATA[ORM]]></category>
		<category><![CDATA[Spring]]></category>
		<category><![CDATA[Spring ROO]]></category>
		<category><![CDATA[SpringSource Tool Suite]]></category>
		<category><![CDATA[STS]]></category>

		<guid isPermaLink="false">http://blog.lckymn.com/?p=146</guid>
		<description><![CDATA[<p>The end of the last month Spring Source released Spring ROO in alpha stage. My friend, <a href="http://stsmedia.net/" target="_blank">Dr. Stefan Schmidt</a>, who in fact used to teach me J2EE technology at UTS when I was a UTS student, has been working for Spring Source and is now involved in ROO development. Although ROO sounds really like Australian, it signifies Real Object-Oriented (ROO). After the release of the alpha version, Dr. Schmidt posted <a href="http://stsmedia.net/introducing-spring-roo/" target="_blank">an introductory tutorial of ROO</a> on <p style="border: 3px solid rgb(243, 197, 52); padding: 5px; background-color: rgb(254, 254, 184); width: 600px; text-align: center;">[...Continue reading <a href="http://blog.lckymn.com/2009/05/17/roo-so-cool-01/">ROO So Cool!!! -01-</a>...]</p>]]></description>
			<content:encoded><![CDATA[<p>The end of the last month Spring Source released Spring ROO in alpha stage.  My friend, <a href="http://stsmedia.net/" target="_blank">Dr. Stefan Schmidt</a>, who in fact used to teach me J2EE technology at UTS when I was a UTS student, has been working for Spring Source and is now involved in ROO development. Although ROO sounds really like Australian, it signifies Real Object-Oriented (ROO).  After the release of the alpha version, Dr. Schmidt posted <a href="http://stsmedia.net/introducing-spring-roo/" target="_blank">an introductory tutorial of ROO</a> on his blog.  He explained well so I could easily try this new mind-blowing technology. <img src='http://blog.lckymn.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Let&#8217;s start a journey!</p>
<p>-Check your maven and JVM versions.</p>
<pre class="brush: bash; gutter: false; title: ; notranslate">
$ mvn --version
Maven version: 2.0.9
Java version: 1.6.0_13
OS name: &quot;linux&quot; version: &quot;2.6.28-11-generic&quot; arch: &quot;amd64&quot; Family: &quot;unix&quot;
</pre>
<p>- I&#8217;m using Ubuntu Linux 9.04 Jaunty Jackalope desktop edition 64bit and installed Sun JDK &amp; Maven2 from its repository.</p>
<p>-Extract <code>spring-roo-1.0.0.A2.zip</code> file to <code>/somepath/roo-1.0.0.A2</code><br />
-Add the environment variable ROO_HOME with the path of Roo home in the <code>.bashrc</code> file.<br />
-Add $ROO_HOME/bin to PATH in the <code>.bashrc</code> file.<br />
e.g.)</p>
<pre class="brush: bash; gutter: false; title: ; notranslate">
export ROO_HOME=/opt/lib/spring/roo-1.0.0.A2
PATH=${PATH}:$ROO_HOME/bin

export PATH
</pre>
<p>For Eclipse,<br />
-Extract <code>sts-roo-integration-1.0.0.A2.zip</code> file to the <code>eclipse/dropins</code> folder to use Spring ROO integration.<br />
This copying to the dropins directory only works for Eclipse Ganymede.</p>
<p>-Install ROO packages in the maven repository.</p>
<pre class="brush: bash; gutter: false; title: ; notranslate">
mvn install:install-file -DgroupId=org.springframework.roo \
  -DartifactId=roo-annotations -Dversion=1.0.0.A2 -Dpackaging=jar \
  -Dfile=$ROO_HOME/dist/roo-annotations-1.0.0.A2.jar
</pre>
<p>-Result</p>
<pre class="brush: bash; gutter: false; title: ; notranslate">
$ mvn install:install-file -DgroupId=org.springframework.roo \
       -DartifactId=roo-annotations -Dversion=1.0.0.A2 -Dpackaging=jar \
       -Dfile=$ROO_HOME/dist/roo-annotations-1.0.0.A2.jar
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'install'.
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO]    task-segment: [install:install-file] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [install:install-file]
[INFO] Installing /opt/lib/spring/roo-1.0.0.A2/dist/roo-annotations-1.0.0.A2.jar to /home/blade2/.m2/repository/org/springframework/roo/roo-annotations/1.0.0.A2/roo-annotations-1.0.0.A2.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Tue May 05 22:09:23 EST 2009
[INFO] Final Memory: 7M/165M
[INFO] ------------------------------------------------------------------------
</pre>
<p>-Now starts ROO console!</p>
<pre class="brush: bash; gutter: false; title: ; notranslate">
$ mkdir roo_test
$ cd roo_test/
$ roo.sh
</pre>
<div id="attachment_149" class="wp-caption alignnone" style="width: 801px"><a href="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-00.jpg"><img src="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-00.jpg" alt="ROO Console" title="ROO Console" width="791" height="583" class="size-full wp-image-149" /></a><p class="wp-caption-text">ROO Console</p></div>
<p>-Create a project directory for a ROO project.</p>
<pre>
roo&gt; script vote.roo
(... wait until ROO console does it's job...)
roo&gt; exit
</pre>
<p>Instead of following the script that Dr. Schmidt provided, I just used <code>vote.roo</code> which can be found in the <code>samples</code> directory. Well no special reasons, it just looks simpler. That&#8217;s it. <img src='http://blog.lckymn.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   If you are seeking more interesting one, you&#8217;d better try the one on the blog of Dr. Schmidt and then try your own one. ^O^</p>
<p>-In order to import the ROO project, just created, to Eclipse (STS), run maven2&#8242;s eclipse plug-in.</p>
<pre class="brush: bash; gutter: false; title: ; notranslate">
$ mvn eclipse:eclipse
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'eclipse'.
[INFO] ------------------------------------------------------------------------
[INFO] Building vote
[INFO]    task-segment: [eclipse:eclipse]
[INFO] ------------------------------------------------------------------------
[INFO] Preparing eclipse:eclipse
Downloading:
... lots of dependencies including spring framework 3.0.0.M2 ...

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7 minutes 26 seconds
[INFO] Finished at: Tue May 05 22:32:18 EST 2009
[INFO] Final Memory: 31M/353M
[INFO] ------------------------------------------------------------------------
</pre>
<p>Well, although it says</p>
<blockquote><p>
Sources for some artifacts are not available.<br />
Javadoc for some artifacts is not available.
</p></blockquote>
<p>it is not that important unless I really want to see the missing source code and Javadoc of the artifacts listed with the message.</p>
<p>If you want to get it, add <code>-DdownloadSources=true  -DdownloadJavadocs=true</code> options and run maven again.</p>
<pre class="brush: bash; gutter: false; title: ; notranslate">
$ mvn eclipse:eclipse -DdownloadSources=true  -DdownloadJavadocs=true
</pre>
<p><del datetime="2009-05-17T17:36:05+00:00">I&#8217;m not sure if the source is available though.</del> <del datetime="2009-05-21T13:38:58+00:00">The source code is not available at the moment though.</del> I was wrong. The source code is available. Check this out. <a href="http://forum.springsource.org/showthread.php?t=71985" target="_blank">http://forum.springsource.org/showthread.php?t=71985</a></p>
<p>-Now run Eclipse. Since ROO is a part of Spring Framework, I&#8217;m using SpringSource Tool Suite (STS) for this practice.</p>
<div id="attachment_150" class="wp-caption alignnone" style="width: 511px"><a href="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-01.jpg"><img src="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-01.jpg" alt="SpringSource Tool Suite" title="SpringSource Tool Suite" width="501" height="341" class="size-full wp-image-150" /></a><p class="wp-caption-text">SpringSource Tool Suite</p></div>
<p>Well, before I go further, here are what I am using.<br />
*SpringSource Tool Suite (STS) 2.0.0</p>
<ul>
<li>Apart from all the Spring related plug-ins that STS comes with, it also comes with several good plug-ins such as AspectJ Development Tools (AJDT), <a href="http://pmd.sourceforge.net/integrations.html#eclipse" target="_blank">PMD for Eclipse</a> (Java source code analyser) and EclEmma (Code Coverage Tool) which are what I usually install when I use pure Eclipse JEE.</li>
</ul>
<p>*Eclipse Plug-ins</p>
<ul>
<li>Subclipse</li>
<li>Maven Integration for Eclipse (M2Eclipse)</li>
<li>Aptana</li>
<li>JDepend (Java source code analyser)</li>
<li>Copy Fully Qualified Class Name Plugin</li>
<li>Resource Bundle Editor</li>
<li>and of course Spring ROO Integration for Eclipse (I heard a new STS will include it).</li>
</ul>
<p>However, what are really required for this ROO practice are Eclipse JEE, Spring IDE, AJDT, M2Eclipse and Spring ROO Integration. Or you can simply use STS and install M2Eclipse and Spring ROO Integration.  If you use Eclipse JEE Ganymede and install Spring IDE, it will automatically install AJDT as a dependency of Spring IDE since Ganymede has a smart software &amp; add-ons update manager. <img src='http://blog.lckymn.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>(Good News: A free version of STS is released. Check this out<br />
<a href="http://blog.springsource.com/2009/05/07/springsource-tool-suite-now-free/" target="_blank">SpringSource Tool Suite now free</a>).</p>
<p><div id="attachment_151" class="wp-caption alignnone" style="width: 916px"><a href="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-02.jpg"><img src="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-02.jpg" alt="Import ROO project" title="Import ROO project" width="906" height="693" class="size-full wp-image-151" /></a><p class="wp-caption-text">Import ROO project</p></div><br />
Right click on the project explorer -> Select <code>Import</code></p>
<p><div id="attachment_152" class="wp-caption alignnone" style="width: 920px"><a href="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-03.jpg"><img src="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-03.jpg" alt="Existing Projects into Workspace" title="Existing Projects into Workspace" width="910" height="699" class="size-full wp-image-152" /></a><p class="wp-caption-text">Existing Projects into Workspace</p></div><br />
Expand the <code>General</code> entry -> Select <code>Existing Projects into Workspace</code> -> Click the <code>Next</code> button.</p>
<p><div id="attachment_153" class="wp-caption alignnone" style="width: 919px"><a href="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-04.jpg"><img src="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-04.jpg" alt="Select Project to Import" title="Select Project to Import" width="909" height="696" class="size-full wp-image-153" /></a><p class="wp-caption-text">Select Project to Import</p></div><br />
Browse the roo project directory created by roo. In my case it&#8217;s <code>roo_test</code> -> Click the <code>Finish</code> button.<br />
(NOTE: Because I created the roo project directory inside the workspace of Eclipse (STS), I don&#8217;t need to check <code>Copy projects into workspace</code> option.)</p>
<p><div id="attachment_154" class="wp-caption alignnone" style="width: 919px"><a href="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-05.jpg"><img src="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-05.jpg" alt="Turn AJDT&#039;s Weaving Service on" title="Turn AJDT&#039;s Weaving Service on" width="909" height="696" class="size-full wp-image-154" /></a><p class="wp-caption-text">Turn AJDT's Weaving Service on</p></div><br />
If Eclipse asks to turn on weaving service function of AJDT, Click the <code>Yes</code> button.</p>
<p><div id="attachment_155" class="wp-caption alignnone" style="width: 919px"><a href="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-06.jpg"><img src="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-06.jpg" alt="Restart STS (Eclipse)" title="Restart STS (Eclipse)" width="909" height="696" class="size-full wp-image-155" /></a><p class="wp-caption-text">Restart STS (Eclipse)</p></div><br />
Restart Eclipse.</p>
<p><div id="attachment_156" class="wp-caption alignnone" style="width: 477px"><a href="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-07_01.jpg"><img src="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-07_01.jpg" alt="Dependency Problems" title="Dependency Problems" width="467" height="698" class="size-full wp-image-156" /></a><p class="wp-caption-text">Dependency Problems</p></div><br />
Eclipse is restarted and there are errors in the project as the require dependencies are not in the project directory.</p>
<p>So now, let M2Eclipse resolves this dependency problem. That&#8217;s why I&#8217;m using this plug-in. I want to focus on real problems in software development rather than focusing on providing dependency libraries for development.</p>
<p><div id="attachment_157" class="wp-caption alignnone" style="width: 804px"><a href="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-07_02.jpg"><img src="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-07_02.jpg" alt="Let M2Eclipse Resolves Dependencies" title="Let M2Eclipse Resolves Dependencies" width="794" height="708" class="size-full wp-image-157" /></a><p class="wp-caption-text">Let M2Eclipse Resolves Dependencies</p></div><br />
Right click on the project -> Select the <code>Maven</code> option on the menu -> Select the <code>Enable Dependency Management</code>.<br />
Wait until it does its job.</p>
<p><div id="attachment_158" class="wp-caption alignnone" style="width: 475px"><a href="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-08.jpg"><img src="http://blog.lckymn.com/wp-content/uploads/2009/05/roo-08.jpg" alt="Dependency Problems Solved" title="Dependency Problems Solved" width="465" height="699" class="size-full wp-image-158" /></a><p class="wp-caption-text">Dependency Problems Solved</p></div><br />
As shown here, Maven resolved it so all the required dependencies are there.</p>
<p>Next:<br />
<a href="http://blog.lckymn.com/2009/05/17/roo-so-cool-02/" target="_blank">http://blog.lckymn.com/2009/05/17/roo-so-cool-02/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lckymn.com/2009/05/17/roo-so-cool-01/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

