ISBN-10:
0201616173
ISBN-13:
9780201616170
Pub. Date:
05/04/2001
Publisher:
Pearson Education
Enterprise Java Programming with IBM WebSphere / Edition 1

Enterprise Java Programming with IBM WebSphere / Edition 1

Paperback

Current price is , Original price is $44.95. You
Select a Purchase Option (Older Edition)
  • purchase options

Product Details

ISBN-13: 9780201616170
Publisher: Pearson Education
Publication date: 05/04/2001
Edition description: Older Edition
Pages: 544
Product dimensions: 7.34(w) x 9.22(h) x 1.00(d)

About the Author

Kyle Brown is a senior member of technical staff at Knowledge Systems Corporation (KSC). Over the last seven years he has been teaching object-oriented principles and Smalltalk through KSC's Smalltalk Apprentice Program (STAP).

Dr. Gary Craig is the founder and President of Superlative Software Solutions, Inc.

Greg Hester is the Chief Technology Officer of Cross Logic Corporation

Jaime Niswonger is a Principal Consultant at Cross Logic Corporation.

David Pitt is a Principal Consultant at Cross Logic Corporation.

Russell Stinehour is the CEO of Cross Logic Corporation.

Read an Excerpt

PREFACE:

How We Got Here

In the mid 1990s, a book on server-side Java would have been an oxymoron. It's funny how quickly things change. When Java first burst onto the programming language scene, Java on the client was all the rage. Oracle was pushing Network Computers (NCs) as the replacement for the PC, Netscape was running full-speed to beat Microsoft in the browser wars, and no one was talking much about putting programs on servers anymore.

How things change. Oracle is out of the NC business and is instead selling server "appliances." Netscape was purchased by AOL and is now giving away its browser source code, and Marc Andressen has unequivocally stated, "Java on the client is dead."

What happened? Why did Java on the client "die"? And if Java is dead on the client, where is it still "alive"? Understanding the answers to these questions requires examining some object-oriented (OO) development history, the history of the Web, and a little bit of Java history. In the process, we will reach an understanding of the most exciting new technologies for Java: the Java 2 Enterprise Edition (J2EE) technologies. In this way, we can discover how the J2EE programming model has incorporated the best elements from some older programming models together with some radically new ideas. In particular, we will focus on understanding how IBM's WebSphere Standard Edition and Advanced Edition make "Java on the server" a reality. You have to have a context in order to understand how to use the new J2EE technologies, and in this book, the context will be the WebSphere Application Server and the VisualAge for Java, Enterprise Edition development environment.

All of us writing thisbook share a similar background. We all came to Java after programming for several years in another OO programming language. In some cases, our first language was Smalltalk; in others, it was C++. In this respect, we're probably like a lot of you. For a good part of the last ten years, we have been involved in developing client/server applications using these languages. Although the details of the systems that we have worked on have differed, they all shared some common features. What we hope to do in this book is to introduce the new parts of J2EE, WebSphere, and VisualAge for Java by referring back to the things you already know and at the same time show you some best practices that we've learned in building client/server and enterprise systems both before the age of Java and in the new J2EE universe.

What We Want to Accomplish

We set forward to achieve several goals in the writing of this book:

  • Introduce developers to key J2EE technologies, such as Java servlets, JavaServer Pages, and Enterprise JavaBeans
  • Teach developers how to apply these J2EE technologies within the correct architectural framework
  • Demonstrate how WebSphere Application Server, Advanced Edition, implements the J2EE standard and what advantages it gives to developers as a J2EE application server
  • Demonstrate the advantages VisualAge for Java, Enterprise Edition, conveys as a platform for developing J2EE programs for deployment on WebSphere Application Server, Advanced Edition

Of these four goals, perhaps the most important one is to teach developers how to apply J2EE technologies within the correct architectural context. It has been our experience that teaching someone a new technology without also teaching how that technology should be applied is a terrible mistake. A lot of our time as consultants is spent in getting customers out of problems that have been created either by trying to make a technology do something it was not intended to do or by viewing one particular technology as a "hammer" and all problems as "nails."

Although we can convey some of this architectural context by teaching you the dos and don'ts of the technologies, most of you are like us: You learn best by doing. In order to help you really gain a "feel" for the J2EE technologies we will cover, you will want to walk with us through the example system that we are building and find out for yourselves how the pieces fit together. It is only by seeing the entire system end to end and by working through the example on your own that you will really start to understand how the different APIs interrelate and how WebSphere and VisualAge for Java implement the abstract specifications.

