Table of Contents – Seam in Action

Table of Contents


Brief Table of Contents

Table of Contents




About this Book

About the Cover Illustration

1. Teeing off with Seam

Chapter 1. Seam unifies Java EE

1.1. Which framework should I use?

1.2. Choosing Seam

1.2.1. A complete application stack

1.2.2. Why Seam was created

1.2.3. Debunking the “vendor lock-in” myth

1.2.4. Making the case for Seam

1.3. Seam’s approach to unification

1.3.1. Seam integrates JSF, JPA, and POJO components

1.3.2. The contextual component model

1.4. Your first swings with Seam

1.4.1. Entity classes serving as backing beans

1.4.2. An all-in-one component

1.4.3. Binding components to the view

1.4.4. Retrieving data on demand

1.4.5. Clickable lists

1.4.6. Integration tests designed for JSF

1.5. Seam’s core competencies

1.5.1. Turns JSF into a pro

1.5.2. Gets you rich quick

1.5.3. Fosters an agile environment

1.6. Summary

Chapter 2. Putting seam-gen to work

2.1. The Open 18 prototype

2.1.1. Consider yourself tasked

2.1.2. Mapping entities to the database schema

2.2. Letting seam-gen do the initial work

2.2.1. seam-gen’s specialty

2.2.2. Features that seam-gen provides

2.3. Kick off your project with seam-gen

2.3.1. A look at the seam-gen commands

2.3.2. A Q&A session with seam-gen

2.3.3. Creating a basic project structure

2.3.4. Generating the CRUD

2.4. Deploying the project to JBoss AS

2.4.1. To deploy...

2.4.2. ...or to explode

2.4.3. Switching between environments

2.4.4. Launching JBoss AS

2.5. Show and tell, change, and repeat

2.5.1. Walking the course

2.5.2. Guiding the reverse-engineering process

2.5.3. Exploring the structure of the generated project

2.6. Rapidly developing a seam-gen project

2.6.1. Incremental hot deployment

2.6.2. Accelerating development by using an IDE

2.7. Summary

2. Seam fundamentals

Chapter 3. The Seam life cycle

3.1. Exploring how Seam participates in a request

3.1.1. Flipping Seam’s switch

3.1.2. The JSF servlet, the workhorse of Seam

3.1.3. Serving collateral resources via the Seam resource servlet

3.1.4. Seam’s chain of servlet filters

3.1.5. The Seam phase listener

3.2. The JSF life cycle sans Seam

3.2.1. The JSF life-cycle phases

3.2.2. The initial request

3.2.3. The postback

3.2.4. Shortcomings of the JSF life cycle

3.3. Seam’s page-oriented life-cycle additives

3.3.1. Advanced orchestration with pages.xml

3.3.2. Intelligent navigation

3.3.3. Seam UI command components

3.3.4. Page parameters

3.3.5. Page actions: execute me first!

3.4. Combining page actions with navigation

3.4.1. Sanity checking a request

3.4.2. Built-in page actions

3.4.3. Search engine–friendly URLs

3.5. The JSF life cycle with Seam

3.5.1. Phase listeners versus servlet filters

3.5.2. Stepping through the augmented life cycle

3.6. A try-catch block around the life cycle

3.6.1. Failing gracefully or with intentional crudeness

3.6.2. Registering an exception handler

3.6.3. Handling the exception at the source

3.7. Summary

Chapter 4. Components and contexts

4.1. Seam’s contextual naming container

4.1.1. Seam’s context model

4.1.2. Unifying the Java servlet contexts

4.1.3. Seam’s new stateful contexts

4.1.4. Seam’s enhanced servlet contexts

4.2. Sorting out components

4.2.1. Components vs. component instances

4.2.2. Seam manages components

4.3. Defining components using annotations

4.3.1. Giving a component a @Name

4.3.2. Putting a component in @Scope

4.4. A comprehensive component example

4.4.1. Creating the entity components

4.4.2. Preparing an action bean component

4.4.3. Integration testing components

4.4.4. Hooking components into JSF

4.5. A component’s life

4.5.1. Loading component definitions

4.5.2. When to @Install a component

4.5.3. Giving a component multiple @Roles

4.5.4. Instantiating components at @Startup

4.5.5. Component life-cycle callbacks

4.5.6. Wiring components together

4.5.7. Where all components go to die

4.6. Using EJB 3 session beans in Seam

4.6.1. Whose component is it, anyway?

4.6.2. The making of a Seam session bean component

4.6.3. The mechanics of the interaction

4.7. Accessing components

4.7.1. Access modes

4.7.2. Access strategies

4.8. Summary

Chapter 5. The Seam component descriptor

5.1. Defining components using XML

5.1.1. Choosing your descriptor strategy

