<?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>Jotadeveloper Blog</title>
	<atom:link href="http://blog.jotadeveloper.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.jotadeveloper.com</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Sun, 11 Jul 2010 21:42:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>España Campeón del Mundo !!!!!</title>
		<link>http://blog.jotadeveloper.com/2010/07/11/espana-campeon-del-mundo/</link>
		<comments>http://blog.jotadeveloper.com/2010/07/11/espana-campeon-del-mundo/#comments</comments>
		<pubDate>Sun, 11 Jul 2010 21:42:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Articulos]]></category>
		<category><![CDATA[España]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[sudafrica 2010]]></category>
		<category><![CDATA[world cup]]></category>

		<guid isPermaLink="false">http://blog.jotadeveloper.com/?p=3072</guid>
		<description><![CDATA[Y el sueño se hizo realidad... ¡¡¡Somos campeones del mundo!!! España se ha ganado un hueco en el olimpo del fútbol gracias a un gol de Iniesta en la segunda parte de la prórroga (115&#8242;) de la final del Mundial de Sudáfrica ante una Holanda que repartió de lo lindo y a pesar del pésimo [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.jotadeveloper.com/wp-content/uploads/2010/07/1278872362_extras_portada_21.jpg" rel="lightbox"><img class="alignnone size-full wp-image-3071" title="1278872362_extras_portada_2" src="http://blog.jotadeveloper.com/wp-content/uploads/2010/07/1278872362_extras_portada_21.jpg" alt="" width="980" height="350" /></a></p>
<p><span style="font-weight: normal;">Y </span><span style="font-weight: normal;">el sueño se hizo realidad</span><span style="font-weight: normal;">.</span><span style="font-weight: normal;">.. </span><span style="font-weight: normal;"><strong>¡¡¡</strong></span><span style="font-weight: normal;"><strong>Somos campeones del mundo</strong></span><span style="font-weight: normal;"><strong>!!! </strong></span><span style="font-weight: normal;">España se ha ganado un hueco en el olimpo del fútbol gracias a un gol de </span><span style="font-weight: normal;">Iniesta en la segunda parte de la prórroga (115&#8242;)</span><span style="font-weight: normal;"> de la final del Mundial de Sudáfrica ante una Holanda que repartió de lo lindo y a pesar del pésimo arbitraje de Howard Webb</span><span style="font-weight: normal;"><strong>.</strong></span><span style="font-weight: normal;"><strong> </strong></span><span style="font-weight: normal;"><strong>Tuvimos que sufrir pero mereció la pena</strong></span><span style="font-weight: normal;"><strong> y el sueño</strong></span><span style="font-weight: normal;">, dejó de ser tal, para convertirse en realidad</span><span style="font-weight: normal;">.</span><span style="font-weight: normal;"><strong> ¡¡¡Enhorabuena </strong></span><span style="font-weight: normal;"><strong>campeones</strong></span><span style="font-weight: normal;"><strong>!!!</strong></span></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jotadeveloper.com/2010/07/11/espana-campeon-del-mundo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Crea tus Feed con RSS o Atom con Spring 3.0 y REST</title>
		<link>http://blog.jotadeveloper.com/2010/07/09/crea-tus-feed-con-rss-o-atom-con-spring-3-0-y-rest/</link>
		<comments>http://blog.jotadeveloper.com/2010/07/09/crea-tus-feed-con-rss-o-atom-con-spring-3-0-y-rest/#comments</comments>
		<pubDate>Sat, 10 Jul 2010 02:55:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Articulos]]></category>
		<category><![CDATA[Programación]]></category>
		<category><![CDATA[Software Libre]]></category>
		<category><![CDATA[atom]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[mvc]]></category>
		<category><![CDATA[rest]]></category>
		<category><![CDATA[rss]]></category>
		<category><![CDATA[spring]]></category>

		<guid isPermaLink="false">http://blog.jotadeveloper.com/?p=3050</guid>
		<description><![CDATA[Hola Gente, regreso a las andadas varios meses después con una serie de artículos sobre Spring 3.0. El primero de ellos sera de unas clases nuevas que nos ofrece Spring MVC 3.0 para crear nuestros propios Feed con 2 formatos diferentes, RSS 2.0 o Atom. Primero vamos a conocer las 2 clases abstractas disponibles desde [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.jotadeveloper.com/wp-content/uploads/2010/07/banner-rss1.jpg" rel="lightbox"><img class="size-medium wp-image-3060" title="banner-rss" src="http://blog.jotadeveloper.com/wp-content/uploads/2010/07/banner-rss-300x57.jpg" alt="" width="300" height="57" /></a></p>
<p>Hola Gente, <strong>regreso a las andadas varios meses después</strong> con una serie de artículos sobre <strong>Spring 3.0</strong>. El primero de ellos sera de unas clases nuevas que nos ofrece Spring MVC 3.0 para crear nuestros propios Feed con 2 formatos diferentes, <strong>RSS 2.0 o Atom</strong>.</p>
<p>Primero vamos a conocer las 2 clases abstractas <strong>disponibles desde Spring 3.0</strong> que vamos a usar</p>
<h2>AbstractRssFeedView</h2>
<p><a href="http://static.springsource.org/spring/docs/current/javadoc-api/org/springframework/web/servlet/view/feed/AbstractFeedView.html">AbstractFeedView</a> es la clase para crear  nuestra vista principal de RSS y esta a su vez se extiende de <a href="http://static.springsource.org/spring/docs/current/javadoc-api/org/springframework/web/servlet/view/AbstractView.html" target="_blank">AbstractView</a> nos ofrece metodos para crear los encabezados de nuestro RSS.</p>
<h2>AbstractAtomFeedView</h2>
<p>Esta clase abstracta extiende de <a href="http://static.springsource.org/spring/docs/3.0.2.RELEASE/javadoc-api/org/springframework/web/servlet/view/feed/AbstractAtomFeedView.html">AbstractAtomFeedView</a> y esta tambien se extiende de <a href="http://static.springsource.org/spring/docs/current/javadoc-api/org/springframework/web/servlet/view/AbstractView.html" target="_blank">AbstractView</a>.</p>
<p><strong>No es posible crear una sola clase para manejar los dos formatos</strong>, asi que trabajaremos solamente con RSS, el proceso para ATOM es practicamente el mismo.</p>
<p>Extendemos <strong>AbstractRssFeedView</strong> y creamos la siguiente vista. Se <strong>deben implementar 2 metodos obligatoriamente</strong>, el primero es para crear el encabezado del RSS (ojo, <strong>si no lo llenas bien recibiras una bonita excepcion</strong>) y el otro metodo es para setear todo el cuerpo del RSS.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000000; font-weight: bold;">class</span> MyViewFeedRssView <span style="color: #000000; font-weight: bold;">extends</span> AbstractRssFeedView <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #008000; font-style: italic; font-weight: bold;">/**
     * En el caso de los RSS debemos crear el Channel, parece la gente de Spring se olvido de hacerlo por nosotros, ojo
     * con llenar bien el Channel.
     */</span>
    @Override
    <span style="color: #000000; font-weight: bold;">protected</span> Channel newFeed<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">final</span> Channel channel <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Channel<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;rss_2.0&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        channel.<span style="color: #006633;">setPubDate</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Date</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        channel.<span style="color: #006633;">setDescription</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;RSS Description&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        channel.<span style="color: #006633;">setTitle</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;TITLE&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        channel.<span style="color: #006633;">setLink</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;link&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        channel.<span style="color: #006633;">setCopyright</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;2010&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        channel.<span style="color: #006633;">setPubDate</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Date</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">return</span>  channel<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #008000; font-style: italic; font-weight: bold;">/**
     * Build Feed Entries.
     */</span>
    @SuppressWarnings<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;unchecked&quot;</span><span style="color: #009900;">&#41;</span>
    @Override
    <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #003399;">List</span> buildFeedEntries<span style="color: #009900;">&#40;</span><span style="color: #003399;">Map</span> model, HttpServletRequest request,
            HttpServletResponse response<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">Exception</span> <span style="color: #009900;">&#123;</span>
         <span style="color: #666666; font-style: italic;">// Obtenemos las entradas que vienen en el modelo desde el Controller</span>
        <span style="color: #003399;">List</span> contentList <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">List</span><span style="color: #009900;">&#41;</span> model.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;entries&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">// Creamos una lista de clase de Item, el objeto de ROME que refleja cada elemento del RSS</span>
        <span style="color: #003399;">List</span> entries <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">ArrayList</span><span style="color: #009900;">&#40;</span>contentList.<span style="color: #006633;">size</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">// Iteramos nuestras entradas del blog</span>
        <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>EntriesBlog content <span style="color: #339933;">:</span> contentList<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                   <span style="color: #000000; font-weight: bold;">final</span> Item item <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Item<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #003399;">String</span> date <span style="color: #339933;">=</span> <span style="color: #003399;">String</span>.<span style="color: #006633;">format</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;%1$tY-%1$tm-%1$td&quot;</span>, content.<span style="color: #006633;">getPublicationDateTweet</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            item.<span style="color: #006633;">setTitle</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span>.<span style="color: #006633;">format</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;On %s, %s publish&quot;</span>, date, content.<span style="color: #006633;">getQuestionBean</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getQuestionName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            item.<span style="color: #006633;">setPubDate</span><span style="color: #009900;">&#40;</span>content.<span style="color: #006633;">getPublicationDateTweet</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            item.<span style="color: #006633;">setLink</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;http://www.encuestame.org&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            entries.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>entry<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">return</span> entries<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Para que esta vista<strong> pueda ser interpretada por el MVC de Spring, debemos definir un RESOLVER</strong> para que pueda encontrar nuestra vista de RSS, yo siempre le doy un orden prioritario, por si tuvieramos otros RESOLVERS definidos en nuestro MVC.<br />
<strong>Tambien agregamos como un Bean nuestra nueva vista</strong> y recordemos el ID que pronto lo usaremos.</p>
<p>Ahora vamos con el Controller, que es el encargado de recibir la peticion del <a href="http://static.springsource.org/spring/docs/3.0.3.RELEASE/javadoc-api/org/springframework/web/servlet/DispatcherServlet.html">Dispacher Servlet</a> , usaremos Anotaciones y mapeo con <strong>REST</strong> porque somos muuuuu modernos <img src='http://blog.jotadeveloper.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  .  Yo extendi de una clase abstracta, que no tiene nada pero no es necesario para nuestro ejemplo.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">@Controller
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> RSSFeedController <span style="color: #000000; font-weight: bold;">extends</span> AbstractFeedController <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #008000; font-style: italic; font-weight: bold;">/**
     * Build Feed Body.
     */</span>
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> buildTweetPollFeedBody<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> username, Model model, HttpServletRequest request, User user<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
         model.<span style="color: #006633;">addAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;username&quot;</span>, username<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
         model.<span style="color: #006633;">addAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;feedTitle&quot;</span>, <span style="color: #003399;">String</span>.<span style="color: #006633;">format</span><span style="color: #009900;">&#40;</span>TWEET_POLL_FEED_TITLE, username<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
         model.<span style="color: #006633;">addAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;url&quot;</span>, buildDomainWithRequest<span style="color: #009900;">&#40;</span>request<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
         <span style="color: #666666; font-style: italic;">//buscamos nuestras entradas de nuestro blog, por poner un ejemplo</span>
         <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">List</span> entries <span style="color: #339933;">=</span> getEntries<span style="color: #009900;">&#40;</span>user.<span style="color: #006633;">getUsername</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
          <span style="color: #666666; font-style: italic;">// las guardamos en el modelo que pasaremos a la vista y usaremos mas adelante.</span>
         model.<span style="color: #006633;">addAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;entries&quot;</span>, entries<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #008000; font-style: italic; font-weight: bold;">/**
     * Display RSS Feed.
     */</span>
     <span style="color: #666666; font-style: italic;">// Utilizar REST es sencillo, solo debemos definir la variable entre llaves y llamarla con la anotacion @PathVariable</span>
    @RequestMapping<span style="color: #009900;">&#40;</span>value <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;/feed/{username}/entries.rss&quot;</span>, method <span style="color: #339933;">=</span> RequestMethod.<span style="color: #006633;">GET</span><span style="color: #009900;">&#41;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> tweetPollRss<span style="color: #009900;">&#40;</span>@PathVariable <span style="color: #003399;">String</span> username, Model model, HttpServletRequest request<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
       <span style="color: #666666; font-style: italic;">// Como queremos utilizar el mismo RSS para diferentes usuarios, buscamos nuestro usuario.</span>
        <span style="color: #000000; font-weight: bold;">final</span> User user <span style="color: #339933;">=</span> getByUsername<span style="color: #009900;">&#40;</span>username<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>user <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #666666; font-style: italic;">//TODO: if null do something.</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">else</span><span style="color: #009900;">&#123;</span>
             <span style="color: #666666; font-style: italic;">// Como somos muy ordenados creamos otro metodo.</span>
            <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">buildTweetPollFeedBody</span><span style="color: #009900;">&#40;</span>username, model, request, user<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #666666; font-style: italic;">// Aqui regresaremos una cadena, que no es mas que el ID de nuestra VISTA del Bean RSS.</span>
        <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;rssFeedView&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Una vez creada toda esta estructura, lo siguiente es pan comido, <strong>simplemente cargar en el url la direccion</strong> de la siguiente manera, sustituyendo la variable {username} por el usuario virtual para que nos regrese los RSS de ese usuario.</p>
<p><strong>http://localhost/feed/bonachon/entries.rss</strong></p>
<p><strong>Preguntas?</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jotadeveloper.com/2010/07/09/crea-tus-feed-con-rss-o-atom-con-spring-3-0-y-rest/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java 4 Ever</title>
		<link>http://blog.jotadeveloper.com/2010/06/26/java-4-ever/</link>
		<comments>http://blog.jotadeveloper.com/2010/06/26/java-4-ever/#comments</comments>
		<pubDate>Sat, 26 Jun 2010 06:42:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programación]]></category>
		<category><![CDATA[Software Libre]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://blog.jotadeveloper.com/2010/06/26/java-4-ever/</guid>
		<description><![CDATA[Con un toque made in Hollywood, excelente trailer de una historia de amor por Java, no tiene desperdicio. Lo que mas me gusta es el reparto de actores y atrices. Scala Johansson]]></description>
			<content:encoded><![CDATA[<p>Con un toque made in Hollywood,<strong> excelente trailer de una historia de amor por Java</strong>, no tiene desperdicio. Lo que mas me gusta es el reparto de actores y atrices. Scala Johansson <img src='http://blog.jotadeveloper.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p><object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/m-zNPQj6UQE&#038;color1=0xb1b1b1&#038;color2=0xd0d0d0&#038;hl=en_US&#038;feature=player_embedded&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="http://www.youtube.com/v/m-zNPQj6UQE&#038;color1=0xb1b1b1&#038;color2=0xd0d0d0&#038;hl=en_US&#038;feature=player_embedded&#038;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="640" height="385"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jotadeveloper.com/2010/06/26/java-4-ever/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Analíza la calidad de tu código Java con Sonar 2.0</title>
		<link>http://blog.jotadeveloper.com/2010/04/06/analiza-la-calidad-de-tu-codigo-java-con-sonar-2-0/</link>
		<comments>http://blog.jotadeveloper.com/2010/04/06/analiza-la-calidad-de-tu-codigo-java-con-sonar-2-0/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 05:29:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Articulos]]></category>
		<category><![CDATA[Programación]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[maven2]]></category>
		<category><![CDATA[métricas]]></category>
		<category><![CDATA[sonar]]></category>

		<guid isPermaLink="false">http://blog.jotadeveloper.com/?p=3026</guid>
		<description><![CDATA[Sonar es un proyecto OpenSource de codehaus.org para analizar la calidad tu código en Java con diferentes tipos de métricas, solo funciona con proyectos construidos con Maven2. Para descargar el proyecto http://sonar.codehaus.org/downloads/ La Instalación es bien sencilla, primero debes descomprimir el ZIP que descargaste y modificar el archivo sonar.properties: #--------------------------------------------------------- # WEB # THESE SETTINGS [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Sonar</strong> es un proyecto OpenSource de codehaus.org para <strong>analizar la calidad tu código en Java</strong> con diferentes tipos de métricas, <strong>solo funciona con proyectos construidos con Maven2</strong>.</p>
<p>Para <strong>descargar</strong> el proyecto <a href="http://sonar.codehaus.org/downloads/">http://sonar.codehaus.org/downloads/</a></p>
<p><a href="http://blog.jotadeveloper.com/wp-content/uploads/2010/04/sonar1.png" rel="lightbox"><img class="alignnone size-full wp-image-3027" title="sonar" src="http://blog.jotadeveloper.com/wp-content/uploads/2010/04/sonar1.png" alt="" width="676" height="455" /></a></p>
<p>La Instalación es <strong>bien sencilla</strong>, primero debes descomprimir el ZIP que descargaste y modificar el archivo <strong>sonar.properties</strong>:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">#---------------------------------------------------------
# WEB
# THESE SETTINGS ARE USED ONLY IN STANDALONE MODE. IGNORED WHEN THE WAR IS DEPLOYED ON A JEE SERVER.
#---------------------------------------------------------
# Listen host/port and context path (for example / or /sonar). Default values are 0.0.0.0:9000/
#sonar.web.host:                           0.0.0.0
sonar.web.port:                           8080
#sonar.web.context:                        /</pre></div></div>

<p>La primera propiedad se refiere al IP donde tienes instalado el sonar, el segundo el puerto y la tercera propiedad el contexto en tomcat o jboss,<strong> si estamos trabajando con virtualhost no creo que haga falta que pongas un contexto.</strong></p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">#----- MySQL 5.x/6.x
# Comment the embedded database and uncomment the following lines to use MySQL
sonar.jdbc.url:                                      jdbc:mysql://localhost:3306/sonar?useUnicode=true<span style="color: #ddbb00;">&amp;characterEncoding=utf8</span>
<span style="color: #ddbb00;">sonar.jdbc.driverClassName:                   com.mysql.jdbc.Driver</span>
<span style="color: #ddbb00;">sonar.jdbc.validationQuery:                     select 1</span>
&nbsp;
<span style="color: #ddbb00;">#----- Global database settings</span>
<span style="color: #ddbb00;">sonar.jdbc.username:                              sonar</span>
<span style="color: #ddbb00;">sonar.jdbc.password:                              sonar</span>
<span style="color: #ddbb00;">sonar.jdbc.maxActive:                             10</span>
<span style="color: #ddbb00;">sonar.jdbc.maxIdle:                                 5</span>
<span style="color: #ddbb00;">sonar.jdbc.minIdle:                                  2</span>
<span style="color: #ddbb00;">sonar.jdbc.maxWait:                                5000</span>
<span style="color: #ddbb00;">sonar.jdbc.minEvictableIdleTimeMillis:        600000</span>
<span style="color: #ddbb00;">sonar.jdbc.timeBetweenEvictionRunsMillis:   30000</span></pre></div></div>

<p>En mi caso decidi conectarlo con MySQL <strong>aunque por defecto unsa una base de datos local en Derby</strong>, debes comentar las lineas de derby y descomentar la base de datos que tu eligas, hay buen menú donde elegir, y tal vez modificar datos como el usuario y la contraseña de conexión a la bd.</p>
<p>Llega la hora de crear el <strong>war</strong>, en la carpeta war, <strong>corres el comando build-war.sh</strong> y publicas en tu contenedor web para java el proyecto.</p>
<p>El tercer paso y mas importante es <strong>la configuracion en settings.xml en Maven2</strong>, en tu repositorio local.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;profile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>sonar<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;activation<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;activeByDefault<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>true<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/activeByDefault<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/activation<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;properties<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;sonar.jdbc.url<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>jdbc:mysql://localhost:3306/sonar<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/sonar.jdbc.url<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;sonar.jdbc.driver<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>com.mysql.jdbc.Driver<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/sonar.jdbc.driver<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;sonar.jdbc.username<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>sonar<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/sonar.jdbc.username<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;sonar.jdbc.password<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>password<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/sonar.jdbc.password<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;sonar.host.url<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>http://tudominio:8080<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/sonar.host.url<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/properties<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/profile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/profiles<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Esta sección<strong> se agrega en la parte de PROFILES en settings.xml </strong>en Maven2. Con esto lograremos que nuestro proyecto pueda publicarse en Sonar.</p>
<p>Ahora, la parte mas sencilla, navegas al path de tu proyecto y corres el comando siguiente,</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">         mvn sonar<span style="color: #339933;">:</span>sonar</pre></div></div>

<p> y el resto es pan comido, <strong>en este proceso Sonar analizara tu código y creará las métricas en el portal</strong>. Algo como lo siguiente.<br />
<a href="http://nemo.sonarsource.org/">http://nemo.sonarsource.org/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jotadeveloper.com/2010/04/06/analiza-la-calidad-de-tu-codigo-java-con-sonar-2-0/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
