<?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>André.blog</title>
	<atom:link href="http://andrerigon.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://andrerigon.wordpress.com</link>
	<description>Because I like coding</description>
	<lastBuildDate>Wed, 16 Sep 2009 13:18:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='andrerigon.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>André.blog</title>
		<link>http://andrerigon.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://andrerigon.wordpress.com/osd.xml" title="André.blog" />
	<atom:link rel='hub' href='http://andrerigon.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Groovy and the with method</title>
		<link>http://andrerigon.wordpress.com/2009/09/10/groovy-and-the-with-method/</link>
		<comments>http://andrerigon.wordpress.com/2009/09/10/groovy-and-the-with-method/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 20:34:51 +0000</pubDate>
		<dc:creator>andrerigon</dc:creator>
				<category><![CDATA[groovy]]></category>

		<guid isPermaLink="false">http://andrerigon.wordpress.com/?p=20</guid>
		<description><![CDATA[Groovy has some interesting additions to the well known java sdk. As an example, see groovy additions for Object. One good example is the with method. The with method receive a closure as a parameter. Inside it, you can configure the object state, set properties and call any method: More, you can transform code like [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=andrerigon.wordpress.com&amp;blog=9208215&amp;post=20&amp;subd=andrerigon&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Groovy has some interesting additions to the well known java sdk. As an example, see groovy additions for <a href="http://groovy.codehaus.org/groovy-jdk/java/lang/Object.html" target="_blank">Object</a>.</p>
<p>One good example is the with method. The with method receive a closure as a parameter. Inside it, you can configure the object state, set properties and call any method:</p>
<p><pre class="brush: java;">

class Person{
 int age
 String name
 String address    
 boolean workDone

 def doVeryExpensiveWork(){
 println 'working....'
 workDone = true
 }

 def String toString(){
 return &quot;Person -&gt; age: ${age}, name: ${name}, address: ${address}, workDone: ${workDone} &quot;
 }
}

def p = new Person()
p.with{
 age = 12
 name = 'andre'
 address = 'my address'
 doVeryExpensiveWork()
}

assert p.age == 12
assert p.name == 'andre'
assert p.address == 'my address'
assert p.workDone

println p

</pre></p>
<p>More, you can transform code like this:</p>
<p><pre class="brush: java;">

Calendar javaCalendar = Calendar.getInstance();
javaCalendar.clear();
javaCalendar.set(Calendar.MONTH, Calendar.JULY);
javaCalendar.set(Calendar.DATE, 19);
javaCalendar.set(Calendar.YEAR, 1986);
Date time = javaCalendar.getTime();

</pre></p>
<p>into this one:</p>
<p><pre class="brush: java;">

//groovy
gcalendar = Calendar.instance
gcalendar.with{
 clear()
 set MONTH, JULY
 set DATE,  19
 set YEAR,  1986
}

assert javaCalendar.time == gcalendar.time

</pre></p>
<p>=D</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/andrerigon.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/andrerigon.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/andrerigon.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/andrerigon.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/andrerigon.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/andrerigon.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/andrerigon.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/andrerigon.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/andrerigon.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/andrerigon.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/andrerigon.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/andrerigon.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/andrerigon.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/andrerigon.wordpress.com/20/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=andrerigon.wordpress.com&amp;blog=9208215&amp;post=20&amp;subd=andrerigon&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://andrerigon.wordpress.com/2009/09/10/groovy-and-the-with-method/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2d53e3d88f665da6a8023589762f9b02?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">andrerigon</media:title>
		</media:content>
	</item>
		<item>
		<title>Groovy plus camel magic</title>
		<link>http://andrerigon.wordpress.com/2009/08/28/groovy-plus-camel-magic/</link>
		<comments>http://andrerigon.wordpress.com/2009/08/28/groovy-plus-camel-magic/#comments</comments>
		<pubDate>Fri, 28 Aug 2009 02:51:05 +0000</pubDate>
		<dc:creator>andrerigon</dc:creator>
				<category><![CDATA[groovy]]></category>

		<guid isPermaLink="false">http://andrerigon.wordpress.com/?p=8</guid>
		<description><![CDATA[It&#8217;s such a pain in the ass complex task integrate enterprise legacy systems. Bad architectural decisions, poor implementation, or maybe just &#8216;out-of-date&#8217; tecnology sometimes  make integration a hard task. For some time I&#8217;ve been studying some dynamic languages. Groovy seems like a good choice,  since I really like java (Erlang and Ruby are in my [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=andrerigon.wordpress.com&amp;blog=9208215&amp;post=8&amp;subd=andrerigon&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s such a <span style="text-decoration:line-through;">pain in the ass</span> complex task integrate enterprise legacy systems. Bad architectural decisions, poor implementation, or maybe just &#8216;out-of-date&#8217; tecnology sometimes  make integration a hard task.</p>
<p>For some time I&#8217;ve been studying some dynamic languages. Groovy seems like a good choice,  since I really like java (Erlang and Ruby are in my TODO list).</p>
<p>Some time ago I heard about <a title="Apache Camel" href="http://camel.apache.org/">Apache Camel</a>, an integration framework based on well known <a title="Enterprise Integration Patterns" href="http://camel.apache.org/enterprise-integration-patterns.html">Enterprise Integration Patterns.</a></p>
<p>Looking at suported languages, <span style="text-decoration:line-through;">WOW</span> it has groovy support. So, let&#8217;s stop talking and show real code that sends messages from files in a filesystem directory to a gtalk account:</p>
<p><pre class="brush: java;">
import org.apache.camel.impl.DefaultCamelContext
import org.apache.camel.language.groovy.GroovyRouteBuilder
</pre></p>
<p>We need to import <strong>DefaultCamelContex</strong>, where we configure routes and the policies to use.<br />
Also, we use <strong>GroovyRouteBuilder</strong>, base class with route management capabilities</p>
<p><pre class="brush: java;">
@Grab(group='org.apache.camel', module='camel-groovy', version='1.6.0')
@Grab(group='org.apache.camel', module='camel-core', version='1.6.0')
@Grab(group='org.apache.camel', module='camel-xmpp', version='1.6.0')
</pre></p>
<p>Uses <a title="Grape" href="http://groovy.codehaus.org/Grape">Grape</a> to retrieve dependencies needed: camel groovy supoort, camel core and camel xmpp component.</p>
<p><pre class="brush: java;">

class SimpleXMPPRoute extends GroovyRouteBuilder {
     protected void configure(){
         from(&quot;file:///tmp/from/?noop=true&quot;).
         to(&quot;xmpp://talk.google.com:5222/&lt;target_user&gt;?serviceName=gmail.com&amp;user=&lt;sender_user&gt;&amp;password=&lt;sender_passwd&gt;&quot;);
     }
}
</pre></p>
<p>Here we configure our route inside the <strong>configure</strong> method. Note that our class extends <strong>GroovyRouteBuilder</strong>.<br />
First, we define the source of data. The example above uses a <a title="File Component" href="http://camel.apache.org/file.html">File</a> component, scanning a directory for any new (or modified) file.<br />
When modifications are detected, the framework &#8216;sends&#8217;  the file to the <a title="XMPP Component" href="http://camel.apache.org/xmpp.html">XMPP</a> component, which sends the file contents to the specified gtalk user.</p>
<p><pre class="brush: java;">

def camelCtx = new DefaultCamelContext()
camelCtx.addRoutes(new SimpleXMPPRoute())
camelCtx.start()

</pre></p>
<p>Finally, create the camel context, add our xmpp route and start the context. That&#8217;s it!</p>
<p>We can integrate several components like databases, jms queues and so on. It&#8217;s easy to transform output data from some system and then plug that output as input to others systems, with no acknowledgment of each other .</p>
<p>Simple, isn&#8217;t it?</p>
<p>=D</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/andrerigon.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/andrerigon.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/andrerigon.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/andrerigon.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/andrerigon.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/andrerigon.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/andrerigon.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/andrerigon.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/andrerigon.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/andrerigon.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/andrerigon.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/andrerigon.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/andrerigon.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/andrerigon.wordpress.com/8/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=andrerigon.wordpress.com&amp;blog=9208215&amp;post=8&amp;subd=andrerigon&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://andrerigon.wordpress.com/2009/08/28/groovy-plus-camel-magic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2d53e3d88f665da6a8023589762f9b02?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">andrerigon</media:title>
		</media:content>
	</item>
		<item>
		<title>Blog blog = new Blog()</title>
		<link>http://andrerigon.wordpress.com/2009/08/28/hello-world/</link>
		<comments>http://andrerigon.wordpress.com/2009/08/28/hello-world/#comments</comments>
		<pubDate>Fri, 28 Aug 2009 00:55:02 +0000</pubDate>
		<dc:creator>andrerigon</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Well, finally I had courage enough and started my own blog. It will be in english, so I can force myself to exercise more that language. Nowadays almost all my projects are in Java, so expect many java-groovy and so on related posts. But C, Python and many others crazy computer science topics that I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=andrerigon.wordpress.com&amp;blog=9208215&amp;post=1&amp;subd=andrerigon&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Well, finally I had courage enough and started my own blog.</p>
<p>It will be in english, so I can force myself to exercise more that language.</p>
<p>Nowadays almost all my projects are in Java, so expect many java-groovy and so on related posts.</p>
<p>But C, Python and many others crazy computer science topics that I like will be here sometimes.</p>
<p>So, I hope you enjoy. Or not. =D</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/andrerigon.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/andrerigon.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/andrerigon.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/andrerigon.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/andrerigon.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/andrerigon.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/andrerigon.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/andrerigon.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/andrerigon.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/andrerigon.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/andrerigon.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/andrerigon.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/andrerigon.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/andrerigon.wordpress.com/1/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=andrerigon.wordpress.com&amp;blog=9208215&amp;post=1&amp;subd=andrerigon&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://andrerigon.wordpress.com/2009/08/28/hello-world/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2d53e3d88f665da6a8023589762f9b02?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">andrerigon</media:title>
		</media:content>
	</item>
	</channel>
</rss>
