forked from seam2/jboss-seam
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPreface.xml
executable file
·311 lines (290 loc) · 19.8 KB
/
Preface.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
<?xml version='1.0'?>
<!DOCTYPE preface PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
]>
<preface id="Book-Preface">
<title>Introduction to JBoss Seam</title>
<para>
Seam is an application framework for Enterprise Java. It is inspired by the following principles:
</para>
<variablelist>
<varlistentry>
<term><emphasis>One kind of "stuff"</emphasis></term>
<listitem>
<para>
Seam defines a uniform component model for all business logic in your application.
A Seam component may be stateful, with the state associated with any one of several
well-defined contexts, including the long-running, persistent, <emphasis>business process
context</emphasis> and the <emphasis>conversation context</emphasis>, which is
preserved across multiple web requests in a user interaction.
</para>
<para>
There is no distinction between presentation tier components and business logic
components in Seam. You can layer your application according to whatever architecture
you devise, rather than being forced to shoehorn your application logic into an
unnatural layering scheme forced upon you by whatever combination of stovepipe
frameworks you're using today.
</para>
<para>
Unlike plain Java EE or Java EE components, Seam components may <emphasis>simultaneously</emphasis>
access state associated with the web request and state held in transactional resources (without
the need to propagate web request state manually via method parameters). You might object
that the application layering imposed upon you by the old Java EE platform was a Good Thing.
Well, nothing stops you creating an equivalent layered architecture using Seam — the difference
is that <emphasis>you</emphasis> get to architect your own application and decide what the
layers are and how they work together.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Integrate JSF with EJB 3.0</emphasis></term>
<listitem>
<para>
JSF and EJB 3 are two of the best new features of Java EE 5. EJB3 is a brand new
component model for server side business and persistence logic. Meanwhile, JSF is a
great component model for the presentation tier. Unfortunately, neither component
model is able to solve all problems in computing by itself. Indeed, JSF and EJB3
work best used together. But the Java EE 5 specification provides no standard way
to integrate the two component models. Fortunately, the creators of both models
foresaw this situation and provided standard extension points to allow extension
and integration with other frameworks.
</para>
<para>
Seam unifies the component models of JSF and EJB 3, eliminating glue code, and letting
the developer think about the business problem.
</para>
<para>
It is possible to write Seam applications where "everything" is an EJB. This may come
as a surprise if you're used to thinking of EJBs as coarse-grained, so-called
"heavyweight" objects. However, version 3.0 has completely changed the nature of EJB
from the point of view of the developer. An EJB is a fine-grained object — nothing
more complex than an annotated JavaBean. Seam even encourages you to use session beans
as JSF action listeners!
</para>
<para>
On the other hand, if you prefer not to adopt EJB 3.0 at this time, you don't have to.
Virtually any Java class may be a Seam component, and Seam provides all the functionality
that you expect from a "lightweight" container, and more, for any component, EJB or
otherwise.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Integrated with Java EE6</emphasis></term>
<listitem>
<para>
While Seam 2.2 was targeted Java EE 5 mainly, you can use some Java EE 6 technologies
also on Seam 2.3.x.
</para>
<para>
Seam 2 and some of its extensions/implementations were added into Java EE 6 as CDI technology.
So this should be a current focus of majority users. But for previous Seam 2.2 users who
doesn't want or can't use pure Java EE 6, we bring some new features from the Java EE 6 set like JSF 2,
JPA 2 and Bean Validation integrations into Seam 2.3.x.
</para>
<note>
<para>Be warned - Seam 2.3 should work only on Java EE 6 certified server like JBoss AS 7 is.</para>
</note>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Integrated AJAX</emphasis></term>
<listitem>
<para>
Seam supports the best open source JSF-based AJAX solutions: RichFaces and
ICEfaces. These solutions let you add AJAX capability to your user interface without
the need to write any JavaScript code.
</para>
<para>
Alternatively, Seam provides a built-in JavaScript remoting layer that lets you call
components asynchronously from client-side JavaScript without the need for an intermediate
action layer. You can even subscribe to server-side JMS topics and receive messages via AJAX
push.
</para>
<para>
Neither of these approaches would work well, were it not for Seam's built-in concurrency
and state management, which ensures that many concurrent fine-grained, asynchronous AJAX
requests are handled safely and efficiently on the server side.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Business process as a first class construct</emphasis></term>
<listitem>
<para>
Optionally, Seam provides transparent business process management via jBPM. You won't
believe how easy it is to implement complex workflows, collaboration and task management
using jBPM and Seam.
</para>
<para>
Seam even allows you to define presentation tier pageflow using the same language (jPDL)
that jBPM uses for business process definition.
</para>
<para>
JSF provides an incredibly rich event model for the presentation tier. Seam enhances this
model by exposing jBPM's business process related events via exactly the same event handling
mechanism, providing a uniform event model for Seam's uniform component model.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Declarative state management</emphasis></term>
<listitem>
<para>
We're all used to the concept of declarative transaction management and declarative
security from the early days of EJB. EJB 3.0 even introduces declarative persistence context
management. These are three examples of a broader problem of managing state that is
associated with a particular <emphasis>context</emphasis>, while ensuring that all needed
cleanup occurs when the context ends. Seam takes the concept of declarative state
management much further and applies it to <emphasis>application state</emphasis>.
Traditionally, Java EE applications implement state management manually, by getting
and setting servlet session and request attributes. This approach to state management is the
source of many bugs and memory leaks when applications fail to clean up session attributes,
or when session data associated with different workflows collides in a multi-window
application. Seam has the potential to almost entirely eliminate this class of bugs.
</para>
<para>
Declarative application state management is made possible by the richness of the
<emphasis>context model</emphasis> defined by Seam. Seam extends the context model defined
by the servlet spec — request, session, application — with two new
contexts — conversation and business process — that are more meaningful from the
point of view of the business logic.
</para>
<para>
You'll be amazed at how many things become easier once you start using conversations.
Have you ever suffered pain dealing with lazy association fetching in an ORM solution
like Hibernate or JPA? Seam's conversation-scoped persistence contexts mean you'll
rarely have to see a <literal>LazyInitializationException</literal>. Have you ever
had problems with the refresh button? The back button? With duplicate form submission?
With propagating messages across a post-then-redirect? Seam's conversation management
solves these problems without you even needing to really think about them. They're all
symptoms of the broken state management architecture that has been prevalent since the
earliest days of the web.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Bijection</emphasis></term>
<listitem>
<para>
The notion of <emphasis>Inversion of Control</emphasis> or <emphasis>dependency injection</emphasis>
exists in both JSF and EJB3, as well as in numerous so-called "lightweight containers". Most of
these containers emphasize injection of components that implement <emphasis>stateless services</emphasis>.
Even when injection of stateful components is supported (such as in JSF), it is virtually useless
for handling application state because the scope of the stateful component cannot be defined with
sufficient flexibility, and because components belonging to wider scopes may not be injected into
components belonging to narrower scopes.
</para>
<para>
<emphasis>Bijection</emphasis> differs from IoC in that it is <emphasis>dynamic</emphasis>,
<emphasis>contextual</emphasis>, and <emphasis>bidirectional</emphasis>.
You can think of it as a mechanism for aliasing contextual variables (names in the various contexts
bound to the current thread) to attributes of the component. Bijection allows auto-assembly of stateful
components by the container. It even allows a component to safely and easily manipulate the
value of a context variable, just by assigning it to an attribute of the component.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Workspace management and multi-window browsing</emphasis></term>
<listitem>
<para>
Seam applications let the user freely switch between multiple browser tabs, each associated with a
different, safely isolated, conversation. Applications may even take advantage of <emphasis>workspace
management</emphasis>, allowing the user to switch between conversations (workspaces) in a single
browser tab. Seam provides not only correct multi-window operation, but also multi-window-like
operation in a single window!
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Prefer annotations to XML</emphasis></term>
<listitem>
<para>
Traditionally, the Java community has been in a state of deep confusion about precisely
what kinds of meta-information counts as configuration. Java EE and popular "lightweight"
containers have provided XML-based deployment descriptors both for things which are
truly configurable between different deployments of the system, and for any other kinds
or declaration which can not easily be expressed in Java. Java 5 annotations changed
all this.
</para>
<para>
EJB 3.0 embraces annotations and "configuration by exception" as the easiest way to provide
information to the container in a declarative form. Unfortunately, JSF is still heavily
dependent on verbose XML configuration files. Seam extends the annotations provided by
EJB 3.0 with a set of annotations for declarative state management and declarative
context demarcation. This lets you eliminate the noisy JSF managed bean declarations
and reduce the required XML to just that information which truly belongs in XML
(the JSF navigation rules).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Integration testing is easy</emphasis></term>
<listitem>
<para>
Seam components, being plain Java classes, are by nature unit testable. But for complex applications,
unit testing alone is insufficient. Integration testing has traditionally been a messy and
difficult task for Java web applications. Therefore, Seam provides for testability of Seam
applications as a core feature of the framework. You can easily write JUnit or TestNG tests
that reproduce a whole interaction with a user, exercising all components of the system
apart from the view. You can run these tests directly inside your
IDE, where Seam will automatically deploy EJB components using Arquillian.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis>The specs ain't perfect</emphasis></term>
<listitem>
<para>
We think the latest incarnation of Java EE is great. But we know it's never going to be
perfect. Where there are holes in the specifications (for example, limitations in the
JSF lifecycle for GET requests), Seam fixes them. And the authors of Seam are working
with the JCP expert groups to make sure those fixes make their way back into the next
revision of the standards.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis>There's more to a web application than serving HTML pages</emphasis></term>
<listitem>
<para>
Today's web frameworks think too small. They let you get user input off a form and
into your Java objects. And then they leave you hanging. A truly complete web application
framework should address problems like persistence, concurrency, asynchronicity, state
management, security, email, messaging, PDF and chart generation, workflow, wikitext
rendering, webservices, caching and more. Once you scratch the surface of Seam, you'll
be amazed at how many problems become simpler...
</para>
<para>
Seam integrates JPA and Hibernate for persistence, the EJB Timer Service and Quartz
for lightweight asychronicity, jBPM for workflow, JBoss Rules for business rules, Meldware
Mail for email, Hibernate Search and Lucene for full text search, JMS for messaging and JBoss
Cache for page fragment caching. Seam layers an innovative rule-based security framework over
JAAS and JBoss Rules. There's even JSF tag libraries for rendering PDF, outgoing email, charts
and wikitext. Seam components may be called synchronously as a Web Service, asynchronously
from client-side JavaScript or Google Web Toolkit or, of course, directly from JSF.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Get started now!</emphasis></term>
<listitem>
<para>
Seam should work in any Java EE application server, and even works in Tomcat. If your environment
supports EJB 3.0 or 3.1, great! If it doesn't, no problem, you can use Seam's built-in transaction
management with JPA or Hibernate for persistence.
</para>
</listitem>
</varlistentry>
</variablelist>
<mediaobject>
<imageobject>
<imagedata fileref="images/architecture.png"/>
</imageobject>
</mediaobject>
<para>
It turns out that the combination of Seam, JSF and EJB is <emphasis>the</emphasis> simplest way
to write a complex web application in Java. You won't believe how little code is required!
</para>
<xi:include href="Feedback.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
</preface>