BT

InfoQ Article: An Introduction to JBoss Seam 1.1

by Floyd Marinescu on Dec 19, 2006 |
JBoss Seam is a new full-stack web application framework that unifies and integrates Ajax, JSF, EJB2, Portlets, and BPM.  Seam 1.1 went final last week, major new changes include the ability to run SEAM without EJB making it useable in any appserver and even Tomcat, a new concurrency model, ICEFaces/Ajax4JSF integration, and Rails-like code generation/command line tools. InfoQ previously interviewed Seam creator Gavin King on Seam 1.1, and today is publishing an introduction to Seam.

Read: Introduction to JBoss Seam

The article is an editted excerpt of chapters 1 and 2 from the first (to-be-released) book on Seam by Michael Yuan and Thomas Heute. It explains what Seam can do and grounds the concepts with a HelloWorld example.

In his interview, Gavin King told InfoQ that Seam has been well adopted within the JBoss community and is recieving over 5000 downloads a month. One reason it never got far out of the JBoss community is because Java EE 5 support is not yet widely available across the appserver ecosystem, which is why the EJB 3 dependency was made optional in Seam 1.1.  Gavin King will also be presenting Seam at QCon London, March 14-16.

Hello stranger!

You need to Register an InfoQ account or to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

should be,,, by Ohtani Shinpei

>JBoss Seam is a new full-stack web application framework that unifies and integrates Ajax, JSF, EJB2, Portlets, and BPM.

should be EJB3, not EJB2, isn't it?

Testing seams incomplete by Matt Raible

The testing section "seams" incomplete: ;-)

For integrated testing of the entire Seam application, it is a little more complex since you have to run the application inside a Seam container. Seam comes with an embeddable lightweight container that helps this type of testing. In your test framework, you can load the Seam container programatically and then run the tests. For more details on embeddable Seam container, please refer to

Refer to what?

Re: should be,,, by Michael Yuan

Yes, it should be EJB3 NOT EJB2. Floyd, can you make the change?

It is important to note that Seam expands the "programming model" of EJB3 to POJOs -- so it can run outside of the EJB3 container as well. See more here and here.

Re: Testing seams incomplete by Michael Yuan

Oh that refers to the chapters 20 and 21 of the book. I will fix the link.

But to get a taste of how out-of-container testing work in Seam, check out the "examples/booking" project in the Seam distro. Run "ant test" and see the tests (unit tests and integrated tests with JSF EL) running in the console. Out-of-container testing is automatically supported in Seam Gen generated projects.

Seam Case Study by Stefane Fermigier

In case you have missed it during the JBossWorld Conference in Berlin, here is a case study of a "real life" application built with JBoss Seam:

"Nuxeo EP 5 Open Source Enterprise Content Management - A Seam Case Study" On Slideshare

Same, as PDF

Injections through configuration by AdiSesha Reddy

Clean and impressive introduction to Seam.
Is there any option to manage injections through configuration file rather than through annotations?-Adi

Re: Testing seams incomplete by Floyd Marinescu

Hi Michael, sorry about that - messed up on the editting, will fix immediately, and also 'ejb 3'

Re: Injections through configuration by Michael Yuan

Is there any option to manage injections through configuration file rather than through annotations?


The components.xml file allows you to inject some of the Seam built-in components into each other via XML configuration (e.g., inject an EntityManager into a Seam CRUD DAO object). However, so far, there is no generic way to inject arbitary user-defined component via XML (we believe annotation is a lot easier to use).

But, in Seam 1.2, we plan to support Spring integration. That would allow you to make Seam components available as Spring beans.

Re: Testing seams incomplete by Michael Yuan

Hi Michael, sorry about that - messed up on the editting, will fix immediately, and also 'ejb 3'


Thanks Floyd!

Re: Injections through configuration by Gavin King

Is there any option to manage injections through configuration file rather than through annotations?


We consider "configuration" to be a separate problem to bijection, in that configuration should happen statically when components are instantiated, instead of dynamically when they are invoked. So Seam provides the components.xml file format, which lets you do stuff like:

