Java Open Source Programming: with XDoclet, JUnit, WebWork, Hibernate

Free Download

Authors:

ISBN: 9780471463627, 0-471-46362-0

Size: 6 MB (6131724 bytes)

Pages: 482/482

File format:

Language:

Publishing Year:

Category:

Joseph Walnes, Ara Abrahamian, Mike Cannon-Brookes, Patrick A. Lightbody9780471463627, 0-471-46362-0

Written by leading authorities in the field, this book shows you how to leverage a suite of best-of-breed Open Source development tools to take the pain out of J2EE and build a complete Web-based application. You’ll combine these tools to actually reduce the points of failure in your application, while increasing overall system stability and robustness. Along with the tools introduced here, you’ll develop the PetSoar application, which follows the PetStore application used by Sun Microsystems to demonstrate features of J2EE. With PetSoar, the authors focus on developing a maintainable and flexible application, rather than showcasing the end result, so that you can apply the material in your own projects.In addition, the authors provide methods for utilizing Open Source software components for each stage of the development process.The Open Source products covered include: * Hibernate to aid with simple,flexible, and speedy transparent object persistence * OpenSymphony WebWork to allow for pluggable view technologies and extensible configuration * JUnit and Mock Objects to assist with rapid and robust unit testing * XDoclet to assist with generating code and configuration files automatically * Jakarta Lucene to add Google-style smart search capabilities to data stores * OpenSymphony SiteMesh to aid in the creation of large sites with a common look and feel * OpenSymphony OSCache to easily cache slow dynamic sections of Web sites resulting in faster-loading pages

