home
NEWS       BLOGS       FORUMS       NEWSLETTERS       RESEARCH       EVENTS       DIGITAL LIBRARY       CAREERS  
Network Computing Network Computing Powered by InformationWeek Business Technology Network

IMMERSE YOURSELF:

SOA

  |

Data Center

  |

802.11n

  |

Data Privacy

  |
APO  |

Virtualization

  |

NAC

  |

Security

  |

Network Mgmt

  |

Enterprise Apps

  |

Storage & Servers



Netdesign Manual

Part 4

Java XML Programmers Reference

Chapter 11: XML Tools for Information Appliances


October 15, 2001


Brought to you by:





Check It Out!

Here is the final installment of a 4-part chapter excerpt from the book Java XML Programmers Reference by Mohammad Akif, Steven Brodhead, Andrei Cioroianu, James Hart, Eric Jung and Dave Writz; ISBN 1861005202; published July 2001, 750 pages.

Sample Application: Contact Infrared Beamer

In this section, we'll show you how to install the Java KVM and Palm OS Emulator on your machine. Then we'll bring together some of the different technologies we've talked about in this chapter — Java and XML on a Palm OS device. We'll create a complete lightweight Java XML application using these tools:

  • Java KVM for J2ME — the Java Kilobyte Virtual Machine (KVM) is designed to operate with as little as 160 to 512 KB of total memory. See Java KVM.
  • NanoXML — a lightweight DOM-style XML parser and document generator. See NanoXML.
  • Palm OS Emulator (POSE) — software that emulates the hardware of different Palm devices (Palm III, Vx, VII, etc.). This will be our unit testing platform. See Palm OS Emulator.

The application allows data entry of contact information into a custom Palm database we'll call the contact book. The term database in Palm OS lingo is rather deceiving as there is no way to create and drop tables on the database. It's better to think of a Palm OS database as permanent data residing in a section of non-volatile memory. The section is comprised of variable-length records. Each record is a variable-length array of bytes. There aren't tables, columns, or rows in a Palm OS database at all. Nevertheless, database is standard terminology.


A Palm OS "database" is not a database in the traditional sense. Rather, it is a persistent store comprised of any number of variable-length records. Each record is a variable-length array of bytes up to 64KB.


Our application will beam contact information from a custom Palm database (called the "contact book") to the same database on another Palm OS device. Data will be packaged as an XML document on the sender's side, and received and parsed on the receiver's side. The user will then be prompted to accept the data into his contact book or not. If accepted, XML will be stored natively as a new record in the contact book database. The application also provides a mechanism to enter, search, view, and edit contact entries in the contact book database.



Setting Up the Environment

In this section, we'll walk through the setup and installation of the Java KVM and POSE.

CLDC and Java KVM

First, download the J2ME CLDC v1.0.2 (see CLDC), and the kjava overlay from:

http://www.sun.com/software/communitysource/j2me/cldc/download.html

Unzip j2me_cldc-1_0_2-fcs-winunix.zip first. Then unzip j2me_cldc-1_0_2-fcs-kjava_overlay.zip using the same directory base in which you unzipped the first file. Overwrite any existing files.

The first archive contains the CLDC reference implementation for Win32, Solaris, and Linux. It includes source code, runtimes, tools, and documentation for porting the CLDC to other platforms. This archive is designed to be used with a profile (see Profiles).

Since there is no PDA Profile implementation yet (see PDA Profile), we'll use the CLDC-compatible port for the Palm contained in the overlay archive. This is the second archive you downloaded, the kjava overlay. The overlay installs Palm-specific tools, samples, the all-important package com.sun.kjava (see Package com.sun.kjava), and KVM.prc — the Java KVM packaged as a Palm application.


The overlay is not intended to be used alone; it must be installed after and on top of the first archive, overwriting any existing files.


Palm OS Emulator (POSE)

We'll use the POSE as our testing platform as we write our code. The POSE runs on Win32, Solaris, or Linux (although you could compile it for another platform as the source code is available). Remember our application will beam addresses from one Palm OS device to another. Obviously, the POSE doesn't have an infrared port since it's just software. So to test the application fully you must have two Palm OS devices (Handspring Visors, Sony Cliés, or IBM Workpads are fine).

Step 1 — Install the Emulator