<components xmlns="http://jboss.com/products/seam/components" 
xmlns:core="http://jboss.com/products/seam/core"
xmlns:drools="http://jboss.com/products/seam/drools">

<drools:rule-base name="ruleBase" rule-files="numberguess.drl"/>
<drools:managed-working-memory name="workingMemory" rule-base="#{ruleBase}"/>

<core:jbpm>
<core:pageflow-definitions>
<value>pageflow.jpdl.xml</value>
</core:pageflow-definitions>
</core:jbpm>

<core:init debug="true"/>
<core:microcontainer installed="@microcontainer@"/>

</components>


Or even - don't get scared, this is a complex example:

<components xmlns="http://jboss.com/products/seam/components"
xmlns:fwk="http://jboss.com/products/seam/framework"
xmlns:core="http://jboss.com/products/seam/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://jboss.com/products/seam/framework jboss.com/products/seam/framework-1.1.xsd
jboss.com/products/seam/core jboss.com/products/seam/core-1.1.xsd
jboss.com/products/seam/components jboss.com/products/seam/components-1.1.xsd">

<factory name="contact" value="#{contactHome.instance}"/>
<fwk:entity-home name="contactHome"
entity-class="org.jboss.seam.example.contactlist.Contact"
entity-manager="#{entityManager}"/>


<factory name="comment" value="#{commentHome.instance}"/>
<fwk:entity-home name="commentHome"
entity-class="org.jboss.seam.example.contactlist.Comment"
entity-manager="#{entityManager}"
new-instance="#{newComment}"/>

<component name="newComment"
class="org.jboss.seam.example.contactlist.Comment">
<property name="contact">#{contact}</property>
<property name="created">#{currentDatetime}</property>
</component>


