ISBN: 0-471-41405 -0
Download (direct link):
With the advent of Java 2, Java split into three editions that were targeted at different devices and applications:
Java 2 Enterprise Edition (J2EE) targets large enterprise applications and servers. The use of CORBA makes it fit into the service network rather than inside the device. We do not describe J2EE in detail in this book.
Java 2 Standard Edition (J2SE) is a natural evolution of Java 1.x, which provides an easy migration for existing Java developers. The size is still too large for most mobile devices, and we will not describe J2SE in detail in this book with the exception of Personal Java. Personal Java is targeted at communicators and powerful PDAs (for instance, the EPOC Quartz reference design).
Java 2Micro Edition (J2ME) is the scaled-down Java version that is suitable for mobile devices.
Figure 11.5 illustrates the different Java 2 editions.
This figure illustrates how the basic J2ME is extended with two configurations. J2ME (at this writing) consists of two configurations: Connected Device Configuration (CDC) and Connected Limited Device Configurations (CDLC). Configurations define a minimum platform for a group of target devices, each with similar properties in terms of memory, size, and processing power. In other words, a configuration consists of the classes and virtual machine features that are targeted toward a certain group of devices.
CDLC is the configuration that is most appropriate for small, mobile Internet devices. Considering the specific needs of this group of target devices, the configuration is very compact and limited. CDLC is defined as a subset of CDC, as shown in Figure 11.6.
CDC is targeted at somewhat bigger devices, such as set-top boxes and in-car systems. All of these devices have more generous environments in terms of processing power and battery power (many of them do not have batteries but instead use nonlimited power sources). The other main difference between CDC and CDLC is that CDC uses the standard Java Virtual Machine (JVM) while CDLC uses a smaller virtual machine, the K Virtual
Figure 11.5 Java 2 editions and configurations.
Machine (KVM). K means that the resulting footprint on devices should be in the range of kilobytes rather than in megabytes.
You should interpret Figure 11.6 as J2ME (in other words, CDC and CDLC)—a Java edition that has been adapted to the small devices. This adaption mostly took place by removing things that were not considered needed or feasible for the small devices. In doing so, the need for some specialized classes has arisen (and for those that are not part of the larger Java editions). In this section, we will look more closely at CDLC, because this point is where most of the work
Figure 11.6 Not all CDC and CDLC classes are included in other Java editions.
has been done in order to fit Java into tiny devices. CDC is built upon the regular JVM and thus runs on similar devices as Java 1.x (memory in the range of megabytes). In other words, developing for CDC is pretty straightforward for any Java programmer.
CDLC targets devices such as PDAs, smartphones, and mobile phones, which can spare at least 128KB of memory. The virtual machine that is used, KVM, is extremely compact when compared to other incarnations of Java. The actual
footprint of KVM is between 40KB and 80KB (depending on compilation options and the target platform). Adding a
heap size of 128KB and a few tens of bytes for configuration and class libraries, a typical memory budget totals 256KB. This value is even within the memory limitations of phone-centric 3G devices. The CDLC specifications state that KVM can be run with as little as 32KB of heap space, but you usually need a bit more.
While CDLC defines some basic common denominators (such as input/output, networking, and security), there are many features that you must define above CDLC (see Figure 11.7). These more specific details are implemented in socalled profiles. A profile extends a configuration and addresses the needs of specific device categories. The main objective for profiles is to ensure interoperability between devices in a certain vertical device family. The idea is to define classes that fulfill the needs of this device family without sacrificing the code’s portability.
The Mobile Information Device Profile (MIDP) is the first profile to be defined. The target device group includes mobile phones, pagers, and PDAs. The characteristics of an MIDP device are the following:
A monochrome or color display that is at least 96 pixels wide and 54 pixels high Input mechanisms consisting of a touch screen, a keypad, or a conventional keyboard
Figure 11.7 A profile sits on top of the configuration.
A wireless network connection that has limited bandwidth (the connection does not have to be always online and thus can include 2G networks)
128K of memory that remains even when the device is turned off (nonvolatile) in order to store the MIDP components, 8K of nonvolatile memory in order to store persistent data, and 32K of volatile memory for the Java run time