J2ME from Sketch - Part 1

J2ME Historical events:
1998:

  • Sun refocused on mobile and entertainment devices (Java's original intention)
  • Released pJava to be used for resource constrained devices.
  • pJava was based on core set of JDK1.1.8 and some new API’s specific to mobile devices.
  • Though pJava fit bigger devices such as setboxes better, it did a poor job on other smaller devices.
1999:
  • Sun creates a VM for Palm Pilots.
  • The project was called "Spotless", and the VM created became KVM.
  • KVM together with Spotlet demo was released for early access at JavaOne.
  • It was standardized via JCP, and came out as a set of configurations and profiles, with a new name J2ME.
  • J2ME release overcame the inefficiencies of pJava.
2000:
  • Sun extends pJava for handsets (PDAs and SmartPhones) with a JavaPhone API which found its way into several Symbian OS 6 implementations.
  • These extensions became new classes in J2ME via PP and the PBP.
2001:
  • Nextel Communications, Inc. introduces first java enabled wireless phone in North America.
  • The i85s, manufactured by Motorola, is pre-loaded with Java apps, including specialized business calculators and an expense pad.Allows download of J2ME applications.

What is J2ME:
A separate Java platform optimized for small devices. Stands for Java 2 Micro Editions.

The Computing resources of J2ME are:
  • Memory (Persistent & Volatile).
  • Processing speed
  • Output device
  • Input device
  • Network connectivity
  • Power supply

J2ME Architecture:
J2ME Architecture divided into three parts as Configurations, Profiles and Optional Packages known as MIDP.



Configuration:
  • It defines the minimum platform required for a group of devices.
  • It defines a lowest common denominator J2ME Runtime Environment.
  • It includes VM and a set of common API derived primarily from J2SE.
  • Each configuration is geared for a family of devices with similar capabilities.
  • Two configurations have been defined:
  • Connected Device Configuration (CDC).
  • Connected, Limited Device Configuration (CLDC)
CDC:
  • Designed for devices with a min of 512KB of memory (ROM) and 256KB of RAM.
  • Specifies a full Java Virtual Machine called CVM.
  • Total memory budget range may extend
  • up to 16MB.
  • CDC compliant devices may have 16 or 32 bit CPUs.
  • E.g. TV Set-top boxes, Car navigation systems, RTS, Washing Machine etc.



CLDC:
  • 128kb memory for Java
  • 32kb for runtime allocation
  • Restricted UI
  • Low bandwidth network connectivity, intermittent access
  • KVM is reference implementation
  • E.g. Mobile Devices, PDA



KVM for CLDC:
  • Kilo Virtual Machine (KVM) a minimal and almost complete JVM, small enough to fit in tens of kilobytes.
  • Lots of features eliminated
  • floating point, finalize(), JNI, etc.
  • Change in classfile verification
  • Preverifier, verifier
  • Classfile format: JAR
CVM for CDC:
  • Compack Virtual Machine
  • JVM with J2SE 1.3 VM specification compliancy.
  • Supports almost all advanced features of J2SE VM, including low-level debugging and native programming interfaces.
  • It is more portable, more efficient, and smaller than J2SE VM.
  • CVM was written in C and uses a portability layer to abstract underlying OS dependencies.
  • CVM improves garbage collectors, native-thread support, synchronization, and stack usage.

Profile:
It addresses the specific needs of a certain device family

MIDP:
Mobile Information Device Profile which is upper layer part of the J2ME architecture comes with the Profile specification. MIDP characteristics are
  • 128 kb non-volatile memory
  • 32 kb volatile memory
  • 8 kb of non-volatile memory for persistency
  • A screen of at least 96 x 54 pixels
  • Some capacity for input
  • Two-way network connection, possibly intermittent

Life cycle of J2ME Midlets:
  • Instantiation
  • pauseApp()
  • startApp()
  • destroyApp()
  • Deallocation


Simple Midlet Skeliton:

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class LifeCycleDemo extends MIDlet
{

LifeCycleDemo() { }
public void startApp() { }
public void pauseApp() { }
public void destroyApp(boolean unconditional) { }

}

0 comments:

Post a Comment