Showing posts with label J2EE. Show all posts
Showing posts with label J2EE. Show all posts

Friday, August 26, 2011

The J2EE 1.4 Tutorial






About This Tutorial

Eric Armstrong
Stephanie Bodoff
Debbie Carson
Ian Evans
Maydene Fisher
Dale Green
Kim Haase
Eric Jendrock
Monica Pawlan
Beth Stearns
May 30, 2003

Who Should Use This Tutorial

How to Read This Tutorial

About the Examples

How to Print This Tutorial

Typographical Conventions
Chapter 1: Overview

Web Services Support

Extensible Markup Language

HTTP-SOAP Transport Protocol

WSDL Standard Format

UDDI and ebXML Standard Formats

Distributed Multitiered Applications

J2EE Components

J2EE Clients

Web Components

Business Components

Enterprise Information System Tier

J2EE Containers

Container Services

Container Types

Packaging

Development Roles

J2EE Product Provider

Tool Provider

Application Component Provider

Application Assembler

Application Deployer and Administrator

J2EE APIs

Enterprise JavaBeans Technology

JDBC API

Java Servlet Technology

JavaServer Pages Technology

Java Message Service

Java Naming and Directory Interface

Java Transaction API

JavaMail API

JavaBeans Activation Framework

Java API for XML Processing

Java API for XML Registries

Java API for XML-Based RPC

SOAP with Attachments API for Java (SAAJ)

J2EE Connector Architecture

Java Authentication and Authorization Service

Simplified Systems Integration
Chapter 2: Understanding XML

Introduction to XML

What Is XML?

Why Is XML Imortant?

How Can You Use XML?

XML and Related Specs: Digesting the Alphabet Soup

Basic Standards

Schema Standards

Linking and Presentation Standards

Knowledge Standards

Standards That Build on XML

Summary

Generating XML Data

Writing a Simple XML File

Defining the Root Element

Writing Processing Instructions

Introducing an Eror

Substituting and Inserting Text

Creating a Document Type Definition (DTD)

Documents and Data

Defining Attributes and Entities in the DTD

Referencing Binary Entities

Defining Parameter Entities and Conditional Sections

Resolving A Naming Conflict

Using Namespaces

Designing an XML Data Structure

Saving Yourself Some Work

Attributes and Elements

Normalizing Data

Normalizing DTDs

Summary
Chapter 3: Getting Started with Web Applications

Web Application Life Cycle

J2EE 1.4 Application Server

Components

Setting Up To Build and Deploy Tutorial Examples

Starting and Stopping the J2EE Application Server

Starting the deploytool Utility

Web Modules

Creating a Web Module

Configuring Web Modules

Mapping URLs to Web Components

Declaring Welcome Files

Setting Initialization Parameters
Specifying Eror Mappings

Declaring References to Environment Entries, Resource Environment Entries, or Resources

Deploying Web Modules

Listing Deployed Web Modules

Running Web Applications

Updating Web Modules

Undeploying Web Modules

Duke's Bookstore Examples

Accessing Databases from Web Applications

Starting the PointBase Database Server

Populating the Example Database

Defining a Data Source in the J2EE Server

Configuring the Web Application to Reference a Data Source with JNDI

Mapping the Web Application JNDI Name to a Data Source

Further Information
Chapter 4: Java API for XML Processing

The JAXP APIs

An Overview of the Packages

The Simple API for XML (SAX) APIs

The SAX Packages

The Document Object Model (DOM) APIs

The DOM Packages

The XML Stylesheet Language for Transformation (XSLT) APIs

The XSLT Packages

Compiling and Running the Programs

Where Do You Go from Here?
Chapter 5: Simple API for XML

When to Use SAX

Echoing an XML File with the SAX Parser

Creating the Skeleton

Iporting Classes

Setting up for I/O

Implementing the ContentHandler Interface

Setting up the Parser

Writing the Output

Spacing the Output

Handling Content Events

Compiling and Running the Program

Checking the Output

Identifying the Events

Compressing the Output

Inspecting the Output

Documents and Data

Adding Additional Event Handlers

Identifying the Document's Location

Handling Processing Instructions

Summary

Handling Erors with the Nonvalidating Parser

Displaying Special Characters and CDATA

Handling Special Characters

Handling Text with XML-Style Syntax

Handling CDATA and Other Characters

Parsing with a DTD

DTD's Effect on the Nonvalidating Parser

Tracking Ignorable Whitespace

Cleanup

Empty Elements, Revisited

Echoing Entity References

Echoing the External Entity

Summarizing Entities

Choosing your Parser Implementation

Using the Validating Parser

Configuring the Factory

Validating with XML Schema

Experimenting with Validation Erors

Eror Handling in the Validating Parser

Parsing a Parameterized DTD

DTD Warnings

Handling Lexical Events

How the LexicalHandler Works

Working with a LexicalHandler

Using the DTDHandler and EntityResolver

The DTDHandler API

The EntityResolver API

Further Information
Chapter 6: Document Object Model

When to Use DOM

Documents vs. Data

Mixed Content Model

A Simpler Model

Increasing the Complexity

Choosing Your Model

Reading XML Data into a DOM

Creating the Program

Additional Information

Looking Ahead

Displaying a DOM Hierarchy

Echoing Tree Nodes

Convert DomEcho to a GUI App

Create Adapters to Display the DOM in a JTree

Finishing Up

Examining the Structure of a DOM

Displaying A Simple Tree

Displaying a More Complex Tree

Finishing Up

Constructing a User-Friendly JTree from a DOM

Compressing the Tree View

Acting on Tree Selections

Handling Modifications

Finishing Up

Creating and Manipulating a DOM

Obtaining a DOM from the Factory

Normalizing the DOM

Other Operations

Finishing Up

Validating with XML Schema

Overview of the Validation Process

Configuring the DocumentBuilder Factory

Validating with Multiple Namespaces

Further Information
Chapter 7: XML Stylesheet Language for Transformations

Introducing XSLT and XPath

The JAXP Transformation Packages

How XPath Works

XPATH Expressions

The XSLT/XPath Data Model

Templates and Contexts

Basic XPath Addressing

Basic XPath Expressions

Combining Index Addresses

Wildcards

Extended-Path Addressing

XPath Data Types and Operators

String-Value of an Element

XPath Functions

Summary

Writing Out a DOM as an XML File

Reading the XML

Creating a Transformer

Writing the XML

Writing Out a Subtree of the DOM

Summary

Generating XML from an Arbitrary Data Structure

Creating a Simple File

Creating a Simple Parser

Modifying the Parser to Generate SAX Events

Using the Parser as a SAXSource

Doing the Conversion

Transforming XML Data with XSLT

Defining a Simple
Document Type

Creating a Test Document

Writing an XSLT Transform

Processing the Basic Structure Elements

Writing the Basic Program

Trimming the Whitespace

Processing the Remaining Structure Elements

Process Inline (Content) Elements

Printing the HTML

What Else Can XSLT Do?

Transforming from the Command Line with Xalan

Concatenating Transformations with a Filter Chain

Writing the Program

Understanding How the Filter Chain Works

Testing the Program

Conclusion

Further Information
Chapter 8: Building Web Services With JAX-RPC

Types Supported By JAX-RPC

J2SE SDK Classes

Primitives

Arrays

Value Types

JavaBeans Components

Creating a Web Service with JAX-RPC

Building the Service

Packaging the Service

Specifying the Endpoint Address

Deploying the Service

Creating Web Service Clients with JAX-RPC

Static Stub Client Example

Dynamic Proxy Client Example

Dynamic Invocation Interface (DII) Client Example

J2EE Application Client Example

Other JAX-RPC Client Examples

Further Information
Chapter 9: SOAP with Attachments API for Java

Overview of SAAJ

Messages

Connections

Tutorial

Creating and Sending a Simple Message

Adding Content to the Header

Adding Content to the SOAP Body

Adding Content to the SOAPPart Object

Adding a Document to the SOAP Body

Manipulating Message Content Using SAAJ or DOM APIs

Adding Attachments

Adding Attributes

Using SOAP Faults

Code Examples

Request.java

MyUddiPing.java

HeaderExample.java

SOAPFaultTest.java

DOMExample.java

Conclusion

Further Information
Chapter 10: Java API for XML Registries

Overview of JAXR

What Is a Registry?

What Is JAXR?

JAXR Architecture

Implementing a JAXR Client

Establishing a Connection

Querying a Registry

Managing Registry Data

Using Taxonomies in JAXR Clients

