Red Hat



In Relation To Pete Muir

In Relation To Pete Muir

CDI 1.1 available :-)

Posted by Pete Muir    |    May 31, 2013    |    Tagged as CDI

I'm pleased to say that CDI 1.1 is available and included in Java EE 7. If you want to learn more, read on, and join a webcast 12th June about all the technologies in Java EE 7. Both webcasts are followed by a Q&A session, when CDI experts will be on hand to answer your questions. The webcast is at [9 am PT / 12 pm ET / 5 pm London] or [9 pm PT / 12 am ET (Thursday) / 2 pm Sydney (Thursday)]

So, what's new in CDI 1.1?

Try it out and find out more

CDI 1.1 Public review draft

Posted by Pete Muir    |    Nov 13, 2012    |    Tagged as CDI

Last week the JCP posted the CDI 1.1 public review draft. This draft continues to incrementally improve the 1.0 spec. We haven't added any major new features, instead we're concentrating on honing 1.0 :-)

  • The CDI class, which provides programmatic access to CDI facilities from outside a managed bean
  • Ability to veto beans declaratively using @Vetoed
  • Conversations in Servlet requests
  • Application lifecycle events in Java EE
  • Injection of Bean metadata into bean instances
  • Programmatic access to a container provided Producer, InjectionTarget, AnnotatedType
  • Ability to override attributes of a Bean via BeanAttributes
  • Ability to process modules via ProcessModule
  • Ability to wrap the InjectionPoint
  • Honor WEB-INF/classes/META-INF/beans.xml to activate WEB-INF/classes in a bean archive
  • Global ordering and enablement of interceptors and decorators
  • Global selection of alternatives
  • @New deprecated
  • Clarify interceptors and decorators must be implemented using proxying
  • Allow multiple annotated types per Java class
  • Allow Extensions to specify the annotations that they are interested in

There are a number of open issues about which we would appreciate your feedback:

Bean visibility

The CDI 1.0 specification clearly states that only beans whose bean class is accessible (using standard classloader visibility rules) can be injected into another bean. For example, if you have a bean A in WAR, assuming standard Java EE classloader structure, it wouldn't be available for injection in bean B, in an EJB module. This generally makes sense, as the type is not visible either.

CDI also offers two options to replace bean implementations transparently, without explicitly selecting that implementation (either by type or using a qualifier) - alternatives and specialization. In this case, it is less clear that the bean class of the specializing bean, or the bean class selected alternative, must be visible.

The CDI EG is still debating this issue, including whether to offer a backwards incompatible mode here.

@ApplicationScoped beans shared between all EAR modules

CDI implementations have not consistently shared @ApplicationScoped beans across all modules of an EAR. This issue heavily relates to Bean visibility. The CDI 1.1 specification will clearly state how @ApplicationScoped are shared.

Startup event

A commonly requested feature is for the application to be able to do some work once the application has started but before it starts servicing requests originating remotely. Currently CDI 1.1 defines a @Initialized(ApplicationScoped.class) which is called when the application context starts, but we are investigating whether this can be extended to provide a more general startup event.

If we define such an event, we need to allow custom contexts to activate themselves whilst it is executing, however this is likely beyond the scope of CDI 1.1 and will likely be addressed in CDI 2.0.

@WithAnnotations

CDI 1.1 adds @WithAnnotations which allows an extension observing ProcessAnnotatedType to filter which types it sees. We would like to provide such functionality for all container lifecycle event observers, but there are some interesting things to consider, including whether it would be better to filter on qualifiers for later events. CDI 1.1 may or may not add such support, and we are looking for feedback on this.

Allowing arrays as qualifier members

CDI 1.0 requires array valued members of qualifiers to be annotated with @Nonbinding, excluding them from the resolution process. The JDK defines that annotation equality for array valued members should use Arrays.equals(), which requires two identical arrays (equal values, in the same order) in order to return true.

