Eclipse Magazin Titelthema: Eclipse & Ajax

In der Ausgabe Vol. 14 2.08 wurde als Titelthema “Rich Internet Applications” gesetzt. Ich habe den Artikel zu GWT beigesteuert: “Make the Web a Better Place” – gestern habe ich meinen Belegexemplar bekommen. Als Brasilianer habe ich mich besonders über das Bild auf der ersten Seite gefreut!

In meinem Artikel habe ich GWT als Technologie und als Framework kurz vorgestellt. Einfache Beispiele sollen den Einstieg erleichtern:

Google Web Toolkit: Webanwendungen mit GWT entwickeln

Mit dem Google Web Toolkit (GWT) soll ein Java- Entwickler schnell in die Lage versetzt werden, JavaScript/Ajax-Anwendungen zu schreiben. Die Nachfrage ist groß und immer mehr Projekte sollen mit JavaScript im Browser dem Trend des Web 2.0 folgen: von intelligenter Validierung über Drag-and-Drop bis hin zu Mashups mit Google Maps. Der Browser hat sich zur beliebtesten Anwendungsplattform entwickelt, die User Experience ist hier das Schlüsselwort.

Leider wurde Zoltan Horvath in meinem Artikel nicht erwähnt: er hat für mich die Box zu MyGWT geschrieben.

Wir haben beide diese Bibliothek kürzlich in einem Projekt bei OIO eingesetzt. An dieser Stelle nochmal ein “Danke” für die Box und fürs Korrekturlesen.

Artikel zu Java und Concurrency

Steffen Schluff hat einen Artikel zum Thema Java und Concurrency geschrieben:

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.

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.

Mehr gibt es hier zu lesen

Non invasive GWT and Spring integration

[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]

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 GWT Widget Library 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.

So here is what I did…

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):

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:

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.

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.

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.

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.

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.

In short: in the initialization of the servlet I pickup the Spring application context and do the injection for all setter methods annotated.

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):

While this leads to a lot of delegation code, I am still happy with the layer separation and the easy usage.

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…

Spring Framework Certification

A few weeks ago I first read about the Spring Framework Certification (SFC)  program offered by SpringSource:

The Spring Framework Professional Certification (SFC) is for software professionals (architects, developers and consultants) who desire to acquire certification of their Spring Framework knowledge. Achieving this certification provides clear evidence that a software professional understands the basic syntax and structure of the Spring Framework and can develop applications using Spring. (source)

As I did not attend to the “Core Spring Course” I was not directly eligible for registration.  But I qualified as a “grandfathered candidate“.  So I went to the SpringSource booth at the OOP and asked for a voucher.

Today I had my exam.

The exam consists of 50 multiple choice questions. You do answer the quesions on a special software, it lets you review your marked questions at the end. You need 75% to pass the exam, you have 88 (!?!) minutes to complete the test. I cannot write about the questions: first screen you get shown before the exam begins is the non disclosure agreement…

Well, it was a nice experience. I am now SpringSource certified.