<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Wepa Blog - Publicações na área de TI</title>
	<atom:link href="http://fabricioepa.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://fabricioepa.wordpress.com</link>
	<description></description>
	<lastBuildDate>Sun, 13 Sep 2009 15:01:26 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>pt-br</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='fabricioepa.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/be3fd067317e67105561999cb443aa77?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Wepa Blog - Publicações na área de TI</title>
		<link>http://fabricioepa.wordpress.com</link>
	</image>
			<item>
		<title>Maemo Eclipse Integration 2nd Edition PreFinal Released</title>
		<link>http://fabricioepa.wordpress.com/2009/09/11/maemo-eclipse-integration-2nd-edition-prefinal-released/</link>
		<comments>http://fabricioepa.wordpress.com/2009/09/11/maemo-eclipse-integration-2nd-edition-prefinal-released/#comments</comments>
		<pubDate>Fri, 11 Sep 2009 19:10:36 +0000</pubDate>
		<dc:creator>fabricioepa</dc:creator>
				<category><![CDATA[Móvel]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[esbox]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[maemo]]></category>
		<category><![CDATA[maemosdk]]></category>
		<category><![CDATA[n900]]></category>
		<category><![CDATA[nokia]]></category>
		<category><![CDATA[pluthon]]></category>
		<category><![CDATA[signove]]></category>
		<category><![CDATA[signove.com]]></category>

		<guid isPermaLink="false">http://fabricioepa.wordpress.com/?p=51</guid>
		<description><![CDATA[Para quem conhece os dipositivos da nokia que usam a plataforma maemo (maemo.org) segue uma boa notícia. Acabamos de lançar a versão pré-final do ambiente de desenvolvimento integrado com Eclipse IDE para estes dispositivos, daí o nome Maemo IDE Integration.  Ele também já suporta o mais novo dispositivo nokia para maemo e recém lançado no [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fabricioepa.wordpress.com&blog=3009806&post=51&subd=fabricioepa&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Para quem conhece os dipositivos da nokia que usam a plataforma maemo (<a title="maemo.org" href="http://maemo.org" target="_blank">maemo.org</a>) segue uma boa notícia. Acabamos de lançar a versão pré-final do ambiente de desenvolvimento integrado com Eclipse IDE para estes dispositivos, daí o nome Maemo IDE Integration.  Ele também já suporta o mais novo dispositivo nokia para maemo e recém lançado no mercado,  é simplesmente uma máquina clique e vejam o <a title="N900" href="http://maemo.nokia.com/n900/" target="_blank">N900</a> !!</p>
<p>Vejam as duas linhas do produto e os screenshots disponíveis em:</p>
<p><a title="ESbox" href="http://esbox.garage.maemo.org" target="_blank"><strong>ESbox</strong> </a>- IDE para aplicações C/C++ e Python, requer instalação de SDK para executar c<em>ross</em>-<em>compilation </em>para o dispositivo.</p>
<p><a title="PluThon" href="http://pluthon.garage.maemo.org" target="_blank"><strong>PluThon</strong></a>-  IDE leve para aplicações  python utilizando diretamente o dispositivo como plataforma de desenvolvimento, não requer SDK.</p>
<p>Existem muitas features novas legais além de um novo sistema de ajuda sensível  para o desenvolvedor que é dinamicamente atualizado pelos mantenedores <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> ! =]</p>
<p>Para criação destes dois produtos eclipse,  foi desenvolvido um o novo framework base: <strong>Mica </strong>(Maemo IDE Common Architecture -  <a href="http://mica.garage.maemo.org/2nd_edition/">http://mica.garage.maemo.org/2nd_edition/</a>), matendo a aquitetura de cada produto bastante simplificada e fácil para quem desejar colaborar ou estender os mesmos ou ainda criar o seu&#8230;.  hein? Sim o código é inteiramente open-source e tem licensa <a title="EPL" href="http://www.eclipse.org/legal/epl-v10.html" target="_blank">EPL </a>.</p>
<p>O link oficial do anúncio: <a style="text-decoration:none;" href="http://maemo.org/news/announcements/maemo_eclipse_integration_2nd_edition_prefinal_released/">http://maemo.org/news/announcements/maemo_eclipse_integration_2nd_edition_prefinal_released/</a></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fabricioepa.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fabricioepa.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fabricioepa.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fabricioepa.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fabricioepa.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fabricioepa.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fabricioepa.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fabricioepa.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fabricioepa.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fabricioepa.wordpress.com/51/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fabricioepa.wordpress.com&blog=3009806&post=51&subd=fabricioepa&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://fabricioepa.wordpress.com/2009/09/11/maemo-eclipse-integration-2nd-edition-prefinal-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fce1b2a6387a8d4a7fede7a78286c4be?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">fabricioepa</media:title>
		</media:content>
	</item>
		<item>
		<title>JEE Quick Start &#8211; Web Tier</title>
		<link>http://fabricioepa.wordpress.com/2009/03/11/jee-quick-start-web-tier/</link>
		<comments>http://fabricioepa.wordpress.com/2009/03/11/jee-quick-start-web-tier/#comments</comments>
		<pubDate>Wed, 11 Mar 2009 23:34:26 +0000</pubDate>
		<dc:creator>fabricioepa</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[java web]]></category>
		<category><![CDATA[jee]]></category>
		<category><![CDATA[jsp]]></category>
		<category><![CDATA[jstl]]></category>
		<category><![CDATA[servlets]]></category>

		<guid isPermaLink="false">http://fabricioepa.wordpress.com/2009/03/11/jee-quick-start-web-tier/</guid>
		<description><![CDATA[Para aqueles que desejam entrar no mundo JEE Web e precisam de um ponta pé inicial, nada melhor que uma apresentação curta e grossa com uma visão simplificada do assunto.
Registre sua dúvida ou opinião sobre o mini-workshop  http://fabricioepa.googlepages.com/jeequickstart-webtier
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fabricioepa.wordpress.com&blog=3009806&post=41&subd=fabricioepa&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Para aqueles que desejam entrar no mundo JEE Web e precisam de um ponta pé inicial, nada melhor que uma apresentação curta e grossa com uma visão simplificada do assunto.</p>
<p>Registre sua dúvida ou opinião sobre o mini-workshop  <a href="http://fabricioepa.googlepages.com/jeequickstart-webtier">http://fabricioepa.googlepages.com/jeequickstart-webtier</a></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fabricioepa.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fabricioepa.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fabricioepa.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fabricioepa.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fabricioepa.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fabricioepa.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fabricioepa.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fabricioepa.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fabricioepa.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fabricioepa.wordpress.com/41/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fabricioepa.wordpress.com&blog=3009806&post=41&subd=fabricioepa&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://fabricioepa.wordpress.com/2009/03/11/jee-quick-start-web-tier/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fce1b2a6387a8d4a7fede7a78286c4be?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">fabricioepa</media:title>
		</media:content>
	</item>
		<item>
		<title>JBean File Storage</title>
		<link>http://fabricioepa.wordpress.com/2008/08/20/jbean-file-storage/</link>
		<comments>http://fabricioepa.wordpress.com/2008/08/20/jbean-file-storage/#comments</comments>
		<pubDate>Wed, 20 Aug 2008 18:36:44 +0000</pubDate>
		<dc:creator>fabricioepa</dc:creator>
				<category><![CDATA[Hibernate]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[file management]]></category>
		<category><![CDATA[file storage]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[JBeanFileStorage]]></category>
		<category><![CDATA[JBFS]]></category>

		<guid isPermaLink="false">http://fabricioepa.wordpress.com/?p=13</guid>
		<description><![CDATA[Após um bomtempo sem publicar devido a minha dedicação ao projeto &#8220;Easy Accept Web&#8221; (mas isso fica para outro post),  anuncio um novo componente para auxílio a manipulação e associação de caminhos de arquivos/diretórios com POJOS.  Muito útil quando sua aplicação trabalha em conjunto com framework ORM (Hibernate like), onde se deseja por [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fabricioepa.wordpress.com&blog=3009806&post=13&subd=fabricioepa&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Após um bomtempo sem publicar devido a minha dedicação ao projeto &#8220;Easy Accept Web&#8221; (mas isso fica para outro post),  anuncio um novo componente para auxílio a manipulação e associação de caminhos de arquivos/diretórios com POJOS.  Muito útil quando sua aplicação trabalha em conjunto com framework ORM (Hibernate like), onde se deseja por exemplo associar uma entidade com um determinado diretório de arquivos (para upload/download por exemplo), seu nome por enquanto é :</p>
<h3><strong> JBean File Storage</strong></h3>
<p style="text-align:left;">
<p style="text-align:left;">O componente ainda apesar de implementado ainda não está disponibilizado publicamente pois ainda necessita de revisão, documentação e algumas possíveis melhorias embora esta versão esteja presente em 2 projetos já em produção.</p>
<p>A idéia chave foi associar um caminho a um tipo java, eu mentiria se dissesse que a idéia foi completamente minha pois me baseei numa solução proposta por Luciano Logrado ao trabalharmos juntos em um outro projeto, digamos que eu incrementei a idéia para suportar polimorfismo e com isto será possível:</p>
<ul>
<li> Associar um caminho a uma tipo (classe ou interface) e seus subtipos também estarão associados</li>
<li>Usar uma Expression Language (semelhante a do JSP 2.0) mínima para usar caminhos dinâmicos</li>
<li>Herdar um caminho dum outro POJO</li>
<li>Manter na hierarquia de diretórios a hierarquia nas associações dos POJOS</li>
</ul>
<p>Estes dois últimos são importantes caso por exemplo existam dois POJO&#8217;s com relacionamento de pai/filho e ao excluir o pai os filhos devem ser excluídos:</p>
<p>Cliente -&gt;* Conta</p>
<p>Desta forma o caminho de arquivos do cliente poderia ser:</p>
<p>$/Cliente_99</p>
<p style="padding-left:30px;">/Conta_33</p>
<p style="padding-left:60px;">MeuExtrato1.txt</p>
<p style="padding-left:30px;">/Conta_34</p>
<p style="padding-left:60px;">Extrato2008.txt</p>
<p>Com uma operação de exclusão do diretório do cliente haverá propagação no sistema de arquivo para os subdiretórios, ou seja, as contas. Além de manter a organização dos arquivos numa hierarquia de pastas de fácil entendimento visual e manipulação.</p>
<p>Veja detalhes do uso:</p>
<p><span id="more-13"></span></p>
<h3><strong>Configuração</strong></h3>
<p>Consiste em definir num arquivo xml os caminhos (paths) e as formas de amazenamento de arquivos utilizada (Stores).</p>
<p><strong>Arquivo:</strong> test-file-storage.xml</p>
<pre class="brush: xml;">

&lt;jbfs-conf&gt;
    &lt;stores&gt;
        &lt;local-system-file-store
          name=&quot;MySampleFileStorage&quot;
          rootDir=&quot;C:/temp&quot; /&gt;
    &lt;/stores&gt;
&lt;paths&gt;
&lt;path name=&quot;root&quot; &gt;/MyRootDir&lt;/path&gt;
&lt;path name=&quot;fatherDir&quot; type=&quot;jbfs.test.FatherBean&quot;&gt;
          ${root}/Father/${_bean.name}
       &lt;/path&gt;
&lt;path name=&quot;childSubdir&quot;&gt;
            ${fatherDir}/ChildSubdir
       &lt;/path&gt;
&lt;path name=&quot;childFileName&quot; type=&quot;jbfs.test.ChildBean&quot; &gt;
             ${_bean.father}/ChildDir/${_bean.childName}.txt
       &lt;/path&gt;
    &lt;/paths&gt;
&lt;/jbfs-conf&gt;
</pre>
<h3><strong>Uso</strong></h3>
<p>Basta recuperar a instância do JBFS e utlizar os dois objetos principais:</p>
<ul>
<li><strong>PathResolver</strong> (Resolvedor de Caminhos) -&gt; Resolve qual caminho associado ao objeto ou um nome utilizando os <em>paths</em> configurados.</li>
<li><strong>FileStorage </strong>(O armazenamento de arquivos) -&gt; Representa uma <em>Store </em>configurada e <em>e</em>xecuta as operações sobre o sistema de arquivo escolhido.
<ul>
<li>Podem existir várias implementações de FileStorage conforme o sistema de arquivo utilizado: FTP, sistema de arquivos remoto, etc. Por enquanto só existe a implementação de armazenamento em disco local: &lt;local-system-file-store /&gt;</li>
</ul>
</li>
</ul>
<p>Segue abaixo um teste unitário que exemplifica o uso duma possível classe cliente do nosso componente:</p>
<pre class="brush: java;">

package jbfs.test;

public class TestPathResolver {

    protected JBeanFileStorage jbfs;

   //CONFIGURANDO
    @Before
    public void setUp() {
        jbfs = new JBeanFileStorage(&quot;test-storage.xml&quot;); //File must be on classpath
    }

    //Resolvendo um diretório baseado em um nome
    @Test
    public void testResolveSimplePathFromName() {

        String path = jbfs.getPathResolver().resolveName(&quot;root&quot;, null);

        assertEquals(&quot;/MyRootDir&quot;, path);

    }

    //Resolvendo um diretório baseado em um Bean
    @Test
    public void testResolvePathFromBean() {

        FatherBean bean = new FatherBean(&quot;fatherName&quot;);

        String path= jbfs.getPathResolver().resolveBean(bean);

        assertEquals(&quot;/MyRootDir/Father/fatherName&quot;, path);
    }

    @Test
    public void testResolveComplexPathFromBean() {

        ChildBean bean = new ChildBean(&quot;childFile&quot;, new FatherBean(&quot;fatherName&quot;));

        String filePath = jbfs.getPathResolver().resolveBean(bean);

        assertEquals(&quot;/MyRootDir/Father/fatherName/ChildDir/childFile.txt&quot;, filePath);
    }

//TESTANDO MANIPULAÇÃO DOS ARQUIVOS
@Test
    public void testFileCRUD() {

        ChildBean bean = new ChildBean(&quot;childFile&quot;, new FatherBean(&quot;fatherName&quot;));

        String filePath= jbfs.getPathResolver().resolveBean(bean);

       FileStorage storage = jbfs.getStore(&quot;MySampleFileStorage&quot;);

        try {
            storage.createNewFile(filePath, &quot;hellow&quot;.getBytes());

            assertTrue(storage.exists(filePath));

            assertEquals(&quot;hellow&quot;, new String(storage.getBytes(filePath)));

            storage.delete(filePath);

            assertFalse(storage.exists(filePath));

        } catch (IOException e) {
            e.printStackTrace();
            fail(&quot;Test fail&quot;);
        }
   }
}
</pre>
<h3><strong>Integração com outros Componentes</strong></h3>
<p>Quando trabalhando com um framework ORM como Hibernate, pode ser interessante apagar os arquivos associados de uma entidade automaticamente quando for removida do Banco de Dados. Seguindo o exemplo Cliente -&gt; *  Conta, quando a transação que remove a entidade Cliente for confirmada os arquivos do cliente e suas contas serão excluídos. Para isto interceptador como o implementado abaixo pode ser utilizado em conjunto com o JBFS:</p>
<pre class="brush: java;">
/**
 * File Garbage Collector tries to remove file paths associated with deleted
 * Hibernate Entities.
 *
 * @author Fabrí­cio Silva
 *
 */
public class FileGarbageCollector extends EmptyInterceptor {

	private FileStorage repository;
	private PathResolver pathResolver;
	private JBeanFileStorage jbfs;
	private static SessionFactory hibernateSessionFactory;

	private Map trash = new HashMap();

       public FileGarbageCollector (SessionFactory hibernateSessionFactory){
            this.hibernateSessionFactory = hibernateSessionFactory;
        } 

	@Override
	public void onDelete(Object entity, Serializable id, Object[] state,
			String[] propertyNames, Type[] types) {

		if (jbfs.getConfiguration().hasPolimorficPath(entity)) {
			putPathInGarbageForDeletion(pathResolver.resolveBean(entity));
		}
	}

	@Override
	public void afterTransactionCompletion(Transaction tx) {
		performGarbageDeletion(tx);
	}

	private void performGarbageDeletion(Transaction tx) {
		Garbage g = trash.remove(tx);
		if (g != null &amp;&amp; tx.wasCommitted() &amp;&amp; !tx.wasRolledBack()) {
			for (String path : g.paths) {
				try {
					repository.deleteQuietly(path);
				} catch (Exception e) {
					logger.debug(
							&quot;Error when file garbage collector try to delete path:&quot;
									+ path, e);
				}
			}
		}
	}

       private void putPathInGarbageForDeletion(String path) {
		Transaction tx = hibernateSessionFactory.getCurrentSession()
				.getTransaction();

		Garbage g = trash.get(tx);
		if (g == null) {
			g = new Garbage();
			trash.put(tx, g);
		}
		g.addPath(path);
	}

       class Garbage {
		protected List paths = new LinkedList();

		void addPath(String path) {
			paths.add(path);
		}

		List getPaths() {
			return paths;
		}

		void setPaths(List paths) {
			this.paths = paths;
		}

	}

     //O código que inicializa as variáveis de instância foi omitido...
}
</pre>
<p>Por o JFBS ser um POJO ele pode facilmente se integrar com qualquer framework ou componente de sua aplicação, em especial no framework Spring sua configuração é tão simples como de qualquer outro bean:</p>
<pre class="brush: xml;">
&lt;!-- File Storage --&gt;
&lt;bean id=&quot;jbfs&quot;
	class=&quot;easyaccept.util.file.jbfs.JBeanFileStorage&quot; scope=&quot;singleton&quot; &gt;
&lt;property name=&quot;confLocation&quot;&gt;
		&lt;value&gt;file-storage.xml&lt;/value&gt;
	&lt;/property&gt;
&lt;/bean&gt;
</pre>
<p>Espero que tenham gostado, quando o componente estiver com o mínimo aceitável de documentação será publicado aqui. Futuramente outras implementações de armazenamento estarão disponíveis:</p>
<ul>
<li>FTP</li>
<li>SVN</li>
<li>CVS</li>
<li>Remote System File</li>
</ul>
<p>Abraço.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/fabricioepa.wordpress.com/13/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/fabricioepa.wordpress.com/13/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fabricioepa.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fabricioepa.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fabricioepa.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fabricioepa.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fabricioepa.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fabricioepa.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fabricioepa.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fabricioepa.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fabricioepa.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fabricioepa.wordpress.com/13/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fabricioepa.wordpress.com&blog=3009806&post=13&subd=fabricioepa&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://fabricioepa.wordpress.com/2008/08/20/jbean-file-storage/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fce1b2a6387a8d4a7fede7a78286c4be?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">fabricioepa</media:title>
		</media:content>
	</item>
		<item>
		<title>Fundamentos do Controle de Versão e SVN</title>
		<link>http://fabricioepa.wordpress.com/2008/04/21/fundamentos-do-controle-de-versao-e-svn/</link>
		<comments>http://fabricioepa.wordpress.com/2008/04/21/fundamentos-do-controle-de-versao-e-svn/#comments</comments>
		<pubDate>Mon, 21 Apr 2008 21:50:32 +0000</pubDate>
		<dc:creator>fabricioepa</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Tecnologia]]></category>
		<category><![CDATA[colaborativo]]></category>
		<category><![CDATA[controle de versão]]></category>
		<category><![CDATA[desenvolvimento]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[team]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://fabricioepa.wordpress.com/?p=12</guid>
		<description><![CDATA[Olá pessoal, estou publicando em minha página pessoal uma apresentação rápida que fiz sobre alguns fundamentos para desenvolvimento de projetos em equipes de maneira colaborativa.
Em suporte a este propósito utilizei os recursos do Subversion (SVN), por ser open-source e de livre distribuição, além de integrar novos recursos em relação ao famoso sistema de controle de [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fabricioepa.wordpress.com&blog=3009806&post=12&subd=fabricioepa&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Olá pessoal, estou publicando em minha página pessoal uma apresentação rápida que fiz sobre alguns fundamentos para desenvolvimento de projetos em equipes de maneira colaborativa.</p>
<p>Em suporte a este propósito utilizei os recursos do Subversion (SVN), por ser open-source e de livre distribuição, além de integrar novos recursos em relação ao famoso sistema de controle de versão CVS.</p>
<p>O foco do estudo foi relacionado aos usuários de um repositório, como também o recurso de integração com Java/Eclipse IDE.</p>
<p>Enjoy it =) !</p>
<p><a class="alignleft" title="Fundamentos de Controle de Versão e SVN" href="http://fabricioepa.googlepages.com/fundamentosdocontroledevers%C3%A3oesvn" target="_blank">Fundamentos do Controle de Versão e SVN</a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/fabricioepa.wordpress.com/12/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/fabricioepa.wordpress.com/12/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fabricioepa.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fabricioepa.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fabricioepa.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fabricioepa.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fabricioepa.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fabricioepa.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fabricioepa.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fabricioepa.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fabricioepa.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fabricioepa.wordpress.com/12/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fabricioepa.wordpress.com&blog=3009806&post=12&subd=fabricioepa&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://fabricioepa.wordpress.com/2008/04/21/fundamentos-do-controle-de-versao-e-svn/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fce1b2a6387a8d4a7fede7a78286c4be?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">fabricioepa</media:title>
		</media:content>
	</item>
		<item>
		<title>BugBuster 1.0 &#8211; Hibernate Exception: Illegally attempted to associate a proxy with two open Sessions</title>
		<link>http://fabricioepa.wordpress.com/2008/04/19/bugbuster-10-hibernate-exception-illegally-attempted-to-associate-a-proxy-with-two-open-sessions/</link>
		<comments>http://fabricioepa.wordpress.com/2008/04/19/bugbuster-10-hibernate-exception-illegally-attempted-to-associate-a-proxy-with-two-open-sessions/#comments</comments>
		<pubDate>Wed, 30 Nov -0001 00:00:00 +0000</pubDate>
		<dc:creator>fabricioepa</dc:creator>
				<category><![CDATA[BugBuster]]></category>
		<category><![CDATA[Hibernate]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Add new tag]]></category>
		<category><![CDATA[excetption]]></category>

		<guid isPermaLink="false">http://fabricioepa.wordpress.com/?p=11</guid>
		<description><![CDATA[O referido erro também ocorre com mesagem semelhante:
Illegal attempt to associate a collection with two open sessions
Causa:
O erro é provocado quando um hiberObject associado a uma sessão tenta ser alterado por outra sessão do hibernate.
Solução:
Esqueça os métodos session.get/load/update você pode conseguir o mesmo efeito com session.refresh/merge.
Contexto do Problema:
Isso acontece devido a associação de um objeto [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fabricioepa.wordpress.com&blog=3009806&post=11&subd=fabricioepa&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>O referido erro também ocorre com mesagem semelhante:</p>
<p><span class="l">Illegal attempt to associate a collection with two open</span> sessions</p>
<h2><strong>Causa:</strong></h2>
<p>O erro é provocado quando um hiberObject associado a uma sessão tenta ser alterado por outra sessão do hibernate.</p>
<h2><strong>Solução:</strong></h2>
<p><strong>Esqueça os métodos session.get/load/update você pode conseguir o mesmo efeito com session.refresh/merge.</strong></p>
<h2><strong>Contexto do Problema:</strong></h2>
<p>Isso acontece devido a associação de um objeto gerenciado pelo hibernate (hiberOjbect) com a sessão que o carrega.  Tecnicamente se um objeto foi carregado por uma sessão, até que o objeto seja desconectado (passando para o estado <em>Detached</em>) ele permanece associado a ela. O que pode ser feito invocando os métodos:</p>
<pre class="brush: java;">
//Apenas se os relacionamentos do hiberOject
//que possuem cascade=&quot;evict&quot; eles serão também desconectados
session.evict(hiberObject);
session.clear();
session.close();
 </pre>
<p>Se outra sessão tentar alterá-lo sem ele estar destacado da última sessão, o erro será lançado.</p>
<h2><strong>Problemas Típicos:</strong></h2>
<p>1. 0 Quando se deseja usar um objeto em outra sessão sem fechar a primeira use o evict, lembrando que se os relacionamentos não possuirem cascade=&#8221;evict&#8221; o efeito do método não servirá para eles e provavelmente o mesmo erro ocorrerá para o &#8220;proxy&#8221; dos relcionamentos (que podem ser coleções causando <span class="l">Illegal attempt to associate a collection with two open</span> sessions) .</p>
<p>2.0  Em Aplicações WEB Java tipicamente carregamos um hiberObject e o setamos em alguma variável do contexto web (request, session, sevletContext), após algum uso pela camada de apresentação fazemos outra chamada a camada do hibernate usando esse mesmo hiberObject onde ocorre falha com o dito erro. Neste caso temos dois pontos:</p>
<ul>
<li>Se a sessão que o carregou anterior ainda estava aberta você recai no erro 1.0</li>
</ul>
<ul>
<li>Caso a velha sessão já tenha morrido, o seu hiberObject não está mais conectado a mesma, porém os seus relacionamentos ainda podem ter algum &#8220;proxy&#8221; para a velha sessão. Nesse caso é mais simples usar um dos metódos:</li>
</ul>
<pre class="brush: java;">

//Caso queira reconectar e recarregar
//no seu objeto os dados do banco
session.refresh(detachedHiberObject);

//Caso queira reconectar o objeto fazer um update no banco
//de dados com as novas informações setadas no objeto
connectedHiberObject = session.merge(detachedHiberObject);
</pre>
<p>O merge/refresh tem funções diferentes, mas ambos reconectam o objeto a uma sessão, seja a mesma ou não, sem provocar erro.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/fabricioepa.wordpress.com/11/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/fabricioepa.wordpress.com/11/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fabricioepa.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fabricioepa.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fabricioepa.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fabricioepa.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fabricioepa.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fabricioepa.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fabricioepa.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fabricioepa.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fabricioepa.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fabricioepa.wordpress.com/11/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fabricioepa.wordpress.com&blog=3009806&post=11&subd=fabricioepa&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://fabricioepa.wordpress.com/2008/04/19/bugbuster-10-hibernate-exception-illegally-attempted-to-associate-a-proxy-with-two-open-sessions/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fce1b2a6387a8d4a7fede7a78286c4be?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">fabricioepa</media:title>
		</media:content>
	</item>
		<item>
		<title>JavaTips 3.0 &#8211; Performance Generics + AutoBox/UnBox</title>
		<link>http://fabricioepa.wordpress.com/2008/03/19/javatips-30-performance-generics-autoboxunbox/</link>
		<comments>http://fabricioepa.wordpress.com/2008/03/19/javatips-30-performance-generics-autoboxunbox/#comments</comments>
		<pubDate>Wed, 19 Mar 2008 16:18:06 +0000</pubDate>
		<dc:creator>fabricioepa</dc:creator>
				<category><![CDATA[Java Tips]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Autobox]]></category>
		<category><![CDATA[autoboxing]]></category>
		<category><![CDATA[Generic]]></category>
		<category><![CDATA[Generics]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Unbox]]></category>

		<guid isPermaLink="false">http://fabricioepa.wordpress.com/?p=10</guid>
		<description><![CDATA[AutoBox/UnBox é a conversão de forma automática entre objetos e tipos primitivos, dicas:

 Use somente quando houver “descasamento” entre tipos primitivos e objetos empacotadores
 Não abuse: um Integer não substitui um int (a performance é pior)
 Cuidado, unboxing com objetos null lança exceção

Probolema:

 Generics não trabalha com tipos primitivos

Após executar o seguinte teste de performance, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fabricioepa.wordpress.com&blog=3009806&post=10&subd=fabricioepa&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>AutoBox/UnBox é a conversão de forma automática entre objetos e tipos primitivos, dicas:</p>
<ul>
<li> Use somente quando houver “descasamento” entre tipos primitivos e objetos empacotadores</li>
<li> Não abuse: um Integer não substitui um int (a performance é pior)</li>
<li> Cuidado, unboxing com objetos null lança exceção</li>
</ul>
<p><strong>Probolema:</strong></p>
<ul>
<li> Generics não trabalha com tipos primitivos</li>
</ul>
<p>Após executar o seguinte teste de performance, constatou-se uma diferênça em média de 25% com uso do autobox. O algoritimo de teste baseou-se em comparar as duas execuções:</p>
<ol>
<li>faça 1000 vezes
<ul>
<li>varra um ArrayList&lt;Integer&gt;,  capturando  o valor sem fazer autobox</li>
</ul>
</li>
<li>faça 1000 vezes
<ul>
<li>varra um ArrayList&lt;Integer&gt; usando <em>enhanced-loop </em>fazendo automaticamente unbox para int, capturando o valor e fazendo autbox novamente para um objeto Integer.</li>
</ul>
</li>
</ol>
<p><strong>Resultado da execução:</strong></p>
<p>___________________________________</p>
<p>autoBoxUnBox()&#8230;java.lang.NullPointerException<br />
Sem autoboxing = 6531ms<br />
Com autobox/unbox= 8734ms<br />
Diferença de 26%</p>
<p>___________________________________</p>
<p><strong>Conclusão:</strong></p>
<p><strong> </strong>Se sua aplicação é &#8220;Performance Driven&#8221;, estruturas como  o  IntHashMap visto no blog anterior entre outras coleções da API que não trabalhem com Generics podem ser a melhor saída para escovar milisegundos de processamento.</p>
<p>Abaixo segue a classe usada no teste:</p>
<p><span id="more-10"></span></p>
<pre class="brush: java;">

package update5.boxing;

import java.util.*;

/**
 *
 * @author Fabrício Silva Epaminondas
 */
public class AutoboxingUnboxing {

    static void autoBoxUnBox() {
        // Antes
        int prim = 10;// primitivo
        Integer obj = new Integer(20);// objeto
        Integer nullObj = null;

        // Java 5
        Integer c = 30;// autobox Integer c = new Integer(30)
        prim = obj;// unbox prim = obj.intValue();
        obj = prim;// autobox obj = new Integer(prim);

        try{
            prim = nullObj;// throw NullPointerException
        }catch (NullPointerException e) {
            System.out.println(&quot;autoBoxUnBox()...&quot; + e);
        }
    }

    @SuppressWarnings(&quot;unchecked&quot;)
    static void autoboxComGenerics() {

        // Antes
        Map products = new HashMap();
        products.put(new Integer(2779), new Float(20.45f));
        products.put(Integer.valueOf(922), Float.valueOf(99.99f));
        float price = new Float((Float) products.get(new Integer(922)
                .intValue())).floatValue();

        // AutoBoxing com Generics
        Map&lt;Integer, Float&gt; products2 = new HashMap&lt;Integer, Float&gt;();
        products2.put(10, 20.45f);
        products2.put(20, 99.99f);
        float price2 = products2.get(10);

        // Problema: Performance
        // Generics só aceita Tipos de Objetos e não primitivos

        // Ex: ArrayList de Integers..
        Collection&lt;Integer&gt; values = new ArrayList&lt;Integer&gt;();
        for (int i = 0; i &lt; 100000; i++) {
            values.add(i);
        }

        Integer intObj = null;

        // Teste de Performance 1 (Sem Autobox)
        long time = System.currentTimeMillis();

        // repete 1000 vezes
        for (int i = 0; i &lt; 1000; i++) {
            // for em coleção de objetos Integer
            for (Integer val : values) {
                intObj = val;// sem autobox
            }
        }
        long performance1 = System.currentTimeMillis() - time;
        System.out.println(&quot;Sem autoboxing = &quot; + performance1 + &quot;ms&quot;);

        // Teste de Performance 2 (Com Autobox/Unbox)
        time = System.currentTimeMillis();

        // repete 1000 vezes
        for (int i = 0; i &lt; 1000; i++) {
            // for em coleção de objetos Integer
            for (int val : values) {// executando unboxing para int
                intObj = val;// autobox para Integer
            }
        }
        long performance2 = System.currentTimeMillis() - time;
        System.out.println(&quot;Com autobox/unbox= &quot; + performance2 + &quot;ms&quot;);

        System.out.println(&quot;Diferença de &quot; + percentGain(performance1,performance2) + &quot;%&quot;);
    }

    static long percentGain(long num, long div) {
        return (100 - num*100/div);
    }

    public static void main(String[] args) {

        autoBoxUnBox();

        autoboxComGenerics();
    }
}</pre>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/fabricioepa.wordpress.com/10/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/fabricioepa.wordpress.com/10/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fabricioepa.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fabricioepa.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fabricioepa.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fabricioepa.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fabricioepa.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fabricioepa.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fabricioepa.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fabricioepa.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fabricioepa.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fabricioepa.wordpress.com/10/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fabricioepa.wordpress.com&blog=3009806&post=10&subd=fabricioepa&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://fabricioepa.wordpress.com/2008/03/19/javatips-30-performance-generics-autoboxunbox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fce1b2a6387a8d4a7fede7a78286c4be?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">fabricioepa</media:title>
		</media:content>
	</item>
		<item>
		<title>Java Tips 2.0: Ganhe até 70% performance com IntHashMap</title>
		<link>http://fabricioepa.wordpress.com/2008/03/17/java-tips-20-ganhe-ate-70-performance-com-inthashmap/</link>
		<comments>http://fabricioepa.wordpress.com/2008/03/17/java-tips-20-ganhe-ate-70-performance-com-inthashmap/#comments</comments>
		<pubDate>Wed, 30 Nov -0001 00:00:00 +0000</pubDate>
		<dc:creator>fabricioepa</dc:creator>
				<category><![CDATA[Java Tips]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[HashMap]]></category>
		<category><![CDATA[IntHashMap]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://fabricioepa.wordpress.com/?p=6</guid>
		<description><![CDATA[O java.util.HashMap  como o próprio nome diz utiliza-se do hash code do objeto &#8220;chave&#8221; para mapear as entradas do mapa. Funciona basicamente assim:

HashMap map = new HashMap();
map.put(&#34;matricula.12345&#34;, &#34;Fabricio&#34;);
A essência do funcionamento do método put() é :
public void put(Object key, Object value){
 int hash = geraHashCode(key);
 int  posicao = geraPosicaoNaTabela(hash);
 adicionaNaTabelaDeEntradas(posicao, value);
}
Quando porém estamos [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fabricioepa.wordpress.com&blog=3009806&post=6&subd=fabricioepa&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>O<span> java.util.HashMap </span> como o próprio nome diz utiliza-se do hash code do objeto &#8220;chave&#8221; para mapear as entradas do mapa. Funciona basicamente assim:</p>
<pre class="brush: java;">
HashMap map = new HashMap();
map.put(&quot;matricula.12345&quot;, &quot;Fabricio&quot;);</pre>
<p>A essência do funcionamento do método <span>put() </span>é :</p>
<pre class="brush: java;">public void put(Object key, Object value){
 int hash = geraHashCode(key);
 int  posicao = geraPosicaoNaTabela(hash);
 adicionaNaTabelaDeEntradas(posicao, value);
}</pre>
<p>Quando porém estamos trabalhando com um mapa onde as chaves já são inteiros muitas operações do mapa podem ser simplificadas, solução: IntHashMap.<br />
Algumas coporações como a Oracle, Apache, etc&#8230; possuem em suas &#8220;foundation classes&#8221; alguma implementações que trababalhem desta forma para obterem melhor performance. Afim de comparar o desempenho com HashMap executei dois teste simples</p>
<ol>
<li>Povoando o mapa com 1000000 chaves sequenciais (<span style="font-style:italic;">Puts</span>)</li>
<li>Recuperando todos os objetos do mapa (<span style="font-style:italic;">Gets</span>), utilizou-se string como objeto para evitar autobox/unbox.</li>
</ol>
<p>O resultado foram ganhos em média de 70% para os <span style="font-style:italic;">puts</span>, e 30% para os <span style="font-style:italic;">gets </span>efetuados no mapa. Veja o resultado de uma excução:<br />
<span style="font-size:x-small;"><br />
<span style="font-family:arial;">Main.testSunMap()&#8230;</span><br />
<span style="font-family:arial;">Main.testIntMap()&#8230;</span></span></p>
<p><span style="font-family:arial;"><span style="font-size:x-small;">&#8216;Puts&#8217; execution time (milliseconds): </span></span><span style="font-size:x-small;"><br />
<span style="font-family:arial;">sunMap: 3328 intMap: 922, Percentage of gain: 73%</span></span></p>
<p><span style="font-family:arial;"><span style="font-size:x-small;">&#8216;Gets&#8217; execution time (milliseconds): </span></span><span style="font-size:x-small;"><br />
<span style="font-family:arial;">sunMap: 234 intMap: 140, Percentage of gain: 41%</span></span></p>
<p><strong><span style="font-weight:bold;">Conclusão</span></strong><br />
Se suas chaves são inteiros use <span style="font-style:italic;">IntHashMap</span>. Os resultados foram obtidos usando java 5, o mesmo exemplo foi executado com 1.4 e obteve em média os mesmos valores, no entanto se em sua aplicação você não tomar os devidos cuidados no uso do autoboxing/unboxing de valores primitivos para objetos, a diferença de ganho vai ser ainda em muito melhor para o IntHashMap devido a perda de performance executando o boxing.</p>
<p><span id="more-6"></span></p>
<p>Código do Teste:</p>
<pre class="brush: java;">

import java.util.HashMap;

public class Main {

    public static final int NUMBER_LOOPS = 1000000;
    static long sunMapPuts = 0;
    static long sunMapGets = 0;

    static long intMapPuts = 0;
    static long intMapGets = 0;

    /**
     * @param args
     */
    public static void main(String[] args) {
        testSunMap();
        testIntMap();

        System.out.println(&quot;\n'Puts' execution time (milliseconds): &quot;);
        System.out.println(&quot;sunMap: &quot;+ sunMapPuts +&quot; intMap: &quot; + intMapPuts
                + &quot;, Percentage of gain: &quot; + percentGain(intMapPuts, sunMapPuts) + &quot;%&quot;) ;

        System.out.println(&quot;\n'Gets' execution time (milliseconds): &quot;);
        System.out.println(&quot;sunMap: &quot;+ sunMapGets +&quot; intMap: &quot; + intMapGets
                + &quot;, Percentage of gain: &quot; + percentGain(intMapGets, sunMapGets) + &quot;%&quot;) ;

    }

    private static void testSunMap() {
        System.out.println(&quot;Main.testSunMap()...&quot;);
        HashMap&lt;Integer, Object&gt; sunMap = new HashMap&lt;Integer, Object&gt;();

        Object value = &quot;111&quot;;

        //test puts
        long time = System.currentTimeMillis();
        for(int i = 0; i&lt; NUMBER_LOOPS; i++){
            sunMap.put(i, value);
        }
        sunMapPuts =  System.currentTimeMillis() - time;

        //test gets
        time = System.currentTimeMillis();
        for(Integer i :sunMap.keySet()){
            sunMap.get(i);
        }
        sunMapGets =  System.currentTimeMillis() - time;
    }

    private static void testIntMap() {
        System.out.println(&quot;Main.testIntMap()...&quot;);
        IntHashMap intMap = new IntHashMap();

        Object value = &quot;222&quot;;

        //test puts
        long time = System.currentTimeMillis();
        for(int i = 0; i&lt; NUMBER_LOOPS; i++){
            intMap.put(i, value);
        }
        intMapPuts = System.currentTimeMillis() - time;

        //test gets
        time = System.currentTimeMillis();
        int[] keySet = intMap.keySet();
        for(int i =0; i&lt; keySet.length; i++){
            intMap.get(keySet[i]);
        }
        intMapGets =  System.currentTimeMillis() - time;

    }

    static long percentGain(long num, long div) {
        return (100 - num*100/div);
    }

}</pre>
<p>Uma implementação de IntHashMap:</p>
<pre class="brush: java;">
/**
 * A hash map mapping int values to objects. This offers the benefit of not having to use objects as keys, which can result in performance benefits.
 */
public class IntHashMap {
    /** The default capacity for hash map instances. */
    public static final int DEFAULT_CAPACITY = 17;

    /** The maximum allowed capacity for hash map instances. */
    public static final int MAXIMUM_CAPACITY = 1 &lt;&lt; 30;

    /** The default load factor for hash map instances. */
    public static final float DEFAULT_LOADFACTOR = 0.75f;
    private MapElement[]      map = null; // The first bucket for each key
    private int[]             count = null; // The count of buckets in each chain
    private int               contents = 0;
    private int               objectCounter = 0; // Counter for objects created
    private int               capacity = DEFAULT_CAPACITY;
    private int               initialCap = DEFAULT_CAPACITY;
    private float             loadFactor = DEFAULT_LOADFACTOR;
    private int               maxLoad = 0;
    private boolean           rehashing = true;

    /**
     * Constructs an empty instance with the default initial capacity and the default load factor
     */
    public IntHashMap() {
        this(DEFAULT_CAPACITY, DEFAULT_LOADFACTOR);
    }

    /**
     * Constructs an empty instance with the given initial capacity and the default load factor
     *
     * &lt;p&gt;&lt;/p&gt;
     *
     * @param initialCapacity The initial capacity for this hash map.
     */
    public IntHashMap(int initialCapacity) {
        this(initialCapacity, DEFAULT_LOADFACTOR);
    }

    /**
     * Constructs an empty instance with the given initial capacity and the given load factor
     *
     * &lt;p&gt;&lt;/p&gt;
     *
     * @param initialCapacity The initial capacity for this hash map.
     * @param loadFactor The load factor for this hash map.
     */
    public IntHashMap(int   initialCapacity,
                      float loadFactor) {
        construct(initialCapacity, loadFactor);
    }

    /**
     * Constructs a new HashMap with the same mappings as the specified Map. The HashMap  is created with default load factor and an initial capacity
     * sufficient to hold the  mappings in the specified Map.
     *
     * &lt;p&gt;&lt;/p&gt;
     *
     * @param m The map whose mappings are to be placed in this map. Throws: &lt;p&gt;
     *
     * @throws IllegalArgumentException if the specified map is&lt;code&gt;null&lt;/code&gt;.
     */
    public IntHashMap(IntHashMap m) {
        if (m == null) {
            throw new IllegalArgumentException(&quot;m may not be null&quot;);
        }

        //.... Determine parameters
        loadFactor     = DEFAULT_LOADFACTOR; // As per standard API for java.util.HashMap
        capacity       = (int) (m.size() / loadFactor);

        if (capacity &lt; DEFAULT_CAPACITY) { // Avoid underflow
            capacity = DEFAULT_CAPACITY;
        } else if ((capacity % 2) == 0) { // Make sure we have an odd value
            capacity++;
        }

        //.... Standard initialization for the internal map elements
        maxLoad        = (int) ((loadFactor * capacity) + 0.5f); // Max. number of elements before a rehash occurs
        initialCap     = capacity;

        objectCounter += 2;
        map       = new MapElement[capacity];
        count     = new int[capacity];

        //.... Copy the elements to the new map
        int[] keys = m.keySet();

        for (int i = 0; i &lt; m.size(); i++) {
            put(keys[i], m.get(keys[i]));
        }
    }

    /**
     * Return the current number of mappings in the hash map.
     *
     * &lt;p&gt;&lt;/p&gt;
     *
     * @return The current number of mappings in the hash map.
     */
    public int size() {
        return contents;
    }

    /**
     * Returns &lt;code&gt;true&lt;/code&gt; if this map contains no key-value mappings.
     *
     * @return DOCUMENT ME!
     */
    public boolean isEmpty() {
        return (contents == 0) ? true : false;
    }

    /**
     * Removes all mappings from this map.
     */
    public void clear() {
        construct(initialCap, loadFactor);
    }

    /**
     * Return the number of objects created in / by this instance
     *
     * &lt;p&gt;&lt;/p&gt;
     *
     * @return The number of objects created
     */
    public int getObjectCounter() {
        return objectCounter;
    }

    /**
     * Return the current capacity of the instance. If rehashing is enabled (which it is per default), the capacity may have been increased as
     * necessary from the initial value.
     *
     * &lt;p&gt;&lt;/p&gt;
     *
     * @return The current capacity for this hash map.
     */
    public int getCapacity() {
        return capacity;
    }

    /**
     * Return the load factor of the instance.
     *
     * &lt;p&gt;&lt;/p&gt;
     *
     * @return The load factor for this hash map.
     */
    public float getLoadFactor() {
        return loadFactor;
    }

    /**
     * Return the keys in the hash map
     *
     * &lt;p&gt;&lt;/p&gt;
     *
     * @return An array containing the keys for which mappings are stored in this hash map.
     */
    public int[] keySet() {
        objectCounter++;

        int[]      keys = new int[contents];
        int        cnt = 0;
        MapElement me = null;

        for (int i = 0; i &lt; capacity; i++) {
            if (map[i] != null) {
                me = map[i];

                for (int j = 0; j &lt; count[i]; j++) {
                    keys[cnt++]     = me.getKey();
                    me              = me.getNext();
                }
            }
        }

        return keys;
    }

    /**
     * Enable/disable rehashing (defaults to &lt;code&gt;true&lt;/code&gt;).
     *
     * &lt;p&gt;&lt;/p&gt;
     *
     * @param rehashing A boolean indicating the desired rehashing status.
     */
    public void setRehash(boolean rehashing) {
        this.rehashing = rehashing;
    }

    /**
     * Associates the specified value with the specified key in this map. If  the map previously contained a mapping for this key, the old value is
     * replaced.
     *
     * &lt;p&gt;&lt;/p&gt;
     *
     * @param key The key with which the specified value is to be associated.
     * @param value The value to be associated with the specified key.  &lt;p&gt;
     *
     * @return Previous value associated with specified key, or &lt;code&gt;null&lt;/code&gt; if there was no mapping  for key. A &lt;code&gt;null&lt;/code&gt; return can
     *         also indicate that the HashMap previously associated &lt;code&gt;null&lt;/code&gt;  with the specified key.
     */
    public Object put(int    key,
                      Object value) {
        int index = key % capacity;

        if (index &lt; 0) {
            index = -index;
        }

        //.... This is a new key since no bucket exists
        if (map[index] == null) {
            objectCounter++;
            map[index] = new MapElement(key, value);
            count[index]++;
            contents++;

            if (contents &gt; maxLoad) {
                rehash();
            }

            return null;

            //.... A bucket already exists for this index: check whether we already have a mapping for this key
        } else {
            MapElement me = map[index];

            while (true) {
                if (me.getKey() == key) { // We have a mapping: just replace the value for this element

                    Object previous = me.getValue(); // Return the current value - same as for java.util.HashMap.put()
                    me.setValue(value);

                    return previous;
                } else {
                    if (me.getNext() == null) { // No next element: so we have no mapping for this key
                        objectCounter++;
                        me.setNext(new MapElement(key, value));
                        count[index]++;
                        contents++;

                        if (contents &gt; maxLoad) {
                            rehash();
                        }

                        return null;
                    } else {
                        me = me.getNext();
                    }
                }
            }
        }
    }

    /**
     * Returns the value to which the specified key is mapped in this identity  hash map, or &lt;code&gt;null&lt;/code&gt; if the map contains no mapping for
     * this key. A return  value of &lt;code&gt;null&lt;/code&gt; does not necessarily indicate that the map contains no  mapping for the key; it is also
     * possible that the map explicitly maps  the key to &lt;code&gt;null&lt;/code&gt;. The &lt;code&gt;containsKey&lt;/code&gt;  method may be used to distinguish these
     * two cases.
     *
     * &lt;p&gt;&lt;/p&gt;
     *
     * @param key The key whose associated value is to be returned.  &lt;p&gt;
     *
     * @return The value to which this map maps the specified key, or  &lt;code&gt;null&lt;/code&gt; if the map contains no mapping for this key.
     */
    public Object get(int key) {
        MapElement me = exists(key);

        if (me == null) {
            return null;
        } else {
            return me.getValue();
        }
    }

    /**
     * Returns &lt;code&gt;true&lt;/code&gt; if this map contains a mapping for the specified key.
     *
     * &lt;p&gt;&lt;/p&gt;
     *
     * @param key The key whose presence in this map is to be tested. &lt;p&gt;
     *
     * @return &lt;code&gt;true&lt;/code&gt; if this map contains a mapping for the specified key.
     */
    public boolean containsKey(int key) {
        if (exists(key) == null) {
            return false;
        } else {
            return true;
        }
    }

    /**
     * Removes the mapping for this key from this map if present.
     *
     * &lt;p&gt;&lt;/p&gt;
     *
     * @param key The key whose mapping is to be removed from the map. &lt;p&gt;
     *
     * @return Previous value associated with specified key, or  &lt;code&gt;null&lt;/code&gt;  if there was no mapping for key. A &lt;code&gt;null&lt;/code&gt; return can
     *         also indicate that the map previously associated &lt;code&gt;null&lt;/code&gt;  with the specified key.
     */
    public Object remove(int key) {
        int index = key % capacity;

        if (index &lt; 0) {
            index = -index;
        }

        if (map[index] == null) {
            return null;
        } else {
            MapElement me = map[index];
            MapElement prev = null;

            while (true) {
                if (me.getKey() == key) { // Keys match

                    if (prev == null) { // The first element in the chain matches
                        map[index] = me.getNext();
                    } else { // An element further down in the chain matches - delete it from the chain
                        prev.setNext(me.getNext());
                    }

                    count[index]--;
                    contents--;

                    return me.getValue();
                } else { // Keys don't match, try the next element
                    prev     = me;
                    me       = me.getNext();

                    if (me == null) {
                        return null;
                    }
                }
            }
        }
    }

    /**
     * Helper method: returns the element matching the key, or &lt;code&gt;null&lt;/code&gt; if no such element exists
     *
     * @param key DOCUMENT ME!
     *
     * @return DOCUMENT ME!
     */
    private MapElement exists(int key) {
        int index = key % capacity;

        if (index &lt; 0) {
            index = -index;
        }

        if (map[index] == null) {
            return null;
        } else {
            MapElement me = map[index];

            while (true) {
                if (me.getKey() == key) {
                    return me;
                } else {
                    me = me.getNext();

                    if (me == null) {
                        return null;
                    }
                }
            }
        }
    }

    /**
     * Increase the capacity of the map to improve performance
     */
    private void rehash() {
        if (rehashing) {
            int newCapacity = (2 * capacity) + 1;

            if (newCapacity &gt; MAXIMUM_CAPACITY) {
                return;
            }

            objectCounter += 2;

            MapElement[] newMap = new MapElement[newCapacity];
            int[]        newCount = new int[newCapacity];

            MapElement   me = null;
            MapElement   t = null;
            MapElement   next = null;
            int          newIndex = 0;

            for (int index = 0; index &lt; capacity; index++) {
                me = map[index];

                while (me != null) {
                    next         = me.getNext();
                    newIndex     = me.getKey() % newCapacity;

                    if (newIndex &lt; 0) {
                        newIndex = -newIndex;
                    }

                    newCount[newIndex]++;

                    if (newMap[newIndex] == null) { // No element yet for this new index
                        newMap[newIndex] = me;
                        me.setNext(null);
                    } else { // Hook the element into the beginning of the chain
                        t                    = newMap[newIndex];
                        newMap[newIndex]     = me;
                        me.setNext(t);
                    }

                    me = next;
                }
            }

            map          = newMap;
            count        = newCount;
            capacity     = newCapacity;
            maxLoad      = (int) ((loadFactor * capacity) + 0.5f); // Max. number of elements before a rehash occurs

            newMap = null;
        }
    }

    /**
     * Construction helper method
     *
     * @param initialCapacity DOCUMENT ME!
     * @param loadFactor DOCUMENT ME!
     *
     * @throws IllegalArgumentException DOCUMENT ME!
     */
    private void construct(int   initialCapacity,
                           float loadFactor) {
        if (initialCapacity &lt; 0) {
            throw new IllegalArgumentException(&quot;Invalid initial capacity: &quot; + initialCapacity);
        }

        if (initialCapacity &lt; DEFAULT_CAPACITY) {
            initialCapacity = DEFAULT_CAPACITY;
        }

        if (initialCapacity &gt; MAXIMUM_CAPACITY) {
            initialCapacity = MAXIMUM_CAPACITY;
        }

        if ((loadFactor &lt;= 0.0f) || Float.isNaN(loadFactor)) {
            throw new IllegalArgumentException(&quot;Invalid load factor: &quot; + loadFactor);
        }

        this.initialCap     = initialCapacity;
        this.capacity       = initialCapacity;
        this.loadFactor     = loadFactor;

        objectCounter += 2;
        maxLoad      = (int) ((loadFactor * capacity) + 0.5f); // Max. number of elements before a rehash occurs
        map          = new MapElement[capacity];
        count        = new int[capacity];
        contents     = 0;
    }

    /**
     * Statistical output for this map.
     *
     * &lt;p&gt;&lt;/p&gt;
     *
     * @param full A boolean indicating whether just a short of the full information should be printed.
     */
    public void printStatistics(boolean full) {
        if (full) {
            for (int i = 0; i &lt; capacity; i++) {
                System.out.println(&quot;Count[&quot; + i + &quot;] = &quot; + count[i]);
            }
        }

        System.out.println(&quot;Initial capacity   = &quot; + initialCap);
        System.out.println(&quot;Capacity           = &quot; + capacity);
        System.out.println(&quot;Number of elements = &quot; + contents);
    }

    /**
         *
         */
    class MapElement {
        private int        key = 0;
        private Object     value = null;
        private MapElement next = null;

        /**
         * Constructor
         *
         * @param key DOCUMENT ME!
         * @param value DOCUMENT ME!
         */
        public MapElement(int    key,
                          Object value) {
            this.key       = key;
            this.value     = value;
        }

        /**
         * Getter method for &lt;code&gt;key&lt;/code&gt; property
         *
         * &lt;p&gt;&lt;/p&gt;
         *
         * @return The value for the &lt;code&gt;key&lt;/code&gt; property
         */
        public int getKey() {
            return key;
        }

        /**
         * Setter method for &lt;code&gt;value&lt;/code&gt; property
         *
         * &lt;p&gt;&lt;/p&gt;
         *
         * @param value The value for the &lt;code&gt;value&lt;/code&gt; property
         */
        public void setValue(Object value) {
            this.value = value;
        }

        /**
         * Getter method for &lt;code&gt;value&lt;/code&gt; property
         *
         * &lt;p&gt;&lt;/p&gt;
         *
         * @return The value for the &lt;code&gt;value&lt;/code&gt; property
         */
        public Object getValue() {
            return value;
        }

        /**
         * Setter method for &lt;code&gt;next&lt;/code&gt; property
         *
         * &lt;p&gt;&lt;/p&gt;
         *
         * @param next The value for the &lt;code&gt;next&lt;/code&gt; property
         */
        public void setNext(MapElement next) {
            this.next = next;
        }

        /**
         * Getter method for &lt;code&gt;next&lt;/code&gt; property
         *
         * &lt;p&gt;&lt;/p&gt;
         *
         * @return The value for the &lt;code&gt;next&lt;/code&gt; property
         */
        public MapElement getNext() {
            return next;
        }
    }
}</pre>
<p><strong><span style="font-weight:bold;"><br />
</span></strong></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/fabricioepa.wordpress.com/6/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/fabricioepa.wordpress.com/6/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fabricioepa.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fabricioepa.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fabricioepa.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fabricioepa.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fabricioepa.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fabricioepa.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fabricioepa.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fabricioepa.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fabricioepa.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fabricioepa.wordpress.com/6/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fabricioepa.wordpress.com&blog=3009806&post=6&subd=fabricioepa&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://fabricioepa.wordpress.com/2008/03/17/java-tips-20-ganhe-ate-70-performance-com-inthashmap/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fce1b2a6387a8d4a7fede7a78286c4be?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">fabricioepa</media:title>
		</media:content>
	</item>
		<item>
		<title>Java Tips 1.0: (2 em 1) Carregue jars dinamicamente &#8211; Acesse métodos protegidos</title>
		<link>http://fabricioepa.wordpress.com/2008/03/17/java-tips-10-2-em-1-carregue-jars-dinamicamente-acesse-metodos-protegidos/</link>
		<comments>http://fabricioepa.wordpress.com/2008/03/17/java-tips-10-2-em-1-carregue-jars-dinamicamente-acesse-metodos-protegidos/#comments</comments>
		<pubDate>Mon, 17 Mar 2008 03:03:00 +0000</pubDate>
		<dc:creator>fabricioepa</dc:creator>
				<category><![CDATA[Java Tips]]></category>
		<category><![CDATA[ClassLoader]]></category>
		<category><![CDATA[classpath]]></category>
		<category><![CDATA[Dinamic]]></category>
		<category><![CDATA[Jars]]></category>

		<guid isPermaLink="false">http://fabricioepa.wordpress.com/2008/03/17/java-tips-10-2-em-1-carregue-jars-dinamicamente-acesse-metodos-protegidos/</guid>
		<description><![CDATA[ Você já se perguntou como algumas IDE&#8217;s configuram o classpath da sua aplicação dinamicamente em tempo de execução?
Aqui vai uma solução técnica alternativa (that means GDD &#8211; Gambiarra Driven Development  ).
A classe java.net.URLClassLoader é o classloader default do sistema para carregar o jars do classpath quando o aplicativo java é iniciado.
Uma maneira de [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fabricioepa.wordpress.com&blog=3009806&post=5&subd=fabricioepa&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong> Você já se perguntou como algumas IDE&#8217;s configuram o classpath da sua aplicação dinamicamente em tempo de execução?</strong></p>
<p>Aqui vai uma solução técnica alternativa (that means GDD &#8211; Gambiarra Driven Development <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> ).</p>
<p>A classe java.net.URLClassLoader é o classloader default do sistema para carregar o jars do classpath quando o aplicativo java é iniciado.<br />
Uma maneira de adicionar jars extras seria invocando no classloder o método addURL(URL url), o que faz o jar localizado por está URL ser carregado na JVM em execuçao. O problema é que este método é protegido (protected) e portanto, a menos que você extenda o URLClassLoader, sobreescreva o método mudando a visibilidade para público e configure seu classloder como default do sistema você não poderá invocá-lo na instância do classloader.<br />
<strong> Mas como nem tudo é impossível na computação, você pode contornar o problema usando reflexão e acessando o método protegido.</strong> Para isso basta recuperar o método &#8220;addURL&#8221; declarado e invocar setAccessible(true).</p>
<p>A classe abaixo mostra como você mata os dois coelhos com uma única cajadada:</p>
<pre class="brush: java;">

public class ClassPathHacker {

private static final Class[] parameters = new Class[]{URL.class};

public static void addFile(String s) throws IOException {
 File f = new File(s);
 addFile(f);
}//end method

public static void addFile(File f) throws IOException {
 addURL(f.toURL());
}//end method

public static void addURL(URL u) throws IOException {

	URLClassLoader sysloader = (URLClassLoader)ClassLoader.getSystemClassLoader();
 Class sysclass = URLClassLoader.class;

	try {
 	Method method = sysclass.getDeclaredMethod(&quot;addURL&quot;,parameters);
 	method.setAccessible(true);
 	method.invoke(sysloader,new Object[]{ u });
 } catch (Throwable t) {
 	t.printStackTrace();
 	throw new IOException(&quot;Error, could not add URL to system classloader&quot;);
 }//end try catch

}//end method

}//end class
</pre>
<p><span style="color:#000000;"> Baseado no Fórum:<br />
</span><br />
<a href="http://forum.java.sun.com/thread.jsp?forum=32&amp;thread=300557&amp;tstart=0&amp;trange=15">http://forum.java.sun.com/thread.jsp?forum=32&amp;thread=300557&amp;tstart=0&amp;trange=15</a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/fabricioepa.wordpress.com/5/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/fabricioepa.wordpress.com/5/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fabricioepa.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fabricioepa.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fabricioepa.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fabricioepa.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fabricioepa.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fabricioepa.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fabricioepa.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fabricioepa.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fabricioepa.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fabricioepa.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fabricioepa.wordpress.com&blog=3009806&post=5&subd=fabricioepa&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://fabricioepa.wordpress.com/2008/03/17/java-tips-10-2-em-1-carregue-jars-dinamicamente-acesse-metodos-protegidos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fce1b2a6387a8d4a7fede7a78286c4be?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">fabricioepa</media:title>
		</media:content>
	</item>
		<item>
		<title>Interceptando a execução do SQL da sua aplicação</title>
		<link>http://fabricioepa.wordpress.com/2008/02/26/interceptando-a-execucao-do-sql-da-sua-aplicacao/</link>
		<comments>http://fabricioepa.wordpress.com/2008/02/26/interceptando-a-execucao-do-sql-da-sua-aplicacao/#comments</comments>
		<pubDate>Tue, 26 Feb 2008 16:44:00 +0000</pubDate>
		<dc:creator>fabricioepa</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Debug]]></category>
		<category><![CDATA[debug sql]]></category>
		<category><![CDATA[Profile]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://fabricioepa.wordpress.com/2008/02/26/interceptando-a-execucao-do-sql-da-sua-aplicacao/</guid>
		<description><![CDATA[Proxy4jdbc3  &#8211; The Proxy for JDBC 3
É um componente de software desenvolvido para interceptar o SQL executado por um aplicativo Java através das chamadas sobre a JDBC. Uma solução rápida e simples para quem deseja depurar, fazer logging  ou perfilar a execução do SQL sem ter que modificar a arquitetura da aplicação.
Para usá-lo [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fabricioepa.wordpress.com&blog=3009806&post=4&subd=fabricioepa&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p class="MsoNormal"><a href="http://proxy4jdbc3.sourceforge.net/"><span style="font-weight:bold;font-size:130%;color:#000000;"><span style="line-height:115%;"><span>Proxy4jdbc3  &#8211; The Proxy for JDBC 3</span></span></span></a></p>
<p class="MsoNormal">É um componente de software desenvolvido para interceptar o SQL executado por um aplicativo Java através das chamadas sobre a JDBC. Uma solução rápida e simples para quem deseja depurar, fazer logging  ou perfilar a execução do SQL sem ter que modificar a arquitetura da aplicação.</p>
<p class="MsoNormal"><span style="font-size:100%;">Para usá-lo primeiro são necessários apenas 4 passos:</span></p>
<ol>
<li><span style="font-size:100%;">É necessário saber qual o componente provedor das conexões com os dados da sua aplicação, exemplo: Driver Manager,  DataSource,  algum Componente de Pooling, etc&#8230;,</span></li>
<li><span style="font-size:100%;">Conhecido o provedor, então deve se escolher o componente correspondente de Proxy.  Obs.: Você também pode estender ou criar seu componente customizado.</span></li>
<li><span style="line-height:115%;">I</span><span style="font-size:100%;">mplementar o Proxy criando a solução <em>vendor-especifc</em>, i.e, especifica do seu SGBD. No pacote </span><span style="line-height:115%;">proxy4jdbc3.solutions.* você encontrará soluções-exemplo.</span></li>
<li><span style="font-size:100%;">Substitua a referência ao provedor de conexão pela referência ao Proxy.</span></li>
</ol>
<p><span style="line-height:115%;font-size:100%;"><br />
O componente foi desenvolvido sobre a JDBC 3, e está ainda em fase de teste (beta).</span><span style="line-height:115%;font-size:12px;"><span style="font-size:100%;"><br />
Maiores informações em: <a href="http://proxy4jdbc3.sourceforge.net/">http://proxy4jdbc3.sourceforge.net/</a></span> </span></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/fabricioepa.wordpress.com/4/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/fabricioepa.wordpress.com/4/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fabricioepa.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fabricioepa.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fabricioepa.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fabricioepa.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fabricioepa.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fabricioepa.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fabricioepa.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fabricioepa.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fabricioepa.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fabricioepa.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fabricioepa.wordpress.com&blog=3009806&post=4&subd=fabricioepa&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://fabricioepa.wordpress.com/2008/02/26/interceptando-a-execucao-do-sql-da-sua-aplicacao/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fce1b2a6387a8d4a7fede7a78286c4be?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">fabricioepa</media:title>
		</media:content>
	</item>
	</channel>
</rss>