Introducing JBoss(r) Seam
The first thing to understand about Seam is that it's a framework. Actually, it's a frame-work that sits on top of another framework (Java EE), and that framework sits on top of another one (Java). But don't get distracted by that just yet.
That word "framework" is a broad one, adopting many meanings depending on how it's used (and who is using it). In this case, I mean "framework" in a typical software technology sense: Seam knits together a set of APIs and services into an environment that makes it easy (or easier) to write Java EE web applications.
A framework typically "makes it easier" to do something by simplifying common tasks and providing built-in utilities that you'd otherwise have to write yourself. Seam is no different. Seam is based on Java EE, so it satisfies its framework duties in two fundamental ways:
- Seam simplifies Java EE: Seam provides a number of shortcuts and simplifications to the standard Java EE framework, making it even easier to effectively use Java EE web and business components.
- Seam extends Java EE: Seam integrates a number of new concepts and tools into the Java EE framework. These extensions bring new functionality within the Java EE framework.
You'll get familiar with Seam in this chapter by briefly examining each of these aspects. In the rest of this article, I'll list for you the various services and utilities that Seam provides.
Seam Simplifies Java EE
The standard Java EE environment consists of the Java Standard Edition (Java SE) with all of its APIs (JDBC for database access, JAXP for XML processing, etc.) supporting all of the enterprise-level capabilities of Java EE (JSF/JSP/servlets for web components, JAX-WS for web services, etc.). Your application components are then built directly on top of this overall framework, as depicted in Figure 1.
Figure 1. Standard Java EE framework
In addition to the APIs and component types depicted in Figure 1-1, Java EE also provides the deployment services, runtime security, and other services you need to create effective applications. And Java EE provides a number of improvements over its predecessor framework, J2EE, for example:
- Java 5.0 annotations are integrated liberally throughout the APIs in Java EE, giving you the option of using either externalized XML deployment data or embedded code annotations.
- The JavaServer Faces (JSF) 1.2, Java API for XML-based Web Services (JAX-WS) 2.0, and Enterprise JavaBeans (EJB) 3.0 APIs offer easier programming models than their J2EE predecessors, allowing you to implement most web, web service, and business components using simple JavaBeans.
- EJB 3.0 eliminates the need for many of the interfaces and other artifacts required in earlier versions of EJB, in most situations.
Even with the improvements delivered with Java EE, the JBoss Seam team saw room for simplifying things even further. Figure 1-2 depicts the Seam framework layered between your application code and the Java EE framework.
Figure 2. Seam-enhanced Java EE framework
The Seam Component Model
The simplifications provided by Seam stem mostly from the Seam component model—this component model can be considered, in essence, as an extension of the component model used for JSF managed beans. But it can be used for more than just web tier components.
A key benefit provided by Seam's component model is the direct use of EJB components as backing beans for JSF pages. JSF's standard model allows for regular JavaBeans to be used as managed beans, configured in the JSF faces-config.xml file. EJB components can be invoked from the managed bean's callback methods, serving as a façade for the EJB component. Seam provides a direct bridge between JSF's component model and the EJB component model, allowing you to use an EJB directly as a JSF managed bean. This eliminates the need for extraneous façade beans when all you require is a single EJB.
Page 1 of 6