did-you-know? rent-now

Amazon no longer offers textbook rentals. We do!

did-you-know? rent-now

Amazon no longer offers textbook rentals. We do!

We're the #1 textbook rental company. Let us show you why.

9780201753066

Component Development for the Java¿ Platform

by
  • ISBN13:

    9780201753066

  • ISBN10:

    0201753065

  • Edition: 1st
  • Format: Paperback
  • Copyright: 2001-12-14
  • Publisher: Addison-Wesley Professional
  • Purchase Benefits
  • Free Shipping Icon Free Shipping On Orders Over $35!
    Your order must be $35 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • eCampus.com Logo Get Rewarded for Ordering Your Textbooks! Enroll Now
List Price: $39.99

Summary

Javatrade; is an object-oriented language, but it is also a component-oriented platform. Java's class-loading model and rich type information makes it possible to build flexible and reusable binary components. COMPONENT DEVELOPMENT FOR THE JAVAtrade; PLATFORM reveals both the potential and pitfalls of developing components using the Java platform. As a platform, Java defines the services needed to connect binary components at runtime safely and reliably. To truly take advantage of all that Java has to offer, you must consider not just development but also deployment, and not just objects but also components. COMPONENT DEVELOPMENT FOR THE JAVAtrade; PLATFORM delves into the component-oriented features of the Java platform, thoroughly discussing class loading, reflection, serialization, native interoperation, and code generation.INCLUDE HOW TO: Use and troubleshoot Class Loaders Build dynamic and generic services through reflection Control an object's serialized representation Load and use native code components Extend the Java class format to add custom services Automate development with code generation This is a cutting-edge approach to Java programming: An emphasis on deployment can be the best way to take advantage of some of the most valuable, yet less heralded, aspects of Java technology. 0201753065B11212001

Author Biography

Stuart Dabbs Halloway is responsible for the Java curriculum at DevelopMentor, where he teaches the Guerrilla Java and Intensive Java courses. He writes for Sun¿s Java Developer Connection(SM) and for JavaPro magazine, and regularly speaks at industry events such as JavaOne. Stuart received his B.S. and M.P.P. degrees from Duke University.



0201753065AB06182002

Table of Contents

