News Archive (1999-2012) | 2013-current at LinuxGizmos | Current Tech News Portal |    About   

Article: An introduction to Waba — an open source Java-like platform

Feb 15, 2001 — by Rick Lehrbaum — from the LinuxDevices Archive — 2 views

Waba is a programming platform for small devices. Waba defines a language, a virtual machine (VM), a class file format, and a set of foundation classes. Legally speaking, Waba is not Java. Also, the foundation classes are simplified in comparison to the standard Java classes, and the VM has certain limitations. Other than this, a programmer familiar with Java will be able to write Waba applications immediately, using the usual development tools. Waba is currently gaining popularity among programmers, and a Linux port is in process.

What makes Waba special?

  • Waba is well suited for embedded and mobile devices, as well as embedded PCs (OS on one floppy)
  • Waba is free and open source (released under the GNU GPL)
  • Applications written in Waba can be run everywhere a JVM is available.
  • The VM is written in standard ANSI C
  • The VM takes 40KB of executable code on Motorola 68K processors, and about double that on a Pentium
  • It is probably the fastest VM able to run bytecode, hence very interesting for embedded systems with low-cost, low-end CPUs
  • It can run standard byte code encoded in its standard format (the class file), produced by any Java compiler
  • It has a no-frills, deterministic garbage collector
A more extensive description can be found here. Where does it come from and where will it go?

Waba was developed by Rick Wild of Wabasoft, initially for PalmOS — principally to provide programmers with a layer hiding the instabilities of PalmOS (especially regarding low memory). Wild then ported Waba to Windows and PocketPC.

Many people contributed to extend the foundation classes and also the VM, mainly with PalmOS in mind. SuperWaba was born and is the subject of an active community of developers.

Then, Smartdata decided to adopt this VM for its ChipSlice platform running the popular embedded version of Linux for MMU-less processors named uClinux and launched the Linux/uClinux Waba port. Noticing the need to synchronize the development, Smartdata opened a SourceForge Waba project.

Waba is likely to become increasingly popular as an application platform in applications such as PDAs, cell phones, and embedded PCs. It should also prove useful for more specialized tasks such as portable drivers or as a scripting language. It is a serious competitor to Sun's J2ME (KVM), but with the advantage of being completely free. Relative to Kaffe, it takes an opposite approach — that is, starting small and growing, instead of starting from a quite complex VM and having to reduce it.

Supported platforms

  • PalmOS — available
  • PocketPC — available
  • Linux — port almost finished, available for GTK
  • uClinux — SourceForge project in progress for PicoGUI
Where to find Waba?

A list of useful links are available here.

Organization of the Waba VM software

The VM code is structured so as to ease porting onto different platforms, and is organized as follows . . .

  • the VM core, platform-independent
  • the OS abstraction routines, interfacing the core to the OS, include:
    • the class loader
    • the startup and exit functions
    • the file manipulations
    • the windowing, sound, networking, etc. functions
  • the C implementation of the native routines, called by the core Java classes (themselves written in Java)
The foundation classes

Currently, the foundation classes are . . .

  • fx: simple effects
    Color, Font, FontMetrics, Graphics, ISurface, Image, Rect, Sound, SoundClip
  • io: access to IO resources — Catalog, File, SerialPort, Socket, Stream
  • lang: subset of the standard lang package — Object, String, StringBuffer
  • sys: misc system utils — Convert, Time
  • ui: simple widget-oriented GUI without layout manager — Check, Container, Control, ControlEvent, Edit, Event, IKeys, KeyEvent, Label, MainWindow, PenEvent, Radio, Tab, TabBar, Timer, Welcome, Window
  • util: misc utilities — Vector
This quite spartan environment enables an extremely reduced footprint, yet it is rich enough to enable writing interactive applications on a PDA (e.g. Palm). Many classes, though slightly different, resemble standard Java core classes but are actually much simpler. Some other classes, like the io.Catalog, were designed to exploit specifics of PalmOS and do not really have an equivalent in standard Java. Discussions will take place within the community regarding moving towards more standard APIs (like, for instance, a subset of the AWT) but without losing the advantage of reduced footprint.

Extending the functionality

One can extend Waba's functionality by supplying additional Java classes, which is probably the easiest way. However, as soon as OS resources (other than those already supported by the existing foundation classes) must be accessed, or speed is an issue, the answer is to implement a package including native methods.

How to implement a native package?

It's rather simple . . .

  • Choose what to implement in Java, and what to implement in C
  • In the Java source code, write the class, including members and methods
    • the native methods must be declared as such
    • the other Java methods may, of course, call the native ones
  • Write the native methods in C; there are a few conventions on how the method gets its parameter and object reference; the method may create other objects (especially strings)
  • Register the native method in a Hash table in the VM; there is currently no dynamic binding such as JNI
  • Declare the class' memory requirement for non-Java members (allocations done by the C code)
  • If needed, Implement the class' destructor


About the authors: Pascal Bauermeister is head of software development at Smartdata in Lausanne, Switzerland, which launched the SourceForge Waba Project. Olivier Bornet also works for Smartdata and is the admin of the SourceForge Waba Project.



 
This article was originally published on LinuxDevices.com and has been donated to the open source community by QuinStreet Inc. Please visit LinuxToday.com for up-to-date news and articles about Linux and open source.



Comments are closed.