<fwk:entity-query name="contacts"
max-results="20"
entity-manager="#{entityManager}">
<fwk:ejbql>from Contact</fwk:ejbql>
<fwk:order>lastName</fwk:order>
<fwk:restrictions>
<value>lower(firstName) like lower( #{exampleContact.firstName} + '%' )</value>
<value>lower(lastName) like lower( #{exampleContact.lastName} + '%' )</value>
</fwk:restrictions>
</fwk:entity-query>

<component name="exampleContact"
class="org.jboss.seam.example.contactlist.Contact"/>

</components>


This facility is basically a mix of JSF style configuration, which uses EL for injection of other components, and XML namespace support similar to what you see in Spring 2.0. In Seam, the namespace stuff is stupendously easy to do. You just add one package-level annotation, and write the schema. Done.

Re: Injections through configuration by AdiSesha Reddy

Sorry, I should have used 'XML'(the way you specify dependencies,in Spring) instead of 'Configuration'

Get rid of the „lightweight”-illusion! by Stefan Frank

How does a framewok qualify as lightweight?!

In terms of the jars you need to import to make the framework run? Then seam is definitely not lightweight, as it comes with 30MB of libraries you need to get a hello world to run, the appserver not yet included.

In terms of the number of things that can go broke?!
With the sheer number of integrated components (embedded container, drools, jbpm, hibernate etc.) - there are lots of things that can go wrong. Sure, everything works fine when you stay on the path, but if you dare to venture a little left or right, you can get quickly bitten by kernel-exceptions,xfid not founds, empty pages and other strange beasts. Plenty of knobs and levers, plenty of things that can go wrong.

In terms of configuration?
Using annotations is a big plus and will get you rid of a lot of configuration you used to do in xml. But there there is still lots of components that have to be configured, and annotations don't go all the way. In a reasonably sized project, you will still end up with a slightly reduced mix of annotations, xml and properties that have to work together.

In terms of the number of things it does?!
Then, again, seam does not qualify, as it aims to do everything from simple crud over pdf-generation up to workflow- and rules integration. Sure, all of this is optional, but then again java also qualifies as "lightweight": Nobody ever forced you to do something more meaningful than "Hello World".

Is the fact that you can use "POJO"'s enough to qualify a framework as lightweight?!
I doubt that you can really call an annotated pojo, that got treated by cglib and gets hidden behind an aop-framework does really still qualify as pojo. If everything works fine, you may not notice the plumbing, but when your stacktrace brings up several hundred lines of code that show libraries with strange and funny names, the pojo-illusion fades rather quickly...


Don't get me wrong here, I really love seam and gavin king and the other jboss-people are doing a terrific job at integrating stuff at a breakneck speed, but we should really try to stay honest and strip off the "lightweight"-buzzword from our articles. It is misleading and says absolutely nothing at all about the framework.

Re: Get rid of the „lightweight”-illusion! by Jim Hazen

The author defines lightweight to mean the following...
There are no framework interfaces or abstract classes to "hook" components into the application.

This seems to be a pretty common definition of lightweight as applied to frameworks these days. This is in contrast to other frameworks that require the extension of framework classes or the implementation of framework interfaces in order to take advantage of their middleware features. EJB2 is probably the most popular example of a heavyweight framework.

The lightweightness however, only extends to the weight added to your business codebase. You are correct in observing that many "lightweight" frameworks have dependencies on third party libraries. In some cases, many, many libraries.

The test here is whether it is possible to swap out middleware providers like Seam for a similar framework (perhaps a WebBeans RI) without modifications to your business code. Also, when it's all said and done, is it possible to package up everything and take it with you? An EAR with a Seam based application can be packaged and moved from one operating environment to another. The business code, like a turtle, can take its house with it (even with the inclusion of many dependent jars). Unlike heavyweight frameworks where your only choice is to move from house to house and make due with whatever accommodations are present when you arrive.

Also, don't think that lightweight means simple or "doesn't do a lot". Batman's utility belt is lightweight and it provides many things. Lightweight frameworks often do some very heavy lifting and can be quite complex.

Perhaps the buzzword should be "unobtrusive" or "TD - Transparently Declarative", but it isn't. For whatever reason folks have decided to go with "lightweight" as shorthand for what I've tried to describe above. In the end no matter what buzzword is chosen some people will feel mislead or confused.

I do agree though that some people tout being lightweight as a bigger selling point than the features actually being provided. That will eventually change as being lightweight becomes the norm. Nobody advertises for example that Seam is an object oriented framework. Until then "lightweight" is a nice single word description that conveys all of what I took paragraphs to explain, and what the author achieved in a single line.

Tutorial: Achieve Rapid Application Development with Seam+Eclipse+Tomcat by TechieExchange TechieExchange

Hi,
I wrote a step-by-step screencast tutorial to make Seam development as RAD - Rapid Application Development with Eclipse and Tomcat, focussing on developer productivity.

techieexchange.wordpress.com/2007/11/11/rad-sea...

bijection by kevin o'brien

I have some confusion here over the term "bijection", as used here.

In one case we have:
"a Seam component A can also create another component B and "outjects" the created component B back to Seam for other components, such as C, to use later."
... which seems to say that bijection is the injection of a component caused by the creation of one component, which can then be used by a second component.

In another case we have:
"This type of bi-directional dependency management is widely used in even the simplest Seam web applications

In Seam documentation, you sometimes see the term "bijection". That refers to the two-way injection and outjection interaction between Seam components and the Seam managed context."
... which seems to say that bijection is the in/outjection of a component after a method call.

Am I missing some of the subtlety in this term??

First SEAM working example by Binod Suman

Really this is very nice and useful discussion on jboss forum. Since last 10 days, I was searching any link or blog to show step by step seam setup example. But I didnt get, then thought to create one blog on Seam. I think, it is very useful who wants to start work on Jboss SEAM.

binodjsf.blogspot.com/

Thanks,

Binod Suman

Seam simple running example. How to setup first Seam Project by Binod Suman

Really this is very nice and useful discussion on jboss forum. Since last 10 days, I was searching any link or blog to show step by step seam setup example. But I didnt get, then thought to create one blog on Seam. I think, it is very useful who wants to start work on Jboss SEAM.

binodjsf.blogspot.com/

Thanks,

Binod Suman

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

17 Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2013 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT