by Dave Orchard

JavaBeans make their debut at JavaOne

news
May 1, 19975 mins

JavaSoft enters the bean component to a chorus of vendor support

If you had to pick one reason for Visual Basicโ€™s success, it would probably be reusable components. Today, Visual Basic component catalogues rival phone books in girth. With this healthy complement of components to choose from, even novice programmers can wire together small applications from components without writing one line of code.

JavaBeans is Sunโ€™s response to the need for this sort of plug-and-play development. Broadly, a component architecture defines how a component can expose its properties and methods to other components and to the container hosting them, how to exchange events and data between components, and how containers behave when the component has the focus.

In its current form, the JavaBeans framework squarely deals with the issue of exposing a beanโ€™s properties as well as with a model for beans to broadcast and listen for events. As of its first release, JavaBeans doesnโ€™t include an aggregation model (for accessing beans embedded in other beans) nor does it specify a containment model, which leaves issues open โ€” like how a container will handle toolbars and menus associated with beans. These shortcomings, however, have done little to dampen the groundswell of interest in beans. For a discussion of JavaBeans in the near future, see the sidebar at the end of this article.

Instant beans

At the recent JavaOne conference in San Franciso, CA, April 2-4, a newly reconstituted Taligent introduced its WebRunner subscription service. WebRunner provides developers with the latest in reusable code. At the core of Taligentโ€™s Bean Factory is a wizard that allows developers to specify what a bean will expose and then creates a complete framework for that bean. With the Bean Factory, you can create a very simple bean in a matter of minutes. Taligent also is offering an interesting twist on this wizard; it inspects an ActiveX component and creates a complete bean framework into which developers can transplant the controlโ€™s logic.

Corel, which debuted Corel Office for Java at JavaOne, also sees a lot of opportunity in beans. This spring, the company will release a beta collection of beans that provides some of the same functionality as the office suite. A spellchecker, a spreadsheet viewer, and similar beans should find their way into Corelโ€™s bean bag.

Chris Biber of Corel revealed that Corel also has an aggregation bean that allows it to bind beans embedded in other beans. Itโ€™s unclear whether this particular tool will ever see the light of day, but in the short term, developers might have a means of working around some of the JavaBeans omissions.

JavaSoft and others also are working on ways of running JavaBeans in other containers. Topping the list is JavaSoftโ€™s ActiveX bridge that wraps a JavaBean in an ActiveX interface, so users can work with beans in any ActiveX environment. The beta ActiveX bridge is available on JavaSoftโ€™s Web site (see Resources).

Catch the InfoBus โ€” and start your beans info exchange

One of the vexing problems in working with components as black boxes is exchanging data between JavaBeans. Sun has adopted Lotusโ€™ InfoBus technology to help exchange structured information between components. InfoBus allows information to be tagged with a content description, i.e., โ€œaccount number,โ€ and to pass complex data structures, like database records, between beans. Sunโ€™s InfoBus spec should be ready in the second quarter of this year.

The devilโ€™s in the details

As developers start stringing together beans from other developers, expect to see some new issues crop up. At JavaOne, Larry Cable, JavaSoftโ€™s JavaBeans project lead, described the different types of properties beans can expose. In addition to simple properties, two powerful property types present interesting problems. When a โ€œboundโ€ property changes, the bean will automatically update all beans that have attached listeners to the property. โ€œConstrainedโ€ properties, a variation on bound properties, allow any listening bean to veto changes to a property by throwing an exception. If several beans are listening to a constrained property, some beans may accept a change (and begin acting on it) only to discover some other bean that then vetos the change. It is possible for developers to implement a proper two-phased commit among beans theyโ€™re developing, but those details are left to individual bean developers. If you mix and match beans from other projects or developers, this ambiguity could make constrained properties quite a bit messier to implement.

Bean builders

JavaSoft included a BeanInfo class that allows bean developers to control how their beans are exposed in development environments. BeanInfo can override the propertyโ€™s name and add help strings for them, define certain properties as hidden or expert, and similar extensions. With this information, visual development tools can provide users with more intelligent choices about what to do with a bean.

Have you bean convinced?

Not convinced of the level of interest in JavaBeans? A raft of tool vendors plan to release bean development tools, including Asymetrixโ€™s SuperCede, Borlandโ€™s JBuilder, IBMโ€™s AppletAuthor and Visual Age for Java, Lighthouse Designโ€™s JavaPlan, Netscapeโ€™s Visual JavaScript, SunSoftโ€™s Project Studio and Java Workshop, Symantecโ€™s Visual Cafe, and Unifyโ€™s Vision.

Gregory S. Smith โ€” sidebar by Dave Orchard is a freelance writer and network consultant based in San Francisco, CA. He specializes in guiding organizations in the design and deployment of intranets and other collaborative technologies.