Running the Client Examples

Before You Compile the Examples

Compiling the Examples

Running the Examples

Using JAXR Clients in J2EE Applications

Coding the Application Client: MyAppClient.java

Coding the PubQuery Session Bean

Compiling the Source Files

Starting the J2EE Application Server

Creating JAXR Resources

Creating and Packaging the Application

Deploying the Application

Saving the Client JAR and Running the Application

Undeploying and Removing the Application

Further Information
Chapter 11: Java Servlet Technology

What is a Servlet?

The Example Servlets

Troubleshooting

Servlet Life Cycle

Handling Servlet Life Cycle Events

Handling Erors

Sharing Information

Using Scope Objects

Controlling Concurrent Access to Shared Resources

Accessing Databases

Initializing a Servlet

Writing Service Methods

Getting Information from Requests

Constructing Responses

Filtering Requests and Responses

Programming Filters

Programming Customized Requests and Responses

Specifying Filter Mappings

Invoking Other Web Resources

Including Other Resources in the Response

Transfering Control to Another Web Component

Accessing the Web Context

Maintaining Client State

Accessing a Session

Associating Attributes with a Session

Session Management

Session Tracking

Finalizing a Servlet

Tracking Service Requests

Notifying Methods to Shut Down

Creating Polite Long-Running Methods

Further Information
Chapter 12: JavaServer Pages Technology

What Is a JSP Page?

Example

The Example JSP Pages

The Life Cycle of a JSP Page

Translation and Compilation

Execution

Creating Static Content

Response and Page Encoding

Creating Dynamic Content

Using Objects within JSP Pages

Expression Language

Deactivating Expression Evaluation

Using Expressions

Variables

Implicit Objects

Literals

Operators

Reserved Words

Examples

Functions

JavaBeans Components

JavaBeans Component Design Conventions

Creating and Using a JavaBeans Component

Setting JavaBeans Component Properties

Retrieving JavaBeans Component Properties

Using Custom Tags

Declaring Tag Libraries

Including the Tag Library Implementation

Reusing Content in JSP Pages

Transfering Control to Another Web Component

jsp:param Element

Including an Applet

Setting Properties for Groups of JSP Pages

Further Information
Chapter 13: JavaServer Pages Standard Tag Library

The Example JSP Pages

Using JSTL

Tag Collaboration

Core Tags

Variable Support Tags

Flow Control Tags

URL Tags

Miscellaneous Tags

XML Tags

Core Tags

Flow Control Tags

Transformation Tags

Internationalization Tags

Setting the Locale

Messaging Tags

Formatting Tags

SQL Tags

query Tag Result Interface

Functions

Further Information
Chapter 14: Custom Tags in JSP Pages

What Is a Custom Tag?

The Example JSP Pages

Types of Tags

Tags with Attributes

Tags with Bodies

Tags That Define Variables

Communication Between Tags

Encapsulating Reusable Content using Tag Files

Tag File Location

Tag File Directives

Evaluating Fragments Passed to Tag Files

Examples

Tag Library Descriptors

Declaring Tag Files

Declaring Tag Handlers

Declaring Tag Attributes for Tag Handlers

Declaring Tag Variables for Tag Handlers

Programming Simple Tag Handlers

Basic Tags

Tags with Attributes

Tags with Bodies

Tags That Define Variables

Cooperating Tags

Examples
Chapter 15: Scripting in JSP Pages

The Example JSP Pages

Using Scripting

Disabling Scripting

Declarations

Initializing and Finalizing a JSP Page

Scriptlets

Expressions

Programming Tags That Accept Scripting Elements

TLD Elements

Tag Handlers

Tags with Bodies

Cooperating Tags

Tags That Define Variables
Chapter 16: Internationalizing and Localizing Web Applications

Java Platform Localization Classes

Providing Localized Messages and Labels

Date and Number Formatting

Character Sets and Encodings

Character Sets

Character Encoding

Further Information
Chapter 17: New Features for EJB 2.1 Technology

Overview

Web Service Endpoints

Web Service Example: HelloServiceEJB

Source Code for HelloServiceEJB

Building HelloServiceEJB

Building the Web Service Client

Running the Web Service Client

Timer Service

Creating Timers

Cancelling and Saving Timers

Getting Timer Information

Transactions and Timers

The TimerSessionEJB Example

Building TimerSessionEJB
Chapter 18: Security

Overview

Users, Realms, and Groups

Security Roles

Declaring and Linking Role References

Mapping Roles to Users and Groups

Web-Tier Security

Protecting Web Resources

Authenticating Users of Web Resources

Using Programmatic Security in the Web Tier

Protecting Web Resources

Installing and Configuring SSL Support

Setting Up Digital Certificates

EJB-Tier Security

Declaring Method Permissions

Using Programmatic Security in the EJB Tier

Unauthenticated User Name

Application Client-Tier Security

EIS-Tier Security

Container-Managed Sign-On

Component-Managed Sign-On

Configuring Resource Adapter Security

Propagating Security Identity

Configuring a Component's Propagated Security Identity

Configuring Client Authentication

Using Java Authorization Contract for Containers
Chapter 19: J2EE Connector Architecture

About Resource Adapters

Resource Adapter Contracts

Connector 1.5 Resource Adapters

Common Client Interface
Chapter 20: The Java Message Service API

Overview

What Is Messaging?

What Is the JMS API?

When Can You Use the JMS API?

How Does the JMS API Work with the J2EE Platform?

Basic JMS API Concepts

JMS API Architecture

Messaging Domains

Message Consumption

The JMS API Programming Model

Administered Objects

Connections

Sessions

Message Producers

Message Consumers

Messages

Exception Handling

Writing Simple JMS Client Applications

Setting Your Environment for Running Applications

A Simple Example of Synchronous Message Receives

A Simple Example of Asynchronous Message Consumption

Running JMS Client Programs on Multiple Systems

Creating Robust JMS Applications

Using Basic Reliability Mechanisms

Using Advanced Reliability Mechanisms

Using the JMS API in a J2EE Application

Using Session and Entity Beans to Produce and to Synchronously Receive Messages

Using Message-Driven Beans

Managing Distributed Transactions

Using the JMS API with Application Clients and Web Components

Specifying Deployment Descriptors

Further Information
Chapter 21: J2EE Examples Using the JMS API

A Simple J2EE Application that Uses the JMS API

Writing the Application Components

Creating and Packaging the Application

Deploying the Application

Saving the Client JAR and Running the Application

Undeploying and Removing the Application

A J2EE Application that Uses the JMS API with a Session Bean

Writing the Application Components

Creating and Packaging the Application

Deploying the Application

Saving the Client JAR and Running the Application

Undeploying and Removing the Application

A J2EE Application that Uses the JMS API with an Entity Bean

Overview of the Human Resources Application

Writing the Application Components

Creating and Packaging the Application

Deploying the Application

Saving the Client JAR and Running the Application

Undeploying and Removing the Application

An Application Example that Consumes Messages from a Remote J2EE Server

Overview of the Applications

Writing the Application Components

Creating and Packaging the Applications

Deploying the Applications

Saving the Client JAR and Running the Application Client

Undeploying and Removing the Applications

An Application Example that Deploys a Message-Driven Bean on Two J2EE Servers

Overview of the Applications

Writing the Application Components

Creating and Packaging the Applications

Deploying the Applications

Saving the Client JAR and Running the Application Client

Undeploying and Removing the Applications
Appendix A: Java Encoding Schemes

Further Information
Appendix B: HTTP Overview

HTTP Requests

HTTP Responses
Glossary
About the Authors
Index

Another J2EE Books
Download

Saturday, February 26, 2011

The Java EE 5 Tutorial Third Edition






By Eric Jendrock, Jennifer Ball, Debbie Carson, Ian Evans, Scott Fordin, Kim Haase
...............................................
Publisher: Addison Wesley Professional
Pub Date: November 03, 2006
Print ISBN-10: 0-321-49029-0
Print ISBN-13: 978-0-321-49029-2
Pages: 1360

The Java EE 5 Tutorial is an introduction to programming server-side Java applications. This book takes a task-oriented, example-driven approach to show you how to build applications for the Java EE 5 platform. This book also describes the features and functionalities available with NetBeans 5.5.

