scmad chapter02

Post on 25-May-2015

1.103 Views

Category:

Technology

2 Downloads

Preview:

Click to see full reader

DESCRIPTION

SCMAD - Chapter 02 (Only for studies purposes)

TRANSCRIPT

By Marcel Caraciolo

http://mobideia.blogspot.com

Chapter 02 – Configurations and first application

SCMAD Certification 45mm

61m

m

Agenda

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

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/

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)

Configurations

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

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.

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

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)

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

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

CLDC - Security

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

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.

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)

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)

CLDC – Differences (Brief Review)

• 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

Java Editions

Profiles

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

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

• 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

• 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

•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

• 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

Comparing configurations and profiles

Future Work

• Next Chapter:

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

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].

top related