October 25, 2014
Hot Topics:
RSS RSS feed Download our iPhone app

Introduction to the Java 2 Micro Edition (J2ME) Platform

  • October 3, 2002
  • By Prentice Hall
  • Send Email »
  • More Articles »

Configurations and Profiles

A configuration specifies three basic elements:

  • a set of Java programming language features
  • a set of Java virtual machine features
  • a set of supported Java libraries and application programming interfaces (APIs)

Figure 1.1  The J2ME platform consists of a set of layers that support a basic runtime environment with core Java libraries and a Virtual Machine (VM), a set of system-level application programming interfaces (APIs) in a configuration, and a set of application-level APIs in a profile.

The creators of J2ME have defined only two configurations to avoid a fragmented landscape of incompatible platforms. The two configurations that exist currently represent the two categories of pervasive devices you saw earlier in this chapter, namely:

  • personal, intermittently connected mobile devices—supported by the Connected, Limited Device Configuration (CLDC)
  • constantly connected network devices—supported by the Connected Device Configuration (CDC)

Theoretically, a configuration could specify the very same support as the J2SE platform libraries. This is unlikely in the real world because, as you now know, J2ME is targeted at devices that are far less powerful than desktop computers.

Configuration specifications require that all Java classes adapted from J2SE be the same as or a proper subset of the original J2SE class. That is, a class cannot add methods not found in the J2SE version. Configurations can include additional classes in their specifications, however; configurations themselves are not necessarily proper subsets of J2SE. Both configurations that have been defined to date add classes not present in J2SE in order to address device attributes and constraints.

The Connected Device Configuration (CDC)

The Connected Device Configuration (CDC) intends to capture just the essential capabilities of each kind of device in the category of devices it targets, namely, devices with 2 MB or more of total memory, including both RAM and ROM.

As you saw in Figure 1.1, a configuration specifies both the set of Java VM features that are supported and a set of class libraries. The CDC specifies the use of the full Java 2 platform VM, which, in this context, is called the Compact Virtual Machine (CVM).

The CVM. Although the CVM supports the same features as the J2SE VM, it is designed for consumer and embedded devices. This means that the standard J2SE VM has been reengineered to suit the constraints of limited-resource devices. The features of the resulting offspring CVM are:

  • advanced memory system
  • small average garbage collection pause times
  • full separation of VM from memory system
  • modularized garbage collectors
  • generational garbage collection

In particular, the CVM has been engineered to offer the following features:

  • portability
  • fast synchronization
  • execution of Java classes out of read-only memory (ROM)
  • native thread support
  • small class footprint
  • provision of interfaces to and support for real-time operating system (RTOS) services
  • mapping Java threads directly to native threads
  • support for all Java 2, v1.3 VM features and libraries: security, weak references, Java Native Interface (JNI), Remote Method Invocation (RMI), Java Virtual Machine Debugging Interface (JVMDI)

CDC Class Libraries. The CDC specifies a minimal set of class libraries and APIs. It supports the following standard Java packages:

  • java.lang—Java VM system classes
  • java.util—underlying Java utilities
  • java.net—Universal Datagram Protocol (UDP) datagram and input/output (I/O)
  • java.io—Java file I/O
  • java.text—very minimal support for internationalization (I18N—see chapter 9)
  • java.security—minimal fine-grain security and encryption for object serialization

As you can see, these APIs do not include the full set of Java 2 software development kit (SDK) packages. In some cases, these packages and classes are subsets of the Java 2 SDK packages and classes. Resource constraints dictate removal of the remainder of the J2SE classes and APIs. Also, all deprecated J2SE APIs are removed. Table 1.1 lists the full set of packages supported by the CDC.

Table 1.1  CDC Packages
CDC Package NameDescription
java.ioStandard IO classes and interfaces
java.langVM classes
java.lang.refReference classes
java.lang.reflectReflection classes and interfaces
java.mathMath package
java.netNetworking classes and interfaces
java.securitySecurity classes and interfaces
java.security.certSecurity certificate classes
java.textText package
java.utilStandard utility classes
java.util.jarJava Archive (JAR) utility classes
java.util.zipZIP utility classes
javax.microedition.ioCDC generic connection framework classes and interfaces

The Foundation Profile. A configuration, together with a profile, creates a J2ME runtime environment. The system-level features and services supported by a configuration are more or less hidden from the application developer. In reality, the application developer is prohibited from accessing them directly. If this were not the case, the application would not be considered J2ME compliant.

