Tuesday, October 27, 2009

j2me Configurations

 

Configurations

A configuration, at the bottom of the Java ME organization stack shown in Figure 1, defines a basic lowest-common-denominator Java runtime environment. This includes the VM and a set of core classes derived primarily from the Java SE platform. Each configuration is geared for a broad family of constrained devices with some type of network connectivity.

As this article mentioned earlier, two configurations have been defined: the Connected Limited Device Configuration (CLDC) and the Connected Device Configuration (CDC). CLDC is a subset of CDC, as Figure 4 shows.

Figure 4: Relationship Between CLDC and CDC

CDC includes all the classes defined by CLDC, including any new ones not included in the Java SE platform, such as the Generic Connection Framework.

The Connected Limited Device Configuration (CDC)
A direct descendant of the Spotless System, CLDC is a minimal Java ME configuration for devices with stringent restrictions on computational power, battery life, memory, and network bandwidth. These limits directly affect the kinds of Java technology-based applications they can support.

CLDC does not require a lot of resources. It supports devices with 16-bit or 32-bit processors with at least 160 KB of persistent memory and at least 32 KB of volatile memory, for a total of 192 KB. Power consumption is low, and devices are typically battery-powered. Network connectivity may be over an intermittent, slow-speed connection. At the heart of this configuration is a Java virtual machine with some Java SE capabilities removed. For example, CLDC does not support class finalization or thread groups. For a list of all the restrictions, visit the CLDC product page.

CLDC defines a subset of the standard core Java language packages familiar to Java SE developers, and it adds classes tailored for constrained devices. In addition, CLDC has introduced the streamlined Generic Connection Framework package, javax.microedition.io, to support I/O in devices that lack the memory to use the larger java.net and java.io packages. This framework is a straightforward hierarchy of interfaces and classes that create connections of various types -- including HTTP, datagram, and streams -- and that perform I/O. Table 1 lists the Java packages included in the CLDC.

Table 1: Core Java Packages in CLDC

Name

Description

java.lang

CLDC subset of core Java programming language classes

java.lang.ref (CLDC 1.1 only)

CLDC subset to support weak references

java.util

CLDC subset of Java SE utility classes

java.io

CLDC subset of system I/O through data streams

javax.microedition.io

Network support based on the Generic Connection Framework

Note that CLDC 1.1, JSR 139, has superseded the original CLDC 1.0 specification, JSR 30.

Differences Between CLDC 1.0 and 1.1
CLDC 1.0 and 1.1 are very similar. From the developer's perspective, the most important enhancements in the newer release are the new floating-point math capabilities and support for weak references. The following list, taken from the CLDC specification document, summarizes CLDC 1.1's main differences from version 1.0:

  • Floating-point support has been added.
    • All floating-point bytecodes are supported.
    • Classes Float and Double have been added.
    • Various methods have been added to the other library classes to handle floating-point values.
  • Weak-reference support -- a small subset of the Java SE weak-reference classes -- has been added.
  • Classes Calendar, Date, and TimeZone have been redesigned to conform more closely to their Java SE counterparts.
  • Error-handling requirements have been clarified, and one new error class, NoClassDefFoundError, has been added.
  • Thread objects have names, as threads in Java SE do. The method Thread.getName() has been introduced, and the Thread class has a few new constructors that have been inherited from Java SE.
  • Various minor library changes and bug fixes have been included, such as the addition of the following fields and methods:
    • Boolean.TRUE and Boolean.FALSE
    • Date.toString()
    • Random.nextInt(int n)
    • String.intern()
    • String.equalsIgnoreCase()
    • Thread.interrupt()
  • The minimum memory budget has been raised from 160 to 192 kilobytes, mainly to allow for the new floating-point functionality.
  • Permission classes have been added to express security checks in the Generic Connection Framework and java.lang APIs.
  • Inverse trigonometric functions have been added to facilitate location-based services.
  • Restrictions have been placed on the behavior of eager-linking VM implementations.
  • Specification text has been tightened and obsolete subsections removed.
  • The verifier specification is much more detailed.

For more information, see the CLDC product page.

The Connected Device Configuration (CDC)
CDC is designed for more powerful devices than those that CLDC supports, such as high-end cell phones and PDAs, and the more sophisticated embedded devices: TV set-top boxes, Web-based devices such as Internet appliances, and even car navigation systems.

Devices that support CDC have 32-bit processors, typically ARM-based devices, at least 2 MB of main memory and 2.5 MB of ROM, and some type of network connectivity. At the heart of this configuration is a Java VM such as the CDC HotSpot Implementation, with full Java SE capabilities.

CDC is a superset of CLDC. It includes all the classes defined by the CLDC, including any new ones not included in Java SE, such as the Generic Connection Framework. CDC includes many more core Java SE classes than does CLDC, making it a more familiar environment for experienced Java SE programmers. Table 2 summarizes the packages in CDC.

Table 2: Core Java Packages in CDC

Name

Description

java.lang

CDC subset of the core Java programming language

java.lang.ref

Reference-object classes, which support a limited degree of interaction with the garbage collector

java.lang.reflect

Classes and interfaces for obtaining reflective information about classes and objects

java.math

CDC subset of classes for performing arbitrary-precision integer arithmetic

java.text

CDC subset of classes and interfaces for handling text, dates, numbers, and messages in a manner independent of native languages

java.io

CDC subset of system input and output through data streams, serialization, and the file system

javax.microedition.io

Network support based on the Generic Connection Framework; support for file: and datagram:

java.util

CDC subset of collections, date and time facilities, internationalization, and miscellaneous utility classes

java.util.zip

CDC subset of classes for reading the standard ZIP file format

java.util.jar

CDC subset of classes for reading files in the Java archive (JAR) format, which is based on the standard ZIP file format, with an optional manifest file

java.net

CDC subset of classes for implementing a networking application; support for datagram: and JAR I/O

java.security

CDC subset of classes and interfaces for the security framework

java.security.cert

CDC subset of classes and interfaces for parsing and managing certificates

CDC release 1.0 was introduced as JSR 36. More recently, CDC 1.1 was introduced as JSR 218.

Differences Between CDC 1.0 and 1.1
CDC 1.1 is very like its predecessor. Existing APIs have been cleaned up. Enhancements center mainly on support for J2SE 1.4, including Unicode 3.0, assertions, and the new security optional packages: Java Authentication and Authorization Service (JAAS), Java Secure Socket Extension (JSSE), and Java Cryptography Extension (JCE).

For more information, see the CDC product page.

No comments:

Post a Comment