
<?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>pgt &#187; Java &amp; Co.</title>
	<atom:link href="http://pgt.de/category/java-stuff/feed/" rel="self" type="application/rss+xml" />
	<link>http://pgt.de</link>
	<description>t3chnology scouting GmbH</description>
	<lastBuildDate>Wed, 09 May 2012 11:54:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>GWT-JSF &#8211; Wahl-o-Mat</title>
		<link>http://pgt.de/2011/05/05/gwt-jsf-wahl-o-mat/</link>
		<comments>http://pgt.de/2011/05/05/gwt-jsf-wahl-o-mat/#comments</comments>
		<pubDate>Thu, 05 May 2011 07:15:22 +0000</pubDate>
		<dc:creator>P.G.Taboada</dc:creator>
				<category><![CDATA[conferences]]></category>
		<category><![CDATA[GWT]]></category>
		<category><![CDATA[Java & Co.]]></category>
		<category><![CDATA[gwt]]></category>
		<category><![CDATA[jsf]]></category>
		<category><![CDATA[politics]]></category>

		<guid isPermaLink="false">http://pgt.de/?p=885</guid>
		<description><![CDATA[<p>Die kleine Entscheidungshilfe, bzw. die Vortragsfolien zu unserem Vortrag auf der Jax 2011.</p> <p></p> <p>Oder direkt hier: http://bit.ly/gwt-jsf-wahlomat</p> ]]></description>
			<content:encoded><![CDATA[<p>Die kleine Entscheidungshilfe, bzw. die Vortragsfolien zu unserem Vortrag auf der Jax 2011.</p>
<p><iframe frameborder='0' style='width:460px;height:375px;' src='http://public.iwork.com/embed/?d=wahlomat-gwt-jsf.key&#038;a=p51619782&#038;h=768&#038;w=1024&#038;sw=458'></iframe></p>
<p>Oder direkt hier: <a href="http://bit.ly/gwt-jsf-wahlomat" target="_blank">http://bit.ly/gwt-jsf-wahlomat</a></p>
]]></content:encoded>
			<wfw:commentRss>http://pgt.de/2011/05/05/gwt-jsf-wahl-o-mat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java 5 &#8211; end of service</title>
		<link>http://pgt.de/2009/11/05/java-5-end-of-service/</link>
		<comments>http://pgt.de/2009/11/05/java-5-end-of-service/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 12:38:15 +0000</pubDate>
		<dc:creator>P.G.Taboada</dc:creator>
				<category><![CDATA[Java & Co.]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[sun]]></category>

		<guid isPermaLink="false">http://pgt.de/?p=698</guid>
		<description><![CDATA[<p>Schon gelesen?</p> <p>End of Service Life für Java 5</p> <p>Die 2004 mit großen Sprachänderungen eingeführte fünfte Java-Version hat letztes Wochenende das sogenannte &#8220;End of Service Life&#8221; (EOSL) erreicht. Sun empfiehlt, um auch zukünftig kritische Fehlerbehebungen zu erhalten, die Anwendungen entweder auf das neueste Update der Java Standard Edition (Java SE) zu migrieren oder den [...]]]></description>
			<content:encoded><![CDATA[<p>Schon <a href="http://www.heise.de/developer/meldung/End-of-Service-Life-fuer-Java-5-847507.html" target="_blank">gelesen</a>?</p>
<blockquote><p>End of Service Life für Java 5</p>
<p>Die 2004 mit großen Sprachänderungen eingeführte fünfte Java-Version hat letztes Wochenende das sogenannte &#8220;End of Service Life&#8221; (EOSL) erreicht. Sun empfiehlt, um auch zukünftig kritische Fehlerbehebungen zu erhalten, die Anwendungen entweder auf das neueste Update der Java Standard Edition (Java SE) zu migrieren oder den &#8220;Java SE Support for Business&#8221; in Anspruch zu nehmen, der bis zu 15 Jahre Gewährleistung für ältere Java-Versionen</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://pgt.de/2009/11/05/java-5-end-of-service/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Eclipse Galileo SR1</title>
		<link>http://pgt.de/2009/09/24/eclipse-galileo-sr1/</link>
		<comments>http://pgt.de/2009/09/24/eclipse-galileo-sr1/#comments</comments>
		<pubDate>Thu, 24 Sep 2009 16:42:55 +0000</pubDate>
		<dc:creator>P.G.Taboada</dc:creator>
				<category><![CDATA[Java & Co.]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[oss]]></category>

		<guid isPermaLink="false">http://pgt.de/?p=655</guid>
		<description><![CDATA[<p> I just started downloading the SR1 release of Eclipse Galileo. According to bugzilla, there were 241 bugs fixed with this release.</p> <p>Can&#8217;t wait for the download to finish to check if Eclipse is working better on Snow Leopard&#8230;</p> ]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" src="http://www.eclipse.org/donate/images/friendslogo200.jpg" alt="" width="200" height="106" /><br />
I just started downloading the SR1 release of Eclipse Galileo. According to bugzilla, there were <a href="https://bugs.eclipse.org/bugs/buglist.cgi?product=JDT&amp;product=PDE&amp;product=Platform&amp;product=Equinox&amp;target_milestone=3.5.1&amp;resolution=FIXED&amp;order=bugs.bug_id" target="_blank">241 bugs fixed with this release</a>.</p>
<p>Can&#8217;t wait for the download to finish to check if Eclipse is working better on Snow Leopard&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://pgt.de/2009/09/24/eclipse-galileo-sr1/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>W-JAX 2009 Vorträge</title>
		<link>http://pgt.de/2009/09/22/w-jax09-events/</link>
		<comments>http://pgt.de/2009/09/22/w-jax09-events/#comments</comments>
		<pubDate>Tue, 22 Sep 2009 09:54:21 +0000</pubDate>
		<dc:creator>P.G.Taboada</dc:creator>
				<category><![CDATA[conferences]]></category>
		<category><![CDATA[GWT]]></category>
		<category><![CDATA[Java & Co.]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[cep]]></category>
		<category><![CDATA[esper]]></category>
		<category><![CDATA[gwt]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[osgi]]></category>
		<category><![CDATA[spring]]></category>

		<guid isPermaLink="false">http://pgt.de/?p=613</guid>
		<description><![CDATA[<p> W-JAX 2009</p> <p>Die Konferenz für Java, Enterprise Architekturen &#38; SOA</p> <p>Die W-JAX ist die Konferenz für ganzheitliches technisches Know-how im Enterprise- und Webumfeld. Hier kommen die besten Experten Europas zusammen, um ihr Wissen und ihre Erfahrung an die Teilnehmer weiterzugeben. Durch ihren einzigartigen Mix an Themen verleiht die W-JAX alljährlich der Java Enterprise [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-662" style="margin: 10px;" title="wjax09_button_speaker_de" src="http://pgt.de/wp-content/uploads/2009/09/wjax09_button_speaker_de.jpg" alt="wjax09_button_speaker_de" width="128" height="128" /><br />
<strong><em>W-JAX 2009</em></strong></p>
<p><em>Die Konferenz für Java, Enterprise Architekturen &amp; SOA</em></p>
<blockquote><p>Die W-JAX ist die Konferenz für ganzheitliches technisches Know-how im Enterprise- und Webumfeld. Hier kommen die besten Experten Europas zusammen, um ihr Wissen und ihre Erfahrung an die Teilnehmer weiterzugeben. Durch ihren einzigartigen Mix an Themen verleiht die W-JAX alljährlich der Java Enterprise Community die entscheidenden Impulse.</p></blockquote>
<p><strong>Google Web Toolkit &#8211; Making a Better Web 2.0</strong><br />
Speaker: Papick G. Taboada</p>
<blockquote><p>Mit Adwords und Google Wave sind die ersten großen GWT basierten Anwendungen von Google erschienen. Mit einem optimierenden Kompiler und pfiffige Codegeneratoren werden mit GWT maßgeschneiderte JavaScript Anwendungen erstellt, die Entwicklung findet allerdings in Java statt. In dem Vortrag werden Konzepte, Neuigkeiten aus 2.0 und die aus Adwords gewonnenen Architektur &#8220;Best Practices&#8221; vorgestellt.</p></blockquote>
<p><strong>SpringSource dm Server: Fitness für die Webanwendungen</strong><br />
Speaker: Agim Emruli, Papick G. Taboada</p>
<blockquote><p>Java-EE-Webanwendungen tragen Deployment-bedingt eine große Menge an Bibliotheken mit sich. Mit OSGi werden dank einem standardisierten Modularisierungskonzept neue Wege gegangen. Lernen Sie in der Session die Möglichkeiten der Modularisierung in Java-EE-Webanwendungen auf dem OSS SpringSource dm Server kennen, damit schwergewichtige und monolithische Deployments der Vergangenheit angehören.</p></blockquote>
<p><strong>EDA in der Businessintegration</strong><br />
Speaker: Christian Dedek, Papick G. Taboada</p>
<blockquote><p>Integrationsszenarien mit ereignisgesteuerten Architekturansätzen in Java umsetzen? Dieser Vortrag bietet Ihnen eine Einführung in EDA und Complex Event Processing (CEP) und stellt den Zusammenhang zwischen EDA und SOA her. Darüber hinaus veranschaulicht er die Architektur und den Aufbau von Esper und zeigt CEP-Einsatzszenarien.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://pgt.de/2009/09/22/w-jax09-events/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML Editor for Eclipse</title>
		<link>http://pgt.de/2009/09/21/html-editor-for-eclipse/</link>
		<comments>http://pgt.de/2009/09/21/html-editor-for-eclipse/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 12:19:11 +0000</pubDate>
		<dc:creator>P.G.Taboada</dc:creator>
				<category><![CDATA[GWT]]></category>
		<category><![CDATA[Java & Co.]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[gwt]]></category>

		<guid isPermaLink="false">http://pgt.de/?p=605</guid>
		<description><![CDATA[<p>Thanks for the tip:</p> <p>Amateras HTML Editor for Eclipse</p> <p>EclipseHTMLEditor is an Eclipse Plugin for HTML / JSP / XML / CSS / DTD / JavaScript editing. This plugin is required by StrutsIDE and FacesIDE.</p> HTML/JSP/XML/CSS/DTD/JavaScript Highlighting HTML/JSP Preview HTML/JSP/XML Validation Contents Assist Wizards for creating HTML/JSP/XML files And many more powerful features&#8230; <p>Works [...]]]></description>
			<content:encoded><![CDATA[<p>Thanks for the tip:</p>
<p><a href="http://amateras.sourceforge.jp/cgi-bin/fswiki_en/wiki.cgi?page=EclipseHTMLEditor" target="_blank">Amateras HTML Editor for Eclipse</a></p>
<blockquote><p>EclipseHTMLEditor is an Eclipse Plugin for HTML / JSP / XML / CSS / DTD / JavaScript editing. This plugin is required by StrutsIDE and FacesIDE.</p>
<ul>
<li>HTML/JSP/XML/CSS/DTD/JavaScript Highlighting</li>
<li>HTML/JSP Preview</li>
<li>HTML/JSP/XML Validation</li>
<li>Contents Assist</li>
<li>Wizards for creating HTML/JSP/XML files</li>
<li>And many more powerful features&#8230;</li>
</ul>
</blockquote>
<p>Works fine with Eclipse Galileo.<br />
I am using it now along with the Google Eclipse Plugin for GWT development/ training.</p>
]]></content:encoded>
			<wfw:commentRss>http://pgt.de/2009/09/21/html-editor-for-eclipse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Non invasive GWT and Spring integration (reloaded)</title>
		<link>http://pgt.de/2009/07/17/non-invasive-gwt-and-spring-integration-reloaded/</link>
		<comments>http://pgt.de/2009/07/17/non-invasive-gwt-and-spring-integration-reloaded/#comments</comments>
		<pubDate>Fri, 17 Jul 2009 20:14:22 +0000</pubDate>
		<dc:creator>P.G.Taboada</dc:creator>
				<category><![CDATA[GWT]]></category>
		<category><![CDATA[Java & Co.]]></category>
		<category><![CDATA[gwt]]></category>
		<category><![CDATA[spring]]></category>

		<guid isPermaLink="false">http://pgt.de/?p=431</guid>
		<description><![CDATA[<p class="wp-caption-text">New project layout</p> <p>Here is my overdue update to my Non invasive GWT and Spring integration blog post from early 2008. Since then we have had the GWT 1.6 and GWT 1.7 releases: One of the biggest changes to GWT 1.6 is a new project structure. The old output format has been replaced [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_454" class="wp-caption alignright" style="width: 219px"><a href="http://pgt.de/wp-content/uploads/2009/07/Bild-14.png"><img src="http://pgt.de/wp-content/uploads/2009/07/Bild-14-209x300.png" alt="New project layout" title="Project layout" width="209" height="300" class="size-medium wp-image-454" /></a><p class="wp-caption-text">New project layout</p></div>


<p>Here is my overdue update to my <a href="http://pgt.de/2008/02/14/non-invasive-gwt-and-spring-integration/" target="_blank">Non invasive GWT and Spring integration</a> blog post from early 2008. Since then we have had the <a href="http://code.google.com/intl/de-DE/webtoolkit/doc/1.6/ReleaseNotes_1_6.html" target="_blank">GWT 1.6</a> and <a href="http://code.google.com/intl/de-DE/webtoolkit/doc/1.7/ReleaseNotes_1_7.html" target="_blank">GWT 1.7</a> releases:

<blockquote>One of the biggest changes to GWT 1.6 is a new project structure. The old output format has been replaced by the standard Java web app "expanded war" format, and the actual directory name does default to "/war". Note that the war directory is not only for compiler output; it is also intended to contain handwritten static resources that you want to be included in your webapp alongside GWT modules (that is, things you'd want to version control).</blockquote>

<p>As a matter of fact, now we finally can (must) manage the web.xml file ourselves:


<blockquote>Projects with server-side code (GWT RPC) must configure a web.xml file at /war/WEB-INF/web.xml. This web.xml file must define and publish any servlets associated with the web application.
</blockquote>

<p> This is a little pain for really much gain, and that's why I am writing this post after all...

<span id="more-431"></span>

<p>

<p>Starting a Springframework ApplicationContext in a Java EE compiient web-application is well known and documented <a href="http://static.springsource.org/spring/docs/2.5.x/reference/beans.html#beans-factory-scopes-other-web-configuration" target="_blank">in the Springframework reference</a>:


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #00bbdd;">&lt;!DOCTYPE web-app</span>
<span style="color: #00bbdd;">    PUBLIC &quot;-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN&quot;</span>
<span style="color: #00bbdd;">    &quot;http://java.sun.com/dtd/web-app_2_3.dtd&quot;&gt;</span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;web-app<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;context-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>contextConfigLocation<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/WEB-INF/spring-conf.xml<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/context-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;context-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>log4jConfigLocation<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/WEB-INF/log4j.xml<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/context-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;listener<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;listener-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.springframework.web.util.Log4jConfigListener<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/listener-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/listener<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;listener<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;listener-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.springframework.web.context.ContextLoaderListener<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/listener-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/listener<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
	<span style="color: #808080; font-style: italic;">&lt;!-- Servlets... --&gt;</span>
&nbsp;
	<span style="color: #808080; font-style: italic;">&lt;!-- Default page to serve.. --&gt;</span>
&nbsp;
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/web-app<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>




<p>There aren't many beans in my spring configuration files as I am using annotation based configuration in my apps. Here a sample spring confuguration taken from one of my sample projects:


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;beans</span> </span>
<span style="color: #009900;">    <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://www.springframework.org/schema/beans&quot;</span></span>
<span style="color: #009900;">	<span style="color: #000066;">xmlns:xsi</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span> </span>
<span style="color: #009900;">	<span style="color: #000066;">xmlns:context</span>=<span style="color: #ff0000;">&quot;http://www.springframework.org/schema/context&quot;</span></span>
<span style="color: #009900;">	<span style="color: #000066;">xsi:schemaLocation</span>=<span style="color: #ff0000;">&quot;</span>
<span style="color: #009900;">	     http://www.springframework.org/schema/beans     http://www.springframework.org/schema/beans/spring-beans-2.5.xsd</span>
<span style="color: #009900;">         http://www.springframework.org/schema/context  http://www.springframework.org/schema/context/spring-context-2.5.xsd</span>
<span style="color: #009900;">    &quot;</span></span>
<span style="color: #009900;">	<span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;context:annotation-config</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;context:component-scan</span> <span style="color: #000066;">base-package</span>=<span style="color: #ff0000;">&quot;x.y.gwt.hellospring.server&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;basicTextEncryptor&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.jasypt.encryption.pbe.StandardPBEStringEncryptor&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;algorithm&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;PBEWithMD5AndDES&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;keyObtentionIterations&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;1000&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;password&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;s0990w8eh0c8hf08aefh8hGf9egf9aefea8f&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/beans<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>




<p>So this is (despite of the missing log4j.xml config) the configuration setup I am using on GWT 1.6 and GWT 1.7 projects in order to bootstrap an application context.

<p>The next step is to implement the dependency injection of spring managed beans into my GWT RPC serverside implementation. I will be using the annotation based config provided by the Springframework. 

<p>This is how the dependency injection in my GWT RPC services looks like:


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #008000; font-style: italic; font-weight: bold;">/**
 * The server side implementation of the RPC service.
 */</span>
@SuppressWarnings<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;serial&quot;</span><span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> EncodingServiceImpl 
<span style="color: #000000; font-weight: bold;">extends</span> AutoinjectingRemoteServiceServlet
<span style="color: #000000; font-weight: bold;">implements</span> EncodingService <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">private</span> IEncodingService encodingService<span style="color: #339933;">;</span>
&nbsp;
	@Autowired
	@Required
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setEncodingService<span style="color: #009900;">&#40;</span>IEncodingService encodingService<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">encodingService</span> <span style="color: #339933;">=</span> encodingService<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Service implementation ommited here...</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>




<p>EncodingServiceImpl is the server side GWt RPC implementation, while EncodingService is the GWT service I am setting up. The managed bean in my spring configuration implements IEncodingService (and uses the great <a href="http://www.jasypt.org/"  target="_blank">jasypt</a> lib). I am using the annotations to configure the dependency injection.

<p>All I have to do now, is "autowire" my RPC servlet during initialization. Since this is not going to be the only GWT RPC service needing dependency injection I introduced the AutoinjectingRemoteServiceServlet class:


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> AutoinjectingRemoteServiceServlet <span style="color: #000000; font-weight: bold;">extends</span> RemoteServiceServlet <span style="color: #009900;">&#123;</span>
&nbsp;
	@Override
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> init<span style="color: #009900;">&#40;</span>ServletConfig config<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> ServletException <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">init</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		WebApplicationContext ctx <span style="color: #339933;">=</span> WebApplicationContextUtils
				.<span style="color: #006633;">getRequiredWebApplicationContext</span><span style="color: #009900;">&#40;</span>config.<span style="color: #006633;">getServletContext</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		AutowireCapableBeanFactory beanFactory <span style="color: #339933;">=</span> ctx
				.<span style="color: #006633;">getAutowireCapableBeanFactory</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		beanFactory.<span style="color: #006633;">autowireBean</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>




<p> There is not much to say about this class. During the initializiation of the RPC Servlet (remember: GWT uses servlets as the foundation technology on the server side implementation of GWT RPC. Being so, the GWT RPC service implementation "lives" in the same lifecycle as any other servlet. I am using the initialization step to get a reference to the ApplicationContext. After that I use the autowire bean method to autowire the servlet automatically.

<p>If you prefer to directly expose spring beans, you should have a look at <a href="http://code.google.com/p/spring4gwt/"  target="_blank">http://code.google.com/p/spring4gwt/</a>.



 ]]></content:encoded>
			<wfw:commentRss>http://pgt.de/2009/07/17/non-invasive-gwt-and-spring-integration-reloaded/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Compiler-Warnings. Mal hü, mal hott?</title>
		<link>http://pgt.de/2009/07/09/compiler-warnings-mal-hu-mal-hott/</link>
		<comments>http://pgt.de/2009/07/09/compiler-warnings-mal-hu-mal-hott/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 08:55:10 +0000</pubDate>
		<dc:creator>P.G.Taboada</dc:creator>
				<category><![CDATA[From nerds to nerds]]></category>
		<category><![CDATA[Java & Co.]]></category>

		<guid isPermaLink="false">http://pgt.de/?p=402</guid>
		<description><![CDATA[<p>Ich habe in Eclipse 3.4.2 unter &#8220;Compiler&#8221; &#8220;Errors/ und Warnings&#8221; folgende Einstellungen:</p> <p>Es geht mir um die Einstellung &#8220;Type parameter hides another type&#8220;.</p> <p>Folgerichtig bekomme ich an diesem Codeschnipsel ein paar Warnungen:</p> <p></p> <p>Und so lautet die Warnung:</p> <p></p> <p>Was ja im Prinzip richtig ist, aber gewollt, schliesslich verwende ich ja &#8220;this.&#8221; in meiner [...]]]></description>
			<content:encoded><![CDATA[<p>Ich habe in Eclipse 3.4.2 unter &#8220;Compiler&#8221; &#8220;Errors/ und Warnings&#8221; folgende Einstellungen:</p>
<p><img class="size-full wp-image-403 alignnone" title="eclipse compiler settings" src="http://pgt.de/wp-content/uploads/2009/07/Bild-12.png" alt="eclipse compiler settings" width="861" height="508" />Es geht mir um die Einstellung &#8220;<strong>Type parameter hides another type</strong>&#8220;.</p>
<p>Folgerichtig bekomme ich an diesem Codeschnipsel ein paar Warnungen:</p>
<p><img class="aligncenter size-full wp-image-407" title="warnings" src="http://pgt.de/wp-content/uploads/2009/07/Bild-5.png" alt="warnings" width="636" height="127" /></p>
<p>Und so lautet die Warnung:</p>
<p><img class="alignnone size-full wp-image-408" title="Warnung &quot;hiding&quot;" src="http://pgt.de/wp-content/uploads/2009/07/Bild-6.png" alt="Warnung &quot;hiding&quot;" width="907" height="33" /></p>
<p>Was ja im Prinzip richtig ist, aber gewollt, schliesslich verwende ich ja &#8220;this.&#8221; in meiner Methode um an die Instanzattribute zu kommen. Ich arbeite ungerne mit Unterstrichen in Variablennamen (in etwa so: _invokedMethod) und die Unterscheidung zwischen lokalen Variablen und Instanzvariablen wird über die Referenz deutlich.</p>
<p>Immerhin (oder seltsamerweise?) wird diese Warnung nicht bei Setter-Methoden angezeigt, dort wird es <strong>geduldet:</strong></p>
<p><strong><img class="alignnone size-full wp-image-412" title="Geduldet!!!" src="http://pgt.de/wp-content/uploads/2009/07/Bild-10.png" alt="Geduldet!!!" width="538" height="117" /></strong></p>
<p>Sehe keinen Sinn darin, so eine Warnung zu bekommen und würde  spontan in den Compilereinstellungen hier auf &#8220;Ignore&#8221; umstellen, zumindest solange meine Parameter einer nicht Setter-Methode so heissen wie meine Attribute. Ich sehe ja vor lauter Wellen das Meer nicht mehr!</p>
<p>Denkfehler?</p>
<p>&#8212;</p>
<p>Es gibt eine bereits viel sinnvollere Warnung, und zwar wenn ich &#8220;this.&#8221; nicht benutze. Dann aber auch in der Zeile meiner Zuweisung&#8230; So wird die sinnlose Zuweisung im Code angezeigt:</p>
<p><img class="alignnone size-full wp-image-409" title="So ist gut!" src="http://pgt.de/wp-content/uploads/2009/07/Bild-7.png" alt="So ist gut!" width="633" height="122" /></p>
<p>Das ist auch gut so. Hier noch die Warnungen die man an dieser Stelle bekommt:</p>
<p><img class="alignnone size-full wp-image-410" title="W1" src="http://pgt.de/wp-content/uploads/2009/07/Bild-8.png" alt="W1" width="433" height="35" /></p>
<p><img class="alignnone size-full wp-image-411" title="W2" src="http://pgt.de/wp-content/uploads/2009/07/Bild-9.png" alt="W2" width="436" height="26" /></p>
<p>Das ist eine Sinnvolle Warnung und sollte IMHO von Warning auf Error umgestellt werden.</p>
<p>Freue mich auf Kommentare!</p>
]]></content:encoded>
			<wfw:commentRss>http://pgt.de/2009/07/09/compiler-warnings-mal-hu-mal-hott/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SpringSource Produktivitätsoffensive</title>
		<link>http://pgt.de/2009/05/09/springsource-produktivitatsoffensive/</link>
		<comments>http://pgt.de/2009/05/09/springsource-produktivitatsoffensive/#comments</comments>
		<pubDate>Sat, 09 May 2009 09:11:19 +0000</pubDate>
		<dc:creator>P.G.Taboada</dc:creator>
				<category><![CDATA[Java & Co.]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[people and business]]></category>
		<category><![CDATA[spring]]></category>

		<guid isPermaLink="false">http://pgt.de/?p=327</guid>
		<description><![CDATA[SpringSource, Spring Roo, SpringSource Tool Suite [...]]]></description>
			<content:encoded><![CDATA[<p>Diese Woche haben wir zwei großartige Nachrichten aus der SpringSource Ecke bekommen:</p>
<ul>
<li><a href="http://www.springsource.org/roo">Spring Roo</a></li>
<li><a href="http://www.springsource.org/node/1394">SpringSource Tool Suite is Now Free!</a></li>
</ul>
<p><div id="attachment_328" class="wp-caption alignright" style="width: 310px"><img class="size-medium wp-image-328" title="STS" src="http://pgt.de/wp-content/uploads/2009/05/stsscreenshot03-300x210.jpg" alt="stsscreenshot03" width="300" height="210" /><p class="wp-caption-text">STS</p></div></p>
<p>Bei <em>STS</em> handelt es sich um eine Eclipse-basierte IDE, die bisher nur den &#8220;Enterprise- Kunden&#8221; vorbehalten war. Es ist die Zusammenstellung von Spring IDE und andere Plugins aus der SpringSource Softwareschmiede:</p>
<blockquote><p>Key Highlights von der <a href="http://www.springsource.com/products/sts">Produktseite</a>:</p>
<ul>
<li> <strong>Greater Productivity</strong></li>
<li><strong>OSGi Made Easy</strong></li>
<li><strong>Developer Onramp to Virtualization</strong></li>
<li><strong>Task Focused Development</strong></li>
<li><strong>Guided Learning</strong></li>
</ul>
</blockquote>
<p>Bei <em>Spring Roo</em> handelt es sich letztendlich um die Umsetzung von Rod Johnsons Aussage:</p>
<blockquote><p>&#8220;<em>We (the Java EE Community) are not picking the low hanging fruits</em>&#8220;</p></blockquote>
<p>Und damit hat er recht: wir haben mit <em>Java EE</em> sehr mächtige Frameworks, scheitern aber kläglich daran, daraus ordentliche &#8220;<em>full stack application frameworks</em>&#8221; zu bauen. Die Quittung haben wir mit &#8220;<em>Ruby on Rails</em>&#8221; und Konsorten bekommen: erst haben wir sie belächelt, dann diese für Prototypen eingesetzt. Jetzt  lautet es &#8220;success stories&#8221; aus allen Ecken. Mit <em>Spring Roo</em> bekommen wir ein &#8220;<em>full stack application framework</em>&#8220;, das diesmal aber in Java mit Java Tools und Technologien umgesetzt wurde (Maven2, JPA, JUnit, Spring MVC, Spring Security, u.s.w.).</p>
<blockquote><p>&#8220;Roo delivers productivity without compromise. Spring Roo melds the development advantages that have emerged in dynamic frameworks with the robustness, reliability, performance and familiarity of enterprise Java. Roo is designed for developers that want to build Java applications faster than ever without having to learn a new language or syntax. Roo is designed to be incorporated into the majority of development environments including visual development tools and utilizes the widely understood implementations of relevant standards.&#8221; (Quelle: <a href="http://www.springsource.org/roo" target="_blank">http://www.springsource.org/roo</a>)</p></blockquote>
<p>Die <em>Spring Roo</em> Seite verrät zur Zeit sehr wenig &#8211; nicht einmal, wie man <em>Spring Roo</em> aktuell <a title="Download Roo 1.0.0.A1" href="http://dist.springframework.org/milestone/ROO/spring-roo-1.0.0.A1.zip" target="_blank">runterladen kann</a>. Hier muss man die Blogosphäre aus dem Umfeld im Radar haben:</p>
<ul>
<li><a href="http://blog.springsource.com/2009/05/01/roo-part-1/">Jump into Roo for extreme Java productivity</a></li>
<li><a href="http://stsmedia.net/introducing-spring-roo/">Introducing Spring ROO: Part 1</a></li>
<li><a href="http://www.theserverside.com/news/thread.tss?thread_id=54496" target="_blank">Getting Code Generation Right for Java and Spring</a></li>
</ul>
<p>Ich habe das Gefühl, dass die Java-Gemeinde endlich aufatmen kann, denn jetzt hat man eine Alternative zu <em>Ruby on Rails</em>, <em>Grails</em> und Co. Es wird sich zeigen, wie tief <em>Spring Roo</em> in den Kinderschuhen steckt, und ob SpringSource &#8220;den Kampf&#8221; an einer weitere Front aufnehmen kann. SpringSource scheint wieder die OSS Community entdeckt zu haben (die Community darf sogar  bei der <a href="http://cloud.springsource.com/vote/" target="_blank">Namensfindung</a> mithelfen), und spielt zu meiner Freude die Karte gross aus.</p>
]]></content:encoded>
			<wfw:commentRss>http://pgt.de/2009/05/09/springsource-produktivitatsoffensive/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Java in den Wolken</title>
		<link>http://pgt.de/2009/04/24/java-in-den-wolken/</link>
		<comments>http://pgt.de/2009/04/24/java-in-den-wolken/#comments</comments>
		<pubDate>Thu, 23 Apr 2009 22:53:40 +0000</pubDate>
		<dc:creator>P.G.Taboada</dc:creator>
				<category><![CDATA[Java & Co.]]></category>
		<category><![CDATA[people and business]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[ibm]]></category>
		<category><![CDATA[oracle]]></category>

		<guid isPermaLink="false">http://pgt.de/?p=291</guid>
		<description><![CDATA[Java in the Wolken. Oracle, IBM, Sun, Google, Amazon, Red Hat. [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><strong>May we live in interesting times&#8230; </strong></p>
<p style="text-align: center;"><strong>again&#8230; </strong></p>
<p style="text-align: center;"><strong>and again&#8230;</strong></p>
<p><div id="attachment_305" class="wp-caption alignright" style="width: 310px"><img class="size-medium wp-image-305" title="Java in den Wolken" src="http://pgt.de/wp-content/uploads/2009/04/wolke-300x200.jpg" alt="It's cloudy. I can't see the sun... " width="300" height="200" /><p class="wp-caption-text">It&#39;s cloudy and I can&#39;t see the sun... </p></div></p>
<p>Wenn das nicht mal spannende Zeiten. Erst vor ein paar Tagen (7. April) kommt Google völlig aus dem Nichts heraus und überrascht mit einem <a title="Introducing GWT 1.6 and friends" href="http://googlewebtoolkit.blogspot.com/2009/04/introducing-gwt-16-and-friends.html" target="_blank">3-fach Release</a>: GWT 1.6 (ok, das war nicht überrraschend), <a title="App Engine Java Overview" href="http://code.google.com/appengine/docs/java/overview.html" target="_blank">Java auf der GAE</a> (Google Application Engine) und dazu noch <a title="Google Plugin for Eclipse" href="http://code.google.com/eclipse/" target="_blank">das passende Plugin</a>,  damit auch alles schön aus Eclipse heraus benutzt werden kann.</p>
<p style="text-align: center;">&#8220;Hui&#8221;, dachte ich&#8230;</p>
<p>Wäre da nicht &#8220;<a title="IBM will Sun: Gespräche über Übernahme" href="http://www.heise.de/newsticker/IBM-will-Sun-Gespraeche-ueber-Uebernahme--/meldung/134739" target="_blank">IBM will Sun kaufen</a>&#8221; (Heise Meldung vom 18. März), dann <a title="Bericht: IBM sagt Übernahme von Sun ab" href="http://www.heise.de/newsticker/Bericht-IBM-sagt-Uebernahme-von-Sun-ab--/meldung/135805" target="_blank">doch nicht</a> (Heise Meldung vom 6. April), dann <a title="Oracle übernimmt Sun" href="http://www.heise.de/newsticker/Oracle-uebernimmt-Sun--/meldung/136423" target="_blank">schnappt plötzlich Oracle zu</a> (Heise Meldung vom 20. April) &#8211; dann hätten wir sicherlich viel länger über Java und GAE gesprochen. Aber die vielen offenen Fragen (Java, JCP, Openoffice, MySQL, Sparc), prominente  Meinungen (<a title="Oracle Adds New Exhibit to Java Technology Museum" href="http://blog.springsource.com/2009/04/20/oracle-adds-new-exhibit-to-java-technology-museum/" target="_blank">hier</a> und <a title="Five insightfull thoughts on the Oracle-Sun Acquisition" href="http://blog.sherifmansour.com/?p=339" target="_blank">hier</a>) und <a href="http://www.tutego.com/blog/javainsel/2009/04/auch-du-sch.html" target="_blank">Reaktionen</a> rund um Suns Zukunft (<a href="http://www.theserverside.com/news/thread.tss?thread_id=54339" target="_blank">oder Javas Zukunft</a>) haben alles überdeckt. Irgendwo habe ich noch ein Kommentar aufgeschnappt: &#8220;Google hat im Cloud-Geschäft Amazon ein Bein abgebissen&#8221;. Ob es jetzt ein Bein oder ein Finger war kann ich nicht sagen, aber ich finde die Metapher gut und da will ich drauf aufbauen&#8230;</p>
<p>Oracle hat doch jetzt den <a href="http://www.oracle.com/lang/de/appserver/index.html" target="_blank">eigenen Java EE Appserver</a>, <a href="http://www.google.de/url?sa=t&amp;source=web&amp;ct=res&amp;cd=1&amp;url=https%3A%2F%2Fglassfish.dev.java.net%2F&amp;ei=suzwSf7RGMu7_AaqhvHFCQ&amp;usg=AFQjCNEXmLM4Go2KMY26WkK6vEQM6L6YOA&amp;sig2=pWWK3tXSP389rd_1Wrvxww" target="_blank">Glassfish</a> und zeigte bereits <a title="Oracle will angeblich Red Hat kaufen" href="http://www.heise.de/newsticker/Oracle-will-angeblich-Red-Hat-kaufen--/meldung/135034" target="_blank">Interesse</a> (Heise Meldung vom 24. März) an Red Hat (und damit auch an <a href="http://www.jboss.org/" target="_blank">JBoss</a>) &#8211; alle zusammen durchaus nennenswerte AppServer. Oh, und ja, auf der anderen Seite, im Schatten der Nachrichten haben wir noch Amazon (ohne Bein) und IBM (mit einem AppServer den sie nur noch &#8220;über Bande&#8221; verkaufen wollen und Geronimo aka Websphere Community Edition).</p>
<p>Tja &#8211; und heute kommt die nächste Nachricht. <a title="Amazon Elastic Compute Cloud (EC2) Running IBM" href="http://aws.amazon.com/ibm" target="_blank">Amazon (AWS) bietet jetzt IBM Produkte im Elastic Cloud (EC2) an</a>. Irgendwie bietet sich die Metapher an, dass Amazon jetzt mit schicken neuen Krücken los humpelt. Und das ist eine böse Metapher und die will ich gar nicht laut gedacht haben.</p>
<p style="text-align: center;">&#8220;Seufz&#8221;, denke ich.</p>
<p style="text-align: center;">&#8220;Es bleibt spannend!&#8221;</p>
<p><span id="more-291"></span></p>
<p>Weitere Links zum Thema und Blogs die ich regelmäßig lese:</p>
<ul>
<li><a href="http://soa-eda.blogspot.com/2009/04/cloud-computing-from-custom-build-via.html">Cloud Computing: From Custom-build via COTS to SaaS</a></li>
<li><a href="http://search.twitter.com/search?q=%23sun+%23oracle" target="_blank">Twitter Strom zu #oracle und #sun</a></li>
<li><a href="http://weblogs.java.net/blog/cayhorstmann/archive/2009/04/my_oracle_prono.html" target="_blank">Cay Horstmann&#8217;s Blog, My Oracle Pronouncements for Java</a></li>
<li><a href="http://www.screaming-penguin.com/node/7684" target="_blank">On Oracle and Sun</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://pgt.de/2009/04/24/java-in-den-wolken/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to use the SimpleHttpInvokerServiceExporter</title>
		<link>http://pgt.de/2009/02/26/how-to-use-the-simplehttpinvokerserviceexporter/</link>
		<comments>http://pgt.de/2009/02/26/how-to-use-the-simplehttpinvokerserviceexporter/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 12:15:04 +0000</pubDate>
		<dc:creator>P.G.Taboada</dc:creator>
				<category><![CDATA[Java & Co.]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[spring]]></category>

		<guid isPermaLink="false">http://pgt.de/?p=275</guid>
		<description><![CDATA[How to use the SimpleHttpInvokerServiceExporter (JRE 1.6 HttpServer and spring remoting) [...]]]></description>
			<content:encoded><![CDATA[<p>The JRE 1.6 ships with small HTTP-Server implementation. <a title="HTTP Server Javadocs" href="http://java.sun.com/javase/6/docs/jre/api/net/httpserver/spec/overview-summary.html" target="_blank">The Javadocs can be found here</a>.</p>
<p>Spring has provides many different ways of configuring remote access to beans (aka spring remoting), but the <a href="http://static.springframework.org/spring/docs/2.5.x/reference/remoting.html" target="_blank">remoting documentation</a> fails when it comes to the usage of the HTTP Service exporter that works with the new JRE 1.6 HttpServer.</p>
<p>So here is a small example on how wire up the embedded JDK <a title="JDK 1.6 HttpServer Javadoc" href="http://java.sun.com/javase/6/docs/jre/api/net/httpserver/spec/com/sun/net/httpserver/HttpServer.html" target="_blank">HttpServer</a> and spring remoting.</p>
<p><span id="more-275"></span></p>
<p>First we need some service that we would like to expose as a remote service. For this short example I am using an very simple &#8220;EchoService&#8221; as follows:</p>
<p>The interface:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">x.y</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">interface</span> EchoService <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">abstract</span> <span style="color: #003399;">String</span> echo<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> message<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>and some implementation:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">x.y</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.slf4j.Logger</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.slf4j.LoggerFactory</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.springframework.stereotype.Service</span><span style="color: #339933;">;</span>
&nbsp;
@Service<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;echoServiceLocalImpl&quot;</span><span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> EchoServiceImpl <span style="color: #000000; font-weight: bold;">implements</span> EchoService <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> Logger log <span style="color: #339933;">=</span> LoggerFactory
			.<span style="color: #006633;">getLogger</span><span style="color: #009900;">&#40;</span>EchoServiceImpl.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> echo<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> message<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		log.<span style="color: #006633;">info</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Echoing: &quot;</span> <span style="color: #339933;">+</span> message<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">return</span> message.<span style="color: #006633;">toUpperCase</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>As you can see in the implementation, I am using annotation based configuration in this example.</p>
<p>That is pretty much all implementation I need to provide the services. Now I have to setup the HttpServer and configure the service exporting. The HttpServer implementation provided by the JRE uses factory methods for the setup. It is a pain to configure beans using factory-methods in the spring xml, and that&#8217;s why we usually create a <a title="FactoryBean interface javadoc" href="http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/beans/factory/FactoryBean.html" target="_blank">FactoryBean</a> to wrap up the ugly initialization of a bean. Fortunately we do not have to do this ourselves, the Springframework already provides (since version 2.5.1) <a href="http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/remoting/support/SimpleHttpServerFactoryBean.html" target="_blank">such a factory bean</a>.</p>
<p>So here is the context xml configuration file I am using to start the server and to export the services:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;">&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;beans</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://www.springframework.org/schema/beans&quot;</span></span>
<span style="color: #009900;">	<span style="color: #000066;">xmlns:xsi</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span></span>
<span style="color: #009900;">	<span style="color: #000066;">xsi:schemaLocation</span>=<span style="color: #ff0000;">&quot;http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd</span>
<span style="color: #009900;">		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd</span>
<span style="color: #009900;">		http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd&quot;</span></span>
<span style="color: #009900;">	<span style="color: #000066;">xmlns:context</span>=<span style="color: #ff0000;">&quot;http://www.springframework.org/schema/context&quot;</span></span>
<span style="color: #009900;">	<span style="color: #000066;">xmlns:util</span>=<span style="color: #ff0000;">&quot;http://www.springframework.org/schema/util&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;context:annotation-config</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;context:component-scan</span> <span style="color: #000066;">base-package</span>=<span style="color: #ff0000;">&quot;x.y&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;httpServer&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.springframework.remoting.support.SimpleHttpServerFactoryBean&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;contexts&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;util:map<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;entry</span> <span style="color: #000066;">key</span>=<span style="color: #ff0000;">&quot;/echoService&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
					<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.springframework.remoting.httpinvoker.SimpleHttpInvokerServiceExporter&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
						<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;serviceInterface&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;x.y.EchoService&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
						<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;service&quot;</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">&quot;echoServiceLocalImpl&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
					<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/entry<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/util:map<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/property<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;port&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;2345&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;remotedEchoService&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>  
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;qualifier</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;remoted&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;serviceUrl&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;http://localhost:2345/echoService&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;serviceInterface&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;x.y.EchoService&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/beans<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>As you can see I also added the xml snippet required for the clients that will be using the remoted service. The qualifier will help me to get the remoted instance and not the local one, hence both instances are kept in my application context in this sample. A simple testcase would look this way:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">x.y</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">static</span> org.<span style="color: #006633;">junit</span>.<span style="color: #000000; font-weight: bold;">Assert</span>.<span style="color: #006633;">assertEquals</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">static</span> org.<span style="color: #006633;">junit</span>.<span style="color: #000000; font-weight: bold;">Assert</span>.<span style="color: #006633;">assertTrue</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.junit.Test</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.junit.runner.RunWith</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.springframework.beans.factory.annotation.Autowired</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.springframework.beans.factory.annotation.Qualifier</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.springframework.test.context.ContextConfiguration</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.springframework.test.context.junit4.SpringJUnit4ClassRunner</span><span style="color: #339933;">;</span>
&nbsp;
@RunWith<span style="color: #009900;">&#40;</span>SpringJUnit4ClassRunner.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span>
@ContextConfiguration<span style="color: #009900;">&#40;</span>inheritLocations <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span>, locations <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span> <span style="color: #0000ff;">&quot;classpath:/META-INF/beans.xml&quot;</span> <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> TestRemoting <span style="color: #000000; font-weight: bold;">extends</span> AbstractJUnit4SpringContextTests <span style="color: #009900;">&#123;</span>
&nbsp;
	@Autowired<span style="color: #009900;">&#40;</span>required <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span>
	@Qualifier<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;remoted&quot;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #000000; font-weight: bold;">private</span> EchoService echoService<span style="color: #339933;">;</span>
&nbsp;
	@Test
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> echoTestUsingConfiguredClient<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">Exception</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #003399;">String</span> echo <span style="color: #339933;">=</span> echoService.<span style="color: #006633;">echo</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;test&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		assertEquals<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Echoed correctly&quot;</span>, <span style="color: #0000ff;">&quot;TEST&quot;</span>, echo<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		assertTrue<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Should not be the implementation&quot;</span>, <span style="color: #339933;">!</span>echoService.<span style="color: #006633;">getClass</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
				.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span>EchoServiceImpl.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	@Test
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> echoTestManually<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">Exception</span> <span style="color: #009900;">&#123;</span>
		HttpInvokerProxyFactoryBean proxy <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> HttpInvokerProxyFactoryBean<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		proxy.<span style="color: #006633;">setServiceInterface</span><span style="color: #009900;">&#40;</span>EchoService.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		proxy.<span style="color: #006633;">setServiceUrl</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;http://localhost:2345/echoService&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		proxy.<span style="color: #006633;">afterPropertiesSet</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		EchoService echoService <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>EchoService<span style="color: #009900;">&#41;</span> proxy.<span style="color: #006633;">getObject</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">String</span> echo <span style="color: #339933;">=</span> echoService.<span style="color: #006633;">echo</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;test&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		assertEquals<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Echoed correctly&quot;</span>, <span style="color: #0000ff;">&quot;TEST&quot;</span>, echo<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		assertTrue<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Should not be the implementation&quot;</span>, <span style="color: #339933;">!</span>echoService.<span style="color: #006633;">getClass</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
				.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span>EchoServiceImpl.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The first test method <strong>echoTestUsingConfiguredClient</strong> does use the bean in the spring context (autowired, using the qualifier to get the right instance), the second method <strong>echoTestManually</strong> creates a proxy bean manually.</p>
<p>Both of them use the remoted proxy and not the local service implementation during the test.</p>
<p>I used maven to setup the eclipse project and to manage my project dependencies.<br />
The project can be downloaded <a href="http://pgt.de/wp-content/uploads/2009/02/simpleexporter.zip">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://pgt.de/2009/02/26/how-to-use-the-simplehttpinvokerserviceexporter/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Jira Plugin &amp; Log4J</title>
		<link>http://pgt.de/2009/02/25/jira-plugin-log4j/</link>
		<comments>http://pgt.de/2009/02/25/jira-plugin-log4j/#comments</comments>
		<pubDate>Wed, 25 Feb 2009 10:48:00 +0000</pubDate>
		<dc:creator>P.G.Taboada</dc:creator>
				<category><![CDATA[Java & Co.]]></category>
		<category><![CDATA[jira]]></category>

		<guid isPermaLink="false">http://pgt.de/?p=264</guid>
		<description><![CDATA[Jira plugin development and log4j configuration. [...]]]></description>
			<content:encoded><![CDATA[<p>I came across this problem lately when I was working on a Jira plugin. A Jira plugin does not rely on a OSGi container or some similar plugin framework. The plugin consists mainly of a jar file that gets deployed with (I mean inside&#8230;) the Jira Java EE  web application.</p>
<p>Logging is an issue in such an environment: the surrounding application configures the logging API &#8211; there is no way to provide log4j configuration fragments.</p>
<p><span id="more-264"></span></p>
<p>The best way I found to solve the problem was (again) to use the native logging API to the configuration manually. Since Jira has already setup the logging API, all I needed was to add some categories with some levels, or, if I need to, create my own appenders. That&#8217;s all possible with the API exposed by log4j.</p>
<p><div style="padding: 50px 10px 50px 10px; text-align:center;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-8682101792434953";
/* blogposts */
google_ad_slot = "3634251742";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div></p>
<p>So I created a Jira component module inside my plugin that does the configuration magic. Jira uses PicoContainer (lightweight, embedable, configurable, POJO based IOC/DI component runtime) as the runtime for their own and for components provided by plugins. As components get initialized along with the Jira application it is good place to implement the required logging configuration:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">x.y</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.log4j.Level</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.log4j.Logger</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> LogConfigurationComponent <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> Logger LOG <span style="color: #339933;">=</span> Logger.<span style="color: #006633;">getLogger</span><span style="color: #009900;">&#40;</span>LogConfigurationComponent.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> LogConfigurationComponent<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
		Level level <span style="color: #339933;">=</span> Level.<span style="color: #006633;">toLevel</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;DEBUG&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		Logger logger <span style="color: #339933;">=</span> Logger.<span style="color: #006633;">getLogger</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;x.y.somethingcool&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		Level oldLevel <span style="color: #339933;">=</span> logger.<span style="color: #006633;">getLevel</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		logger.<span style="color: #006633;">setLevel</span><span style="color: #009900;">&#40;</span>level<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #003399;">String</span> message <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Changing loglevel for logger &quot;</span>
				<span style="color: #339933;">+</span> logger.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; from &quot;</span> <span style="color: #339933;">+</span> oldLevel.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
				<span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; to &quot;</span> <span style="color: #339933;">+</span> level.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		LOG.<span style="color: #006633;">info</span><span style="color: #009900;">&#40;</span>message<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Just by adding this component to the atlassian-plugin.xml in my plugin I solved my problems with distributed logging configuration:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;atlassian-plugin</span> <span style="color: #000066;">key</span>=<span style="color: #ff0000;">&quot;x.y.coolthings&quot;</span></span>
<span style="color: #009900;">	<span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;CoolThings&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugin-info<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Simple plugin<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1.0<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;vendor</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;PGT Technology Scouting&quot;</span> <span style="color: #000066;">url</span>=<span style="color: #ff0000;">&quot;http://www.pgt.de&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugin-info<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;component</span> <span style="color: #000066;">key</span>=<span style="color: #ff0000;">&quot;logConfig&quot;</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;The logging configuration for this plugin&quot;</span></span>
<span style="color: #009900;">		<span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;x.y.LogConfigurationComponent&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/component<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #808080; font-style: italic;">&lt;!-- ... --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/atlassian-plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://pgt.de/2009/02/25/jira-plugin-log4j/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Stop this “my support is better than yours” discussion!</title>
		<link>http://pgt.de/2008/08/30/stop-this-my-support-is-better-than-yours-discussion/</link>
		<comments>http://pgt.de/2008/08/30/stop-this-my-support-is-better-than-yours-discussion/#comments</comments>
		<pubDate>Sat, 30 Aug 2008 10:46:07 +0000</pubDate>
		<dc:creator>P.G.Taboada</dc:creator>
				<category><![CDATA[Java & Co.]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[oss]]></category>
		<category><![CDATA[spring]]></category>

		<guid isPermaLink="false">http://pgt.de/?p=204</guid>
		<description><![CDATA[<p>Ok, someone is making money with support. Ok, someone is not contributing to OSS. But wait &#8211; is offering support not exactly that? Contributing to OSS by doing the dirty work no one wants to do?</p> <p>That’s why I do not agree entirely with the label “parasites”. It is not easy to offer support, [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>Ok, someone is making money with support.<br />
Ok, someone is not contributing to OSS.<br />
But wait &#8211; is offering support not exactly that? Contributing to OSS by doing the dirty work no one wants to do?</p></blockquote>
<p>That’s why I do not <a href="http://blog.springsource.com/main/2008/08/22/who-is-the-chief-of-the-apache-projects/" target="_blank">agree entirely with the label “parasites”</a>. It is not easy to offer support, IMHO it is a Job that no one likes to do. I don’t know if it is true for everyone &#8211; but I am very happy to be a developer and not to be a support guy.</p>
<p><span id="more-204"></span></p>
<p>It just happens that it is exactly this job is actually needed, and hence, can be monetized.</p>
<ul>
<li>Don’t tell me that those few developers really contributing to an OSS project have time to provide support as it is required today.</li>
<li>Don’t tell me that somebody not contributing is not capable to offer support. If you really believe that, you don’t understand what it means to offer support.</li>
<li>Don’t tell me that developers can offer better support.</li>
</ul>
<p>So even if all OSS developers start working 24h a day (I am sure many already do) &#8211; would they be supply enough service to cover the demand? How many people do need support, now many contributors do we have?</p>
<p>I remember reading somewhere on a OSS page:  “great support by the community”. What does this mean? Easy to tell: <strong>we can’t or we won’t offer support.</strong></p>
<p>I believe that neither Spring nor any other OSS product would have come that far without the many consultants and supporters we have working very hard today. So someone is monetizing support? Fine! It will open the doors for enterprise OSS acceptance. Is someone offering training for OSS technologies? GREAT!</p>
<p>Does it feel like it is stealing work? No it is not.</p>
<p>Sure &#8211; we live in interesting times. Don’t have a working business plan for your successfull OSS product? I tell you what: go offer support for it. But be warned: it is hard work, it is mostly badly payed, it does not scale, and you will stop working with computers and start working with people.</p>
<p>Good luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://pgt.de/2008/08/30/stop-this-my-support-is-better-than-yours-discussion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GWT &#8211; kein JSF wie Andy Bosch es haben will…</title>
		<link>http://pgt.de/2008/05/20/gwt-kein-jsf-wie-andy-bosch-es-haben-will%e2%80%a6/</link>
		<comments>http://pgt.de/2008/05/20/gwt-kein-jsf-wie-andy-bosch-es-haben-will%e2%80%a6/#comments</comments>
		<pubDate>Tue, 20 May 2008 08:02:40 +0000</pubDate>
		<dc:creator>P.G.Taboada</dc:creator>
				<category><![CDATA[conferences]]></category>
		<category><![CDATA[Java & Co.]]></category>
		<category><![CDATA[gwt]]></category>
		<category><![CDATA[jsf]]></category>

		<guid isPermaLink="false">http://pgt.de/?p=128</guid>
		<description><![CDATA[ <p>Danke Andy für dein Kommentar. Freut mich, dass dich mein provokanter Titel in die Session gezogen hat &#8211; das war Absicht. Und es freut mich um so mehr, dass Du dir die Zeit genommen hast, ein Kommentar zu schreiben. Also auf gehts, möchte kurz auf dein Kommentar eingehen:</p> <p>Um jedoch ehrlich zu sein: [...]]]></description>
			<content:encoded><![CDATA[<div class="entry-content">
<p>Danke Andy <a href="http://it-republik.de/jaxenter/news/JAX-Kommentar-GWT---Ein-JSF-wie-ich-es-schon-immer-wollte%3F-043239.html" target="_blank">für dein Kommentar</a>. Freut mich, dass dich mein provokanter Titel in die Session gezogen hat &#8211; das war Absicht. <img class="wp-smiley" src="../wp-includes/images/smilies/icon_smile.gif" alt=":-)" /> Und es freut mich um so mehr, dass Du dir die Zeit genommen hast, ein Kommentar zu schreiben. Also auf gehts, möchte kurz auf dein Kommentar eingehen:</p>
<blockquote><p>Um jedoch ehrlich zu sein: Ich finde die Ansätze von <strong>GWT</strong> durchaus    interessant, allerdings bleibe ich doch bei meiner gewohnten  JSF-Entwicklung.</p></blockquote>
<p>Klar… <img class="wp-smiley" src="../wp-includes/images/smilies/icon_smile.gif" alt=":-)" /></p>
<blockquote><p>Ich befinde mich im Web und programmiere auch dort. Warum  muss ich das   zwanghaft zu verbergen versuchen?</p></blockquote>
<p>Was meinst du mit verbergen? Und was meinst du mit du programmierst im Web? Sowohl <strong>GWT</strong> als auch JSF definieren ein Komponentenmodell und abstrahieren von der klassischen request/response Entwicklung. Sowohl bei JSF als auch <strong>GWT</strong> hat der Entwickler wenig Kontakt mit den ursrpünglichen Web-Technologien (wann habe ich das letzte mal ein Tree von Hand in HTML geschrieben?)-</p>
<p>So gesehen programmierst Du nicht im Web, oder ich habe dich falsch verstanden. Weder JSPs noch das Facelets-XML sind im eigentlichem Sinne Web-Technologien, diese werden nämlich vom W3C definiert…</p>
<blockquote><p>Auch bietet mir <strong>GWT</strong> meiner Meinung nach nicht wirklich neuartige Antworten auf Dinge, die ich in JSF nicht genauso gut lösen könnte (nur eben anders).</p></blockquote>
<p>Das stimmt nicht. Ich kenne beide. Du nicht. Aussage gegen Aussage.  <img class="wp-smiley" src="../wp-includes/images/smilies/icon_wink.gif" alt=";-)" /></p>
<blockquote><p>Auch in JSF gibt  es einen großen    und sehr guten Komponentenmarkt, der mir die Details von  Html und JavaScript   versteckt.</p></blockquote>
<p>Und genau hier greift eines meiner Kritikpunkte: JSF ist kein Produkt, nur ein Standard. Die Komponenten sind teilweise inkompatibel zueinander, haben unterschiedliche Programmiermodelle, etc.</p>
<blockquote><p>Auch habe ich keine Antwort gefunden, warum ich von einem Standard wie JSF weggehen sollte, nur um eine proprietäre und nicht standardisierte API zu verwenden.</p></blockquote>
<p>Ja, JSF ist ein Standard. Ich weiss noch, wass ich von dem EJB Standard gewonnen habe: 3 Mal die Anwendung portieren. Bei JSF sieht es auch nicht besser aus &#8211; oder kannst du unter Websphere einfach so beliebige Komponenten und JSF Implementierungen laufen lassen? Was bringt mir da der Standard? Trägheit?</p>
<blockquote><p>Sicherlich ist Google mit seiner Marktstärke durchaus in der Lage, auch einen eigenen “Standard” in die Welt zu setzen, aber ich setze eher auf die im Java-Umfeld etablierten Standardisierungsprozesse wie den JCP (trotz aller Kritik an ihm).</p></blockquote>
<p>Kann ich nachvollziehen und als Argument stehen lassen. Ich habe mich mehr den technischen und konzeptionellen Themen in meiner Session gewidmet.</p>
<blockquote><p>Eine Entscheidung, welches Framework man zukünftig nutzen möchte, muss jedoch  jeder selbst treffen.</p></blockquote>
<p>Genau. Daher ist eine Gegenüberstellung der unterschiedlichen Webframeworks um Java Umfeld mit Sinn und Verstand wichtig. Ob man dann andere Frameworks einsetzt, oder nur daraus lernt &#8211; das wird die Zeit zeigen.</p>
<blockquote><p>Für mich war die Session sicherlich dahingegend hilfreich,  um mehr über <strong>GWT</strong> zu   erfahren. Aber auch, um für mich die Frage beantworten zu  können, ob <strong>GWT</strong> wirklich das bessere JSF ist oder der Titel einfach nur etwas  provokant gewählt wurde.</p></blockquote>
<p>Der Titel war erstens provokant und zweitens eine Fragestellung. So wie es aussieht habe ich es genau richtig gewählt &#8211; es hat dich in die Session gelockt und dich zum nachdenken gebracht. <img class="wp-smiley" src="../wp-includes/images/smilies/icon_smile.gif" alt=":-)" /></p>
<p>Aber, ein paar Fragen habe ich an Dich…</p>
<ul>
<li>Was ist wenn weder JSF noch <strong>GWT</strong> ein Standard wären? Würdest du dann mit JSP/ Servlets entwickeln?</li>
<li>Was ist wenn Struts der Standard geworden wäre? Wa würdest du dann nehmen?</li>
<li>Was ist wenn ich <strong>GWT</strong> benutze, um bessere JSF Komponenten zu schreiben</li>
</ul>
<p>Würde mich freuen, von dir zu hören!</p></div>
]]></content:encoded>
			<wfw:commentRss>http://pgt.de/2008/05/20/gwt-kein-jsf-wie-andy-bosch-es-haben-will%e2%80%a6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Modular apps with JBoss???</title>
		<link>http://pgt.de/2008/05/06/modular-apps-with-jboss/</link>
		<comments>http://pgt.de/2008/05/06/modular-apps-with-jboss/#comments</comments>
		<pubDate>Tue, 06 May 2008 10:54:19 +0000</pubDate>
		<dc:creator>P.G.Taboada</dc:creator>
				<category><![CDATA[From nerds to nerds]]></category>
		<category><![CDATA[Java & Co.]]></category>
		<category><![CDATA[modularization]]></category>

		<guid isPermaLink="false">http://pgt.de/?p=210</guid>
		<description><![CDATA[<p>Reading MarcF blog I stumbled across this statement:</p> <p>enough to call it out for what it is “an emperor has no clothes” attempt to monetize his ISV base. I will respectfully point out that all this mumbo jumbo about modularity being a “quantum leap to the next generation” is just bullshit. We were peddling [...]]]></description>
			<content:encoded><![CDATA[<p>Reading <a href="http://www.thedelphicfuture.org/2008/05/rod-johnson-has-smd-moment.html" target="_blank">MarcF blog I stumbled across this statement</a>:</p>
<blockquote><p>enough to call it out for what it is “an emperor has no clothes” attempt to monetize his ISV base. I will respectfully point out that all this mumbo jumbo about modularity being a “quantum leap to the next generation” is just bullshit. We were peddling modular application servers with JBoss and its JMX base back in 2000, except we had real run-time substance behind it.</p></blockquote>
<p>Funny. I understand the <strong>“run-time substance”</strong> point, won’t argue here. I agree that JBoss was/is a beautiful piece of work, modularity already implemented back in 2000.</p>
<p>Yes. But we, who did develop applications on top of this runtime, who tried to use standards (regarding Java EE specs), <strong>did not have ways of modularization.</strong> We had different component models, yes. People are using OSGi to split their own application into coarse grained modules. OSGi by hand is a pain in the ass. The platform helps here. So this is runtime, yes. And they are solving problems that maybe JBoss had back at 2000, and some people who are trying to use OSGi now.</p>
<p>I do not see Java EE solving that. I do not see Java Dynamic Modules beeing released, I do not see that becoming part of Java EE.</p>
]]></content:encoded>
			<wfw:commentRss>http://pgt.de/2008/05/06/modular-apps-with-jboss/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SpringSource announces an application plattform</title>
		<link>http://pgt.de/2008/05/05/springsource-announces-an-application-plattform/</link>
		<comments>http://pgt.de/2008/05/05/springsource-announces-an-application-plattform/#comments</comments>
		<pubDate>Mon, 05 May 2008 07:51:54 +0000</pubDate>
		<dc:creator>P.G.Taboada</dc:creator>
				<category><![CDATA[Java & Co.]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[gpl]]></category>
		<category><![CDATA[java ee]]></category>
		<category><![CDATA[oss]]></category>
		<category><![CDATA[spring]]></category>

		<guid isPermaLink="false">http://pgt.de/?p=124</guid>
		<description><![CDATA[ <p>SpringSource recently announced the Spring Aplication Platform, and this announcement is generating a lot of fuss. Google has recently launched the Google App Engine. From an Java enterprise developers point of view it is shamelessly easy to use, deploy, etc. Well, unfortunately it only takes Python apps for now, but it is stated [...]]]></description>
			<content:encoded><![CDATA[<div class="entry-content">
<p>SpringSource recently announced the <a href="http://feeds.feedburner.com/%7Er/Interface21TeamBlog/%7E3/280954280/" target="_blank">Spring Aplication Platform</a>, and this announcement is generating a lot of fuss. Google has recently launched the <a href="http://code.google.com/appengine/" target="_blank">Google App Engine</a>. From an Java enterprise developers point of view it is shamelessly easy to use, deploy, etc. Well, unfortunately it only takes Python apps for now, but it is stated that there will be more languages supported in the future. But it’s Google again putting its finger into the Java EE wound (first GWT with webapps, then Android shaking the Java ME world, and now App Engine showing how runtimes should look like).</p>
<p>Looking at Googles App Engine I thought how nice it would be to have the deployment, packaging and runtime of Java EE applications redesigned.  Those deployment descriptors really suck. As it seems (heard it at the Jax from speakers “off the record”) Java Dynamic Modules and Java Superpackages aren’t going to make it into the next Java relase &#8211; Java 7.</p>
<p>From this point of view, the Spring Application Platform is bringing fresh air into the Java EE development. The Java EE dream of a runtime didn’t come through. Modularization got lost somewhere in the way. Packaging and deployment is a nightmare, and tools didn’t solve the problem. Since Java EE 5 is being adopted very slowly and Java EE 6 is really far away, this is surely the best time to drop in an alternative. Well done. Though beeing an alternative, there seems to be <a href="http://www.theserverside.com/news/thread.tss?thread_id=49243#251548" target="_blank">some level of commitment regarding Java EE deployment support</a>.</p>
<p>IMHO the real shock came with the change in licensing terms. We are used to SpringSource licensing their products under the Apache 2 license. The license is clear and accepted by most companies. The Spring Application Platform is licensed under the GPL. GPL is, IMHO, the most misunderstood license we have in the OSS. I do not have nothing against the GPL, I only have a problem with the different interpretations. And if a license can be misunderstood, how can we rely on it? I won’t start another blog about how GPL works &#8211; please go read the GPL and the GPL FAQ, it’s worth it. A nice reply from Will Hartung about GPL on the TSS thread <a href="http://www.theserverside.com/news/thread.tss?thread_id=49243#251572" target="_blank">can be found here</a>.</p>
<blockquote><p>Does nobody actually, you know, READ these licenses?<br />
Users who change GPL code have absolutely no, zero, zippo, big bagel, goose egg obligation to give back to “the community”.<br />
I can take this code, make all the changes I want, sell it to my customers, and you can come knock on my door saying “I want the code, it’s GPL! Give me the code!” and I can nod and smile knowingly and tell you to pound sand. “Give me $100K and I’ll give you the software.</p></blockquote>
<p>Thanks Will. It’s beautiful.</p>
<p>Rod argues that if someone takes the code, makes changes and starts selling it, this someone will, sooner or later, have to provide the source code to a major number of customers and hence the changes will be available for the community, especially for SpringSource. Rod, I hope I did quote you right, sorry if I didn’t.</p>
<p>Another great statement from Will comes a <a href="http://www.theserverside.com/news/thread.tss?thread_id=49243#251590" target="_blank">few postings later</a>:</p>
<blockquote><p>But you certainly aren’t going to take back contributions that don’t have at least shared copyright, because as soon as that happens you can’t relicense the whole under something other than GPL. So, there’s not a whole lot of value to the community there.</p></blockquote>
<p>Later Rod <a href="http://www.theserverside.com/news/thread.tss?thread_id=49243#251853" target="_blank">makes a nice statement</a> about what’s ok:</p>
<blockquote><p>1. Using the platform to run closed source applications is OK. This immediately covers the vast majority of companies and developers who are end users. This would cover for example, software use by companies like Google, banks, media companies etc.<br />
2. Modifying and extending the platform and “hiding” (closing) it is OK, <em>unless you redistribute</em>. So if you modify it in your own company, or you modify it and distribute your modifications in GPL open source, that’s OK. If you modify it and distribute a closed source product including those modifications, that is not OK. This would exclude Oracle, for example, from modifying the server and redistributing it as a closed source product. We believe this is a Good Thing.<br />
3. It is fine to run closed source applications on the platform. Whether you can redistribute them as one closed product (bundling the platform) would depend if they constituted a derivative work.</p></blockquote>
<p>I liked <a href="http://www.theserverside.com/news/thread.tss?thread_id=49243#251858" target="_blank">this one too</a>:</p>
<blockquote><p>Wow, 174 replies and counting, mostly about GPL, hmm, i knew I should have done law!!! ha ha<br />
Lets stay technical please, even though it clearly doesn’t pay !!!</p></blockquote>
<p>This is perfectly showing how GPL, although commonly used in OSS projects, is really badly misunderstood by people.</p>
<p>IMHO GPL licensing was a bad idea. SpringSource targets the enterprise, the enterprise dislikes GPL, that’s a fact. Linux seems to be the exception to the rule. It’ nice to see how SpringSource understands GPL &#8211; but this understanding is not binding. What if someone wakes up next week and says &#8211; “oh sorry, I think we have to rethink our GPL understanding….”</p></div>
]]></content:encoded>
			<wfw:commentRss>http://pgt.de/2008/05/05/springsource-announces-an-application-plattform/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Security Anforderungen 2.0: Gruppen, Rollen, Flexibilität</title>
		<link>http://pgt.de/2008/04/28/security-anforderungen-20-gruppen-rollen-flexibilitat/</link>
		<comments>http://pgt.de/2008/04/28/security-anforderungen-20-gruppen-rollen-flexibilitat/#comments</comments>
		<pubDate>Mon, 28 Apr 2008 09:00:04 +0000</pubDate>
		<dc:creator>P.G.Taboada</dc:creator>
				<category><![CDATA[Java & Co.]]></category>
		<category><![CDATA[jira]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[spring]]></category>

		<guid isPermaLink="false">http://pgt.de/?p=158</guid>
		<description><![CDATA[<p>Was habe ich mich gefreut, als Jira das Sicherheitskonzept um Rollen (Projekt-Rollen) erweitert hat. Statt Rechtekonfigurationen an Benutzergruppen zu binden, hat man jetzt die Möglichkeit Rechte an bestimmte Rollen zu binden. Für jedes Projekt folgt dann die Benutzer/ Rolle Zuweisung: dadurch ergibt sich letztlich, welche Rechte ein Benutzer für ein bestimmtes Projekt haben wird.</p> [...]]]></description>
			<content:encoded><![CDATA[<p>Was habe ich mich gefreut, als Jira das Sicherheitskonzept um Rollen (Projekt-Rollen) erweitert hat. Statt Rechtekonfigurationen an Benutzergruppen zu binden, hat man jetzt die Möglichkeit <a href="http://www.atlassian.com/software/jira/docs/latest/project_role_management.html" target="_blank">Rechte an bestimmte Rollen zu binden</a>. Für jedes Projekt folgt dann die Benutzer/ Rolle Zuweisung: dadurch ergibt sich letztlich, welche Rechte ein Benutzer für ein bestimmtes Projekt haben wird.</p>
<p>Gerade in kleine, agil arbeitende Teams ist das wesentlich effizienter: in einem Projekt ist man der Projektleiter, bei einem anderem lediglich ein Entwickler. So flexibel wie Entwickler heute die Rollen wechseln müssen, so flexibel konfigurierbar muss heute auch unternehmenskritische Software sein. In der Vergangenheit musste man in Jira für jede mögliche Kombination der Rollen in einem Projekt entsprechende Benutzergruppen einführen. Benutzergruppen sind aber statisch/ global und nehmen keine Rücksicht auf besondere Projektgegebenheiten. Am Ende bekommt jedes Projekt eigene Benutzergruppen.</p>
<p>Die Einführung von Projektrollen und Sicherheitskonfigurationen für Projektrollen im Allgemeinen reduziert die Konfiguration drastisch. Danke Atlassian!</p>
<p>Ein Rollenmodell ist nicht mit den heute üblichen deklarativen Mitteln konfigurierbar. Wir scheitern an der instanzbasierten Sicherheit. Je nach Projekt hat der Benutzer andere Rollen. Um so wichtiger ist es, ein Security Framework zu wählen, mit dem man die nötige Flexibilität und die Möglichkeit bekommt, eigene Anforderungen umzusetzen.</p>
<p>Auch wenn <a href="http://java.sun.com/javase/6/docs/technotes/guides/security/jaas/JAASRefGuide.html" target="_blank">JAAS</a> ein beeindruckendes Werk ist, mangelt es meiner Meinung nach an Flexibilität. Anpassungen sind sehr schnell nicht mehr portabel, eine Bindung zu der Laufzeitumgebung und oder Infrastruktur ist das Ergebenis. <a href="http://static.springframework.org/spring-security/site/index.html" target="_blank">Spring Security</a> (formerly known as Acegi) ist hingegen sehr flexibel. Security wird dadurch nicht trivial, aber besondere Anforderungen und entsprechende Lösungsansätze scheitern nicht mehr an dem Framework.</p>
<p>Schade dass in der <a href="http://static.springframework.org/spring-security/site/reference/html/springsecurity.html" target="_blank">Spring Security Dokumentation</a> zu diesem Thema nichts zu finden ist. Eine Interessante Ausarbeitung zum Thema Gruppen und Rollen auf Konzeptebene <a href="http://www.mwiesner.com/index.php/2008/03/28/rollen-sind-keine-gruppen/" target="_blank">ist hier zu finden</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://pgt.de/2008/04/28/security-anforderungen-20-gruppen-rollen-flexibilitat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Session: Complex Event Processing with Esper</title>
		<link>http://pgt.de/2008/04/12/session-complex-event-processing-with-esper/</link>
		<comments>http://pgt.de/2008/04/12/session-complex-event-processing-with-esper/#comments</comments>
		<pubDate>Sat, 12 Apr 2008 08:22:36 +0000</pubDate>
		<dc:creator>P.G.Taboada</dc:creator>
				<category><![CDATA[conferences]]></category>
		<category><![CDATA[Java & Co.]]></category>
		<category><![CDATA[cep]]></category>
		<category><![CDATA[eda]]></category>
		<category><![CDATA[esper]]></category>

		<guid isPermaLink="false">http://pgt.de/?p=139</guid>
		<description><![CDATA[<p>Last but not least &#8211; my presentation slides for my EDA, CEP, ESP and Esper session at the JAX India 2008. Thanks to all audients for visiting my presentation and for the interesting chats afterwards.</p> <p>Complex Event Processing with Esper</p> <p>Complex Event Processing, or CEP, is technology to process events and discover complex patterns [...]]]></description>
			<content:encoded><![CDATA[<p>Last but not least &#8211; my presentation slides for my EDA, CEP, ESP and Esper session at the JAX India 2008. Thanks to all audients for visiting my presentation and for the interesting chats afterwards.</p>
<p><strong>Complex Event Processing with Esper</strong></p>
<p>Complex Event Processing, or CEP, is technology to process events and discover complex patterns among multiple streams of event data. ESP stands for Event Stream Processing and deals with the task of processing multiple streams of event data with the goal of identifying the meaningful events within those streams, and deriving meaningful information from them. The Esper engine has been developed to address the requirements of applications that analyze and react to events.</p>
<blockquote><p>PDF:<a href="/wp-content/uploads/2008/04/taboada-session-esper.pdf"><br />
Complex Event Processing with Esper<br />
JAX India 2008, Papick G. Taboada</a></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://pgt.de/2008/04/12/session-complex-event-processing-with-esper/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Short talk at the Jax 2008: Android</title>
		<link>http://pgt.de/2008/04/02/short-talk-at-the-jax-2008-android/</link>
		<comments>http://pgt.de/2008/04/02/short-talk-at-the-jax-2008-android/#comments</comments>
		<pubDate>Wed, 02 Apr 2008 08:27:51 +0000</pubDate>
		<dc:creator>P.G.Taboada</dc:creator>
				<category><![CDATA[conferences]]></category>
		<category><![CDATA[Java & Co.]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[android]]></category>

		<guid isPermaLink="false">http://pgt.de/?p=142</guid>
		<description><![CDATA[<p>Steffen and I will be talking at the mobility day about Google’s mobile platform Android:</p> <p>Google Android: Uncanny Valley – unheimliches Tal? Google Mobile für Java Entwickler </p> <p>Im November 2007 stellt Google ein Handybetriebssystem namens Android vor. Das entsprechende SDK für Android-Applikationen ist Java-basiert, kommt mit Eclipse Plug-in, hat Bibliotheken für openGL, Bluetooth [...]]]></description>
			<content:encoded><![CDATA[<p>Steffen and I will be talking at the mobility day about Google’s mobile platform Android:</p>
<blockquote><p><strong>Google Android: Uncanny Valley – unheimliches Tal? Google Mobile für Java Entwickler<br />
</strong></p>
<p>Im November 2007 stellt Google ein Handybetriebssystem namens Android vor. Das entsprechende SDK für Android-Applikationen ist Java-basiert, kommt mit Eclipse Plug-in, hat Bibliotheken für openGL, Bluetooth oder USB und produziert Java Byte Code. Ausgeführt wird dieser allerdings nicht auf einer JavaVM. Der Vortrag zeigt die Möglichkeiten des neuen Ansatzes in einer Welt fern von JCP-Standards.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://pgt.de/2008/04/02/short-talk-at-the-jax-2008-android/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Artikel zu Java und Concurrency</title>
		<link>http://pgt.de/2008/02/20/artikel-zu-java-und-concurrency/</link>
		<comments>http://pgt.de/2008/02/20/artikel-zu-java-und-concurrency/#comments</comments>
		<pubDate>Wed, 20 Feb 2008 09:49:13 +0000</pubDate>
		<dc:creator>P.G.Taboada</dc:creator>
				<category><![CDATA[GWT]]></category>
		<category><![CDATA[Java & Co.]]></category>
		<category><![CDATA[articles]]></category>
		<category><![CDATA[concurrency]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://pgt.de/?p=164</guid>
		<description><![CDATA[ <p>Steffen Schluff hat einen Artikel zum Thema Java und Concurrency geschrieben:</p> <p>Der seit den 70er Jahren vorhandene Trend, dass jede neue Prozessor Generation eine deutliche Steigerung der Taktfrequenz mit sich bringt, beginnt langsam aber sicher abzuebben. Die Hardware Hersteller versuchen nun, ihr Glück in der Erhöhung der verfügbaren Anzahl Prozessoren je Chip zu [...]]]></description>
			<content:encoded><![CDATA[<div class="entry-content">
<p>Steffen Schluff hat einen Artikel zum Thema Java und Concurrency geschrieben:</p>
<blockquote><p>Der seit den 70er Jahren vorhandene Trend, dass jede neue Prozessor Generation eine deutliche Steigerung der Taktfrequenz mit sich bringt, beginnt langsam aber sicher abzuebben. Die Hardware Hersteller versuchen nun, ihr Glück in der Erhöhung der verfügbaren Anzahl Prozessoren je Chip zu finden. Dementsprechend wird sich auch die Softwareentwicklung über kurz oder lang an diese neuen Rahmenbedingungen anpassen müssen.</p>
<p>Die Programmiersprache Java hat mit Java 5 in Form der sogenannten Concurrency Utilities eine mächtige neue API dazugewonnen, die es Programmierern erlaubt, mit ganz neuen Voraussetzungen an die Entwicklung von Multithreaded Anwendungen heranzugehen. Der vorliegende Artikel zeigt auf, warum das Themenfeld in Zukunft an Bedeutung gewinnen wird und stellt die wichtigsten Inhalte dieser API vor.</p></blockquote>
<p>Mehr gibt es <a href="http://www.oio.de/public/java/concurrency/concurrency-utils.htm" target="_blank">hier zu lesen</a>…</div>
]]></content:encoded>
			<wfw:commentRss>http://pgt.de/2008/02/20/artikel-zu-java-und-concurrency/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Non invasive GWT and Spring integration</title>
		<link>http://pgt.de/2008/02/14/non-invasive-gwt-and-spring-integration/</link>
		<comments>http://pgt.de/2008/02/14/non-invasive-gwt-and-spring-integration/#comments</comments>
		<pubDate>Thu, 14 Feb 2008 08:44:20 +0000</pubDate>
		<dc:creator>P.G.Taboada</dc:creator>
				<category><![CDATA[GWT]]></category>
		<category><![CDATA[Java & Co.]]></category>
		<category><![CDATA[gwt]]></category>
		<category><![CDATA[spring]]></category>

		<guid isPermaLink="false">http://pgt.de/?p=151</guid>
		<description><![CDATA[<p>[update] If you are working with GWT 1.6, you probably would like to have a look at this here: http://pgt.de/2009/07/17/non-invasive-gwt-and-spring-integration-reloaded/ [update]</p> <p>Obviously I am not the only one looking for a way to integrate my Spring backend into some GWiT application. After searching for a while I didn’t find any suiting solution. There are [...]]]></description>
			<content:encoded><![CDATA[<p>[update]<br />
If you are working with GWT 1.6, you probably would like to have a look at this here:<br />
<a href="http://pgt.de/2009/07/17/non-invasive-gwt-and-spring-integration-reloaded/">http://pgt.de/2009/07/17/non-invasive-gwt-and-spring-integration-reloaded/</a><br />
[update]</p>
<p>Obviously I am not the only one looking for a way to integrate my Spring backend into some GWiT application. After searching for a while I didn’t find any suiting solution. There are some interesting approaches (like <a href="http://gwt-widget.sourceforge.net/" target="_blank">GWT Widget Library</a> SL and using the maven plugin), but being new to GWiT I did not want to give up the GWiT Development Shell neither the embeded Tomcat. I wanted the integration to be less invasive as possible.</p>
<p>So here is what I did…</p>
<p>First problem I had to solve was how to get my configuration elements into the tomcat configuration. I needed to add some listeners to the web.xml (e.g. to start the Spring container and Acegi security):</p>
<p>Here is a snippet from my web.xml showing how to use the listeners provided by the Spring Framework to start an application context and to configure log4j properly:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">(...)
...)
&nbsp;
log4jConfigLocation
/WEB-INF/log4j.xml
&nbsp;
contextConfigLocation
classpath:/META-INF/spring-conf.xml
&nbsp;
			org.springframework.web.util.Log4jConfigListener
&nbsp;
			org.springframework.web.context.ContextLoaderListener
&nbsp;
			org.springframework.web.context.request.RequestContextListener
&nbsp;
(...)</pre></div></div>

<p>GWiT does not provide any extension point for custom configuration, so I had to add the configuration elements directly to the provided Tomcat web.xml. I cannot make changes to the web.xml in the ROOT web application, since this web.xml is re-generated by GWiT every time the Development Shell is started. Fortunately, the default web.xml stored in the “conf” directory of the embedded Tomcat is generated only one. So I found some place to add my configuration elements. Unfortunately the configuration there is not reusable, so I am having double configuration here: configuration for the development and configuration for the deployment.</p>
<p>Next, I wanted to easily have access to my Spring beans. JSF developers have a variable resolver and have access to their Spring beans for free. I wanted that too. Again, being new to GWiT, I didn’t want to loose the features provided by the IDE (Eclipse + GWT-Designer in this case). It is nice to simply say “add new remote service” in the IDE and get everything wired out of the box. For different reasons I do want to expose my Spring beans automatically to the GWiT application. JSF developers have the services for free at the SERVER SIDE: the services do not get exposed via RPC automatically. I wanted something similar: my GWiT remote service implementation should have access to the Spring backend for free without exposing anything automatically.</p>
<p><div style="padding: 50px 10px 50px 10px; text-align:center;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-8682101792434953";
/* blogposts */
google_ad_slot = "3634251742";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div></p>
<p>I wanted some sort of dependency injection. Since the servlets are managed by the servlet container and the servlet container does not know anything about dependeny injection of Spring beans into servlets I had to do it myself.</p>
<p>First, I needed some sort of markup to identify what to inject. I was using JDK 5 syntax on none client sources, so I used an annotation. I could also have used some marker interface for my services, but I found this to be to invasive, I did not touch my backend files.</p>

<div class="wp_syntax"><div class="code"><pre class="java5" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.lang.annotation.ElementType</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.lang.annotation.Retention</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.lang.annotation.RetentionPolicy</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.lang.annotation.Target</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
 * Annotation used to flag auto injection.
 */</span>
@<span style="color: #003399; font-weight: bold;">Retention</span><span style="color: #009900;">&#40;</span><span style="color: #003399; font-weight: bold;">RetentionPolicy</span>.<span style="color: #006633;">RUNTIME</span><span style="color: #009900;">&#41;</span>
@<span style="color: #003399; font-weight: bold;">Target</span><span style="color: #009900;">&#40;</span>value = <span style="color: #003399; font-weight: bold;">ElementType</span>.<span style="color: #006633;">METHOD</span><span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">public</span> @<span style="color: #000000; font-weight: bold;">interface</span> AutoInject <span style="color: #009900;">&#123;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>All I wanted to do is to add this annotation to my setter methods in my GWiT remote service implementations. So I extended the RemoteServiceServlet provided by GWiT and implemented the auto injection.</p>

<div class="wp_syntax"><div class="code"><pre class="java5" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.lang.reflect.Method</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.servlet.ServletException</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.slf4j.Logger</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.slf4j.LoggerFactory</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.springframework.web.context.WebApplicationContext</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.springframework.web.context.support.WebApplicationContextUtils</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.google.gwt.user.server.rpc.RemoteServiceServlet</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
 * Provides automatic injection into GWT services. Only setter methods with exactly one parameter and
 * annotated with AutoInject will be considered for auto injection.
 *
 */</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">abstract</span> <span style="color: #000000; font-weight: bold;">class</span> AutoInjectingRemoteServiceServlet <span style="color: #000000; font-weight: bold;">extends</span> RemoteServiceServlet <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #008000; font-style: italic; font-weight: bold;">/**
     * Logger.
     */</span>
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399; font-weight: bold;">Logger</span> LOG = LoggerFactory.<span style="color: #006633;">getLogger</span><span style="color: #009900;">&#40;</span>AutoInjectingRemoteServiceServlet.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #008000; font-style: italic; font-weight: bold;">/** Reference for the WebApplicationContext. */</span>
    <span style="color: #000000; font-weight: bold;">private</span> WebApplicationContext ctx<span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #008000; font-style: italic; font-weight: bold;">/**
     * {@inheritDoc}
     */</span>
    @<span style="color: #003399; font-weight: bold;">Override</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #006600; font-weight: bold;">void</span> init<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> ServletException <span style="color: #009900;">&#123;</span>
        LOG.<span style="color: #006633;">debug</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Initializing servlet&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        LOG.<span style="color: #006633;">debug</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Get reference to the Spring Application Context&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        ctx = WebApplicationContextUtils.<span style="color: #006633;">getWebApplicationContext</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">getServletContext</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003399; font-weight: bold;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>ctx<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        LOG.<span style="color: #006633;">debug</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Spring ctx with: {} beans.&quot;</span>, ctx.<span style="color: #006633;">getBeanDefinitionCount</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">populateVariables</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #008000; font-style: italic; font-weight: bold;">/**
     * Performs auto injection on this servlet instance.
     */</span>
    @<span style="color: #003399; font-weight: bold;">SuppressWarnings</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;unchecked&quot;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #006600; font-weight: bold;">void</span> populateVariables<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        LOG.<span style="color: #006633;">debug</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Start servlet auto injection&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003399; font-weight: bold;">Method</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> methods = <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">getClass</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getMethods</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000;  font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #006600; font-weight: bold;">int</span> i = <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span> methods.<span style="color: #006633;">length</span><span style="color: #339933;">;</span> i++<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #003399; font-weight: bold;">Method</span> method = methods<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #000000;  font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>method.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">startsWith</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;set&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> method.<span style="color: #006633;">isAnnotationPresent</span><span style="color: #009900;">&#40;</span>AutoInject.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span>
                    <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> method.<span style="color: #006633;">getParameterTypes</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">length</span> == <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #003399; font-weight: bold;">Class</span> type = method.<span style="color: #006633;">getParameterTypes</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                LOG.<span style="color: #006633;">debug</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Looking for: {}&quot;</span>, type<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #003399; font-weight: bold;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> beanNamesForType = ctx.<span style="color: #006633;">getBeanNamesForType</span><span style="color: #009900;">&#40;</span>type, <span style="color: #006600; font-weight: bold;">false</span>, <span style="color: #006600; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                LOG.<span style="color: #006633;">debug</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Got {} with {} elements&quot;</span>, beanNamesForType, beanNamesForType.<span style="color: #006633;">length</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000000;  font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>beanNamesForType.<span style="color: #006633;">length</span> <span style="color: #339933;">!</span>= <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                    LOG.<span style="color: #006633;">error</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;There is no bean of type {} for autoinjection&quot;</span>, type.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span> <span style="color: #000000;  font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
                    <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
                        method.<span style="color: #006633;">invoke</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>, ctx.<span style="color: #006633;">getBean</span><span style="color: #009900;">&#40;</span>beanNamesForType<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        LOG.<span style="color: #006633;">info</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Injected bean: {} on field {} &quot;</span>, beanNamesForType<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span>, <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">getClass</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399; font-weight: bold;">Throwable</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                        LOG.<span style="color: #006633;">error</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Error: could not inject into &quot;</span> + <span style="color: #0000ff;">&quot;protected variable {}, cause: {}&quot;</span>, method.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, e
                                .<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #000000;  font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>LOG.<span style="color: #006633;">isDebugEnabled</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                            e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #009900;">&#125;</span>
                    <span style="color: #009900;">&#125;</span>
                <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>In short: in the initialization of the servlet I pickup the Spring application context and do the injection for all setter methods annotated.</p>
<p>In the following GWiT remote service implementation I use this injection to get access to my Spring login service (that itself uses acegi, the user DAO and a session scoped bean):</p>

<div class="wp_syntax"><div class="code"><pre class="java5" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> GwtLoginServiceImpl <span style="color: #000000; font-weight: bold;">extends</span> AutoInjectingRemoteServiceServlet <span style="color: #000000; font-weight: bold;">implements</span> GwtLoginService <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">private</span> ILoginService loginService<span style="color: #339933;">;</span>
&nbsp;
	@AutoInject
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #006600; font-weight: bold;">void</span> setLogService<span style="color: #009900;">&#40;</span>ILoginService loginService<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">loginService</span> = loginService<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	@<span style="color: #003399; font-weight: bold;">Override</span>
	<span style="color: #000000; font-weight: bold;">public</span> LoginResult doLogin<span style="color: #009900;">&#40;</span><span style="color: #003399; font-weight: bold;">String</span> username, <span style="color: #003399; font-weight: bold;">String</span> password<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		LoginResult result = <span style="color: #000000; font-weight: bold;">new</span> LoginResult<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
			result.<span style="color: #006633;">loggedInUser</span> = loginService.<span style="color: #006633;">doLogin</span><span style="color: #009900;">&#40;</span>username, password<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			result.<span style="color: #006633;">successFull</span> = <span style="color: #006600; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>BadCredentialsException bce<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			result.<span style="color: #006633;">successFull</span> = <span style="color: #006600; font-weight: bold;">false</span><span style="color: #339933;">;</span>
			result.<span style="color: #006633;">errorMessage</span> = <span style="color: #0000ff;">&quot;Bad credentials.&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399; font-weight: bold;">Throwable</span> t<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			result.<span style="color: #006633;">successFull</span> = <span style="color: #006600; font-weight: bold;">false</span><span style="color: #339933;">;</span>
			result.<span style="color: #006633;">errorMessage</span> = <span style="color: #0000ff;">&quot;Server error.&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">return</span> result<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	@<span style="color: #003399; font-weight: bold;">Override</span>
	<span style="color: #000000; font-weight: bold;">public</span> UserDTO isLoggedIn<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> loginService.<span style="color: #006633;">isLoggedIn</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	@<span style="color: #003399; font-weight: bold;">Override</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #006600; font-weight: bold;">void</span> doLogout<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		loginService.<span style="color: #006633;">doLogout</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>While this leads to a lot of delegation code, I am still happy with the layer separation and the easy usage.</p>
<p>When playing with GWiT 1.5 (build from the trunk) a few weeks ago, I noticed that GWiT started overriding the web.xml in the embeded Tomcat configuration directory. I just thought “oh no!”, but next thing I noticed was that it stopped overriding the application web.xml in the ROOT webapps folder. Let’s see if it stays this way…</p>
]]></content:encoded>
			<wfw:commentRss>http://pgt.de/2008/02/14/non-invasive-gwt-and-spring-integration/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