We feel that to make array valued members of qualifiers useful, we need to offer a pluggable strategy for checking equality of arrays, as often it would be desirable to consider two arrays with the same values, in any order, as equal. We intend to add this for CDI 1.1.

Restricting what CDI scans

CDI 1.0 will scan all classes in a jar with beans.xml. We plan to add a syntax to beans.xml that will the application developer to exclude classes using a variety of filtering options (e.g. by package). Weld offers such a syntax, and will be used as a starting point for CDI http://docs.jboss.org/weld/reference/1.1.5.Final/en-US/html/configure.html#d0e5769.

Observer resolution

CDI 1.0 requires the type used for observer resolution to be based on the runtime type of the event object. Unfortunately, the JDK erases generic type information about objects that we need to allow firing of many events with parameterized types. CDI 1.0 also completely ignores the generic type of the injected event object, which does typically contain the needed type information. We therefore intend to change the event observer resolution rules to allow the generic type of the event object to be taken into account if the runtime event object does not contain sufficient information.

Note that this may seem like a backwards incompatible change, however CDI 1.0 is essentially unimplementable today - examples in the spec do not work as described.

Announcing jdf - JBoss Developer Framework

Posted by Pete Muir    |    Jun 5, 2012    |    Tagged as Seam

JBoss Developer Framework exists to show you, the developer, how to make the most of JBoss and Java EE 6 technologies on JBoss Enterprise Application Platform and JBoss AS.

There are three ways we do this:

Quickstarts

We start small, with the quickstarts. Each quickstart is very focused, and shows you one API, or one use case. There are about 53 quickstarts today, ranging from JAX-RS CRUD to GWT to HTML5 to transactions.

Examples

Quickstarts are great, but there comes a time in everyone's life when they want to write something other than a simple application! TicketMonster steps up to the plate at this point. Today, it's a full web-app written, with front-ends showing off the three approaches to view layers we like at JBoss - HTML5 + REST, Errai/GWT and RichFaces/JSF.

Over time, we plan to add much more to TicketMonster, as well as spin up other examples. Check out the Roadmap for more info on our plans!

Migrating

We realise that there are lots of people still using older technologies such as Seam 2, Spring or Java EE 5. We've put together a comprehensive set of migration tutorials to show you how.

JBoss BOMs

To make all this possible, we've developed a set of BOMs. The BOMs start with Java EE 6, and build on that base API with JBoss extensions such as Hibernate (Search, Validator...), Errai and Arquillian. They're a great way to make sure you're using the same set of dependences that we test with!

Roadmap

JBoss Developer Framework 1.0 is firmly focused on education, showing you how to use JBoss Enterprise Application Platform and JBoss AS with Java EE 6.

JBoss Developer Framework 2.0 will start to add other technologies to the stack, such as Deltaspike and Aerogear. We won't be forking these projects, but simply testing and recommending a version to use (via a Maven BOM).

Get Involved

If you want to ask questions, or help out, then visit our forums (which are also mailing lists).

We'll be tweeting using the #jbossjdf tag.

We'll mostly be posting jdf related items on the jdf news feed, so if you want to keep up to date, I suggest you subscribe there.

If you are lucky enough to be coming to JBoss World, Red Hat Summit or JUDCon, then we'll be there.

Enjoy!

JBoss AS 7.1 on OpenShift

Posted by Pete Muir    |    May 9, 2012    |    Tagged as JBoss AS

Excited about JBoss AS 7.1 in the cloud? JBoss AS 7.1 is now available on OpenShift and provides a small memory footprint and lightning fast startup times.

OpenShift is a free Platform-as-a-Service (PaaS) that enables developers to get deployed to the cloud without having to worry about downloading and managing the stack, writing scripts or installing agents. You can build your applications using the built in Jenkins support, easily add persistence, like MySQL or MongoDB, test using Arquillian or deploy from JBDS.

Getting started simply requires signing up for OpenShift.