Table of contents :
Cover……Page 1
Contents……Page 6
Introduction……Page 20
Part 1. Introduction……Page 24
Using Open Source Technologies……Page 26
Less Is More……Page 28
Exploring the PetSoar Project……Page 29
Summary……Page 30
Looking at Yet Another Pet Store?……Page 32
Understanding the Requirements of PetSoar……Page 34
Looking at the Architecture……Page 35
Using Persistence and Searching……Page 37
Using the Web Front End……Page 38
Summary……Page 39
Part 2. Building Your Open Source Toolbox……Page 40
Types of Testing……Page 42
Using JUnit……Page 43
Writing a Unit Test……Page 44
Running a Unit Test……Page 46
Running Multiple Tests……Page 48
Everything You Need to Know about JUnit……Page 51
Summary……Page 61
Exploring Some Pitfalls of Testing State……Page 62
Exploring the Alternative: Testing Interactions……Page 64
Using Mock Objects……Page 65
Example Scenario……Page 66
Understanding the Role of a Mock Object……Page 67
Understanding the Mock Objects Library……Page 68
Using Dynamic Mocks……Page 69
Summary……Page 74
Understanding the Complexities of Persistence……Page 76
Persisting Objects with Hibernate 2……Page 77
Creating the Persistent Classes……Page 78
Mapping the Classes to a Database……Page 80
Configuring Hibernate……Page 83
Obtaining a Session……Page 86
Storing Objects in the Database……Page 87
Retrieving Objects from the Database……Page 90
Querying Persistent Objects……Page 91
Persisting Relationships Between Objects……Page 93
Persisting Hierarchies of Objects……Page 99
Hibernate vs. EJB……Page 102
Summary……Page 104
Understanding Model View Controller (MVC)……Page 106
Examining the Model Layer……Page 107
Tying It All Together……Page 108
Looking at Reasons to Use MVC……Page 109
Exploring XWork……Page 110
Exploring WebWork……Page 111
Taking an In- depth Look at Actions……Page 112
A Simple XWork Example……Page 113
Structuring Your Actions (Action Composition)……Page 114
Calling an Action from XWork……Page 116
Using Parameters and the ActionContext……Page 117
Applying Newton’s Third Law of Physics……Page 118
and the Servlet Environment……Page 119
Configuring WebWork……Page 121
Understanding the Role of the Dispatcher……Page 122
Exploring Example Views in JSP and Velocity……Page 124
Looking at Component- Based Web Development……Page 127
Expressing Yourself……Page 132
Using Basic Expressions……Page 133
Using Advanced Expressions……Page 134
Understanding the ValueStack……Page 136
Digging into a Date Example……Page 138
Specifying New Conversion Rules……Page 140
Looking at Configuration and Interceptor Stacks……Page 141
Using LoggingInterceptor……Page 142
XWork Validation Framework……Page 143
Exploring an Example with XWork Validation Framework……Page 145
Using Built- In and Custom Validators……Page 146
Summary……Page 148
Identifying Problems with Layout……Page 150
Using the Object- Oriented Solution……Page 155
Decorator Design Pattern……Page 156
Composite Design Pattern……Page 157
Combining the Patterns……Page 158
Implementing the Solution with SiteMesh……Page 160
SiteMesh Fundamentals……Page 161
Creating a Decorator……Page 163
Composing Pages……Page 165
Exploring SiteMesh……Page 168
Using Tips and Tricks……Page 172
CSS Is Your Friend……Page 173
Summary……Page 174
Understanding the Complexities of Searching……Page 176
Understanding the Elements of Lucene……Page 177
Indexing a Document……Page 178
Searching Documents……Page 182
Using Advanced Searching……Page 184
Customizing the Tokenization Process……Page 185
Summary……Page 187
Introducing XDoclet……Page 188
Programming with XDoclet……Page 189
Understanding the Syntax of Attributes……Page 191
Running XDoclet……Page 193
Using Advanced Hibernate OR Mapping with XDoclet……Page 196
Sophisticated Artifacts……Page 198
Understanding XDoclet Tasks and Subtasks……Page 202
Using XDoclet Effectively……Page 204
Summary……Page 206
Exploring PetSoar Development……Page 208
Communicating in Every Way……Page 211
Using Source Communication……Page 212
Using Communication as a Learning Tool……Page 213
Knowledge Management — Wiki……Page 214
Real- time Discussion — IRC and Instant Messaging……Page 215
Using Continuous Integration……Page 216
Summary……Page 218
Understanding Utility Components……Page 220
Introducing SampleNews. com……Page 221
Using the Loop Test……Page 222
Exploring the OSCache Tag Library……Page 224
Understanding OSCache Concepts……Page 225
Looking at a Caching Time Example……Page 226
Looking at Advanced OSCache Features……Page 227
Understanding Commons Lang……Page 228
Using Builder Classes……Page 229
Understanding Commons Collections……Page 232
Looking at Advantages of Commons Logging……Page 234
Looking at a Simple Example……Page 235
Looking at a Digester Example……Page 236
Understanding Digester Rules……Page 239
Summary……Page 240
Part 3. Developing the Application……Page 242
Setting Up the Development Environment……Page 244
Working from Within the IDE……Page 245
The Problem: IDEs Don’t Automate……Page 246
The Solution: Automated Build Tools……Page 247
Using the Hybrid Approach……Page 248
Structuring by Type……Page 250
Structuring by Deployment……Page 252
And What about PetSoar?……Page 253
Managing Unit Tests……Page 254
Understanding Test Types……Page 255
Examining Test Suites, JUnit, and Batch Testing……Page 256
Using Version Control……Page 257
Deploying PetSoar……Page 258
Summary……Page 260
Understanding Test Driven Development……Page 262
Testing First vs. Testing Last……Page 263
Narrowing the Requirements……Page 265
Understanding Testing Techniques……Page 266
Isolate the Untestable Using Mock Objects……Page 267
Stick with Simplicity……Page 268
Use Lots of Small Objects……Page 269
Testing the TDD Cycle……Page 270
Example Scenario Using TDD……Page 272
Example Scenario Revisited……Page 274
Enhancing the Functionality……Page 275
Summary……Page 277
Understanding Components and Services……Page 278
Using Direct Instantiation……Page 279
Using a Registry……Page 280
Using a Container……Page 281
Understanding the Component Lifecycle……Page 282
Examining the Benefits……Page 283
Exploring the Disadvantages……Page 284
Using Containers to Define Scope……Page 285
Configuring the Container……Page 286
Understanding How the Container Works……Page 287
Testing XWork Components……Page 289
Summary……Page 291
Considering the Advantages of a Domain Model……Page 292
Comparing a Layer- Driven vs. Feature- Driven Approach……Page 293
Choosing Bottom Up, Top Down, or Middle Out……Page 295
Adding a Pet to the Store……Page 298
Implementing the PersistenceManager Using Hibernate……Page 302
Where We Are……Page 311
Retrieving Pets……Page 312
Retrieving a Single Pet……Page 315
Where We Are……Page 318
Persisting the Categories……Page 320
Where We Are……Page 323
Implementing the Category- Pet Relation……Page 324
Performance and Maintainability Considerations……Page 329
Summary……Page 331
Creating a Web- Based Interface……Page 332
Creating the AddPet Action……Page 333
Creating Views for AddPet……Page 336
Tying It All Together……Page 338
Creating the ViewPet Action……Page 340
Refactoring the Actions……Page 344
Editing a Pet……Page 347
Checking Validity……Page 350
Tying It All Together — Take II……Page 351
Get that Pet Out of Here!……Page 352
Refactoring the CRUD……Page 356
Removing Duplication in ViewPet and RemovePet……Page 357
Odd One Out……Page 359
Performing One Last Refactor……Page 361
Decoupling the Validation……Page 363
Changing the Pet……Page 366
Summary……Page 368
Componentizing Form Widgets……Page 370
Forming a Better Look and Feel……Page 374
Using a Touch of Style……Page 378
Navigating to a Better User Interface……Page 381
Summary……Page 384
Defining the Application Requirements……Page 386
Browsing the List of Categories……Page 387
Browsing the List of Pets……Page 389
Searching the Store for Pets……Page 392
Implementing LuceneSearcher……Page 395
Implementing LuceneIndexer……Page 399
Implementing Searching of Any Type of Data……Page 409
Implementing Full- Text Searches……Page 418
Implementing Pagination……Page 420
Tying It All Together……Page 424
Summary……Page 426
Creating a Shopping Cart……Page 428
Creating the WebWork Actions……Page 431
Checking Out the Shopping Cart……Page 434
Summary……Page 446
Securing the Application……Page 448
Understanding J2EE Security……Page 449
Simplifying Security……Page 451
Using the HTTP Request Wrapper……Page 452
Using the Login Filter……Page 453
Making It All Work in Harmony……Page 455
Using a More Graceful Approach……Page 457
Summary……Page 459
Index……Page 460

Reviews

There are no reviews yet.

Be the first to review “Java Open Source Programming: with XDoclet, JUnit, WebWork, Hibernate”
Shopping Cart
Scroll to Top