Help

I am leading the CDI 1.1 specification, and work on JBoss Developer Framework, a set of tutorials and examples for all JBoss users. Previously, I've worked on Infinispan and I led the Seam and Weld projects, and am a founder of the Arquillian project. I've worked on a number of specifications including JSF 2.0, AtInject and Java EE 7. I am a regular speaker at JUGs and conferences such as JavaOne, Devoxx, JAX, JavaBlend, JSFDays, JBoss World, Red Hat Developer Day and JUDCon.

I am currently employed by Red Hat Inc. working on JBoss open source projects. Before working for Red Hat, I used and contributed to Seam whilst working at a UK based staffing agency as IT Development Manager.

Location: Edinburgh, Scotland
Occupation: Principal Software Engineer, Red Hat, Inc.
Archive
04. Apr 2008, 23:17 CET, by Pete Muir

We just finished uploading Seam 2.0.2.CR1 to SourceForge and the Maven repository - so go get it!

This release fixes around 30 bugs and updates various component libraries (Groovy 1.5, Drools 4.0.6, jfreechart 1.0.8a, RichFaces 3.1.4 and Trinidad 1.2.5).

But perhaps most exciting is that we have a brand new structure for our documentation, that brings with it a style themed on SeamFramework.org! This new structure will allow us to simply incorporate translations of the reference guide and keep them up to date.

We've already had a translation of the Seam 2.0.0.GA docs into Chinese (thanks to Xiaogang Cao, Yu Limin and their community!) and I'm looking forward to others flooding in (well, perhaps not flooding... ;-)

[Download] [Reference Documentation] [Forums] [JIRA]

21. Feb 2008, 20:24 CET, by Pete Muir

I'll highlight a few of my favourite features of Seam 2, then go on to discuss how where Seam will go over next year, and finally introduce Web Beans.

Date: Friday, 29 February 2008

Time: Arrive 1430-1530, presentations start 1530, finish 1900-1930.

Location: Paddy Murphy’s, Rodezand 15, 3011 AM, Rotterdam (map)

There is also a talk on the Process Virtual Machine from Tom Baeyens, jBPM lead, and a talk on jBPM from Lunatech Research.

More here.

See you there!

19. Feb 2008, 04:17 CET, by Pete Muir
<s:selectItems /> and <s:convertEntity /> output a key based on a numeric sequence to the page. How can I make it output something meaningful (e.g. the natural id of the entity)?

Why would you want to do this? Well, perhaps you want to use do some client side manipulation using JavaScript.

In Seam 2.0.1 I've added two mechanisms for doing this. You'll need to choose one based on your requirement.

By default <s:selectItems value="#{people}"/> uses, as its itemValue (which is rendered as the value attribute on <option />) each item in the list. Perhaps you want to use some associated object (for example, #{person.employeeNumber}). In this case it's as easy as:

<h:selectOneMenu value="#{project.teamLeadEmployeeNumber}">
  <s:selectItems value="#{people}" var="person" label="#{person.name}" itemValue="#{person.employeeNumber}" />
</h:selectOneMenu>

Great! But what if you want to use <s:convertEntity /> (which doesn't play nicely with this approach)? Why? Well the value referenced by the itemValue attribute is passed to <s:convertEntity />.

So, there is a second, slightly more complex option, if you want to use <s:convertEntity /> with custom keys - you need to provide a strategy for converting the entity Identifier to the output value and back.

First, override the org.jboss.seam.ui.entityIdentifierStore component:

@Name("org.jboss.seam.ui.entityIdentifierStore")
@Scope(PAGE)
public class MyEntityIdentifierStore extends EntityIdentifierStore {

Then, override the public String put(Identifier identifier, Object entity) method:

  public String put(Identifier identifier, Object entity) {
    if (entity instanceof Person) {
      Person person = (Person) entity;
      return "person:" + person.getEmployeeNumber();
    } else {
      return super.put(identifier, entity);
    }
  }

Finally, override public Identifier get(String key):

  public Identifier get(String key) {
    if (key.startsWith("person")) {
      String id = key.substring(6, key.length());
      return new EntityIdentifier(Person.class, new Long(id));
    } else {
      return super.get(key);
    }
  }
}

I've used EntityIdentifier as I'm using JPA, but of course of you could use HibernateEntityIdentifier if you are using plain Hibernate.

I hope you've learnt in this tutorial how to customise <s:selectItems />, BUT I also hope it highlights what I think is one of the most powerful features of Seam - that you can easily override the core components of Seam!

17. Feb 2008, 00:58 CET, by Pete Muir

Well, I'm safely home after my first JBossWorld, and I wanted to share some of the highlights for Seam at JBossWorld Orlando - lots of presentations about Seam, and more on RichFaces, Hibernate, Tools etc.

Of particular interest to me was the presentation by Cameron Ingram and Shawn Hill on using Seam with Flex. Cameron and I had a couple of discussions about where they plans to take this project and I'm looking forward to seeing Flex become a first-class view layer for use with Seam. Great work guys!

I also attended Thomas Heute's presentation on JBoss Portal, where he introduced the JBoss Portlet Bridge, a joint effort between the Seam, JBoss Portal and RichFaces teams to allow you to use JBoss Portal with Seam and RichFaces - he showed off using the Seam Booking example in a Portal.

And, the highlight for many was the Web Beans (JSR 299) talk by Gavin. Some really good work has gone on since the Early Draft Review - it's shaping up to be a great spec! You can find out more here.

My personal favourite though was the Seam/Web Beans/Hibernate/Tools BOF - we had an excellent attendance and got some really good discussions going - I love interacting with the community like this!

I promised to put the slides up from my Introduction to Seam presentation - and also the slides from the BOF where I talked a bit about Seam with Wicket.

It would be great to collect the slides from the various Seam presentations on SeamFramework.org - so please, put a link here - feel free to upload them onto SeamFramework.org.

I learnt a lot about JBoss Tools whilst writing a quick demo for my talk at Javapolis, and I wanted share a favourite feature with you - hot deploy of Seam components. Now, of course, this works with any seam problems if you set it up right, but JBoss Tools makes it /seamless/ :-). It removes the need for calling out to ant to copy the files to the application server - this makes it so quick you don't even see the progress bar pop up!

So, how do you get this going in your project?

Well, first, create a new WAR project (you can't currently hot-deploy EJB3s - vote for the issue here!)

You can learn more about creating a new project here.

Create a new action called helloworld.

You can learn more about creating a new action here

Now, run your project on the server - you'll need to wait a few seconds while the server boots.

Find out more about deploying your project here.

Finally, add a method (note, we are changing the class signature here!) to one of your actions, and add a <h:commandLink /> to your view to call it. Make sure to save both the class and the facelets.

You are restricted to /action/ classes here - you can't hot deploy model classes (entities).

You'll notice that JBoss Tools also provides EL completion in java class files :-)

Seam tells you it has hot deployed the the component.

Refresh the page in your browser, click the button, and the method is called without having to restart your application - now you need another excuse to get a cup of coffee than I had to restart my application! ;-)

Well, that concludes our quick tour of hot deployment with Seam and JBoss Tools. The JBoss Tools docs are a great place to learn more.

Showing 101 to 105 of 117 blog entries