Upload
others
View
1
Download
0
Embed Size (px)
Citation preview
627
Chapter
Index
A
accessclient access, controlling 22client access, guarding a views 23client access, guarding by configuration
25restricting access to resources 88
acknowledgments xxviiiAction class 70action management and Struts 215Actions 69activation 47Adapters
Action Adapter for Web Worker 594in Web Worker 590Work Adapter for Web Worker 613
aggregation 401Alexander, Christopher
pattern definition 9pattern relationships 13three-part rule 9
Apache software license 625
APIhiding from presentation tier 80JMS and MOM 60protocol-specific, using 181SOAP with attachments 162
Application Controllerclass diagram 207Command Handler class diagram 210Command Handler sequence diagram
211Command Handler strategy 209Command Handler with CommandPro-
cessor class diagram 210consequences 238Custom SOAP Handler class diagram
230Custom SOAP Message Handling strat-
egy 230forces 205Handle class diagram 209JAX-RPC Message Handling strategy
235
Index
CJP2IOM.fm Page 627 Friday, May 16, 2003 6:00 PM
628 Index
Index
JAX-RPC sequence diagram 236Message Handling strategy 229Navigation and Flow Control strategy
223Nested Command and View sequence
diagram 216overview 131participants and responsibilities 207problem 205related patterns 239sequence diagram 207SOAP Message Handling sequence dia-
gram 231solution 205strategies 209structure 207Struts 215Transform Handler class diagram 221Transform Handler sequence diagram
222Transform Handler strategy 221View Handler class diagram 214View Handler strategy 213View Helper sequence diagram 244
Application Controller Using Command Handler strategy 591, 592
Application ServiceApplication Service class diagram 360Application Service Command alternate
sequence diagram 364Application Service Command class di-
agram 363Application Service Command class di-
agram, alternate 364Application Service Command se-
quence diagram 364Application Service GoF strategy 365Application Service Layer class dia-
gram 365Application Service Layer sequence di-
agram 366Application Service Layer strategy 365Application Service sequence diagram
362Application Service strategy 363class diagram 361
GoF Application Service class diagram 365
order system sequence diagram 368overview 133problem 357
Application Service GoF strategy 365Application Service Layer strategy 365Application Service strategy 363architectural tiers 11architecture
Christopher Alexander 9pattern framework 16
see also
micro-architecture, Web Work-er
asynchronous processingservice 60solution to enterprise beans for long-
lived transactions 60attributes
bean attributes, exposing via get/set 55HttpSession object 229servlet context 229
audience for book xxvauthentication methods 25automated workflow 581
B
bad practicesallowing duplicate form submissions 35business tier 53client aggregates data from business
components 59control code in multiple views 33entity bean dependent object graph,
storing 57entity beans, using as fine-grained ob-
jects 56entity beans, using as read-only objects
56entity beans, using for long-lived trans-
actions 60exposing all enterprise bean attributes
via get/set 55exposing EJB-related exceptions to
non-EJB clients 58exposing presentation tier data struc-
tures in business tier 34
CJP2IOM.fm Page 628 Friday, May 16, 2003 6:00 PM
Index 629
Index
exposing presentation tier data struc-tures in domain objects 35
exposing sensitive resources to clients 36
fat controllers 36finder methods, using for large results
set 59helpers, using as scriptlets 37integration tier 53jspsetproperty, assuming will reset bean
properties 36mapping each use case to session bean
54mapping object model to entity bean
model 53mapping relational model to entity bean
model 53presentation tier 33service lookup, embedding in clients 55stateless session bean reconstructs con-
versational state 60Bake-a-Cake workflow example 582Base Filter strategy 158Base Front strategy 179bean-managed persistence 103
entity beans and DA code 52bean-managed transaction 93beans,
see
session beans, entity beans, enter-prise beans, JavaBeans
benefits of using patterns 15best practices
entity beans and business logic 51entity beans and primary keys 50
see also
design considerationsbibliography 621Blueprints web site xxviiBMP definition 124Booch, Grady
foreword xviii
see also
Bibliography , GoFbook audience xxvbook web site xxviibusiness components
clients aggregating data from 59CMP 107
see also
business objectsbusiness data validation 381Business Delegate 55, 302
Business Delegate with Adaptor se-quence diagram 308
Business Delegate with ID sequence di-agram 306
class diagram 304consequences 308Delegate Adaptor strategy 307Delegate Proxy strategy 307forces 302, 316overview 133participants and responsibilities 304,
317problem 302refactoring using 94related patterns 313sample code 309sequence diagram 305solution 303strategies 307structure 304
Business Delegate as Helper strategy 254, 255
business delegatesdecoupling client from business tier 58definition 58
business logic 51EJB Home business methods 451entity beans, in 50extracting into helper classes 72types of entity relationships 51
business modelsconceptual and abstract models 375identifying objects 377terminology 374
Business Objectclass diagram 379consequences 385forces 375overview 134participants and responsibilities 379POJO Business Object strategy 381problem 374related patterns 388sample code 387sequence diagram 380solution 375strategies 381structure 379
CJP2IOM.fm Page 629 Friday, May 16, 2003 6:00 PM
630 Index
Index
business object modelsDomain Store 555terminology 374, 375
business objectsidentifying 377non-business organizations 376persistence, and 377persistence, implementing 378validation 381wrapping transfer object 390
business servicesas POJOs or EJBs 500mapping to session beans 96
business tierbad practices 53decoupling from clients with business
delegate 58design considerations 46exposing entity beans from 92exposing presentation tier data to 34overview 121pattern catalog 300patterns list 13, 123refactorings 92storing state on 48
C
Cached RowSet strategy 475caching 95
encapsulate code 95enterprise bean remote references and
handles 52POJOs and entity beans 384
cake workflow example 582can 381Candidate Interactions
sequence diagram 612workflow 611
categories of patterns 10centralizing
common logic 144control logic 64disparate logic 72
characteristics of patterns 10chocolate cake 582class diagrams
Application Controller 207
Application Controller Command Han-dler 210
Application Controller Command Han-dler with Command Processor 210
Application Controller Custom SOAP Handler strategy 230
Application Controller Handle 209Application Controller Transform Han-
dler strategy 221Application Controller View Handler
strategy 214Application Service 361Application Service Command strategy
363Application Service Command strategy,
alternate 364Application Service Layer strategy 365Business Delegate 304Business Object 379Composite Entity 394, 398Composite Entity Entity Facade 396Composite View 264Context Object 182Custom SOAP Filter strategy 162Data Access Object 463Data Access Object Read Only RowSet
477Data Access Object RowSet Wrapper
List 483Dispatcher View 289Dispatcher View, Dispatcher in Control-
ler 291Domain Store 518Domain Store Custom Persistence 527Domain Store with participating classes
519EJB Service Locator strategy 320Entity Inherits Transfer Object 423Front Controller 168Front Controller Dispatcher in Control-
ler 178Front Controller using helpers 169GoF Application Service strategy 365Intercepting Filter 145JMS Queue Service Locator strategy
325JMS Topic Service Locator strategy 327Multiple Transfer Objects 421
CJP2IOM.fm Page 630 Friday, May 16, 2003 6:00 PM
Index 631
Index
POJO Service Activator 502Request Context strategy 184SecurityContext authentication 197Service Activator 497Service Activator Aggregator 510Service Activator Command Request
509Service Facade strategy 360Service Locator strategy 317Service to Worker, Command 277Service to Worker, Helper 278Session Facade 343Transfer Object 416Transfer Object Assembler 435Updatable Transfer Object 418Value List Handler 446View Helper 244View Helper Style Sheets 247View Helper, Using Translets 247Web Service Broker 558Web Service Broker Java Binder 561Web Service Broker Java Binder PO ex-
ample 563Web Service Broker Java Binder sche-
ma 564Web Service Broker JAX-RPC 569Web Worker Action Adapter 591Web Worker Work Adapter 594, 595Web Worker Work Adapter, Candidate
Interactions 612clients
access, controlling 22access, guarding a view 23access, guarding by configuration 25aggregating data from business compo-
nents 59clicking Back and duplicate form sub-
missions 27client tier overview 121decoupling from business tier 58determining which access business ser-
vices 48embedding service lookups in 55exposing EJB exceptions to 58exposing sensitive resources to 36hiding resources from 88JMS components 323legacy application as 499
navigation 35validation on 28
see also
viewsCMP
choosing for Business Object 376complex business components 107definition 125
coarse-grainedbusiness objects 54business services and entity beans 96distributed persistent objects 92entity beans 53, 57interfaces to business services 94service access layer 53
collaborationstructure for each pattern 130Web Worker Hire Employee 588
Command and Controller strategy 174, 177Command Handler strategy 209Command object 70Command Request strategy 508comments, email address for xxviicommon vocabulary 15composite display 268Composite Entity 421, 433
BMP strategy 396class diagram 394Composite Transfer Object sequence di-
agram 400Composite Transfer Object strategy 400consequences 401Dirty Marker strategy 397Entity Facade class diagram 396forces 392Lazy Loading strategy 396overview 134problem 391related patterns 413Remote Facade strategy 395sample code 402sequence diagram 394solution 392Store Optimization class diagram 398Store Optimization sequence diagram
399Store Optimization strategy 397structure 393, 434
Composite Entity BMP strategy 396
CJP2IOM.fm Page 631 Friday, May 16, 2003 6:00 PM
632 Index
Index
Composite Entity Remote Facade strategy 395
Composite Transfer Object strategy 400Composite Value Object strategy 400Composite View 262
class diagram 264consequences 271Custom Tag View Management strategy
269Early-Binding Resource strategy 270forces 262JavaBean View Management strategy
265Late-Binding Resource strategy 271overview 133participants and responsibilities 264problem 262related patterns 275sample code 272sequence diagram 265solution 262Standard Tag View Management strate-
gy 267strategies 265structure 263Transformer View Management strate-
gy 270composite views 262composites, definition 125concurrency
avoiding issues with DAO 463managing for Business Objects 376POJOs and entity beans 384
configurationguarding by configuration, client access
25guarding client access and standard se-
curity constraint 25connection management 109connection pools
POJOs and entity beanspre-initializing connections 108
connection retrieval methods 109Connections 108consequences
definition 130consequences, definition 130container-managed transaction 93
containerscontainer configuration, hiding resourc-
es from client 88, 89container-managed transaction 92, 98container-managed transactions 107container-managed transactions and en-
tity beans 92ejbActivate 445finder method overhead 445life cycle of enterprise beans 47
Context Objectclass diagram 182consequences 203Context Object Auto-Population strate-
gy 200Context Object Factory strategy 199forces 181JSTL Configuration strategy 196overview 133participants and responsibilities 183problem 181related patterns 203Request Context class diagram 184Request Context Map strategy 184Request Context POJO strategy 185request context strategies 184Request Context Validation strategy 192Security Context strategy 197SecurityContext authentication class di-
agram 197sequence diagram 183solution 181strategies 184structure 182
Context Object Auto-Population strategy 200Context Object Factory strategy 199control
control components, hiding resources from clients 88, 91
permission-based control 89control code 66
in multiple views
views
33control code in multiple views 33control component 89control logic
avoiding duplicating 166extract into controller classes 64
CJP2IOM.fm Page 632 Friday, May 16, 2003 6:00 PM
Index 633
Index
extracting into one class 64Front Controller 166mingling with data access logic 240View Helper 240
Controller-Based View strategy 249controllers
definition 125fat controllers, bad practices 37helper classes and business logic 79
conversational state 48maintaining on EJB layer
see also
stateconversion code 84, 85conversions 84cookies
HTTP cookies strategy 21session state 20, 21
core processing for request handling and view processing 167
coupling 82Create Candidate workflow steps 594CRUD business operations 517cursors
created only once 484DataRowListIterator 485designing Data Access Object 492
Custom Data Access Object strategy 466custom data access objects 378custom event listeners 228Custom Filter strategy 153Custom Persistence strategy 526, 541Custom SOAP Message Handling strategy
230Custom Tag Helper strategy 252Custom tag helpers 33, 86custom tag helpers 77Custom Tag View Management strategy 267,
269, 270Custom Tag View Manager strategy 266custom tags 241, 269
UML 129Custom XML Messaging strategy 560
D
DAOsconcurrency issues, avoiding 463in Data Access Object diagram 466
see also
data access, data sources
dataclients aggregating from business com-
ponents 59data synchronization, POJOs and entity
beans 385validation in business objects 381
data access codeentity beans 52extracting 102localizing data access logic 105moving closer to data source 102, 105separating from control and entity ob-
jects 106Data Access Object 378
Cached RowSet strategy 475class diagram 463consequences 493Custom Data Access Object strategy
466Data Access Object Factory strategies
471designing 492EJB Home business methods 451forces 462overview 134participants and responsibilities 464problem 462Read Only RowSet class diagram 477Read Only RowSet sequence diagram
478Read Only RowSet strategy 476related patterns 495RowSet Wrapper List class diagram 483RowSet Wrapper List sequence diagram
484RowSet Wrapper List strategy 482sequence diagram pt. 1 464sequence diagram pt. 2 465solution 463strategies 466structure 463Transfer Object Collection strategy 473Value List Handler 449
Data Access Object Factory strategies 471data access objects 106
definition 125encapsulating data source 56implementing persistence 378
CJP2IOM.fm Page 633 Friday, May 16, 2003 6:00 PM
634 Index
Index
data modelsconceptual and abstract models 375entity-relationship model 375terminology 374
data sourcesdesigning enterprise beans based on ex-
isting schema 57encapsulating access using 56extracting data access code 102implementing business object persis-
tence 378data store
business object persistence 378entity beans overview 49persistence implementation 378
see also
data sources, persistence, per-sistent store
data structuresexposing presentation tier to business
tier 34exposing presentation tier to domain ob-
jects 35generic 80
Database connection 108Database Response strategy 513declarative security constraints 25decoupling
client from business tier 58coupling client and business tier, prob-
lems 59tiers using business delegate
Delegate Adapter strategy 307Delegate Adaptor strategy 307Delegate Proxy strategy 307delegate to a control component 91delegates
definition 125
see also
Business Delegatedelegates,
see
business delegatesdependent entity beans 98dependent objects
and coarse-grained entity beans 98Composite Entity 392definition 125inter-entity bean relationships 393object graph 57
deployment descriptorsprimary keys, and 50
transaction attributes of session bean 93design considerations
business tier 46caching enterprise bean remote refer-
ences and handles 52controlling client access 22entity beans 49helper properties 30integrity and consistency of helper prop-
erties 30presentation tier 20session beans 46session management 20validation 28
Design Patterns, Gang of Four 9diagrams,
see
sequence diagrams, class dia-grams, UML
direct handles 208Dirty Marker strategy 397Dispatcher in Controller strategy 178Dispatcher View 276, 288
class diagram 289consequences 293Dispatcher in Controller class diagram
291Dispatcher in Controller sequence dia-
gram 292forces 288Front Controller and 277overview 133problem 288related patterns 299sample code 294sequence diagram 290solution 288structure 289
dispatchers, definition 125distributed objects, entity bean definition 49domain models
and object models 375terminology 374, 375
domain objectsexposing presentation tier data to 35non-business organizations 376terminology 376
Domain Storebusiness object persistence 378business objects sequence diagram 521
CJP2IOM.fm Page 634 Friday, May 16, 2003 6:00 PM
Index 635
Index
class diagram 518consequences 555Custom Persistence class diagram 527Custom Persistence sequence diagram
528Custom Persistence strategy 526data retrieval sequence diagram 523forces 516JDO strategy 543participants and responsibilities 520Participating Classes class diagram 519persistence implementation 379problem 516queries sequence diagram 525related patterns 556solution 516strategies 526structure 517
duplicate form submissions 27duplicate request submissions 67duplicate submissions 27duplicate validation 381dynamic resource subviews 271
E
Early-Binding Resource strategy 270EJB finder methods
looking up entity beans 59
see also
findersEJB Home
business methods 451EJB Home handle 52
EJB Service Locator strategy 319ejbLoad, storing entity-bean dependent ob-
ject graph 57EJBs
business service implementation 500EJB Home business methods 451EJB UML stereotype 129EntityEJB UML stereotype 129finder method drawbacks 445persistence versus transparent persis-
tence 517select methods 445SessionEJB UML stereotype 129
ejbStore and entity beans as read-only objects 56
Email Response strategy 513
embedding a guard 23empty values and resetting bean properties 36encapsulating
content retrieval logic 78encapsulate code for lookup and caching
95encryption of session state 21enhancing persistence 524enterprise beans
bringing in and out of memory 47caching remote references and handles
52definition 126designing based on existing RDBMS
schema 57exposing all attributes via get/set 55exposing EJB exceptions to non-EJB
clients 58life cycle management 47using for long-lived transactions 60
entities, wrapping with sessions 92entity beans 378
bean-managed persistence and DA code 52
business logic in 50business objects, implementing 383coarse-grained and dependent objects 98dependent 98design considerations 49encapsulating by wrapping with session
92entity facade 396entity-entity relationships 51finder drawbacks 445fine-grained objects, as 56increasing fine-grained 53inter-entity bean communication 98model, mapping object model to 53model, mapping relational model to 53moving business logic to session 100multiple beans and workflow 51overview 49persistence 385persistence implementation 378primary key best practice 50primary keys and 50read-only objects, using as 56single-field primary key 50
CJP2IOM.fm Page 635 Friday, May 16, 2003 6:00 PM
636 Index
Index
storying entire entity bean-dependent object graph 57
wrapping with sessions 92entity facades
class diagram 396POJOs 396
Entity Inherits Transfer Object strategy 422Entity Inherits Value Object strategy 422EntityEJB UML stereotype 129events
event listeners 228lifecycle 228
exceptionsbusiness application 58EJB exceptions, exposing to non-EJB
clients 58
F
facadesdefinition 126entity facade 396
see also
Session Facade, service facadesfaçades for entity beans 94façades to entity beans 97factories, definition 126factoring
factoring logic into helper classes 72
see also
centralizingfat controllers, bad practice 37feedback email address xxviiFilter Controller strategy 179filters
Intercepting Filter 146pluggable 145processing 146strategies 147
findersdrawbacks 445returning large results set 59
fine-grainedcontrollers 54entity beans, increasing 53objects 57objects, entity beans as 56
flowcontrolling request flow with shared to-
ken 67
see also
workflow
forces, definition 130form-centric validation 28forms
allowing duplicate form submissions 35duplicate form submissions 27form-centric validation 28HTML form interfaces 32
Fowler, Martindefinition of patterns 10Foreword xixpattern relationships to J2EE patterns
135
see also
Bibliography frameworks
generic 29J2EE pattern relationships 131pattern frameworks 16
Front Controller 166Base Front strategy 179class diagram 168class diagram using helpers 169Command and Controller sequence dia-
gram 176Command and Controller strategy 174consequences 180creating Context Object 277Dispatcher in Controller class diagram
178Dispatcher in Controller sequence dia-
gram 179Dispatcher View 277Filter Controller strategy 179JSP Front strategy 172participants and responsibilities 169Physical Resource Mapping strategy
175problem 166related patterns 180sequence diagram 169Service to Worker 277Servlet Front strategy 170solution 166strategies 170structure 168subcomponents 131
functional approach to views 245
CJP2IOM.fm Page 636 Friday, May 16, 2003 6:00 PM
Index 637
Index
G
Gang of Four Design Patterns book 9generic
configuration 26data structures 80refactorings 102
getter methodsexposing bean attributes with 55
glossarymodels 374, 375pattern terminology 124
GoFApplication Service strategy 365authors 126names of authors 9relationship to J2EE patterns 135
granularity 12graphs
object graphs, storing bean-dependent 57
storing only changed objects 58guarding a view
all-or-nothing guard 23client access control 23embedding guard within view 23portions of view 24portions of view not displayed for user
roles 24guarding by configuration
client access control 25code example 26resource guards 26
H
handlescaching 52design note 208direct and indirect 208
handling requests 167helper classes 73Helper components 78helpers
definition 126design notes 256encapsulating conversion code in 84extracting business logic into 72, 78
helper properties design considerations 30
intermediate state 30using scriptlets as 37
hidden fields and session state 20, 21Hire Employee
class diagram 591, 594collaboration 588interaction 586, 588interaction with adapters 590sequence diagram 595workflow 583, 584
HRroles in workflow 584workflow diagrams 586workflow process 585
HTML 147form interfaces 32forms, allowing duplicate submissions
35hidden fields and session state 21
HTTPContext Object 181cookies 21cookies strategy 21protocol, helpers independent of 37
HttpServletRequestexposing presentation tier data struc-
tures to business tier 34exposing presentation tier data struc-
tures to domain objects 35hiding presentation tier details from
business tier 80HttpSession
event listeners 228events 229storing state in stateful session or 48storing state on web tier 48
I
Identity Map and StateManager 523imperative approach to views 245implementation
business object persistence 378business objects 383details, hiding 80details, hiding with business delegateintent versus 253
CJP2IOM.fm Page 637 Friday, May 16, 2003 6:00 PM
638 Index
Index
security for POJOs and entity beans 383
see also
strategies, sample codeimplementing business object persistence
378independent objects, definition 126indirect handles 208integration tier
bad practices 53overview 121pattern catalog 460patterns list 13, 123refactorings 92
interaction diagrams,
see
sequence diagramsIntercepting Filter 144
Base Filter strategy 158class diagram 145consequences 165Custom Filter strategy 153Custom SOAP Filter strategy 162, 163Custom SOAP Filter strategy class dia-
gram 162forces 144JAX-RPC sequence diagram 164overview 131participants and responsibilities 146problem 144related patterns 165sequence diagram 146sequence diagram, decorator implemen-
tation 155sequence diagram, encoding conversion
152sequence diagram, nondecorator imple-
mentation 156sequence diagram, template filter strate-
gy 161solution 145Standard Filter strategy 147strategies 147structure 145Template Filter strategy 158Web Service Message-Handling strate-
gies 161inter-entity
bean dependencies 51entity bean communication
reducing
98
relationships
393
entity bean relationships 98, 100relationships 54
interfacesHTML form interfaces 32overlaying interface types 81
intermediate state and JavaBean helper class-es 30
Interview Candidate workflow steps 596isolation levels, transaction 56iterators
definition 126GoF Iterator pattern 134Value List iterator 446
J
J2EEadvantages 8patterns,
see
patternsJava Binder strategy 560Java Center xxiiiJava Community Process 8Java objects,
see
POJOsJava Scriptlet code 256JavaBeans
helper 256helpers design note 256JavaBean Helper strategy 251, 252JavaBean helpers, extracting business
logic into 78JavaBean View Management strategy
265JAX-RPC Message Handling strategy 235JAX-RPC strategy 568JDBC
results set and Data Access Object de-sign 493
see also
results set, Data Access ObjectJDBC DataSource Locator strategy 322JDOs
JDO strategy 543persistence implementation 379persistence, enhancing 524
JMScomponents 323JMS Queue Service Locator strategy
323, 324JMS Response strategy 513JMS Service Locator strategy 323
CJP2IOM.fm Page 638 Friday, May 16, 2003 6:00 PM
Index 639
Index
JMS Topic Service Locator strategy 327queues or topics 501
JNDIembedding service lookups in clients 55initial context object 315JMS components 323
JSPimplementation versus intent 253mingling business logic with view 73tags 267UML stereotype 129using helpers as scriptlets 37
JSP Front strategy 172jspsetproperty
resetting bean properties 36JSTL Configuration strategy 196
K
keys, primary keys and entity beans 50
L
Late-Binding Resource strategy 271Lazy Loading strategy 396, 408legacy application as client 499level of abstraction 12lifecycle
Command Handler 209dependent objects 125events 228independent objects 126
listserver for J2EE patterns xxviilocalizing
data access logic 105disparate logic 72references to protocol-related data 83
logiclocalize disparate logic 72
Logical Resource Mapping strategy 176Logical Resource Naming strategy 176lookups
embedding in clients 55lookup code 55lookup services 95
M
manual workflow 581mapping 96
command and controller strategy for Front Controller 177
Mapper handle 208session beans to entity beans 96Session Facade pattern 54StateManager and Identity Map 523use case to entity bean 54
MDB Service Activator strategy 507mechanism for reuse 15memory
blocking container resources 60bringing beans in and out of 47
merging session beans 96Message Handling strategies 229message-oriented middleware
definition 60
see also
MOMmessages
clients as message generators 499message-oriented middleware 499
micro-architectureoverview 14Web Worker 581
minglingbusiness logic and presentation 72business logic with view, JSP 73control logic, data access logic, format-
ting logic 240Model validation 29models
definition 127object models implemented as Business
Objects 516multiple atomic subviews 262Multiple Transfer Objects strategy 420Multiple Value Objects strategy 420Multiplexed Resource Mapping strategy 176
N
Navigation and Flow Control strategy 223navigation and routing 167nested composite structures 271network performance 450networks
HTML hidden fields 21network communication and fine-
grained objects 56object model mapped to entity bean
model 53
CJP2IOM.fm Page 639 Friday, May 16, 2003 6:00 PM
640 Index
Index
session state 22
see also
performance
O
object graphsdependent objects 57storing entity bean dependent 57
object modelsdesigning enterprise beans based on ex-
isting schema 57identifying objects 377implementing object models 375implementing OO model 375mapping directly to entity bean model
53terminology 374, 376
object-relational mappingdesigning enterprise beans based on ex-
isting RDBMS schema 57off the shelf solutions 382separating persistence and business log-
ic 386objects
using entity beans as read-only objects 56
see also
POJOsone-to-one mapping 96overlaying interface types 81overview of patterns 121
P
parent objectsComposite Entity 392dependent relationships 393
parent-dependent object relationships 53parent-dependent objects 54passivation 47pattern identification 119pattern relationship 131pattern roadmap 135patterns
abstraction level 119Application Controller 205Application Service 357benefits 14Business Delegate 302Business Object 374business tier catalog 300
business tier list 123categorizing 10characteristics 10community listserver xxviiComposite Entity 391Composite View 262Context Object 181Data Access Object 462definition 118definition and history 9Dispatcher View 288Domain Store 516frameworks 16Front Controller 166information structure in this book 129integration tier catalog 460integration tier list 123Intercepting Filter 144J2EE relationship to known patterns 135list of patterns in this book 13list with synopsis 121micro-architecture 581pattern template description 129presentation tier catalog 142presentation tier list 122relationships 131relationships among 16reuse of patterns 16Service Activator 496Service Locator 315Service to Worker 276Session Facade 341strategies, compared to 119subcomponents 133terminology 124Transfer Object 415Transfer Object Assembler 433Value List Handler 444View Helper 240Web Service Broker 557Web Worker micro-architecture 584
performanceconnection pools 108exposing enterprise bean attributes 55fine-grained objects 56inter-entity-bean dependencies 51large amounts of state 21large results set 59
CJP2IOM.fm Page 640 Friday, May 16, 2003 6:00 PM
Index 641
Index
performance throughput, reduction 98qualities of service 12
permission-based control 67, 89persistence
business object persistence 378business objects and 377custom strategy 541EJB versus transparent 517enhancers 524implementation 378JDO persistence 378, 379JDOs 378POJOs and entity beans 385
persistent dataentity beans overview 49
see also
data storepersistent store
definition 127retrieving state from 47updating transactions to 56
Physical Resource Mapping strategy 175plain old Java object,
see
POJOspluggable filters 145POJO Business Object strategy 381POJO Handler strategy 448POJO Service Activator strategy 500POJO Transfer Object Assembler strategy
437POJOs
business objects, implementing 383business service implementation 500entity facade 396persistence 385
poolsPOJOs and entity beans 384
see also
connection poolspostprocessing
Intercepting Filter 144requests and Intercepting Filter 144SOAP message handling 230useful pattern 135
preprocessingIntercepting Filter 144requests and Intercepting Filter 144SOAP message handling 230useful pattern 135
presentation processing 106Presentation Tier 121
presentation tierbad practices 33data structures 80design considerations 20exposing data structures to business tier
34exposing data structures to domain ob-
jects 35framework 81overview 121pattern catalog 142patterns list 13, 122refactorings 64request handling 167view processing 167
primary keysbest practice 50definition 50deployment descriptor 50entity beans and 50primary key field 50
problemdefinition 130exposing code intent 261modularity and View Helper 240
processingprocessing logic, extracting from page
261request processing and view preparation
276view processing 243
processing logiclocalizing 105moving into business tier 105
productivityJ2EE and 8
protocolsrequest handling and view processing
167proxies
definition 127Delegate 125Delegate Proxy Strategy 307session bean proxy to entity 97
Q
Quality of Service goals 12queries
CJP2IOM.fm Page 641 Friday, May 16, 2003 6:00 PM
642 Index
Index
finder drawbacks 445obtaining results sets 59
queuesclients and JMS components 323topics or 501
R
Raspberry Offshore Resources 584Read Only RowSet strategy 476read-only objects, using entity beans as 56reconstructing
conversational state for each invocation 60
refactoringsbusiness tier 92general 102hide presentation tier details from busi-
ness tier 80hide resources from client 88integration tier 92introduce a controller 64introduce business delegate 94introduce synchronizer token 67localize disparate logic 72merge session beans 96move business logic to session 100presentation tier 64reduce inter-entity bean communication
98refactor architecture by tiers 105remove conversions from view 84separate data access code 102use a connection pool 108wrap entities with session 92
reference to an enterprise bean 52related patterns
definition 130relational models
mapping directly to entity bean model 53
relationshipsamong patterns 16pattern overviews and diagram 132pattern relationships 131pattern relationships and micro-architec-
ture 581remote method invocation semantics 98
remote referencescaching 52obtaining reference to session bean 52
RemoteExceptionbusiness application errors 58exposing to non-EJB clients 58
Request Context Map strategy 184Request Context POJO strategy 185request context strategies 184Request Context Validation strategy 192requests
controlling with synchronizer token 67duplicate submissions 67pre and postprocessing 144processing design note 167processing views 243request processing and views 243
resource tieroverview 121
resourceshiding from clients 88
response strategies 513Restrict access 89restrict direct access 90result sets
Data Access Object 449Data Access Object, designing 492finder drawbacks 445JDBC API 493Value List Handler 449
results setscursor that’s created once 484finder methods, using to return 59queries, using to return 59
resumesaction adapter and work adapter work-
flow interactions 588workflow process 586
reusedesign reuse xxivpatterns, using together 16software 16
Review Candidate workflow steps 596role name 26RowSet Wrapper List strategy 482Rule of Three 119runtime-content inclusion 271
CJP2IOM.fm Page 642 Friday, May 16, 2003 6:00 PM
Index 643
Index
S
scalability 47connection pools 108session beans and problems 47stateless session beans and 60
schema for Web Service Broker Purchase Or-der example 564
scriptletsdefinition 127implementation versus intent 253using helpers as 37
securityclient access, controlling 22client access, guarding a view 23client access, guarding by configuration
25exposing all bean attributes via get/set
55exposing sensitive resources to clients
36guarding client by configuration 25guarding client by view 23hiding resources from clients 88POJOs and entity beans 383session state, client side 21
see also
bad practices, design consider-ations
Security Context strategy 197select methods 445semantics, transaction 56sensitive resources 36sequence diagrams
Application Controller 207Application Controller Command Han-
dler 211Application Controller JAX-RPC 236Application Controller Nested Com-
mand and Vi3ew 216Application Controller SOAP Message
Handling 231Application Controller Transform Han-
dler 222Application Controller View Helper 244Application Service Command alternate
strategy 364Application Service Command strategy
364
Application Service Layer strategy 366Application Service order system 368Business Delegate 305Business Delegate with Adapter 308Business Delegate with ID 306Business Object 380Command and Controller 176Composite Entity 394Composite Entity Composite Transfer
Object 400Composite Entity Store Optimization
399Composite View 265Context Object 183Data Access Object pt. 1 464Data Access Object pt. 2 465Data Access Object Read Only RowSet
478Data Access Object RowSet Wrapper
List 484Dispatcher View 290Dispatcher View Dispatcher in Control-
ler 292Domain Store Custom Persistence 528Domain Store, business objects 521Domain Store, data retrieval 523Domain Store, queries 525EJB Service Locator strategy 321EJB Service Locator Using Handles
strategy 322Entity Inherits Transfer Object 423Front Controller 169Front Controller Dispatcher in Control-
ler 179Intercepting Filter 146Intercepting Filter Custom SOAP Filter
strategy 163Intercepting Filter decorator implemen-
tation 155Intercepting Filter encoding conversion
152Intercepting Filter JAX-RPC strategy
164Intercepting Filter nondecorator imple-
mentation 156Intercepting Filter Template Filter strat-
egy 161JDBC Service Locator strategy 323
CJP2IOM.fm Page 643 Friday, May 16, 2003 6:00 PM
644 Index
Index
JMS Queue Service Locator strategy 326
JMS Topic Service Locator strategy 328Multiple Transfer Objects 422Service Activator 498Service Activator Aggregator pt. 1 511Service Activator Aggregator pt. 2 512Service Activator Aggregator pt. 3 512Service Facade strategy 362Service Locator 318Service to Worker 279Session Facade 344Transfer Object 417Transfer Object Assembler 436Updatable Transfer Object 420Value List Handler 447View Helper, Helper, non-remote 257View Helper, Helper, remote 259Web Service Broker 560Web Service Broker Custom Messaging
561server affinity definition 22servers
administration tasks reduced 167server-side RPC invocation 163session state on 22validation on 28
Service Activatorclass diagram 497Command Request class diagram 509Command Request strategy 508consequences 514Database Response strategy 513Email Response strategy 513forces 496JMS Response strategy 513MDB Service Activator strategy 507overview 134participants and responsibilities 497POJO Service Activator class diagram
502POJO Service Activator strategy 500problem 496sequence diagram 498Service Activator Aggregator class dia-
gram 510Service Activator Aggregator sequence
diagram pt. 1 511
Service Activator Aggregator sequence diagram pt. 2 512
Service Activator Aggregator sequence diagram pt. 3 512
Service Activator Aggregator strategy 509
solution 496strategies 500
Service Activator Aggregator strategy 509service facades
business logic 358definition 360diagram 360POJO Facade 357session beans 360Session Facade 357
Service Locator 55, 458consequences 329EJB Service Locator class diagram 320EJB Service Locator sequence diagram
321EJB Service Locator strategy 319EJB Service Locator Using Handles se-
quence diagram 322JDBC DataSource Service Locator strat-
egy 322JDBC Service Locator sequence dia-
gram 323JMS Queue Service Locator class dia-
gram 325JMS Queue Service Locator sequence
diagram 326JMS Queue Service Locator strategy
324JMS Service Locator strategy 323JMS Topic Service Locator class dia-
gram 327JMS Topic Service Locator sequence di-
agram 328JMS Topic Service Locator strategy 327overview 133problem 315related patterns 340sample code 330sequence diagram 318Service Locator class diagram 317solution 316strategies 319
CJP2IOM.fm Page 644 Friday, May 16, 2003 6:00 PM
Index 645
Index
structure 316Web Service Locator strategy 329
service lookupsembedding in client 55
Service to Worker 276Command class diagram 277consequences 281forces 276Front Controller and 277Helper class diagram 278overview 133participants and responsibilities 278problem 276related patterns 287sample code 281sequence diagram 279solution 276strategies 280structure 277
serviceslocating 55
servlet controller 90Servlet Front strategy 170, 179Servlet View strategy 248, 249ServletContext
event listeners 228servlets
context events 228Servlet UML stereotype 129
Session Bean Transfer Object Assembler strategy 437
Session beans 46session beans
creating from coarse-grained business services 96
definition 127design considerations 46eliminating entity bean proxies 96encapsulating workflow in 100mapping each use case to 54merging 96service facades 360stateful versus stateless 46workflow and 46
Session Facade 304, 420, 433class diagram 343consequences 345, 366forces 342, 357
overview 133participants and responsibilities 343,
361problem 341related pattern 373related patterns 355sample code 347, 367separating from Value List Handler 448sequence diagram 344solution 342, 358Stateful Session Facade strategy 345Stateless Session Facade strategy 345strategies 345structure 343, 360use case design note 342
session statecookies and hidden fields 20maintaining on the server for large ap-
plications 22on server, decisions regarding 22presentation tier, maintaining on 21saving 20server, maintaining on 21
see also
sessionsSessionEJB UML stereotype 129sessions
client session state 20design considerations 20wrapping entities with 92
setter methodsexposing bean attributes with 55
sharing data structures 34Singleton
definition 127UML stereotype 129
solutionsdefinition 130
Standard Filter strategy 147Standard Tag View Management strategy
267state
conversational, reconstructing for each invocation 60
HttpSession 48session beans and design considerations
46StateManager and Identity Map 523storing on business tier 48
CJP2IOM.fm Page 645 Friday, May 16, 2003 6:00 PM
646 Index
Index
state management 49stateful session beans 48
overview 46scalability problems 47
see also
session beansStateful Session Facade strategy 345stateless session beans
overuse 47overview 46reconstructing conversational state 60scalability 60
see also
session beansStateless Session Facade strategy 345StateManager
custom persistence strategy 541Identity Map 523
stereotypesdefinition 128UML 129
Store Optimization strategy 397, 409storing state 48strategies
Application Controller Using Command Handler strategy 591, 592
Application Service 363Application Service GoF 365Application Service Layer 365Base Filter strategy 158Base Front strategy 179Business Delegate as Helper strategy
255Cached RowSet strategy 475Command and Controller strategy 174Command Handler strategy 209Command Request strategy 508Composite Entity BMP strategy 396Composite Entity Remote Facade strate-
gy 395Composite Transfer Object strategy 400Context Object Auto-Population strate-
gy 200Context Object Factory strategy 199Controller-Based View strategy 249Custom Data Access Object strategy
466Custom Filter strategy 153Custom Persistence strategy 526
Custom SOAP Message Handling strat-egy 230
Custom Tag Helper strategy 252Custom Tag View Management strategy
269Custom XML Messaging strategy 560Data Access Object Factory strategies
471Database Response strategy 513definition 130Delegate Adaptor strategy 307Delegate Proxy strategy 307Dirty Marker strategy 397Early-Binding Resource strategy 270EJB Service Locator strategy 319Email Response strategy 513Entity Inherits Transfer Object strategy
422Filter Controller strategy 179Intercepting Filter Custom SOAP Filter
strategy 162Intercepting Filter Web Service Mes-
sage-Handling 161Java Binder strategy 560JavaBean Helper strategy 251JavaBean View Management strategy
265JAX-RPC Message Handling strategy
235JAX-RPC strategy 568JDBC DataSource Service Locator strat-
egy 322JDO strategy 543JMS Queue Service Locator strategy
324JMS Response strategy 513JMS Service Locator strategy 323JMS Topic Service Locator strategy 327JSP Front strategy 172JSTL Configuration strategy 196Late-Binding Resource strategy 271Lazy Loading strategy 396MDB Service Activator strategy 507Message Handling strategy 229Multiple Transfer Objects strategy 420Navigation and Flow Control strategy
223patterns, compared to 119
CJP2IOM.fm Page 646 Friday, May 16, 2003 6:00 PM
Index 647
Index
Physical Resource Mapping strategy 175
POJO Business Object 381POJO Handler strategy 448POJO Service Activator strategy 500POJO Transfer Object Assembler strate-
gy 437Read Only RowSet strategy 476Request Context Map strategy 184Request Context POJO strategy 185request context strategies 184Request Context Validation strategy 192response strategies 513RowSet Wrapper List strategy 482Security Context strategy 197Service Activator Aggregator strategy
509Servlet Front strategy 170Session Bean Transfer Object Assem-
bler strategy 437Standard Filter strategy 147Standard Tag View Management strate-
gy 267StatefulSession Facade 345Stateless Session Facade 345Store Optimization strategy 397Template Filter strategy 158Template-Based View strategy 248Transfer Object Collection strategy 473Transform Handler strategy 221Transformer View Management strate-
gy 270Updatable Transfer Object strategy 418View Handler strategy 213Web Service Locator strategy 329
structuredefinition 130
Struts 69, 81Application Controller 215nested command and view management
215style sheets
view transforms
views
style sheets 247Sun Java Center xxiii, 11Sun Professional Services 12
synchronizer token and duplicate form sub-missions 27
synchronizer tokensclient requests refactoring 67generating, storing, and checking 68
synchronizingdata, POJOs and entity beans 385
synopsis of patterns 121
T
target audience of book xxvTemplate Filter strategy 158Template-Based View strategy 248templates
pattern template description 129text in a JSP view, defined 127
terminology of patterns 124tiers
pattern categorization 120
see also
business tier, presentation tier, integration tier
token 70token generation 69token value 70tokens
generating, storing, and checking 68synchronizer token and client requests
67topics
clients and JMS components 323queue or 501
transaction attributes 93transaction management 450transactions
demarcating 98enterprise beans, using for long-lived 60POJOs and entity beans 384synchronous processing 60transaction isolation levels 56transaction semantics 56
Transfer Objectclass diagram 416consequences 424cursor that’s created once 484designing Data Access Object 492Entity Inherits Transfer Object class di-
agram 423
CJP2IOM.fm Page 647 Friday, May 16, 2003 6:00 PM
648 Index
Index
Entity Inherits Transfer Object sequence diagram 423
Entity Inherits Transfer Object strategy 422
forces 415Multiple Transfer Objects class diagram
421Multiple Transfer Objects sequence dia-
gram 422Multiple Transfer Objects strategy 420overview 134participants and responsibilities 417problem 415related patterns 432sample code 425sequence diagram 417solution 415strategies 418structure 416Updatable Transfer Object class dia-
gram 418Updatable Transfer Object sequence di-
agram 420Updatable Transfer Object strategy 418
Transfer Object Assemblerclass diagram 435consequences 438forces 433, 434overview 134participants and responsibilities 435POJO Transfer Object Assembler strate-
gy 437problem 433related patterns 443sample code 439sequence diagram 436Session Bean Transfer Object Assem-
bler strategy 437strategies 437Value List Handler
POJO Handler strategy
448Transfer Object Collection strategy 473transfer objects
business object, wrapping 390composite transfer object 412definition 127
Transform Handler strategy 221Transformer View Management strategy 270
Transformer View Management View strate-gy 270
transformsstyle sheets 247XSLT 246
translation-time content inclusion 270transparent persistence or EJB persistence
517trees
storing entity bean-dependent object graph 57
U
UMLdiagram types 128stereotypes 129
see also
sequence diagrams, class dia-grams
Updatable Transfer Object strategy 418use cases
mapping each to session bean 54session facades and 342
user sessiondefinition 20token matching 68
V
validationbusiness objects 381design consideration 28duplicate 381form-centric 28
Value List Handler 134, 444, 445class diagram 446consequences 450Data Access Object, what to get from
449forces 444overview 133participants and collaborations 446problem 444related patterns 458sample code 451separating Session Facade from 448sequence diagram 447solution 445strategies 448structure 445
CJP2IOM.fm Page 648 Friday, May 16, 2003 6:00 PM
Index 649
Index
Value Object 415Value Object Assembler 433, 434View Handler strategy 213View Helper 205
Business Delegate as Helper strategy 255
class diagram 244consequences 260Controller-Based View strategy 249Custom Tag Helper strategy 252forces 241Helper, non-remote sequence diagram
257Helper, remote sequence diagram 259JavaBean Helper strategy 251overview 133participants and responsibilities 244problem 240related patterns 261solution 241strategies 248structure 243Style Sheets class diagram 247Template-Based View strategy 248Using Translets class diagram 247
View management 267, 270view management and Struts 215view processing 243view transforms 245views
centralizing controller logic 64client access, guarding a view 23client access, guarding by configuration
25definition 128dynamic resource subviews 271hiding JSP resources from clients 88nested command and view management
215processing and helper classes 79removing conversions from 84Struts 215view creation 243view preparation 243view processing 243view processing design note 167View UML stereotype 129
see also
clients
W
Web Service Brokerclass diagram 558consequences 579Custom Messaging sequence diagram
561Custom XML Messaging strategy 560forces 557Java Binder class diagram 561Java Binder PO example class diagram
563Java Binder schema class diagram 564Java Binder strategy 560JAX-RPC class diagram 569JAX-RPC strategy 568participants and responsibilities 558problem 557related patterns 579sequence diagram 560solution 558strategies 560structure 558
Web Service Locator strategy 329web site
Core J2EE Patterns xxviiJava Blueprints xxvii
Web WorkerApplication Controller Using Command
Handler strategy 591, 592Candidate Interactions sequence dia-
gram 612class diagram 591, 594collaboration 588consequences 620Create Candidate workflow 594forces 587Hire Employee workflow 583, 584interaction 586, 588interaction with adapters 590Interview Candidate workflow 596micro-architecture 581participants and responsibilities 594problem 584Review Candidate workflow 596sequence diagram 595solution 587structure 591
CJP2IOM.fm Page 649 Friday, May 16, 2003 6:00 PM
650 Index
Index
workflowautomated 581Bake-a-Cake example 582Create Candidate steps 594definition 581encapsulating in session bean 100Interview Candidate steps 596manual 581multiple entity beans 51Review Candidate steps 596session bean design considerations and
46Web Worker Hire Employee class dia-
gram 591, 594, 595, 612Web Worker Hire Employee interaction
586, 588Web Worker Hire Employee interaction
with adapters 590Web Worker Hire Employee workflow
583, 584wrapping
Business Object wrapping a Transfer Object 389
business object wraps transfer object 390
request and response objects in filters 151
RowSet instance to expose results 482
X
XMLWeb Service Broker Purchase Order
schema 564XSLT and view transforms 246
XSLTadvantages 246issues 246transformations 87transformer 270view transforms 245, 246
CJP2IOM.fm Page 650 Friday, May 16, 2003 6:00 PM