So, we want to welcome you on an adventure. It's been a long, hard road for us in mastering these technologies, tools, and techniques; we hope that we can make the way easier for those of you who are following us. It will still take a lot of preparation and effort for you to really learn how and why to apply these technologies and how best to take advantage of the features of WebSphere and VisualAge for Java, but we feel that the effort is worthwhile. J2EE is a terrific architecture for building scalable, manageable server-side systems, and IBM has developed a wonderful set of tools that make those technologies "real." We hope that by the time you reach the end of this book, you will understand and agree with us why we think so highly of these tools. We also hope that this book will enable you to start designing and building these kinds of large-scale, "enterprise" systems that J2EE, WebSphere, and VisualAge for Java make possible. Thanks for coming along with us on this journey, and good luck in reaching your destination.

May, 2001
Raleigh, N.C.
Asheville, N.C.
Kansas City, Mo.


Table of Contents

Figures, Tables, and Listings.
Foreword.
Preface.
1. Internet Business Environment.
Web Revenue Projections.
Marketplace Competition.
IT Management Issues.
What Is Needed.
Summary and Preview.

2. Web Based Client/Server Solutions.
Web-Based Client/Server Design Templates.
Remote Presentation.
Distributed Logic.
Remote Data Management.
Distributed Data Management.

J2EE and Server-Side Solutions.
Summary and Preview.

3. MVC and Layered Architectures.
Layering.
Layered Architecture.
Common Layering Schemes.
Layered Architecture Defined.
Other Considerations.

Summary and Preview.

4. Introduction to Servlets.
HTTP Technology Primer.
Background.
Uniform Resource Identifiers.
Requests, Responses, and Headers.
Pulling It All Together.

Servlet Concepts.
Support for Servlets.
Servlet Engines.
Servlet Life Cycle.
An Example Servlet.

Key Classes and Interfaces.
The javax.servlet Package.
The javax.servlet.http Package.

Rationale for Servlets.
Summary and Preview.

5. Developing Servlets Using VisualAge for Java.
IBM WebSphere Test Environment (WTE).
Installing the WTE.
Using the WTE Control Center.
Starting the Servlet Engine.
Testing with the Servlet Engine.
Stopping the Servlet Engine.

Building an Example Servlet in VisualAge.
Configuring the Servlet Engine.
Summary and Preview.

6. Using the IBM WebSphere Application Server - Advanced Edition.
WASAE Architecture.
Some Definitions of WebSphere Components.
Testing the Installation.
Before You Start the Admin Server.
Starting the Admin Server.
Opening the Administrator's Console.
Starting the Default Server.
Starting the Web Server.
Test Using the "Snoop" Servlet.

Creating the "EmployeeSys" Application Server.
Using XML Config.
Configuration Issues.
Application Server versus Web Application.
"Invoker" Servlet.

Summary and Preview.

7. Using IBM WebSphere Studio.
Rationale for WebSphere Studio.
Installing and Starting Studio.
Using Page Designer.
Managing a Web Site.
Importing from VisualAge.
Importing Existing Sites.
Version Control.
Working in a Team.
Summary and Preview.

8. Session State Management.
Some Client-Side Session Approaches.
Cookies.
Hidden Fields.
URL Parameters.

Servlets and Session State.
HttpSession Binding.
How the Session Is Found.

Choosing a Session Identifier.
URL Rewriting.

Third-Tier Session Storage.
WebSphere Persistent Session Storage.
Other Session Storage Options.

Configuring WebSphere 3.5 Session Support.
The Enable Section.
The Cookies Section.
The Persistence Section.
The Intervals Section.
The Tuning Section.

Summary and Preview.

9. Servlet Design Considerations.
Number of Servlets.
State Pattern.
Exception Handling.
Servlet Chaining and Filtering.
Using XML.
Summary and Preview.

10. JavaServer Pages Concepts.
Page Templates and Server-Side Scripting.
Page Compilation: Runtime View.
JSP Syntax.
Scripting Elements.
Directives.

Roles for JSP.
Summary and Preview.

11. JSP Actions, MVC, and Tools.
Programming Models.
JSP Direct Model.
JSP Indirect Model.

JSP Standard Actions.
The useBean Action.
The getProperty and the setProperty Standard Actions.
The Rest of the Standard Action Tags.

JSP Development Tools: WebSphere Page Designer.
JavaBeans, Introspection, and Contracts.
WebSphere Studio and Page Designer.

Testing JSPs.
Configuration of JSPs in the WebSphere Test Environment.
JSP Execution Monitor.

