Multi-Configuration support in MTJ
-
Upload
gustavoeliano -
Category
Documents
-
view
708 -
download
2
description
Transcript of 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
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
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
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
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
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
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
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
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
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
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
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)
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
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
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
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
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
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:
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
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
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