Developing Java Beans
Java Beans is the most important new development in Java this year. Beans is the next generation of Java technology that not only adds features the language lacked, but also lets Java programs interoperate with a number of development environments. The initial release includes a bridge for Microsoft's ActiveX/COM; future releases will include bridges for Netscape's LiveConnect and IBM's OpenDoc. Since it's a "component architecture" for Java, Beans can be used in graphical programming environments, like Borland's JBuilder, or IBM's VisualAge for Java. This means that someone can use a graphical tool to connect a lot of Beans together and make an application, without actually writing any Java code — in fact, without doing any programming at all. Graphical development environments let you configure components by specifying aspects of their visual appearance (like the color or label of a button) in addition to the interactions between components (what happens when you click on a button or select a menu item). One important aspect of Java Beans is that components don't have to be visible. This sounds like a minor distinction, but it's very important: the invisible parts of an application are the parts that do the work. So, for example, in addition to manipulating graphical widgets, like checkboxes and menus, Beans allows you to develop and manipulate components that do database access, perform computations, and so on. You can build entire applications by connecting pre-built components, without writing any code. Developing Java Beans is for people who need to stay up-to-date with the latest developments in programming technology. Minimally, developing Beans means adopting several simple design patterns in your code. However, that's only the beginning. To take full advantage of the Java Beans architecture, you should understand how to write classes that are serializable, use events for communication between classes, know when and how to provide BeanInfo classes that give graphical environments more information about your components, and provide property editors and customizers that let graphical tools work with more complex Beans. The book covers:
  • Events, event listeners, and adapters
  • Properties, indexed properties, bound properties, constrained properties, and vetoable property changes
  • Persistence, serialization, versioning, and object validation
  • Packaging Beans using JAR files
  • The BeanBox, a prototypical development tool
  • Reflection and introspection
  • Property editors and customizers
  • The ActiveX bridge; using Java Beans in Visual Basic programs
1100395954
Developing Java Beans
Java Beans is the most important new development in Java this year. Beans is the next generation of Java technology that not only adds features the language lacked, but also lets Java programs interoperate with a number of development environments. The initial release includes a bridge for Microsoft's ActiveX/COM; future releases will include bridges for Netscape's LiveConnect and IBM's OpenDoc. Since it's a "component architecture" for Java, Beans can be used in graphical programming environments, like Borland's JBuilder, or IBM's VisualAge for Java. This means that someone can use a graphical tool to connect a lot of Beans together and make an application, without actually writing any Java code — in fact, without doing any programming at all. Graphical development environments let you configure components by specifying aspects of their visual appearance (like the color or label of a button) in addition to the interactions between components (what happens when you click on a button or select a menu item). One important aspect of Java Beans is that components don't have to be visible. This sounds like a minor distinction, but it's very important: the invisible parts of an application are the parts that do the work. So, for example, in addition to manipulating graphical widgets, like checkboxes and menus, Beans allows you to develop and manipulate components that do database access, perform computations, and so on. You can build entire applications by connecting pre-built components, without writing any code. Developing Java Beans is for people who need to stay up-to-date with the latest developments in programming technology. Minimally, developing Beans means adopting several simple design patterns in your code. However, that's only the beginning. To take full advantage of the Java Beans architecture, you should understand how to write classes that are serializable, use events for communication between classes, know when and how to provide BeanInfo classes that give graphical environments more information about your components, and provide property editors and customizers that let graphical tools work with more complex Beans. The book covers:
  • Events, event listeners, and adapters
  • Properties, indexed properties, bound properties, constrained properties, and vetoable property changes
  • Persistence, serialization, versioning, and object validation
  • Packaging Beans using JAR files
  • The BeanBox, a prototypical development tool
  • Reflection and introspection
  • Property editors and customizers
  • The ActiveX bridge; using Java Beans in Visual Basic programs
29.95 In Stock
Developing Java Beans

Developing Java Beans

by Robert Englander
Developing Java Beans

Developing Java Beans

by Robert Englander

Paperback(1 ED)

$29.95 
  • SHIP THIS ITEM
    In stock. Ships in 1-2 days.
  • PICK UP IN STORE

    Your local store may have stock of this item.

Related collections and offers


Overview