Foreword xii
Preface xv
From Objects to Components
1(10)
The Class Loader Architecture
11(46)
Assembling an Application
11(3)
Goals of the Class Loader Architecture
14(3)
Transparency
15(1)
Extensibility
15(1)
Capability
16(1)
Configurability
16(1)
Handling Name and Version Conflicts
16(1)
Security
17(1)
Explicit and Implicit Class Loading
17(6)
Explicit Loading with URL ClassLoader
18(1)
Implicit Class Loading
19(1)
Reference Type versus Referenced Class
20(1)
ClassLoader.loadClass versus Class.forName
21(1)
Loading Nonclass Resources
22(1)
The Class Loader Rules
23(6)
The Consistency Rule
23(1)
The Delegation Rule
24(1)
The Visibility Rule
25(2)
Delegations as Namespaces
27(1)
Static Fields Are Not Singletons
28(1)
Implicit Loading Hides Most Details
29(1)
Hot Deployment
29(6)
Using Hot Deployment
33(2)
Unloading Classes
35(1)
Making Sure Classes Are Collectable
35(1)
Bootclasspath, Extensions Path, and Classpath
36(7)
The Classpath
37(2)
The Extensions Path
39(2)
The Bootclasspath
41(2)
Debugging Class Loading
43(6)
Instrumenting an Application
44(1)
Using -verbose:class
45(1)
Instrumenting the Core API
46(3)
Inversion and the Context Class Loader
49(6)
Onward
55(1)
Resources
56(1)
Type Information and Reflection
57(48)
The Binary Class Format
58(8)
Binary Compatibility
58(5)
Binary Class Metadata
63(3)
From Binary Classes to Reflection
66(1)
Reflection
66(6)
Reflecting on Fields
68(1)
The Difference between get and getDeclared
68(2)
Type Errors Occur at Runtime
70(1)
Reflecting on Methods
71(1)
Reflective Invocation
72(11)
A Reflective Launcher
73(1)
Wrapping Primitive Types
74(2)
Bypassing Language Access Rules
76(5)
Exceptions Caused by Reflective Invocation
81(2)
Dynamic Proxies
83(9)
Delegation instead of Implementation Inheritance
83(1)
Dynamic Proxies Make Delegation Generic
84(1)
Implementing InvocationHandler
85(1)
Implementing a Forwarding Handler
86(1)
The InvocationHandler as Generic Service
87(2)
Handling Exceptions in an InvocationHandler
89(1)
Either Client or Server Can Install a Proxy
90(1)
Advantages of Dynamic Proxies
91(1)
Reflection Performance
92(2)
Package Reflection
94(4)
Setting Package Metadata
95(1)
Accessing Package Metadata
96(1)
Sealing Packages
97(1)
Weaknesses of the Versioning Mechanism
97(1)
Custom Metadata
98(5)
Onward
103(1)
Resources
103(2)
Serialization
105(48)
Serialization and Metadata
105(1)
Serialization Basics
106(5)
Serialization Skips Some Fields
109(1)
Serialization and Class Constructors
110(1)
Using readObject and writeObject
111(2)
Matching Streams with Classes
113(6)
The serialVersionUID
114(1)
Overriding the Default SUID
115(2)
Compatible and Incompatible Changes
117(2)
Explicitly Managing Serializable Fields
119(5)
ObjectlnputStream.GetField Caveats
120(1)
Writer Makes Right
121(1)
Overriding Class Metadata
122(1)
Performance Problems
123(1)
Custom Class Descriptors
124(1)
Abandoning Metadata
124(6)
Writing Custom Data after defaultWriteObject
124(1)
Externalizable
125(3)
Using writeObject to Write Raw Data Only: Bad Idea
128(2)
Object Graphs
130(3)
Pruning Graphs with Transient
131(1)
Preserving Identity
131(1)
Encouraging the Garbage Collector with reset
132(1)
Object Replacement
133(14)
Stream-Controlled Replacement
134(3)
Class-Controlled Replacement
137(2)
Ordering Rules for Replacement
139(6)
Taking Control of Graph Ordering
145(2)
Finding Class Code
147(3)
Annotation in RMI
148(2)
RMI MarshalledObjects
150(1)
Onward
150(1)
Resources
151(2)
Customizing Class Loading
153(38)
Java 2 Security
155(4)
The Role of Class Loaders
157(2)
Custom Class Loaders
159(9)
Pre-Java 2 Custom Class Loaders
159(1)
Class Loading since SDK 1.2
160(2)
A Transforming Class Loader
162(6)
Protocol Handlers
168(7)
Implementing a Handler
169(2)
Installing a Custom Handler
171(3)
Choosing between Loaders and Handlers
174(1)
Getting Past Security to the Loader You Need
175(2)
Reading Custom Metadata
177(12)
Example: Version Attributes
178(1)
Serializable Classes as Attributes
179(4)
Reading Attributes during Class Loading
183(5)
Debugging Support
188(1)
Onward
189(1)
Resources
190(1)
Interop 1: JNI
191(52)
Why Interoperate?
191(2)
The Dangers of Native Code
193(1)
Finding and Loading Native Code
194(14)
Name Mappings
195(1)
Type Mappings
195(3)
Overloaded Names
198(1)
Loading Native Libraries
199(3)
Class Loaders and JNI
202(3)
Common Errors Loading Native Libraries
205(2)
Troubleshooting Native Loading
207(1)
Calling Java from C++
208(9)
Minimizing Round Trips
211(3)
Performance Comparisons
214(1)
Differences between JNI and Reflective Invocation
214(3)
Error Handling in JNI
217(6)
Failures in Native Code
217(1)
Handling C++ Exceptions
218(1)
Handling Java Exceptions from Native Code
219(3)
Throwing Java Exceptions from Native Code
222(1)
Resource Management
223(17)
Interacting with the Garbage Collector
224(7)
Managing Native Resources
231(2)
Managing Arrays
233(6)
Managing Strings
239(1)
Onward
240(1)
Resources
241(2)
Generative Programming
243(38)
Why Generate Code?
243(7)
Object-Oriented Approaches to Modeling Variabilities
244(2)
Thinking in Terms of Bind Time
246(1)
Separating Specification from Bind Time
247(2)
Choosing a Specification Language
249(1)
Reuse Requires More Than One Use
249(1)
A Little Domain Analysis Is a Dangerous Thing
250(1)
Why Generate Code with Java?
250(3)
Type Information Acts as a Free Specification Document
250(1)
Class Loading Supports Flexible Binding Modes
251(1)
Java Source Is Easy to Generate
251(1)
Java Binary Classes Are Easy to Generate
252(1)
Code Generation Boosts Performance
252(1)
Levels of Commitment to Code Generation
252(1)
A Taxonomy of Bind Times and Modes
253(2)
Code Generation in RMI
255(2)
Code Generation in JSP
257(3)
Code Generation in EJB
260(7)
The Deployment Descriptor
263(2)
Alternate Implementations
265(2)
Generating Strongly Typed Collections
267(4)
Code Generation Language versus Target Language
270(1)
Generating Custom Serialization Code
271(5)
Onward
276(3)
Resources
279(2)
Onward
281(4)
Where We Are
281(1)
Where We Are Going
282(1)
Resources
283(2)
A Interop 2: Bridging Java and Win32/COM 285(34)
Index 319