First, download the emulator from http://www.palmos.com/dev/tech/tools/emulator/. It is available for Windows (as a ZIP file), Macintosh (as a SIT file), and for UNIX (source code in a TAR that you must compile). Extract the file.

Step 2 — Obtain a ROM Image

Before the emulator will operate, it needs a binary image of the environment to be emulated. The base installation doesn't come with any ROM images. If you own a Palm OS device, you can download an image of that device's ROM using the emulator. Simply run emulator.exe, which was installed in Step 1, and select "Download a ROM image from a Palm OS device." Detailed instructions are then given; it's really quite a simple process.

If you don't own a Palm OS device, you can download a ROM image from the Palm web site (http://www.palmos.com/dev/tech/tools/emulator/#roms). You'll need to join the Palm Alliance Program, which simply requires you to fill out an online form.

Step 3 — Run the Emulator for the First Time

Now you should run emulator.exe, which was installed in Step 1. Click the new button, Start a new emulator session. Under ROM file, select Other and navigate to the .ROM file you obtained in Step 2. The device field should automatically populate, but if it doesn't, select the correct Palm device type. Leave skin as generic. Finally, select the RAM size that corresponds to the actual RAM of the device you are emulating (for example, if emulating a Palm Vx, you should set this value to 8192KB, click OK. The emulator will then start.

Step 4 — Install the Java KVM On the Emulator

Now we must load the virtual machine onto the emulator. Right-click anywhere on the emulator. From the pop-up menu, select Install Application/Database and Other. Navigate to j2me_cldc/bin/kjava/palm and select KVM.prc. The virtual machine will be installed. Now do the same for j2me_cldc/bin/kjava/palm/KVMutil.prc. KVMutil is a debugging utility that allows you to set the maximum heap size and screen output (System.out) options.


PAGE: 1 | 2 | 3 | 4 | 5 | 6 | 7 | NEXT PAGE
 





Ready to take that job and shove it?

Function:

Keyword(s):

State:
SPONSOR
RECENT JOB POSTINGS
CAREER NEWS
Go beyond Google and get vertical. These specialized search sites will help you find the business information you need -- fast.

Ari Balogh was named to the post of chief technology officer as the companys for a "realignment" of employees.










InformationWeek U.S. IT Salary Survey 2008
Salaries for business technology professionals are falling. Here's what you need to know in order to make good hiring decisions and personal career choices. Download Today
 
ROLLING RIGHT ALONG
Follow key Network Computing Reviews from conception to completion. This Week: Holistic APM.



Network Computing Reports Emerging Enterprise Podcast Series: Secrets to Success








TechSearch


Microsite of the Week


Powerful Information at Your Fingertips



InformationWeek Business Technology Network
InformationWeekInformationWeek 500InformationWeek 500 ConferenceInformationWeek AnalyticsInformationWeek CIO
InformationWeek EventsInformationWeek ReportsInformationWeek MagazinebMightyByte and SwitchDark Reading
Digital LibraryIntelligent EnterpriseInternet EvolutionNetwork ComputingNo Jitter
space
Techweb Events Network
InteropVoiceConWeb 2.0 ExpoWeb 2.0 SummitEnterprise 2.0 ConferenceMobile Business ExpoSoftware ConferenceCSI - Computer Security Institute
Black HatGTECEnergy CampMashup CampStartup Camp
space
Light Reading Communications Network
Light ReadingLight Reading EuropeUnstrungLight Reading's Cable Digital NewsConstantinopleInternet Evolution
Heavy ReadingLight Reading Live!Light Reading InsiderEthernet ExpoOptical ExpoTeleco TVTower Technology Summit
space
Financial Technology Network
Advanced TradingBank Systems & TechnologyInsurance & TechnologyWall Street & TechnologyAccelerating Wall StreetBank Systems & Technology Executive SummitBuyside Trading SummitInsurance & Technology Executive Summit
space
Microsoft Technology Network
MSDN MagazineTechNetThe Architecture Journal
space
App Infrastructure   |   Messaging & Collaboration   |   Network & Systems Mgmt   |   Network Infrastructure   |   Security  |   Storage & Servers   |   Wireless   |   Enterprise Apps
About Us  |  Contact Us  |  Site Map  |  Technology Marketing Solutions  |  Advertising Contacts  |   Briefing Centers
Copyright © 2008  United Business Media LLC  |  Privacy Statement  |  Terms of Service  |  Your California Privacy Rights