Deploying JSPs.
Support for taglib and XML.
XML Compliance.
Summary and Preview.

12. Servlet and JSP Case Study.
Executing Test Scripts.
Loading the Case Study into the WebSphere Test Environment.
User's Guide.
Initial Screen.
Create, Display, and Modify Time Sheet for an Employee.
Display Pending and Approved Time Sheets.

Case Study Analysis and Design Artifacts.
Problem Statement.
System Tasks.
Use Case List.

Use Case Definitions.
Defined Use Cases.
Time-Sheet Domain Model.
Class Listing.
Collaboration Diagram.
Mediator.
Domain.
Enumeration.
Filtering.
Container.
Time Sheets.
Time-Sheet State.
Mapping.

Package Structure.
Summary and Preview.

13. Enterprise Java Bean Architecture.
Object Distribution.
CORBA Overview.
RMI Overview.
Remaining Problems.

Object Persistence.
Objects and Transactions.
Security in Enterprise Applications.
EJB Definition.
Containers.
Session EJBs.
Entity EJBs.

Need for EJBs.
Summary and Preview.

14. Building Basic EJBs in VisualAge for Java.
The Simplest EJB.
Bean Implementation and Life Cycle.
EJB Home Interfaces.
Building EJBs in VisualAge.
Summary and Preview.

15. Testing and Debugging EJBs in VisualAge for Java.
Overview of the Testing Process.
Debugging EJBs in VisualAge for Java.
Summary and Preview.

16. Writing Simple EJB Clients.
EJB Client Steps.
Obtaining a Home Interface.
Obtaining Home References.
Using the EJB.

EJBObject and Remote Proxies.
VisualAge for Java Access Beans.
Testing EJB Code in the Scrapbook.
Using Servlets as EJB Clients.
Some Design Points about Servlet Clients.
Java Application Clients.
Testing Applications Clients in VisualAge.
Running Application Clients Outside of VisualAge.

Summary and Preview.

17. Simple Container Managed Persistence Entity Beans.
Some Entity Bean Basics.
CMP in WebSphere and VisualAge for Java.
The Parts of an Entity Bean.
Remote Interfaces.
Home Interfaces.
Key Classes.
Finder Helpers.
Bean Implementation Classes.

Summary and Preview.

18. EJB Transactions.
Transaction Defined.
Transactions and Two-Phase Commit.
EJBs and Transactions.
Starting a Transaction.
Participating in a Transaction.
Setting Transaction Attributes.
Transactions and Concurrency.
EJB Caching.
Introduction to Isolation Levels.

WebSphere-Specific Transaction Settings.
Summary and Preview.

19. Building Entity Beans in VisualAge and WebSphere.
Creating an Entity Bean in VisualAge.
Schemas, EJBs, and Table Maps.
Exporting a Schema to a Database.
Some Simple Tests.
Summary and Preview.

20. Advanced CMP Mapping.
Simple Mapping Rules.
Object-Relational Basics.
Concepts in EJB Relationship Mapping.
Associations in UML.
Associations in VisualAge for Java 3.5.
Implementing a Simple Association.
Single-Valued Association Implementation Details.
Implementing Many-Valued Relationships.
Wrapping Up Relationships.

EJB Inheritance in VisualAge.
Remote Interface Inheritance for Sessions and Entities.
Building Inherited Beans in VisualAge.
Inheritance of Home Interfaces.
Database Inheritance Strategies.
CMP Entity Support for Inheritance.

Summary and Preview.

21. Bean Managed Persistence.
Applying BMP.
A Simple BMP Bean.
WebSphere JDBC Connection Pooling.
Examining BMP Persistence.
Writing ejbCreate() Method in BMP Beans.
Writing BMP Finder Methods.
Writing BMP ejbLoad() Methods.
Writing ejbStore() Methods.

BMP versus CMP.
Summary and Preview.

22. Building Layered Architectures for EJB Systems.
Problems with an All-EJB Solution.
The Session Facade and Data Bean Solution.
Examples of the Session Facade/Data Bean Solution.
A Simple Example from the Case Study.
A More Complex Example.
An Updating Example.

Summary and Preview.

23. Deploying EJBs into WebSphere.
Exporting EJBs from VisualAge for Java.
EJB JAR File.
Creating an EJB JAR from VisualAge for Java.
VisualAge Deployed JAR File.
Client JAR File.

Best Practices for EJB Deployment.
Deploying EJBs to WebSphere.
Deploying .jar Files.
Deploying Files from Studio.
Defining EJBs.

Final Changes.
Summary and Preview.

