SKIP THE SHIPPING
Use code NOSHIP during checkout to save 40% on eligible eBooks, now through January 5. Shop now.
Register your product to gain access to bonus material or receive a coupon.
79033-7
Start building enterprise applications with JavaBeans right now!
CD-ROM includes all you need to get started: Sun's JDK and BDK 1.1, a trial version of DB2, and a full version of VisualAge for Java™.
JavaBeans portends a revolution in enterprise software development. It allows IT organizations to build small, reusable, platform-independent components that substantially enhance the value of existing computing and database resources.
JavaBeans by Example is the first practical, complete guide to JavaBeans enterprise development. It introduces JavaBeans and shows how they package functionality into reusable components that can be spread throughout the organization. It shows how to create a JavaBeans reuse plan and philosophy that works; how to leverage JavaBeans visual programming; and how to use JavaBeans to effectively access and enhance legacy data.
The heart of the book is the step-by-step construction of a sophisticated real-world enterprise application with JavaBeans, using IBM's powerful VisualAge development tools, DB2 database, Sun's JDK and BDK 1.1-all included on CD-ROM. This book is for every programmer, developer, and architect working with Java in the enterprise.
1. How to Use This Book.
Introduction. The Chili Pepper Story. The Structure of the Book.
Definition—What is a Bean? Characteristics. Where and How Beans Can Be Used. Using Beans to “Liven Up” a Web Page. Using Beans to Provide a Web Page with the Ability to Communicate. Using Beans to Implement an Application. Using Beans to Implement a Distributed Web-Based Application. Building a Simple Bean.
Events. Event Object. Event Listeners. Event Listener Interfaces. Listener Registration. Event Listener Example. Event Sources. Multicast Delivery. Unicast Delivery. Complete Events Example—Pizza Delivery. Testing the Application. Extending the Example with Graphical Output. Conclusion. Properties. Indexed Properties. Bound Properties. Constrained Properties. Read Only and Private Properties. Conclusion. Introspection. BeanInfo Class. A BeanInfo Class for a Bean. BeanInfo Example. Introspector. Coding Guidelines. Properties. Events. Methods. Introspection example—Descriptor. Running the Descriptor Application. Conclusion. Customization. Property Editors and the Property Sheet. Default Property Editors. Simple Property Editors. Graphical Property Editors. Property Editor Managers. Customizers. Conclusion. Serialization. Object Streams. ObjectOutputStream. ObjectInputStream. Serialization Using the Serializable Interface. Controlling Serialization. Serialization Using the Externalizable Interface. Version Control. Conclusion.
Mapping the Story to Classes. Mapping the Classes to Beans, Defining the Interfaces. Building and Connecting the Beans. Adding the GUI.
Internationalization. Defining Locales. Resource Bundles. Combining Locales and Resource Bundles. Conclusion. Distribution/Remote Method Invocation. RMI. RMI Bootstrap Registry. Remote Interface. Remote Object. Stubs and Skeletons. Local Objects. Testing the Distributed Application. Distributed Applet. A Short Description of CORBA. Persistency. JDBC. Mapping Beans to Relational Database Tables. Loading JDBC Drivers. Connecting to Databases. Executing SQL Statements. JDBC Drivers. Applets. JSQL. Standard API for Object Databases. Serialization. Conclusion. Printing. Printing Framework. Printing Example. Conclusion.
Packaging Beans, Applets and Applications. JAR Files. The JAR Command. Manifest Files. Signature Files. Conclusion. Security and Beans. Signed Applets. The Signed Pepper Applet. The Identity Database, Identities and Signers. The Certificate File. Step by Step to a Signed Applet. Steps to Do at the Client. Conclusion. Visual Development Environments. Java Workshop. Jbuilder. VisualAge for Java. Visual Cafe Pro. Visual J++. Conclusion.
The Simplest HelloPepper Bean. Events or Notification Units. Overview of the Two Events Samples. The Pizza Events Sample Named PizzaExText. The Pizza Events Sample Named PizzaExGUI. Properties. Overview of the Four Properties Samples. The Pepper Bean Sample Named Default. The Pepper Bean Sample Named Simple. The Pepper Bean Sample Named GUI. The Pepper Bean Sample Named Custom. Serialization Styles. Overview of the Four Serialization Samples. The SimplePepper Bean Sample Named Serial. The SimplePepper Bean Sample Named SerialControl. The SimplePepper Bean Sample Named External. The SimplePepper Bean Sample Named Version. Persistency. The Persistency Sample Named DrvLister. The Persistency Sample Named DbLocal with a Local JDBC Driver. The Persistency Sample Named DbNet with a JDBC Net Driver. The Persistency Sample Named DbODBC with a JDBC-to-OBDC Bridge. The Persistency Sample Named Applet. Introspection. Remote Method Invocation. Signed Applets.
Java, in a relatively short period of time, has emerged as the de facto standard for creating applications for the Internet, and, consequently, for enterprise intranets. “Write once, run anywhere” has become a reality with Java. Java Virtual Machines (JVMs) are available for nearly every computing platform, including all IBM operating systems (from OS/2 Warp to OS/390), Microsoft Windows, Apple Macintosh, UNIX, and even new devices such as the IBM Network Station and telephony devices. Java is ideally suited to the Internet (and intranets), with compact code size, robust security features, windowing toolkits, database access capabilities, multimedia features, and more. For the enterprise, in-house Java applications can be more easily and quickly distributed, even to customers outside the enterprise who might need selective access to information. Furthermore, because Java is platform neutral, both in-house and public versions of Java applications reach the widest possible audience, now and in the future.
While Java itself is a highly object-oriented language, until recently there was no standard technology to help programmers build Java components which interact with one another in common ways. Consequently, “beans” were born. JavaBeans can be created, reused, modified and assembled into feature-rich applications. This book focuses on the benefits of JavaBeans and how to take advantage of them, particularly in the enterprise.
Introduction
Understand what JavaBeans are, how they are built and how they can be used and reused. Although the focus is on JavaBeans, special attention is paid to the enterprise environment. For anyone trying to build applications for the enterprise environment, topics such as distributed objects and accessing legacy databases become important. JavaBeans provide an interesting solution to many of the issues which arise in the enterprise environment. They provide a means of packaging functionality into reusable units which can then be spread throughout the enterprise. In addition, beans are designed to be able to be manipulated visually using a visual builder tool.
The Authors
This book was written by the Jalape–o Team, an international group of IBM software engineers.
The organizer and guiding spirit for the Jalape–o Team is Henri Jubin. Henri currently works for the International Technical Support Organization (ITSO) in Austin, where he covers the area of Object Oriented Technology. Henri has previously worked in various support and consulting positions within IBM France. He has dealt with topics such as Object-Oriented Technology and OS/2. Henri has lived in France and Spain.
Following, in alphabetical order, is a list of the authors and developers of the Jalape–o Team.
Jacques Dubuquoy is a member of the Object Technology University group of IBM's International Education Center in Belgium. He teaches courses in C++ and Object-Oriented Analysis and Design. Jacques previously worked as an assistant professor for the engineering faculty of the Catholic University of Louvain in Belgium. Jacques is a native of Belgium.
Robert Insley is a consultant with IBM's Information Technology Practice in Switzerland. His specialization is in Object-Oriented Technology, particularly Smalltalk and Java. Robert previously worked for Credit Suisse, an international Swiss bank, developing Smalltalk applications. Robert has lived in the United States and Switzerland. Takashi Itoh works for the IBM Advanced Software Systems Laboratory in Makuhari Chiba in Japan. Takashi has worked with diverse technologies such as AIX, RS6000, virtual reality and CASE tools. Takashi is a native of Japan.
Mario Kosmiskas is a member of IBM's Network Computing and Open Systems Center in S‹o Paolo, Brazil. He has experience in developing Java, C++ and Smalltalk applications. In addition he is responsible for the design and testing of AIX and HACMP solutions. Mario is a native of Brazil.
Abhay Parasnis works for TISL, a joint IBM and Tata company in India. Lately, Abhay has been working on Java and C++ solutions. He has also worked on Networking solutions. Abhay is a native of India.
Mats Pettersson is a consultant with IBM Global Services in Stockholm, Sweden. Recently, Mats has been involved with developing Java and C++ applications. Previously, he worked on MQSeries solutions. Mats is an absolute chili pepper fanatic. He is a native of Sweden.
Contributors
The Jalape–o Team would like to thank the following people for their help and contributions:
Bob Matta, IBM ITSO Rochester
Joaquin Picon, IBM France
Noel Javier Sales, IBM The Netherlands
Acknowledgment
The Jalape–o Team would like to thank all our friends, spouses, girlfriends, children and colleagues for all their support and patience over the last several months. In addition, special thanks to the team at the ITSO in Austin, Texas, for making us feel so at home during our stay in Austin.
The following people provided invaluable advice, answers, text and support: Helene Armitage, Ron Martin, John Cook, Tod Wiese, and Sheila Richardson.
We would like to thank Marcus Brewer, the editor at ITSO-Austin Center, for his many contributions to this book, as well as Steve Gardner for his logistic coverage. Henri Jubin would like to thank the whole team and in particular their families for their silent and patient support.