What's new in this edition? The author team have updated the existing chapters to reflect the changes to JSP, EJB, Servlets, and more. Also, the authors have added new chapters on the Sun Java System Application Server 9 as a deployment environment for server-side technologies. The web-tier technology chapters cover the components used in developing the presentation layer of a Java EE 5 or stand-alone web application. The web services technology chapters cover the APIs used in developing standard web services. The Enterprise JavaBeans (EJB) technology chapters cover the components used in developing the business logic of a Java EE 5 application. The Persistence technology chapters cover the Java Persistence API, which is used for accessing databases from Java EE applications. The platform services chapters cover the system services used by all the Java EE 5 component technologies

Table of Contents
Copyright
About This Tutorial
Chapter 1. Overview
Java EE Application Model
Distributed Multitiered Applications
Java EE Containers
Web Services Support
Java EE Application Assembly and Deployment
Packaging Applications
Development Roles
Java EE 5 APIs
Sun Java System Application Server Platform Edition 9
Part One: The Web Tier
Chapter 2. Getting Started with Web Applications
Web Application Life Cycle
Web Modules
Configuring Web Applications
Duke's Bookstore Examples
Accessing Databases from Web Applications
Further Information
Chapter 3. Java Servlet Technology
What Is a Servlet?
The Example Servlets
Servlet Life Cycle
Sharing Information
Initializing a Servlet
Writing Service Methods
Filtering Requests and Responses
Invoking Other Web Resources
Accessing the Web Context
Maintaining Client State
Finalizing a Servlet
Further Information
Chapter 4. JavaServer Pages Technology
What Is a JSP Page?
The Example JSP Pages
The Life Cycle of a JSP Page
Creating Static Content
Creating Dynamic Content
Unified Expression Language
JavaBeans Components
Using Custom Tags
Reusing Content in JSP Pages
Transferring Control to Another Web Component
Including an Applet
Setting Properties for Groups of JSP Pages
Further Information
Chapter 5. JavaServer Pages Documents
The Example JSP Document
Creating a JSP Document
Identifying the JSP Document to the Container
Chapter 6. JavaServer Pages Standard Tag Library
The Example JSP Pages
Using JSTL
Core Tag Library
XML Tag Library
Internationalization Tag Library
SQL Tag Library
Functions
Further Information
Chapter 7. Custom Tags in JSP Pages
What Is a Custom Tag?
The Example JSP Pages
Types of Tags
Encapsulating Reusable Content Using Tag Files
Tag Library Descriptors
Programming Simple Tag Handlers
Chapter 8. Scripting in JSP Pages
The Example JSP Pages
Using Scripting
Disabling Scripting
Declarations
Scriptlets
Expressions
Programming Tags That Accept Scripting Elements
Chapter 9. JavaServer Faces Technology
JavaServer Faces Technology Benefits
What Is a JavaServer Faces Application?
A Simple JavaServer Faces Application
User Interface Component Model
Navigation Model
Backing Beans
The Life Cycle of a JavaServer Faces Page
Further Information
Chapter 10. Using JavaServer Faces Technology in JSP Pages
The Example JavaServer Faces Application
Setting Up a Page
Using the Core Tags
Adding UI Components to a Page Using the HTML Component Tags
Using Localized Data
Using the Standard Converters
Registering Listeners on Components
Using the Standard Validators
Binding Component Values and Instances to External Data Sources
Binding Converters, Listeners, and Validators to Backing Bean Properties
Referencing a Backing Bean Method
Using Custom Objects
Chapter 11. Developing with JavaServer Faces Technology
Writing Bean Properties
Performing Localization
Creating a Custom Converter
Implementing an Event Listener
Creating a Custom Validator
Writing Backing Bean Methods
Chapter 12. Creating Custom UI Components
Determining Whether You Need a Custom Component or Renderer
Understanding the Image Map Example
Steps for Creating a Custom Component
Creating Custom Component Classes
Delegating Rendering to a Renderer
Handling Events for Custom Components
Creating the Component Tag Handler
Defining the Custom Component Tag in a Tag Library Descriptor
Chapter 13. Configuring JavaServer Faces Applications
Application Configuration Resource File
Configuring Beans
Registering Custom Error Messages
Registering Custom Localized Static Text
Registering a Custom Validator
Registering a Custom Converter
Configuring Navigation Rules
Registering a Custom Renderer with a Render Kit
Registering a Custom Component
Basic Requirements of a JavaServer Faces Application
Chapter 14. Internationalizing and Localizing Web Applications
Java Platform Localization Classes
Providing Localized Messages and Labels
Date and Number Formatting
Character Sets and Encodings
Further Information
Part Two: Web Services
Chapter 15. Building Web Services with JAX-WS
Setting the Port
Creating a Simple Web Service and Client with JAX-WS
Types Supported by JAX-WS
Web Services Interoperability and JAX-WS
Further Information
Chapter 16. Binding between XML Schema and Java Classes
JAXB Architecture
Representing XML Content
Binding XML Schemas
Customizing JAXB Bindings
Examples
Basic Examples
Customizing JAXB Bindings
Java-to-Schema Examples
Further Information
Chapter 17. Streaming API for XML
Why StAX?
StAX API
Using StAX
Sun's Streaming XML Parser Implementation
Example Code
Further Information
Chapter 18. SOAP with Attachments API for Java
Overview of SAAJ
Tutorial
Code Examples
Further Information
Chapter 19. Java API for XML Registries
Overview of JAXR
Implementing a JAXR Client
Running the Client Examples
Using JAXR Clients in Java EE Applications
Further Information
Part Three: Enterprise Beans
Chapter 20. Enterprise Beans
What Is an Enterprise Bean?
What Is a Session Bean?
What Is a Message-Driven Bean?
Defining Client Access with Interfaces
The Contents of an Enterprise Bean
Naming Conventions for Enterprise Beans
The Life Cycles of Enterprise Beans
Further Information
Chapter 21. Getting Started with Enterprise Beans
Creating the Enterprise Bean
Creating the Application Client
Creating the Web Client
Deploying the Java EE Application
Running the Application Client
Running the Web Client
Modifying the Java EE Application
Chapter 22. Session Bean Examples
The cart Example
A Web Service Example: helloservice
Using the Timer Service
Handling Exceptions
Chapter 23. A Message-Driven Bean Example
Example Application Overview
The Application Client
The Message-Driven Bean Class
Packaging, Deploying, and Running the SimpleMessage Example
Creating Deployment Descriptors for Message-Driven Beans
Part Four: Persistence
Chapter 24. Introduction to the Java Persistence API
Entities
Managing Entities
Chapter 25. Persistence in the Web Tier
Accessing Databases from Web Applications
Chapter 26. Persistence in the EJB Tier
The order Application
The roster Application
Chapter 27. The Java Persistence Query Language
Terminology
Simplified Syntax
Example Queries
Full Syntax
Part Five: Services
Chapter 28. Introduction to Security in Java EE
Overview
Security Implementation Mechanisms
Securing Containers
Securing the Application Server
Working with Realms, Users, Groups, and Roles
Establishing a Secure Connection Using SSL
Further Information
Chapter 29. Securing Java EE Applications
Securing Enterprise Beans
Enterprise Bean Example Applications
Securing Application Clients
Securing EIS Applications
Example Applications in the Application Server
Further Information
Chapter 30. Securing Web Applications
Overview
Working with Security Roles
Checking Caller Identity Programmatically
Defining Security Requirements for Web Applications
Examples: Securing Web Applications
Further Information
Chapter 31. The Java Message Service API
Overview
Basic JMS API Concepts
The JMS API Programming Model
Writing Simple JMS Client Applications
Creating Robust JMS Applications
Using the JMS API in a Java EE Application
Further Information
Chapter 32. Java EE Examples Using the JMS API
A Java EE Application That Uses the JMS API with a Session Bean
A Java EE Application That Uses the JMS API with an Entity
An Application Example That Consumes Messages from a Remote Server
An Application Example That Deploys a Message-Driven Bean on Two Servers
Chapter 33. Transactions
What Is a Transaction?
Container-Managed Transactions
Bean-Managed Transactions
Transaction Timeouts
Updating Multiple Databases
Transactions in Web Components
Chapter 34. Resource Connections
Resources and JNDI Naming
DataSource Objects and Connection Pools
Resource Injection
The confirmer Example Application
Further Information
Chapter 35. Connector Architecture
About Resource Adapters
Resource Adapter Contracts
Common Client Interface
Further Information
Part Six: Case Studies
Chapter 36. The Coffee Break Application
Common Code
JAX-WS Coffee Supplier Service
SAAJ Coffee Supplier Service
Coffee Break Server
Building, Packaging, Deploying, and Running the Application
Chapter 37. The Duke's Bank Application
Enterprise Beans
Application Client
Web Client
Building, Packaging, Deploying, and Running the Application
Appendix A. Java Encoding Schemes
Further Information
Appendix B. Preparation for Java EE Certification Exams
CX-310-081: Sun Certified Web Component Developer
SL-351: Business Component Development with Enterprise JavaBeans™ Technology
About the Authors
Index