Java Beans is the most important new development in Java this year. Beans is the next generation of Java technology that not only adds features the language lacked, but also lets Java programs interoperate with a number of development environments. The initial release includes a bridge for Microsoft's ActiveX/COM; future releases will include bridges for Netscape's LiveConnect and IBM's OpenDoc. Since it's a "component architecture" for Java, Beans can be used in graphical programming environments, like Borland's JBuilder, or IBM's VisualAge for Java. This means that someone can use a graphical tool to connect a lot of Beans together and make an application, without actually writing any Java code — in fact, without doing any programming at all. Graphical development environments let you configure components by specifying aspects of their visual appearance (like the color or label of a button) in addition to the interactions between components (what happens when you click on a button or select a menu item). One important aspect of Java Beans is that components don't have to be visible. This sounds like a minor distinction, but it's very important: the invisible parts of an application are the parts that do the work. So, for example, in addition to manipulating graphical widgets, like checkboxes and menus, Beans allows you to develop and manipulate components that do database access, perform computations, and so on. You can build entire applications by connecting pre-built components, without writing any code. Developing Java Beans is for people who need to stay up-to-date with the latest developments in programming technology. Minimally, developing Beans means adopting several simple design patterns in your code. However, that's only the beginning. To take full advantage of the Java Beans architecture, you should understand how to write classes that are serializable, use events for communication between classes, know when and how to provide BeanInfo classes that give graphical environments more information about your components, and provide property editors and customizers that let graphical tools work with more complex Beans. The book covers:
  • Events, event listeners, and adapters
  • Properties, indexed properties, bound properties, constrained properties, and vetoable property changes
  • Persistence, serialization, versioning, and object validation
  • Packaging Beans using JAR files
  • The BeanBox, a prototypical development tool
  • Reflection and introspection
  • Property editors and customizers
  • The ActiveX bridge; using Java Beans in Visual Basic programs

Product Details

ISBN-13: 9781565922891
Publisher: O'Reilly Media, Incorporated
Publication date: 06/08/1997
Series: Java (Addison-Wesley)
Edition description: 1 ED
Pages: 316
Product dimensions: 7.00(w) x 9.19(h) x 0.76(d)

About the Author

Robert Englander is Principal Engineer and President of MindStream Software, Inc. (www.mindstrm.com). He provides consulting services in software architecture, design, and development, as well as developing frameworks for use on client projects. His focus is in the areas of component architectures and distributed systems. Rob has built software in Java and C++ for clients ranging from small shops to large organizations. He has spoken at industry conferences, written articles for magazines and journals, and is the author of the OReilly book Developing Java Beans.

Read an Excerpt

As software developers, we are constantly being asked to build applications in less time and with less money. And, of course, these applications are expected to be better and faster than ever before. Object-oriented techniques and component software environments are in wide use now, in the hope that they can help us build applications more quickly. Development tools like Microsoft's Visual Basic have made it easier to build applications faster by taking a building-block approach to software development. Such tools provide a visual programming model that allows you to include software components rapidly in your applications.

The JavaBeans architecture brings the component development model to Java, and that's the subject of this book. But before we get started, I want to spend a little time describing the component model, and follow that with a general overview of JavaBeans. If you already have an understanding of these subjects, or you just want to get right into it, you can go directly to Chapter 2, Events. Otherwise, you'll probably find that the information in this chapter sets the stage for the rest of the book.

The Component Model

Components are self-contained elements of software that can be controlled dynamically and assembled to form applications. But that's not the end of it. These components must also interoperate according to a set of rules and guidelines. They must behave in ways that are expected. It's like a society of software citizens. The citizens (components) bring functionality, while the society (environment) brings structure and order.

JavaBeans is Java's component model. It allows users to construct applications by piecingcomponents together either programmatically or visually (or both). Support of visual programming is paramount to the component model; it's what makes component-based software development truly powerful.

The model is made up of an architecture and an API (Application Programming Interface). Together, these elements provide a structure whereby components can be combined to create an application. This environment provides services and rules, the framework that allows components to participate properly. This means that components are provided with the tools necessary to work in the environment, and they exhibit certain behaviors that identify them as such. One very important aspect of this structure is containment. A container provides a context in which components can interact. A common example would be a panel that provides layout management or mediation of interactions for visual components. Of course, containers themselves can be components.

As mentioned previously, components are expected to exhibit certain behaviors and characteristics in order to participate in the component structure and to interact with the environment, as well as with other components. In other words, there are a number of elements that, when combined, define the component model. These are described in more detail in the following sections.

Discovery and Registration

Class and interface discovery is the mechanism used to locate a component at runtime and to determine its supported interfaces so that these interfaces can be used by others. The component model must also provide a registration process for a component to make itself and its interfaces known. The component, along with its supported interfaces, can then be discovered at run-time. Dynamic (or late) binding allows components and applications to be developed independently. The dependency is limited to the "contract" between each component and the applications that use it; this contract is defined by interfaces that the component supports. An application does not have to include a component during the development process in order to use it at run-time; it only needs to know what the component is capable of doing. Dynamic discovery also allows developers to update components without having to rebuild the applications that use them.

This discovery process can also be used in a design-time environment. In this case, a development tool may be able to locate a component and make it available for use by the designer. This is important for visual programming environments, which are discussed later.

Raising and Handling of Events