Supplemental Materials

What is included with this book?

The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any access cards, study guides, lab manuals, CDs, etc.

The Used, Rental and eBook copies of this book are not guaranteed to include any supplemental materials. Typically, only the book itself is included. This is true even if the title states it includes any access cards, study guides, lab manuals, CDs, etc.

Excerpts

This book is about developingcomponentsusing the Java platform. In this book, the term component has a very specific meaning. A component is an independent unit of production and deployment that is combined with other components to assemble an application.To elaborate on this definition, consider the difference between objects and components. An object represents an entity in the problem domain, while a component is an atomic piece of the installed solution. The object and component perspectives are complementary, and good designs take account of both.Modern development platforms such as Java provide the infrastructure that developers need to create classes and components. To support object-oriented programming, Java provides encapsulation, inheritance, and polymorphism. To support components, Java provides loaders and rich type information. This book assumes that you already understand object-oriented programming in Java, and it explains how to use Java's component infrastructure effectively.Loaders are responsible for locating, bringing into memory, and connecting components at runtime. Using Java's loaders, you can Deploy components at fine granularity. Load components dynamically as needed. Load components from other machines on the network. Locate components from custom repositories. Create mobile code agents that live across multiple virtual machines. Import the services of non-Java components.Loaders manage the binary boundaries between components. In a world of distributed applications and multiple component suppliers, loaders locate and connect compatible components.Type information describes the capabilities of some unit of code. In some development environments type information is present only in source code. In Java, type information is not merely a source code artifact; it is also an intrinsic part of a compiled class and is available at runtime through a programmatic interface. Because Java type information is never "compiled away," loaders use it to verify linkages between classes at runtime. In application programming, you can use type information to Serialize the state of Java objects so that they can be recreated on another virtual machine. Create dynamic proxies at runtime, to provide generic services that can decorate any interface. Translate data into alternate representations to interoperate with non-Java components. Convert method calls into network messages. Convert between Java and XML, the new lingua franca of enterprise systems. Annotate components with application-specific metadata. Type information automates many tasks that might otherwise be coded by hand, and it helps to make components forward compatible to platforms of the future. Who Should Read This BookYou should read this book if you want to design, develop, or deploy substantial applications in Java. Taking a full-lifecycle view of a Java application requires that you consider not just objects, but components. This book is about the core features of Java as a component platform: class loaders, reflection, serialization, and interoperation with other platforms. You should already know the basics of Java syntax and have some experience in object-oriented programming with Java.This book is not specifically about high-level Java technologies, such as Remote Method Invocation (RMI), Enterprise JavaBeans (EJB), JINI, Java Server Pages (JSP), servlets, or JavaBeans, but understanding the topics in this book is critical to using those technologies effectively. If you learn how to use the component services described here, you will understand how these high-level technologies are built, which is the key to employing them effectively.Security is also an important aspect of component development and deployment. It is too complex a topic to handle fairly here, and it

Rewards Program