Differences between Seam-gen and Jboss Tools

In this article we will basically try to understand the basic difference between different ways in which we can do Seam application development. So before we get into details, let have a brief introduction about Seam


So what is Seam??

Seam is a powerful open source development platform for building rich Internet applications in Java. Seam integrates technologies such as Asynchronous JavaScript and XML (AJAX), JavaServer Faces (JSF), Java Persistence (JPA), Enterprise Java Beans (EJB 3.0) and Business Process Management (BPM) into a unified full-stack solution, complete with sophisticated tooling(1). The simple chart of architectural design will show you about this:

design-2

Diagram 1.1 Architecute of Seam

So Seam basically does the job of plumbing these disconnected frameworks. We had all the good things in J2EE world, but making them work together was a pain. But, now we do have Seam to do all the dirty work for us.

How to get started with Seam application development??
Following could be the possible ways in which we could get started with a simple seam project structure.

  • Seam- gen
  • Jboss Tools
  • Maven

It was really fun to work on Seam, as it greatly reduced the initial project setup time which we normally have with J2EE project. Seam is basically a tool which give you more Return on Investment (ROI) for the same number of lines you write in any other Java framework like spring or struts.

So, let’s get started with the main aim of this article to have feature differentitation between seam-gen and Jboss Tools .

First of all I would write something about both the Tools and after that will try to get into more details about each.

Seam-gen

We will start with using seam-gen to generate a project structure, as seam-gen provides out-of –box scripts to generate Seam Action, Entity and Conversations

So what is Seam-gen??

Seam-gen is a rapid application generator shipped with the Seam distribution. With a few command line commands, seam-gen generates an array of artifacts for Seam projects to help you get started. In particular, seam-gen is useful for the following.

  • Automatically generate an empty Seam project with common configuration files, a build script, and directories for Java code and JSF view pages.
  • Automatically generate complete Eclipse and NetBeans project files for the Seam project.
  • Reverse-engineer entity bean objects from relational database tables.
  • Generate template files for common Seam components.

Jboss tools

JBoss Tools is a collection of Eclipse plugins. JBoss Tools a project creation wizard for Seam, Content Assist for the Unified Expression Language (EL) in both facelets and Java code, a graphical editor for jPDL, a graphical editor for Seam configuration files, support for running Seam integration tests from within Eclipse, and much more.
In short, if you are an Eclipse user, then you'll want to use JBoss Tools!

Now, we will mainly look at different aspects in which seam-gen and Jboss Tools are different and what could be the best option for building Seam application from scratch

Aspects in which they are different:

  1. Project Structure
  2. Build process
  3. Deployment strategy
  4. Profiles
  5. Testing approach

Difference in Project Structure:

Seam-gen source directories

The source directories created by seam-gen are each dedicated to holding certain types of source files. This enables seam-gen to determine what tests need to be executed as well as selectively hot-deploy your Seam components.(Diagram 1.2)

/src/main Classes to include in the main classpath
/src/hot Classes to include in the hot deployable classpath when running in development mode.
/src/test These classes will not be deployed but will be executed as part of the test target.

So in this project structure, we only have one source folder which contains both, the EJB entities and the War content. This is one thing, which I don’t like about seam-gen. They could have provided a better project structure like the one we have with Jboss tools.

Jboss tools source directories

Jboss tools source directory is well arranged compared to the seam-gen project directory, as it follow the standard J2EE application packaging.In this struture we have a war project, ejb project and finally both of them bundled into a ear distribution. In addition to that they have separated out a test project, which is good for doing testing.This kind of structure also helps to manage large projects, where we have teams working on different module of the project.

HelloSeam Contains the deployment descriptor, the Web component files, and related resources.
HelloSeam-ear The final ear distribution
HelloSeam-ejb/ejbModule Contains ejb deployment descriptor, the enterprise bean files, and related files.
HelloSeam -test/test-src The test classes.

seam-gen-project-structure-22

Diagram 1.2 Project struture of Seam-gen and JBoss tools

Differences in Build process:

First let start with the build process seam-gen follows. The seam-gen project is built using the ant tool and they provide an extensive target in the build.xml. So most of what you want to do in different phases of application development, you can do that using the build.xml provided.

Some sample targets which might be of interest to everyone

explode , reexplode These are for doing the seam application deployment as a exploded directory.
deploy , reploy these are for deploying the seam application as a packaged archive
groovy.compile If you have some groovy code, so this would just compile them into java classes
restart, restart-deployed, restart-exploded for doing the restart , depending on the kind of deployment
others like jar, war, javadoc Utility targets for generating different things.

In case of Jboss tools on the other hand, we don’t have a build.xml file provided, but we can tweak the build script of Seam-gen project to work with JBoss tools. I have attached a strip down version of the build.xml of seam-gen to provide the minimum task needed for Seam project, which works fine with JBoss Tools.