An event is something of importance that happens at a specific point in time. An event can take place due to a user action such as a mouse click—when the user clicks a mouse button, an event takes place. Events can also be initiated by other means. Imagine the heating system in your house. It contains a thermostat that sets the desired comfort temperature, keeps track of the current ambient temperature, and notifies the boiler when its services are required. If the thermostat is set to keep the room at 70 degrees Fahrenheit, it will notify the boiler to start producing heat if the temperature dips below that threshold. Components will send notifications to other objects when an event takes place in which those objects have expressed an interest.

Persistence

Generally, all components have state. The thermostat component has state that represents the comfort temperature. If the thermostat were a software component of a computer-based heating control system, we would want the value of the comfort temperature to be stored on a non-volatile storage medium (such as the hard disk). This way if we shut down the application and brought it back up again, the thermostat control would still be set to 70 degrees. The visual representation and position of the thermostat relative to other components in the application would be restored as well.

Components must be able to participate in their container's persistence mechanism so that all components in the application can provide application-wide persistence in a uniform way. If every component were to implement its own method of persistence, it would be impossible for an application container to use components in a general way. This wouldn't be an issue if reuse weren't the goal. If we were building a monolithic temperature control system we might create an application-specific mechanism for storing state. But we want to build the thermostat component so that it can be used again in another application, so we have to use a standard mechanism for persistence.

Visual Presentation

The component environment allows the individual components to control most of the aspects of their visual presentation. For example, imagine that our thermostat component includes a display of the current ambient temperature. We might want to display the temperature in different fonts or colors depending on whether we are above, below, or at the comfort temperature. The component is free to choose the characteristics of its own visual presentation. Many of these characteristics will be properties of the component...

Table of Contents

Dedication; Preface; Intended Audience; A Moment in Time; How the Book Is Organized; Conventions Used in This Book; Acknowledgments; How to Contact Us; Providing Feedback to the Author; Retrieving Examples Online; Chapter 1: Introduction; 1.1 The Component Model; 1.2 The JavaBeans Architecture; 1.3 JavaBeans Overview; 1.4 Using Design Patterns; 1.5 JavaBeans vs. ActiveX; 1.6 Getting Started; Chapter 2: Events; 2.1 The Java Event Model; 2.2 Events in the AWT Package; Chapter 3: Event Adapters; 3.1 Demultiplexing; 3.2 Generic Adapters; 3.3 Event Adapters in the AWT Package; 3.4 Event Filtering; 3.5 Event Queuing; Chapter 4: Properties; 4.1 Accessing Properties; 4.2 Indexed Properties; 4.3 Bound Properties; 4.4 Constrained Properties; 4.5 Handling Events for Specific Properties; 4.6 A java.awt Example; Chapter 5: Persistence; 5.1 Object Serialization; 5.2 The java.io.Serializable Interface; 5.3 Class-Specific Serialization; 5.4 Walking the Class Hierarchy; 5.5 Serializing Event Listeners; 5.6 Versioning; 5.7 Object Validation; 5.8 The java.io.Externalizable Interface; 5.9 Instantiating Serialized Objects; Chapter 6: JAR Files; 6.1 The jar Program; 6.2 The Manifest; 6.3 Using JAR Files with HTML; 6.4 Using JAR Files on the CLASSPATH; 6.5 Archive Signing; 6.6 An Alternative to the jar Program; Chapter 7: The BeanBox Tool; 7.1 Running BeanBox; 7.2 Dropping Beans on BeanBox; 7.3 Editing a Bean’s Properties; 7.4 Hooking Up Beans; 7.5 Saving and Restoring the BeanBox Form; 7.6 Adding Your Own Beans to BeanBox; Chapter 8: Putting It All Together; 8.1 Defining the Temperature Control Simulator; 8.2 Building the Simulator; 8.3 A Sample Simulator Applet; 8.4 Creating a JAR File; 8.5 Recreating the Sample Using BeanBox; Chapter 9: Introspection; 9.1 The BeanInfo Interface; 9.2 Providing Additional BeanInfo Objects; 9.3 Introspecting the Environment; 9.4 The BeansBook.SimulatorBeanInfo Classes; Chapter 10: Property Editors and Customizers; 10.1 Property Editors; 10.2 Customizers; Chapter 11: ActiveX; 11.1 The JavaBeans ActiveX Bridge; 11.2 Technology Mapping; 11.3 Using Beans in Visual Basic; Design Patterns; Event Objects; Event Listeners; Registering for Event Notification; Registering for Unicast Event Notification; Multiple Parameter Event Methods; Property Access Methods; Indexed Property Access Methods; Constrained Property Access Methods; Registering for Bound and Constrained Property Event Notifications; Naming a BeanInfo Class; The java.beans Package; Colophon;
From the B&N Reads Blog

Customer Reviews