<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.2.2" -->
<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/"
	>

<channel>
	<title>Héctor Fuente Pérez</title>
	<link>http://fuenteperez.es/blog</link>
	<description>Artículos técnicos, noticias y desarrollo aplicaciones Java, PL/SQL Server Pages (PSP), ...</description>
	<pubDate>Wed, 07 Apr 2010 08:02:31 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.2</generator>
	<language>en</language>
			<item>
		<title>Manual de OpenSTA (Crear un escenario de Ejemplo)</title>
		<link>http://fuenteperez.es/blog/manual-de-opensta-crear-un-escenario-de-ejemplo</link>
		<comments>http://fuenteperez.es/blog/manual-de-opensta-crear-un-escenario-de-ejemplo#comments</comments>
		<pubDate>Wed, 07 Apr 2010 07:55:27 +0000</pubDate>
		<dc:creator>Héctor Fuente Pérez</dc:creator>
		
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://fuenteperez.es/blog/manual-de-opensta-crear-un-escenario-de-ejemplo</guid>
		<description><![CDATA[En este articulo se mostraran los pasos que debemos seguir para crear un escenario de prueba con OpenSTA (script, configuración proxy, grabar secuencia http, …).
Una vez realizada la instalación y configuración de OpenSTA siguiendo los pasos descritos en artículos anteriores, vamos a crear una prueba de stress de forma sencilla.
- Entramos en la herramienta OpenSTA [...]]]></description>
			<content:encoded><![CDATA[<p><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'">En este articulo se mostraran los pasos que debemos seguir para crear un escenario de prueba con OpenSTA (script, configuración proxy, grabar secuencia http, …).</span></p>
<p><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'">Una vez realizada la <a href="http://fuenteperez.es/blog/manual-de-opensta-instalacion">instalación y configuración</a> de OpenSTA siguiendo los pasos descritos en artículos anteriores, vamos a crear una prueba de stress de forma sencilla.</span></p>
<p><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'">- Entramos en la herramienta OpenSTA Commander.</span></span></p>
<p><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'">- <strong><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'">Creamos un script</span></strong><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'">: Un script es la secuencia de<span>  </span>pasos que va a seguir el usuario para realizar una operatoria determinada en la<span>  </span>aplicación. Esta secuencia de pasos es sobre la que queremos realizar la prueba de carga. Selección en el menú File</span><span style="font-family: Wingdings"><span><font size="3">à</font></span></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'">New Script</span><span style="font-family: Wingdings"><span><font size="3">à</font></span></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'">Http.</span></span></span></p>
<p style="text-align: center"><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo1.JPG"><br />
<img width="191" src="http://www.fuenteperez.es/resources/opensta/ejemplo1.JPG" alt="Pulsa para agrandar la imagen " height="216" style="width: 191px; height: 216px" /></a><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo1.JPG"> </a></p>
<p style="text-align: center"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"></span></span></span></span></p>
<p><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'">Crea un Script y lo marco como erroneo.</span></span></span></span></p>
<p><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><strong>- Configurar el proxy</strong></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'">: Si es el primer script que generamos tenemos que configurar el proxy y otras opciones para poder realizarla grabación de los pasos de la operatoria. Para ello realizamos doble sobre el Script creado y nos aparece la siguiente pantalla.</span></span></span></span></span></p>
<p style="text-align: center"><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo2.JPG"><br />
<img width="273" src="http://www.fuenteperez.es/resources/opensta/ejemplo2.JPG" alt="Pulsa para agrandar la imagen " height="183" style="width: 273px; height: 183px" /></a><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo2.JPG"> </a></p>
<p><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'">Dentro del menú Options tenemos vamos opciones que debemos configurar. La primera opción que tenemos que configurar es <strong>Browser</strong> donde debemos seleccionar el browser con el cual queremos realizar las pruebas de grabación.</span></span></span></span></span></span></p>
<p style="text-align: center"><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo3.JPG"><br />
<img width="215" src="http://www.fuenteperez.es/resources/opensta/ejemplo3.JPG" alt="Pulsa para agrandar la imagen " height="105" style="width: 215px; height: 105px" /></a><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo3.JPG"> </a></p>
<p><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'">Por último configuramos el proxy,<span>  </span>para ello vamos a Options</span><span style="font-size: 9pt; line-height: 115%; font-family: Wingdings"><span>à</span></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'">Gateway, nos aparece la siguiente pantalla de configuración:</span></span></span></span></span></span></span></p>
<p style="text-align: center"><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo4.JPG"><img width="147" src="http://www.fuenteperez.es/resources/opensta/ejemplo4.JPG" alt="Pulsa para agrandar la imagen " height="179" style="width: 147px; height: 179px" /></a><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo4.JPG"> </a></p>
<p><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'">Si la aplicación que queremos probar esta dentro de<span>  </span>nuestra red, seleccionamos Local y dejamos los parámetros por defecto. Si por el contrario queremos realizar prueba<span>  </span>con una aplicación que se encuentra fuera de nuestra red tendremos que configurar el Proxy.</span></span></span></span></span></span></span></span></p>
<p><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><strong>- Grabar la secuencia HTTP</strong></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'">: Dentro del Script Modeler para realizar la grabación de pasos a probar, debemos pulsar sobre el botón <img width="24" src="http://www.fuenteperez.es/resources/opensta/ejemplo5.JPG" height="17" style="width: 24px; height: 17px" /></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'">. Una vez pulsado se ejecuta el navegador y comenzamos a navegar siguiendo una determinada secuencia de pasos. Una vez termina la secuencia de pasos cerramos el navegador y automáticamente se detiene la grabación y nos muestra el script SCL en un lenguaje propio creado por el equipo de OpenSTA y que se basa en el lenguaje BASIC.</span></span></span></span></span></span></span></span></span></p>
<p style="text-align: center"><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo6.JPG"><br />
<img width="273" src="http://www.fuenteperez.es/resources/opensta/ejemplo6.JPG" alt="Pulsa para agrandar la imagen " height="183" style="width: 273px; height: 183px" title="Pulsa para agrandar la imagen " /></a><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo6.JPG"> </a></p>
<p><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"></span></span></span></span></span></span></span></span></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"></span></span></span></span></span></span></span></span></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"></span></span></span></span></span></span></span></span></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"></span></span></span></span></span></span></span></span></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"></span></span></span></span></span></span></span></span></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"></span></span></span></span></span></span></span></span></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"></span></span></span></span></span></span></span></span></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"></span></span></span></span></span></span></span></span></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"></span></span></span></span></span></span></span></span></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"></span></span></span></span></span></span></span></span></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"></span></span></span></span></span></span></span></span></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"></p>
<p style="margin: 0cm 0cm 10pt; text-align: justify" class="MsoNormal"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'">Cerramos la pantalla del Script Modeler y guardamos la secuencia de pasos.</span></p>
<p><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><strong><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'">- Creamos el Test</span></strong><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'">: Para crear el test vamos al menú File</span><span style="font-family: Wingdings"><span><font size="3">à</font></span></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"> New Test</span><span style="font-family: Wingdings"><span><font size="3">à</font></span></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'">Tests. Nos parece un nuevo test con el nombre NEWTEST y con un símbolo de<span>  </span>error. Realizamos doble click sobre el nuevo test y nos aparece la siguiente pantalla:</span></span></p>
<p style="text-align: center"><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo7.JPG"><br />
<img width="413" src="http://www.fuenteperez.es/resources/opensta/ejemplo7.JPG" alt="Pulsa para agrandar la imagen " height="187" style="width: 413px; height: 187px" title="Pulsa para agrandar la imagen " /></a><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo7.JPG"> </a></p>
<p><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'">Tenemos 3 pestañas Configuration, Monitoring y Results.</span></span></span></p>
<p><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'">Para configurar el test vamos a la pestaña de configuración, en primer lugar introducimos una pequeña descripción en Test Description.</span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'">A continuación arrastramos el script PRUEBA hacia la tabla y lo soltamos sobre Task1. La tabla nos queda<span>  </span>de la siguiente manera:</span></span></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"> </span></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"></span></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"></span></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo7.JPG"></a><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo7.JPG"></a></span></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo7.JPG"></a></span></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo7.JPG"></a></span></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo7.JPG"></a></span></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo7.JPG"></a></span></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo7.JPG"></a></span></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo7.JPG"></p>
<p style="text-align: center"><img width="426" src="http://www.fuenteperez.es/resources/opensta/ejemplo71.JPG" alt="Pulsa para agrandar la imagen " height="132" style="width: 426px; height: 132px" title="Pulsa para agrandar la imagen " /></p>
<p><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo7.JPG"></a><span style="font-size: 10pt; line-height: 115%; font-family: 'Verdana','sans-serif'">Nos aparecen varias varios valores que antes no teníamos en las columnas <strong>Task Group, Start, Status,<span>  </span>Host y VUs</strong>.</span></p>
<p></a><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"></p>
<p style="margin: 0cm 0cm 9pt; text-align: justify" class="MsoNormal"><strong><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'">Task Group</span></strong><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"> es el nombre asociado al grupo de tareas.</span></p>
<p><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><strong>Start</strong></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"> nos indica cuando se va ejecutar la tarea en el momento que lo lancemos. Puede ser <em>Immediate, Scheduled y Delayed</em>. Nosotros seleccionamos <em>Immediate</em> para que se ejecute en el momento en que pulsemos el botón<shapetype coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f" id="_x0000_t75"></shapetype> <img width="29" src="http://www.fuenteperez.es/resources/opensta/ejemplo72.JPG" height="23" style="width: 29px; height: 23px" />.<span>  </span>Scheduled y Delayed permiten planificar cuando<span>  </span>queremos que se ejecute el test. También se puede indicar el número de veces que se va a ejecutar esta tarea del test en el campo Iterations.</span><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo8.JPG"></a><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo8.JPG"></a><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo8.JPG"></a><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo8.JPG"></a><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo8.JPG"> </a><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo8.JPG"></a><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo8.JPG"></a><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo8.JPG"></a><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo8.JPG"></p>
<p style="text-align: center"><img width="412" src="http://www.fuenteperez.es/resources/opensta/ejemplo8.JPG" alt="Pulsa para agrandar la imagen " height="107" style="width: 412px; height: 107px" /></p>
<p><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo8.JPG"></a></p>
<p></a><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><strong><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'">Status</span></strong><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"> nos indica el estado en el que se encuentra la tarea, los estados dependen de la ejecución. Los pasos siguen el siguiente orden Enabled </span><span style="font-size: 9pt; line-height: 115%; font-family: Wingdings"><span>à</span></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"> Waiting Enabled </span><span style="font-size: 9pt; line-height: 115%; font-family: Wingdings"><span>à</span></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"> Running </span><span style="font-size: 9pt; line-height: 115%; font-family: Wingdings"><span>à</span></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"> Finish </span><span style="font-size: 9pt; line-height: 115%; font-family: Wingdings"><span>à</span></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"> Enabled.</span><strong><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'">Hostname</span></strong><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><span>  </span>indica la maquina desde donde se va a ejecutar el test.</span><strong><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'">VUs </span></strong><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'">indica el número de usuarios virtuales que van a realizar la secuencia pasos grabada (script) durante el test. </span></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"></p>
<p style="margin: 0cm 0cm 9pt; text-align: justify" class="MsoNormal"><strong><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'">Task n </span></strong><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'">los distintas tareas y en el orden en<span>  </span>que se van a ejecutar. En cada una de las ‘tareas’ (scripts) se puede establecer una serie de parámetros, entre ellos el número de veces que cada usuario virtual va ejecutar esta tarea en cada iteración o establecer el retardo entre cada iteración.</span></p>
<p><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"><strong><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'">- Ejecutar el test</span></strong><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'">, una vez configurado el test solamente falta ejecutarlo. Para ello pulsamos en botón<shapetype coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f" id="_x0000_t75"></shapetype> <img width="29" src="http://www.fuenteperez.es/resources/opensta/ejemplo72.JPG" height="23" style="width: 29px; height: 23px" /><br />
<formulas></formulas><f eqn="if lineDrawn pixelLineWidth 0"></f><f eqn="sum @0 1 0"></f><f eqn="sum 0 0 @1"></f><f eqn="prod @2 1 2"></f><f eqn="prod @3 21600 pixelWidth"></f><f eqn="prod @3 21600 pixelHeight"></f><f eqn="sum @0 0 1"></f><f eqn="prod @6 1 2"></f><f eqn="prod @7 21600 pixelWidth"></f><f eqn="sum @8 21600 0"></f><f eqn="prod @7 21600 pixelHeight"></f><f eqn="sum @10 21600 0"></f></p>
<path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"></path><lock v:ext="edit" aspectratio="t"></lock>. Para vez lo resultado durante la ejecución vamos a la pestaña Monitoring.</span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'">Durante la ejecución nos va a mostrar diferentes gráficos como el número de usuarios activos, el log de errores…</span><span style="font-size: 10pt; line-height: 115%; font-family: 'Verdana','sans-serif'"></span></span></p>
<p><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"></span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"></p>
<p style="margin: 0cm 0cm 9pt; text-align: justify" class="MsoNormal">&nbsp;</p>
<p><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo9.JPG"></a><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo9.JPG"></a><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo9.JPG"></a><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo9.JPG"></a><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo9.JPG"></a><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo9.JPG"></p>
<p style="text-align: center"><img width="301" src="http://www.fuenteperez.es/resources/opensta/ejemplo9.JPG" alt="Pulsa para agrandar la imagen " height="214" style="width: 301px; height: 214px" /></p>
<p><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo9.JPG"></a></p>
<p></a><strong><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'">- Analizar los resultado, </span></strong><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'">una vez terminado podemos analizar los resultados. Para ello vamos a la pestaña <strong>Results</strong>. En la parte derecha de la pantalla nos aparecerán todos resultados de las diferentes pruebas que hemos realizado sobre este test ordenados por fechas.</span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'">Seleccionamos los resultados que queremos analizar y nos muestra una serie de parámetros analizados. Los resultados nos los muestra en gráficos o tablas dependiendo del parámetro seleccionado.</span><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'"></span></p>
<p style="margin: 0cm 0cm 9pt; text-align: justify" class="MsoNormal">&nbsp;</p>
<p><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo10.JPG"></a><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo10.JPG"></a><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo10.JPG"></a><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo10.JPG"></a><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo10.JPG"></p>
<p style="text-align: center"><img width="314" src="http://www.fuenteperez.es/resources/opensta/ejemplo10.JPG" alt="Pulsa para agrandar la imagen " height="217" style="width: 314px; height: 217px" /></p>
<p><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/ejemplo10.JPG"></a></p>
<p></a><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'">Espero que os haya gustado la serie de artículos sobre la herramienta OpenSTA.</span></p>
<p style="margin: 0cm 0cm 10pt; text-align: justify" class="MsoNormal"><span style="font-size: 9pt; line-height: 115%; font-family: 'Verdana','sans-serif'">Salu2. </span><span style="font-size: 9pt; line-height: 115%; font-family: Wingdings"><span>J</span></span></p>
<p></span></span></span></span></span></span></span></span></span></span></span></span></span></span></p>
]]></content:encoded>
			<wfw:commentRss>http://fuenteperez.es/blog/manual-de-opensta-crear-un-escenario-de-ejemplo/feed</wfw:commentRss>
		</item>
		<item>
		<title>Manual de OpenSTA (Instalación)</title>
		<link>http://fuenteperez.es/blog/manual-de-opensta-instalacion</link>
		<comments>http://fuenteperez.es/blog/manual-de-opensta-instalacion#comments</comments>
		<pubDate>Wed, 31 Mar 2010 15:45:55 +0000</pubDate>
		<dc:creator>Héctor Fuente Pérez</dc:creator>
		
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://fuenteperez.es/blog/manual-de-opensta-instalacion</guid>
		<description><![CDATA[Vamos a continuar el manual de OpenSTA. En este apartado vamos a ver los pasos a seguir para instalarlo en nuestra maquina.
A continuación se detallan los pasos a seguir para realizar la instalación:
- Descargar la última versión estable de OpenSTA desde la pagina de sourceforge. (http://sourceforge.net/projects/opensta).
- Una vez descargado ejecutamos el archivo para la instalación (dependiendo de [...]]]></description>
			<content:encoded><![CDATA[<p align="left" style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2" style="font-size: 9pt">Vamos a continuar el manual de OpenSTA. En este apartado vamos a ver los pasos a seguir para instalarlo en nuestra maquina.</font></font></p>
<p align="justify" style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2" style="font-size: 9pt">A continuación se detallan los pasos a seguir para realizar la instalación:</font></font></p>
<p align="justify" style="margin-bottom: 0cm"><font face="Verdana">- <font size="2" style="font-size: 9pt">Descargar la última versión estable de OpenSTA desde la pagina de sourceforge. (</font></font><font color="#0000ff"><u><a href="http://sourceforge.net/projects/opensta"><font face="Verdana, sans-serif"><font size="2" style="font-size: 9pt">http://sourceforge.net/projects/opensta</font></font></a></u></font><font face="Verdana, sans-serif"><font size="2" style="font-size: 9pt">).</font></font></p>
<p align="justify" style="margin-bottom: 0cm"><font face="Verdana">- <font size="2" style="font-size: 9pt">Una vez descargado ejecutamos el archivo para la instalación (dependiendo de la versión puede variar el tipo de archivo, pero normalmente es un fichero .msi o .exe) y seguimos los pasos de la instalación. OpenSTA necesita 29MB para la instalación.</font></font></p>
<p><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/instalacion1.JPG"></a><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/instalacion1.JPG"></a><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/instalacion1.JPG"></a><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/instalacion1.JPG"></p>
<p style="text-align: center"><img width="273" src="http://www.fuenteperez.es/resources/opensta/instalacion1.JPG" alt="Pulsa para agrandar la imagen " height="183" style="width: 273px; height: 183px" /></p>
<p><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/instalacion1.JPG"></a></p>
<p></a></p>
<p align="justify" style="margin-bottom: 0cm"><font face="Verdana">- <font size="2" style="font-size: 9pt">Una vez terminada la instalación solicita reiniciar el equipo. Si el proceso de instalación se ha realizado correctamente nos aparecerá en la barra de tareas el siguiente icono <img src="http://www.fuenteperez.es/resources/opensta/instalacion2.JPG" /> .</font></font></p>
<p align="justify" style="margin-bottom: 0cm"><font face="Verdana">- <font size="2" style="font-size: 9pt">Dentro del menú nos aparecen 3 opciones:</font></font></p>
<p style="text-align: center"><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/instalacion3.JPG"><br />
<img width="281" src="http://www.fuenteperez.es/resources/opensta/instalacion3.JPG" alt="Pulsa para agrandar la imagen " height="91" style="width: 281px; height: 91px" /></a><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/instalacion3.JPG"> </a></p>
<p align="justify" style="margin-bottom: 0cm"> <font face="Verdana, sans-serif"><font size="2" style="font-size: 9pt">Nos vamos a centrar en el OpenSTA Commander que nos permite realizar los diferentes script y pruebas de carga.</font></font></p>
<p style="text-align: center"><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/instalacion4.JPG"><br />
<img width="273" src="http://www.fuenteperez.es/resources/opensta/instalacion4.JPG" alt="Pulsa para agrandar la imagen " height="183" style="width: 273px; height: 183px" /></a><a rel="lightbox" href="http://www.fuenteperez.es/resources/opensta/instalacion4.JPG"> </a></p>
<p align="justify" style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2" style="font-size: 9pt">- Por último, para completar vamos a configurar el repositorio donde vamos a almacenar los Collectors, Scripts y Tests. OpenSTA tiene su propio sistema de almacenamiento. Para configurar este repositorio, pulsamos sobre Tools &#8211;&gt; Repository Path y seleccionamos donde queremos establecer el repositorio.</font></font></p>
<p align="justify" style="margin-bottom: 0cm"><font size="2" face="Verdana">Ya solamente nos queda realizar un ejemplo de como crear una prueba de carga con OpenSTA. </font><font size="2" face="Verdana">Pero eso sera en el <a target="_blank" href="http://fuenteperez.es/blog/manual-de-opensta-crear-un-escenario-de-ejemplo">siguiente articulo.</a></font></p>
<p align="justify" style="margin-bottom: 0cm"><font size="2" face="Verdana">Salu2. <img src='http://fuenteperez.es/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </font></p>
]]></content:encoded>
			<wfw:commentRss>http://fuenteperez.es/blog/manual-de-opensta-instalacion/feed</wfw:commentRss>
		</item>
		<item>
		<title>Manual de OpenSTA (Introducción)</title>
		<link>http://fuenteperez.es/blog/manual-de-opensta-introduccion</link>
		<comments>http://fuenteperez.es/blog/manual-de-opensta-introduccion#comments</comments>
		<pubDate>Wed, 24 Mar 2010 17:17:07 +0000</pubDate>
		<dc:creator>Héctor Fuente Pérez</dc:creator>
		
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://fuenteperez.es/blog/manual-de-opensta-introduccion</guid>
		<description><![CDATA[&#160;
IntroducciónOpenSTA es una herramienta open-source, basada en arquitectura CORBA que permite el testeo de estrés de aplicaciones web, de una forma similar a NeoLoad.Originalmente nació como un desarrollo comercial de la  empresa CYRANO. El actual conjunto de herramientas tiene la capacidad de ejecutar secuencias de comandos HTTP y HTTPS, que junto con otros componentes forman [...]]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal">&nbsp;</p>
<p><font face="Verdana, sans-serif"><font class="Apple-style-span" face="Verdana, sans-serif" size="3"><strong><strong><span style="line-height: 115%; font-family: Verdana, sans-serif; font-size: 10pt">Introducción</span></strong></strong></font><font class="Apple-style-span" face="Verdana, sans-serif" size="3"><strong><strong><span style="line-height: 115%; font-family: Verdana, sans-serif; font-size: 10pt"></span></strong></strong></font><font class="Apple-style-span" face="Verdana, sans-serif" size="3"><strong><strong><span style="line-height: 115%; font-family: Verdana, sans-serif; font-size: 10pt"></span></strong><span style="font-family: Verdana, sans-serif; font-size: 9pt"><a href="http://opensta.org/"><span class="Apple-style-span" style="font-weight: normal">OpenSTA</span></a><span class="Apple-style-span" style="font-weight: normal"> es una herramienta open-source, basada en arquitectura CORBA que permite el testeo de estrés de aplicaciones web, de una forma similar a NeoLoad.</span><span class="Apple-style-span" style="font-weight: normal"></span></span><span style="font-family: Verdana, sans-serif; font-size: 9pt"><span class="Apple-style-span" style="font-weight: normal">Originalmente nació como un desarrollo comercial de la  empresa CYRANO. El actual conjunto de herramientas tiene la capacidad de ejecutar secuencias de comandos HTTP y HTTPS, que junto con otros componentes forman pruebas de carga y stress para la medición del desempeño de aplicaciones Web.</span><span class="Apple-style-span" style="font-weight: normal"></span></span><span style="font-family: Verdana, sans-serif; color: black; font-size: 9pt"><span class="Apple-style-span" style="font-weight: normal">El conjunto de herramientas que forman OpenSTA están diseñadas para ser utilizados por los consultores de pruebas (QAs). </span><span class="Apple-style-span" style="font-weight: normal"></span></span><span style="font-family: Verdana, sans-serif; color: black; font-size: 9pt"><span class="Apple-style-span" style="font-weight: normal"> </span></span></strong></font><font class="Apple-style-span" face="Verdana, sans-serif" size="3"><strong><span style="font-family: Verdana, sans-serif; color: black; font-size: 9pt"><span class="Apple-style-span" style="font-weight: normal">Las pruebas se realizan mediante grabaciones y reproducciones de secuencias de comandos HTTP y HTTPS, este es el mecanismo más común en este tipo de herramientas (NeoLoad, STA, etc.)</span><span class="Apple-style-span" style="font-weight: normal"></span></span><span style="font-family: Verdana, sans-serif; color: black; font-size: 9pt"><span class="Apple-style-span" style="font-weight: normal"> </span></span><span style="font-family: Verdana, sans-serif; font-size: 9pt"><span class="Apple-style-span" style="font-weight: normal">Para la  grabación  de acciones de usuario, se</span></span><span style="font-family: Verdana, sans-serif; font-size: 9pt"><span class="Apple-style-span" style="font-weight: normal"> </span></span><span style="font-family: Verdana, sans-serif; font-size: 9pt"><span class="Apple-style-span" style="font-weight: normal">configura el programa para crear un proxy que se encargará de grabar las acciones del usuario, es decir, las peticiones y las respuestas del servidor.</span><span class="Apple-style-span" style="font-weight: normal"></span></span><span style="font-family: Verdana, sans-serif; font-size: 9pt"><span class="Apple-style-span" style="font-weight: normal"> </span></span><span style="font-family: Verdana, sans-serif; font-size: 9pt"><span class="Apple-style-span" style="font-weight: normal"> Luego se configura el navegador para conectar a ese proxy, y se pone a grabar las acciones en el OpenSTA. Se realiza la prueba manualmente y cuando se termina, se para la grabación, y se guarda el script generado de la prueba.</span></span><span style="font-family: Verdana, sans-serif; color: black; font-size: 9pt"><span class="Apple-style-span" style="font-weight: normal"></span></span><span style="font-family: Verdana, sans-serif; font-size: 9pt"><span class="Apple-style-span" style="font-weight: normal">Una vez se tengan creadas unas cuantas pruebas a partir de las acciones del usuario (altas, bajas, modificaciones…), se utilizan para realizar baterías de pruebas intensas con uno o varios usuarios. El programa ejecuta las pruebas simples y cuando termina, proporciona gran cantidad de datos acerca de las pruebas.</span><span class="Apple-style-span" style="font-weight: normal"></span></span><span style="font-family: Verdana, sans-serif; font-size: 9pt"><span class="Apple-style-span" style="font-weight: normal">Por ejemplo, si queremos probar el módulo de altas de usuarios de nuestra aplicación, configuramos el proxy del OpenSTA, y nuestro navegador Firefox para conectarse al proxy. Ponemos el OpenSTA a grabar nuestras acciones. Se realiza la prueba manualmente: se entra en la aplicación, creamos un usuario. Paramos la grabación, y guardamos el script generado.</span><span class="Apple-style-span" style="font-weight: normal"></span></span><span style="font-family: Verdana, sans-serif; font-size: 9pt"><span class="Apple-style-span" style="font-weight: normal">Estos test nos ofrecerán como resultado una sería de graficas, por ejemplo:</span><span class="Apple-style-span" style="font-weight: normal"></span></span> </strong></font><font class="Apple-style-span" face="Verdana, sans-serif" size="3"><strong>
<ul>
<li><span class="Apple-style-span" style="font-size: 12px; font-weight: normal">HTTP Monitored Bytes/Sec</span></li>
<li><span class="Apple-style-span" style="font-size: 12px; font-weight: normal">HTTP Response Time v Number of Reponses</span></li>
<li><span class="Apple-style-span" style="font-size: 12px; font-weight: normal">HTTP Errors / HTTP Requeses</span></li>
<li><span class="Apple-style-span" style="font-size: 12px; font-weight: normal">HTTP Errors / Elapsed Time</span></li>
<li><span class="Apple-style-span" style="font-size: 12px; font-weight: normal">HTTP Responses / Elapsed Time</span></li>
<li><span class="Apple-style-span" style="font-size: 12px; font-weight: normal">HTTP Response Time / Elapsed Time</span></li>
<li><span class="Apple-style-span" style="font-size: 12px; font-weight: normal">HTTP Active Users / Elapsed Time</span></li>
</ul>
<p></strong></font><font class="Apple-style-span" face="Verdana, sans-serif" size="3"><strong><span class="Apple-style-span" style="font-size: 12px; font-weight: normal"><a href="http://fuenteperez.es/blog/manual-de-opensta-instalacion" title="Instalación OpenSTA">En el siguiente articulo, se mostrara como instalar OpenSTA</a>.</span></strong></font><font class="Apple-style-span" face="Verdana, sans-serif" size="3"><strong><span class="Apple-style-span" style="font-size: 12px; font-weight: normal"></span><span class="Apple-style-span" style="font-size: 12px; font-weight: normal"></span><span class="Apple-style-span" style="font-size: 12px; font-weight: normal">Salu2. <img src='http://fuenteperez.es/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </span></strong></font></font></p>
]]></content:encoded>
			<wfw:commentRss>http://fuenteperez.es/blog/manual-de-opensta-introduccion/feed</wfw:commentRss>
		</item>
		<item>
		<title>Invocar funciones JavaScirpt desde Flex (ExternalInterface)</title>
		<link>http://fuenteperez.es/blog/invocar-funciones-javascirpt-desde-flex-externalinterface</link>
		<comments>http://fuenteperez.es/blog/invocar-funciones-javascirpt-desde-flex-externalinterface#comments</comments>
		<pubDate>Tue, 02 Feb 2010 19:05:29 +0000</pubDate>
		<dc:creator>Héctor Fuente Pérez</dc:creator>
		
		<category><![CDATA[Adobe Flex]]></category>

		<guid isPermaLink="false">http://fuenteperez.es/blog/invocar-funciones-javascirpt-desde-flex-externalinterface</guid>
		<description><![CDATA[En el siguiente artículo vamos a ver como invocar funciones JavaScript desde Flex. Esto nos será de gran utilidad en muchas ocasiones.
&#160;
Un ejemplo lo podeis encontrar en http://code.google.com/p/flex-iframe/. La librería Flex-iframe permite embeber una pagina html dentro de una aplicación Flex. Esto lo consigue insertando un iframe mediante html.
&#160;
Para poder ejecutar JavaScritp vamos a utilizar [...]]]></description>
			<content:encoded><![CDATA[<p style="margin-bottom: 0cm">En el siguiente artículo vamos a ver como invocar funciones JavaScript desde Flex. Esto nos será de gran utilidad en muchas ocasiones.</p>
<p style="margin-bottom: 0cm">&nbsp;</p>
<p style="margin-bottom: 0cm">Un ejemplo lo podeis encontrar en <font color="#0000ff"><u><a href="http://code.google.com/p/flex-iframe/">http://code.google.com/p/flex-iframe/</a></u></font>. La librería Flex-iframe permite embeber una pagina html dentro de una aplicación Flex. Esto lo consigue insertando un iframe mediante html.</p>
<p style="margin-bottom: 0cm">&nbsp;</p>
<p style="margin-bottom: 0cm">Para poder ejecutar JavaScritp vamos a utilizar la clase <strong>ExternalInterface</strong> y el método estático <strong>ExtenalInterface.call()</strong>.</p>
<p style="margin-bottom: 0cm">&nbsp;</p>
<p style="margin-bottom: 0cm">Primero vamos a ver el código ActionScript:</p>
<pre class="brush: xml;">
       <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" verticalAlign="middle" backgroundColor="white">
           <mx:Script>
            private function holaMundoJavaScript():void {
                ExternalInterface.call(&#8221;holaMundo&#8221;);
            }
        ]]&gt;
        </mx:script>
        <mx:button label="¡Hola Mundo!" click="holaMundoJavaScript();" />
      </mx:Application>
</pre>
<p style="margin-bottom: 0cm">&nbsp;</p>
<p style="margin-bottom: 0cm">Ahora insertamos la función JavaScript holaMundo(), añadimos el siguiente código entre las etiquetas &lt;head&gt; &lt;/head&gt; y :</p>
<pre class="brush: js;">
function holaMundo() {
       alert("Hola Mundo desde JavaScript");
}
</pre>
<p style="margin-bottom: 0cm">&nbsp;</p>
<p style="margin-bottom: 0cm">Si estáis utilizando Flex Builder recordar que debéis introducir este código en \html-template\index.template.htm. Vamos a probar el ejemplo:</p>
<p align="center"><iframe src="http://www.fuenteperez.es/resources/externalinterface/testExternalInterface.html"></iframe></p>
<p style="margin-bottom: 0cm">&nbsp;</p>
<p style="margin-bottom: 0cm">Sencillo verdad. Ahora vamos a ver como se pasan parámetros a la función JavaScript y como la función JavaScript retorna parámetros a Flex. Este es el código AS·:</p>
<pre class="brush: xml;">
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white">
         <mx:Script>
        	import mx.controls.Alert;
                private function showMessageJavaScript():void {
                 	var ncaracteres: Number;
                        ncaracteres  = ExternalInterface.call(&#8221;showMessage&#8221;, mensaje.text);
                        Alert.show(&#8221;Numero Caracteres contados por JavaScript: &#8221; + ncaracteres);
               }
        ]]&gt;
        </mx:Script>
	<mx:Textinput id="mensaje"<7>
        <mx:Button label="¡Enviar texto a JavaScript!" click="showMessageJavaScript();" />
</mx:Application>
</pre>
<p style="margin-bottom: 0cm">&nbsp;</p>
<p style="margin-bottom: 0cm">Y creamos la función JavaScript  showMessage() a la cual, se le pasa un parámetro y nos retorna numero de caracteres del parámetro de entrada.</p>
<pre class="brush: js;">
function showMessage(mensaje) {
    	alert(mensaje);
    	return mensaje.length;
}
</pre>
<p style="margin-bottom: 0cm">&nbsp;</p>
<p style="margin-bottom: 0cm">Aquí tenemos el ejemplo.</p>
<p align="center"><iframe src="http://www.fuenteperez.es/resources/externalinterface/testExternalInterface2.html"></iframe></p>
<p style="margin-bottom: 0cm">&nbsp;</p>
<p style="margin-bottom: 0cm">El siguiente ejemplo muestra como ejecutar código JavaScritpt definido directamente en ActionScript, además de recuperar variables JavaScript desde Flex. Este es el código ActionScript:</p>
<pre class="brush: xml;">
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white">
        <mx:Script>
        	import mx.controls.Alert;

                private function mostrarAlert():void {
                	var ncaracteres: Number;
                        ExternalInterface.call(&#8221; function holaMundo() {alert(&#8217;Hola Mundo&#8217;);}&#8221;);
                }

                private function recuperarUserAgent(): void{
                	var userAgent:String = ExternalInterface.call(&#8221;navigator.userAgent.toString&#8221;);
                        Alert.show(userAgent, &#8220;navigator.userAgent:&#8221;);
               }
              ]]&gt;
         </mx:Script>
          <mx:Button label="Mostrar Alert" click="mostrarAlert();" />
          <mx:Button label="Recuperar User Agent" click="recuperarUserAgent();"/>
</mx:Application>
</pre>
<p style="margin-bottom: 0cm">&nbsp;</p>
<p style="margin-bottom: 0cm">Aquí podeis probar el código anterior.</p>
<p align="center"><iframe src="http://www.fuenteperez.es/resources/externalinterface/testExternalInterface3.html"></iframe></p>
<p style="margin-bottom: 0cm">&nbsp;</p>
<p style="margin-bottom: 0cm"><a href="http://www.fuenteperez.es/resources/externalinterface/testExternalInterface.rar">Pulsar aquí </a>para descargaros el código completo</p>
]]></content:encoded>
			<wfw:commentRss>http://fuenteperez.es/blog/invocar-funciones-javascirpt-desde-flex-externalinterface/feed</wfw:commentRss>
		</item>
		<item>
		<title>Crear Release con Flex Builder (propiedad viewSourceURL)</title>
		<link>http://fuenteperez.es/blog/crear-release-con-flex-builder-propiedad-viewsourceurl</link>
		<comments>http://fuenteperez.es/blog/crear-release-con-flex-builder-propiedad-viewsourceurl#comments</comments>
		<pubDate>Fri, 22 Jan 2010 15:47:26 +0000</pubDate>
		<dc:creator>Héctor Fuente Pérez</dc:creator>
		
		<category><![CDATA[Adobe Flex]]></category>

		<guid isPermaLink="false">http://fuenteperez.es/blog/crear-release-con-flex-builder-propiedad-viewsourceurl</guid>
		<description><![CDATA[ Alguna vez os habréis encontrado que pulsando el botón derecho del ratón sobre alguna película flash, además de las opciones habituales, os aparece la opción View Source.
  
 Y cuando lo seleccionamos, nos envía a una pagina html en la cual se puede ver el código fuente de las clases actionScript, además de la opción de descargase [...]]]></description>
			<content:encoded><![CDATA[<p> <font color="#000000"><font face="Verdana, sans-serif"><font size="2" style="font-size: 9pt">Alguna vez os habréis encontrado que pulsando el botón derecho del ratón sobre alguna película flash, además de las opciones habituales, os aparece la opción <strong>View Source</strong>.</font></font></font>
<p align="center"><a href="http://www.fuenteperez.es/resources/releaseFlex/viewsource.JPG" rel="lightbox"><img src="http://www.fuenteperez.es/resources/releaseFlex/viewsource.JPG" width="406" alt="Pulsa para agrandar la imagen" height="74" style="width: 406px; height: 74px" /></a><a href="http://www.fuenteperez.es/resources/releaseFlex/viewsource.JPG" rel="lightbox"> </a><font color="#000000"><font face="Verdana, sans-serif"><font size="2" style="font-size: 9pt"> </font></font></font></p>
<p><font color="#000000"><font face="Verdana, sans-serif"><font size="2" style="font-size: 9pt"> </font></font></font><font color="#000000"><font face="Verdana, sans-serif"><font size="2" style="font-size: 9pt">Y cuando lo seleccionamos, nos envía a una pagina html en la cual se puede ver el código fuente de las clases actionScript, además de la opción de descargase el proyecto.</font></font></font>
<p style="margin-bottom: 0cm"><font color="#000000"><font face="Verdana, sans-serif"><font size="2" style="font-size: 9pt">Para poder añadir esta opción a nuestros proyectos basta con seguir unos sencillos pasos.</font></font></font></p>
<p align="center"><a href="http://www.fuenteperez.es/resources/releaseFlex/indexSrcView.JPG" rel="lightbox"><img src="http://www.fuenteperez.es/resources/releaseFlex/indexSrcView.JPG" width="451" alt="Pulsa para agrandar la imagen" height="204" style="width: 451px; height: 204px" /></a><a href="http://www.fuenteperez.es/resources/releaseFlex/indexSrcView.JPG" rel="lightbox"> </a></p>
<p style="margin-bottom: 0cm"><font color="#000000"><font face="Verdana, sans-serif"><font size="2" style="font-size: 9pt">En primer lugar, para poder añadir la opción View Source debemos indicar en nuestras aplicaciones (mx:Application) la propiedad viewSourceURL:</font></font></font><font face="Verdana, sans-serif"><font size="2" style="font-size: 9pt"><font color="#0000ff"><span> </span></font></font></font></p>
<p style="margin-bottom: 0cm">&nbsp;</p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: blue">&lt;mx:Application</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: black"> xmlns:mx=&#8221;</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: #990000">http://www.adobe.com/2006/mxml</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: black">&#8220; </span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: black"><span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', Times, serif; font-size: 16px; line-height: 20px"><span style="font-size: 10pt; line-height: 115%; font-family: 'Courier New'; color: black">                      viewSourceURL=&#8221;</span><span style="font-size: 10pt; line-height: 115%; font-family: 'Courier New'; color: #990000">srcview/index.html</span><span style="font-size: 10pt; line-height: 115%; font-family: 'Courier New'; color: black">&#8220;</span><span style="font-size: 10pt; line-height: 115%; font-family: 'Courier New'; color: blue">&gt;</span></span></span></p>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2" style="font-size: 9pt"><font color="#0000ff"><span></span></font></font></font></p>
<p><span class="Apple-style-span" style="font-family: monospace; font-size: 15px; line-height: 24px; color: #444444"></span>
<p align="left" style="margin-bottom: 0cm"><font color="#000000"><font face="Verdana, sans-serif"><font size="2" style="font-size: 9pt">A la propiedad <strong>viewSourceURL</strong> tenemos que asignarla la URL que queremos que se muestre cuando el usuario pulse sobre View Source. En mi caso es una URL relativa a mi aplicación Flex.</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font color="#000000"><font face="Verdana, sans-serif"><font size="2" style="font-size: 9pt">El siguiente paso, es generar la página html que muestra un árbol con todas las clases actionScript de nuestra aplicación.</font></font></font></p>
<p align="center"><a href="http://www.fuenteperez.es/resources/releaseFlex/exportReleaseBuild.JPG" rel="lightbox"><img src="http://www.fuenteperez.es/resources/releaseFlex/exportReleaseBuild.JPG" width="245" alt="Pulsa para agrandar la imagen" height="172" style="width: 245px; height: 172px" /></a><a href="http://www.fuenteperez.es/resources/releaseFlex/exportReleaseBuild.JPG" rel="lightbox"> </a></p>
<p><font face="Verdana"> </font><font face="Verdana"> </font><font face="Verdana"> </font><font face="Verdana">
<p align="left" style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2" style="font-size: 9pt"><font color="#000000"><span>Para ello lo vamos a crear con Flex Builder, para ello basta con pulsar boton derecho sobre el proyecto Flex y seleccionamos Export </span></font><font color="#000000"><span>→</span></font><font color="#000000"><span> Flex Builder </span></font><font color="#000000"><span>→</span></font><font color="#000000"><span> Release Build y Next.</span></font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font color="#000000"><font face="Verdana, sans-serif"><font size="2" style="font-size: 9pt">En la siguiente pantalla nos aparece el proyecto sobre el cual vamos a realizar la release y las y sobre que aplicaciones. En nuestro caso vamos seleccionamos All Applications. A continuacion debemos seleccionar el check Enable View Source, y pulsamos sobre el botón Choose Source Files. Esta opción nos permite seleccionar que elementos se van a incluir en el viewSource.</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font color="#000000"><font face="Verdana, sans-serif"><font size="2" style="font-size: 9pt">Y por ultimo pulsamos Finish.</font></font></font></p>
<p align="center"><a href="http://www.fuenteperez.es/resources/releaseFlex/chooseSourceFiles.JPG" rel="lightbox"><img src="http://www.fuenteperez.es/resources/releaseFlex/chooseSourceFiles.JPG" width="266" alt="Pulsa para agrandar la imagen" height="177" style="width: 266px; height: 177px" /></a><a href="http://www.fuenteperez.es/resources/releaseFlex/chooseSourceFiles.JPG" rel="lightbox"> </a></p>
<p align="left" style="margin-bottom: 0cm"><font color="#000000"><font face="Verdana, sans-serif"><font size="2" style="font-size: 9pt">Comienza el proceso de generación de los ficheros de la release, la carpeta bin-release. En la siguiente imagen se puede ver la carpeta con todos los ficheros que contienen la release. Dentro de esta carpeta esta el fichero index.html. Esta página a la que tenemos que hacer referencia en la propiedad viewSourceURL.</font></font></font></p>
<p align="center"><a href="http://www.fuenteperez.es/resources/releaseFlex/directorioBinRelease.JPG" rel="lightbox"><img src="http://www.fuenteperez.es/resources/releaseFlex/directorioBinRelease.JPG" width="143" alt="Pulsa para agrandar la imagen" height="271" style="width: 143px; height: 271px" /></a><a href="http://www.fuenteperez.es/resources/releaseFlex/directorioBinRelease.JPG" rel="lightbox"> </a></p>
<p align="left" style="margin-bottom: 0cm"><font color="#000000"><font face="Verdana, sans-serif"><font size="2" style="font-size: 9pt">Aquí podemos ver un ejemplo. Basta con pulsar el botón derecho y seleccionar View Source.</font></font></font></p>
<p align="center"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="350" height="300" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0">
<param name="_cx" value="9260"></param>
<param name="_cy" value="7938"></param>
<param name="FlashVars"></param>
<param name="Movie" value="http://www.fuenteperez.es/resources/releaseFlex/ejemploViewSource.swf"></param>
<param name="Src" value="http://www.fuenteperez.es/resources/releaseFlex/ejemploViewSource.swf"></param>
<param name="WMode" value="Window"></param>
<param name="Play" value="-1"></param>
<param name="Loop" value="-1"></param>
<param name="Quality" value="High"></param>
<param name="SAlign"></param>
<param name="Menu" value="-1"></param>
<param name="Base"></param>
<param name="AllowScriptAccess"></param>
<param name="Scale" value="ShowAll"></param>
<param name="DeviceFont" value="0"></param>
<param name="EmbedMovie" value="0"></param>
<param name="BGColor"></param>
<param name="SWRemote"></param>
<param name="MovieData"></param>
<param name="SeamlessTabbing" value="1"></param>
<param name="Profile" value="0"></param>
<param name="ProfileAddress"></param>
<param name="ProfilePort" value="0"></param>
<param name="AllowNetworking" value="all"></param>
<param name="AllowFullScreen" value="false"></param></object></p>
<p></font></p>
]]></content:encoded>
			<wfw:commentRss>http://fuenteperez.es/blog/crear-release-con-flex-builder-propiedad-viewsourceurl/feed</wfw:commentRss>
		</item>
		<item>
		<title>Generar ASDOC con Flex Builder</title>
		<link>http://fuenteperez.es/blog/generar-asdoc-con-flex-builder</link>
		<comments>http://fuenteperez.es/blog/generar-asdoc-con-flex-builder#comments</comments>
		<pubDate>Tue, 05 Jan 2010 17:30:01 +0000</pubDate>
		<dc:creator>Héctor Fuente Pérez</dc:creator>
		
		<category><![CDATA[Adobe Flex]]></category>

		<guid isPermaLink="false">http://fuenteperez.es/blog/generar-asdoc-con-flex-builder</guid>
		<description><![CDATA[ Cuando estamos desarrollando es imprescindible documentar. Action Script proporcionan una serie de etiquetas que se pueden incluir en los comentarios, y que posteriormente serán parseados por ASDoc para generar una documentación muy similar a JavaDoc.
Este post pretende ser una guía muy sencilla para generar esta documentación desde Flex Builder. Para ello seguir los siguientes pasos:


Crear un nueva &#8220;External Tool&#8221;:
- [...]]]></description>
			<content:encoded><![CDATA[<p> <font color="#000000"><font face="Verdana, sans-serif"><font size="2"><span style="background: #ffffff">Cuando estamos desarrollando es imprescindible documentar. Action Script proporcionan una serie de etiquetas que se pueden incluir en los comentarios, y que posteriormente serán parseados por <strong>ASDoc</strong> para generar una documentación muy similar a JavaDoc.</span></font></font></font><font color="#000000"><font face="Verdana, sans-serif"><font size="2"><span style="background: #ffffff"></span></font></font></font><font color="#000000"><font face="Verdana, sans-serif"><font size="2"><span style="background: #ffffff"></span></font></font></font><font color="#000000"><font face="Verdana, sans-serif"><font size="2"><span style="background: #ffffff"></span></font></font></font><font color="#000000"><font face="Verdana, sans-serif"><font size="2"><span style="background: #ffffff"></span></font></font></font><font color="#000000"><font face="Verdana, sans-serif"><font size="2"><span style="background: #ffffff"></span></font></font></font><font color="#000000"><font face="Verdana, sans-serif"><font size="2"><span style="background: #ffffff"></span></font></font></font><font color="#000000"><font face="Verdana, sans-serif"><font size="2"><span style="background: #ffffff"></span></font></font></font><font color="#000000"><font face="Verdana, sans-serif"><font size="2"><span style="background: #ffffff"></span></font></font></font><font color="#000000"><font face="Verdana, sans-serif"><font size="2"><span style="background: #ffffff"></span></font></font></font><font color="#000000"><font face="Verdana, sans-serif"><font size="2"><span style="background: #ffffff"></span></font></font></font><font color="#000000"><font face="Verdana, sans-serif"><font size="2"><span style="background: #ffffff"></span></font></font></font><font color="#000000"><font face="Verdana, sans-serif"><font size="2"><span style="background: #ffffff"></span></font></font></font><font color="#000000"><font face="Verdana, sans-serif"><font size="2"><span style="background: #ffffff"></span></font></font></font><font color="#000000"><font face="Verdana, sans-serif"><font size="2"><span style="background: #ffffff"></span></font></font></font><font color="#000000"><font face="Verdana, sans-serif"><font size="2"><span style="background: #ffffff"></p>
<p style="widows: 2; font-style: normal; orphans: 2" align="left"><font color="#000000"><font face="Verdana, sans-serif"><font size="2"><span style="background: #ffffff">Este post pretende ser una guía muy sencilla para generar esta documentación desde Flex Builder. Para ello seguir los siguientes pasos:</span></font></font></font></p>
<ol>
<li>
<p style="widows: 2; font-style: normal; orphans: 2" align="left"><font color="#000000"><font face="Verdana, sans-serif"><font size="2"><span style="background: #ffffff">Crear un nueva <em>&#8220;External Tool&#8221;</em>:</span></font></font></font></p>
<p style="widows: 2; font-style: normal; orphans: 2" align="left"><font color="#000000"><font face="Verdana, sans-serif"><font size="2"><span style="background: #ffffff">- Click <em>Run -&gt; External Tools -&gt; Open External Tools Dialog</em></span></font></font></font></p>
<p style="widows: 2; font-style: normal; orphans: 2" align="left"><font color="#000000"><font face="Verdana, sans-serif"><font size="2"><span style="background: #ffffff">- Sobre el icono <em>&#8220;Program&#8221;</em> pulsamos con el botón derecho. Nos aparece <em>&#8220;New&#8221;</em> y los seleccionamos.</span></font></font></font></p>
</li>
<p><a rel="lightbox" href="http://www.fuenteperez.es/resources/asdoc/asdoc1.JPG"><br />
<img src="http://www.fuenteperez.es/resources/asdoc/asdoc1.JPG" alt="Pulsa para agrandar la imagen " style="width: 273px; height: 183px" height="183" width="273" /></a><a rel="lightbox" href="http://www.fuenteperez.es/resources/asdoc/asdoc1.JPG"> </a></p>
<li>
<p style="widows: 2; font-style: normal; orphans: 2" align="left"><font color="#000000"><font face="Verdana, sans-serif"><font size="2"><span style="background: #ffffff">Introducimos el nombre que va tener asociada, en mi caso ASDOC.</span></font></font></font></p>
</li>
<li>
<p style="widows: 2; font-style: normal; orphans: 2" align="left"><font color="#000000"><font face="Verdana, sans-serif"><font size="2"><span style="background: #ffffff">En el campo <em>&#8220;Location&#8221;</em> debemos introducir la ruta al ejecutable asdoc. Para ello seleccionamos el botón <em>&#8220;Browse File System&#8221;</em> y navegamos por el arbol de directorios. Normalmente se encuentra en: <em>C:\Archivos de programa\Adobe\Flex Builder 3 Plug-in\sdks\${version}\bin\asdoc.exe</em>. En mi caso tengo varias sdks y selecciona la sdk 3.3.04589. Por tanto la ruta es <em>C:\Archivos de programa\Adobe\Flex Builder 3 Plug-in\sdks\3.3.0.4589\bin\asdoc.exe.</em></span></font></font></font></p>
</li>
<li>
<p style="widows: 2; font-style: normal; orphans: 2" align="left"><font color="#000000"><font face="Verdana, sans-serif"><font size="2"><span style="background: #ffffff">Vamos asignar al campo <em>&#8220;Working Directory&#8221;</em> el valor <em>${project_loc}</em></span></font></font></font></p>
</li>
<li>
<p style="widows: 2; font-style: normal; orphans: 2" align="left"><font color="#000000"><font face="Verdana, sans-serif"><font size="2"><span style="background: #ffffff">Como argumentos: <em>-source-path=./src -doc-sources=./src -window-title=&#8221;${project_name}&#8221; -main-title=&#8221;${project_name}&#8221; -external-library-path=./libs</em>. Vemos que indicamos que el source path y los elementos sobre los que vamos a realizar el parseo se encuentran por debajo de la carpeta src y que las librerias externas que utiliza el proyecto se encuentran en la carpeta libs. Además indicamos que el titulo principal es el nombre del proyecto, así como el titulo de la ventana. Estos podemos modificarlo por ejemplo por   -window-title=&#8221;Documentación del proyecto ${project_name}&#8221;</span></font></font></font></p>
</li>
<li>
<p style="widows: 2; font-style: normal; orphans: 2" align="left"><font color="#000000"><font face="Verdana, sans-serif"><font size="2"><span style="background: #ffffff">Pulsamos sobre el botón <em>&#8220;Apply&#8221;</em>.</span></font></font></font></p>
</li>
<p><a rel="lightbox" href="http://www.fuenteperez.es/resources/asdoc/asdoc2.JPG"><br />
<img src="http://www.fuenteperez.es/resources/asdoc/asdoc2.JPG" alt="Pulsa para agrandar la imagen " style="width: 273px; height: 183px" height="183" width="273" /></a><a rel="lightbox" href="http://www.fuenteperez.es/resources/asdoc/asdoc2.JPG"> </a></p>
<li>
<p style="widows: 2; font-style: normal; orphans: 2" align="left"><font color="#000000"><font face="Verdana, sans-serif"><font size="2"><span style="background: #ffffff">Por ultimo solo nos queda generar el <strong>ASDOC</strong> de un proyecto. Para ello pulsamos sobre el proyecto y ejecutamos la <em>&#8220;External Tool&#8221;</em> que hemos creado (<em>Run-&gt;External Tools-&gt;ASDOC</em>).</span></font></font></font></p>
</li>
<p><a rel="lightbox" href="http://www.fuenteperez.es/resources/asdoc/asdoc3.JPG"><br />
<img src="http://www.fuenteperez.es/resources/asdoc/asdoc3.JPG" alt="Pulsa para agrandar la imagen " style="width: 273px; height: 183px" height="183" width="273" /></a><a rel="lightbox" href="http://www.fuenteperez.es/resources/asdoc/asdoc3.JPG"> </a></p>
<li><font color="#000000"><font face="Verdana, sans-serif"><font size="2"><span style="background: #ffffff"></span></font></font></font><font color="#000000"><font face="Verdana, sans-serif"><font size="2"><span style="background: #ffffff">La documentación generada la deja en la carpeta  <em>asdoc-output</em> del proyecto. Para ver la documentación, basta con ejecutar el fichero index.html.</span></font></font></font><font color="#000000"><br />
<a rel="lightbox" href="http://www.fuenteperez.es/resources/asdoc/asdoc4.JPG"><br />
<img src="http://www.fuenteperez.es/resources/asdoc/asdoc4.JPG" alt="Pulsa para agrandar la imagen " style="width: 273px; height: 183px" height="183" width="273" /></a><a rel="lightbox" href="http://www.fuenteperez.es/resources/asdoc/asdoc4.JPG"> </a><br />
<font face="Verdana, sans-serif"><font size="2"><span style="background: #ffffff"></span></font></font></font><font color="#000000"><font face="Verdana, sans-serif"><font size="2"><span style="background: #ffffff"></p>
<ol>
<p style="widows: 2; font-style: normal; orphans: 2" align="left"><font color="#000000"><font face="Verdana, sans-serif"><font size="2"><span style="background: #ffffff">En el siguiente link podeis ver la nomenclatura de asdoc: <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=asdoc_3.html">http://livedocs.adobe.com/flex/3/html/help.html?content=asdoc_3.html</a></span></font></font></font></p>
<p style="widows: 2; font-style: normal; orphans: 2" align="left"><font color="#000000"><font face="Verdana, sans-serif"><font size="2"><span style="background: #ffffff">Existen otras formas de generarlo utilizando herramientas como Maven o Ant.</span></font></font></font></p>
<p style="widows: 2; font-style: normal; orphans: 2" align="left"><font color="#000000"><font face="Verdana, sans-serif"><font size="2"><span style="background: #ffffff">- Maven (<a href="http://maven.servebox.org/sites/maven-flex-plugin/flex-plugin/asdoc-aggregate-mojo.html">http://maven.servebox.org/sites/maven-flex-plugin/flex-plugin/asdoc-aggregate-mojo.html</a>)</span></font></font></font></p>
<p style="widows: 2; font-style: normal; orphans: 2" align="left"><font color="#000000"><font face="Verdana, sans-serif"><font size="2"><span style="background: #ffffff">- Ant (<a href="http://www.herrodius.com/blog/85">http://www.herrodius.com/blog/85</a>)</span></font></font></font></p>
<p style="widows: 2; font-style: normal; orphans: 2" align="left"><font color="#000000"><font face="Verdana, sans-serif"><font size="2"><span style="background: #ffffff">Salu2. Héctor <img src='http://fuenteperez.es/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </span></font></font></font> </p>
</ol>
<p></span></font></font></font></li>
</ol>
<p style="widows: 2; font-style: normal; orphans: 2" align="left"><font color="#000000"><font face="Verdana, sans-serif"><font size="2"><span style="background: #ffffff"></span></font></font></font></p>
<p style="widows: 2; font-style: normal; orphans: 2" align="left"><font color="#000000"><font face="Verdana, sans-serif"><font size="2"><span style="background: #ffffff"></span></font></font></font></p>
<p></span></font></font></font></p>
]]></content:encoded>
			<wfw:commentRss>http://fuenteperez.es/blog/generar-asdoc-con-flex-builder/feed</wfw:commentRss>
		</item>
		<item>
		<title>Ini4j e IniEditor: Leer fichero INI con Java</title>
		<link>http://fuenteperez.es/blog/ini4j-e-inieditor-leer-fichero-ini-con-java</link>
		<comments>http://fuenteperez.es/blog/ini4j-e-inieditor-leer-fichero-ini-con-java#comments</comments>
		<pubDate>Thu, 28 May 2009 19:25:26 +0000</pubDate>
		<dc:creator>Héctor Fuente Pérez</dc:creator>
		
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://fuenteperez.es/blog/ini4j-e-inieditor-leer-fichero-ini-con-java</guid>
		<description><![CDATA[Después de mucho tiempo, voy a intentar retomar el blog. 
En este post, voy a proponer dos alternativas para manipular ficheros INI de Windows. 
Las alternativas que he encontrado son ini4j e iniEditor. 
Son dos librerias que de forma sencilla nos permiter leer, modificar y crear ficheros INI.  Para ello, he realizado la lectura del mismo fichero [...]]]></description>
			<content:encoded><![CDATA[<p><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD">Después de mucho tiempo, voy a intentar retomar el blog.</span><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"> </span></p>
<p><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"></span><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD">En este post, voy a proponer dos alternativas para manipular ficheros INI de Windows.</span><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"> </span></span></p>
<p><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"></span></span><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD">Las alternativas que he encontrado son ini4j e iniEditor. </span></span></p>
<p><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD">Son dos librerias que de forma sencilla nos permiter leer, modificar y crear ficheros INI.</span><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"> </span><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"> </span><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD">Para ello, he realizado la lectura del mismo fichero con cada una de las dos librerias. </span><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"> </span><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD">El fichero que vamos a leer es el siguiente:</span><span lang="ES-TRAD"><font face="Times New Roman"> </font></span></span></span></p>
<table border="0" cellPadding="0" cellSpacing="0" style="margin: auto auto auto 2.75pt; border-collapse: collapse" class="MsoNormalTable">
<tr>
<td width="208" vAlign="top" style="width: 155.95pt; background-color: transparent; border: black 1pt solid; padding: 2.75pt"><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD">[seccion1]</span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD"></span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD"></span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD"></span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD"></span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD"></span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD"></span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD"></span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD"></span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD">entrada1 = valor1</span></p>
<p><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD"></span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD"></span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD"></span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD">entrada2 = valor2</span></p>
<p><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD"></span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD"></span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD">entrada3 = valor67</span></p>
<p><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD"></span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD"><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD">&#8230;&#8230;&#8230;&#8230;&#8230;</span></span></td>
</tr>
</table>
<p><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"></span><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"></span></span></p>
<p><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD">En primer lugar vamos a utilizar la librería ini4j:</span><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"> </span></span></p>
<p><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"></span></span></p>
<table border="0" cellPadding="0" cellSpacing="0" style="margin: auto auto auto 2.75pt; border-collapse: collapse" class="MsoNormalTable">
<tr>
<td width="642" vAlign="top" style="width: 481.5pt; background-color: transparent; border: black 1pt solid; padding: 2.75pt"><strong><span style="font-size: 10pt; color: #7f0055; font-family: 'Courier New'" lang="ES-TRAD">package</span></strong><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD"> es.fuenteperez.ini4j.main;</span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD"></span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD"></span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD"></span><strong><span style="font-size: 10pt; color: #7f0055; font-family: 'Courier New'" lang="EN-US">import</span></strong><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"> java.io.FileReader;</span></p>
<p><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"></span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"></span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"></span><strong><span style="font-size: 10pt; color: #7f0055; font-family: 'Courier New'" lang="EN-US">import</span></strong><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"> org.ini4j.Ini;</span></p>
<p><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"></span><span style="font-size: 10pt; font-family: 'Courier New'" lang="EN-US"><strong><span style="font-size: 10pt; color: #7f0055; font-family: 'Courier New'" lang="EN-US">public</span></strong><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"> </span><strong><span style="font-size: 10pt; color: #7f0055; font-family: 'Courier New'" lang="EN-US">class</span></strong><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"> MainIni4J {</span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"><span>      </span></span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"><span>      </span></span></span></p>
<p><span style="font-size: 10pt; font-family: 'Courier New'" lang="EN-US"><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"><span></span></span><strong><span style="font-size: 10pt; color: #7f0055; font-family: 'Courier New'" lang="EN-US">public</span></strong><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"> </span><strong><span style="font-size: 10pt; color: #7f0055; font-family: 'Courier New'" lang="EN-US">static</span></strong><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"> </span><strong><span style="font-size: 10pt; color: #7f0055; font-family: 'Courier New'" lang="EN-US">void</span></strong><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"> main(String[] args) </span><strong><span style="font-size: 10pt; color: #7f0055; font-family: 'Courier New'" lang="EN-US">throws</span></strong><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"> Exception {</span></span></p>
<p><span style="font-size: 10pt; font-family: 'Courier New'" lang="EN-US"><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US">String filename = </span><span style="font-size: 10pt; color: #2a00ff; font-family: 'Courier New'" lang="EN-US">&#8220;ejemplo.ini&#8221;</span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US">;</span></span></p>
<p><span style="font-size: 10pt; font-family: 'Courier New'" lang="EN-US"><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US">Ini ini = </span><strong><span style="font-size: 10pt; color: #7f0055; font-family: 'Courier New'" lang="EN-US">new</span></strong><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"> Ini(</span><strong><span style="font-size: 10pt; color: #7f0055; font-family: 'Courier New'" lang="EN-US">new</span></strong><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"> FileReader(filename));</span></span></p>
<p><span style="font-size: 10pt; font-family: 'Courier New'" lang="EN-US"><span style="font-size: 10pt; color: #3f7f5f; font-family: 'Courier New'" lang="ES-TRAD">//Recuperar todas las secciones del fichero .ini</span></span></p>
<p><span style="font-size: 10pt; font-family: 'Courier New'" lang="EN-US"><strong><span style="font-size: 10pt; color: #7f0055; font-family: 'Courier New'" lang="EN-US">for</span></strong><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US">(Ini.Section section : ini.values()){</span></span></p>
<p><span style="font-size: 10pt; font-family: 'Courier New'" lang="EN-US"><span style="font-size: 10pt; color: #3f7f5f; font-family: 'Courier New'" lang="ES-TRAD">//Obtener las entradas x cada una de las secciones</span></span></p>
<p><span style="font-size: 10pt; font-family: 'Courier New'" lang="EN-US"><span style="font-size: 10pt; color: #3f7f5f; font-family: 'Courier New'" lang="ES-TRAD"></span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US">System.</span><em><span style="font-size: 10pt; color: #0000c0; font-family: 'Courier New'" lang="EN-US">out</span></em><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US">.println(</span><span style="font-size: 10pt; color: #2a00ff; font-family: 'Courier New'" lang="EN-US">&#8220;[&#8221;</span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"> + section.getName() + </span><span style="font-size: 10pt; color: #2a00ff; font-family: 'Courier New'" lang="EN-US">&#8220;]&#8221;</span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US">);</span></span></p>
<p><span style="font-size: 10pt; font-family: 'Courier New'" lang="EN-US"><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"></span><strong><span style="font-size: 10pt; color: #7f0055; font-family: 'Courier New'" lang="EN-US">for</span></strong><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US">(String option : section.keySet()){</span></span></p>
<p><span style="font-size: 10pt; font-family: 'Courier New'" lang="EN-US"><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"></span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US">System.</span><em><span style="font-size: 10pt; color: #0000c0; font-family: 'Courier New'" lang="EN-US">out</span></em><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US">.println(option + </span><span style="font-size: 10pt; color: #2a00ff; font-family: 'Courier New'" lang="EN-US">&#8221; = &#8220;</span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"> + section.fetch(option));</span></span></p>
<p><span style="font-size: 10pt; font-family: 'Courier New'" lang="EN-US"><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"></span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD">}</span></span></p>
<p><span style="font-size: 10pt; font-family: 'Courier New'" lang="EN-US"><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD"></span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD">System.</span><em><span style="font-size: 10pt; color: #0000c0; font-family: 'Courier New'" lang="ES-TRAD">out</span></em><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD">.println();</span></span></p>
<p><span style="font-size: 10pt; font-family: 'Courier New'" lang="EN-US"><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD"></span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD">}</span></span></p>
<p><span style="font-size: 10pt; font-family: 'Courier New'" lang="EN-US"><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD"></span><span style="font-size: 10pt; color: #3f7f5f; font-family: 'Courier New'" lang="ES-TRAD">//Recuperar las entradas de las seccion entradaX</span></span></p>
<p><span style="font-size: 10pt; font-family: 'Courier New'" lang="EN-US"><span style="font-size: 10pt; color: #3f7f5f; font-family: 'Courier New'" lang="ES-TRAD"></span><strong><span style="font-size: 10pt; color: #7f0055; font-family: 'Courier New'" lang="EN-US">for</span></strong><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US">(String key : ini.get(</span><span style="font-size: 10pt; color: #2a00ff; font-family: 'Courier New'" lang="EN-US">&#8220;entradaX&#8221;</span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US">).keySet()){</span></span></p>
<p><span style="font-size: 10pt; font-family: 'Courier New'" lang="EN-US"><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"></span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US">System.</span><em><span style="font-size: 10pt; color: #0000c0; font-family: 'Courier New'" lang="EN-US">out</span></em><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US">.println(</span><span style="font-size: 10pt; color: #2a00ff; font-family: 'Courier New'" lang="EN-US">&#8220;entradaX/&#8221;</span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"> + key + </span><span style="font-size: 10pt; color: #2a00ff; font-family: 'Courier New'" lang="EN-US">&#8221; = &#8220;</span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"> +</span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US">ini.get(</span><span style="font-size: 10pt; color: #2a00ff; font-family: 'Courier New'" lang="EN-US">&#8220;entradaX&#8221;</span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US">).fetch(key));</span></span></p>
<p><span style="font-size: 10pt; font-family: 'Courier New'" lang="EN-US"><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"></span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD">}</span></span></p>
<p><span style="font-size: 10pt; font-family: 'Courier New'" lang="EN-US"><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD"></span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD">}</span></span></p>
<p><span style="font-size: 10pt; font-family: 'Courier New'" lang="EN-US"><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD"></span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD">}</span></span></td>
</tr>
</table>
<p><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"></span><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"></span></span></p>
<p><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD">Como podemos observar basta con pasar el fichero al constructor de la clase org.ini4j.Ini, y llamar al método values() para recuperar todas las secciones (org.ini4j.Ini.Section) del fichero INI ([sección]).</span></span></p>
<p><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"></span></span><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD">A partir de las secciones podemos obtener las opciones y sus valores. Para recuperar las opciones debemos llamar al metodo keySet() de cada una de las secciones, que retorna un Set&lt;String&gt;.</span></p>
<p><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"></span><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD">Y por ultimo recuperamos el valor de cada una de las opciones con el metodo fetch(opcion) que retorna un String.</span><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"> </span></span><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD">Vamos a realizar el mismo ejemplo utilizando la librería IniEditor.</span></span></p>
<p><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"></span></span></p>
<table border="0" cellPadding="0" cellSpacing="0" style="margin: auto auto auto 2.75pt; border-collapse: collapse" class="MsoNormalTable">
<tr>
<td width="641" vAlign="top" style="width: 480.75pt; background-color: transparent; border: black 1pt solid; padding: 2.75pt"><strong><span style="font-size: 10pt; color: #7f0055; font-family: 'Courier New'" lang="ES-TRAD">package</span></strong><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD"> es.fuenteperez.inieditor.main;</span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD"></span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD"></span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD"></span><strong><span style="font-size: 10pt; color: #7f0055; font-family: 'Courier New'" lang="ES-TRAD">import</span></strong><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD"> java.util.List;</span></p>
<p><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD"></span><strong><span style="font-size: 10pt; color: #7f0055; font-family: 'Courier New'" lang="ES-TRAD">import</span></strong><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD"> ch.ubique.inieditor.IniEditor;</span></p>
<p><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD"></span><span style="font-size: 10pt; font-family: 'Courier New'" lang="ES-TRAD"><strong><span style="font-size: 10pt; color: #7f0055; font-family: 'Courier New'" lang="EN-US">public</span></strong><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"> </span><strong><span style="font-size: 10pt; color: #7f0055; font-family: 'Courier New'" lang="EN-US">class</span></strong><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"> MainIniEditor {</span></span></p>
<p><span style="font-size: 10pt; font-family: 'Courier New'" lang="ES-TRAD"><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"></span><strong><span style="font-size: 10pt; color: #7f0055; font-family: 'Courier New'" lang="EN-US">public</span></strong><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"> </span><strong><span style="font-size: 10pt; color: #7f0055; font-family: 'Courier New'" lang="EN-US">static</span></strong><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"> </span><strong><span style="font-size: 10pt; color: #7f0055; font-family: 'Courier New'" lang="EN-US">void</span></strong><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"> main(String[] args) </span><strong><span style="font-size: 10pt; color: #7f0055; font-family: 'Courier New'" lang="EN-US">throws</span></strong><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"> Exception {</span></span></p>
<p><span style="font-size: 10pt; font-family: 'Courier New'" lang="ES-TRAD"><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"></span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US">IniEditor iniEditor = </span><strong><span style="font-size: 10pt; color: #7f0055; font-family: 'Courier New'" lang="EN-US">new</span></strong><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"> IniEditor();</span></span></p>
<p><span style="font-size: 10pt; font-family: 'Courier New'" lang="ES-TRAD"><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"></span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US">iniEditor.load(</span><span style="font-size: 10pt; color: #2a00ff; font-family: 'Courier New'" lang="EN-US">&#8220;ejemplo.ini&#8221;</span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US">);</span></span></p>
<p><span style="font-size: 10pt; font-family: 'Courier New'" lang="ES-TRAD"><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"></span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US">List&lt;String&gt; secciones = iniEditor.sectionNames();</span></span></p>
<p><span style="font-size: 10pt; font-family: 'Courier New'" lang="ES-TRAD"><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"></span><strong><span style="font-size: 10pt; color: #7f0055; font-family: 'Courier New'" lang="EN-US">for</span></strong><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"> (String seccion : secciones) {</span></span></p>
<p><span style="font-size: 10pt; font-family: 'Courier New'" lang="ES-TRAD"><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"></span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US">System.</span><em><span style="font-size: 10pt; color: #0000c0; font-family: 'Courier New'" lang="EN-US">out</span></em><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US">.println(</span><span style="font-size: 10pt; color: #2a00ff; font-family: 'Courier New'" lang="EN-US">&#8220;Sección: &#8220;</span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"> + seccion);</span></span></p>
<p><span style="font-size: 10pt; font-family: 'Courier New'" lang="ES-TRAD"><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"></span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US">List&lt;String&gt; opciones = iniEditor.optionNames(seccion);</span></span></p>
<p><span style="font-size: 10pt; font-family: 'Courier New'" lang="ES-TRAD"><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"></span><strong><span style="font-size: 10pt; color: #7f0055; font-family: 'Courier New'" lang="EN-US">for</span></strong><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"> (String opcion : opciones) {</span></span></p>
<p><span style="font-size: 10pt; font-family: 'Courier New'" lang="ES-TRAD"><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="EN-US"></span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD">System.</span><em><span style="font-size: 10pt; color: #0000c0; font-family: 'Courier New'" lang="ES-TRAD">out</span></em><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD">.println(</span><span style="font-size: 10pt; color: #2a00ff; font-family: 'Courier New'" lang="ES-TRAD">&#8220;\topción: &#8220;</span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD"> + opcion + </span></span></p>
<p><span style="font-size: 10pt; font-family: 'Courier New'" lang="ES-TRAD"><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD"></span><span style="font-size: 10pt; color: #2a00ff; font-family: 'Courier New'" lang="ES-TRAD">&#8221; valor: &#8220;</span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD"> + iniEditor.get(seccion,opcion));</span></span></p>
<p><span style="font-size: 10pt; font-family: 'Courier New'" lang="ES-TRAD"><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD"></span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD">}</span></span></p>
<p><span style="font-size: 10pt; font-family: 'Courier New'" lang="ES-TRAD"><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD"></span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD">}</span></span></p>
<p><span style="font-size: 10pt; font-family: 'Courier New'" lang="ES-TRAD"><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD"></span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD">}</span></span></p>
<p><span style="font-size: 10pt; font-family: 'Courier New'" lang="ES-TRAD"><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD"></span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD">}</span><span style="font-size: 10pt; color: black; font-family: 'Courier New'" lang="ES-TRAD"> </span></span></td>
</tr>
</table>
<p><span lang="ES-TRAD"></span><span lang="ES-TRAD"></span><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"></span></p>
<p><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD">Para indicar el fichero que queremos leer, existe el método load().</span><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"> </span><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD">Para recuperar las secciones esta el metodo sectionNames(), que retorna un List&lt;String&gt;.</span></p>
<p><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"></span><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD">A partir de este colección de String, recuperamos las opciones con el método optionNames(sección).</span><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"> </span></span><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD">Con las opciones obtenidas ya podemos recuperar el valor de cada una de ellas. Para esto tenemos el método get(sección, opción) que retorna un String con el valor de la opción.</span></span></p>
<p><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"></span><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"><span style="font-size: 10pt; color: black; font-family: 'Verdana','sans-serif'" lang="ES-TRAD">Como podéis observar la lectura de ficheros INI con ambas librerías es muy similar.</span></span></span></p>
<p><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"><span style="font-size: 10pt; color: black; font-family: 'Verdana','sans-serif'" lang="ES-TRAD">Os dejo el código fuente de ambas pruebas en el siguiente link:</span><span style="font-size: 10pt; color: black; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"> </span></span></span></p>
<p><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"><span style="font-size: 10pt; color: black; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"></span></span></span><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"><span style="font-size: 10pt; color: black; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"></span><span style="font-size: 10pt; color: black; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"><span lang="ES-TRAD"><a href="http://www.fuenteperez.es/resources/readIniTest.zip"><span style="font-family: 'Verdana','sans-serif'"><font color="#800080">http://www.fuenteperez.es/resources/readIniTest.zip</font></span></a></span></span></span></p>
<p><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"><span style="font-size: 10pt; color: black; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"><span lang="ES-TRAD"></span></span><span style="font-size: 10pt; color: black; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"><span style="font-size: 10pt; color: black; font-family: 'Verdana','sans-serif'" lang="ES-TRAD">Espero que os sirva de ayuda.</span></span></span></p>
<p><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"><span style="font-size: 10pt; color: black; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"><span style="font-size: 10pt; color: black; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"></span><span style="font-size: 10pt; color: black; font-family: 'Verdana','sans-serif'" lang="ES-TRAD"><span style="font-size: 10pt; color: black; font-family: 'Verdana','sans-serif'" lang="ES-TRAD">Salu2. <img src='http://fuenteperez.es/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </span></span></span></span></p>
]]></content:encoded>
			<wfw:commentRss>http://fuenteperez.es/blog/ini4j-e-inieditor-leer-fichero-ini-con-java/feed</wfw:commentRss>
		</item>
		<item>
		<title>XStream: Leer ficheros XML desde Java</title>
		<link>http://fuenteperez.es/blog/xstream-leer-ficheros-xml-desde-java</link>
		<comments>http://fuenteperez.es/blog/xstream-leer-ficheros-xml-desde-java#comments</comments>
		<pubDate>Wed, 30 Jul 2008 21:16:40 +0000</pubDate>
		<dc:creator>Héctor Fuente Pérez</dc:creator>
		
		<category><![CDATA[XML]]></category>

		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://fuenteperez.es/blog/xstream-leer-ficheros-xml-desde-java</guid>
		<description><![CDATA[Hace unos días me surgió la necesidad de leer y escribir ficheros XML desde Java. Los ficheros que debía leer y escribir eran colecciones de beans, lo comente con mis compañeros y tras ver varias opciones me decante por utilizar XStream.
Las dos razones por la cuales me decante por utilizar esta librería son las siguientes:


Los [...]]]></description>
			<content:encoded><![CDATA[<p><font face="Verdana, sans-serif"><font size="2">Hace unos días me surgió la necesidad de leer y escribir ficheros XML desde Java. Los ficheros que debía leer y escribir eran colecciones de beans, lo comente con mis compañeros y tras ver varias opciones me decante por utilizar <a href="http://xstream.codehaus.org/'">XStream</a>.</font></font></p>
<p><font face="Verdana, sans-serif"><font size="2">Las dos razones por la cuales me decante por utilizar esta librería son las siguientes:</font></font></p>
<ul>
<li>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2">Los ficheros XML que tenia que escribir para posteriormente leer, no debían seguir ninguna DTD o esquema.</font></font></p>
</li>
<li>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2">Lo sencilla que es la librería XStream de aprender y utilizar.</font></font></p>
</li>
</ul>
<p style="margin-bottom: 0cm"> <font face="Verdana, sans-serif"><font size="2">Os podría seguir contando lo maravillosa que es la librería XStream, pero para eso ya esta su web. Solo comentaros algunas características:</font></font></p>
<ul>
<li>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2">Fácil de usar.</font></font></p>
</li>
<li>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2">No requiere modificaciones en los objetos Java que se van a serializar.</font></font></p>
</li>
<li>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2">Integración sencilla con otros APIs para XML</font></font></p>
</li>
<li>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2">Soporte para Anotaciones (definición de alias para los atributos de una clase, conversores, omisión de tags,  etc).</font></font></p>
</li>
</ul>
<p style="margin-bottom: 0cm"> <font face="Verdana, sans-serif"><font size="2">Veamos un ejemplo sencillo, vamos a suponer que el cliente nos a impuesto el siguiente modelo XML para persistir un Blog:</font></font></p>
<table border="1" width="100%" cellPadding="4" cellSpacing="0" borderColor="#000000">
<tr>
<td width="100%" vAlign="top">
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#008080">&lt;</font><font color="#3f7f7f">blog</font><font color="#008080">&gt;</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#008080">&lt;</font><font color="#3f7f7f">autor</font><font color="#008080">&gt;</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#008080">&lt;</font><font color="#3f7f7f">nombre</font><font color="#008080">&gt;</font><font color="#000000">Héctor Fuente</font><font color="#008080">&lt;/</font><font color="#3f7f7f">nombre</font><font color="#008080">&gt;</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#008080">&lt;/</font><font color="#3f7f7f">autor</font><font color="#008080">&gt;</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#008080">&lt;</font><font color="#3f7f7f">entrada</font><font color="#008080">&gt;</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#008080">&lt;</font><font color="#3f7f7f">titulo</font><font color="#008080">&gt;</font><font color="#000000">XStream: Leer ficheros desde Java en 3 Lineas(I)</font><font color="#008080">&lt;/</font><font color="#3f7f7f">titulo</font><font color="#008080">&gt;</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#008080">&lt;</font><font color="#3f7f7f">descripcion</font><font color="#008080">&gt;</font><font color="#000000">XStream: Leer ficheros desde Java en 3 Lineas(I)</font><font color="#008080">&lt;/</font><font color="#3f7f7f">descripcion</font><font color="#008080">&gt;</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#008080">&lt;/</font><font color="#3f7f7f">entrada</font><font color="#008080">&gt;</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#008080">&lt;</font><font color="#3f7f7f">entrada</font><font color="#008080">&gt;</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#008080">&lt;</font><font color="#3f7f7f">titulo</font><font color="#008080">&gt;</font><font color="#000000">XStream: Leer ficheros desde Java en 3 Lineas(II)</font><font color="#008080">&lt;/</font><font color="#3f7f7f">titulo</font><font color="#008080">&gt;</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#008080">&lt;</font><font color="#3f7f7f">descripcion</font><font color="#008080">&gt;</font><font color="#000000">XStream: Leer ficheros desde Java en 3 Lineas(II)</font><font color="#008080">&lt;/</font><font color="#3f7f7f">descripcion</font><font color="#008080">&gt;</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#008080">&lt;/</font><font color="#3f7f7f">entrada</font><font color="#008080">&gt;</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#008080">&lt;</font><font color="#3f7f7f">entrada</font><font color="#008080">&gt;</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#008080">&lt;</font><font color="#3f7f7f">titulo</font><font color="#008080">&gt;</font><font color="#000000">XStream: Leer ficheros desde Java en 3 Lineas(III)</font><font color="#008080">&lt;/</font><font color="#3f7f7f">titulo</font><font color="#008080">&gt;</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#008080">&lt;</font><font color="#3f7f7f">descripcion</font><font color="#008080">&gt;</font><font color="#000000">XStream: Leer ficheros desde Java en 3 Lineas(III)</font><font color="#008080">&lt;/</font><font color="#3f7f7f">descripcion</font><font color="#008080">&gt;</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#008080">&lt;/</font><font color="#3f7f7f">entrada</font><font color="#008080">&gt;</font></font></font></p>
<p align="left"><font size="2" style="font-size: 9pt"><font color="#008080"><font face="Courier New, monospace">&lt;/</font></font><font color="#3f7f7f"><font face="Courier New, monospace">blog</font></font><font color="#008080"><font face="Courier New, monospace">&gt;</font></font></font></p>
</td>
</tr>
</table>
<p style="margin-bottom: 0cm">&nbsp;</p>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2">A partir de este modelo XML vamos a crear nuestro modelo de datos en Java, compuesto por 3 clases Blog, Autor y Entrada:</font></font></p>
<p style="margin-bottom: 0cm">&nbsp;</p>
<table border="1" width="369" cellPadding="4" cellSpacing="0" borderColor="#000000">
<tr>
<td width="359" vAlign="top">
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>package</strong></font><font color="#000000"> es.fuenteperez.xstream.modelo;</font></font></font></p>
<p align="left" style="margin-bottom: 0cm">&nbsp;</p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>public</strong></font><font color="#000000"> </font><font color="#7f0055"><strong>class</strong></font><font color="#000000"> Entrada {</font></font></font></p>
<p style="margin-bottom: 0cm">&nbsp;</p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>private</strong></font><font color="#000000"> String </font><font color="#0000c0">titulo</font><font color="#000000">, </font><font color="#0000c0">descripcion</font><font color="#000000">;</font></font></font></p>
<p style="margin-bottom: 0cm">&nbsp;</p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>public</strong></font><font color="#000000"> Entrada(){</font></font></font></p>
<p style="margin-bottom: 0cm">&nbsp;</p>
<p style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt">}</font></font></p>
<p style="margin-bottom: 0cm">&nbsp;</p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>public</strong></font><font color="#000000"> Entrada(String titulo, </font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font color="#000000"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt">String descripcion) {</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>this</strong></font><font color="#000000">.</font><font color="#0000c0">titulo</font><font color="#000000"> = titulo;</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>this</strong></font><font color="#000000">.</font><font color="#0000c0">descripcion</font><font color="#000000"> = descripcion;</font></font></font></p>
<p style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt">}</font></font></p>
<p><font face="Courier New, monospace"><font size="2" style="font-size: 9pt">&#8230;</font></font></td>
</tr>
</table>
<p style="margin-bottom: 0cm">&nbsp;</p>
<table border="1" width="369" cellPadding="4" cellSpacing="0" borderColor="#000000">
<tr>
<td width="359" vAlign="top">
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>package</strong></font><font color="#000000"> es.fuenteperez.xstream.modelo;</font></font></font></p>
<p align="left" style="margin-bottom: 0cm">&nbsp;</p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>public</strong></font><font color="#000000"> </font><font color="#7f0055"><strong>class</strong></font><font color="#000000"> Autor {</font></font></font></p>
<p style="margin-bottom: 0cm">&nbsp;</p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>private</strong></font><font color="#000000"> String </font><font color="#0000c0">nombre</font><font color="#000000">;</font></font></font></p>
<p style="margin-bottom: 0cm">&nbsp;</p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>public</strong></font><font color="#000000"> Autor(){</font></font></font></p>
<p style="margin-bottom: 0cm">&nbsp;</p>
<p style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt">}</font></font></p>
<p style="margin-bottom: 0cm">&nbsp;</p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>public</strong></font><font color="#000000"> Autor(String nombre) {</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>this</strong></font><font color="#000000">.</font><font color="#0000c0">nombre</font><font color="#000000"> = nombre;</font></font></font></p>
<p style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt">}</font></font></p>
<p align="left" style="margin-bottom: 0cm">&nbsp;</p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>public</strong></font><font color="#000000"> String getNombre() {</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>return</strong></font><font color="#000000"> </font><font color="#0000c0">nombre</font><font color="#000000">;</font></font></font></p>
<p style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt">}</font></font></p>
<p align="left" style="margin-bottom: 0cm">&nbsp;</p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>public</strong></font><font color="#000000"> </font><font color="#7f0055"><strong>void</strong></font><font color="#000000"> setNombre(String nombre) {</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>this</strong></font><font color="#000000">.</font><font color="#0000c0">nombre</font><font color="#000000"> = nombre;</font></font></font></p>
<p style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt">} </font></font></p>
<p align="left" style="margin-bottom: 0cm"><font color="#000000"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt">}</font></font></font></p>
</td>
</tr>
</table>
<p style="margin-bottom: 0cm">&nbsp;</p>
<p style="margin-bottom: 0cm">&nbsp;</p>
<table border="1" width="368" cellPadding="4" cellSpacing="0" borderColor="#000000">
<tr>
<td width="358" vAlign="top">
<p style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>package</strong></font><font color="#000000"> es.fuenteperez.xstream.modelo;</font></font></font></p>
<p align="left" style="margin-bottom: 0cm">&nbsp;</p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>import</strong></font><font color="#000000"> java.util.ArrayList;</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>import</strong></font><font color="#000000"> java.util.List;</font></font></font></p>
<p align="left" style="margin-bottom: 0cm">&nbsp;</p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>public</strong></font><font color="#000000"> </font><font color="#7f0055"><strong>class</strong></font><font color="#000000"> Blog {</font></font></font></p>
<p style="margin-bottom: 0cm">&nbsp;</p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>private</strong></font><font color="#000000"> Autor autor;</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>private</strong></font><font color="#000000"> List&lt;Entrada&gt; entradas = </font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>new</strong></font><font color="#000000"> ArrayList&lt;Entrada&gt;();</font></font></font></p>
<p style="margin-bottom: 0cm">&nbsp;</p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>public</strong></font><font color="#000000"> Blog(){</font></font></font></p>
<p style="margin-bottom: 0cm">&nbsp;</p>
<p style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt">}</font></font></p>
<p align="left" style="margin-bottom: 0cm">&nbsp;</p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>public</strong></font><font color="#000000"> Autor getAutor() {</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>return</strong></font><font color="#000000"> autor;</font></font></font></p>
<p style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt">}</font></font></p>
<p align="left" style="margin-bottom: 0cm">&nbsp;</p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>public</strong></font><font color="#000000"> </font><font color="#7f0055"><strong>void</strong></font><font color="#000000"> setAutor(Autor autor) {</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>this</strong></font><font color="#000000">.autor = autor;</font></font></font></p>
<p style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt">}</font></font></p>
<p align="left" style="margin-bottom: 0cm">&nbsp;</p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>public</strong></font><font color="#000000"> </font><font color="#7f0055"><strong>void</strong></font><font color="#000000"> add(Entrada entrada) {</font></font></font></p>
<p style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt">entradas.add(entrada);</font></font></p>
<p style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt">}</font></font></p>
<p align="left" style="margin-bottom: 0cm">&nbsp;</p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>public</strong></font><font color="#000000"> List&lt;Entrada&gt; getEntradas() {</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>return</strong></font><font color="#000000"> entradas;</font></font></font></p>
<p style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt">}</font></font></p>
<p align="left"><font color="#000000"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt">}</font></font></font></p>
</td>
</tr>
</table>
<p style="margin-bottom: 0cm">&nbsp;</p>
<p><font face="Verdana, sans-serif"></font><font face="Verdana, sans-serif"><font color="#000000"></font></font><font face="Verdana, sans-serif"><font color="#000000"><font size="2"></p>
<p style="margin-bottom: 0pt; line-height: 180%"><span style="font-size: 10pt; color: #382e1f; line-height: 180%; font-family: Verdana">Las clases anteriores son simples bean, no hay que añadir absolutamente nada para poder utilizarlos con XStream, aunque puedas ver en todas el construcción por defecto no es necesario.</span></p>
<p></font></font></font><font size="2" face="Verdana"></p>
<p style="margin-bottom: 0pt; line-height: 180%"><span style="font-size: 10pt; color: #382e1f; line-height: 180%; font-family: Verdana">Ahora vamos ver como leer y escribir con XStream. Para escribir un fichero simplemente tenemos que utilizar el método</span><span style="font-size: 9pt; color: #382e1f; line-height: 180%; font-family: Arial"> </span><strong><span style="font-size: 10pt; color: black; line-height: 180%; font-family: 'Courier New'">toXML(Object o, OutputStream stream);</span></strong></p>
<p></font></p>
<p style="margin-bottom: 0cm"><font size="2" face="Verdana"><span style="font-size: 10pt; color: black; font-family: Verdana">Como se puede ver es muy sencillo, le pasamos un Object y es capaz de generar de forma ‘mágica’ un XML, la magia se llama Reflection. XStream utiliza el <a href="http://java.sun.com/docs/books/tutorial/reflect/index.html"><font color="#bb6f02">Reflection API</font></a> para conseguir la serialización con los objetos Java sin necesidad de ficheros de mapeo (DTD o esquemas).</span></font></p>
<p><font size="2" face="Verdana"><span style="font-size: 10pt; color: black; font-family: Verdana"></span></font><font size="2" face="Verdana"><span style="font-size: 10pt; color: black; font-family: Verdana"></span></font><font size="2" face="Verdana"><span style="font-size: 10pt; color: black; font-family: Verdana"></span></font><font size="2" face="Verdana"><span style="font-size: 10pt; color: black; font-family: Verdana"></span></font><font size="2" face="Verdana"><span style="font-size: 10pt; color: black; font-family: Verdana"></span></font><font size="2" face="Verdana"><span style="font-size: 10pt; color: black; font-family: Verdana"></p>
<p style="margin-bottom: 0pt; line-height: 180%"><span style="font-size: 10pt; color: black; line-height: 180%; font-family: Verdana">En el siguiente fragmento de código podemos alguna opción más, que esta comentada a nivel de código.</span></p>
<p style="margin-bottom: 0pt; line-height: 180%"><span style="font-size: 10pt; color: black; line-height: 180%; font-family: Verdana"></span></p>
<p></span></font></p>
<table border="1" width="100%" cellPadding="4" cellSpacing="0" borderColor="#000000">
<tr>
<td width="100%" vAlign="top">
<p style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>package</strong></font><font color="#000000"> es.fuenteperez.xstream.main;</font></font></font></p>
<p align="left" style="margin-bottom: 0cm">&nbsp;</p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>import</strong></font><font color="#000000"> java.io.FileNotFoundException;</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>import</strong></font><font color="#000000"> java.io.FileOutputStream;</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>import</strong></font><font color="#000000"> com.thoughtworks.xstream.XStream;</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>import</strong></font><font color="#000000"> es.fuenteperez.xstream.modelo.Autor;</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>import</strong></font><font color="#000000"> es.fuenteperez.xstream.modelo.Blog;</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>import</strong></font><font color="#000000"> es.fuenteperez.xstream.modelo.Entrada;</font></font></font></p>
<p align="left" style="margin-bottom: 0cm">&nbsp;</p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>public</strong></font><font color="#000000"> </font><font color="#7f0055"><strong>class</strong></font><font color="#000000"> TestEscritura {</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#3f5fbf">/**</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#3f5fbf">*</font><font color="#000000"> </font><font color="#7f9fbf"><strong>@param</strong></font><font color="#000000"> </font><font color="#3f5fbf">args</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#3f5fbf">*</font><font color="#000000"> </font><font color="#7f9fbf"><strong>@throws</strong></font><font color="#000000"> </font><font color="#3f5fbf">FileNotFoundException</font><font color="#000000"> </font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#3f5fbf">*/</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>public</strong></font><font color="#000000"> </font><font color="#7f0055"><strong>static</strong></font><font color="#000000"> </font><font color="#7f0055"><strong>void</strong></font><font color="#000000"> main(String[] args){</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>try</strong></font><font color="#000000"> {</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#3f7f5f">//Creamos un objeto Blog</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#000000">Blog blog = </font><font color="#7f0055"><strong>new</strong></font><font color="#000000"> Blog();</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#3f7f5f">//Creamos un autor y se lo asociamos al blog</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#000000">Autor autor = </font><font color="#7f0055"><strong>new</strong></font><font color="#000000"> Autor(</font><font color="#2a00ff">&#8220;Héctor Fuente&#8221;</font><font color="#000000">);</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font color="#000000"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt">blog.setAutor(autor);</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#3f7f5f">//A continuacion creamos una serie de entradas para posteriomente asocialas al Blog</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#000000">Entrada entrada1 = </font><font color="#7f0055"><strong>new</strong></font><font color="#000000"> Entrada(</font><font color="#2a00ff">&#8220;XStream: Leer ficheros desde Java en 3 Lineas(I)&#8221;</font><font color="#000000">, </font><font color="#2a00ff">&#8220;XStream: Leer ficheros desde Java en 3 Lineas(I)&#8221;</font><font color="#000000">);</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#000000">Entrada entrada2 = </font><font color="#7f0055"><strong>new</strong></font><font color="#000000"> Entrada(</font><font color="#2a00ff">&#8220;XStream: Leer ficheros desde Java en 3 Lineas(II)&#8221;</font><font color="#000000">, </font><font color="#2a00ff">&#8220;XStream: Leer ficheros desde Java en 3 Lineas(II)&#8221;</font><font color="#000000">);</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#000000">Entrada entrada3 = </font><font color="#7f0055"><strong>new</strong></font><font color="#000000"> Entrada(</font><font color="#2a00ff">&#8220;XStream: Leer ficheros desde Java en 3 Lineas(III)&#8221;</font><font color="#000000">, </font><font color="#2a00ff">&#8220;XStream: Leer ficheros desde Java en 3 Lineas(III)&#8221;</font><font color="#000000">);</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font color="#000000"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt">blog.add(entrada1);</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font color="#000000"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt">blog.add(entrada2);</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font color="#000000"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt">blog.add(entrada3);</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#3f7f5f">//Creamos una instancia de XStream</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#000000">XStream xstream = </font><font color="#7f0055"><strong>new</strong></font><font color="#000000"> XStream();</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#3f7f5f">//Instanciamos el metodo toXML pasamos como atributos el objeto Blog y un FileOutputStream</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#000000"><strong>xstream.toXML(blog, </strong></font><font color="#7f0055"><strong>new</strong></font><font color="#000000"><strong> FileOutputStream(</strong></font><font color="#2a00ff"><strong>&#8220;testXStream1.xml&#8221;</strong></font><font color="#000000"><strong>));</strong></font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#3f7f5f">//XStream nos da diferentes opciones a la hora de nombrar los nodos del fichero XML</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#3f7f5f">//para cambiar por ejemplo &lt;es.fuenteperez.xstream.modelo.Autor&gt; por Autor utilizamos el metodo alias</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#000000">xstream.alias(</font><font color="#2a00ff">&#8220;blog&#8221;</font><font color="#000000">, Blog.</font><font color="#7f0055"><strong>class</strong></font><font color="#000000">);</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#000000">xstream.alias(</font><font color="#2a00ff">&#8220;autor&#8221;</font><font color="#000000">, Autor.</font><font color="#7f0055"><strong>class</strong></font><font color="#000000">);</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#000000">xstream.alias(</font><font color="#2a00ff">&#8220;entrada&#8221;</font><font color="#000000">, Entrada.</font><font color="#7f0055"><strong>class</strong></font><font color="#000000">);</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#000000">xstream.toXML(blog, </font><font color="#7f0055"><strong>new</strong></font><font color="#000000"> FileOutputStream(</font><font color="#2a00ff">&#8220;testXStreamAlias.xml&#8221;</font><font color="#000000">));</font></font></font></p>
<p align="left" style="margin-bottom: 0cm">&nbsp;</p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#3f7f5f">//Existen otras opciones como omitir por ejemplo el nombre de las colecciones</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#3f7f5f">//en nuestro caso podemos realizarlo sobre la coleccion entradas</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#3f7f5f">//Omitir el tag &#8216;entradas&#8217;, utilizamos el metodo addImplicitCollection</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#000000">xstream.addImplicitCollection(Blog.</font><font color="#7f0055"><strong>class</strong></font><font color="#000000">, </font><font color="#2a00ff">&#8220;entradas&#8221;</font><font color="#000000">);</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#000000">xstream.toXML(blog, </font><font color="#7f0055"><strong>new</strong></font><font color="#000000"> FileOutputStream(</font><font color="#2a00ff">&#8220;testXStreamOmitirTags.xml&#8221;</font><font color="#000000">));</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#000000">} </font><font color="#7f0055"><strong>catch</strong></font><font color="#000000"> (Exception e) {</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font color="#000000"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt">e.printStackTrace();</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font color="#000000"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt">} </font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font color="#000000"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt">}</font></font></font></p>
<p align="left"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#000000">}</font></font></font></p>
</td>
</tr>
</table>
<p><font face="Verdana, sans-serif"></font><font face="Verdana, sans-serif"><font color="#000000"></font></font><font face="Verdana, sans-serif"><font color="#000000"><font size="2"></p>
<p style="margin-bottom: 0pt; line-height: 15.6pt"><span style="font-size: 10pt; color: black; font-family: Verdana">En el ejemplo anterior se crean 3 ficheros XML (<em>testXStream1.xml, testXStreamAlias.xml y testXStreamOmitirTags.xml</em>) donde se puede ver texto XML generado según las opciones seleccionadas.</span></p>
<p><span style="font-size: 10pt; color: black; font-family: Verdana"></span><span style="font-size: 10pt; color: black; font-family: Verdana"></span><span style="font-size: 10pt; color: black; font-family: Verdana"></span><span style="font-size: 10pt; color: black; font-family: Verdana"></span><span style="font-size: 10pt; color: black; font-family: Verdana"></p>
<p style="margin-bottom: 0pt; line-height: 15.6pt"><span style="font-size: 10pt; color: black; font-family: Verdana">Ahora vamos ver como se pueden leer ficheros XML con XStream, para leer ficheros XML utilizamos el metodo </span><strong><span style="font-size: 10pt; color: black; font-family: 'Courier New'">xstream.fromXML(InputStream i).</span></strong></p>
<p><span></span><span></span><span></span><span></span><span></p>
<p style="margin-bottom: 0pt; line-height: 15.6pt"><span style="font-size: 10pt; color: black; font-family: Verdana">La sencillez del siguiente fragmento de código seguro os va a sorprender:</span></p>
<p style="margin-bottom: 0pt; line-height: 15.6pt"><span style="font-size: 10pt; color: black; font-family: Verdana"></span></p>
<p></span></span></font></font></font></p>
<table border="1" width="100%" cellPadding="4" cellSpacing="0" borderColor="#000000">
<tr>
<td width="604" vAlign="top">
<p style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>package</strong></font><font color="#000000"> es.fuenteperez.xstream.main;</font></font></font></p>
<p align="left" style="margin-bottom: 0cm">&nbsp;</p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>import</strong></font><font color="#000000"> java.io.FileInputStream;</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>import</strong></font><font color="#000000"> java.io.FileNotFoundException;</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>import</strong></font><font color="#000000"> com.thoughtworks.xstream.XStream;</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>import</strong></font><font color="#000000"> es.fuenteperez.xstream.modelo.Blog;</font></font></font></p>
<p align="left" style="margin-bottom: 0cm">&nbsp;</p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>public</strong></font><font color="#000000"> </font><font color="#7f0055"><strong>class</strong></font><font color="#000000"> TestLectura {</font></font></font></p>
<p align="left" style="margin-bottom: 0cm">&nbsp;</p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#3f5fbf">/**</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#3f5fbf">*</font><font color="#000000"> </font><font color="#7f9fbf"><strong>@param</strong></font><font color="#000000"> </font><font color="#3f5fbf">args</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#3f5fbf">*</font><font color="#000000"> </font><font color="#7f9fbf"><strong>@throws</strong></font><font color="#000000"> </font><font color="#3f5fbf">FileNotFoundException</font><font color="#000000"> </font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#3f5fbf">*/</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>public</strong></font><font color="#000000"> </font><font color="#7f0055"><strong>static</strong></font><font color="#000000"> </font><font color="#7f0055"><strong>void</strong></font><font color="#000000"> main(String[] args) {</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#7f0055"><strong>try</strong></font><font color="#000000"> { </font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#3f7f5f">//Creamos una instancia de XStream</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#000000">XStream xstream = </font><font color="#7f0055"><strong>new</strong></font><font color="#000000"> XStream();</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#3f7f5f">//Para leer los datos del fichero </font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font color="#3f7f5f"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt">//simplemente utilizamos el metodo fromXML</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#3f7f5f">//pasandole un FileInputStream</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#000000"><strong>Blog blog = (Blog) xstream.fromXML(</strong></font><font color="#7f0055"><strong>new</strong></font><font color="#000000"><strong> FileInputStream(</strong></font><font color="#2a00ff"><strong>&#8220;testXStream1.xml&#8221;</strong></font><font color="#000000"><strong>)); </strong></font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#000000">} </font><font color="#7f0055"><strong>catch</strong></font><font color="#000000"> (Exception e) {</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font color="#000000"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt">e.printStackTrace();</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt"><font color="#000000">System.</font><font color="#0000c0"><em>out</em></font><font color="#000000">.println(</font><font color="#2a00ff">&#8220;Tal vez debas ejecutar primero TestEscritura.java&#8221;</font><font color="#000000">);</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font color="#000000"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt">}</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font color="#000000"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt">}</font></font></font></p>
<p align="left" style="margin-bottom: 0cm"><font color="#000000"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt">}</font></font></font></p>
</td>
</tr>
</table>
<p style="margin-bottom: 0cm">&nbsp;</p>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font color="#000000"><font size="2">Con una simple llamada a un método, obtenemos el objeto Blog.</font></font></font></p>
<p style="margin-bottom: 0cm">&nbsp;</p>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font color="#000000"><font size="2">Podéis descargaros el proyecto para Eclipse con el código que aparece en el artículo en la siguiente dirección:</font></font></font></p>
<p align="center" style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><a href="http://www.fuenteperez.es/resources/testXStream.zip">http://www.fuenteperez.es/resources/testXStream.zip</a></font></p>
<p align="center" style="margin-bottom: 0cm">&nbsp;</p>
<p align="left" style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font color="#000000"><font size="2">Otras alternativas más formales para leer y escribir ficheros XML son <a href="https://jaxb.dev.java.net/">JAXB</a> o <a href="http://xmlbeans.apache.org/">XMLBeans</a>, si conocéis alguna otra librería de acceso a XML estaría encantado de que lo comentarais.</font></font></font></p>
<p align="left" style="margin-bottom: 0cm">&nbsp;</p>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font color="#000000"><font size="2">Salu2. <img src='http://fuenteperez.es/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </font></font></font></p>
]]></content:encoded>
			<wfw:commentRss>http://fuenteperez.es/blog/xstream-leer-ficheros-xml-desde-java/feed</wfw:commentRss>
		</item>
		<item>
		<title>Salvar al Burgos C.F</title>
		<link>http://fuenteperez.es/blog/salvar-al-burgos-cf</link>
		<comments>http://fuenteperez.es/blog/salvar-al-burgos-cf#comments</comments>
		<pubDate>Tue, 22 Jul 2008 09:04:26 +0000</pubDate>
		<dc:creator>Héctor Fuente Pérez</dc:creator>
		
		<category><![CDATA[Burgos]]></category>

		<guid isPermaLink="false">http://fuenteperez.es/blog/salvar-al-burgos-cf</guid>
		<description><![CDATA[“Salvar al Burgos C.F” este es el nombre y la intención de un grupo de valientes burgaleses que luchan por cambiar el destino de un club de futbol que mal que nos pese es reflejo de la sociedad burgalesa. 
Como aficionado del Burgos C.F puedo asegurar que esta situación se veía venir, muchos son los que [...]]]></description>
			<content:encoded><![CDATA[<p><span style="font-size: 10pt; font-family: Verdana">“Salvar al Burgos C.F” este es el nombre y la intención de un grupo de <strong>valientes burgaleses </strong>que luchan por cambiar el destino de un club de futbol que mal que nos pese es reflejo de la sociedad burgalesa.</span><span style="font-size: 10pt; font-family: Verdana"> </span></p>
<p><span style="font-size: 10pt; font-family: Verdana"></span><span style="font-size: 10pt; font-family: Verdana"><span style="font-size: 10pt; font-family: Verdana">Como aficionado del Burgos C.F puedo asegurar que esta situación se veía venir, muchos son los que venían advirtiéndolo en el foro de </span></span><span style="font-size: 10pt; font-family: Verdana"><span style="font-size: 10pt; font-family: Verdana">la Web oficial del Burgos Club de Futbol.</span><span style="font-size: 10pt; font-family: Verdana"> </span></span></p>
<p><span style="font-size: 10pt; font-family: Verdana"><span style="font-size: 10pt; font-family: Verdana"><span style="font-size: 10pt; font-family: Verdana">Muchos fueron expulsados del foro, no por sus insultos, sino por decir la realidad, la censura aplicada por la Familia Novoa intentaba llegar a todos los aspectos del club.</span></span></span></p>
<p><span style="font-size: 10pt; font-family: Verdana"><span style="font-size: 10pt; font-family: Verdana"><span style="font-size: 10pt; font-family: Verdana"></span></span><span style="font-size: 10pt; font-family: Verdana">Después de confundirse con los fichajes de técnicos y jugadores durante toda la temporada, llego lo que ninguno nos imaginábamos a principio de temporada:</span><span style="font-size: 10pt; font-family: Verdana"> </span></span></p>
<p><span style="font-size: 10pt; font-family: Verdana"><span style="font-size: 10pt; font-family: Verdana"></span><span style="font-size: 10pt; font-family: Verdana"></span><span style="font-size: 10pt; font-family: Verdana"><span style="font-size: 10pt; font-family: Verdana">“18 de Mayo de 2008 partido decisivo, 500 burgaleses se desplazan a nuestra vecina Palencia, resultado 1-1, el Guadalajara no nos ayuda y en su campo pierde 0-4 con el filial rojillo, Palencia y Burgos están en Tercera”.</span><span style="font-size: 10pt; font-family: Verdana"> </span></span><span style="font-size: 10pt; font-family: Verdana"> </span></span></p>
<p><span style="font-size: 10pt; font-family: Verdana"><span style="font-size: 10pt; font-family: Verdana"></span><span style="font-size: 10pt; font-family: Verdana"></span><span style="font-size: 10pt; font-family: Verdana">Al día siguiente <strong>Domingo Novoa Rey</strong> no tarda en salir en los medios de comunicación diciendo que el Burgos jugara en Tercera el año que viene, MENTIRAS.</span><span style="font-size: 10pt; font-family: Verdana"> </span></span></p>
<p><span style="font-size: 10pt; font-family: Verdana"><span style="font-size: 10pt; font-family: Verdana"></span><span style="font-size: 10pt; font-family: Verdana"></span><span style="font-size: 10pt; font-family: Verdana"><span style="font-size: 10pt; font-family: Verdana">La situación a día de hoy es bien distinta, existe más de una decena de denuncias de jugadores por impagos, si el día 31 de Julio no se hacen efectivos los pagos el club será descendido a Regional, y lo peor no es eso, sino otra nueva desaparición.</span><span style="font-size: 10pt; font-family: Verdana"> </span></span> </span><span style="font-size: 10pt; font-family: Verdana"><span style="font-size: 10pt; font-family: Verdana"><span style="font-size: 10pt; font-family: Verdana"></span></span><span style="font-size: 10pt; font-family: Verdana"><span style="font-size: 10pt; font-family: Verdana">Los valiente burgaleses que luchan por la no desaparición comienzan su batalla, probablemente a sabiendas que es una lucha desigual pero no por ello piensan desesperar.</span><span style="font-size: 10pt; font-family: Verdana"> </span><span style="font-size: 10pt; font-family: Verdana"> </span></span></span><span style="font-size: 10pt; font-family: Verdana"><span style="font-size: 10pt; font-family: Verdana"><span style="font-size: 10pt; font-family: Verdana"></span><span style="font-size: 10pt; font-family: Verdana">Y no luchan por ellos mismo, <strong>luchan por una ciudad, unos colores, una identidad y no lo olvidemos por 300 jugadores componen la cantera del Burgos C.F, todos ellos jóvenes con ilusiones y sueños de jugar algún día en el equipo de su ciudad.</strong></span><span style="font-size: 10pt; font-family: Verdana"><strong> </strong></span></span></span><span style="font-size: 10pt; font-family: Verdana"><strong> </strong><span style="font-size: 10pt; font-family: Verdana"><span style="font-size: 10pt; font-family: Verdana"></span><span style="font-size: 10pt; font-family: Verdana"><strong><span style="font-size: 10pt; font-family: Verdana">POR FAVOR NO PERMITAMOS QUE ARREBATEN LOS <span> </span>SUEÑOS E ILUSIONES A 300 JOVENES.</span><span style="font-size: 10pt; font-family: Verdana"> </span></strong></span></span></p>
<p></span></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana">Sin más que decir, solamente publicar la carta que han redactado los integrantes de esta plataforma, solo por gente como vosotros, el Burgos C.F debe salvarse:</span></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana"></span></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana"></span></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana"></span></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana"></span></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana"><span style="font-size: 12pt; font-family: Verdana"><strong>A LOS SOCIOS Y AFICIONADOS DEL BURGOS C.F.</strong></span></span></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana"><span style="font-size: 12pt; font-family: Verdana"></span></span></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana"><span style="font-size: 12pt; font-family: Verdana"></span></span></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana"><span style="font-size: 12pt; font-family: Verdana"></span></span></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana"><span style="font-size: 12pt; font-family: Verdana"></span><img width="295" src="http://www.burgoscf.es/fotos/755.jpg" alt="SalvarAlBurgos" height="106" style="width: 295px; height: 106px" title="SalvarAlBurgos" /> </span></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana"></span></p>
<p><span style="font-size: 10pt; font-family: Verdana"><span style="font-size: 10pt; color: #333333; font-family: Verdana">CUENTA: SALVAR AL BURGOS C.F. : </span><span class="rojo1"><u><span style="font-size: 10pt; font-family: Verdana"><strong><font color="#cc0000">2018-0000-69-0001458472</font></strong></span></u></span></span></p>
<p><span style="font-size: 10pt; font-family: Verdana"><span class="rojo1"><u><span style="font-size: 10pt; font-family: Verdana"></span></u></span><span style="font-size: 10pt; color: #333333; font-family: Verdana"></span></span><span style="font-size: 10pt; font-family: Verdana"><span style="font-size: 10pt; color: #333333; font-family: Verdana">La plataforma SALVAR AL BURGOS C.F. formada por socios, peñas y aficionados de nuestro Club de Fútbol, desea comunicar a todos los socios y aficionados del fútbol burgalés, que a raíz del descenso deportivo que sufrió el Burgos C.F. a la tercera división del fútbol nacional, se han desencadenado unos acontecimientos que han derivado en la más que posible desaparición del club de fútbol que porta el nombre de nuestra ciudad, lo cual no solo significaría la pérdida del equipo profesional sino también probablemente la de las categorías inferiores que cuentan con 13 equipos y 300 niños y jóvenes burgaleses compitiendo y trabajando en ellas así como la de la sección de fútbol sala y de varios puestos de trabajo.</span></span></p>
<p><span style="font-size: 10pt; font-family: Verdana"><span style="font-size: 10pt; color: #333333; font-family: Verdana"></span></span><span style="font-size: 10pt; font-family: Verdana"><span style="font-size: 10pt; color: #333333; font-family: Verdana">De consumarse la situación, el desprestigio del fútbol burgalés, que sumaría 3 vergonzosas desapariciones, tendría un alto calado a nivel nacional, siendo nuestra ciudad la única capital de provincia que no contaría con un equipo en categorías nacionales.</span></span><span style="font-size: 10pt; font-family: Verdana"><span style="font-size: 10pt; color: #333333; font-family: Verdana">La primera medida adoptada fue la solicitud de una audiencia con el Alcalde de la ciudad, D. J. Carlos Aparicio a los efectos de exponerle la gravedad del asunto y de las consecuencias nefastas para el conjunto y la imagen de la ciudad, así como las posibles soluciones que podrían darse a imagen de otras ciudades de nuestro entorno cercano.</span></span></p>
<p><span style="font-size: 10pt; font-family: Verdana"><span style="font-size: 10pt; color: #333333; font-family: Verdana"><br />
La reunión, celebrada el viernes 18 de julio, fue de entendimiento de la situación de ambas partes y de las medidas que cada uno, dentro de la medida de sus posibilidades, pueden tomar para evitar lo que ninguno deseamos. Asimismo, los responsables municipales, mostraron su mayor disposición para que las categorías inferiores continúen con su labor independientemente de lo que suceda con el primer equipo.</span></span><span style="font-size: 10pt; font-family: Verdana"><span style="font-size: 10pt; color: #333333; font-family: Verdana"> </span></span><span style="font-size: 10pt; font-family: Verdana"><span style="font-size: 10pt; color: #333333; font-family: Verdana">Otra de las medidas de urgencia adoptadas para intentar revertir la situación ha sido la apertura de una cuenta corriente mancomunada, que necesita de la firma de varias personas para disponer de los fondos, para que los socios y aficionados aporten lo que puedan en la medida de sus posibilidades, y que se gestionará con la transparencia que merecen los que en ella depositen su dinero, proporcionando claves de internet a partir del día 1 de agosto, para que cualquier persona pueda ver sus movimientos bancarios. Asimismo hemos abierto la siguiente dirección de correo electrónico para que cualquiera pueda ponerse en contacto con nosotros: salvaralburgos@hotmail.com.</span></span><span style="font-size: 10pt; font-family: Verdana"><span style="font-size: 10pt; color: #333333; font-family: Verdana">Lo recaudado en dicha cuenta se destinará única y exclusivamente a pagar las deudas contraídas con los jugadores, y en ningún caso para negociar con los actuales gestores (Familia Novoa) su salida del club.</span></span><span style="font-size: 10pt; font-family: Verdana"><span style="font-size: 10pt; color: #333333; font-family: Verdana">Los ingresos deben realizarse dejando claro la identificación del ordenante, indicando nombre y apellidos o razón social, para que en caso de que las gestiones sean infructuosas, se proceda a la devolución de las sumas aportadas. En el concepto del ingreso sería importante además indicar un número de teléfono o un e-mail.</span></span><span style="font-size: 10pt; font-family: Verdana"><span style="font-size: 10pt; color: #333333; font-family: Verdana">Es por eso que las mismas se deben realizar a la máxima brevedad posible, para poder negociar con los jugadores y que las denuncias presentadas ante</span></span><span style="font-size: 10pt; font-family: Verdana"><span style="font-size: 10pt; color: #333333; font-family: Verdana"></p>
<personname ProductID="la AFE" w:st="on"></personname>la AFE (Asociación de Futbolistas Españoles) se retiren antes del 31 de julio, fecha límite y ante la cual, si no se han solventado, se produciría un nuevo descenso de nuestro club a Regional Preferente.El número de cuenta en el que se pueden realizar las aportaciones es:<span class="rojo1"><u><span style="font-size: 10pt; font-family: Verdana"><strong><font color="#cc0000">2018-0000-69-0001458472</font></strong></span></u></span><span style="font-size: 10pt; color: #333333; font-family: Verdana"></span><span style="font-size: 10pt; color: #333333; font-family: Verdana">Por ello queremos pedirte que si sientes nuestro club, y has sufrido y vibrado con él a lo largo de estos años de alegrías y sinsabores deportivos, aportes lo que creas conveniente y nos ayudes a intentar salvar al Burgos Club de Fútbol.NO TE QUEDES DE BRAZOS CRUZADOS, ENTRE </span><span style="font-size: 10pt; color: #333333; font-family: Verdana">TODOS LO CONSEGUIREMOS!!!<br />
</span><span style="font-size: 10pt; color: #333333; font-family: Verdana">AUPA EL BURGOS C.F.!!!<span style="font-size: 10pt; font-family: Verdana"></span></span></span></span></p>
]]></content:encoded>
			<wfw:commentRss>http://fuenteperez.es/blog/salvar-al-burgos-cf/feed</wfw:commentRss>
		</item>
		<item>
		<title>Guía Rápida de JBoss Drools BRMS 4.0.*</title>
		<link>http://fuenteperez.es/blog/guia-rapida-de-jboss-drools-brms-40</link>
		<comments>http://fuenteperez.es/blog/guia-rapida-de-jboss-drools-brms-40#comments</comments>
		<pubDate>Fri, 13 Jun 2008 08:29:28 +0000</pubDate>
		<dc:creator>Héctor Fuente Pérez</dc:creator>
		
		<category><![CDATA[JBoss Drools]]></category>

		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://fuenteperez.es/blog/guia-rapida-de-jboss-drools-brms-40</guid>
		<description><![CDATA[El siguiente documento pretende ser un pequeño rayo de luz sobre el infierno del “¿por donde empezar?” teniendo en cuenta la documentación de Drools y en general de JBoss, sin ser tan poéticos esto es una guiá rápida de Jboss Drools BRMS.  
&#160;
En este articulo nos vamos a central en JBoss Drools BRMS (Business [...]]]></description>
			<content:encoded><![CDATA[<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2">El siguiente documento pretende ser un pequeño rayo de luz sobre el infierno del “¿por donde empezar?” teniendo en cuenta la documentación de Drools y en general de JBoss, sin ser tan poéticos esto es una guiá rápida de Jboss Drools BRMS. <img src='http://fuenteperez.es/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </font></font></p>
<p style="margin-bottom: 0cm">&nbsp;</p>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2">En este articulo nos vamos a central en JBoss Drools BRMS (Business Rules Management System).</font></font></p>
<p style="margin-bottom: 0cm">&nbsp;</p>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2"><strong>¿Qué es JBoss Drools BRMS?</strong></font></font></p>
<p style="margin-bottom: 0cm">&nbsp;</p>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2">Es el componente de Jboss Rules que permite gestionar, almacenar, clasificar, modificar y desplegar en caliente reglas de negocio, que podrán ser invocadas vía servicios web desde aplicaciones Java. </font></font></p>
<p style="margin-bottom: 0cm">&nbsp;</p>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2">Proporciona un interfaz Web, que facilita la definición de reglas a personas que no trabajan con habitualmente con IDES de desarrollo, principalmente Analista de Negocio y Expertos en Reglas.</font></font></p>
<p style="margin-bottom: 0cm">&nbsp;</p>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2">Alguna característica técnica interesante: utiliza JCR (JackRabbit) para la gestión del repositorio de reglas o que utiliza el estándar JAAS para la autorización y autenticación.</font></font></p>
<p style="margin-bottom: 0cm">&nbsp;</p>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2"><strong>Requisitos</strong></font></font></p>
<p style="margin-bottom: 0cm">&nbsp;</p>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2">- Debemos tener un contenedor de servlets: recomiendo <a href="http://www.jboss.org/jbossas/downloads/">Jboss 4.2.2.GA</a>, si quieres Tomcat debeis ver la información de este <a href="http://wiki.jboss.org/wiki/JBRMSjsfdependencies">link</a>.</font></font></p>
<p style="margin-bottom: 0cm">&nbsp;</p>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2">- Necesitamos como mínimo un JavaBean en un fichero .jar, si quieres utilizar el del ejemplo que puedes descargarlo <a href="http://www.fuenteperez.es/resources/drools/brms/modelo.jar">aquí</a>.</font></font></p>
<p style="margin-bottom: 0cm">&nbsp;</p>
<ol>
<li>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2"><a href="http://download.jboss.org/drools/release/4.0.7.19894.GA/drools-4.0.7-brms.zip">Descargamos JBoss Drools BRMS.</a></font></font></p>
</li>
<li>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2">Desplegamos el BRMS en el servidor de aplicaciones. En JBoss:</font></font></p>
</li>
</ol>
<ul>
<li>
<p style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt">Descomprimir el archivo drools-4.0.*-brms.zip.</font></font></p>
</li>
<li>
<p style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt">Copiamos el archivo drools-jbrms.war a la carpeta JBOSS_HOME\server\default\deploy.</font></font></p>
</li>
<li>
<p style="margin-bottom: 0cm"><font face="Courier New, monospace"><font size="2" style="font-size: 9pt">Arrancamos Jboss: JBOSS_HOME\bin\run.bat</font></font></p>
</li>
</ul>
<ol start="3">
<li>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2">Accedemos a la aplicación web, para ellos abrimos un navegador e introducimos la siguiente url: <a href="http://localhost:8080/">http://localhost:8080/drools-jbrms</a>. A continuación nos aparece la siguiente pantalla de login pulsamos el botón Login con User y Password vacíos.</font></font></p>
</li>
<p style="text-align: center"><a rel="lightbox" href="http://www.fuenteperez.es/resources/drools/brms/drools_brms_login.JPG"><br />
<img width="273" src="http://www.fuenteperez.es/resources/drools/brms/drools_brms_login_little.JPG" alt="Pulsa para agrandar la imagen (JBoss Drools BRMS Login)" height="183" style="width: 273px; height: 183px" /><br />
</a></p>
<li>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2">Puedes ver cinco opciones en un menú a la izquierda: Info, Rules, Packages, Deployment y Admin.</font></font></p>
</li>
<li>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2">Vamos a crear una categoría, las categorías no son obligatorias, pero es recomendable cuando tenemos gran cantidad de reglas. Para ello vamos al Menú Admin <font face="Times New Roman, serif">→</font> Create a new category.</font></font></p>
</li>
<li>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2">Introducimos el nombre Candidatos y una descripción, y pulsamos OK. Si no aparece la nueva categoría pulsa sobre la opción Refresh view.</font></font></p>
</li>
<p style="text-align: center"><a rel="lightbox" href="http://www.fuenteperez.es/resources/drools/brms/drools_brms_categoria.JPG"><br />
<img width="273" src="http://www.fuenteperez.es/resources/drools/brms/drools_brms_categoria_little.JPG" alt="Pulsa para agrandar la imagen (JBoss Drools BRMS Crear Categoría)" height="183" style="width: 273px; height: 183px" /><br />
</a></p>
<li>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2">A continuación pulsamos sobre la opción del menú “Packages”, la pantalla muestra varias opciones en la parte superior representadas por pequeños iconos, pulsamos sobre el primero. En la siguiente imagen se puede observar:</font></font></p>
</li>
<p style="text-align: center"><a rel="lightbox" href="http://www.fuenteperez.es/resources/drools/brms/drools_brms_package.JPG"><br />
<img width="273" src="http://www.fuenteperez.es/resources/drools/brms/drools_brms_package_little.JPG" alt="Pulsa para agrandar la imagen (JBoss Drools BRMS Crear Package)" height="183" style="width: 273px; height: 183px" /><br />
</a></p>
<li>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2">Nos solicita un nombre de paquete y una descripción, p.e candidatoSample y aceptamos. </font></font></p>
</li>
<li>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2">Ahora vamos a asociar un modelo de datos al paquete creado anteriormente, para ello pulsamos sobre el icono de la parte superior con forma de bote, e introducimos un nombre p.e “Modelo” y establecemos a que paquete va a estar asociado “candidatoSample”.</font></font></p>
</li>
<li>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2">Este modelo debe hacer referencia a un jar, el cual contendrá una serie de beans, en nuestro caso un único bean llamado “Persona”. En la siguiente imagen se puede observar los pasos a seguir. Importante: el jar no debe contener los fuentes, ya que nos saltara una excepción al importar las clases: <font face="Courier New, monospace">java.lang.ClassFormatError: Incompatible magic value </font></font></font></p>
</li>
<p style="text-align: center"><a rel="lightbox" href="http://www.fuenteperez.es/resources/drools/brms/drools_brms_package2.JPG"><br />
<img width="273" src="http://www.fuenteperez.es/resources/drools/brms/drools_brms_package2_little.JPG" alt="Pulsa para agrandar la imagen (JBoss Drools BRMS Crear Package2)" height="183" style="width: 273px; height: 183px" /><br />
</a></p>
<li>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2">Ya falta menos para escribir una regla. En el árbol de la izquierda hacemos click sobre el paquete, y seleccionamos “Edit Package Configuration”, nos aparece la siguiente pantalla.</font></font></p>
</li>
<p style="text-align: center"><a rel="lightbox" href="http://www.fuenteperez.es/resources/drools/brms/drools_brms_package3.JPG"><br />
<img width="273" src="http://www.fuenteperez.es/resources/drools/brms/drools_brms_package3_little.JPG" alt="Pulsa para agrandar la imagen (JBoss Drools BRMS Edit Package Configuration)" height="183" style="width: 273px; height: 183px" /><br />
</a></p>
<li>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2">En la sección “Header” de la pantalla anterior debemos incluir las clases sobre la cuales vamos a definir reglas, así como la definición de variables globales. En nuestro caso añadimos nuestro único bean, importante no incluir ; al final de la linea:</font></font></p>
</li>
</ol>
<p align="center" style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2"><font color="#000000"><font face="Courier New, monospace">import es.fuenteperez.brms.modelo.Persona</font></font></font></font></p>
<p align="center" style="margin-bottom: 0cm">&nbsp;</p>
<ol start="13">
<li>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2">Llegados a este punto ya podemos definir una regla, para ello en el menú que se encuentra encima del árbol, pulsamos sobre el icono de Drools si nos ponemos sobre este nos muestra un tooltip con “Create New Rule”.</font></font></p>
</li>
<li>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2">Introducimos el nombre, seleccionamos el paquete, y el formato de la regla, vamos a seleccionar Regla de Negocio (Bussiness rule using guided editor).</font></font></p>
</li>
<p style="text-align: center"><a rel="lightbox" href="http://www.fuenteperez.es/resources/drools/brms/drools_brms_definicion_regla.JPG"><br />
<img width="273" src="http://www.fuenteperez.es/resources/drools/brms/drools_brms_definicion_regla_little.JPG" alt="Pulsa para agrandar la imagen (JBoss Drools BRMS Rule Configuration)" height="183" style="width: 273px; height: 183px" /><br />
</a></p>
<li>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2">Vamos a definir una regla que comprueba si la edad de la Persona &gt;= 18 y &lt;=65, y en caso afirmativo, vamos establecer que la persona puede no esta descartada para trabajar. Para ello en primer lugar pulsamos sobre la cruz verde, nos aparece un popup donde vamos a añadir la condición a la regla, en el combo Fact nos aparecen todos las clases de nuestro modelo en nuestro caso solo aparece Persona, la seleccionamos automáticamente añade Persona a la regla.</font></font></p>
</li>
<li>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2">Ahora pulsamos sobre la flecha verde junto a Persona, e introducimos en el campo Variable name una p y pulsamos el botón Set. Con esto nos permitirá referencia el bean que estamos comparando en el THEN de la regla.</font></font></p>
</li>
<li>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2">De nuevo pulsamos sobre la flecha verde junto a Persona, nos permite añadir condiciones sobre un campo, en el combo Add a restriction on a field tenemos todas propiedad del bean Persona seleccionamos edad.</font></font></p>
</li>
<li>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2">Junto a la palabra edad nos aparece un combo con diferentes opciones, el contenido de este dependerá del tipo del campo a comparar en este caso edad es un Integer, seleccionamos greater than or equal to, y pulsamos sobre un el lápiz que esta junto al combo anterior.</font></font></p>
</li>
<li>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2">Nos aparece una pantalla y pulsamos sobre Literal value, donde antes se encontraba el lápiz ahora hay una caja de texto, introducimos 18. Junto a la caja de texto hay un flecha transparente, pulsamos sobre ella, nos aparece otro combo y seleccionamos &#8216;and less than (or equal to), y como anteriormente pulsamos sobre el lápiz e introducimos 65. La regla nos quedaría como se ve en la siguiente imagen.</font></font></p>
</li>
<p style="text-align: center"><a rel="lightbox" href="http://www.fuenteperez.es/resources/drools/brms/drools_brms_rule1.JPG"><br />
<img width="273" src="http://www.fuenteperez.es/resources/drools/brms/drools_brms_rule1_little.JPG" alt="Pulsa para agrandar la imagen (JBoss Drools BRMS Definir Regla)" height="183" style="width: 273px; height: 183px" /><br />
</a></p>
<li>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2">Ya hemos definido que se debe cumplir (WHEN), ahora vamos lo que sucede si se cumple la condición anterior THEN. Pulsamos sobre la cruz verde y nos aparece una pantalla con el texto Add a new action &#8230;, seleccionamos en el combo Set Values on a field on, seleccionamos en el combo [p] que es el bean que hemos tratado en el WHEN, nos añade Set [p].</font></font></p>
</li>
<li>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2">Pulsamos sobre la flecha verde que esta junto al texto anterior y nos aparece un combo con todas la propiedades que tiene Persona, seleccionamos descartado que es un Boolean, y en la caja de texto junto a descartado introducimos false. Pulsamos Validate para ver si la regla es correcta. Además existe la opción View Source donde nos muestra el código de la regla donde personalmente creo que se entiende mejor.</font></font></p>
</li>
</ol>
<p style="text-align: center"><a rel="lightbox" href="http://www.fuenteperez.es/resources/drools/brms/drools_brms_rule2.JPG"><br />
<img width="273" src="http://www.fuenteperez.es/resources/drools/brms/drools_brms_rule2_little.JPG" alt="Pulsa para agrandar la imagen (JBoss Drools BRMS Definir Regla 2)" height="183" style="width: 273px; height: 183px" /><br />
</a></p>
<p style="margin-bottom: 0cm">&nbsp;</p>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2">Os recomiendo cacharrear con el JBoss Drools BRMS y ver el resto de opciones que proporciona. En otro articulo contare como acceder desde una aplicación a las reglas definidas en Drools Brms, así como importar reglas que hemos definido fuera de JBoss Drools Brms y alguna cosa más.</font></font></p>
<p style="margin-bottom: 0cm">&nbsp;</p>
<p style="margin-bottom: 0cm"><font face="Verdana, sans-serif"><font size="2">Salu2. <img src='http://fuenteperez.es/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </font></font></p>
]]></content:encoded>
			<wfw:commentRss>http://fuenteperez.es/blog/guia-rapida-de-jboss-drools-brms-40/feed</wfw:commentRss>
		</item>
	</channel>
</rss>
