lundi nov. 09, 2009

javax.annotation.ManagedBean

This blog has moved to alexismp.wordpress.com
Follow the link for the most up-to-date version of this blog entry.

You might have heard of "managed beans" before, but chances are these will be new to you. These are not specific to JSF and not related to JMX in any way. Rather, Java EE 6 specifies Managed Beans 1.0, or lightweight components.

Managed beans are plain old java objects whose life-cycle is governed by the container (allowing for creation and destruction callbacks) and supports resource injection (and of course can themselves be injected). To define a managed bean, you simply need to annotate a class with @java.annotation.ManagedBean. You can apply the existing (JSR 250) @PostConstruct and @PreDestroy annotations to methods in that bean and inject resources using @Resources (as well as with @EJB or @WebServiceRef). Here's a simple example :

@javax.annotation.ManagedBean
public class MessagesBean {
    @Resource
    TranslationBean localizer;

    @PostConstruct
    public void myInit() {
        System.out.println("\*\*\* Constructed!");
        // Do something useful
    }

    public String getTranslatedMessage(String message) {
        return localizer.translate(message);
    }
}

Such a class can then be deployed within a WAR, an EJB-JAR or an ACC-JAR and can be injected within another Managed Bean, a servlet, an EJB or a JSF Managed Bean using a simple @Resource MessagesBean bean; statement. Life-cycle and injection in itself is nice but it gets even better with interceptors which can also be applied to managed beans (no longer to just EJB's) :

@Interceptors(LogInterceptor.class)
@javax.annotation.ManagedBean
public class MessagesBean {
     ...
}

Whether Managed Beans will be used directly by application developers or mostly for building higher level abstractions such as EJB's (transactional managed beans in a sense), JAX-WS endpoints (SOAP-enabled managed beans) or JSR 299 is yet to be defined. You decide.

You can of course try all of the above in GlassFish v3.

mercredi sept. 09, 2009

GlassFish v3 at JavaZone - slides, demos and screencasts

Here are the slides that I presented on GlassFish v3 at the JavaZone conference today. All five demos went fine (some with the help of the audience), and I even got questions at the end. I'm not sure what the plans are for making the conference talks available (delay, format), so here are the five demos (almost identical) in various screencasts :

Painless development with GlassFish (deploy on change, session preservation, etc...). Use it today on any GlassFish v3 install.
Painless Java EE 6 development (James Gosling himself, only using NetBeans, not Eclipse like I did). Starts at 12:21. Same as above - any v3 version.
• GlassFish à la Carte - Part 1, Part 2, Part 3 (the closest to what I showed) - Same as above, IPS has been there from day one (much improved in recent builds though).
Extending GlassFish v3, OSGi-style (by Jerome Dochez, the GlassFish architect), note that recent promoted builds of GlassFish v3 now ships with the Felix OSGi declarative service bundle by default, no need to install it manually.
• (I don't know of a screencast showing the RESTful admin, but Rajeshwar blog would be a good start and Ludo's JavaFX demo a fun illustration). Using recent promoted builds is recommended.

Update: the video is available (streaming + QT format). Demo timing are documented here.

Let's enjoy the rest of the conference now...

dimanche avr. 26, 2009

Antonio's book on Java EE 6 (and GlassFish v3)

Antonio Goncalves seems to have just shipped his work for his new Java EE 6 book. It sounds like the very first one to cover this topic which is quite a challenge given the specification will be final only in a few months. In the mean time, I wish Antonio the best for JavaOne sales! He's certainly very well positioned to write such a book - at the heart of the matter, yet not a "vendor" but rather a exemplary Java community member.

GlassFish v3 as covered in this book (great to have GlassFish be part of the title!) is also a moving target since "Prelude" was released last year with a Java EE 5 web container and previews of EJB 3.1 and JSF 2.0 available via the update center. In the mean time, only promoted builds of the Java EE 6 work have been made available, so I hope Antonio will have a chance the refresh the content when Java EE 6 and GlassFish v3 ship later this year in a second edition of the book.

vendredi avr. 03, 2009

GlassFish l'aquarium in Paris - Presentation Slides

The latest GlassFish Community Day in Paris dubbed "l'aquarium" took place this past Monday. The agenda covered Java EE 6, GlassFish Portfolio (including ESB and WebSpace) but also MySQL and OpenSSO. The other interesting part is the large number (almost half) of non-Sun speakers. Here are the slides for the various presentations (some in French, most in English). Thanks to all the speakers and to the attendees (I hope you like the new GlassFish shirt!).

"Bienvenue et Introduction GlassFish Portfolio", Jean-Yves Pronier (SlideShare, PDF)
"Java EE 6", Roberto Chinnici (SlideShare, PDF)
"GlassFish v3, en route Java EE 6", Alexis Moussine-Pouchkine (SlideShare, PDF)
"GlassFish Web Space", Patrice Goutin (SlideShare, PDF)
"Retour d'expérience OpenMQ (1)", Jérôme Molière, Mentor/J (SlideShare, PDF)
"GlassFish Enterprise 2.1, production", Didier Burkhalter, Alexis Moussine-Pouchkine (SlideShare, PDF)
"Transaction support, guaranty of delivery and consistency with Glassfish ESB BPEL", Paul Perez et Bruno Sinkovic, Pymma Consulting (Source from Pymma Consulting)
"Retour d'expérience OpenMQ (2)", François Ostyn (SlideShare, PDF)
"Authentification Web unique, Fédération d'identité et sécurisation de services Web .Net et Java avec OpenSSO", Alain Barbier, Sun Microsystems et Stève Sfartz, Microsoft (SlideShare, PDF)
"MySQL HA Solutions", Lenz Grimmer (SlideShare, PDF)

vendredi août 08, 2008

New GlassFish Podcast episode, Java EE 6 with Roberto

I posted a new episode of the GlassFish podcast. This time, it's Roberto Chinnici's Java EE 6 presentation from the Jazoon conference back in June. The audio is far from perfect but I decided content mattered more than container...
Update: I posted the second part as well.

lundi juil. 21, 2008

Java EE 6 - le point à mi-parcours.

Il y a à peine plus d'un an, je mentionnais pour la première fois Java EE 6 (JSR 316). Il semble y avoir un large consensus sur les différents JSR. Il y a également un consensus sur les trois thèmes proposés: extensibilité, profils et pruning. Clairement les profils a pas mal fait parlé d'eux: faut-il un web profile de type "tomcat" ou bien quelque chose de plus riche (voir le billet de Roberto sur ce sujet). Ce qui est clair c'est qu'il n'y aura qu'un seul profil "web" (pas question de maintenir les profils A et B). Après la présentation de Rod Johnson à Jazoon en Juin dernier, il semble que SpringSource ne s'oppose plus au profil B qui contient EJB 3.1 Lite (session+interface locales), WebBeans 1.0, et JSF 2.0.

Clairement Servlet 3.0 me parait comme une avancé significative. C'est elle qui va permettre en grande partie l'extensibilité (déposer les JAR de son framework dans un répertoire précis suffira, plus d'édition de web.xml), de standardiser les mécanismes de suspend/resume utilisés par Comet, et d'avoir (enfin) une approche POJO (annotation @Servlet). JPA 2.0 (specification séparée des EJB) et EJB 3.1 sont des incréments importants et nécessaires après des versions 1.0 déjà bien réussies.

Le succès de WebBeans me parait être une inconnue même si l'unification du modèle de composant est selon moi un "no-brainer". JAX-RS aura certainement beaucoup de succès mais je vois déjà les discussions "JAX-WS ou JAX-RS?" occuper les architectes dans les entreprises et les SSII y passer du temps (à leur grand plaisir! ;-).

Le calendrier initial était effectivement un peu agressif (sachant également que d'autres ne sont pas encore arrivés encore à Java EE 5). Rendez-vous donc pour la beta Java EE 6 l'année prochaine. GlassFish v3 sera aligné avec cette version de la spécification et la version TechPreview 2 propose déjà quelques implémentations en avance de phase au travers de son update center (EJB 3.1, JAX-RS 1.0, ...).

About

This blog has moved

Alexis Moussine-Pouchkine's Weblog

GlassFish - Stay Connected

Search

Archives
« avril 2014
lun.mar.mer.jeu.ven.sam.dim.
 
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
    
       
Today
Blogroll

No bookmarks in folder

News

No bookmarks in folder