Differences in Deployment Process:

As we have already discussed that the Jboss tools can be configured to use Eclipse Web Tool Platform (WTP) Project, so when we deploy the seam application using WTP the ear bundle along with the datasource deployment descriptor file are copied to the following directory.

“C: workspace .metadata.pluginsorg.jboss.ide.eclipse.as.coreJBoss_4.2_Serverdeploy”

Whereas, in case of ant build, both the files goes directly into the Jboss main deploy directory .In my case it was this directory:

“C:Program Filesjboss-4.2.2.GAserverdefaultdeploy”

In this regard, the former process looks to be better, since we don’t clutter the main Jboss deploy directory.

Differences in Profiles

Seam-gen Profiles

Seam-gen supports the concept of "profile". The idea is that the application probably needs different settings (e.g. database settings, etc) in the development, test, and production phases. So, the project provides alternative configuration files for each of the three scenarios. In the resources directory, you will find the following configuration files:

/META-INF/persistence-*.xml Provides configuration of a JPA persistence-unit for each environment.
import-*.sql Imports data into a generated schema based on deployment environment. Generally useful for testing purposes.s
components-*.properties Allows wild-card replacement of Seam component properties based on environment.

Jboss Tool Profiles

Jboss tools doesn’t provide any support for profiles , so we only have one set of configuration files, which we have to use for different phases by making changes in them .

So this could be one more drawback of using Jboss tools.

Differences in Testing approach:

Testing is a very important part of the Agile programming, so we also need a very good project structure for doing the same. Jboss tools, surely knows this and have done a good job of keeping a separate project, only for test. This really solves lot of problems you might face while running test in Eclipse for a seam- gen project

For a seam-gen project, if you are running test using ant task then its fine, but otherwise you would need to make some changes in classpath of all the test classes.

Conclusion Matrix:

We could conclude this article with a matrix which contains feature by feature comparison.

Project Structure Build Process Deployment Strategy Profiles Testing approach
Seam-gen ** **** *** **** **
JBoss tools ***** ** **** * ***

For me mixture of both is the winner for developing a Seam application.But till we don't have that from the Seam's framework , we can surely go with Jboss Tools. Even though it misses the ant support, we can tweak the ant script provided by seam-gen and use it in our Jboss Tools project.

References

Comments (5)

  1. Max - Reply

    April 22, 2009 at 8:17 am

    Great writeup - you catched the gist of what are the good and bad properties of the project structures.

    Here are a few comments/tips:

    1) The reason for the project structure is primarily because we wanted the projects to work with the WTP plugins and not just with the plugins we do.

    2) We did everything we could to make sure that you can also use JBoss Tools projects with seam-gen projects, but of course you loose some functionality because now things are not where some plugins expect them to be.

    3) Build process - we got on the roadmap to at least get a Ant file in there (optional), and are also looking into getting Maven support.

    4) Deployment strategy - if you want to you can edit the server in JBoss Tools and set it to deploy inside the appserver just as seam-gen does. We just kept the external location to make the installation cleaner.

    5) Profiles - this is my biggest issue. We haven't yet found a good way of providing that in the IDE (haven't seen it in others either) since introducing it basically means that the actual files the plugins can edit today become derived files and hence any edits will be lost. Ideas/patches on how to make this better are welcome.

    6) Testing - I like this approach better in tools too since the embedded JBoss makes it simpler to be outside the main tree; but again the main reason here is to actually have it working in Eclipse. And eclipse only supports one classpath per project meaning to have a the testspecific classess limited to be in the testproject we had to have an independent one.

    Thanks for the write up 🙂

  2. Gaurav Kohli - Reply

    April 24, 2009 at 12:09 pm

    Max, Thanks for addressing my points and the tips,

    I totally agree with all the points you have listed. Just that, after having a look at both Seam-gen and Jboss Tools, I just thought that if Jboss Tools also has Ant/Maven support it would be better for Seam developers.

    I am looking forward to have ant/maven support in the next JBoss tools release and I know you people will surely find some solution to the profile issue :p

  3. Jeremy Davis - Reply

    July 16, 2009 at 9:52 pm

    Great post!

    I had one hiccup with the build.xml. The "Class-Path" entry wasn't created in the manifest files when I ran deploy.

    I added manifest tags to the archive target and it worked beautifully.

  4. Jim - Reply

    February 16, 2012 at 8:23 pm

    You said, "but we can tweet the build script" ... obviously meant "tweak", right? hehehe

  5. Gaurav Kohli - Reply

    February 16, 2012 at 9:37 pm

    @Jim,
    I have corrected that... thanks :p

Add a Comment