5.1.2. The structure of the component descriptor

5.1.3. Fine-grained component descriptors

5.2. XML namespaces in the component descriptor

5.2.1. The purpose of XML namespace declarations

5.2.2. Defining an XML @Namespace for components in a package

5.2.3. How XML namespaces are interpreted

5.2.4. Importing a context variable prefix

5.3. Configuring component properties

5.3.1. Component definitions as object prototypes

5.3.2. Where component properties are defined

5.3.3. Property value types

5.3.4. Wiring components together

5.4. Component definitions vs. component configuration

5.4.1. Avoiding conflicts with an existing definition

5.4.2. Dividing the configuration between annotations and XML

5.5. Configuring and enabling built-in components

5.5.1. Using the component descriptor to control Seam

5.5.2. Configuring Seam’s internationalization support

5.6. Summary

Chapter 6. Absolute inversion of control

6.1. Bijection: dependency injection evolved

6.1.1. Introducing bijection

6.1.2. Bijection on the golf course

6.1.3. Activating bijection

6.2. Dynamic dependency @In-jection

6.2.1. Declaring an injection point

6.2.2. The injection process

6.2.3. Mixing scopes and serializability

6.2.4. Injection variants

6.3. @Out-jecting context variables

6.3.1. The outjection process

6.3.2. Outjection use cases

6.3.3. Built-in @DataModel support

6.4. Bypassing bijection

6.4.1. Internal method calls

6.4.2. The mystical method context

6.4.3. Reentrant method calls

6.4.4. Disabling bijection by disabling interceptors

6.5. Component events

6.5.1. Raising an event from a component

6.5.2. Defining an event @Observer

6.5.3. Raising events on page transitions

6.5.4. Built-in events

6.6. Custom method interceptors

6.6.1. Two sides to the interceptor coin

6.6.2. Defining a Seam interceptor

6.7. Factory and manager components

6.7.1. A context variable @Factory

6.7.2. Components that @Unwrap

6.8. Summary

3. Seam’s state management

Chapter 7. The conversation: Seam’s unit of work

7.1. Learning to appreciate conversational state

7.1.1. Redefining the unit of work

7.1.2. The burden of managing state

7.2. The conversation context

7.2.1. Carving a workspace out of the HTTP session

7.2.2. What you might store in a conversation

7.3. Establishing conversation boundaries

7.3.1. A conversation’s state

7.3.2. Beginning a long-running conversation

7.3.3. Keeping the conversation going

7.3.4. Enlisting objects in a conversation

7.3.5. Ending a long-running conversation

7.4. Putting the conversation aside

7.4.1. Abandoning a conversation

7.4.2. Creating nested conversations

7.5. Switching between conversations

7.5.1. The conversation as a workspace

7.5.2. Giving conversations a description

7.5.3. Using the built-in conversation switchers

7.6. Driving the conversation with a page flow

7.6.1. Setting up a page flow

7.6.2. Learning your way around a page flow

7.6.3. Advancing the page flow

7.6.4. Addressing the back button

7.7. Ad hoc conversations

7.7.1. Open for business

7.7.2. Show me what you’ve got

7.8. Summary

Chapter 8. Understanding Java persistence

8.1. Java persistence principles

8.1.1. Establishing expectations

8.1.2. The four pillars of Java persistence

8.2. Entities and relationships

8.2.1. Mapping metadata

8.2.2. Transitive persistence

8.2.3. Bringing annotations to the persistence layer

8.3. The persistence unit

8.3.1. Defining a JCA data source

8.3.2. The persistence unit descriptor

8.3.3. The persistence manager factory

8.4. The persistence manager

8.4.1. Obtaining a persistence manager

8.4.2. The management functions of a persistence manager

8.4.3. Persistence context scoping

8.5. Transactions

8.5.1. Sorting out the transaction APIs

8.5.2. Atomic units of work

8.5.3. ACID abridged

8.6. Managing persistence in the enterprise

8.6.1. Introducing the extended persistence context

8.6.2. The benefits of an extended persistence context

8.7. Choosing between JPA and Hibernate

8.7.1. How Hibernate relates to JPA

8.7.2. What sets Hibernate and JPA apart

8.7.3. Seam’s hybrid approach

8.8. Summary

Chapter 9. Seam-managed persistence and transactions

9.1. Getting persistence context management right

9.1.1. Respecting the persistence manager

9.1.2. Managing an extended persistence context

9.2. Enhancing the capabilities of the persistence manager

9.2.1. Seam’s standard enhancements

9.2.2. Letting Hibernate shine through

9.3. Setting up a persistence unit in Seam

9.3.1. Seam’s persistence manager factories

9.3.2. Seam-managed persistence contexts

9.3.3. Sharing the persistence manager factory through JNDI

