21
© 2009 by Motorola and Sybase; made available under the EPL v1.0 | Date March 26 th . Multi-Configuration Support for MTJ (Mobile Tools for Java) Feng (Marvin) Wang Gang (Allen) Ma Gustavo de Paula

Multi-Configuration support in MTJ

Embed Size (px)

DESCRIPTION

EclipseCon 2009 presentation

Citation preview

Page 1: Multi-Configuration support in MTJ

© 2009 by Motorola and Sybase; made available under the EPL v1.0 | Date March 26th.

Multi-Configuration Support for MTJ (Mobile Tools for Java)

Feng (Marvin) WangGang (Allen) Ma

Gustavo de Paula

Page 2: Multi-Configuration support in MTJ

2 Multi-Configuration support in MTJ | © 2009 by Motorola and Sybase; made available under the EPL v1.0

Agenda

DSDP MTJ Overview Device Fragmentation Problem Possible Solutions Java preprocessing Multi-Configuration Concepts & Use cases Code assist Demo

Page 3: Multi-Configuration support in MTJ

3 Multi-Configuration support in MTJ | © 2009 by Motorola and Sybase; made available under the EPL v1.0

DSDP MTJ Overview

Glue between the Eclipse IDE and the JavaME SDKs (emulators) MTJ does NOT provide the SDKs Each vendor provides their own SDKs MTJ provide the basic developer workflow

Import JavaME SDK (each SDK has several devices associated to it)

Create MIDlet Suite Project

Build Project

Create Deployment Package

Eclipse Platform

JDT

MTJSDK

Extens.

Vendor AJavaME SDK

Vendor BJavaME SDK

Vendor CJavaME SDK

UEI

VendorProprietaryProtocol

UEI

Page 4: Multi-Configuration support in MTJ

4 Multi-Configuration support in MTJ | © 2009 by Motorola and Sybase; made available under the EPL v1.0

Device Fragmentation Problem

1 Billion JavaME Devices

Hardware Software Carrier

• Display size, color• Number of keys• Accelerometer

• Different APIs• APIs with optional Components• Proprietary APIs

• File name Requirements• Localization • MIDlet Requirements

Hard to do ProfessionalJavaME Development

Fra

gmen

tatio

n

Page 5: Multi-Configuration support in MTJ

5 Multi-Configuration support in MTJ | © 2009 by Motorola and Sybase; made available under the EPL v1.0

Possible Solutions

Standardize everything

Almost impossible to happen Everyone wants to be different Applications want to use

device specific features

Live with the problem and adapt

Old and good preprocessing Not available in standard Java There are some external

preprocessing solutions

Device Database There are databases on the

internet (proprietary and GPL) MTJ can import databases

Page 6: Multi-Configuration support in MTJ

6 Multi-Configuration support in MTJ | © 2009 by Motorola and Sybase; made available under the EPL v1.0

MTJ

MTJ Approach: Live with the Problem and Adapt

Antenna preprocessorJava Code Preprocessor

Multi-Configuration

Preprocessor Code Assist

Each project can have multiple runtimes

Each runtime defines preprocessor tags (Symbols)

Symbols are used on the code assist

Page 7: Multi-Configuration support in MTJ

7 Multi-Configuration support in MTJ | © 2009 by Motorola and Sybase; made available under the EPL v1.0

Antenna Preprocessor

