J2EE核心模式

J2EE核心模式
作 者: Deepak Alur
出版社: 科学出版社
丛编项: Java程序员书库
版权说明: 本书为公共版权或经版权方授权,请支持正版图书
标 签: Java
ISBN 出版时间 包装 开本 页数 字数
未知 暂无 暂无 未知 0 暂无

作者简介

暂缺《J2EE核心模式》作者简介

内容简介

本书主要讲述企业Java 2平台(J2EE)关键技术的模式、最佳实践、设计策略和经过验证的解决方案。涉及J2EE包括的15个模式的分类和大量的策略,便于读者更好地掌握Java技术。本书适合J2EE的爱好者、程序员、设计师、开发者和技术管理者参考。

图书目录

Foreword xv

Preface xvii

Acknowledgments xxiv

PART 1

Patterns and J2EE 2

CHAPTER 1

Introduction 4

What Is J2EE? 6

What Are Patterns? 7

Historical References 7

Defining a Pattern 7

Categorizing Patterns 9

J2EE Pattern Catalog 10

Continuous Evolution 10

How to Use the J2EE Pattern Catalog 11

Benefits of Using Patterns 12

Patterns, Frameworks, and Reuse 14

Summary 15

CHAPTER 2

J2EE Platform Overview 16

A Brief Perspective 17

Application Servers--The New Breed 19

Convergence of Java Technologies 19

The Rise of the J2EE Platform 20

J2EE Value Proposition 21

J2EE Platform 22

J2EE Architecture 22

Java 2 Standard Edition 24

J2EE Application Components and Containers 25

Standard Services 26

J2EE Platform Roles 27

Deployment Descriptors 29

J2EE Patterns and J2EE Platform 30

Summary 31

PART 2

Design Considerations, Bad Practices, and Refactorings 32

CHAPTER 3

Presentation Tier Design Considerations and Bad Practices 34

Presentation Tier Design Considerations 35

Session Management 35

Controlling Client Access 38

Validation 43

Helper Properties--Integrity and Consistency 46

Presentation Tier Bad Practices 49

Control Code in Multiple Views 49

Exposing Presentation-Tier Data Structures to Business Tier 50

Exposing Presentation-Tier Data Structures to Domain Objects 5 I

Allowing Duplicate Form Submissions 51

Exposing Sensitive Resources to Direct Client Access 52

Assuming Will Reset Bean Properties 52

Creating Fat Controllers 53

CHAPTER 4

Business Tier Design Considerations and Bad Practices 54

Business Tier Design Considerations 55

Using Session Beans 55

Using Entity Beans 59

Caching Enterprise Bean Remote References and Handles 62

Business and Integration Tiers Bad Practices 63

Mapping Object Model Directly to Entity Bean Model 63

Mapping Relational Model Directly to Entity Bean Model 63

Mapping Each Use Case to a Session Bean 64

Exposing All Enterprise Bean Attributes via Getter/Setter

Methods 65

Embedding Service Lookup in Clients 65

Using Entity Bean as Read-Only Object 66

Using Entity Beans as Fine-Grained Objects 67

Storing Entire Entity Bean-Dependent Object Graph 68

Exposing EJB-related Exceptions to Non-EJB Clients 68

Using Entity Bean Finder Methods to Return a Large Results Set 69

Client Aggregates Data from Business Components 70

Using Enterprise Beans for Long-Uved Transactions 70

Stateless Session Bean Reconstructs Conversational State for Each

Invocation 71

CHAPTER 5

J2EE Refactorings 72

Presentation Tier Refactorings 73

Introduce a Controller 74

Introduce Synchronizer Token 77

Localize Disparate Logic 83

Hide Presentation Tier-Specific Details From the Business Tier 91

Remove Conversions from View 96

Hide Resource From a Client 100

Business and Integration Tier Refactorings 104

Wrap Entities With Session 104

Introduce Business Delegate 106

Merge Session Beans 108

Eliminate Inter-Entity Bean Communication 110

Move Business Logic to Session 112

General Refactorings 113

Separate Data Access Code 113

Refactor Architecture by Tiers 116

Use A Connection Pool 119

PART 5

J2EE Pattern Catalog 122

CHAPTER 6

J2EE Patterns Overview 124

What Is a Pattern? 126

Identifying a Pattern 127

The Tiered Approach 128

J2EE Patterns 130

Presentation Tier Patterns 130

Business Tier Patterns 131

Integration Tier Patterns 132

Guide to the Catalog 132

Terminology 132

Use of UML 137

Pattern Template 138

J2EE Pattern Relationships 140

Relationship to Known Patterns 143

Patterns Roaclmap 144

Summary 149

CHAPTER 7

Presentation Tier Patterns 150

Intercepting Filter 152

Context 152

Problem 152

Forces 153

Solution 153

Consequences 170

Related Patterns 170

Front Controller 172

Context 172

Problem 172

Forces 172

Solution 173

Consequences 184

Related Patterns 185

View Helper 186

Context 186

Problem 186

Forces 186

Solution 186

Consequences 201

Related Patterns 202

Composite View 203

Context 203

Problem 203

Forces 203

Solution 203

Consequences 212

Sample Code 213

Related Patterns 215

Service to Worker 216

Context 216

Problem 216

Forces 216

Solution 217

Consequences 222

Sample Code 222

Related Patterns 230

Dispatcher View 231

Context 231

Problem 231

Forces 231

Solution 232

Consequences 238

Sample Code 239

Related Patterns 244

CHAPTER 8

Business Tier Patterns 246

Business Delegate 248

Context 248

Problem 248

Consequences 321

Sample Code 323

Related Patterns 335

Value Object Assembler 339

Context 339

Problem 339

Forces 340

Solution 341

Consequences 345

Sample Code 347

Related Patterns 351

Value List Handler 353

Context 353

Problem 353

Forces 354

Solution 354

Consequences 358

Sample Code 360

Related Patterns 366

Service Locator 367

Context 367

Problem 367

Forces 369

Solution 369

Consequences 379

Sample Code 380

Related Patterns 385

CHAPTER 9

Integration Tier Patterns 388

Data Access Object 390

Context 390

Problem 390

Forces 391

Solution 391

Consequences 397

Sample Code 399

Related Patterns 407

Service Activator 408

Context 408

Problem 408

Forces 409

Solution 409

Consequences 413

Sample Code 414

Related Patterns 420

EPILOGUE

J2EE Patterns Applied 422

PSA Overview 423

Use Case Model 424

Use Cases, Patterns, and Pattern Frameworks 426

Create Project Use Case 426

Pattern Identification 426

Pattern Realization 428

Reserve Resource Use Case 430

Pattern Identification 430

Pattern Realization 431

Find Available Resources Use Case 433

Pattern Identification 434

Pattern Realization 435

Bibliography 439

Apache Software License 443

Index 445