9.3.4. Validating the persistence context at startup

9.4. Seam’s transaction support

9.4.1. Global transactions

9.4.2. Seam’s transaction abstraction layer

9.4.3. Controlling Seam-managed transactions

9.4.4. Application transactions

9.5. Summary

Chapter 10. Rapid Seam development

10.1. A framework within a framework

10.1.1. Wrapping the persistence API

10.1.2. The persistence controllers

10.1.3. Two ways to play

10.2. Stateful CRUD using the Home component

10.2.1. Remedying the Anemic Domain Model

10.2.2. Giving the domain object a Home

10.2.3. Putting Home to work

10.2.4. Venturing away from home

10.2.5. CRUD a la XML

10.3. Providing feedback

10.3.1. Customizing the status messages

10.3.2. Creating i18n-compliant messages

10.3.3. Transaction success events

10.4. Smarter queries with the Query component

10.4.1. Creating a result set listing

10.4.2. Paging the result set

10.4.3. Deleting multiple records at once

10.4.4. Putting the results in order-

10.4.5. Placing restrictions on the result set

10.5. Summary

4. Sinking the business requirements

Chapter 11. Securing Seam applications

11.1. Authentication jump-start

11.1.1. Giving the user an identity

11.1.2. Implementing authentication in three steps

11.1.3. A glimpse at Seam’s identity management

11.1.4. Even more “Basic” authentication

11.2. Securing pages

11.2.1. The challenge with JSF security

11.2.2. Requiring authentication

11.2.3. Serving pages securely

11.3. Role-based authorization

11.3.1. Expressing restrictions

11.3.2. Declaring role-based restrictions

11.4. Rule-based authorization using Drools

11.4.1. Rules vs. roles

11.4.2. Setting up Drools

11.4.3. Creating rules with Drools

11.4.4. Automatic context detection

11.5. Separating the computers from the humans

11.5.1. An overview of CAPTCHA

11.5.2. Adding a CAPTCHA challenge to forms

11.6. Summary

Chapter 12. Ajax and JavaScript remoting

12.1. Using Ajax with JSF

12.1.1. Embracing a server-centric application model

12.1.2. Ajax4jsf and ICEfaces open a communication channel to JSF

12.1.3. Seam’s role in Ajax-based JSF requests

12.2. Partial form submits

12.2.1. Live validation

12.2.2. Business-savvy validations

12.2.3. Working alongside the user to fill out a form

12.3. Ajax Push with ICEfaces

12.4. JavaScript remoting to Seam

12.4.1. Transparent Ajax

12.4.2. Giving the browser access to Seam components

12.4.3. Making calls to a server-side component

12.4.4. Local stubs

12.5. Conversational remoting calls

12.5.1. Joining the conversation in progress

12.5.2. Striking up a conversation

12.5.3. Storing up requests for a shipment

12.6. Responding to GWT remoting calls

12.6.1. A quick introduction to GWT integration

12.6.2. Preparing the remoting service

12.6.3. Making a GWT service call through Seam remoting

12.7. Summary

Chapter 13. File, rich rendering, and email support

13.1. Uploading files and rendering dynamic images

13.1.1. Accepting file uploads

13.1.2. Rendering images from raw data

13.2. PDF generation with iText

13.2.1. Laying out a PDF with UI components

13.2.2. Working with tables and cells

13.2.3. Adding a splash of color

13.2.4. Graceful failures and friendly file extensions

13.2.5. Serving dynamic documents

13.3. Quick and easy charting with JFreeChart

13.3.1. Chart basics

13.3.2. Bar charts

13.3.3. Line charts

13.3.4. Pie charts

13.4. Composing email the Seam way

13.4.1. Sending your first message

13.4.2. Adding an entourage to the message

13.4.3. Setting up JavaMail in Seam

13.4.4. Publishing newsfeeds

13.5. Customizing the UI with resource bundles

13.5.1. Getting Seam to speak the right language

13.5.2. Themes

13.6. Summary

Appendix A. Seam starter set

A.1. Stepping through the prerequisites

A.1.1. Java 5 compliance

A.1.2. Java EE 5 application servers

A.1.3. Absent (JavaServer) Faces

A.2. Downloading the Seam distribution

A.2.1. Seam’s modules

A.2.2. A wealth of documentation and examples

A.2.3. Finding seam-gen amid the noise

A.3. seam-gen and the Open 18 example application

A.3.1. The source code

A.3.2. H2 database

A.3.3. Apache Ant, turning the wheels of seam-gen

A.3.4. RichFaces or ICEfaces—take your pick

A.4. Managing libraries in a seam-gen project

A.5. Adding Seam as a Maven 2 dependency



List of Figures

List of Tables

List of Listings