Antenna is a open source project created on 2002 (http://antenna.sourceforge.net/)

Defines several JavaME build related tools Build, Obfuscate, Package, Sign, Deploy and Preprocess

Preprocessor defines Preprocessor language

Input java code with preprocessor symbols

Output preprocessed java code

//#if ScreenWidth>100 && ScreenHeight>120 do something;//#else do something else;//#endif

Page 8: Multi-Configuration support in MTJ

8 Multi-Configuration support in MTJ | © 2009 by Motorola and Sybase; made available under the EPL v1.0

Multi-Configuration Concepts: Devices

The DeviceImporter knows how to “talk” to one SDK Returns all Devices that one SDK have

Each device has a DeviceClasspath associated to it ... and a list of APIs

Devices are persisted on the DeviceRegistry

Page 9: Multi-Configuration support in MTJ

9 Multi-Configuration support in MTJ | © 2009 by Motorola and Sybase; made available under the EPL v1.0

A Symbol is a pair <name; value> Symbols are organized in SymbolSets Each SymbolSet has a name and a list of

Symbols i.e.:

Symbols: <screen.width;240>, <screen.height;320>

Symbol set: <MOTV3; <screen.width;240>, <screen.height;320>>

SymbolDeviceFactory can import devices database and same them on the workspace

Multi-Configuration Concepts: Symbols

Page 10: Multi-Configuration support in MTJ

10 Multi-Configuration support in MTJ | © 2009 by Motorola and Sybase; made available under the EPL v1.0

A MTJ project has a list of MTJRuntimes Each project has a current active Runtime

Each Runtime has A Device

A project symbol set (created based on the device properties)

A list of workspace SymbolSets

Multi-Configuration Concepts: Runtimes

Page 11: Multi-Configuration support in MTJ

11 Multi-Configuration support in MTJ | © 2009 by Motorola and Sybase; made available under the EPL v1.0

Multi-Configuration Use Cases: Manage Configurations

Create Project Wizard Add, Remove, Edit

Select one to be the active

Page 12: Multi-Configuration support in MTJ

12 Multi-Configuration support in MTJ | © 2009 by Motorola and Sybase; made available under the EPL v1.0

Multi-Configuration Use Cases: New/Edit Configuration

Select SDK/Device associated to this configuration

SymbolSet associated to chosen Device

Workspace level SymbolSets (imported from device database)

Page 13: Multi-Configuration support in MTJ

13 Multi-Configuration support in MTJ | © 2009 by Motorola and Sybase; made available under the EPL v1.0

Multi-Configuration Use Cases: Switch Configuration

Switch active configuration or manage current configurations

Page 14: Multi-Configuration support in MTJ

14 Multi-Configuration support in MTJ | © 2009 by Motorola and Sybase; made available under the EPL v1.0

Multi-Configuration Use Cases: Build Project

All configurations are build on the same time

Export antenna build files to be called externally

One build for each configuration JAR/JAD

Code is preprocessed

Build files and symbol files for each configuration

Page 15: Multi-Configuration support in MTJ

15 Multi-Configuration support in MTJ | © 2009 by Motorola and Sybase; made available under the EPL v1.0

Content Assist Preprocess

Help user to input preprocess code in Java Editor Preprocess code format

Directives

Symbols

Operators

Values All preprocess code starts is “//#”

//#ifdef mmedia //#ifdef nokia //#if s60_ver=="1.0" import com.nokia.mmapi.v1 //#elif s60_ver=="2.0" import com.nokia.mmapi.v2 //#else import com.nokia.mmapi.def //#endif //#else import javax.microedition.mmapi //#endif//#endif

Page 16: Multi-Configuration support in MTJ

16 Multi-Configuration support in MTJ | © 2009 by Motorola and Sybase; made available under the EPL v1.0

Content Assist Directives

All available directives are presented Brief description of each directive

Page 17: Multi-Configuration support in MTJ

17 Multi-Configuration support in MTJ | © 2009 by Motorola and Sybase; made available under the EPL v1.0

Content Assist Symbols

All symbols provided by all configurations registered on the project are presented

Each symbol has Name, Value, if active, provider information

Page 18: Multi-Configuration support in MTJ

18 Multi-Configuration support in MTJ | © 2009 by Motorola and Sybase; made available under the EPL v1.0

Content Assist Templates

Propose preprocess template for the user.

After apply:

Page 19: Multi-Configuration support in MTJ

19 Multi-Configuration support in MTJ | © 2009 by Motorola and Sybase; made available under the EPL v1.0

Content Assist Templates

Manage current templates Create new templates

Edit current templates

Page 20: Multi-Configuration support in MTJ

Multi-Configuration support in MTJ | © 2009 by Motorola and Sybase; made available under the EPL v1.0

Demo & Thanks!

DSDP MTJ Web site: www.eclipse.org/dsdp/mtj

DSDP MTJ Wiki: http://wiki.eclipse.org/DSDP/MTJ

Newsgroup: news://news.eclipse.org/eclipse.dsdp.mtj

Developer List: http://dev.eclipse.org/mailman/listinfo/dsdp-mtj-dev

Page 21: Multi-Configuration support in MTJ

21 Multi-Configuration support in MTJ | © 2009 by Motorola and Sybase; made available under the EPL v1.0

Wish list…

Preprocess Resources Preprocess full java files Preprocess JAD file Sign based on configuration Improve error handling