Home > Store > Programming > Java
Enterprise J2ME: Developing Mobile Java Applications
- By Michael Juntao Yuan
- Published Oct 23, 2003 by Prentice Hall.
- Copyright 2004
- Dimensions: 7 x 9 1/4
- Pages: 480
- Edition: 1st
- Book
- ISBN-10: 0-13-140530-6
- ISBN-13: 978-0-13-140530-1
Register your product to gain access to bonus material or receive a coupon.
Industrial-strength J2ME™ for enterprise developers, architects, and decision-makers
J2ME offers an extraordinarily flexible and robust platform for developing mobile applications with enterprise-class performance, reliability, and value. Now, leading mobile developer Michael Yuan covers every aspect of building industrial-strength applications with J2ME: design, architecture, tools, processes, business issues, and more.
Yuan introduces innovations that make the platform even more powerful, ranging from new J2ME profiles and wireless messaging APIs to mobile databases and web services tools. These innovations allow existing Java™ developers (especially J2EE™ developers) to leverage their skills and add mobility to enterprise applications. Yuan also presents more than a dozen complete sample applications—including the application that earned him the grand prize in Nextel, Sun, and Motorola’s nationwide wireless developer contest. Coverage includes:
- Patterns and best practices for building end-to-end mobile applications
- Emerging mobile “killer applications”: driving productivity and cost reduction
- “Smart client” applications: architecture and construction
- Advanced HTTP techniques for authentication and session tracking
- Overcoming hardware and network limitations
- Leading-edge mobile enterprise messaging techniques
- Mobile databases and synchronization engines
- XML and mobile web services, including the J2ME Web Services Optional Package
- New options for mobile security in the enterprise
Source Code
Download the complete source code and build instructions for the example applications related to this title.
Related Articles
Programming for the Mobile World
Using the Java Wireless Toolkit
Links
To facilitate your work with the resources mentioned in the text, below please find links to Web-based references mentioned at the end of the chapters.
Chapter 2
- Zelos Group mobile handset survey. http://www.microjava.com/articles/perspective/zelos/
- The early history of Java. http://java.sun.com/features/1998/05/birthday.html
- The Connected Limited Device Configuration (CLDC). http://www.jcp.org/en/jsr/detail?id=139
- The Connected Device Configuration (CDC). http://www.jcp.org/en/jsr/detail?id=36
- The Mobile Information Device Profile (MIDP). http://java.sun.com/products/midp/
- The PDA Profile (PDAP). http://www.jcp.org/en/jsr/detail?id=75
- The Foundation Profile. http://java.sun.com/products/foundation/
- The Personal Basis Profile (PBP) http://java.sun.com/products/personalbasis/
- The Personal Profile (PP) http://java.sun.com/products/personalprofile/
- The Game Profile. http://www.jcp.org/en/jsr/detail?id=134
- The Mobile Media API. http://java.sun.com/products/mmapi/
- The Mobile 3D API. http://www.jcp.org/en/jsr/detail?id=184
- The Wireless messaging API. http://wireless.java.sun.com/midp/articles/wma/
- The Location API. http://jcp.org/en/jsr/detail?id=179
- The J2ME Web services API. http://www.jcp.org/en/jsr/detail?id=172
- The Java API for Bluetooth. http://www.jcp.org/en/jsr/detail?id=82
- The Security and Trust Services API. http://www.jcp.org/en/jsr/detail?id=177
- The SIP API for J2ME. http://www.jcp.org/en/jsr/detail?id=180
- The JAIN SIMPLE Presence API. http://www.jcp.org/en/jsr/detail?id=164
- The JAIN SIMPLE Instant Messaging. http://www.jcp.org/en/jsr/detail?id=165
- The JAIN Presence. http://www.jcp.org/en/jsr/detail?id=186
- The JAIN Instant Messaging. http://www.jcp.org/en/jsr/detail?id=187
- Java Technology for the Wireless Industry (the road map). http://www.jcp.org/en/jsr/detail?id=185
- The RMI Optional Package. http://java.sun.com/products/rmiop/
- The JDBC Optional Package. http://java.sun.com/products/jdbc/
- Advanced Graphics and User Interface Optional Package for the J2ME platform. http://www.jcp.org/en/jsr/detail?id=209
Chapter 3
- The J2EE Reference Implementation (v1.3 is used in the example). http://java.sun.com/j2ee/download.html
- The Java Web Services Developer Pack (v1.0 is used in the example). http://java.sun.com/webservices/webservicespack.html
- The kSOAP J2ME SOAP parser. http://www.ksoap.org/
Chapter 4
- The Open Services Gateway initiative (OSGi). http://www.osgi.org/
- IBM WebSphere Studio Device Developer IDE (free evaluation). The page also contains a link to download the latest IBM Service Management Framework (SMF) software for free evaluation. http://www.ibm.com/embedded/
- The Espial DeviceTop is a client side OSGi container with GUI support. http://www.espial.com/index.php?page=sol_devices_suite_over
Chapter 5
- The Java wireless blueprint program. http://java.sun.com/blueprints/wireless/index.html
- The Smart Ticket v2.0 Early Access source code is available for download from the book's web site. http://www.enterprisej2me.com/
Chapter 6
- HTTP State Management using cookies. http://www.ietf.org/rfc/rfc2109.txt
- HTTP Authentication: Basic and Digest Access Authentication. http://ftp.ics.uci.edu/pub/ietf/http/rfc2617.txt
- Kenneth Ballard's HttpClient package. http://www.geocities.com/ballarke/Projects/HttpClient/
Chapter 7
- The Sun Wireless Java Blueprint: The Smart Ticket application demonstrates many of the best practices described in this chapter. http://java.sun.com/blueprints/wireless/
- The Sun J2ME Wireless Toolkit is a comprehensive collection of tools for MIDP development and performance tuning. http://java.sun.com/products/j2mewtoolkit/index.html
- The J2EE client provisioning specification defines a flexible server architecture for smart client provisioning and user tracking/billing services. http://java.sun.com/j2ee/provisioning/
- The Thinlet project creates a lightweight XUL (XML UI Language) toolkit that runs on both Personal Profile and MIDP devices. http://www.thinlet.com/
- The kCommand toolkit is an open source RPC framework for J2ME clients to execute remote commands on J2EE servers. http://www.developnet.co.uk/kcommand.htm
- Java blogger Charles Miller discusses HTTP conditional GET in his blog entry. http://fishbowl.pastiche.org/archives/001132.html
Chapter 8
- The SMTP specification. http://www.ietf.org/rfc/rfc0821.txt
- The POP3 specification. http://www.ietf.org/rfc/rfc1939.txt
- The IMAP specification. http://www.imap.org/
- The Mail4ME project. http://mail4me.enhydra.org/
- The JavaPhone API. http://java.sun.com/products/javaphone/
- The J2ME CLDC PDA Optional Package. http://jcp.org/en/jsr/detail?id=075
- Espial applications and SDKs. http://www.espial.com/
- ReqWireless libraries and applications. http://www.reqwireless.com/
- The BlackBerry Enterprise Server. http://www.blackberry.net/products/software/server/index.shtml
- The BlackBerry JDE documentation. http://www.blackberry.net/developers/na/java/doc/index.shtml
- The Sybase Mail Anywhere Studio. http://www.sybase.com/products/mobilewireless/ianywheremobilemail/
Chapter 9
- The J2ME Wireless Messaging API, reference implementation and documentation. http://java.sun.com/products/wma/
- JSR 205 develops WMA v2.0 specification which includes support for MMS. http://www.jcp.org/en/jsr/detail?id=205
- The MIDP specification including documentation of the PUSH architecture for MIDP v2.0. http://java.sun.com/products/midp/
- JSR 197: Generic Connection Framework Optional Package for J2SE. http://www.jcp.org/en/jsr/detail?id=197
- Object XP's jSMS package. http://www.objectxp.com/products/jSMS/
- Simplewire's Java SMS SDK. http://www.simplewire.com/developers/sdk/java/
- The Server API for Mobile Services: Messaging - SAMS: Messaging . http://www.jcp.org/en/jsr/detail?id=212
- All about Jabber. http://www.jabber.org/
- XMPP IETF drafts. http://www.jabber.org/ietf/
- Al Sutton's KVMJab library. http://www.alsutton.com/software/kvmjab/index.html
- Antepo PresenceWare and Jabber SDK. http://www.antepo.com/
- TipicME wireless proxy. http://www.tipic.com/index.php
- Uppli J2ME Jabber clients. http://www.uppli.com/
- Streampath SIM J2ME Jabber client. http://www.streampath.com/
- An introduction to SIP. http://www.cs.columbia.edu/sip/
- JSR 164: JAIN SIMPLE Presence. http://www.jcp.org/en/jsr/detail?id=164
- JSR 165: JAIN SIMPLE Instant Messaging. http://www.jcp.org/en/jsr/detail?id=165
- JSR 180: The SIP API for J2ME. http://www.jcp.org/en/jsr/detail?id=180
- The JXTA project. http://www.jxta.org/
- The JXME project. http://jxme.jxta.org/
Chapter 10
- The JMS home page. http://java.sun.com/products/jms/
- The iBus//Mobile wireless JMS solution. http://www.softwired-inc.com/products/mobile/mobile.html
- IBM WebSphere MQ Everyplace (WMQe). http://www-3.ibm.com/software/integration/appconn/wmqe/
Chapter 11
- The JDBC specification. http://java.sun.com/products/jdbc/
- The CDC JDBC optional package. http://java.sun.com/products/jdbc/download.html#cdcfp
- PersonalJava: find the supported JDBC API in JDK v1.1 and v1.2 in the documentation. http://java.sun.com/products/personaljava/
- The HSQL DB project (check out their Sharp Zaurus page!). http://hsqldb.sourceforge.net/
- The Sybase SQL Anywhere Studio (including Adaptive Server Anywhere and UltraLite Deployment Option). http://www.ianywhere.com/products/sql_anywhere.html
- IBM DB2 Everyplace. http://www-3.ibm.com/software/data/db2/everyplace/
- Oracle9i Lite database. http://otn.oracle.com/products/lite/content.html
- PointBase Micro database. http://www.pointbase.com/home.shtml
Chapter 12
- The PointBase Micro MIDP edition and the Lite API. http://www.pointbase.com/home.shtml
- SODA is included in the Oracle J2ME SDK. Download the SDK and documentation from the following web site. http://studio.oraclemobile.com/studio/sites/otn/j2me.html
- The IBM FastRecordStore is part of DB2 Everyplace. http://www-3.ibm.com/software/data/db2/everyplace/
Chapter 13
- The PointBase UniSync server JavaDoc. http://www.pointbase.com/support/docs/javadoc/UniSync/index.html
- The PointBase UniSync JDBC client API. http://www.pointbase.com/support/docs/javadoc/UniSyncMicroJDBC/index.html
- The PointBase UniSync Lite client API. http://www.pointbase.com/support/docs/javadoc/UniSyncMicroLite/index.html
- IBM DB2 Everyplace Sync Server. http://www-3.ibm.com/software/data/db2/everyplace/syncserver.html
- The Sybase SQL Anywhere Studio including MobiLink. http://www.ianywhere.com/products/sql_anywhere.html
- iAnywhere MobiLink tutorial. http://www.ianywhere.com/whitepapers/oracle_asa.html
- The Oracle9i Lite including the Mobile Server. http://otn.oracle.com/products/lite/htdocs/o9ilite_datasheet.htm
Chapter 14
- The Oracle J2ME SDK (including the SQL Web Services module). http://studio.oraclemobile.com/studio/sites/otn/j2me.html
- The Simplicity IDE from Data Representations. http://www.datarepresentations.com/
Chapter 15
- The Oracle J2ME SDK (including the SQL Web Services module). http://studio.oraclemobile.com/studio/sites/otn/j2me.html
- The Simplicity IDE from Data Representations. http://www.datarepresentations.com/
Chapter 16
- The kSOAP project (v1.2). http://ksoap.enhydra.org/
- kSOAP v2.0. http://www.ksoap.org/
- Google Web Services API. http://www.google.com/apis/
Chapter 17
- JSR 172: The J2ME Web Services Specification. http://www.jcp.org/en/jsr/detail?id=172
- Java API for XML Processing (JAXP). http://java.sun.com/xml/jaxp/index.html
- Java API for XML-based RPC (JAX-RPC). http://java.sun.com/xml/jaxrpc/index.html
- The SAX API. http://www.saxproject.org/
- The IBM Web Services Tool Kit for Mobile Devices provides an implementation for the J2ME Web Services Optional Package. http://www.alphaworks.ibm.com/tech/wstkmd
Chapter 18
- JSR 179: J2ME Location API. http://jcp.org/en/jsr/detail?id=179
- Microsoft MapPoint Web Services. http://www.microsoft.com/mappoint/net/
- Enhanced 911 services news. http://www.wirelessdevnet.com/e911/news.html
Chapter 19
- The Bouncy Castle project. http://www.bouncycastle.org/
- The IAIK JCE-ME library. http://jce.iaik.tugraz.at/products/10_me-jce/index.php
- Phaos Technology Micro Security products. http://www.phaos.com/products/category/micro.html
- NTRU toolkits. http://www.ntru.com/products/toolkits.htm
- The NTRU algorithms explained. http://www.ntru.com/cryptolab/algorithms.htm
- B3 Security. http://www.b3security.com
- You can download the iDEN J2ME SDK, including the cryptography API, from Motorola's iDEN phone developer Website. http://idenphones.motorola.com/iden/developer/developer_home.jsp
- Bruce Schneier's Applied Cryptography is a classic book that discusses all the algorithms (except NTRU) mentioned in this chapter. http://www.counterpane.com/applied.html
- To learn more about general security challenges and solutions for mobile Java applications, read Michael Yuan and Ju Long's article "Securing Wireless J2ME" (IBM developerWorks, June 2002). http://www-106.ibm.com/developerworks/wireless/library/wi-secj2me.html
- Security and Trust API for J2ME (JSR 177). http://www.jcp.org/en/jsr/detail?id=177
Chapter 20
- The Bouncy Castle project. http://www.bouncycastle.org/
- The IAIK JCE-ME library. http://jce.iaik.tugraz.at/products/10_me-jce/index.php
- Phaos Technology Micro Security products. http://www.phaos.com/products/category/micro.html
- NTRU toolkits. http://www.ntru.com/products/toolkits.htm
- RSA Security's Cryptography FAQ is a good introduction to modern cryptography solutions, including the Public Key Infrastructure: http://www.rsasecurity.com/rsalabs/faq/
- The NTRU algorithms explained. http://www.ntru.com/cryptolab/algorithms.htm
- The National Institute of Standards and Technology (NIST) PKI program home page. http://csrc.nist.gov/pki/
Online Sample Chapter
Overcoming Challenges in Mobile J2ME Development
Index
Download the Index
file related to this title.
Preface
About this Book
Target Audience
This book targets all mobile software developers and business decision makers. It focuses on end-to-end architectural patterns, best practices, key innovations, and real-world design approaches. For different readers, this book offers different benefits:
- Managers and entrepreneurs : This book is a comprehensive guide to mobile enterprise applications and the Java 2 Micro Edition (J2ME). It covers the capabilities, limitations, common best practices, and commercial solutions of the state-of-the-art mobile Java technologies. It helps you decide which mobile Java profile and products are the best for your business.
- Experienced mobile developers : This book skips the basic MIDP API tutorial materials and goes straight to the more advanced and more useful topics. It uses several complete sample applications to illustrate common architectural patterns and coding best practices in mobile enterprise applications. For developers who are looking for specific solutions (e.g., messaging, database, XML, and security), the technical discussions on leading third-party J2ME tools and libraries will prove useful. Those real-world innovations also serve as prime examples of how you should design and implement your own solutions for similar tasks.
- Experienced Java developers : For experienced Java enterprise developers (J2EE developers), the move to mobility is about leveraging existing skills. This book walks through familiar design patterns and best practices and shows developers how to apply them in mobile applications. Lightweight mobile versions of enterprise Java APIs (such as JDBC, Java servlet, JMS, and Java Cryptography Extension) are discussed. Those are excellent examples of how to scale down enterprise solutions for mobility while still preserving core functionalities. With a few notes on mobile-specific issues, it is the fastest path to add mobility to existing enterprise infrastructure.
Prerequisites
To fully understand the technical content in this book, the readers should be familiar with the basic Java 2 Micro Edition, Mobile Information Device Profile (J2ME/MIDP) APIs and development tools. A quick MIDP programming guide is provided in Appendix A.
To run the end-to-end sample applications, you will need to deploy the serverside components to your own Java application server and run the clientside components on the desktop emulator or real devices. Please refer to the product manuals of your tools for step-by-step instructions.
Although serverside Java is not the focus of this book, familiarity with basic Java 2 Enterprise Edition (J2EE) concepts such as servlets, Java DataBase Connectivity (JDBC), Java Messaging Service (JMS), Java XML processing, and Enterprise JavaBean (EJB), will help you understand various topics in this book.
Contents
This book is divided into six parts:
- Part I is the introductory material for mobile commerce, mobile enterprise applications, and J2ME. It covers the overall architecture, current status, and future roadmaps of J2ME.
- Part II is the heart of this book. It presents several example applications to illustrate the smart client mobile application paradigm, common architectural patterns, and best practices. It covers how to run container-managed applications (e.g., servlets) on PDA devices. It also presents a useful advanced HTTP client library for J2ME clients.
- Part III is about mobile messaging. In the mobile world, messaging clients are easy to use and fit into the mobile lifestyle. In the enterprise world, messaging is the best way to build loosely coupled applications that have guaranteed quality-of-service (QoS). This part of this book seeks to combine the best of the two worlds. It covers email and SMS-based end-to-end applications as well enterprise mobile messaging servers.
- Part IV discusses mobile databases that are core to occasionally connected and synchronization-based applications. This part covers commercial and open source innovations for mobile databases, synchronization engines, and legacy database connectivity. Two sample database applications from PointBase are presented.
- Part V covers how to integrate mobile clients into the enterprise Web services infrastructure. It discusses existing and emerging J2ME XML and SOAP toolkits, specifications and showcases several complete sample applications.
- Part VI is all you need to know about J2ME mobile security solutions. It goes way beyond the simple connection-based end-to-end solutions such as the HTTPS. This part covers open source and commercial cryptography toolkits for J2ME. Due to the complexity of cryptography APIs, API tutorials for each important toolkit are provided.
- There are two appendices to this book. One of them uses a simple end-to-end MIDP application to illustrate the whole development and deployment cycle. The other appendix introduces the IBM WebSphere Studio Device Developer IDE and provides undocumented instructions on how to install IBM J2ME runtimes on PocketPC devices.
Code Examples
This book uses complete example applications to demonstrate design patterns, best practices, and important API usages. Since this book discusses a wide range of technologies, innovations, and application scenarios, it is impractical to cover everything within a monolithic example. Instead, I decided to develop several small to midsize samples, each focusing on a particular topic. This approach allows the readers to partition the learning task and read one part of this book at a time.
The source code is presented in easy-to-digest segments that are relevant to the discussion text. Nonessential parts of the code (e.g., exception handling, importing packages) are often deliberately omitted from the listings for clarity. Hence, the printed listings are suffcient for understanding the ideas but are not directly runnable code.
- iFeedBack : The grand prize winner of the NexTel/Motorola/Sun wireless application contest in 2002 (Chapter 3).
- Echo : A GUI client and a service running in an OSGi clientside container (Chapter 4).
- Pizza Order : An example included in the IBM Service Management Framework download. It demonstrates how to build smart clients with HTTP front ends (Chapter 4).
- Smart Ticket : The Sun Wireless Blueprints application v2.0 early release code (Chapter 5).
- HttpClient : The code for the advanced HTTP library we develop in this section (Chapter 6).
- Mail : An MIDP email client based on the Mail4ME v1.0 library (Chapter 8).
- WMATester : A simple messaging application that illustrates the use of Wireless Messaging API v1.0 (Chapter 9).
- ContactManager : A mobile address book based on the PointBase v4.5 library (Chapter 11).
- ContactManagerSync : A synchronized mobile address book based on the PointBase v4.5 library (Chapter 13).
- AmazonExample : An kXML client for AmazonWeb services using both kDOM and XmlPull APIs (Chapter 15).
- PeekAndPick : A RSS reader for mobile phones developed by Jonathan Knudsen (Chapter 15).
- Google : A simple client for the Google Web services API. Both kSOAP v1.2 and v2.0 versions are available (Chapter 16).
- SmartPhrases : An integrated Google search and online dictionary application (Chapter 16).
- MapPoint AxisFacade : An Apache Axis facade for MapPoint v3.0 Web services (Chapter 18).
- MapPoint AxisClient : Personal Profile and MIDP clients for the Map-Point facade (Chapter 18).
- MobileSecurity : A collection of small applications that demonstrate the correct usage of cryptography APIs (Chapter 20).
- SimpleDemo : A simple MIDP application to illustrate key concepts and APIs in MIDP programming (Appendix A).
Commercial Products
This book covers and compares more than 30 toolkits and libraries from more than a dozen third-party vendors. The descriptions and API usage examples of those products are intended to give the readers a solid technical ground to make informed comparisons and decisions. They also serve as realworld examples for API and tool designs. However, they do not substitute for the formal product documentation from the vendor. I strongly encourage interested readers to obtain the latest evaluation package and documentation from the vendor to investigate further.
Related Publications
Some of the materials used in this book are loosely based on articles I published previously on several online magazines.
- The Sun Smart Ticket blueprint discussed in Chapter 5 is also covered in “End-to-End J2ME Application Development by Example,” published on the Sun Wireless Java Web site in June 2003.
- The first half of Chapter 9 is also covered by “Mobile P2P messaging, Part 1,” published on IBM developerWorks in December 2002.
- Examples in Part IV are adapted from “High-availability mobile applications,” published on JavaWorld in June 2003.
- Chapter 16 is based on “Access Web services from wireless devices,” published on JavaWorld in August 2002.
- The example in Chapter 18 is adapted from “Let the mobile games begin, Part 2,” published on JavaWorld in May 2003.
- Part VI is loosely based on “Data security in mobile Java applications,” published on JavaWorld in December 2002.
Production Notes
This book is produced by the Latex typesetting system on a 1GHz Apple PowerBook running Mac OS X—the best consumer operating system ever produced. Microsoft Word is used for collaborative editing and reviewing. The figures are made with Microsoft Visio, OmniGra2e, GIMP, and the ImageMagick utilities.
The example applications are developed using a variety of development tools, including VI, JEdit, IntelliJ IDEA, and the WebSphere Studio Device Developer IDE. Apache Ant is used to build the applications. Mobile clients are tested on many vendor SDKs, including those from Sun Microsystems (the J2ME Wireless ToolKit), IBM (the WebSphere Micro Environment), Nokia, and Motorola. Real device testing was conducted on Motorola i95cl, Nokia 7210, Nokia 6800, and PocketPC Phone devices.
Table of Contents
Foreword.
About the Book.
Acknowledgments.
I. INTRODUCTION.
II. END-TO-END ENTERPRISE APPLICATIONS.
III. MOBILE MESSAGING APPLICATIONS.
IV. MOBILE DATABASES AND SYNCHRONIZATION ENGINES.
V. XML AND MOBILE WEB SERVICES.
VI. ADVANCED MOBILE SECURITY.
Downloadable Sample Chapter
Download the Sample
Chapter related to this title.
This book includes Instant Online Access with
and free shipping!
Instant Online Access with Safari Books Online
With your book purchase you are entitled to free, instant online access to that book on Safari Books Online for 45 days. After you've completed your purchase, you will receive instructions on how to log into Safari Books Online. If you do not want to receive online access to the book, simply uncheck the box for Instant Online Access in your cart.
- Save more by becoming a member.
- Request an Instructor or Media review copy.
- Corporate, Academic, and Employee Purchases
- International Buying Options
Online access to books, videos, and tutorials from Addison Wesley, Prentice Hall, Cisco Press, IBM Press, O'Reilly Media and others - starting as low as $22.99. Learn more and start a free trial.



Account Sign In
View your cart