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

<channel>
	<title>Sobre Isso!</title>
	<atom:link href="http://www.paulocordeiro.com.br/index.php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.paulocordeiro.com.br</link>
	<description>Tecnologia da infomação; Java; Linux e um pouco mais.</description>
	<lastBuildDate>Wed, 27 Apr 2011 19:13:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>String &#8211; reverse</title>
		<link>http://www.paulocordeiro.com.br/index.php/2011/04/27/string-reverse/</link>
		<comments>http://www.paulocordeiro.com.br/index.php/2011/04/27/string-reverse/#comments</comments>
		<pubDate>Wed, 27 Apr 2011 19:13:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Groovy]]></category>

		<guid isPermaLink="false">http://www.paulocordeiro.com.br/?p=92</guid>
		<description><![CDATA[Esses dias precisei baixar um arquivo num site e ele pedia um cadastro de celular como pre-requisito para fornecer o link. Ao observar mais atentamente dá pra ver que o link é parte da própria URL, o único inconveniente é ela está ao oirártnoc contrário. Resolver o problema não é difícil, mas é chato, foi [...]]]></description>
			<content:encoded><![CDATA[<p>Esses dias precisei baixar um arquivo num site  e ele pedia um cadastro de celular como pre-requisito para fornecer o link. Ao observar mais atentamente dá pra ver que o link é parte da própria URL, o único inconveniente é ela está ao <del datetime="2011-04-27T18:10:38+00:00">oirártnoc</del> contrário.<br />
Resolver o problema não é difícil, mas é chato, foi por isso que escrevi um pequeno script <a href="http://groovy.codehaus.org/">groovy</a> que recebe a url invertida, simplesmente usa a própria api do groovy para reverte-la e abri-la no browser default.</p>
<p><code><br />
url = System.in.withReader {<br />
        print  'url: '<br />
        it.readLine()<br />
} </p>
<p>println "Você digitou: $url"</p>
<p>java.awt.Desktop.getDesktop().browse( new URL( url.toString().reverse() ).toURI() )<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.paulocordeiro.com.br/index.php/2011/04/27/string-reverse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Serializador Json personalizado para Enum</title>
		<link>http://www.paulocordeiro.com.br/index.php/2011/04/19/serializador-json-personalizado-para-enum/</link>
		<comments>http://www.paulocordeiro.com.br/index.php/2011/04/19/serializador-json-personalizado-para-enum/#comments</comments>
		<pubDate>Wed, 20 Apr 2011 00:03:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[geral]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[Springframework]]></category>

		<guid isPermaLink="false">http://www.paulocordeiro.com.br/?p=68</guid>
		<description><![CDATA[Estou trabalhando num projeto com Springframework mvc onde os serviços rest são transportados em json. Por padrão, a serialização para json é feita pelo framework Jackson que é muito bom diga-se de passagem, já que é bastante flexivel. No meu problema de hoje precisei personalizar a serialização dos enums pois por padrão ele retorna o [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.paulocordeiro.com.br/wp-content/uploads/2011/04/json160.gif"><img src="http://www.paulocordeiro.com.br/wp-content/uploads/2011/04/json160.gif" alt="" title="json160" width="100" height="100" class="alignleft size-full wp-image-84" /></a><br />
Estou trabalhando num projeto com <a href="http://www.springsource.org/about">Springframework</a> mvc onde os serviços rest são transportados em json.<br />
Por padrão, a serialização para json é feita pelo framework <a href="http://jackson.codehaus.org/">Jackson</a> que é muito bom diga-se de passagem, já que é bastante flexivel.<br />
No meu problema de hoje precisei personalizar a serialização dos enums pois por padrão ele retorna o name do enum. É possivel por exemplo, adicionar a anotação<a href="http://jackson.codehaus.org/1.3.4/javadoc/org/codehaus/jackson/annotate/JsonValue.html"> @JsonValue</a> para definir qual método retornará o valor desejado. No meu caso porém, eu precisava retornar o enum numa estrutura de pojo e não: </p>
<p><code><br />
{<br />
  "name" : { "first" : "Joe", "last" : "Sixpack" },<br />
  <strong>"gender" : "MALE",</strong><br />
  "verified" : false,<br />
  "userImage" : "Rm9vYmFyIQ=="<br />
}<br />
</code></p>
<p>Para isso criei um serializador personalizado:</p>
<p><code><br />
public class SimpleEnumSerializer extends JsonSerializer<enum <?>> {</p>
<p>    @Override<br />
    public void serialize(Enum< ?> value, JsonGenerator jgen, SerializerProvider provider) throws IOException,<br />
            JsonProcessingException {<br />
         jgen.writeStartObject();<br />
         jgen.writeFieldName("ordinal");<br />
         jgen.writeNumber(value.ordinal());<br />
         jgen.writeFieldName("name");<br />
         jgen.writeString(value.name());<br />
         jgen.writeEndObject();<br />
    }<br />
}</p>
<p>public class User {<br />
    private Gender _gender;<br />
    private Name _name;<br />
    private boolean _isVerified;<br />
    private byte[] _userImage;</p>
<p>    <strong>@JsonSerialize(using = SimpleEnumSerializer.class)</strong><br />
    public Gender getGender() { return _gender; }<br />
}</p>
<p></enum></code></p>
<p>com isso o resultado passa para:<br />
<code><br />
{<br />
  "name" : { "first" : "Joe", "last" : "Sixpack" },<br />
 <strong> "gender" {"ordinal":0, "name":"MALE"},</strong><br />
  "verified" : false,<br />
  "userImage" : "Rm9vYmFyIQ=="<br />
}<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.paulocordeiro.com.br/index.php/2011/04/19/serializador-json-personalizado-para-enum/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A imposição de uma consciência ecológica</title>
		<link>http://www.paulocordeiro.com.br/index.php/2010/09/08/a-imposicao-de-uma-consciencia-ecologica/</link>
		<comments>http://www.paulocordeiro.com.br/index.php/2010/09/08/a-imposicao-de-uma-consciencia-ecologica/#comments</comments>
		<pubDate>Wed, 08 Sep 2010 13:13:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[geral]]></category>

		<guid isPermaLink="false">http://www.paulocordeiro.com.br/?p=52</guid>
		<description><![CDATA[Nos últimos dias tenho ouvido muito na mídia sobre ecologia focado em reciclagem. Um assunto tão importante como esse, é tratado aqui no Brasil como se reciclagem fosse algo que já fizéssemos há anos. Interessante também é observar como aqueles que tentam despertar na população o interesse por esse assunto parecem realmente não considerar questões [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.paulocordeiro.com.br/wp-content/uploads/2010/09/reciclagem.jpeg"><img src="http://www.paulocordeiro.com.br/wp-content/uploads/2010/09/reciclagem-150x150.jpg" alt="" title="reciclagem" width="150" height="150" class="aligncenter size-thumbnail wp-image-53" /></a><br />
Nos últimos dias tenho ouvido muito na mídia sobre ecologia focado em reciclagem. Um assunto tão importante como esse, é tratado aqui no Brasil como se reciclagem fosse algo que já fizéssemos há anos.<br />
Interessante também é observar como aqueles que tentam despertar na população o interesse por esse assunto parecem realmente não considerar questões básicas em suas abordagens.</p>
<p>O Governo por exemplo, sugere que a dona de casa, durante sua árdua tarefa diária, separe todo lixo, cuidando em não misturar orgânicos, metais, papeis, vidros e plásticos. Até parece interessante, até você se perguntar: Como tudo isso vai funcionar? A maioria da população vive em minusculas moradias, será que caberá mais quatro recipientes de lixo numa casa? E o pior: o que adianta separar o lixo se na prática não existe coleta seletiva?</p>
<p>O Governo precisa iniciar projetos envolvendo a população, os condomínios, as empresas responsáveis pela coleta de lixo os sindicatos dos catadores, objetivando fazer menos propaganda e mais ação. É necessário projetar e distribuir gratuitamente um repositório de lixo compacto que seja possível num mesmo repositório, de forma prática armazenar todo tipo de lixo. E mais: é preciso fazer a coleta seletiva nesses bairros.</p>
<p>Algumas redes varejistas têm dado a opção de se adquirir sacolas “retornáveis”. Fico imaginando isso na prática pois à exceção do responsável pelas compras domesticas, a maioria das pessoas, não vão para o supermercado, passam lá. Imagine agora você que foi ao shopping, lembrou que precisava comprar algo mais que estava em falta mas não poderá faze-lo pois não trouxe sua sacola retornável. Se esse algo for muito importante, você poderá adquirir outra sacolinha pelos módicos R$ 4,50.</p>
<p>Soluções como essas nada mais são que tentativas de lançar novos produtos sob o marketing de uma<br />
iniciativa ecologicamente correta.</p>
<p>Por fim não poderia deixar de mencionar a área de tecnologia que a cada dia evolui de tal forma que o mercado lança para o consumo novos produtos em intervalos cada vez menores.<br />
No Brasil, logo teremos mais dispositivos móveis que brasileiros, ainda que esses não estejam proporcionalmente distribuídos, ou seja, não estou dizendo que todos terão um dispositivo.<br />
Todos sabemos que não se deve descartar a baterias desses dispositivos em lixo comum, mas você conhece<br />
algum ponto de coleta? Tipo você foi almoçar e viu a placa: “Descarte suas baterias de celulares Aqui!”.<br />
Você não precisou ligar para nenhuma agência regulamentadora, não precisou ameaçar o gerente de uma revendedora de aparelhos celulares…</p>
<p>É preciso haver compreensão que apenas marketing não é suficiente para haja um despertamento de uma consciência ecológica.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.paulocordeiro.com.br/index.php/2010/09/08/a-imposicao-de-uma-consciencia-ecologica/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Groovy, o melhor dos mundos</title>
		<link>http://www.paulocordeiro.com.br/index.php/2008/09/22/groovy-o-melhor-dos-mundos/</link>
		<comments>http://www.paulocordeiro.com.br/index.php/2008/09/22/groovy-o-melhor-dos-mundos/#comments</comments>
		<pubDate>Tue, 23 Sep 2008 01:06:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Groovy]]></category>

		<guid isPermaLink="false">http://www.paulocordeiro.com.br/?p=37</guid>
		<description><![CDATA[Uma das coisas que mais interessante na plataforma Java é a capacidade de expandir e adaptar-se às novas necessidades do mercado. Nestes últimos anos a plataforma Java tem crescido e atraído para perto de comunidades tradicionais e sólidas como PHP, Ruby, Python devido a novos recursos de Scripting. Paralelo a essa revolução, a comunidade Groovy [...]]]></description>
			<content:encoded><![CDATA[<p> <div id="attachment_38" class="wp-caption aligncenter" style="width: 213px"><a href="http://www.paulocordeiro.com.br/wp-content/uploads/2008/09/groovy_medium.png"><img src="http://www.paulocordeiro.com.br/wp-content/uploads/2008/09/groovy_medium.png" alt="groovy" title="groovy_medium" width="203" height="100" class="size-medium wp-image-38" /></a><p class="wp-caption-text">groovy</p></div><br />
Uma das coisas que mais interessante na plataforma Java é a capacidade de expandir e adaptar-se às novas necessidades do mercado.<br />
Nestes últimos anos a plataforma Java tem crescido e atraído para perto de comunidades tradicionais e sólidas como PHP, Ruby, Python devido a novos recursos de <a href="https://scripting.dev.java.net/">Scripting</a>. Paralelo a essa revolução, a comunidade <a href="http://groovy.codehaus.org/">Groovy</a> já estava um passo à frente pois se antecipava nos conceitos e introduzia na plataforma um novo modelo de programação cujos principais objetivos era ser simples, dinâmica, eliminar a burocracia sintática, mas aproveitar todo o poder da plataforma.<br />
Nasceu então o Groovy uma linguagem de script espetacular sendo inspirada em outras bem sucedidas como Python, Ruby e Smalltalk.</p>
<p><strong>Instalação</strong><br />
A instalação do Groovy é bastante simples faça o <a href="http://dist.groovy.codehaus.org/distributions/groovy-binary-1.5.6.zip">download</a> da versão estável e descompacte o zip numa pasta desejada. Na página de downloads você também encontrará versões empacotadas para distribuições OpenSuse, Ubuntu e para quem usa Windows há um <a href="http://dist.codehaus.org/groovy/distributions/installers/windows/nsis/groovy-1.5.6-installer-2.exe">instalador</a> próprio.<br />
Você precisa ter o java previamente instalado e a variável <strong>JAVA_HOME</strong> configurada. Após descompactado o pacote, configure a variável <strong>GROOVY_HOME</strong> apontando para a pasta recém criada. Adicione à variável <strong>PATH</strong> a pasta bin de sua pasta <strong>$GROOVY_HOME</strong>/bin </p>
<p><strong>Executando</strong><br />
Se tudo foi feito certinho, quando você for ao console e digitar <strong>groovyConsole</strong> você terá uma tela semelhante a esta<br />
<a href="http://www.paulocordeiro.com.br/wp-content/uploads/2008/09/groovyconsole.png"><img src="http://www.paulocordeiro.com.br/wp-content/uploads/2008/09/groovyconsole-300x245.png" alt="" title="groovyconsole" width="300" height="245" class="aligncenter size-medium wp-image-42" /></a></p>
<p>Você poderia também usar o <strong>groovysh</strong>, uma ferramenta interativa e muito leve. Mas   <strong>groovyConsole</strong> é mais amigável<br />
<a href="http://www.paulocordeiro.com.br/wp-content/uploads/2008/09/groovysh.png"><img src="http://www.paulocordeiro.com.br/wp-content/uploads/2008/09/groovysh-300x220.png" alt="" title="groovysh" width="300" height="220" class="aligncenter size-medium wp-image-44" /></a></p>
<p><strong>Hello Word</strong><br />
Abra o <strong>groovyConsole</strong> e digite área reservada ao script:</p>
<p><code>def hw = "Hello, World!"<br />
"Sobre Isso: ${hw}"<br />
"Sobre Isso: ${hw}".center(40,'+')<br />
</code></p>
<p>A primeira linha define a variável hw com o conteúdo &#8220;Hello, World!&#8221;, a segunda demonstra a utilização de <a href="http://groovy.codehaus.org/api/groovy/lang/GString.html">GStrings</a> que são Strings com recursos adicionais. Por fim, o mesmo texto é centralizado e num comprimento de 40 caracteres plus.</p>
<p>Num próximo post veremos o poder do Groovy em coisas mais interessantes.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.paulocordeiro.com.br/index.php/2008/09/22/groovy-o-melhor-dos-mundos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GWT &#8211; basico, mas funcional</title>
		<link>http://www.paulocordeiro.com.br/index.php/2008/09/02/gwt-basico-mas-funcional/</link>
		<comments>http://www.paulocordeiro.com.br/index.php/2008/09/02/gwt-basico-mas-funcional/#comments</comments>
		<pubDate>Wed, 03 Sep 2008 00:37:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AJAX]]></category>

		<guid isPermaLink="false">http://blogs.dominiopublico.com.br/paulocordeiro/index.php/2008/09/02/gwt-basico-mas-funcional/</guid>
		<description><![CDATA[O GWT é um tecnologia extraordinária. Ela possibilita que aplicações sejam criadas em java e após compilado, transformado em JavaScript gerando assim uma aplicação dinâmica e bastante flexível. A internet está cheia de tutorias e o próprio site do GWT somado ao grupo oficial de usuário é uma fonte excelente de informação para tirar dúvidas [...]]]></description>
			<content:encoded><![CDATA[<p>O <a href="http://code.google.com/webtoolkit/">GWT</a>  é um tecnologia extraordinária. Ela possibilita que aplicações sejam criadas em java e após compilado, transformado em JavaScript gerando assim uma aplicação dinâmica e bastante flexível.<br />
A internet está cheia de tutorias e o próprio site do <a href="http://code.google.com/webtoolkit/">GWT</a> somado ao <a href="http://groups.google.com/group/Google-Web-Toolkit/">grupo</a> oficial de usuário  é uma fonte excelente de informação para tirar dúvidas e melhorar o conhecimento.</p>
<p>Um problema que é muito comum nos vários tutoriais que vemos pela internet é que eles não são completos o suficientes para o usuário mais iniciante ter um compreensão da tecnologia e muitas vezes até desmotiva a continuidade em busca de um maior entendimento ante os primeiros desafios.</p>
<p>Para quem está iniciando uma boa alternativa é utilizar o Netbeans com seu plugin <a href="http://www.netbeans.org/kb/60/web/quickstart-webapps-gwt.html">gwt4nb</a> para GWT pois ele permite criar uma aplicação completa inclusive fazer deploy para seu servidor de aplicação.<br />
Para o Eclipse, entretanto, não existe nenhuma boa alternativa livre (que eu conheça) para se trabalhar com o GWT, mas isso pode ser contornado de forma simples. Vamos lá:</p>
<p>Faça o download:<br />
<code>wget http://google-web-toolkit.googlecode.com/files/gwt-linux-1.5.2.tar.bz2</code><br />
veja opções para outras plataformas em http://code.google.com/webtoolkit/versions.html</p>
<p>Descompacte o arquivo:<br />
<code>tar -xjvf gwt-linux-1.5.2.tar.bz2</code></p>
<p><a href='http://blogs.dominiopublico.com.br/paulocordeiro/wp-content/uploads/2008/09/download.png' title='download'><img src='http://blogs.dominiopublico.com.br/paulocordeiro/wp-content/uploads/2008/09/download.png' alt='download' /></a></p>
<p>Edite suas variáveis de ambiente criando a variavel para GWT_HOME e atualizando a variável PATH.<br />
Em sistemas no padrão Linux basta editar o arquivo oculto chamando .profile em sua pasta pessoal adicionando as seguintes linhas</p>
<p><code>export GWT_HOME=/home/paulo/gwt-linux-1.5.2<br />
export PATH=$PATH:$GWT_HOME<br />
</code></p>
<p>Lógico que você precisará substituir <code>/home/paulo/gwt-linux-1.5.2</code> pela pasta onde você descompactou o gwt.<br />
Em sistemas Windows o procedimento é realizado editando-se as propriedades do sistema conforme imagem abaixo:</p>
<p><a href='http://blogs.dominiopublico.com.br/paulocordeiro/wp-content/uploads/2008/09/variaveiswin.png' title='variaveisWin'><img src='http://blogs.dominiopublico.com.br/paulocordeiro/wp-content/uploads/2008/09/variaveiswin.png' alt='variaveisWin' /></a></p>
<p><strong>Criando um projeto para teste</strong></p>
<p>O objetivo do nosso teste é apenas criar um esqueleto de uma aplicação padrão, acrescentando a ela uma serviço RPC e por<br />
fim fazer o deploy num conteiner web, no nosso caso, para simplificar, o  <a href="http://tomcat.apache.org">Tomcat, </a>mas não é preciso nenhuma mudança para que este rode no <a href="https://glassfish.dev.java.net">Glassfish</a></p>
<p>no console digite:<br />
<code><br />
 cd workspace/<br />
applicationCreator -out gwtWebMode -eclipse gwtWebMode br.com.sample.client.GwtWebMode</code></p>
<p>o gwt  criou uma estrutura básica para trabalharmos. Normalmente usaríamos um outro recurso do gwt que é criar um projeto para o eclipse, com o comando <strong>projectCreator</strong> importando-o em seguida mas não vamos fazê-lo pois o projeto criado não gera os artefatos para uma aplicação web coisa que uma aplicação gwt é por natureza.</p>
<p><a href='http://blogs.dominiopublico.com.br/paulocordeiro/wp-content/uploads/2008/09/applicationcreator.png' title='applicationCreator'><img src='http://blogs.dominiopublico.com.br/paulocordeiro/wp-content/uploads/2008/09/applicationcreator.png' alt='applicationCreator' /></a></p>
<p>O que vamos fazer é pedir para o Eclipse criar um novo projeto web justamente na pasta recém criada, isso aproveitará os arquivos criados pelo <strong>applicationCreator</strong> e nos dará os artefatos adicionais.</p>
<p>Abra o Eclipse e escolha File/New/Other/Dynamic Web Project<br />
<a href='http://blogs.dominiopublico.com.br/paulocordeiro/wp-content/uploads/2008/09/newproject.png' title='newProject'><img src='http://blogs.dominiopublico.com.br/paulocordeiro/wp-content/uploads/2008/09/newproject.png' alt='newProject' /></a></p>
<p>Digite o nome do projeto igual ao nome ao informado ao applicationCreator.<br />
<a href='http://blogs.dominiopublico.com.br/paulocordeiro/wp-content/uploads/2008/09/nameapplication.png' title='nameApplication'><img src='http://blogs.dominiopublico.com.br/paulocordeiro/wp-content/uploads/2008/09/nameapplication.png' alt='nameApplication' /></a></p>
<p>Sua aplicação já deverá funcionar em hosted mode. Experimente executar GwtWebMode-shell (está na pasta recém criada).</p>
<p><a href='http://blogs.dominiopublico.com.br/paulocordeiro/wp-content/uploads/2008/09/hostmode.png' title='hostmode'><img src='http://blogs.dominiopublico.com.br/paulocordeiro/wp-content/uploads/2008/09/hostmode.png' alt='hostmode' /></a></p>
<p>O <strong>hostmoded</strong> é uma opção rápida para utilização durante a fase de desenvolvimento, mas nem todos os recursos que sua aplicação irá precisar são suportados.</p>
<p><strong>Executando em WebMode</strong></p>
<p>O que vamos fazer é criar um mecanismo capaz de compilar nossa aplicação e fazer o deploy dela em nosso servidor web. A melhor opção ainda é utilizar um script <a href="http://ant.apache.org/">Ant</a></p>
<p>salve o arquivo abaixo na raiz de seu projeto com o nome <strong>build.xml </strong></p>
<div class="igBar"><span id="lhtml-10"><a href="#" onclick="javascript:showCodeTxt('html-10'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite">
<div id="html-10">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span></a>?xml <span style="color: #000066;">version</span>=<span style="color: #ff0000;">"1.0"</span> encoding=<span style="color: #ff0000;">"UTF-8"</span>?<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;">&lt;project <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"gwtWebMode"</span> default=<span style="color: #ff0000;">"deploy"</span> basedir=<span style="color: #ff0000;">"."</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;">&lt;property environment=<span style="color: #ff0000;">"env"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;">&lt;property file=<span style="color: #ff0000;">"build.properties"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;">&lt;path <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"classpath"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;pathelement location=<span style="color: #ff0000;">"build"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;pathelement location=<span style="color: #ff0000;">"src"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;pathelement location=<span style="color: #ff0000;">"${gwt.dir}/gwt-user.jar"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;pathelement location=<span style="color: #ff0000;">"${gwt.dir}/gwt-dev-linux.jar"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;pathelement location=<span style="color: #ff0000;">"${gwt.dir}/gwt-servlet.jar"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;fileset <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">"${web.dir}/WEB-INF/lib/"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;include <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"*.jar"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span></a>/fileset&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span></a>/path&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;">&lt;target <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"clean"</span> depends=<span style="color: #ff0000;">"clean.test"</span> description=<span style="color: #ff0000;">"deletes all generated files"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;delete <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">".gwt-cache"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;delete <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">"build"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;delete <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">"dist"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;delete <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">"log"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;delete <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">"container"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span></a>/target&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;">&lt;target <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"clean.test"</span> description=<span style="color: #ff0000;">"deletes all generated test files"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;delete <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">"test"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span></a>/target&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;">&lt;target <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"compile"</span> depends=<span style="color: #ff0000;">"prepare"</span> description=<span style="color: #ff0000;">"compiles Java source files to bytecode"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;javac srcdir=<span style="color: #ff0000;">"src"</span> destdir=<span style="color: #ff0000;">"build"</span> classpathref=<span style="color: #ff0000;">"classpath"</span> debug=<span style="color: #ff0000;">"false"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span></a>/javac&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span></a>/target&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;">&lt;target <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"compile.gwt"</span> depends=<span style="color: #ff0000;">"compile"</span> description=<span style="color: #ff0000;">"compiles Java source files to JavaScript"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- Consider adding -Xms256m -Xmx512m to improve performance. --&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;java classname=<span style="color: #ff0000;">"com.google.gwt.dev.GWTCompiler"</span> classpathref=<span style="color: #ff0000;">"classpath"</span> fork=<span style="color: #ff0000;">"true"</span> maxmemory=<span style="color: #ff0000;">"768m"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;arg line=<span style="color: #ff0000;">"-out build/www"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;arg line=<span style="color: #ff0000;">"-style ${gwt-security}"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;arg <span style="color: #000066;">value</span>=<span style="color: #ff0000;">"${package}.${module}"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span></a>/java&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;move todir=<span style="color: #ff0000;">"build/www"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;fileset <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">"build/www/${package}.${module}"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span></a>/move&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span></a>/target&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;">&lt;target <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"clean_www"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;delete <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">"build/www"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span></a>/target&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;">&lt;target <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"hosted"</span> depends=<span style="color: #ff0000;">"compile"</span> description=<span style="color: #ff0000;">"runs the application in hosted mode"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;java classname=<span style="color: #ff0000;">"com.google.gwt.dev.GWTShell"</span> classpathref=<span style="color: #ff0000;">"classpath"</span> fork=<span style="color: #ff0000;">"true"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;jvmarg <span style="color: #000066;">value</span>=<span style="color: #ff0000;">"-XstartOnFirstThread"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;arg line=<span style="color: #ff0000;">"-out ./www"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;arg line=<span style="color: #ff0000;">"${package}.${module}/${module}.html"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span></a>/java&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span></a>/target&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;">&lt;target <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"prepare"</span> depends=<span style="color: #ff0000;">"clean"</span> description=<span style="color: #ff0000;">"creates output directories"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;mkdir <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">"build"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;mkdir <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">"dist"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;mkdir <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">"log"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span></a>/target&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;">&lt;target <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"test"</span> depends=<span style="color: #ff0000;">"clean.test,compile"</span> description=<span style="color: #ff0000;">"runs all JUnit tests"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;mkdir <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">"test"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;junit fork=<span style="color: #ff0000;">"yes"</span> printsummary=<span style="color: #ff0000;">"yes"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- next line is only for Mac OS X --&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;jvmarg <span style="color: #000066;">value</span>=<span style="color: #ff0000;">"-XstartOnFirstThread"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;classpath refid=<span style="color: #ff0000;">"classpath"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;batchtest todir=<span style="color: #ff0000;">"test"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;fileset <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">"src"</span> includes=<span style="color: #ff0000;">"**/${test}Test.java"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span></a>/batchtest&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;formatter <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"xml"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span></a>/junit&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;junitreport toDir=<span style="color: #ff0000;">"test"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;fileset <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">"test"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;report format=<span style="color: #ff0000;">"frames"</span> todir=<span style="color: #ff0000;">"test"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span></a>/junitreport&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;exec os=<span style="color: #ff0000;">"Windows"</span> executable=<span style="color: #ff0000;">"cmd.exe"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;arg line=<span style="color: #ff0000;">"/c start test/index.html"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span></a>/exec&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;exec os=<span style="color: #ff0000;">"Mac OS X"</span> executable=<span style="color: #ff0000;">"open"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;arg line=<span style="color: #ff0000;">"-a /Applications/Safari.app test/index.html"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span></a>/exec&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span></a>/target&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;">&lt;target <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"deploy"</span> depends=<span style="color: #ff0000;">"clean_www, war,undeploy"</span> description=<span style="color: #ff0000;">"deploys the war file to Tomcat"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;copy file=<span style="color: #ff0000;">"dist/${war}"</span> todir=<span style="color: #ff0000;">"${app.server.deploy.dir}"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span></a>/target&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;">&lt;target <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"undeploy"</span> description=<span style="color: #ff0000;">"undeploys the web app. from Tomcat"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;delete file=<span style="color: #ff0000;">"${app.server.deploy.dir}/${war}"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span></a>/target&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;">&lt;target <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"war"</span> depends=<span style="color: #ff0000;">"compile, compile.gwt"</span> description=<span style="color: #ff0000;">"builds the war file"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;delete file=<span style="color: #ff0000;">"dist/${war}"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;war destfile=<span style="color: #ff0000;">"dist/${war}"</span> webxml=<span style="color: #ff0000;">"${web.dir}/WEB-INF/web.xml"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- bytecode from your Java code --&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;classes <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">"build"</span> includes=<span style="color: #ff0000;">"**/*.class"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;classes <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">"src"</span> includes=<span style="color: #ff0000;">"**/*.properties"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;classes file=<span style="color: #ff0000;">"log4j.properties"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;manifest&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;attribute <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"Created-By"</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">"${user.name}"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;attribute <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"Manifest-Version"</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">"1.0"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;attribute <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"Ant-Version"</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">"${ant.version}"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span></a>/manifest&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- generated HTML/JavaScript plus your CSS --&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;fileset <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">"build/www"</span>/<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- supplied JAR --&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;lib <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">"${web.dir}/WEB-INF/lib"</span>/<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;lib file=<span style="color: #ff0000;">"${gwt.dir}/gwt-servlet.jar"</span>/<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span></a>/war&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span></a>/target&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span></a>/project&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>salve também esse  arquivo de propriedades na mesma pasta com o nome <strong>build.properties </strong> </p>
<div class="igBar"><span id="lhtml-11"><a href="#" onclick="javascript:showCodeTxt('html-11'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite">
<div id="html-11">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">gwt.dir=/home/paulo/gwt</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">web.dir=${basedir}/WebContent</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">module=GwtWebMode</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">package=br.com.sample</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">url=http://localhost:8080/${ant.project.name}/${package}.${module}/${module}.html</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">war=${ant.project.name}.war</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">app.server.dir = /home/paulo/bin/apache-tomcat</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">app.server.deploy.dir = ${app.server.dir}/webapps</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">app.server.lib.dir = ${app.server.dir}/lib</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">gwt-security=OBFUSCATE </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Não vou entrar nos detalhes dos arquivos.<br />
O Eclipse deve está se "queixando" que não conhece as classes do GWT. Para resolver este problema copie os arquivos<br />
$GWT_HOME/gwt-user.jar<br />
$GWT_HOME/gwt-dev-linux.jar<br />
$GWT_HOME/gwt-servlet.jar</p>
<p>para a pasta: gwtWebMode/WebContent/WEB-INF/lib e dê um refresh em seu projeto.</p>
<p>Certifique-se que o Tomcat esteja instalado e em execução.<br />
Abra o arquivo build.properties e altere as variáveis gwt.dir e app.server.dir para refletir sua instalação<br />
<code>gwt.dir=/home/paulo/gwt-linux-1.5.2<br />
app.server.dir = /home/paulo/bin/apache-tomcat</code></p>
<p>Edite seu arquivo <strong>web.xml</strong> modificando a tag  welcome-file</p>
<p><a href='http://blogs.dominiopublico.com.br/paulocordeiro/wp-content/uploads/2008/09/welcome.png' title='welcome'><img src='http://blogs.dominiopublico.com.br/paulocordeiro/wp-content/uploads/2008/09/welcome.png' alt='welcome' /></a></p>
<p>Clique com botão direito no arquivo build.xml e escolha Run As/Ant Build. Após concluindo abra o browse no seguinte endereço:</p>
<p><code>http://localhost:8080/gwtWebMode/</code></p>
<p><a href='http://blogs.dominiopublico.com.br/paulocordeiro/wp-content/uploads/2008/09/webmode.png' title='webmode'><img src='http://blogs.dominiopublico.com.br/paulocordeiro/wp-content/uploads/2008/09/webmode.png' alt='webmode' /></a></p>
<p><strong>Incluindo um Serviço RPC</strong></p>
<p>Um outro importante recurso do GWT é a possibilidade de executar serviços remotos. Esses serviços são servlets especiais que fazem ponte entre o javascript gerado e a parte servidora, possibilitando assim um completa integração com outras aplicações e os mais variados frameworks que somos dependentes.</p>
<p>O nosso serviço apenas receberá uma String e retornará a quantidade de caracteres deste.<br />
inicie criando a interface  <strong>StringLengthService. </strong>Ela precisa estender a interface <strong>RemoteService</strong>. </p>
<p><a href='http://blogs.dominiopublico.com.br/paulocordeiro/wp-content/uploads/2008/09/stringlengthservice.png' title='interface'><img src='http://blogs.dominiopublico.com.br/paulocordeiro/wp-content/uploads/2008/09/stringlengthservice.png' alt='interface' /></a></p>
<div class="igBar"><span id="ljava-12"><a href="#" onclick="javascript:showCodeTxt('java-12'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite">
<div id="java-12">
<div class="java">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">package br.<span style="color: #006600;">com</span>.<span style="color: #006600;">sample</span>.<span style="color: #006600;">client</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import com.google.gwt.user.client.rpc.RemoteService;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">interface</span> StringLengthService <span style="color: #000000; font-weight: bold;">extends</span> RemoteService <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">public</span> <a href="http://www.google.com/search?q=allinurl%3AInteger+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Integer</span></a> length<span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> string<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Em seguida você precisa de uma outra interface que permitirá invocar os serviços de forma assíncrona, ou seja ele será executado  em background e comunicado assim que houver uma "resposta" da execução do serviço.</p>
<div class="igBar"><span id="ljava-13"><a href="#" onclick="javascript:showCodeTxt('java-13'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite">
<div id="java-13">
<div class="java">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">package br.<span style="color: #006600;">com</span>.<span style="color: #006600;">sample</span>.<span style="color: #006600;">client</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import com.google.gwt.user.client.rpc.AsyncCallback;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">interface</span> StringLengthServiceAsync <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp;<span style="color: #993333;">void</span> length<span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> string, AsyncCallback async<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>  </p>
<p>Por fim criaremos a classe responsável por implementar o serviço: Ela deve estender <strong>RemoteServiceServlet</strong>, implementar a interface <strong>StringLengthService</strong> anteriormente criada e deve ficar no
<div class="igBar"><span id="ljava-14"><a href="#" onclick="javascript:showCodeTxt('java-14'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite">
<div id="java-14">
<div class="java">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">package br.<span style="color: #006600;">com</span>.<span style="color: #006600;">sample</span>.<span style="color: #006600;">server</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><a href='http://blogs.dominiopublico.com.br/paulocordeiro/wp-content/uploads/2008/09/serviceimpl.png' title='serviceimpl'><img src='http://blogs.dominiopublico.com.br/paulocordeiro/wp-content/uploads/2008/09/serviceimpl.png' alt='serviceimpl' /></a></p>
<div class="igBar"><span id="ljava-15"><a href="#" onclick="javascript:showCodeTxt('java-15'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite">
<div id="java-15">
<div class="java">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">package br.<span style="color: #006600;">com</span>.<span style="color: #006600;">sample</span>.<span style="color: #006600;">server</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import br.com.sample.client.StringLengthService;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import com.google.gwt.user.server.rpc.RemoteServiceServlet;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> StringLengthServiceImpl <span style="color: #000000; font-weight: bold;">extends</span> RemoteServiceServlet <span style="color: #000000; font-weight: bold;">implements</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; StringLengthService <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; @Override</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <a href="http://www.google.com/search?q=allinurl%3AInteger+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Integer</span></a> length<span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> string<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>string != <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> string.<span style="color: #006600;">length</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #cc66cc;color:#800000;">0</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>Declando os Serviços</strong></p>
<p>Aqui está um ponto crucial na execução de serviços RPC. Caso seu interese seja apenas executar seu serviço em hosted mode basta editar o arquivo <strong>GwtWebMode.gwt.xml</strong> declando nele seu serviço:</p>
<div class="igBar"><span id="lxml-16"><a href="#" onclick="javascript:showCodeTxt('xml-16'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite">
<div id="xml-16">
<div class="xml">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;servlet</span> <span style="color: #000066;">path</span>=<span style="color: #ff0000;">"/StringLength/StringLengthService"</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"br.com.sample.server.StringLengthServiceImpl"</span> <span style="font-weight: bold; color: black;">/&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Só que não bastará isto para utiliza-lo em webmode. Você precisará declara-lo no arquivo <strong>web.xml</strong> como se faz com qualquer servlet.</p>
<p><a href='http://blogs.dominiopublico.com.br/paulocordeiro/wp-content/uploads/2008/09/servletmap.png' title='servletmap'><img src='http://blogs.dominiopublico.com.br/paulocordeiro/wp-content/uploads/2008/09/servletmap.png' alt='servletmap' /></a></p>
<p><strong>Utilizando o Serviço</strong></p>
<p>Por fim faremos agora a utilização do serviço. Crie uma referência ao serviço da seguinte forma:</p>
<div class="igBar"><span id="ljava-17"><a href="#" onclick="javascript:showCodeTxt('java-17'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite">
<div id="java-17">
<div class="java">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">lengthService</span> = <span style="color: #66cc66;">&#40;</span>StringLengthServiceAsync<span style="color: #66cc66;">&#41;</span> GWT.<span style="color: #006600;">create</span><span style="color: #66cc66;">&#40;</span>StringLengthService.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>ServiceDefTarget<span style="color: #66cc66;">&#41;</span> lengthService<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">setServiceEntryPoint</span><span style="color: #66cc66;">&#40;</span>GWT.<span style="color: #006600;">getModuleBaseURL</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>+ <span style="color: #ff0000;">"/StringLength/StringLengthService"</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Veja o código completo: <strong>GwtWebMode.java</strong></p>
<div class="igBar"><span id="ljava-18"><a href="#" onclick="javascript:showCodeTxt('java-18'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite">
<div id="java-18">
<div class="java">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">package br.<span style="color: #006600;">com</span>.<span style="color: #006600;">sample</span>.<span style="color: #006600;">client</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import com.google.gwt.core.client.EntryPoint;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import com.google.gwt.core.client.GWT;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import com.google.gwt.user.client.rpc.AsyncCallback;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import com.google.gwt.user.client.rpc.ServiceDefTarget;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import com.google.gwt.user.client.ui.Button;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import com.google.gwt.user.client.ui.ClickListener;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import com.google.gwt.user.client.ui.DialogBox;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import com.google.gwt.user.client.ui.Image;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import com.google.gwt.user.client.ui.Label;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import com.google.gwt.user.client.ui.RootPanel;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import com.google.gwt.user.client.ui.TextBox;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import com.google.gwt.user.client.ui.VerticalPanel;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import com.google.gwt.user.client.ui.Widget;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"> * Entry point classes define &lt;code&gt;onModuleLoad()&lt;/code&gt;.</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"> */</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> GwtWebMode <span style="color: #000000; font-weight: bold;">implements</span> EntryPoint <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> StringLengthServiceAsync lengthService;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/**</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp;&nbsp; * This is the entry point method.</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp;&nbsp; */</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">void</span> onModuleLoad<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// prepara o serviço</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">lengthService</span> = <span style="color: #66cc66;">&#40;</span>StringLengthServiceAsync<span style="color: #66cc66;">&#41;</span> GWT.<span style="color: #006600;">create</span><span style="color: #66cc66;">&#40;</span>StringLengthService.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>ServiceDefTarget<span style="color: #66cc66;">&#41;</span> lengthService<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">setServiceEntryPoint</span><span style="color: #66cc66;">&#40;</span>GWT.<span style="color: #006600;">getModuleBaseURL</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>+ <span style="color: #ff0000;">"/StringLength/StringLengthService"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?q=allinurl%3AImage+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Image</span></a> img = <span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=allinurl%3AImage+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Image</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"http://code.google.com/webtoolkit/logo-185x175.png"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?q=allinurl%3AButton+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Button</span></a> button = <span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=allinurl%3AButton+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Button</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"length"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; img.<span style="color: #006600;">getElement</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">setId</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"pc-template-img"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">final</span> TextBox textBox = <span style="color: #000000; font-weight: bold;">new</span> TextBox<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">final</span> <a href="http://www.google.com/search?q=allinurl%3ALabel+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Label</span></a> lengthLabel = <span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=allinurl%3ALabel+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Label</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; VerticalPanel vPanel = <span style="color: #000000; font-weight: bold;">new</span> VerticalPanel<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; vPanel.<span style="color: #006600;">setWidth</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"100%"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; vPanel.<span style="color: #006600;">setHorizontalAlignment</span><span style="color: #66cc66;">&#40;</span>VerticalPanel.<span style="color: #006600;">ALIGN_CENTER</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; vPanel.<span style="color: #006600;">add</span><span style="color: #66cc66;">&#40;</span>img<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; vPanel.<span style="color: #006600;">add</span><span style="color: #66cc66;">&#40;</span>textBox<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; vPanel.<span style="color: #006600;">add</span><span style="color: #66cc66;">&#40;</span>button<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; vPanel.<span style="color: #006600;">add</span><span style="color: #66cc66;">&#40;</span>lengthLabel<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// Add image and button to the RootPanel</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; RootPanel.<span style="color: #006600;">get</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">add</span><span style="color: #66cc66;">&#40;</span>vPanel<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; button.<span style="color: #006600;">addClickListener</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> ClickListener<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">void</span> onClick<span style="color: #66cc66;">&#40;</span>Widget sender<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lengthService.<span style="color: #006600;">length</span><span style="color: #66cc66;">&#40;</span>textBox.<span style="color: #006600;">getText</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">new</span> AsyncCallback&lt;integer&gt;<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">void</span> onFailure<span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AThrowable+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Throwable</span></a> arg0<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lengthLabel.<span style="color: #006600;">setText</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"foi mal! deu erro!"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">void</span> onSuccess<span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AInteger+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Integer</span></a> arg0<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lengthLabel.<span style="color: #006600;">setText</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"length = "</span>&nbsp;+ arg0.<span style="color: #006600;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><a href='http://blogs.dominiopublico.com.br/paulocordeiro/wp-content/uploads/2008/09/final.png' title='final'><img src='http://blogs.dominiopublico.com.br/paulocordeiro/wp-content/uploads/2008/09/final.png' alt='final' /></a></integer></p>
<p>Se deseja faça o download dos fontes <a href='http://blogs.dominiopublico.com.br/paulocordeiro/index.php/2008/09/02/gwt-basico-mas-funcional/gwtwebmodezip/' rel='attachment wp-att-27' title='gwtWebMode.zip'>gwtWebMode.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.paulocordeiro.com.br/index.php/2008/09/02/gwt-basico-mas-funcional/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>script para backups &#8211; parte 2</title>
		<link>http://www.paulocordeiro.com.br/index.php/2007/09/02/script-para-backups-parte-2/</link>
		<comments>http://www.paulocordeiro.com.br/index.php/2007/09/02/script-para-backups-parte-2/#comments</comments>
		<pubDate>Mon, 03 Sep 2007 02:40:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[geral]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://blogs.dominiopublico.com.br/paulocordeiro/index.php/2007/09/02/script-para-backups-parte-2/</guid>
		<description><![CDATA[Num post anterior eu mostrei um script genérico para realização dos backups de projetos, mas que é flexível pois permite a personalização das informações que se deseja backupear em cada projeto, a partir de arquivos de configurações. Neste post faremos algumas pequenas modificações nele e configuraremos o agendamento para que o backup seja feito automaticamente. [...]]]></description>
			<content:encoded><![CDATA[<p>Num <a href="http://blogs.dominiopublico.com.br/paulocordeiro/index.php/2007/07/24/script-paga-backups">post anterior</a> eu mostrei um script genérico para realização dos backups de projetos, mas que é flexível pois permite a personalização das informações que se deseja backupear em cada projeto, a partir de arquivos de configurações.</p>
<p>Neste post faremos algumas pequenas modificações nele e configuraremos o agendamento para que o backup seja feito automaticamente.</p>
<p>As modificações consistem em remover as mensagens e diálogos gerados pelo kdialog e outras simplificações.<br />
O novo script ficará assim:</p>
<p>backup.sh</p>
<div class="igBar"><span id="lactionscript-22"><a href="#" onclick="javascript:showCodeTxt('actionscript-22'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite">
<div id="actionscript-22">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">#!/bin/bash</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">############################################</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"># backup de projetos</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"># deve ser usado em conjuto com algum arquivo de</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"># definicoes de backup</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"># por Paulo Cordeiro (paulo@link3.com.br)</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"># 02/09/2007</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"># versao 1.2</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">############################################</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#91;</span> <span style="color: #ff0000;">"$#"</span> -<span style="color: #0066CC;">eq</span> <span style="color: #cc66cc;color:#800000;">0</span> -o ! -<span style="color: #0066CC;">e</span> <span style="color: #ff0000;">"$1"</span> <span style="color: #66cc66;">&#93;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">then</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo <span style="color: #ff0000;">"execute: backup.sh arqConfig.bpk"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">exit <span style="color: #cc66cc;color:#800000;">2</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">else</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">defBackup=$<span style="color: #cc66cc;color:#800000;">1</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">fi</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">projeto=$<span style="color: #66cc66;">&#40;</span>cat $defBackup | grep projetoNome | cut -d <span style="color: #ff0000;">"="</span> -f <span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">descricao=$<span style="color: #66cc66;">&#40;</span>cat $defBackup | grep descricao | cut -d <span style="color: #ff0000;">"="</span> -f <span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">fonte=$<span style="color: #66cc66;">&#40;</span>cat $defBackup | grep fonte | cut -d <span style="color: #ff0000;">"="</span> -f <span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">destino=$<span style="color: #66cc66;">&#40;</span>cat $defBackup | grep destino | cut -d <span style="color: #ff0000;">"="</span> -f <span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">pastasPorData=$<span style="color: #66cc66;">&#40;</span>cat $defBackup | grep pastasPorData | cut -d <span style="color: #ff0000;">"="</span> -f <span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">data</span>=$<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">date</span> +%Y%m%d-%H%M%S<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">includefile=$<span style="color: #66cc66;">&#40;</span>mktemp /tmp/$projeto.<span style="color: #b1b100;">in</span>.<span style="color: #006600;">XXXXXX</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">excluirfile=$<span style="color: #66cc66;">&#40;</span>mktemp /tmp/$projeto.<span style="color: #006600;">ex</span>.<span style="color: #006600;">XXXXXX</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#91;</span> <span style="color: #ff0000;">"$pastasPorData"</span> == <span style="color: #ff0000;">"sim"</span> <span style="color: #66cc66;">&#93;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">then</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">destino=<span style="color: #ff0000;">"$destino/$projeto/$(date +%Y)/$(date +%B)/$(date +%d)"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">else</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">destino=$destino/$projeto</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">fi</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">backup_name=$destino/$projeto-$data.<span style="color: #006600;">tar</span>.<span style="color: #006600;">gz</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">cd $fonte</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">for</span> infile <span style="color: #b1b100;">in</span> $<span style="color: #66cc66;">&#40;</span>sed <span style="color: #ff0000;">'/incluir-ini/,/incluir-fim/! d; '</span> $defBackup | sed <span style="color: #ff0000;">'1d;$d'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">do</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo $infile&amp;gt;&amp;gt; $includefile</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">done</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sed <span style="color: #ff0000;">'/excluir-ini/,/excluir-fim/! d; '</span> $defBackup | sed <span style="color: #ff0000;">'1d;$d'</span>&amp;gt; $excluirfile</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mkdir <span style="color: #ff0000;">"$destino"</span> -p</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">tar -cvzf $backup_name --exclude-from=$excluirfile $<span style="color: #66cc66;">&#40;</span>cat $includefile<span style="color: #66cc66;">&#41;</span>&amp;gt; /dev/<span style="color: #000000; font-weight: bold;">null</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">rm $includefile</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">rm $excluirfile</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo $backup_name</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">exit <span style="color: #cc66cc;color:#800000;">0</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>crie também esse pequeno script que será usado  no agendamento:</p>
<p>agendamento.sh</p>
<div class="igBar"><span id="lactionscript-23"><a href="#" onclick="javascript:showCodeTxt('actionscript-23'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite">
<div id="actionscript-23">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">#!/bin/bash</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">############################################</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"># agendamento de backups</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"># por Paulo Cordeiro (paulo@link3.com.br)</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"># 02/09/2007</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"># versao 1.0</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">############################################</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">arqConfig=arqConfiguracao.<span style="color: #006600;">bkp</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">servidor=server</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">usuario=user</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">pastaRemota=/backups</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"># gera o backup</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">backupGerado=$<span style="color: #66cc66;">&#40;</span>dpbackupAgendamento $arqConfig<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"># tranfere para servidor remoto</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">scp -p $backupGerado $usuario@$servidor:$pastaRemota</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">exit <span style="color: #cc66cc;color:#800000;">0</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>É importante observar é que o comando scp faz a transferência do arquivo de forma segura por SSH. Para que ele não solicite a senha durante a transferência é preciso que previamente você gere um par de chaves com o ssh-keygen e exporte-a para o servidor. Veja como fazer isso em <a href="http://freebsd.ag.com.br/sessao10_7.html" target="_blank">http://freebsd.ag.com.br/sessao10_7.html</a></p>
<p>Por fim registre o agendamento no cron. Digite  "crontab -e "  e adicione as linhas abaixo:</p>
<div class="igBar"><span id="lactionscript-24"><a href="#" onclick="javascript:showCodeTxt('actionscript-24'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite">
<div id="actionscript-24">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"># agendamentoBackup</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc66cc;color:#800000;">0</span> <span style="color: #cc66cc;color:#800000;">13</span> * * *&nbsp; &nbsp; agendamento.<span style="color: #006600;">sh</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Pronto, seu backup será feito todos os dias às 13h00.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.paulocordeiro.com.br/index.php/2007/09/02/script-para-backups-parte-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>script para backups</title>
		<link>http://www.paulocordeiro.com.br/index.php/2007/07/24/script-paga-backups/</link>
		<comments>http://www.paulocordeiro.com.br/index.php/2007/07/24/script-paga-backups/#comments</comments>
		<pubDate>Tue, 24 Jul 2007 20:45:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://blogs.dominiopublico.com.br/paulocordeiro/index.php/2007/07/24/script-paga-backups/</guid>
		<description><![CDATA[Uma das primícias que qualquer desenvolvedor precisa aprender é que o backup é um grande companheiro. Seja nas horas trágicas em que seu hd queima ou até lhe roubam o laptop ou simplesmente quando você percebe que as ultimas modificações realizadas em determinado projeto ficaram pior que a versão anterior. Nessas horas não tem jeito, [...]]]></description>
			<content:encoded><![CDATA[<p>Uma das primícias que qualquer desenvolvedor precisa aprender é que o backup é um grande companheiro.</p>
<p>Seja nas horas trágicas em que seu hd queima ou até lhe roubam o laptop ou simplesmente quando você percebe que as ultimas modificações realizadas em determinado projeto ficaram pior que a versão anterior. Nessas horas não tem jeito, recorra ao backup.</p>
<p>Quanto se tem muitos projetos para acompanhar fica ainda mais complicado por isso é comum se utilizar scripts para automatizar esse processo. Entretanto, cada projeto tem suas particularidades de forma que ou você armazena todas as pastas do projeto ou cria um script para cada um.</p>
<p>O script abaixo é bastante simples e tem por diferencial utilizar um arquivo com as configurações para o projeto que se deseja backupear permitindo a personalização do backup e facilitando a manutenção do script.</p>
<p>backup.sh</p>
<div class="igBar"><span id="lactionscript-27"><a href="#" onclick="javascript:showCodeTxt('actionscript-27'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite">
<div id="actionscript-27">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">#!/bin/bash</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">############################################</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"># backup de projetos</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"># deve ser usado em conjuto com algum arquivo de</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"># definicoes de backup</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"># por Paulo Cordeiro (paulo@link3.com.br)</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"># 20/07/2007</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"># versao 1.1</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">############################################</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">clear</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#91;</span> <span style="color: #ff0000;">"$#"</span> -<span style="color: #0066CC;">eq</span> <span style="color: #cc66cc;color:#800000;">0</span> -o ! -<span style="color: #0066CC;">e</span> <span style="color: #ff0000;">"$1"</span> <span style="color: #66cc66;">&#93;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">then</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">kdialog --yesno <span style="color: #ff0000;">"O arquivo com as definições do backup não existe ou não foi informado. <span style="color: #000099; font-weight: bold;">\n</span> Deseja informa-lo agora?"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">resposta=$?</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#91;</span> <span style="color: #ff0000;">"$resposta"</span> = <span style="color: #ff0000;">"0"</span> <span style="color: #66cc66;">&#93;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">then</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">defBackup=$<span style="color: #66cc66;">&#40;</span>kdialog --getopenfilename <span style="color: #ff0000;">"$HOME"</span> \ <span style="color: #ff0000;">"*.bkp |Definicoes de Backup"</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">"$defBackup"</span> == <span style="color: #ff0000;">""</span><span style="color: #66cc66;">&#93;</span>; then exit <span style="color: #cc66cc;color:#800000;">2</span>; fi</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">else</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">exit <span style="color: #cc66cc;color:#800000;">2</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">fi</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">else</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">defBackup=$<span style="color: #cc66cc;color:#800000;">1</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">fi</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">projeto=$<span style="color: #66cc66;">&#40;</span>cat $defBackup | grep projetoNome | cut -d <span style="color: #ff0000;">"="</span> -f <span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">descricao=$<span style="color: #66cc66;">&#40;</span>cat $defBackup | grep descricao | cut -d <span style="color: #ff0000;">"="</span> -f <span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">fonte=$<span style="color: #66cc66;">&#40;</span>cat $defBackup | grep fonte | cut -d <span style="color: #ff0000;">"="</span> -f <span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">destino=$<span style="color: #66cc66;">&#40;</span>cat $defBackup | grep destino | cut -d <span style="color: #ff0000;">"="</span> -f <span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">pastasPorData=$<span style="color: #66cc66;">&#40;</span>cat $defBackup | grep pastasPorData | cut -d <span style="color: #ff0000;">"="</span> -f <span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">data</span>=$<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">date</span> +%Y%m%d-%H%M%S<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo <span style="color: #ff0000;">"projeto ---&amp;gt; $projetoNome"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">includefile=$<span style="color: #66cc66;">&#40;</span>mktemp /tmp/$projeto.<span style="color: #b1b100;">in</span>.<span style="color: #006600;">XXXXXX</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">excluirfile=$<span style="color: #66cc66;">&#40;</span>mktemp /tmp/$projeto.<span style="color: #006600;">ex</span>.<span style="color: #006600;">XXXXXX</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo include = $includefile</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#91;</span> <span style="color: #ff0000;">"$pastasPorData"</span> == <span style="color: #ff0000;">"sim"</span> <span style="color: #66cc66;">&#93;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">then</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">destino=<span style="color: #ff0000;">"$destino/$projeto/$(date +%Y)/$(date +%B)/$(date +%d)"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">else</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">destino=$destino/$projeto</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">fi</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">backup_name=$destino/$projeto-$data.<span style="color: #006600;">tar</span>.<span style="color: #006600;">gz</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">cd $fonte</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo <span style="color: #ff0000;">"==========================================================================================="</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo <span style="color: #ff0000;">"Backup do $projeto - $descricao"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo <span style="color: #ff0000;">"==========================================================================================="</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">for</span> infile <span style="color: #b1b100;">in</span> $<span style="color: #66cc66;">&#40;</span>sed <span style="color: #ff0000;">'/incluir-ini/,/incluir-fim/! d; '</span> $defBackup | sed <span style="color: #ff0000;">'1d;$d'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">do</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo $infile&amp;gt;&amp;gt; $includefile</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">done</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sed <span style="color: #ff0000;">'/excluir-ini/,/excluir-fim/! d; '</span> $defBackup | sed <span style="color: #ff0000;">'1d;$d'</span>&amp;gt; $excluirfile</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo pasta $destino</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mkdir <span style="color: #ff0000;">"$destino"</span> -p</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">xterm -<span style="color: #0066CC;">e</span> tar -cvzf $backup_name --exclude-from=$excluirfile $<span style="color: #66cc66;">&#40;</span>cat $includefile<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo <span style="color: #ff0000;">"==========================================================================================="</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo <span style="color: #ff0000;">"Backup gerado em $backup_name"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo <span style="color: #ff0000;">"==========================================================================================="</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">kdialog --msgbox <span style="color: #ff0000;">"Backup gerado em $backup_name"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">rm $includefile</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">rm $excluirfile</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">exit <span style="color: #cc66cc;color:#800000;">0</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Cada projeto precisa ter um arquivo com as os dados para backup:</p>
<p>projeto1.bkp</p>
<div class="igBar"><span id="lactionscript-28"><a href="#" onclick="javascript:showCodeTxt('actionscript-28'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite">
<div id="actionscript-28">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">projetoNome=projeto1</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">descricao=Descricao para o projeto1</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">fonte=/<span style="color: #0066CC;">home</span>/paulo/projetos/projeto1</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">destino=/backup/projetos/projeto1</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">pastasPorData=sim</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#91;</span>incluir-ini<span style="color: #66cc66;">&#93;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">pasta1</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">pasta2</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">docs</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">pasta3</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#91;</span>incluir-fim<span style="color: #66cc66;">&#93;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#91;</span>excluir-ini<span style="color: #66cc66;">&#93;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">*.<span style="color: #006600;">exe</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">*.<span style="color: #006600;">zip</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">*.<span style="color: #006600;">svn</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">*.<span style="color: #000000; font-weight: bold;">class</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">*.~*</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#91;</span>excluir-fim<span style="color: #66cc66;">&#93;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>a utilização é: backup.sh projeto1.bkp</p>
<p>O script utiliza duas chamadas ao kdialog do KDE que podem ser trocadas pelo xdialog ou simplesmente ser removidas.</p>
<p>Depois explicarei alguns detalhes do script e mostrarei como agendar backup automático para  um servidor remoto.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.paulocordeiro.com.br/index.php/2007/07/24/script-paga-backups/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ICEFaces, Ajax e JSF 1.2</title>
		<link>http://www.paulocordeiro.com.br/index.php/2007/07/11/icefaces-ajax-e-jsf-12/</link>
		<comments>http://www.paulocordeiro.com.br/index.php/2007/07/11/icefaces-ajax-e-jsf-12/#comments</comments>
		<pubDate>Wed, 11 Jul 2007 16:43:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AJAX]]></category>

		<guid isPermaLink="false">http://blogs.dominiopublico.com.br/paulocordeiro/index.php/2007/07/11/icefaces-ajax-e-jsf-12/</guid>
		<description><![CDATA[O pessoal da ICESoft anunciou o release 1.6 do ICEFaces. O ICEFaces é um conjunto de componentes ricos para desenvolvimento web com JSF e AJAX. Há alguns meses atrás tentei usa-lo em um novo projeto, mas desisti ao perceber que não poderia usa-lo junto com o glassfish. Essa incompatibilidade deve-se ao fato de o glassfish [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.icefaces.org/docs/v1_5/htmlguide/gettingstarted/ICEfaces-Logo-for-HTML-Docs.gif" align="top" height="105" width="279" /></p>
<p>O pessoal da ICESoft anunciou o release 1.6 do ICEFaces. O ICEFaces é um conjunto de componentes ricos para desenvolvimento web com <a href="http://java.sun.com/javaee/javaserverfaces/" target="_blank">JSF</a> e AJAX.</p>
<p>Há alguns meses atrás tentei usa-lo em um novo projeto, mas desisti ao perceber que não poderia usa-lo junto com o <a href="http://java.sun.com/javaee/javaserverfaces/" target="_blank">glassfish.</a> Essa incompatibilidade deve-se ao fato de o glassfish usar o JSF 1.2 por padrão e o ICEFaces a versão 1.1. Agora essa incompatibilidade acaba pois uma das novidades dessa nova versão é justamente a compatibilização com o JSF 1.2. Além desta, outras melhorias foram feitas como integração ao JBoss Seam 1.2.1, Liferay Portal, Webtide Jetty, dentre outras.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.paulocordeiro.com.br/index.php/2007/07/11/icefaces-ajax-e-jsf-12/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Recuperando um datasource no Glassfish a partir de um cliente desktop</title>
		<link>http://www.paulocordeiro.com.br/index.php/2007/05/30/recuperando-um-datasource-no-glassfish-a-partir-de-um-cliente-desktop/</link>
		<comments>http://www.paulocordeiro.com.br/index.php/2007/05/30/recuperando-um-datasource-no-glassfish-a-partir-de-um-cliente-desktop/#comments</comments>
		<pubDate>Wed, 30 May 2007 20:58:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://blogs.dominiopublico.com.br/paulocordeiro/index.php/2007/05/30/recuperando-um-datasource-no-glassfish-a-partir-de-um-cliente-desktop/</guid>
		<description><![CDATA[No post anterior falei como recuperar um datasource no Glassfish a partir de um client web. Hoje faleremos como fazer a mesma coisa. só que a partir de um client desktop. O processo consiste em iniciar o contexto com atributos adicionais que auxiliem a aplicação a procurar de forma correta e encontrar o recurso solicitado. [...]]]></description>
			<content:encoded><![CDATA[<p>No post <a href="http://blogs.dominiopublico.com.br/paulocordeiro/index.php/2007/05/25/recuperando-um-datasource-no-glassfish/">anterior</a> falei como recuperar um datasource no Glassfish a partir de um client web. Hoje faleremos como fazer a mesma coisa. só que a partir de um client desktop.</p>
<p>O processo consiste em iniciar o contexto com atributos adicionais que auxiliem a aplicação a procurar de forma correta e encontrar o recurso solicitado.</p>
<div class="igBar"><span id="ljava-32"><a href="#" onclick="javascript:showCodeTxt('java-32'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite">
<div id="java-32">
<div class="java">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">public</span> javax.<span style="color: #006600;">sql</span>.<span style="color: #006600;">DataSource</span> getDataSource<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">try</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.google.com/search?q=allinurl%3AProperties+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Properties</span></a> props = <span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=allinurl%3AProperties+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Properties</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">props.<span style="color: #006600;">setProperty</span><span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AContext+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Context</span></a>.<span style="color: #006600;">INITIAL_CONTEXT_FACTORY</span>, <span style="color: #ff0000;">"com.sun.enterprise.naming.SerialInitContextFactory"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">props.<span style="color: #006600;">setProperty</span><span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AContext+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Context</span></a>.<span style="color: #006600;">URL_PKG_PREFIXES</span>, <span style="color: #ff0000;">"com.sun.enterprise.naming"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">props.<span style="color: #006600;">setProperty</span><span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AContext+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Context</span></a>.<span style="color: #006600;">STATE_FACTORIES</span>, <span style="color: #ff0000;">"com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// servidor</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">props.<span style="color: #006600;">setProperty</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"org.omg.CORBA.ORBInitialHost"</span>, <span style="color: #ff0000;">"localhost"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// porta do servidor</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">props.<span style="color: #006600;">setProperty</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"org.omg.CORBA.ORBInitialPort"</span>, <span style="color: #ff0000;">"3700"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.google.com/search?q=allinurl%3AInitialContext+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">InitialContext</span></a> initialContext = <span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=allinurl%3AInitialContext+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">InitialContext</span></a><span style="color: #66cc66;">&#40;</span>props<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">DataSource datasource = <span style="color: #66cc66;">&#40;</span>DataSource<span style="color: #66cc66;">&#41;</span> initialContext.<span style="color: #006600;">lookup</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"jdbc/seuDataSource"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">return</span> datasource;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3ANamingException+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">NamingException</span></a> ex<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ex.<span style="color: #006600;">printStackTrace</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">null</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Os atributos:</p>
<div class="igBar"><span id="ljava-33"><a href="#" onclick="javascript:showCodeTxt('java-33'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite">
<div id="java-33">
<div class="java">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">props.<span style="color: #006600;">setProperty</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"org.omg.CORBA.ORBInitialHost"</span>, <span style="color: #ff0000;">"localhost"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">props.<span style="color: #006600;">setProperty</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"org.omg.CORBA.ORBInitialPort"</span>, <span style="color: #ff0000;">"3700"</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>são opcionais e só precisam ser utilizados se o servidor estiver em um endereço diferente do cliente ou porta for diferente da padrão.</p>
<p>Algo que é importante observar é que é necessário que o classpath da aplicação client esteja configurado com os seguintes pacotes:</p>
<div class="igBar"><span id="lcode-34"><a href="#" onclick="javascript:showCodeTxt('code-34'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite">
<div id="code-34">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$GLASSFISH_HOME/lib/appserv-admin.<span style="">jar</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$GLASSFISH_HOME/lib/appserv-rt.<span style="">jar</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$GLASSFISH_HOME/lib/install/applications/jmsra/imqjmsra.<span style="">jar</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$GLASSFISH_HOME/lib/javaee.<span style="">jar</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>além, é claro, do pacote com o driver JDBC para banco de dados que você está tentando acessar.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.paulocordeiro.com.br/index.php/2007/05/30/recuperando-um-datasource-no-glassfish-a-partir-de-um-cliente-desktop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Recuperando um datasource no Glassfish</title>
		<link>http://www.paulocordeiro.com.br/index.php/2007/05/25/recuperando-um-datasource-no-glassfish/</link>
		<comments>http://www.paulocordeiro.com.br/index.php/2007/05/25/recuperando-um-datasource-no-glassfish/#comments</comments>
		<pubDate>Fri, 25 May 2007 20:03:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://blogs.dominiopublico.com.br/paulocordeiro/index.php/2007/05/25/recuperando-um-datasource-no-glassfish/</guid>
		<description><![CDATA[Quando se está trabalhando com um servidor de aplicações, é comum a necessidade de se acessar diretamente os recursos do banco de dados. Mesmo quando se está usando frameworks de persistência como JPA ou mesmo Entities Beans pode-se haver a necessidade de fazer alguma consulta direta ao banco de dados. Nesse caso a melhor opção [...]]]></description>
			<content:encoded><![CDATA[<p>Quando se está trabalhando com um servidor de aplicações, é comum a necessidade de  se acessar diretamente os recursos do banco de dados.</p>
<p>Mesmo quando se está usando frameworks de persistência como JPA ou mesmo Entities Beans pode-se haver a necessidade de fazer alguma consulta direta ao banco de dados. Nesse caso a melhor opção recuperar o datasource registrado no servidor.</p>
<p>Os passos são os seguintes:<br />
No arquivo web.xml registre o recurso que deseja recuperar:</p>
<div class="igBar"><span id="lxml-38"><a href="#" onclick="javascript:showCodeTxt('xml-38'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite">
<div id="xml-38">
<div class="xml">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;resource</span>-ref<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;res</span>-ref-name<span style="font-weight: bold; color: black;">&gt;</span></span>jdbc/seuDataSource<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/res</span>-ref-name<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;res</span>-type<span style="font-weight: bold; color: black;">&gt;</span></span>javax.sql.DataSource<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/res</span>-type<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;res</span>-auth<span style="font-weight: bold; color: black;">&gt;</span></span>Container<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/res</span>-auth<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;res</span>-sharing-scope<span style="font-weight: bold; color: black;">&gt;</span></span>Shareable<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/res</span>-sharing-scope<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/resource</span>-ref<span style="font-weight: bold; color: black;">&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
Após isso só é necessário buscar no contexto seu datasource. Alguma coisa mais ou menos assim:</p>
<div class="igBar"><span id="ljava-39"><a href="#" onclick="javascript:showCodeTxt('java-39'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite">
<div id="java-39">
<div class="java">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">public</span> javax.<span style="color: #006600;">sql</span>.<span style="color: #006600;">DataSource</span> getDataSource<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.google.com/search?q=allinurl%3AInitialContext+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">InitialContext</span></a> initialContext;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">try</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">initialContext = <span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=allinurl%3AInitialContext+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">InitialContext</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">DataSource datasource = <span style="color: #66cc66;">&#40;</span>DataSource<span style="color: #66cc66;">&#41;</span> initialContext.<span style="color: #006600;">lookup</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"java:comp/env/jdbc/seuDataSource"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">return</span> datasource;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3ANamingException+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">NamingException</span></a> e<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">e.<span style="color: #006600;">printStackTrace</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">null</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>e para usar a conexão  basta:</p>
<div class="igBar"><span id="ljava-40"><a href="#" onclick="javascript:showCodeTxt('java-40'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite">
<div id="java-40">
<div class="java">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">datasource.<span style="color: #006600;">getConnection</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.paulocordeiro.com.br/index.php/2007/05/25/recuperando-um-datasource-no-glassfish/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

