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??
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
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.
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 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:
- Project Structure
- Build process
- Deployment strategy
- 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.|
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:
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 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.
We could conclude this article with a matrix which contains feature by feature comparison.
|Project Structure||Build Process||Deployment Strategy||Profiles||Testing approach|
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.
- Build. xml for JBoss Tools Project (Build.xml)
- Seam-gen Command guide http://www.jboss.org/community/docs/DOC-10750
- Seam-gen and JBoss Tools together http://relation.to/Bloggers/UsingASeamgenProjectInJBossTools
Look at our consultancy services, training offers and careers below or contact us at email@example.com