Here are the slides from my JavaOne talk on CDI 1.1 :-)
In Relation To CDI
In Relation To CDI
The CDI support is also a partial implementation of JSR-107 - the temporary caching API for Java that has recently reactivated and published a first draft for review . Greg's blog has more on using JSR-107.
We would like to thank everyone that provided feedback to the announcement we made earlier this week.
We feel that the main concerns people have can be expressed as follows (please let us know if we've missed something!):
- Portability: one of the promises of Seam, CDI and Java EE has been portability, and the community is loath to give this up. We do believe in portability and standards (just look at the evidence). We're reworking our ideas to make sure that portability remains a central goal. We're even looking at ways in which we can make your apps more portable!
- Getting stuff done: one of the reasons that people loved Seam 1 and Seam 2 was that it offered a complete solution to build a Java enterprise application, on top of the Java EE standard. We feel that we have let the community down in this area, and really want to focus on this goal going forward. Whatever happens, this will be a foundation stone.
- Community: the Seam community has always been a strong one, and we look forward to continuing to work with this passionate community.
- Migration: Seam 3 is built on top of standards - Java EE 6 and CDI. JBoss is committed to this as the core programming model and will offer a migration path from Seam 2 to Java EE 6 and make sure that Seam 3 apps run on Java EE 6, and integrate nicely with other parts of the Java EE / CDI ecosystem.
We are currently working on a proposal which we think will address your concerns. We all feel passionately that what is right for the community is right for us. With that in mind we would like to have an open consultation period about what comes next. You guys are the ones at the rockface, and you know what you need. We want to listen to what you have to say. We've started a forum thread on which to have this debate, and the Seam team are going into this with an open mind (but remember we can't promise to do everything you want -- you'll never get a free iPad with every Seam download!).
Those of you who have sent us feedback privately (email, IRC etc.), please chime in on this thread with your thoughts and comments so the entire community can benefit from hearing your viewpoint - some of the feedback has been very insightful.
[Adminstrative note: we've disabled comments on this post, please post on the forum with your thoughts!]
We'd like to thank everyone for their comments - on twitter, on IRC and in the comments section. There have been some excellent concerns raised, and, believe it or not, those same reasons are at the heart of why we want to make the changes we discussed here. We have exactly the same concerns the community has raised.
We would like to reassure everyone on a few points:
- We are convinced that one of things that drove people to adopt Seam 1 and Seam 2 was strong focus on how to build real applications. We are well aware that Seam 3 hasn't offered that and we want to focus on providing that
- We still believe in portability and standards, and we want to take the knowledge we have about building portable standards and applications out of the Seam silo, and to the rest of the Java EE ecosystem. We will continue to standardise APIs and ideas that we believe are necessary
- That we love the Seam community and their passion and that we want bring this community into the heart of the Java EE community, where it belongs
- We will ensure that apps built using Seam 3.x will continue to run. We will continue to support anyone who wants to build a CDI extension
However we made a mistake. We told you about the outcome we think is the right way to address this. We didn't tell you why we want to do it, or how it supports these goals. We don't want to jump right in with a half-baked position right now, and make that mistake again. So we ask that you give us the benefit of the doubt, and trust that we do have the community's best interests at heart, and watch this space for the whole picture over the next couple of days.
I'd like to take a few moments to update everyone on what is happening within the Seam project, and to clear up a few rumours that have started to float around before they start to balloon out of control (how do these things start up anyway???). As some of you might know, we recently held a JBoss face to face meeting in Toronto, Canada where besides consuming vast amounts of alcohol and staying up into the wee hours of the night coding and talking about important stuff like politics and humorous YouTube videos, we actually made a number of important decisions about the direction and focus of the Seam project as a whole.
Over the years, Seam has evolved by quite a substantial amount - if you were to ask the core team members for an executive summary of what Seam was, then the answer would have changed every year. In the very beginning, Seam was intended to solve some of the shortcomings of developing applications with JSF and EJB (and unfortunately this is the impression that has stuck with many people, even until now). It quickly grew into a powerful DI component framework, and more and more features have been added over time. It has spawned quite a number of innovations and sister projects - CDI, Weld and Arquillian to name a few. I'm also pleased to say that Seam is successfully powering many, many production web sites and rich internet applications today.
So, that brings us to the present. In the latter part of 2011, what is Seam's focus, and what goals does it set out to achieve? Well, let's start by looking at the goals it has already achieved. The core features of Seam - dependency injection, contextual component model, event bus, interceptors, i.e. the
frameworky stuff has all been standardised as JSR-299 (CDI). Since this is now all part of the Java EE specification, and comes as standard in any compliant Java EE6 container, we now have a fantastic foundation to build on. However, it is just a foundation - as an experienced home renovator I know that the foundation is the most important part of building a structure, however having a foundation alone doesn't give you a place to live - you still need to build a house on top of it.
That's where Seam comes in. It helps you, the developer, by providing the tools and materials necessary to build a house on top of the CDI-based foundation. It does this by integrating various useful libraries - libraries that are important for everyday application development - with the CDI component model so that you can write
one kind of stuff, to coin a phrase that Gavin came up with quite some time ago.
Well yes, yes it was. But we've recently come to the conclusion that the Seam project shouldn't be a destination, it should be a journey. Ooh, so Zen!!...but what does this mean? Well, let me explain - Seam's goal is all about supporting the CDI ecosystem, and promoting
CDI Everywhere. Why? Because, if we're all building our tools and libraries on the same standards-based component model, then we're all going to be much more productive when it comes to developing our rich internet applications. So, in light of this goal it doesn't make sense for Seam to be gathering crops - rather it should be planting seeds. In other words, there are many modules currently in Seam that we think would make better sense if they were situated somewhere more
closer to home, so to speak.
Let's take a look at a concrete example - the Seam Persistence module. This module provides an extension-managed persistence context, useful for when your project needs to inject an EntityManager into a POJO bean, or if your persistence context needs to last longer than a single request. These are features that we consider to be essential for day to day application development. But in light of the goal of strengthening the CDI ecosystem, do these features really belong in Seam? At JBoss we have another well known project which deals with EntityManagers and persistence contexts and other databasey-related stuff - perhaps you've even heard of it (I'll give you a clue, it starts with
So instead of Seam trying to
capture all of the CDI extensions in one place, like Pokemon, we should be trying to propagate them throughout the greater developer community instead. To that end, our focus is going to shift somewhat, and we've already made some concrete plans towards achieving that goal. Here's a few of the changes that we're proposing:
- Seam Persistence - Move into the Hibernate core project, re-brand as
- Seam Validation - Move into Hibernate Validator, make CDI support part of the core offering
- Seam Wicket - Moving into the Wicket project itself, this is already in motion
- Seam REST - Moving into the RESTEasy project
- Seam Faces - Moving into RichFaces as a standalone
Faces CDIintegration library
As a part of the Seam community, you may have concerns that these changes might fracture the Seam project, or the community itself. I'd like to address this concern up front, and say that what we want to achieve is the exact opposite of this. Our aim is to broaden the existing community, by working closer with other projects to achieve a common goal. The current module leads will stay the same, however they will be working together with the other project leads to deliver native CDI support directly from their project. The end of result of this can only be a positive gain, as projects take more ownership of their own CDI integration, and work more closely with the Seam developer community to leverage the experience we have at building CDI extensions.
So while some modules may graduate from Seam to become part of the broader CDI ecosystem, there are still many features that are unique to Seam itself. These modules will remain within the Seam project for the foreseeable future, and Seam will continue to be an incubator for innovative development solutions and ideas. We still have much work to do, and many ideas on how we can provide new value-added features to Seam for our users.
We are planning on our next bundled release (3.1) to be our last. Note I said
bundled - this release is basically a big zip file that contains the latest versions of all our modules. With our new focus, the bundled release just doesn't make a whole lot of sense any more. What we will continue to do however, is release each Seam module whenever it has received enough bug fixes and feature updates to warrant a brand new release.
From what I have heard personally, most of our developers are using Maven for dependency management anyway and so this change isn't going to make an iota of difference to them.
So to sum up, Seam is not going away, rather its new goal is to unite the CDI developer community, and it will continue to foster innovation and encourage new ideas and improvements. If you have any questions or concerns about this, I look forward to addressing them in the comment section below.
- Introducing Contexts and Dependency Injection 1.1 - technical session in which I'll overview some of the changes coming in CDI 1.1
- CDI Today and Tomorrow - panel session on CDI with David Blevins, Arun Gupta, Sivakumar Thyagarajan and Reza Rahman
- Making Java EE Cloud-Friendly: JSR 347, Data Grids for the Java Platform - BOF with Manik Surtani
- Java EE in the Cloud - a technical session in which I'll show you how to use Java EE in the cloud, using Red Hat's OpenShift Platform-as-a-Service
- Using Infinispan as a remote data store - a technical session with Galder Zamarreño in which we'll show you how to use Infinispan as a remote data store on Red Hat's OpenShift Platform-as-a-Service, with a client app written using CDI.
JUDCon is the official JBoss Users and Developers Conference, and is great value at £100 for a day - so if you near London, I recommend registering today!Devoxx
- Real-world deep-dive into Infinispan - the open source data grid platform - university talk with Manik Surtani and Mircea Markus in which we'll deep dive into Infinispan
- The Java EE BOF series - 3 hours of discussions on Java EE, CDI and Seam with people such as Emmanuel, Dan, Alexis Moussine-Pouchkine's and Nigel Deakin - and I know more will be confirmed later!
- OpenShift is the first PaaS to offer Java EE 6 support
- OpenShift Express is 100% free, and allows you to run as many non-clustered applications you want on JBoss AS 7
- OpenShift Express offers neat management of your apps via Git, including a source compilation mode
- OpenShift Flex gives you much more freedom, including the ability to run clustered applications, and offers monitoring and automatic scaling.
- OpenShift Flex is free, but you need to provide the EC2 instances. However Red Hat is offering a free 1 month/30 hour trial, so there is no reason not to check it out right now
- JBoss AS 7 implements the Java EE 6 web profile, with all the benefits of the excellent CDI-based programming model it offers. It's very snappy to use, so deploying apps is quick
This week we've been pushing out material like crazy. If you want to give Java EE 6 in the cloud a try check out these resources:
- Getting Started with OpenShift Express [Windows | Fedora | Mac ]
- Using Java EE 6 on OpenShfit Express
- Mobile to Cloud in 4 minutes using OpenShift Express
- Use Seam in OpenShift Express [ Blog | Screencast ]
- JBoss on OpenShift Overview
- JBoss AS 7 on OpenShift Express
- Using Infinispan with CDI on OpenShift Express
To find out more, check out jboss.org.
I just got back from the excellent Paris JUG where I presented CDI to a packed room.
We started by covering the basics - the Java EE 6 platform, before doing a deep dive (using the Weld Pastecode example) into the various features CDI offers and when you might want to use them. We also took a look at EJBs and how you can use them to supplement the programming model offered by CDI. The slides I used are available .
After the break, we then took a look writing CDI extensions. We took a look at the way you can observe the events CDI fires when the container starts, and how you can use these to modify the deployment. We then used a few examples from the cdi-extensions-showcase to show how simple yet powerful the extensions SPI is. The slides I used are available .
You can hardly fail to have noticed that JBoss AS 7 is coming any day now - everyone at JBoss is pretty excited by this!
We want everyone to check it out, as we think the improvements it offers (2.5s boot, small memory footprint, super easy config and more) will have you dancing in the streets. To get you going, we've arranged a special series of webinars covering AS7 for the end of June. Jason Greene will give you an overview of AS7, Dan Allen and myself will show you how to write and test Java EE6 apps for AS7, Brian Stansberry will demonstrate exactly how easy it is to configure a JBoss AS 7 domain and Paul Ferraro and Bela Ban will show you how to cluster JBoss AS 7.
Get your registration done today!
The JBoss World opening Keynote featured one of the best keynote demonstrations I've ever seen!! Part of that demonstration included a RichFaces application customized for the mobile web call TweetStream. We are going to talk about that app, why it works so well for mobile web development, and how you can get it running on your machine.
The entire JBoss World demonstration included many JBoss projects; such as JBoss AS, Infinispan, Hibernate OGM, CDI, and Errai. A video of the keynote & demo is available through the image on the left. The demo starts around 35:15 minutes in. And yes that WAS my real iPad/iPhone password :-)
The latest JBoss Assylum also features many of the developers giving behind the scenes perspective and humor. Each project will be providing blogs and code for its own part. You can get the latest at the JBoss World Keynote 2011 landing page, and follow along with the #jbwkeynote2011 twitter hashtag!
Wesley Hales and I were looking for an application to show RichFaces 4 on mobile devices for our JUDCon presentation: Filling the Gap: Going Mobile With JBoss Technologies Today. We came up with a simple idea that would be instantly recognizable, allow audience participation, and with just enough UI complexity. It was around this time that JBoss Keynote was being planned, and TweetStream just fit right in!
TweetStream uses twitter4j to search and filter a stream of tweets containing a set of hashtags, and displays them to the user. It also keeps track and calculates the top 10 tweeters, and the top 10 hashtags. It then uses RichFaces Push to keep the UI updated with the latest content across devices.
In front of this Wesley and I built a set of RichFaces 4 views that provide advanced support for different mobile devices. We targeted webkit browsers that run on iPhones, iPads, BlackBerry, and Android devices. Each view is served through a single URL with device detection for a one bookmark solution. We achieved near native behavior using advanced HTML5/CSS3 techniques to process orientation layout changes, transitions, and more.
If you just can't wait to check out the demo on your own machine we have a version of it hosted on RedHat's OpenShift just follow this link http://bit.ly/tweetstream2. The Filling The Gap presentation was also recorded and contains Wesley and I discussing some of the apps details.
Instead of just explaining the various parts all up front lets just jump right into getting the source code, building it, deploying to JBoss AS and integrating it into JBoss Tools. We'll discuss some of the internals below, or is follow up blogs.
The TweetStream source code is part the RichFaces organization on github.com. You can use git to clone the repo with: git clone firstname.lastname@example.org:richfaces/tweetstream.git. We'll talk about the structure after we get it running.
oauth.consumerKey=************************** oauth.consumerSecret=************************** oauth.accessToken=************************** oauth.accessTokenSecret=**************************
Once that's done all that is left is deploying the application!
In the base /tweetstream directory run mvn package to build the standalone version of the application. You should now have the file /tweetstream/target/tweetstream.war. Copy this file to the $JBOSS_HOME/server/default/deploy directory.
At this point your can start the server, but I would recommend you start with the $JBOSS_HOME/bin/run.sh -b 0.0.0.0 if you want to access the server from external clients, like your mobile phone ;-)
Once the application starts up you can see it at http://localhost:8080/tweetstream. If you want to try out your smartphone or tablet you may need to modify you firewall to allow port 8080 through. Then access using your tablet, or phone at
Importing this project into JBoss Tools 3.2 is easy because it uses m2eclipse under the covers. All you need to do is choose File-->Import-->Existing Maven Project, and point it to where you cloned the source code. Eclipse will run through it's normal project import, and in a few minutes have the new project ready to go.
A couple of things to note:
- Add your JBoss AS 6 server as normal and you can configure TweetStream to be deployed
- You may see build issues in the /jbw project - I'll explain that in a minute
Now that you have the application running, and hopefully imported into JBoss Tools lets talk about the structure and some of the key areas to look at.
As I alluded to above this application was originally just going to be for Wesley and my JUDCon talk. When it became part of the JBoss World Keynote demo we needed to support two different back-ends. We did this by using the power of CDI, and Maven to create two profiles. A standard profile for JUDCon, and a keynote version. Below is a brief explanation of the various modules:
/tweetstream #Core application and views /shared #Classes files needed across the other two modules /jbw #Keynote specific source files to hook into the different backend
The build errors you get in eclipse for the /jbw directory is because of missing dependencies related to the keynote demo. At some point in the near future we'll be releasing the whole keynote demo, but for now Tweetstream is moduler enough to run on its own.
The way we were easily able to shift our backend so easily is a testament to not only JBoss, but to the Java EE as a whole. The pieces fit together well, and with CDI, and JSF we were able to swap in a completely different backend with very little effort.
As I said we'll be following up this blog with deep-dives into the various details, but for now, here are some things to take a look at:
We use a great little project called mobileESP to help us with device detection. It is a basic user-agent sniffer that we wrapped in a CDI bean to do our bidding in a class called UserAgentProcess.java. This could be swapped out for any of the other device detection libraries such as the WURLF API.
We take advantage of JSF 2.0 and facelets templating to provide a single point of access per view to act as a dispatcher for different devices. This provides a single bookmark and URL no matter what device you are accessing it from. You can review that in the home.xhtml
Using CSS 3 @media selectors makes this a breeze. We use this to great effect in for the tablet view. Always keeping the top tweeters, and top hashtags in the best location.
Making the page handle the page transitions on smartphones was also easier than you'd think. You can review the details in the phoneHome.xhtml file.
TweetStream was developed quickly and with a singular goal in mind. There are some great opportunities for improvements, future RichFaces components, and more. I would like to encourage anyone who is interested to take look in more detail. Here are some possible ideas for improvements
- Streamline device detection
- Customizable search filters
- Layout components to support transitions
- RichFaces Mobile Skins
- Combine, and compress CSS
- Performance analysis and update
- Drill-downs on tweets and tags
- Flush out the desktop version
There are a lot more possibilities, fork it, play, and lets see what you can come up with!! We'll be standardizing and integrating some of these things into RichFaces, and other parts of JBoss so stay tuned!!
Wesley and I are going to post additional blogs and dig into some of the features just touched on above. All of this should give you a good starting point for your own mobile web application using RichFaces 4 and JBoss! Also, as I mentioned above there are going to be several more blogs related to the JBoss World Keynote demo that will detail Infinispan, Hibernate OGM, the plug computers and more!!
Next week, I'll be at the Paris JUG on the evening of Tuesday 14th June. I'll stawt with a CDI overview, and then move on to discuss CDI extensions.
Duchess (a global network for women in Java technology) posted an interview with me in preparation for the Paris JUG (the interview is in French).
See you in Paris!