Another J2EE Books
Download

Thursday, February 24, 2011

Java™ Enterprise Best Practices






Audience

Put succinctly, this book is for anyone who is interested in picking up solid experience in the Java Enterprise APIs. Note that I use the word "solid." It's one thing to learn an API; it's another thing to learn an API so well that you know which areas to use and which areas to stay away from. That doesn't mean the material in this book will turn you into a J2EE expert overnight—obviously, learning any development environment takes many months of development experience. However, after reading some of these chapters, you should be able to get a feel for the right and wrong approaches to tackling common problems in a particular API space. After all, you're likely learning from other people's mistakes.

One imprtant point that should be made is that these chapters are not tutorials for learning the java Enterprise APIs. For that, you should consult a wide array of books from O'Reilly that cover each Java Enterprise API (see Chapter 1 for an exhaustive list). However, the authors expect that you will have at least some degree of familiarity with the Enterprise APIs in each chapter, even if you don't consider yourself ready to give presentations on J2EE programming at the next JavaOne conference. Obviously, it helps if you've done some programming with that particular API before. If you're reasonably familiar with the structure of the Java Enterprise APIs, you shouldn't feel lost when reading any of these chapters.

Organization

This book consists of 11 chapters:

Chapter 1, (Robert Eckstein, O'Reilly editor)

Contains a brief introduction as to why best practices are imprtant, and what to expect from each chapter in this book.
Chapter 2, (Sasha Nikolic, EJB author)

Contains imprtant information on how to effectively develop and deploy Enterprise JavaBeans™ (EJBs).
Chapter 3, (Jason Hunter, author of Java Servlet Programming)

Tips and tricks from one of O'Reilly's bestselling authors on how to efficiently work with servlets and frameworks.
Chapter 4, (George Reese, author of Database Programming with JDBC and Java)

Includes wisdom on configuring, storing, and retrieving information from various databases using the latest version of JDBC.
Chapter 5, (Brett McLaughlin, author of Java and XML and O'Reilly editor)

Contains practical advice on structuring XML, as well as using both the SAX and DOM APIs. Brett also covers using the new JAXP APIs in some detail.
Chapter 6, (William Grosso, author of Java RMI)

Includes a plethora of tips for making sure you don't pull your hair out working with Java's Remote Method Invocation (RMI).
Chapter 7, (J. Steven Perry, author of Java Management Extensions)

Our newest Java author, J. Steven Perry, shows you some common and arcane pitfalls to watch out for when working with the Java Management Extensions.
Chapter 8, (David Czarnecki and Andy Deitsch, authors of Java Internationalization)

Contains a thorough explanation as to why J2EE developers need to plan for internationalization from the start, as well as common design principles to ensure that your first internationalized project won't be your last.

Chapter 9, (Hans Bergsten, author of Java ServerPages)

Offers practical wisdom for using JavaServer Pages (JSPs) on your web server, as well as the new JavaServer Pages Standard Tag Library (JSTL) elements.
Chapter 10, (William Crawford, co-author of Java Enterprise in a Nutshell)

Talks about how to get the most out of the JavaMail APIs and provides tips and tricks for using attachments effectively.
Chapter 11, (Jack Shirazi, author of Java Performance Tuning)

Contains good advice on how to make sure that your J2EE applications are not painfully slow.

Another J2EE Books
Download

Thursday, February 17, 2011

EJB & JSP Java on the Edge






by Lou Marco ISBN: 0764548026
Your Guide to Cutting-Edge J2EE Programming Techniques.

Table of Contents

Part I EJB & JSP—Java On the Edge
Chapter 1 - Enterprise Computing Concepts
Chapter 2 - J2EE Component APIs
Part II JavaServer Pages
Chapter 3 - A First Look at JavaServer Pages
Chapter 4 - The Elements of a JSP Page
Chapter 5 - JSP Web Sessions
Chapter 6 - JSP and JavaBeans
Chapter 7 - JSP Tag Extensions
Chapter 8 - JSPs and Servlets Revisited
Chapter 9 - JSP Errors and Debugging
Chapter 10 - The “Make Money” Brokerage Application
Part III Enterprise JavaBeans
Chapter 11 - A First Look at EJB
Chapter 12 - The Elements of an EJB
Chapter 13 - EJB Contexts and Containers
Chapter 14 - EJB Session Beans
Chapter 15 - EJB Entity Beans
Chapter 16 - EJB Security
Chapter 17 - EJB and Transaction Management
Chapter 18 - Creating EJB Clients
Chapter 19 - The Proposed EJB 2.0 Specification
Chapter 20 - Integrating JSPs and EJBs
Appendix A - The JSP API
Appendix B - The EJB API
Appendix C - Configuring the Tomcat Web ServerAppendix D - XML Overview

Another J2EE Books
Download

Friday, February 11, 2011

J2EE Best Practices, Java Design Patterns







Acknowledgments x
About the Author xi
Introduction xii
Overview of the Book and Technology xii
How This Book Is Organized xx
Who Should Read This Book xxiii
Tools You Will Need xxiii
What’s on the Web Site xxiv
Summary xxiv
Chapter 1 Building Business Applications with J2EE 1
Elements of Transactional,
Web-Based Business Applications 2
The Reference Architecture 4
The J2EE Platform Approach 9
The Model-View-Controller Architecture Approach 16
Best Practices for Building Business Applications
with J2EE 20
Summary 21
Chapter 2 The Business Object Architecture: Design Considerations 23
Business Objects in a Banking Application 25
Elements of Business Objects 26
Design Considerations 29
Best Practices for Designing Business Objects 50
Summary 53
Chapter 3 Building Business Objects: Managing Properties
and Handling Errors 55
Managing Properties 55
Value Objects and Lightweight Business Objects 83
Object Validation and Error Handling 87
Best Practices for Implementing Business Objects: Part One 102
Summary 103
Chapter 4 Building Business Objects: Persistence, Relationships,
and the Template Method Pattern 105
Object Persistence 105
The Base Class as a Template 159
Overall Business Object Metadata Approach 168
Data Caching 174
Best Practices for Implementing Business Objects: Part Two 185
Summary 188
Chapter 5 The Service-Based Architecture: Design Considerations 189
Elements of Service-Based Components 193
Design Considerations 196
Best Practices for Designing Service-Based Components 207
Summary 208
Chapter 6 Building Service-Based Components 209
The Actual Service Interface 209
An Implementation for Argument Lists 210
The Session Bean as a Component Wrapper to the Service 215
Responsibilities of the Service Component 221
Update Service Examples 225
Updating Multiple Business Objects 233
The New Customer Service 234
Data Retrieval Services 240
Building Generic, Reusable Services 251
Implementing the Controller Pattern in Services 253
Best Practices for Implementing Service-Based
Components 255
Summary 257
Chapter 7 The User Interaction Architecture: Design
Considerations and an Overview of Jakarta Struts 259
Elements of the User Interaction Architecture 261
Design Considerations 265
An Overview of Jakarta Struts 284
Best Practices for Designing the User
Interaction Architecture 298
Summary 300
Chapter 8 Building the User Interaction Architecture 301
The Change Address Page 301
The Change Address JSP 307
The View Accounts Page 332
The New Customer Wizard 342
A Template for the Action Class 362
Web Services 369
Best Practices for Implementing the
User Interaction Architecture 371
Summary 372
Chapter 9 Strengthening the Bank Application: Adding Security
and Advanced Functionality 375
Application Security 375
Interesting Aspects of the Bank Application 392
Best Practices for Advanced Web Application Development 417
Summary 418
Chapter 10 Performance 421
Overall Performance Approach 421
Performance in J2EE Applications 430
Best Practices for J2EE Performance Engineering 440
Summary 442
Chapter 11 Moving toward Reuse in the Reference Architecture 443
Common Roadblocks and Corresponding Best Practices 444
Reuse in the Reference Architecture 452
The Strategic View of the Architecture 454
Best Practices for Moving toward Reuse 456
Summary 457
Bibliography 459
Index 461

Another J2EE Books
Another Software Engineering Books
Download

Thursday, February 10, 2011

Teach Yourself J2EE in 21 Days







Contents at a Glance
Introduction 1
WEEK 1 Introducing J2EE and EJBs 7
Day 1 The Challenge of N-Tier Development 9
2 The J2EE Platform and Roles 27
3 Naming and Directory Services 81
4 Introduction to EJBs 125
5 Session EJBs 165
6 Entity EJBs 211
7 CMP and EJB QL 271
WEEK 2 Developing J2EE Applications 333
Day 8 Transactions and Persistence 335
9 Java Message Service 395
10 Message-Driven Beans 429
11 JavaMail 461
12 Servlets 501
13 JavaServer Pages 555
14 JSP Tag Libraries 603
WEEK 3 Integrating J2EE into the Enterprise 651
Day 15 Security 653
16 Integrating XML with J2EE 701
17 Transforming XML Documents 741
18 Patterns 787
19 Integrating with External Resources 827
20 Using RPC-Style Web Services with J2EE 869
21 Web Service Registries and Message-Style Web Services 923
Appendixes
Appendix A An Introduction to UML 965
B SQL Reference 977
C An Overview of XML 987
D The Java Community Process 999
Glossary 1003
Index 1025

Another J2EE Books
Another Java Books
Download

Tuesday, February 1, 2011

Server Component Patterns







Preface xi
Foreword by Frank Buschmann xxi
Foreword by Clemens Szyperski xxv
Foundations 1
What is a component? 1
Patterns and pattern languages 5
Principles for component architectures 12
Components: a silver bullet? 24
Part I A Server Component Patterns Language 27
Language map 28
Sequences through the language 29
A conversation 31
1 Core Infrastructure Elements 37
Component 38
Container 43
Service Component 48
Entity Component 52
Session Component 56
Summary 59
2 Component Implementation Building Blocks 63
Component Interface 64
Component Implementation 70
Implementation Restrictions 75
Lifecycle Callback 79
Annotations 83
Summary 87
3 Container Implementation Basics 91
Virtual Instance 92
Instance Pooling 95
Passivation 100
Component Proxy 104
Glue-Code Layer 108
Summary 111
4 A Component and its Environment 115
Component Context 117
Naming 121
Component-Local Naming Context 125
Managed Resource 128
Pluggable Resources 133
Configuration Parameters 136
Required Interfaces 139
Summary 141
5 Identifying and Managing Instances 147
Component Home 148
Primary Key 153
Handle 157
Summary 160
6 Remote Access to Components 167
Component Bus 169
Invocation Context 174
Client-Side Proxy 178
Client Library 182
Client Reference Cooperation 185
Summary 188
7 More Container Implementation 191
System Errors 192
Component Introspection 196
Implementation Plug-In 199
Summary 202
8 Component Deployment 203
Component Installation 204
Component Package 208
Assembly Package 211
Application Server 214
Summary 217
Part II The Patterns Illustrated with EJB 219
9 EJB Core Infrastructure Elements 221
Component 222
Container 223
Managing resources 224
Persistence 224
Security 225
Transactions 225
Other features 226
Service Component 227
Message-Driven Beans 229
Entity Component 231
What is an Entity Bean? 231
The technical perspective 232
Session Component 239
10 EJB Component Implementation Building Blocks 243
Component Interface 244
Component Implementation 254
Implementation Restrictions 258
Lifecycle Callback 262
Annotations 282
11 EJB Container Implementation Basics 289
Virtual Instance 290
Instance Pooling 291
Passivation 297
Component Proxy 301
Glue-Code Layer 304
12 A Bean and its Environment 307
Component Context 308
Naming 315
Component-Local Naming Context 319
Managed Resource 321
Pluggable Resources 328
Configuration Parameters 332
Required Interfaces 333
13 Identifying and Managing Bean Instances 337
Component Home 338
Primary Key 348
Handle 353
14 Remote Access to Beans 357
Component Bus 358
Invocation Context 365
Client-Side Proxy 367
Client Library 369
Client Reference Cooperation 371
15 More EJB Container Implementation 373
System Errors 374
Component Introspection 380
Implementation Plug-In 382
16 Bean Deployment 385
Component Installation 386
Component Packaging 388
Assembly Package 390
Application Server 392
Part III A Story 393
Literature and Online Resources 443
Glossary 453
Index 458

Another J2EE Books
Another Web Programming Books
Download

Saturday, January 29, 2011

Special Edition Using Enterprise JavaBean 2.0







By Chuck Cavaness, Brian Keeton

Publisher : Que
Pub Date : September 19, 2001
ISBN : 0-7897-2567-3
Pages : 648
Slots : 1



Special Edition Using Enterprise JavaBeans 2.0 starts with a description of how Enterprise JavaBeans fits into the big picture of J2EE development, then covers such topics as:

Locating EJB's using JNDI

Managing data with EJB Query Language

Building JMS applications using the new Message-driven Bean

Planning EJB applications using design patterns

Later chapters describe advanced development topics including interoperability, horizontal services and clustering. Throughout the book, the authors construct a component-based auction web site using the J2EE architecture as a practical example.


Copyright
About the Authors
Acknowledgments
Tell Us What You Think!
Introduction
This Book Is for You
How This Book Is Organized
Conventions Used in This Book

Part I: Developing Enterprise JavaBeans
Chapter 1. Introduction to Enterprise Applications
The Enterprise JavaBeans Architecture
Component-Based Distributed Computing
N-Tiered Architectures
Why Use EJB?

Chapter 2. Setting the Stage–An Example Auction Site
The Auction Example
Overview of an English Auction
Choosing the Use Cases to Implement
Defining the Object Model
What's Next?

Chapter 3. EJB Concepts
Grasping the Concepts Early
What Is an Enterprise Bean?
EJB Roles and Their Responsibilities
Local Versus Remote EJB Clients
Using RMI to Communicate with Enterprise JavaBeans
Accessing an EJB Through Its Component Interface
Locating Enterprise Beans Using the Home Interface
Deciding Whether to Use a Local or Remote Client
Creation and Removal of EJBs
Passivation and Activation
Object Pooling
Handles
The EJBMetaData Class
EJB Server and Container Implementations

Chapter 4. Java Naming and Directory Interface
Why Applications Need Naming and Directory Services
Overview of the JNDI Architecture
Selecting and Configuring a JNDI Provider
The JNDI Environment Properties
Setting the JNDI Environment Properties
The Context and InitialContext Objects
Getting the Environment for a Context Object
Using the lookup Method to Locate JNDI Resources
Locating EJB Objects
Accessing an EJB's Environment
Establishing Security Through the InitialContext
JNDI and Clustering
Troubleshooting

Chapter 5. Entity Beans
What Is an Entity Bean?
Declaring the Component Interface
Defining the Primary Key Class
Declaring the Home Interface
Implementing an Entity Bean
Inheritance and Entity Beans
Are Entity Beans Worth It?

Chapter 6. Bean-Managed Persistence
Choosing to Manage Persistence Yourself
JDBC Primer
Configuring a Data Source
Creating an Entity Bean
Loading and Storing an Entity
Accessing Other Entity Beans
Implementing Finder Methods
Deleting an Entity
Deploying an Entity Bean Using BMP
Troubleshooting

Chapter 7. Container-Managed Persistence
Building Portable Entity Beans
Declaring a CMP Entity Bean
Implementing the Container Callback Methods
Deploying an Entity Bean Using CMP
Managing Relationships
Using EJB 1.1 CMP
Troubleshooting

Chapter 8. EJB Query Language
What Is the EJB Query Language?
Defining a FROM Clause
Defining a WHERE Clause
Defining a SELECT Clause
Using the Built-In Functions
EJB QL Syntax in BNF Notation
Troubleshooting

Chapter 9. Session Beans
What Is a Session Bean?
Differences Between Stateless and Stateful Session Beans
Declaring the Component Interface
Declaring the Home Interface
Implementing a Session Bean
Deploying a Session Bean
Reentrant Issues
Troubleshooting

Chapter 10. Java Message Service
Introduction to Messaging
Components of the JMS Architecture
The Two JMS Message Models
The JMS Interfaces
The Details of a JMS Message
Message Selection and Filtering
Using the JMS Point-to-Point Model
Using the JMS Publish/Subscribe Model
Synchronous Versus Asynchronous Messaging
Message Persistence
Using Transactions with JMS
Using JMS with Enterprise JavaBeans
Troubleshooting

Chapter 11. Message-Driven Beans
What Are Message-Driven Beans?
The Message-Driven Bean and the Container
Using Message-Driven Beans with EJB
Using JMS Queues or Topics with Message-Driven Beans
Creating a Message-Driven Bean
Deploying a Message-Driven Bean
Sending Messages to a Message-Driven Bean
Acknowledging Messages from Message-Driven Beans
Using Transactions with Message-Driven Beans
Troubleshooting

Chapter 12. Transactions
Understanding Transactions
Passing the ACID Test
Programming with the Java Transaction API
Using Container-Managed Transactions
Using Bean-Managed Transactions
Using Client-Demarcated Transactions
Isolating Access to Resources
Troubleshooting

Chapter 13. Exception Handling
EJB Exception Handling
Application Exceptions
System Exceptions
Exceptions and Transactions
Packaging Exceptions
Troubleshooting

Chapter 14. Security Design and Management
The Imprtance of Application Security
Understanding Your Application's Security Requirements
Basic Security Concepts
Java Security Fundamentals
Using Security with Enterprise JavaBeans and J2EE
Sketching Out the Auction Security
Java Authentication and Authorization Service (JAAS)

Chapter 15. Deployment
Deployment Descriptors and EJB Roles
Bean Provider Responsibilities
Application Assembler Responsibilities
Deployer Responsibilities
Packaging EJBs
Troubleshooting


Part II: Design and Performance
Chapter 16. Patterns and Strategies in EJB Design
What Are Patterns?
Strategies for Enterprise JavaBeans
Designing EJB Classes and Interfaces
Managing Client Access
Implementing a Singleton in EJB
Troubleshooting

Chapter 17. Addressing Performance
The Role of Performance in Design
Minimizing Remote Calls
Optimizing Entity Bean Persistence
Building a Pick List
Managing Transactions
Troubleshooting

Chapter 18. Performance and Stress Testing Your Applications
Why Stress Test Your Applications?
Performance Testing Your Beans
Stress Testing Your Beans
Using ECperf 1.0
Troubleshooting


Part III: Building the Web Tier
Chapter 19. Building a Presentation Tier for EJB
The Different Types of Presentation Tiers
Using a Façade Pattern to Hide EJB
Using Servlets and Java Server Pages with EJB
Using JSP Tag Libraries
Using the Struts Open-Source Framework
Caching on the Web Server or in Stateful Session Beans


Part IV: Advanced Concepts
Chapter 20. Distribution and EJB Interoperability
Interoperability Overview
Portability Versus Interoperability
EJB 2.0 Interoperability Goals
The Relationship Between CORBA and Enterprise JavaBeans
Remote Invocation Interoperability
Transaction Interoperability
Naming Interoperability
Security Interoperability

Chapter 21. Horizontal Services
What Are Horizontal Services?
Horizontal Services Provided by EJB
Traditional Buy Versus Build Analysis
Auction Example Horizontal Services
Building the Auction Logging Service
Java 1.4 Logging API
Building an E-Mail Horizontal Service
Troubleshooting

Chapter 22. EJB Clustering Concepts
Too Much Isn't Always a Good Thing
What Is Clustering?
Clustering in the Web Tier
Clustering in the EJB Tier
Single VM Versus Multiple VM Architectures

Chapter 23. EJB 2.0 Programming Restrictions
The Purpose of the Restrictions
The EJB 2.0 Restrictions
Summary


Part V: Appendixes
Appendix A. The EJB 2.0 API
Interfaces
Exceptions
The javax.ejb.spi Package

Appendix B. Changes from EJB 1.1
Local Clients
Message-Driven Beans
Container-Managed Persistence Changes
EJB Query Language
Home Interface Business Methods
Security Changes
Component Interoperability


Another J2EE Books
Download

Wednesday, January 26, 2011

Pro NetBeans IDE 5.5 Enterprise Edition







Contents at a Glance
About the Author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii
About the Technical Reviewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii
Creating and Managing Projects
PART 1 ■■■
■CHAPTER 1 Integrated Development Environments . . . . . . . . . . . . . . . . . . . . . . . . . 3
■CHAPTER 2 Installing and Customizing NetBeans . . . . . . . . . . . . . . . . . . . . . . . . . . 9
■CHAPTER 3 Creating a Java Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
■CHAPTER 4 Creating a Web Application Project . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
■CHAPTER 5 Creating Visual Web Applications: JSF, Ajax,
and Data Binding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
■CHAPTER 6 Creating Java Enterprise Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
■CHAPTER 7 Creating Web Service Projects: JAX-WS, SOA, and BPEL . . . . . . 165
■CHAPTER 8 Creating UML Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
The NetBeans Coding Experience
PART 2 ■■■
■CHAPTER 9 The Source Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
■CHAPTER 10 Code Completion and Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
■CHAPTER 11 Refactoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
NetBeans and Professional
PART 3 ■■■
Software Development
■CHAPTER 12 Generating and Accessing Javadoc . . . . . . . . . . . . . . . . . . . . . . . . . . 319
■CHAPTER 13 Managing Version Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
■CHAPTER 14 Managing Compilation and Projects with Ant . . . . . . . . . . . . . . . . . 353
■CHAPTER 15 JUnit Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367
■CHAPTER 16 Using Code Coverage Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379
■CHAPTER 17 Working with NetBeans Developer Collaboration Tools . . . . . . . . 395
■CHAPTER 18 Using NetBeans Database Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413
■INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429


Another J2EE Books
Another Netbeans Books
Download

Tuesday, January 25, 2011

Java EE 5 Development with NetBeans 6







Table of Contents
Preface 1
Chapter 1: Getting Started with NetBeans 7
Introduction 7
Downloading NetBeans 9
Installing NetBeans 12
Microsoft Windows 12
Mac OS X 13
Linux and Solaris 13
Other Platforms 13
Installation Procedure 14
Starting NetBeans for the First Time 19
Configuring NetBeans for Java EE Development 20
Integrating NetBeans with a Third Party Application Server 21
Integrating NetBeans with a Third Party RDBMS 24
Adding a JDBC Driver to NetBeans 24
Connecting to a Third Party RDBMS 26
Deploying Our First Application 28
NetBeans Tips for Effective Development 33
Code Completion 33
Code Templates 37
Keyboard Shortcuts 38
Understanding NetBeans Visual Cues 42
Summary 44
Chapter 2: Developing Web Applications with Servlets
and JSPs 45
Creating Our First Web Application 45
Modifying NetBeans' Generated Code 52
Developing the Input Page 52
Developing the Output Page 61
Servlet Development 68
Adding a Servlet to Our Application 68
Securing Web Applications 77
Implementing Form Based Authentication 79
Implementing the Login Page 79
Implementing a Login Error Page 81
Configuring Our Application for Form-Based Authentication 82
JSP Fragments 90
Creating a JSP Fragment in NetBeans 91
Monitoring Web Applications with NetBeans HTTP Monitor 93
Summary 100
Chapter 3: Enhancing JSP Functionality with JSTL
and Custom Tags 101
Core JSTL Tags 102
Conditionally Displaying Part of a Page with the Tag 102
Displaying Mutually Exclusive Markup with the Tag 105
Iterating through Arrays or Collections with the Tag 109
SQL JSTL Tags 112
Retrieving Database Data with the Tag 115
Modifying Database Data with the Tag 119
Inserting Database Data 119
Updating Database Data 123
Deleting Database Data 125
Closing Remarks about JSTL 128
Custom JSP Tags 128
Summary 134
Chapter 4: Developing Web Applications using
JavaServer Faces 135
Developing Our first JSF Application 136
Creating a New JSF Project 137
Modifying Our JSP to Capture User Data 141
Creating Our Managed Bean 147
Implementing Navigation 152
Executing Our Application 156
JSF Validation 158
Displaying Tabular Data 162
Summary 171
Chapter 5: Interacting with Databases through
the Java Persistence API 173
Creating Our First JPA Entity 174
Adding Persistent Fields to Our Entity 182
Creating a Data Access Object (DAO) 183
Generating the User Interface 188
Implementing the Controller 191
Trying Out Our Application 193
Automated Generation of JPA Entities 196
Named Queries and JPQL 203
Entity Relationships 204
Generating JSF Applications from JPA Entities 210
Summary 218
Chapter 6: Visual Web JSF Development 219
Writing Our first Visual Web Application 219
Adding Additional Components to Our Application 232
Adding Additional Text Fields 232
Adding a Drop-Down List Component 235
Adding a Message Component to Each Input Field 239
Grouping Error Messages with the Message Group Component 242
Ajax Autovalidation 244
Organizing Our Page into Tabs 249
Binding a Drop-Down List to a Database Table 253
Ajax-Enabling Visual Web Applications 256
Summary 261
Chapter 7: Implementing the Business Tier
with Session Beans 263
Introduction to Session Beans 264
Creating a Session Bean in NetBeans 264
Accessing the Bean from a Client 272
Executing the Client 274
Session Bean Transaction Management 276
Implementing Aspect-Oriented Programming with Interceptors 278
Implementing the Interceptor Class 279
Decorating the EJB with the @Interceptors Annotations 281
EJB Timer Service 282
Implementing the Client 284
Generating Session Beans from JPA Entities 286
Summary 290
Chapter 8: Messaging with JMS and Message Driven Beans 291
Introduction to JMS 291
Creating the Project and JMS Resources 293
Creating a JMS Destination 294
Sending Messages to a Message Destination 298
Processing JMS Messages with Message Driven Beans 303
Summary 306
Chapter 9: Web Services 307
Introduction to Web Services 307
Creating a Simple Web Service 308
Testing Our Web Service 314
Developing a Client for Our Web Service 316
Exposing EJBs as Web Services 320
Implementing New Web Services as EJBs 321
Exposing Existing EJBs as Web Services 324
Creating a Web Service from an Existing WSDL 327
Summary 329
Chapter 10: Putting it all Together 331
Creating Our Enterprise Project 331
Implementing the Data Access Layer 334
Implementing the User Interface Layer 338
Adding User Interface Components to the Page 339
Populating the Table 344
Testing Our Application 346
Adding Missing Functionality 346
Defining Navigation Rules 361
Testing the Completed Application 362
Summary 365
Appendix A: Debugging Enterprise Applications
with the NetBeans Debugger 367
Debugging Enterprise Applications 367
Summary 374
Appendix B: Identifying Performance Issues
with NetBeans Profiler 375
Profiling Our Application 375
Summary 379
Index 381


Another J2EE Books
Another Netbeans Books
Download

Monday, January 17, 2011

VisualAge for Java Enterprise Version 2 Data Access Beans - Servlets - CICS Connector






Contents
Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii
Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi
The Team That Wrote This Redbook. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxii
Comments Welcome . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii
Part 1. VisualAge for Java Enterprise Version 2. . . . . . . . . . . . . . . . .1
Chapter 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1 VisualAge for Java Version 2 Professional. . . . . . . . . . . . . . . . . . . . . . . . 4
Support for Java Development Kit 1.1.6 . . . . . . . . . . . . . . . . . . . . . . . . . . 4
New Integrated Development Environment Features . . . . . . . . . . . . . . . 4
New Visual Composition Editor Features. . . . . . . . . . . . . . . . . . . . . . . . . 4
JavaBeans for Easy Access to Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.2 VisualAge for Java Version 2 Enterprise . . . . . . . . . . . . . . . . . . . . . . . . . 5
Java Team Programming Support. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Source Code Management Tools Integration . . . . . . . . . . . . . . . . . . . . . . 5
Open Tool Integrator APIs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Enterprise Toolkits for Workstation, AS/400, and OS/390 . . . . . . . . . . . 6
Enterprise Access Builders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Automated Object to Relational Mapping . . . . . . . . . . . . . . . . . . . . . . . . . 7
Servlet Builder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
IDL Development Environment. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Support for SanFrancisco, Tivoli, Lotus, and Component Broker . . . . . . 8
AIX Development Environment. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Chapter 2. Relational Database Access with Data Access Beans . 9
2.1 Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Data Access Beans versus Data Access Builder . . . . . . . . . . . . . . . . . . . 11
2.2 Development Process with Data Access Beans . . . . . . . . . . . . . . . . . . . 11
Loading the Data Access Bean Feature . . . . . . . . . . . . . . . . . . . . . . . . . 11
Using the Select Bean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Development Process Step by Step . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.3 Building a Sample Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Application Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Development Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Creating the Project and the Package . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Creating the Sample Panel and the Select Bean . . . . . . . . . . . . . . . . . . 21
Building the User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Improving the Select Bean. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Run the Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
2.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Chapter 3. Enterprise Application Development with Servlets . 47
3.1 Server-Side Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Common Gateway Interface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Servlets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
What Are Servlets? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Servlet Creation Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Web Server Consideration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
3.2 Inside Servlets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Simple Servlet. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Invoking a Servlet in HTML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Invoking a Servlet with Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
HttpServlet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Complex Servlets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
3.3 Servlet Builder Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
How Do Servlet Builder Beans Work?. . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Advantages of the Servlet Builder. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Visual Servlet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Servlet Builder Visual Beans. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Servlet Builder Nonvisual Beans. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Form Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Cookie Wrapper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Session Data Wrapper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Run Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Invoking Another Servlet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
3.4 Creating Visual Servlets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Simple Servlet. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Server-Side Include Servlet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Counter Servlet. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Passing Data to the Servlet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
3.5 Advanced Servlet Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Advanced HTML Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Servlet Chaining. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Keeping and Passing Data between Servlets . . . . . . . . . . . . . . . . . . . . . 81
Servlet Branch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Condition Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Disable Caching of Generated HTML . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
Servlet with JDBC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Chapter 4. CICS Access with the CICS Connector . . . . . . . . . . . . . 91
4.1 The Enterprise Access Builder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
4.2 Connectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
4.3 The CICS Connector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
CICS Connector Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
CICS Connector Classes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
4.4 CICS Universal Clients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Communcation Protocols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Client Customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Client Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
4.5 CICS Transaction Gateway. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
What the CICS Transaction Gateway Provides . . . . . . . . . . . . . . . . . . 101
How the CICS Transaction Gateway Accesses CICS . . . . . . . . . . . . . . 101
4.6 A Discussion Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
4.7 Accessing Enterprise Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
Structure Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
Records and the Java Record Framework. . . . . . . . . . . . . . . . . . . . . . . 105
Record Bean Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Commands. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Navigators. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
Business Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Mappers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Executing the Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
4.8 A Review of Accessing Enterprise Data . . . . . . . . . . . . . . . . . . . . . . . . 124
Part 2. Implementing the ATM Application . . . . . . . . . . . . . . . . . . .125
Chapter 5. ATM Application Requirements and ATM Database 127
5.1 ATM Application Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
5.2 ATM Database Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
Sample Data of ATM Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
Chapter 6. ATM Application Business Model . . . . . . . . . . . . . . . . . 137
6.1 Application Design. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
Application Layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
Application Layer Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
6.2 Business Object Layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
Business Logic Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
Testing the Business Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
6.3 Application Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
Persistence Layer Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
Controller Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
Controller and Persistence Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Implementing the Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
6.4 Persistence Layer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
Chapter 7. ATM Application Persistence Using Data Access Beans
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
7.1 Persistence Layer Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
7.2 Database Access with ATM Database Beans . . . . . . . . . . . . . . . . . . . . 165
PIN Validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
List of Accounts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
Debit and Credit Transactions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Transaction History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
7.3 Business Object Creation with ATM Database Beans . . . . . . . . . . . . 178
PIN Validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
List of Accounts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
Debit and Credit Transactions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
Transaction History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
7.4 Implementing the Persistence Interface . . . . . . . . . . . . . . . . . . . . . . . 186
AtmDB Bean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
Testing the Implementation of the Persistence Interface . . . . . . . . . . 188
7.5 Preparation for Servlet Usage. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
Chapter 8. Swing GUI for ATM Application . . . . . . . . . . . . . . . . . . 191
8.1 Design of the GUI Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
Application Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
Panel Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
8.2 Implementation of the Application Panels . . . . . . . . . . . . . . . . . . . . . . 195
Card Panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
PIN Panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
Select Account Panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
Transaction Panel. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
ATM Applet. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
8.3 Running the ATM GUI Applet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
Chapter 9. ATM Application Using Servlets . . . . . . . . . . . . . . . . . . 205
9.1 Create a Skeleton Controller Servlet . . . . . . . . . . . . . . . . . . . . . . . . . . 206
9.2 Servlet Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
Card Servlet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
PIN Servlet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
Account Servlet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
Transaction Servlet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
Thank You Servlet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
9.3 Application Flow Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
9.4 Implementing the Controller Servlet . . . . . . . . . . . . . . . . . . . . . . . . . . 223
Preparation for Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
Customer Verification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
PIN Verification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
Account Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
Deposit Transaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
Withdraw Transaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
Query Transaction History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
Termination and Restart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
Disable Caching of the Output HTML . . . . . . . . . . . . . . . . . . . . . . . . . 233
Controller Servlet Total Design. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
9.5 Testing the ATM Servlet Application . . . . . . . . . . . . . . . . . . . . . . . . . . 235
Built-in HTTP Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
Using the WebSphere Application Server. . . . . . . . . . . . . . . . . . . . . . . 235
Using the ATM Servlet Application with DB2 . . . . . . . . . . . . . . . . . . . 236
9.6 Deploying Servlets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
Chapter 10. ATM Application with the CICS Connector . . . . . . . 239
10.1 A Review of the ATM Application Design . . . . . . . . . . . . . . . . . . . . . 240
The Persistence Interface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
10.2 Task Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
Conventions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
Only a Subset of the Interface Methods . . . . . . . . . . . . . . . . . . . . . . . . 242
CICS Infrastructure Assumptions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
CICS Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
Tasks Implemented . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
10.3 CICS Infrastructure Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . 243
CICS Server Resources. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
CICS Client Configuration and Startup . . . . . . . . . . . . . . . . . . . . . . . . 244
Starting the CICS Transaction Gateway . . . . . . . . . . . . . . . . . . . . . . . 245
10.4 Initial Creation of AtmCICS Class . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
10.5 ATM Header for the COMMAREA . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
10.6 CICS Transaction to Retrieve an ATM Card . . . . . . . . . . . . . . . . . . . 246
CICS COBOL Program ATMCARDI . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
Card Record Bean. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
Card Command. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
Building a Navigator to Execute the CICS Transaction . . . . . . . . . . . 252
Implement the extGetCard Method. . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
10.7 Using Mappers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
Input Mapper for Card . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
Output Mapper for Card . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
Create a Command with Mappers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
Execute the CICS Transaction with Mappers . . . . . . . . . . . . . . . . . . . 257
Change the AtmCICS Class to Use the Mappers . . . . . . . . . . . . . . . . . 259
10.8 Test the CICS Card Transaction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
Prepare Test Output for Card Transaction. . . . . . . . . . . . . . . . . . . . . . 260
Testing Card Transaction with a Scrapbook Script . . . . . . . . . . . . . . . 261
Testing without CICS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
10.9 Discussion Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
10.10 CICS Transaction to Retrieve Accounts . . . . . . . . . . . . . . . . . . . . . . 263
CICS COBOL Program ATMACCNT . . . . . . . . . . . . . . . . . . . . . . . . . . 263
Accounts Record Bean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
Accounts Input Mapper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
Accounts Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
Navigator to Execute the CICS Accounts Transaction. . . . . . . . . . . . . 267
Implement the extGetAccounts Method . . . . . . . . . . . . . . . . . . . . . . . . 270
10.11 Testing the CICS Accounts Transaction. . . . . . . . . . . . . . . . . . . . . . 270
Prepare Test Output for Accounts Transaction . . . . . . . . . . . . . . . . . . 270
Testing the Accounts Transaction with a Scrapbook Script . . . . . . . . 271
10.12 Testing the ATM Application with CICS . . . . . . . . . . . . . . . . . . . . . 272
Testing the Real Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
10.13 Using an Advanced Navigator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
Design of a Navigator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
Implementation of the Navigator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
Testing the Navigator. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
10.14 Implementation of the Back-End Programs. . . . . . . . . . . . . . . . . . . 277
10.15 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
Chapter 11. ATM Application Using MQSeries. . . . . . . . . . . . . . . . 279
11.1 A Brief Overview of MQSeries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
Messages and Queues. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
MQSeries Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
MQSeries Clients and Servers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
11.2 MQSeries Version 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
11.3 About MQSeries and Java. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
MQSeries Client for Java . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
MQSeries Bindings for Java . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
The MQSeries Java Programming Interface . . . . . . . . . . . . . . . . . . . . 289
11.4 Implementing the ATM Application with MQSeries . . . . . . . . . . . . . 291
11.5 MQSeries Queue Manager and Objects . . . . . . . . . . . . . . . . . . . . . . . 292
Create a Queue Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
Define MQSeries Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
Command File to Start the Queue Manager. . . . . . . . . . . . . . . . . . . . . 294
11.6 Imprting MQSeries into VisualAge for Java . . . . . . . . . . . . . . . . . . 294
11.7 Create an MQAccess Bean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
Sample MQSeries Package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
MQAccess Bean. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
Implement the MQAccess Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
11.8 ATM MQSeries Design Choices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304
Conforming to the ATM Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
Unit of Work Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
11.9 ATM Request Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
AtmRequest Class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
Card Request. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
Accounts Request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
11.10 ATM Response Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
AtmResponse Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
Card Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310
Accounts Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
11.11 ATM Access Classes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312
Card Access Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312
Account Access Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
11.12 Persistence Interface with MQSeries . . . . . . . . . . . . . . . . . . . . . . . . 315
AtmMQ Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
11.13 Adding Additional Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
Create a Class for the MQSeries Request . . . . . . . . . . . . . . . . . . . . . . . 319
Create a Class for the MQSeries Response . . . . . . . . . . . . . . . . . . . . . . 320
Create a Transaction-Specific Access Class . . . . . . . . . . . . . . . . . . . . . 320
Modify the AtmMQ Class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322
Create a Back-End Application Program . . . . . . . . . . . . . . . . . . . . . . . 324
11.14 Back-End Programs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324
Java Back-End Server Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324
Testing the ATM MQSeries Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330
Testing the ATM Application with MQSeries. . . . . . . . . . . . . . . . . . . . 331
CICS COBOL Back-End Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332
Chapter 12. Deployment of the ATM Application Implementations
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
12.1 Deployment of Applications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334
Prerequisites for Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334
Exporting an Application from VisualAge for Java . . . . . . . . . . . . . . . 334
Deployment Process for Applications . . . . . . . . . . . . . . . . . . . . . . . . . . 335
12.2 Deployment of Applets. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
Exporting Applets from VisualAge for Java . . . . . . . . . . . . . . . . . . . . . 336
Deployment Process for Applets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
12.3 Deployment of Servlets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338
Deployment of Servlets for Lotus Domino Go Webserver . . . . . . . . . . 339
Target Location. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340
Class Path Setting for Web Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340
12.4 Deployment of Applications with Swing. . . . . . . . . . . . . . . . . . . . . . . 344
12.5 Tailoring the Web Browser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344
Chapter 13. High-Performance Compiler and Remote Debugger
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
13.1 High-Performance Compiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
Compiler Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
Base Java Classes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
Swing Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
Execution. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
13.2 Compiling the ATM Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
Export the ATM Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
Compile the ATM Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348
Compile the Data Access Beans. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348
Compile the DB2 JDBC Drivers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
Remove the Object Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
13.3 Run the Compiled ATM Application. . . . . . . . . . . . . . . . . . . . . . . . . . 350
13.4 Alternative Compile Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
13.5 Remote Debugger. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
Reasons for Remote Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
Running the Remote Debugger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
13.6 Remote Debugging of the ATM Application. . . . . . . . . . . . . . . . . . . . 354
13.7 Debugging a Compiled Program. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
Appendixes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .359
Appendix A. Installation, Setup, and Configuration . . . . . . . . . . 361
A.1 Setup of VisualAge for Java Enterprise Version 2 . . . . . . . . . . . . . . . 362
A.2 Setup for Data Access Beans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
A.3 Setup for the Servlet Builder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364
Web Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364
A.4 Setup for the CICS Connector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
Setup of the CICS Server and Client. . . . . . . . . . . . . . . . . . . . . . . . . . . 365
COBOL Sample Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366
A.5 Setup for MQSeries on Windows NT . . . . . . . . . . . . . . . . . . . . . . . . . . 369
Installation Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
Queue Manager and Queue Setup. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
VisualAge for Java Setup. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
MQSeries CICS Bridge Program. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
A.6 Installation of the Redbook Samples . . . . . . . . . . . . . . . . . . . . . . . . . . 373
Appendix B. Special Notices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375
Appendix C. Related Publications . . . . . . . . . . . . . . . . . . . . . . . . . . . 379
C.1 International Technical Support Organization Publications . . . . . . . 380
C.2 Redbooks on CD-ROMs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381
C.3 Other Publications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381
How to Get ITSO Redbooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383
How IBM Employees Can Get ITSO Redbooks. . . . . . . . . . . . . . . . . . . . . . 383
How Customers Can Get ITSO Redbooks . . . . . . . . . . . . . . . . . . . . . . . . . . 384
IBM Redbook Order Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385
List of Abbreviations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389
ITSO Redbook Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395

Another Java Books
Another J2EE Books
Download
Related Posts with Thumbnails

Put Your Ads Here!