From the programmer's perspective, a profile is required to do "useful" work. A profile defines the layer that contains the APIs that the programmer usually manipulates. The J2ME creators initially defined one CDC profile, the Foundation Profile, which is based on the J2SE v1.3 release. It was designed by standard committee through the Java Community Process, by an expert group of companies in the consumer electronics industry. The Foundation Profile contains the J2SE packages listed in Table 1.2.

The list of packages above looks exactly like the list that comprises the CDC. In fact, they are the same. To say that the Foundation Profile contains these packages really means that they are available to the Foundation Profile. The intention is that the Foundation Profile be used with the CDC. The delineation between the profile and the configuration is a conceptual one, not a physical one.

Notice that the whole java.awt Abstract Window Toolkit (AWT) and javax.swing Swing package hierarchies that define the J2SE graphical user interface (GUI) APIs are absent from the supported packages. If an application needs a GUI, an additional profile would be required. Profiles can be built on top of one another. An implementation of the J2ME platform, however, can contain only one configuration.

The lack of GUI support in the Foundation Profile has less impact for the family of shared, constantly connected network devices such as TV set-top boxes than it does for personal, mobile devices, which are served by the second J2ME configuration, the CLDC.

In general, the decision to include or omit features and libraries from a configuration or profile is based on their footprints, static and dynamic resource requirements, and security requirements.

Table 1.2  Foundation Profile Packages
Foundation Profile Package NameDescription
java.langRounds out full java.lang.* J2SE package support for the Java language (Compiler, UnknownError)
java.utilAdds full zip support and other J2SE utilities (java.util.Timer)
java.netAdds TCP/IP Socket and HTTP connections
java.ioRounds out full java.io.* J2SE package support for Java language input/output (Reader and Writer classes)
java.textRounds out full java.text.* J2SE package support for internationalization (I18N): Annotation, Collator, Iterator
java.securityAdds code signing and certificates

Personal Profile. The Personal Profile specification was created through the Java Community Process, resulting in JSR–62. The Personal Profile provides an environment with full AWT support. The intention of its creators is to provide a platform suitable for Web applets. It also provides a J2ME migration path for Personal Java applications.

Personal Profile version 1.0 requires an implementation of the Foundation Profile version 1.0. It is a superset of the Personal Basis Profile version 1.0. Personal Profile is a subset of the J2SE version 1.3.1 platform, however, which makes Personal Profile applications upward compatible with J2SE version 1.3.1.

Table 1.3 lists the packages that comprise Personal Profile version 1.0.

Table 1.3  Foundation Profile Packages
Personal Profile Package NameDescription
java.appletClasses needed to create applets and those used by applets
java.awtClasses for creating AWT UI programs
java.awt.datatransferClasses and interfaces for transferring data within and between applications
java.awt.eventClasses and interfaces for AWT event handling
java.awt.fontClasses and interface for font manipulation
java.awt.imClasses and interfaces for defining input method editors
java.awt.im.spiInterfaces that aid in the development of input method editors for any Java runtime environment
java.awt.imageClasses for creating and modifying images
java.beansClasses that support JavaBean development
javax.microedition.xletInterfaces used by J2ME Personal Profile applications and application managers for communication

RMI Profile. The RMI Profile is a profile designed for platforms that support the CDC configuration. It has been defined by JSR-66 by various companies participating through the Java Community Process.

The RMI Profile requires an implementation of the Foundation Profile and is built on top of it. RMI Profile implementations must support the following features:

  • full RMI call semantics
  • marshaled object support
  • RMI wire protocol
  • export of remote objects through the UnicastRemoteObject API
  • distributed garbage collection and garbage collector interfaces for both client and server side
  • the activator interface and the client side activation protocol
  • RMI registry interfaces and export of a registry remote object

The RMI profile supports a subset of the J2SE v1.3 RMI API. The following interfaces and features are part of the J2SE v1.3 RMI specification and public API, but support for these interfaces and functionality is omitted from the RMI profile specification because of limitations on device processing power, network performance, and throughput:

  • RMI through firewalls and proxies
  • RMI multiplexing protocol
  • implementation model for an "activatable" remote object
  • deprecated methods, classes, and interfaces
  • support for the RMI v1.1 skeleton/stub protocol
  • stub and skeleton compiler

Support for the following J2SE RMI v1.3 properties is omitted:

  • java.rmi.server.disableHttp
  • java.rmi.activation.port
  • java.rmi.loader.packagePrefix
  • java.rmi.registry.packagePrefix
  • java.rmi.server.packagePrefix




Page 2 of 4



Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Sitemap | Contact Us

Rocket Fuel