24. A Final Look.
J2EE Application Servers.
Layering: MVC revisited.
Tools.
Parting Comments.

Appendix A: Mapping Domain Objects to Datastores.
Appendix B: Application Service Layers.
Application Services.
The AppService Class.
Startup Sequence.
Exception Handling.

Application Property and Resource Access.

Bibliography.
Index.

Preface

How We Got Here

In the mid 1990s, a book on server-side Java would have been an oxymoron. It's funny how quickly things change. When Java first burst onto the programming language scene, Java on the client was all the rage. Oracle was pushing Network Computers (NCs) as the replacement for the PC, Netscape was running full-speed to beat Microsoft in the browser wars, and no one was talking much about putting programs on servers anymore.

How things change. Oracle is out of the NC business and is instead selling server "appliances." Netscape was purchased by AOL and is now giving away its browser source code, and Marc Andressen has unequivocally stated, "Java on the client is dead."

What happened? Why did Java on the client "die"? And if Java is dead on the client, where is it still "alive"? Understanding the answers to these questions requires examining some object-oriented (OO) development history, the history of the Web, and a little bit of Java history. In the process, we will reach an understanding of the most exciting new technologies for Java: the Java 2 Enterprise Edition (J2EE) technologies. In this way, we can discover how the J2EE programming model has incorporated the best elements from some older programming models together with some radically new ideas. In particular, we will focus on understanding how IBM's WebSphere Standard Edition and Advanced Edition make "Java on the server" a reality. You have to have a context in order to understand how to use the new J2EE technologies, and in this book, the context will be the WebSphere Application Server and the VisualAge for Java, Enterprise Edition development environment.

All of us writing thisbook share a similar background. We all came to Java after programming for several years in another OO programming language. In some cases, our first language was Smalltalk; in others, it was C++. In this respect, we're probably like a lot of you. For a good part of the last ten years, we have been involved in developing client/server applications using these languages. Although the details of the systems that we have worked on have differed, they all shared some common features. What we hope to do in this book is to introduce the new parts of J2EE, WebSphere, and VisualAge for Java by referring back to the things you already know and at the same time show you some best practices that we've learned in building client/server and enterprise systems both before the age of Java and in the new J2EE universe.

What We Want to Accomplish

We set forward to achieve several goals in the writing of this book:

  • Introduce developers to key J2EE technologies, such as Java servlets, JavaServer Pages, and Enterprise JavaBeans
  • Teach developers how to apply these J2EE technologies within the correct architectural framework
  • Demonstrate how WebSphere Application Server, Advanced Edition, implements the J2EE standard and what advantages it gives to developers as a J2EE application server
  • Demonstrate the advantages VisualAge for Java, Enterprise Edition, conveys as a platform for developing J2EE programs for deployment on WebSphere Application Server, Advanced Edition

Of these four goals, perhaps the most important one is to teach developers how to apply J2EE technologies within the correct architectural context. It has been our experience that teaching someone a new technology without also teaching how that technology should be applied is a terrible mistake. A lot of our time as consultants is spent in getting customers out of problems that have been created either by trying to make a technology do something it was not intended to do or by viewing one particular technology as a "hammer" and all problems as "nails."

Although we can convey some of this architectural context by teaching you the dos and don'ts of the technologies, most of you are like us: You learn best by doing. In order to help you really gain a "feel" for the J2EE technologies we will cover, you will want to walk with us through the example system that we are building and find out for yourselves how the pieces fit together. It is only by seeing the entire system end to end and by working through the example on your own that you will really start to understand how the different APIs interrelate and how WebSphere and VisualAge for Java implement the abstract specifications.

So, we want to welcome you on an adventure. It's been a long, hard road for us in mastering these technologies, tools, and techniques; we hope that we can make the way easier for those of you who are following us. It will still take a lot of preparation and effort for you to really learn how and why to apply these technologies and how best to take advantage of the features of WebSphere and VisualAge for Java, but we feel that the effort is worthwhile. J2EE is a terrific architecture for building scalable, manageable server-side systems, and IBM has developed a wonderful set of tools that make those technologies "real." We hope that by the time you reach the end of this book, you will understand and agree with us why we think so highly of these tools. We also hope that this book will enable you to start designing and building these kinds of large-scale, "enterprise" systems that J2EE, WebSphere, and VisualAge for Java make possible. Thanks for coming along with us on this journey, and good luck in reaching your destination.

May, 2001
Raleigh, N.C.
Asheville, N.C.
Kansas City, Mo.


Customer Reviews

Most Helpful Customer Reviews

See All Customer Reviews