Sun Logo


Porting Guide

Sun Javatrademark Wireless Client Software 2.0

Java Platform, Micro Edition

05-2007



Contents

Preface

1. Software Overview

Specifications and APIs

Architecture

MIDP Services and Subsystems

Components

Control Flow

Device Interactions

2. Hardware and Software Requirements and Constraints

Data-Type Assumptions

Resource Limitations

Native Stack Size

AMS Resource Limitations

RMS Resource Limitations

Networking Resource Limitations

Graphics Resource Limitations

Other Resources

3. File Organization and Naming

Source Code Organization

Naming Convention for Native Files

JavaCall API Directory Structure

4. Runtime Security

Design Considerations

Native VM Startup Code and MIDlet Suite Loader

Class Loader

Security Token

Using the Service

Classes Protected by Security Tokens

Classes Used by Internal MIDlets

5. Managing Properties and Constants

Introduction

Design

Input Files

Properties

Modifying Properties

procedure iconsmall spaceAdding Properties

Constants

Modifying Constants

procedure iconsmall spaceAdding Constants

Changing the Output Format of Constants

6. Porting Strategy

Build the Software on the Reference Platform

Run TCKs on the Reference Port

Set Up and Configure Your Device Development Environment

Port the JavaCall API

Port PCSL

Port CLDC HotSpot Implementation

Enable PCSL

Normal and Slave Modes

Test Programs

Implement Native PCSL Functionality and Expand Testing

Initial TCK Testing

Port MIDP

Build MIDP

Normal and Slave Mode Event Handling

Run a Test MIDlet

Graphics, Image and Fonts

User Input Handling

High-Level UI

Networking

RMS

AMS and System Integration

Run the MIDP TCK

Run the Java Device Test Suite Software

Enable the Multitasking Feature

Port the Optional Packages

7. Porting the JavaCall API

Structure and Naming

Understanding the Event Module

8. PCSL

PCSL Print Library

PCSL Memory Allocation Library

Porting malloc-Based Implementations

Porting the Heap-Based Implementation

PCSL File System Interface

PCSL Networking Library

Handles and Contexts

Alternative Networking Implementations

BSD Implementations

Socket-over-Serial Implementation

Notification

PCSL String Library

9. Porting the Networking Subsystem

Generic Connection Framework and Protocol Implementations

Porting the Networking Subsystem

General Porting Considerations

Porting Considerations for HTTP

HTTP Requests Using Proxies

HTTP1.1 Persistent Connections

Porting Considerations for HTTPS

Porting HTTPS

Using the Java Wireless Client Software SSL Implementations

Porting Considerations for Server Socket

References

10. Porting the Event Processing Service

Event System

procedure iconsmall spaceSubmitting Native Events

Complete the Event Fields

Locking

Setting the MAX_EVENTS Constant

Types of Event Systems

Normal Mode

Slave Mode

Choosing Normal or Slave Mode

11. Native Resource Management for Multitasking

Fixed Resource Policy

Open Resource Policy

Porting

12. PutPixel Technology

Porting

Building

Testing

Tuning

13. Low-Level Graphics and Images Services

Description

External Interactions

Design

Graphics Rendering Component

Primitive Graphics Routines and Porting

Design Rationale, Notes, and Considerations

Graphics Context Component

Detailed Design

Image Component

Preprocessor Component

Decoder Component

Accessor Component

Image Storage Component

Renderer Component

Porting

Porting the Primitive Graphics Group

Porting Checklist for Primitive Graphics

Drawing Graphics Primitives

Porting Image Manipulation Group

Mutable and Immutable Images

Porting Checklist for the Image Manipulation Group

Functions to Port

procedure iconsmall spaceFacilitating Porting of the Image Manipulation Group

String and Font Drawing and Accessing Group

Alert Sound Group

Vibrate and Backlight Group

Backlight Control Methods

Backlighting Porting Interface

Strategies for Porting Backlighting

Backlighting Duration

Vibration Control Methods

Vibration Porting Interface

Vibration Support

Network Indicator

Porting Strategies

Porting Issues

Porting Verification

Error Checking

Boundary Cases

Performance Tuning

14. Games

Engineering and Device Requirements

Design

Sprites and Tiled Layers

Example Sprite

Example Tiled Layer

Layer Manager Component

Game Canvas Component

Design Rationale, Notes, and Considerations

Porting

Porting GameCanvas

Porting Sprite and TiledLayer

15. Implementing the High-Level UI Using Adaptive User Interface Technology

Design

Customization

Property Loading and Skin Customization

Image Usage and Support

Compressed Images Compared With Uncompressed Images

ROMized Images Compared With File System Images

Storing Image Resources in the File System

Storing Image Resources in the ROM

RAW Format Platform Specification

Porting Steps

16. Implementing the High-Level UI Using Platform Components

Overview

Component Dependencies

Porting Steps

Testing

17. Porting the Record Management System

Design

Design Overview

External API and the Sandbox

Detailed Design

Design Rationale, Notes, and Considerations

Database Implementation

Detailed Design

Design Rationale, Notes, and Considerations

File System Access

Porting

18. Permission Management

Design Overview

Security Handler

Permissions

Design Rationale, Notes, and Considerations

New Permissions

procedure iconsmall spaceAdding a New Permission

New Domains

procedure iconsmall spaceAdding a New Domain

Using Permissions for Internal MIDlets

19. Application Management with the Java Platform

Native AMS

AMS Functionality

External Interactions With AMS

Porting and Customizing

Strategies for Porting the AMS

Strategies for Customizing the AMS

Things to Consider

Configuration Examples

20. MIDlet Auto Invocation

Design

Design Overview

Push Connection States

Design Rationale, Notes, and Considerations

Porting

Protocols

Listening for Incoming Data

Message Buffering

User Interaction

MIDlet Concurrency

procedure iconsmall spaceAdding Network Protocols for Push

21. Porting the User Message Bundle Service

Design

Access Module

Behavior Module

Decoder-Encoder Component

Design Rationale, Notes, and Considerations

Porting

procedure iconsmall spaceAdding Additional Message Strings

Supporting a New Locale

procedure iconsmall spaceSupplying Locale-Specific Strings

Adding a Character Encoding

22. Using the Logging and Tracing Service

Using the Logging and Tracing APIs

Logging

Adding Logging Channels

Tracing

A. Performance Notes

Application Startup Time

Measuring Startup Time

Handling Startup Time Variance

Starting an Application

Optimizing a MIDlet for Improved Application Startup Time

Optimizing the System for Improved Application Startup Time

Minimizing the Static Initialization of System Classes

Controlling the JIT Compiler and Ahead-of-Time Compilation

Giving the VM Hints

Disabling the Class Verifier

Caching Images

procedure iconsmall spaceCaching JAR File Entries

Runtime Performance

Performance Metrics

procedure iconsmall spaceProfiling the System

Runtime Optimizations

Caching

Indexing

Buffering

Memory Footprint

procedure iconsmall spaceMeasuring Footprint

Minimizing Static and Dynamic Footprint

Heap Capacity for the Java Platform

procedure iconsmall spaceMinimizing the Space Used by AOT and JIT Compilation

Minimizing Full Garbage Collections at Startup

Summary

Glossary

Index