Advanced Programming for the Java 2 Platform
Résumé
Advanced Programming for the Java™ 2 Platform uses all the best APIs to construct an advanced business application. It will efficiently guide you through the maze of Java APIs, while providing coverage of some key elements in developing advanced applications, such as:
- Enterprise JavaBeans™ technology
- Security and permissions
- Data and transaction management
- Performance tuning
- Debugging
- Distributed computing
- Database access
- Servlets
- Project Swing
- Native methods
In this practical, hands-on guide, the authors create an auction application to provide an in-depth look at the development, testing, and deployment of an enterprise-worthy application. They explore many common situations, leaving you with the knowledge you need to design, build, debug, and deploy your own solutions with the Java platform. After reading Advanced Programming for the Java™ 2 Platform you'll be able to create advanced applications faster than ever before.
The accompanying CD contains all the source code referenced in the book, the text of the book itself in html, and a Linux version of the J2SE SDK 1.2.2 and 1.3 beta update.
Table of Contents
Preface xv
Chapter 1 Matching Project Requirements with Technology 1
- Project Requirements 2
- Interview User Base 2
- Auction House Requirements 2
- User Requirements 2
- Model the Project 2
- Activity Diagram 5
- Choosing the Software 5
- Duke's Auction Demonstration 7
- Home Page 7
- Registration Page 8
- New Auction Items Today 8
- Items Closing Today 9
- All Items 9
- Search for Items 10
- Sell Item 10
Chapter 2 Auction House Application 11
- A Multitiered Application with Enterprise Beans 12
- Thin-Client Programs and Multitiered Architecture 12
- Entity and Session Bean Differences 14
- Auction House Workings 15
- Developing and Running Applications 16
- How Multitiered Applications Work 16
- How Enterprise Beans Are Used in the Example 17
- AuctionServlet 18
- Entity Bean Classes 19
- AuctionItem Entity Bean 19
- Auction Items Table 21
- Registration Entity Bean 22
- Registration Table 22
- Session Bean Classes 22
- Bidder Session Bean 23
- Seller Session Bean 24
- Container Classes 24
- Examining a Container-Managed Bean 24
- Member Variables 24
- Create Method 25
- Entity Context Methods 25
- Load Method 26
- Store Method 26
- Connection Pooling 26
- Deployment Descriptor 26
- XML Deployment Descriptor 27
- Container-Managed Finder Methods 27
- Finder-Based Search 28
- AuctionServlet.searchItems 29
- BidderBean.getMatchingItemsList 29
- AuctionItemHome.findAllMatchingItems 30
- AuctionItemBean Deployment Descriptor 30
- AuctionItemBean 30
- BidderBean 33
Chapter 3 Data and Transaction Management 37
- Bean-Managed Persistence and the JDBC Platform 38
- Connect to Database 38
- Create Method 38
- Load Method 39
- Refresh Method 39
- Store Method 40
- Find Method 41
- Managing Transactions 41
- Why Manage Transactions? 42
- Session Synchronization 42
- Container-Managed Example 43
- Session Synchronization Code 43
- Transaction Commit Mode 45
- Bean-Managed Finder Methods 49
- AuctionServlet.searchItems 50
- SearchBean 52
- Database Connection 52
- Get Matching Items List 52
- Create Method 53
- SearchBean
Chapter 4 Distributed Computing 57
- Lookup Services 58
- Java Naming and Directory Interface 59
- CORBA Naming Service 60
- Interoperable Object References 63
- RMI Lookup Service 64
- RMI over Internet Inter-ORB Protocol 65
- Improving Lookup Performance 66
- RMI Registration Server 67
- About RMI 67
- RMI in the Auction Application 68
- Establishing Remote Communications 72
- RegistrationServer Class 74
- Registration Interface 79
- RegistrationHome Interface 79
- ReturnResults Interface 80
- SellerBean Class 80
- Common Object Request Broker Architecture 83
- IDL Mapping Scheme 83
- Quick Reference 83
- Other IDL Keywords and Types 87
- CORBA in the Auction Application 89
- Object Request Broker 92
- Helper and Holder Classes 95
- Garbage Collection 95
- CORBA Callbacks 96
- Using the Any Type 99
- In Conclusion 103
- JDBC Technology 103
- JDBC Drivers 103
- Database Connections 105
- Statements 105
- Caching Database Results 107
- Result Sets 108
- Scrolling Result Sets 108
- Controlling Transactions 114
- Escaping Characters 116
- Mapping Database Types 117
- Mapping Date Types 118
- Servlets 118
- HttpServlet 119
- The init Method 119
- The destroy Method 120
- The service Method 120
- HTTP Requests 122
- Using Cookies in Servlets 122
- HTTP Error Codes 126
- Reading GET and POST Values 127
- Threading 132
- HTTPS 132
Chapter 5 JNI Technology 135
- JNI Example 136
- About the Example 136
- Generate the Header File 137
- Method Signature 137
- Implement the native Method 138
- Compile the Dynamic or Shared Object Library 139
- Run the Example 140
- Strings and Arrays 140
- Passing Strings 140
- Passing Arrays 141
- Pinning Array 143
- Object Arrays 144
- Multidimensional Arrays 145
- Other Programming Issues 148
- Language Issues 148
- Calling Methods 149
- Accessing Fields 153
- Threads and Synchronization 154
- Memory Issues 155
- Invocation 156
- Attaching Threads 157
Chapter 6 Project Swing: Building a User Interface 159
- Components and Data Models 160
- Lightweight Components 160
- Ordering Components 161
- Specialized Event Handling 180
- Project Swing Directions 180
- Printing API 181
- What Is in the Package? 181
- Printing an AWT Component 182
- Printing a Project Swing Component 183
- Printing Graphics in Project Swing 184
- Print Dialog 184
- Page Setup Dialog 186
- Printing a Collection of Pages 187
- Advanced Printing 188
- Multiple Components per Page 188
- Components Larger Than One Page 189
- Printing a JTable Component 191
- Print a Sales Report 192
- AuctionClient 193
- Report 202
- SalesReport 204
Chapter 7 Debugging Applets, Applications, and Servlets 209
- In a Rush? 210
- Collecting Evidence 210
- Installation and Environment 210
- Class Path 211
- Class Loading 212
- Including Debug Code 213
- Turning Debug Information on at Run Time 213
- Creating Debug and Production Releases at Run Time 214
- Using Diagnostic Methods 214
- Adding Debug Information 215
- Running Tests and Analyzing 216
- Getting Behind the Seat with jdb 216
- Simple jdb Test Drive 216
- Remote Debugging 222
- Using Auto-Pilot 224
- Creating a Session Log 225
- Servlet Debugging 226
- Running servletrunner in Debug Mode 226
- Running Java Web Server in Debug Mode 227
- Abstract Window Toolkit Debugging 229
- Using AWTEventListener 230
- Analyzing Stack Traces 231
- Sending a Signal to the Java VM 231
- The Java VM Generates a Stack Trace 232
- Core Files 232
- Using Debugging Tools or API Calls 232
- Which Release Generated the Stack Trace? 232
- Which Platform Generated the Stack Trace? 233
- Which Thread Package Was Used? 233
- What Are the Thread States? 233
- Examining Monitors 234
- Putting the Steps into Practice 237
- Expert's Checklist 240
- Stack Trace Examples 240
- Version Issues 244
- JDK 1.0.2 Deployment 244
- JDK 1.1 Deployment 244
- Java 2 Platform Deployment 245
- Netscape Deployment 245
- Internet Explorer Deployment 246
Chapter 8 Performance Techniques 247
- Improving Applet Download Speed 247
- Packaging Images into One Class 248
- Using JAR Files 249
- Thread Pooling 250
- Connection Pooling 252
- Wrapper Classes 253
- Deadlocks and Hangs 258
- Closing Connections 259
- Example Application 259
- Performance Features and Tools 263
- Java Virtual Machine Features 263
- Just-In-Time Compilers 267
- Third-Party Tools 269
- Performance Analysis 269
- Profiling 269
- Analyze a Program 270
- Operating System Performance Tools 275
- Caching Client/Server Applications 277
- Caching One Object 277
- Caching Many Objects 279
- Pool 282
- Worker 285
- HttpServerWorker 285
- HttpServer 286
Chapter 9 Deploying the Auction Application 289
- JAR File Format 290
- Bundle and Deploy the HTML Files 290
- Bundle and Deploy the Enterprise Beans 291
- Bundle and Deploy the Applet Program 294
- Deploy to Solaris Operating System 295
- Get Downloads 295
- Extract Downloaded Files 296
- Install Java Plug-In 296
- Install Java Plug-In Patches 296
- Install Netscape Communicator 297
- Check the Installation 297
- Install the HTML Converter 298
- Security Policy File 298
- Run the Administration Applet 299
- Deploy to Win32 Platform 300
- Get Downloads 300
- Install JRE with Java Plug-In 301
- Install the HTML Converter 301
- Security Policy File 301
- Run the Administration Applet 302
- How Does It Work? 303
Chapter 10 Signed Applets and Security Managers 305
- Signed Applets 305
- Signed Applet Example 306
- SignedAppletDemo 306
- Policy File 307
- HTML file 307
- How It Works 307
- Intranet Developer 308
- End User 309
- Running an Application with a Policy File 311
- Signed Applets in JDK 1.1 311
- Writing a Security Manager 311
- The FileIO Program 311
- The PasswordSecurityManager Class 314
- Reference Information 317
Appendix A: Security and Permissions 319
Overview 320Knowing Which Permissions 321
AllPermission 321
AWTPermission 322
FilePermission 323
NetPermission 324
PropertyPermission 324
ReflectPermission 325
RuntimePermission 325
SecurityPermission 328
SerializablePermission 332
SocketPermission 332
Appendix B: Classes, Methods, and Permissions 335
java.awt.Graphics2D 337java.awt.Toolkit 337
java.awt.Window 337
java.beans.Beans 338
java.beans.Introspector 338
java.beans.PropertyEditorManager 338
java.io.File 338
java.io.FileInputStream 339
java.io.FileOutputStream 339
java.io.ObjectInputStream 339
java.io.ObjectOutputStream 339
java.io.RandomAccessFile 339
java.lang.Class 340
java.lang.ClassLoader 341
java.lang.Runtime 341
java.lang.SecurityManager 342
java.lang.System 342
java.lang.Thread 342
java.lang.ThreadGroup 344
java.lang.reflect.AccessibleObject 344
java.net.Authenticator 344
java.net.DatagramSocket 345
java.net.HttpURLConnection 345
java.net.InetAddress 346
java.net.MulticastSocket 346
java.net.ServerSocket 346
java.net.Socket 347
java.net.URL 347
java.net.URLConnection 347
java.net.URLClassLoader 347
java.rmi.activation.ActivationGroup 347
java.rmi.server.RMISocketFactory 348
java.security.Identity 348
java.security.IdentityScope 348
java.security.Permission 348
java.security.Policy 348
java.security.Provider 348
java.security.SecureClassLoader 349
java.security.Security 349
java.security.Signer 349
java.util.Locale 349
java.util.zip.ZipFile 349
Appendix C: Security Manager Methods 351
Appendix D: API Reference 355
ActionListener Interface 355WindowListener Interface 355
Graphics Class 356
Graphics2D class 356
Book Class 356
PageFormat Class 356
Printable Interface 356
PrinterJob Class 357
Toolkit Class 357
ByteArrayOutputStream Class 357
DataOutputStream Class 357
Double Class 357
SecurityManager Class 357
System Class 358
Naming Class 358
RMISocketFactory Class 358
CallableStatement Interface 358
Connection Interface 358
DatabaseMetaData Interface 359
DriverManager Class 359
PreparedStatement Interface 359
ResultSet Interface 359
Statement Interface 360
ArrayList Class 360
Calendar Class 360
Date Class 360
Enumeration Interface 361
HashMap Class 361
Iterator Interface 361
LinkedList Class 361
List Class 361
EntityBean Interface 361
SessionBean Interface 362
UserTransaction Interface 362
RemoteObject Class 362
Cookie Class 362
HttpServlet Class 362
HttpServletRequest Interface 363
HttpServletResponse Interface 363
ServletConfig Interface 363
ServletRequest Interface 363
ServletResponse Interface 363
Box Class 363
DefaultCellEditor Class 364
JButton Class 364
JComponent Class 364
JFrame Class 364
JLabel Class 364
JScrollPane Class 364
JTable Class 364
JTree Class 365
JViewPort Class 365
ListSelectionModel Interface 365
SwingUtilities Class 365
DefaultTableCellRenderer Class 365
DefaultTableModel Class 366
TableColumn Class 366
TableColumnModel Interface 366
DefaultMutableTreeNode Class 366
TreePath Class 366
Any Class 366
IntHolder Class 366
ORB Class 367
NameComponent Class 367
NamingContext Interface 367
JNI C methods 367
Index 369
L'auteur - Calvin Austin
Calvin Austin is a staff engineer at Sun Microsystems, Inc. and is co-founder of the Java Developer Connection.s" He is a recognized expert in debugging applications and other advanced techniques.
Caractéristiques techniques
PAPIER | |
Éditeur(s) | Addison Wesley |
Auteur(s) | Calvin Austin, Monica Pawlan |
Parution | 15/09/2000 |
Nb. de pages | 378 |
Format | 18,5 x 23 |
Couverture | Broché |
Poids | 625g |
Intérieur | Noir et Blanc |
EAN13 | 9780201715019 |
Avantages Eyrolles.com
Consultez aussi
- Les meilleures ventes en Graphisme & Photo
- Les meilleures ventes en Informatique
- Les meilleures ventes en Construction
- Les meilleures ventes en Entreprise & Droit
- Les meilleures ventes en Sciences
- Les meilleures ventes en Littérature
- Les meilleures ventes en Arts & Loisirs
- Les meilleures ventes en Vie pratique
- Les meilleures ventes en Voyage et Tourisme
- Les meilleures ventes en BD et Jeunesse