Scmad Chapter02

27
By Marcel Caraciolo http://mobideia.blogspot.com Chapter 02 – Configurations and first application SCMAD Certification 45mm 61mm

description

SCMAD - Chapter 02 (Only for studies purposes)

Transcript of Scmad Chapter02

Page 1: Scmad Chapter02

By Marcel Caraciolo

http://mobideia.blogspot.com

Chapter 02 – Configurations and first application

SCMAD Certification 45mm

61m

m

Page 2: Scmad Chapter02

Agenda

• Tools and requirements for JavaME development• First JavaME application – Hello World MIDlet• Configurations and profiles - differences

Page 3: Scmad Chapter02

Tools and installation

•Install the Java Development Kit (JDK 1.4 or higher)•http://java.sun.com/javase/downloads/index.jsp

•Install the Wireless Toolkit (version used here: 2.5)•http://java.sun.com/products/sjwtoolkit/

•Install the Eclipse IDE• Install the pluggin for Eclipse: EclipseME

• http://eclipseme.org/

Page 4: Scmad Chapter02

First JavaME Application

•Create a new J2ME MIDletSuite•Don’t forget to add the WTK emulator path to the EclipseME Plug-in (Window -> Preferences -> J2ME -> Device Management)

•Create a new HelloWorld J2ME MIDlet• Download: http://www.dsc.upe.br/~mpc/HelloWorldMIDlet.java

• Run the Hello World MIDlet• Eclipse : Run -> Run As -> Emulated J2ME MIDlet

• It displays the Hello World screen!• It also prints some properties from your MIDlet (Only in console for debug)

Page 5: Scmad Chapter02

Configurations

• Introduction- Configurations•Configurations•Configurations – CLDC•Configurations – CDC•ME Platform

Page 6: Scmad Chapter02

Differences between JavaME and JavaSE/EE

•JavaSE: Single VM specification

•JavaEE: Same VM from SE, new API’s and execution environments

•JavaME: “Configurations-based” VM’s. There are several VM specifications, to support devices with distinct features, from cheap mobile phones to TV set-top-boxes with high-speed network and wired power supply.

Page 7: Scmad Chapter02

Configurations• Address “Horizontal” market segments (Based on the device features, e.g. processing power, available resources (memory, network, power))

• Define features supported by a VM (e.g. floating point support, security model) and basic API’s (e.g. classes at java.lang, java.util, java.io packages). They are composed by a subset of features from a regular VM and by some new API’s.

• Configurations cannot define any optional feature

Page 8: Scmad Chapter02

CLDC: Connected Limited Configuration

• Most limited configuration

• Devices: Mobile phones and PDA’s with limited power and connectivity

• Based on a subset of Java SE 1.3 API’s

•Defines an API for network communication, but does not define any protocol

• All other configurations are based on CLDC ( to avoid market fragmentation)

Page 9: Scmad Chapter02

CLDC - Security

• Simplified security model: All classes must be preverified and are executed on a restricted environment (sandbox):•User-defined class loaders are not allowed•All classes must be packaged on a single JAR (you cannot download classes or JAR’s from the network)•Java API classes cannot be replaced by the application•JNI is not allowed

Page 10: Scmad Chapter02

CLDC - Security

• Simplified security model: All classes must be preverified and are executed on a restricted environment (sandbox):•User-defined class loaders are not allowed•All classes must be packaged on a single JAR (you cannot download classes or JAR’s from the network)•Java API classes cannot be replaced by the application•JNI is not allowed

Page 11: Scmad Chapter02

CLDC - Security

Page 12: Scmad Chapter02

CLDC – Available resources

• No finalization (Object.finalize())• No file system (might no make sense on mobile phones)• No Reflection or Serialization• Network connectivity though javax.microedition.io (GCF) and not by java.net• Multi-Threading and synchronization features are identical to Java SE

Page 13: Scmad Chapter02

CLDC – API

• Missing several utility classes:• java.util.Properties• java.util.StringTokenizer• java.util.ResourceBundle

• No Collections Framework:• java.util.List• java.util.Iterator• java.util.Set•java.util.Map

• But Vector, Hashtable, Stack and Enumeration classes are available.

Page 14: Scmad Chapter02

CLDC – API

• API classes fit in two groups:• Inherited classes from Java SE:•At java.lang, java.io and java.util packages•Methods and attributes may have been removed (e.g. String.equalsIgnoreCase() on CLDC 1.0)• Java ME specifications WILL NOT add methods or classes to these packages

•CLDC-specific classes (Added to javax.microedition packages)

Page 15: Scmad Chapter02

CLDC – Versions

• CLDC 1.0• No floating point support• No Weak References support

•CLDC 1.1• Floating point support• Weak References support• Requires more memory than 1.0 (32 KB)

Page 16: Scmad Chapter02

CLDC – Differences (Brief Review)

Page 17: Scmad Chapter02

• Closer to the Java SE than CLDC• Devices: Set-top boxes and PDA’s • No need for preverification• Inherit additional API’s from Java SE

CDC: Connected Device Configuration

Page 18: Scmad Chapter02

Java Editions

Page 19: Scmad Chapter02

Profiles

• Introduction – Profiles and OP’s• Profiles• Optional packages• JTWI• Requirements

Page 20: Scmad Chapter02

Profiles

• “Vertical” market segments (Defined by device features, e.g. Mobile phones, PDA’s).• Define API’s for a range of devices (e.g. user interfaces, application life cycle, persistence, events, etc.)•May define optional features

Page 21: Scmad Chapter02

• MIDP (Mobile Information Device Profile)• Designed for mobile phones• Provides GUI, persistence, networking, multimedia• Depends on CLDC

• Personal Profile• Designed for PDA’s and Set-top boxes• Provides AWT for other Java SE API’s• Runs on CDC

Available Profiles

Page 22: Scmad Chapter02

• Defines supplementary API:•Bluetooth •3D Graphics•File system access•XML Parsing/ Web Services

• Shall be provided by the device vendor, so it’s not possible to “add the API classes” to the environment if you want to use them•OP’s may define optional features

Optional Packages

Page 23: Scmad Chapter02

•WMA (JSR – 120) – Wireless messaging API (SMS messages)• MMAPI (JSR-135) – Mobile Media API (support for audio, video and media capture)• PIM and File API (JSR-75) – Access to device’s file system and contact list.• Web Services (JSR-172) - SOAP calls and XML parsing• Java API’s for Bluetooth (JSR-82)• Scalable 2D Vector Graphics for Java ME (SVG Support) • Mobile 3D Graphics API for Java ME (JSR-184)• Mobile Internationalization API (JSR-238)

Optional Packages

Page 24: Scmad Chapter02

• Does not define any new API

• Define requirements over the other API’s aiming to reduce platform fragmentation (e.g. when you write an application inside the JTWI limits you can run it on any device that supports JTWI)

• Define also minimum requirements about hardware and performance

JTWI: Java Technology for Wireless Industry

Page 25: Scmad Chapter02

Comparing configurations and profiles

Page 26: Scmad Chapter02

Future Work

• Next Chapter:

• Introduction to MIDP (Mobile Information Device Profile)• MIDP - API’s• MIDlets and MIDlets Suites

Page 27: Scmad Chapter02

References

• ALVES F. Eduardo. SCMAD Study Guide, 27/04/2008.

• JAKL Andreas, Java Platform, Micro Edition Part 01 slides, 12/2007.

• Sun Certification Mobile Application Developer Website: [http://www.sun.com/training/certification/java/scmad.xml].