J2ME MIDP Deployment Services

J2ME MIDP Deployment Services

When facing the problem of porting Java to the myriad of handheld and dedicated devices that constitutes the new wave of portable devices while preserving the advantages of the Java platform (portability, security, with an high-level language-widespread among developers), Sun engineers have devised a particular architecture, composed of few configurations for defining the common features for a class of devices (they comprise the virtual machine, core libraries, and some APIs) while leaving the differences of each device described by a so-called profile.

Profiles are thought of as gathering together not only common devices (such as mobile phones, for example), but also common applications.

The two configurations currently provided for the J2ME platform are the following:

  • Connected Limited Device Configuration (CLDC).
  • This configuration is for devices with constrained hardware resources (principally CPU and memory). Typically, such devices run on either a 16- or 32-bit CPU with 512 Kbytes or less memory available for client applications and the Java platform itself.
  • Connected Device Configuration (CDC).Essentially, this configuration is designed for next- generation devices with more robust resources than CLDCs. Typically, these devices run on a 32-bit CPU, and have at least 2 Mbytes of RAM totally available for the Java platform and client applications.
  • A need among device manufacturers is the capability to dynamically change the features provided by the device. That is to say, the software is not hard-coded within the device once and for all, but could be to some extent dynamically loaded. Here, deployment techniques come into play.

    The configurations don't address lifecycle issues (installation, launching, and removal), leaving these and other features to their profiles. Therefore, we are obliged to discuss deployment issues on a per-profile basis. The following section discusses the deployment of the Mobile Information Device Profile (MIDP).

    Deploying MIDlets

    The Mobile Information Device Profile (MIDP) is a set of Java APIs that, together with the Connected Limited Device Configuration (CLDC), provides a complete J2ME application environment defining issues such as user interface, the application model, networking, and persistence storage for mobile devices such as cellular phones and the so-called two-way pagers. The code proposed here was developed and executed on the J2ME Wireless Toolkit from Sun, available at http://www.javasoft.com/products/j2mewtoolkit/

    The key component in the deployment of MIDlets is the Java Application Descriptor (JAD) file that describes all the deployment-related details for a MIDP executable.

    Application Descriptor Files An application descriptor file is a text file, encoded with Unicode, with the suffix .JAD. It is made up of text lines composed as follows:

    [attribute-name]+': '+[value]

    Such attributes can be read by MIDlets using the static method MIDlet.getAppProperty. Listing 1 shows an example of a JAD file.

    Listing 1 An Example Of a Java Application Descriptor (JAD) File.

    MIDlet-Name: MIDletApplication
    MIDlet-Version: 0.0.1
    MIDlet-Vendor: myself
    MIDlet-Jar-URL: http://www.awebsite.biz/apps/app.jar
    MIDlet-Jar-Size: 1234
    MIDlet-Data-Size: 256

    Attributes in a JAD file can be divided into two main groups, depending on whether they are required or not. Note that attributes beginning with MIDLet- are thought to be "system" attributes, and are reserved. Application-specific attributes cannot begin with the MIDlet- prefix. Required attributes in every JAD file are the following:
  • MIDlet-Name.Specifies the name of the application that will be shown to the user.
  • MIDlet-Jar-URL.The URL from where the JAR file can be downloaded.
  • MIDlet-Version.The MIDlet version.
  • MIDlet-Vendor.The MIDlet vendor.
  • MIDlet-Jar-Size.The size of the JAR file
  • Optional attributes for JAD files:
  • MIDlet-Data-Size. The minimum number of bytes of persistent data required by the MIDlet. The device should ensure this memory to the application to be run, whereas it can provide optionally more.
  • MIDlet-Description.A brief description for the user.
  • MIDlet-Info-URL.A link to the application home page.
  • An icon that (depending on the particular device) will be associated with the application. The PNG image file format is used.
  • Application-specific attributes, used to configure the MIDlet via its JAD file. For example, the following line in a JAD file would indicate to the MIDlet to launch the configuration property:
  • Figure 1 The waterfall software lifecycle model.

    © 1998-2005 Mauro Marinilli