To celebrate the availability of JBoss AS 7.1 on OpenShift, we've put together a series of 6 videos. Learn how to build a mobile ready application, deployed to OpenShift in 5 minutes. Deploy REST services to the cloud, and consume them. Add a portal, courtesy of the GateIn project. Add very high performance messaging, from HornetQ. Or add atomic transactions over Web Services.

And that's on top of the web profile support, available for about a year!

Enjoy!

Transactions for managed beans

Posted by Pete Muir    |    May 1, 2012    |    Tagged as

A standard, universal @Transactional annotation is coming in Java EE 7. You can read more about the proposal here.

However, there are some important things to keep in mind:

  • @Transactional is being developed as a revision to the JTA spec (as an MR)
  • @Transactional is not being developed by the CDI EG, nor will it be in the CDI spec
  • Feedback on @Transactional should be sent to the Java EE platform EG not to the CDI EG. The platform EG is conducting the revision to the JTA spec.

Java EE does not recognize a Servlet container as a compliant environment and therefore this feature will not be available there by default (mainly due to the absence of JTA in this environemnt).

However, to bridge the divide, Deltaspike will likely offer support for @Transactional in a Servlet environment since we acknowledge that it is important, and is an environment preferred by many developers (but we still strongly urge you to migrate to the web profile!!).

I recently had the pleasure and attending and presenting at the Greater Indian Developer Summit (GIDS) in Bangalore. I was joined by fellow JBossians Andrew, Bruno, Manik and Mike.

The conference was excellent, I think we all noticed the really high calibre of the attendees - lots of excellent questions throughout the sessions!

On my way home, I stopped off at the London JBUG (kudos to Steve & co for breathing new life into the group!).

I captured both the presentations I did, and they are up on vimeo - check them out if either topic interests you!

JUDCon India, Brno Developer Conferences, Interviews, and more

Posted by Pete Muir    |    Jan 10, 2012    |    Tagged as Events

Whilst I was relaxing over the Christmas break, a few items came in which I want to share with you.

First up, JUDCon India. In two weeks, what feels like half of the core developers at JBoss will descend on Bangalore for two days packed full of talks on all things JBoss. I'll be covering Infinispan and application development using JBoss AS and Java EE.

Next, I'll be in Brno (my favourite city in the Czech Republic, as I always get to drink lots of beer with friends. I'll be speaking at the JBUG and at the Developer Conference about Infinispan. See you there.

At JavaOne, I had the great pleasure of talking to Rick Hightower for half an hour. We covered CDI, Java EE, EJB and Spring - great fun! Info just published the talk.

Enjoy!

JavaOne 2011, Wow!

Posted by Pete Muir    |    Oct 15, 2011    |    Tagged as Events
DSC_0619

First, let me start with a confession. Until last week I was a virgin. A JavaOne virgin of course ;-)

Where to start?

The booth

The JBoss / Red Hat booth really was the hub of the conference for me, and my colleagues. I spent more time at the booth than anywhere. Whether it was catching up community members, presenting in the mini-theater, chatting with people interested in JBoss technologies, or just gossiping with colleagues, it was always fun.

The mini-theater was a great crowd draw, and both my mini-theater talks caused the corridor to become impassable. All the mini-theater talks were recorded, and are just starting to appear online. I had a cloudy theme to mine, showing people how to use Red Hat's PaaS, OpenShift.

I kept both talks very practical, focusing on how you can use OpenShift with Java EE, and Infinispan, and wove in some information about the technologies I was using. Take a look.

Parties

photo

The parties were non-stop, and of course I have to mention the JBoss Party at Slide. But the definite highlight of the week for me was seeing Tom Petty and the Heartbreakers, and Sting. Mark, my boss, told me I was allowed to appreciate Oracle for a couple of hours during the concert, but afterwards I had to take a cold shower ;-) I better not say too much more, as I know there are some good photos of me on his camera!

Our final party of the week was perhaps the most impressive. Roof top terrace of one of the two JBoss Pad's watching the Blue Angels doing a fly-by.

