COP with JavaBeans

Andy Ju An Wang, Kai Guo Qian · 2005

The JavaBeans specification defines a component infrastructure to build, customize, assemble, and deploy Java software components. As a component infrastructure, JavaBeans provides most of the requirements specified by the component theory discussed in Chapter 2. It provides properties, which are exposed through its interface by getter and setter methods. It provides methods, which are used to provide services to be called from other components. It provides an event handling model, which is critical for communications among beans. Finally the BeanInfo interface describes what properties, methods, and events are exposed by a bean component. In addition, JavaBeans provides support for introspection and customization, which allow automatic analysis of beans and easy configuration of bean components. One of the distinguishing features of JavaBeans is that components are visually composed into applications in a builder tool. Two builder tools have been discussed in this chapter: BDK 1.1 and Bean Builder 1.0, both form Sun Microsystems, Inc. BDK 1.1 has a BeanBox window for visually manipulating components. The composition method in BDK 1.1 is event handling. The Bean Builder 1.0 demonstrates new technologies in Java platform that allow the construction of applications using component assembly mechanisms. The Bean Builder 1.0 extends the capabilities of the BDK 1.1 by demonstrating new techniques for long term persistence, layout editing, and dynamic event adapter generation using the new dynamic proxy API that was introduced in Java 2 platform. Bean Builder 1.0 comes with two main connecting operators for assembling components: “Set Property” and “Event Adapter”. The “Set Property” operator provides the designers with a technique of changing some properties of targeting components. The “Event Adapter” is used to connect an event from one component up to a method of another component. In other words, this operator provides for the “multiplication” composition in device beans discussed in Chapter 2. It is possible to create a chain of events to alter multiple components from one fired event. So the first component in the sequence would fire an event to the second component which in turn would trigger the third component to react and so on. The strength of Bean Builder with regard to the component model and the connection model in the JavaBeans component infrastructure is mainly the visualization of the connections that can be made between components. The use of XML file to describe component design makes long term persistence possible. XML is becoming a universal language for its independence between builder tools and computer architectures. However, neither BDK 1.1 nor Bean Builder 1.0 is a mature component technology yet. Their functionalities and usability have to be improved significantly before they could be a major market hit in component oriented programming.

Read the paper · More papers on PaperTik