Sessions

P1000872

I managed to attend a few sessions, and enjoyed attending a couple around migrating from both Spring to Java EE. It's great to see the community really championing the cause of Java EE so enthusiastically. Makes those long hours Gavin, and many others, spent getting CDI off the ground seem very worth it.

My session was a once-in-a-lifetime opportunity - I talked about what's coming in CDI 1.1. I'm not a huge fan of this sort of session (I much prefer showing how you can build applications using the JBoss stack), but I knew the JavaOne audience would be interested in seeing the updates. The session, and many corridor discussions lead to an excellent panel session at the end of the week (with Arun in the chair, and David, Reza and Siva sitting alongside me on the panel). I learnt a lot about what you are looking for from CDI 1.1, and what your priorities are, invaluable information.

OracleAppreciationEvent

Interviews

I had the opportunity to talk to InfoQ, O'Reilly and TSS during the week about CDI and Java EE - all three were great fun to do. We covered the inevitable question How does this relate to Spring? a couple of times of course ;-) I'll post when the interviews are up! Thanks to Rick, Tim and Cameron, and their respective teams, for taking the time!

Thigh deep snow

Eh? What? Manik and I took a few days off after the conference to go hiking in the Sierra Nevada. There was somewhat more snow than we expected, and was pretty cold (night one, our boots froze), but a great way to unwind. Of course, I was sporting some pretty sexy well travelled head gear (it's been to 5500m above sea level and to 61 degrees north, that cap has).

Bring on next year!

Photos courtesy of Ray Ploski, Paul Bakker and Matt Vanderpol

Contexts and Dependency Injection 1.1 early draft submitted

Posted by Pete Muir    |    Oct 6, 2011    |    Tagged as CDI

I've just submitted an early draft of the Contexts and Dependency Injection 1.1 (CDI, JSR-346) to the JCP. We (the CDI community) have completed around a third of the features we want to see in CDI 1.1, so wanted to post an early draft to get some wider feedback. Whilst the JCP sort out the paperwork, you can read the draft on jboss.org :-)

So, what's been added since CDI 1.0?

  • @Disposes methods for producer fields
  • The CDI class, which provides programmatic access to CDI facilities from outside a managed bean
  • Pass the qualifiers an event was fired with to the ObserverMethod
  • Ability to veto beans declaratively using @Veto and @Requires
  • Ability to access the BeanManager from the ServletContext
  • Conversations in Servlet requests
  • Application lifecycle events in Java EE
  • Injection of Bean metadata into bean instances
  • Programmatic access to a container provided Producer, InjectionTarget, AnnotatedType
  • Ability to override attributes of a Bean via BeanAttributes
  • Ability to process modules via ProcessModule
  • Ability to wrap the InjectionPoint
  • Ability to obtain Extension instances from BeanManager
  • Injection of the ServletContext
  • Access to beans.xml in ProcessModule
  • Injection into enums
  • Around 60 issues addressed

However, don't worry if your favorite new feature isn't listed - we're still planning to add:

  • XML configuration
  • Global ordering for interceptors, decorators and events
  • Global enablement of interceptors, decorators and alternatives
  • Multi-plexed contexts (multi-tennancy support)
  • Service Handlers
  • Split specification into core and Java EE integration
  • Bootstrap support
  • Java SE context definition
  • Transaction scope

We're also tracking the development of other features such as:

  • Declarative transactions for managed beans
  • Async invocation and timers
  • JMS / CDI integration

So, what do you think? You can comment on this blog, email the cdi-dev@lists.jboss.org list, or direct comments to me.

What do you like? What have we missed? What don't you like? The purpose of the EDR is to get your feedback - so please, get in touch!

CDI 1.1 slides

Posted by Pete Muir    |    Oct 5, 2011    |    Tagged as CDI

Here are the slides[1] from my JavaOne talk on CDI 1.1 :-)

Attachments

  1. CDI_JavaOne_2011.pdf
back to top