Welcome!

Java IoT Authors: Pat Romanski, Elizabeth White, Liz McMillan, Yeshim Deniz, Mehdi Daoudi

Related Topics: Java IoT

Java IoT: Article

Building End-to-End Palm Applications Using Java

Building End-to-End Palm Applications Using Java

In the past, mobile warriors were the only ones who relied on portable information technology. Since PalmOS, RIM, and WindowsCE devices penetrated corporate walls, it’s no longer unusual to have over 60% of corporate employees using PDAs and handheld devices for time management.

Indeed, Franklin-Covey, one of the world’s largest providers of time-management tools, adopted the medium and made it a large part of their overall toolkit.

As with all great technologies that improve productivity, it’s taken the enterprise quite a bit of time to catch up and analyze what’s happening right under their noses. So employees have fortified themselves with the ultimate arsenal for the dissemination of corporate information. Now comes the real trick for corporate IT departments – how to build and deploy applications on PDA/handheld platforms that support management’s goal of providing employees with corporate information when they’re away from their desktops.

This will truly be one of the most complex endeavors for IT departments (since the proliferation of desktop operating systems). There are three versions of Palm operating systems, two of RimOS, and three of WindowsCE. Each version has varying capabilities and functions. In addition, Palm has licensed their operating system to other vendors who have added their own capabilities for their own devices. Kyrocera and Handspring are two examples.

The industry faced a similar situation when Java first arrived on the scene with a solution for cross-platform application development. Well, once again Java is offering an opportunity for cross-platform application development on PDAs and handheld computers.

The Java 2 Micro Edition (J2ME) is a Java 2 platform used in small footprint devices, such as PDAs, phones, and appliances. The goal of J2ME is to separate the set of usable APIs into groups based upon device functionality. These groups are defined as “profiles” and allow applications to be designed for specific sets of capabilities.

There’s basically one choice for developers who want to build cross-platform applications for RIM and PalmOS devices: the Mobile Information Device Profile (MIDP). I doubt anyone reading this article would expect to find a WindowsCE solution here, although I won’t rule out that an implementation of MIDP for WindowsCE might already exist.

The Application
After downloading and installing the sample applications that come with the MIDP implementation for PalmOS from Sun’s Web site (http://java.sun.com/products/j2mewtoolkit/ ), I decided to build a J2ME application (MIDlet). This entailed studying the MIDP specification, which provided some basic direction but also required significant testing with the individual platforms to really understand how they would impact the user.

The application I chose to build is called SecurePad. I chose it because I hate locking my Palm (since it makes it a real pain to use), but I don’t want confidential information in the open if I should lose my device. SecurePad requires the user to enter a password before being placed in a memo pad list screen. That password is then used to encrypt/decrypt all messages for that session. This approach yielded some interesting side effects, as it allowed me to have a different password for each note if I so chose.

The key to SecurePad is the integration with Palm conduits, which allows the entire pad to be uploaded from or downloaded to the desktop without first being decrypted. This is a critical part of building an end-to-end Palm application as it’s possible for the Palm to corrupt data or need a hard reset, which would erase everything in memory.

The Results
J2ME applications definitely don’t look or feel like native PalmOS applications. After years of hearing that Java applications don’t look and feel like Windows applications, this should come as no surprise to Java developers. My biggest complaint was that all field-based input had to be provided through the use of a Form object, which requires the form to occupy the entire screen. And there are only a small, fixed number of items to choose from for screen objects, but the basics such as lists, buttons, and images are there.

Note: The current MIDP version used for the Palm also needs to operate on cellular phones and similar types of equipment that have a lot less screen space and a very mundane entry system. The Sun community is working on a different profile that fits a much more powerful class of devices.

SecurePad uses a basic XOR encryption scheme and operates directly on byte arrays. Still, this modest amount of memory access and mathematical computation appears to make my Visor Prism seem like an IBM PC XT loading up Lotus 123 off a floppy disk. I’ve since been testing with a C++ version of the application and the encryption/decryption algorithm works considerably faster than under Java.

Palm’s Java interface for developing conduits is an extremely useful tool. From the Palm Web site I was able to download the Conduit Development Kit (CDK), which includes the Java interface, documentation, usable sample code, and a redistributable component for installing and using Java conduits on users’ desktops. All things considered, it took only a few hours to transform their TEXTCOND sample application into a usable conduit for SecurePad (see Figures 1–3).

The How-To
To build an end-to-end application for the PalmOS in Java you’ll need the following items:

1. The PalmOS emulator and a PalmOS ROM file: If you have a serially connected base, you can download the ROM from your own Palm device. If you have a USB-connected base, it may be difficult to download the ROM from your Palm to your desktop.

2. The J2ME Wireless Toolkit: The toolkit ships with emulators for cellular phones and can integrate into the PalmOS emulator.

3. The Java VM for PalmOS 1.0: This VM conforms to the MIDP and you’ll need to install this on your Palm before you can load and run MIDlets.

4. The Palm Conduit Development Kit 4.0

The J2ME Wireless Toolkit (J2MEWTK) supports Sun’s Forte development tool; however, I was unable to get the complete environment working and found it easier to use Sun’s KToolbar application that ships with the J2ME Wireless Toolkit. The KToolbar application performs the necessary builds of the application and creates the .JAD manifest file for the MIDlet.

The J2MEWTK also comes with tools to transform .JAD and .JAR files into .PRC files for uploading into the Palm. An automated tool comes with a graphical user interface that can be launched though the J2MEWTK utilities. However, this application frequently failed and I ended up generating the .PRC from the command line. This is a very important point if you’re using a conduit with your application, since the creator ID on the Palm application is used to identify which conduit to call upon synchronization. The command-line application is the only way to apply a creator ID to your MIDlet. We’ll review this further when discussing how to build the end-to-end application.

Developing the application
A key thing to know about designing your J2ME application for the PalmOS is that when the application exits, it’s over. As you read through the documentation you’ll see that the MIDP profile supports a paused state for the application. This initially led me to believe that the Palm application would run in the background and, therefore, I designed the first incarnation of SecurePad around that thought.

Now, having delved a little deeper into the workings of the Palm, I understand that it’s the responsibility of the application to store and retrieve its state upon exit and reentry. However, J2ME developers will need to use a database record to make this happen because MIDP doesn’t provide access to the properties database on the Palm, which is where this information would typically be stored.

All MIDlets start by extending the javax.microedition .midlet.MIDlet class. This enables the Palm to launch the application. Once launched, it’s up to the developer to set the current screen. Building a MIDlet reminded me of the Macintosh Hypercard programming motif – essentially, screens are stacked and unstacked with the current screen controlling which screen should be next. This is only one model; the user could have the controlling class make all decisions on screen based on state information.

If the application requires persistent storage on the device, the MIDP provides the RecordStore, a nice abstraction of the underlying database mechanics of the Palm. It’s a fairly good representation of the Palm’s native database management capabilities and is extremely easy to use. However, just like JDBC, remember to close your database before exiting the application. I witnessed some strange behavior on the emulator when previous instances didn’t close the RecordStore.

Listing 1 illustrates how to create a new form and read records from the database. (Listings 1–2 can be downloaded from www.sys-con.com/java/sourcec.cfm .)

For debugging I used the phone emulators during development stages since they leveraged KToolbar’s console to deliver messages sent to System.out and System.err. The Palm emulator won’t perform this function, making debugging very difficult. To debug the few things on the Palm that I had to, I built Alert dialogs and displayed them.

Preparing the application for deployment
After the application is built and tested, the KToolbar application will generate a .JAD and .JAR file for you. These files will be stored in the application’s bin directory. To synchronize this application with your Palm, create a .PRC file. The J2MEWTK contains a utility in the C:\J2mewtk\wtklib\devices\PalmOS_Device directory to transform .JAR files into .PRC files. The following command performs this task for you:

java -jar C:\J2mewtk\wtklib\devices\PalmOS_Device\
MakeMIDPApp.jar -creator [creatorID] \
-JARtoPRC [JAR file] [main class]

For example:

java -jar C:\J2mewtk\wtklib\devices\
PalmOS_Device\MakeMIDPApp.jar -creator spad \
-JARtoPRC SecurePad.jar com.comtellect.securepad.SecurePad

(Don’t enter the \ in the above command, it’s just there to illustrate that the command is entered on a single line.)

Designing and building a conduit in Java
The CDK allows developers to use the Java programming language to build applications that will synchronize data with the Palm. This is a very powerful tool that has a proprietary API and allows full use of the J2SE environment.

There are two distinct components to building the conduit:

1. Installing the conduit into the HotSync Manager environment

2. Accessing data on the Palm during a HotSync operation

There’s an API that allows developers to call the HotSync Manager functions for registration and removal. The CDK comes with a graphical utility for Windows called CondCfg.exe. This program lists all the current conduits registered and allows you to add and change their details.

Conduits have two entry points, one for configuration and one for execution. When the HotSync Manager locates an application database with a matching creator ID in its registry, it executes the conduit associated with that ID. Upon execution, the HotSync Manager calls the open() function on your conduit. Pay attention to the direction of the synchronization as it’s passed in. This parameter is set by the user through the HotSync Manager if your conduit allows configuration.

The SyncManager object enables the conduit developer to read and write database records directly inside the Palm. However, the conduit must know the format of the database records in order to operate over them. Listing 2 illustrates uploading or downloading information on the Palm.

Conclusion
RIM will be shipping a fully functional version of their MIDP implementation, providing developers with a wider array of platforms to deliver their J2ME apps to. Eventually, both RIM and PalmOS will hopefully gain more powerful profiles based on the CDC. MIDP is now based on the CLDC.

While writing this article I quickly became aware of how much is involved in building an end-to-end application for the PalmOS. In the end, I focused on some key points I thought would help speed developers on their way and covered some of the hurdles I encountered to get my application to run. Overall, the experience of building an end-to-end Palm application in Java was a worthwhile and useful experience.

More Stories By JP Morgenthal

JP Morgenthal is a veteran IT solutions executive and Distinguished Engineer with CSC. He has been delivering IT services to business leaders for the past 30 years and is a recognized thought-leader in applying emerging technology for business growth and innovation. JP's strengths center around transformation and modernization leveraging next generation platforms and technologies. He has held technical executive roles in multiple businesses including: CTO, Chief Architect and Founder/CEO. Areas of expertise for JP include strategy, architecture, application development, infrastructure and operations, cloud computing, DevOps, and integration. JP is a published author with four trade publications with his most recent being “Cloud Computing: Assessing the Risks”. JP holds both a Masters and Bachelors of Science in Computer Science from Hofstra University.

Comments (2) View Comments

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


Most Recent Comments
Joe McDaniel 03/29/02 08:40:00 AM EST

Maybe I am missing something, but I did not see any source in the download for 0703.zip relating to this article????

Also, why not print it automatically in the "printable version?"

Arthur Yeh 03/28/02 11:34:00 PM EST
@ThingsExpo Stories
SYS-CON Events announced today that Datera will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Datera offers a radically new approach to data management, where innovative software makes data infrastructure invisible, elastic and able to perform at the highest level. It eliminates hardware lock-in and gives IT organizations the choice to source x86 server nodes, with business model option...
21st International Cloud Expo, taking place October 31 - November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA, will feature technical sessions from a rock star conference faculty and the leading industry players in the world. Cloud computing is now being embraced by a majority of enterprises of all sizes. Yesterday's debate about public vs. private has transformed into the reality of hybrid cloud: a recent survey shows that 74% of enterprises have a hybrid cloud strategy. Me...
SYS-CON Events announced today that DXWorldExpo has been named “Global Sponsor” of SYS-CON's 21st International Cloud Expo, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Digital Transformation is the key issue driving the global enterprise IT business. Digital Transformation is most prominent among Global 2000 enterprises and government institutions.
SYS-CON Events announced today that Massive Networks will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Massive Networks mission is simple. To help your business operate seamlessly with fast, reliable, and secure internet and network solutions. Improve your customer's experience with outstanding connections to your cloud.
When shopping for a new data processing platform for IoT solutions, many development teams want to be able to test-drive options before making a choice. Yet when evaluating an IoT solution, it’s simply not feasible to do so at scale with physical devices. Building a sensor simulator is the next best choice; however, generating a realistic simulation at very high TPS with ease of configurability is a formidable challenge. When dealing with multiple application or transport protocols, you would be...
SYS-CON Events announced today that Akvelon will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Akvelon is a business and technology consulting firm that specializes in applying cutting-edge technology to problems in fields as diverse as mobile technology, sports technology, finance, and healthcare.
SYS-CON Events announced today that Secure Channels, a cybersecurity firm, will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Secure Channels, Inc. offers several products and solutions to its many clients, helping them protect critical data from being compromised and access to computer networks from the unauthorized. The company develops comprehensive data encryption security strategie...
SYS-CON Events announced today that WineSOFT will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Based in Seoul and Irvine, WineSOFT is an innovative software house focusing on internet infrastructure solutions. The venture started as a bootstrap start-up in 2010 by focusing on making the internet faster and more powerful. WineSOFT’s knowledge is based on the expertise of TCP/IP, VPN, SS...
WebRTC is the future of browser-to-browser communications, and continues to make inroads into the traditional, difficult, plug-in web communications world. The 6th WebRTC Summit continues our tradition of delivering the latest and greatest presentations within the world of WebRTC. Topics include voice calling, video chat, P2P file sharing, and use cases that have already leveraged the power and convenience of WebRTC.
SYS-CON Events announced today that App2Cloud will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct. 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. App2Cloud is an online Platform, specializing in migrating legacy applications to any Cloud Providers (AWS, Azure, Google Cloud).
When shopping for a new data processing platform for IoT solutions, many development teams want to be able to test-drive options before making a choice. Yet when evaluating an IoT solution, it’s simply not feasible to do so at scale with physical devices. Building a sensor simulator is the next best choice; however, generating a realistic simulation at very high TPS with ease of configurability is a formidable challenge. When dealing with multiple application or transport protocols, you would be...
An increasing number of companies are creating products that combine data with analytical capabilities. Running interactive queries on Big Data requires complex architectures to store and query data effectively, typically involving data streams, an choosing efficient file format/database and multiple independent systems that are tied together through custom-engineered pipelines. In his session at @BigDataExpo at @ThingsExpo, Tomer Levi, a senior software engineer at Intel’s Advanced Analytics ...
Internet-of-Things discussions can end up either going down the consumer gadget rabbit hole or focused on the sort of data logging that industrial manufacturers have been doing forever. However, in fact, companies today are already using IoT data both to optimize their operational technology and to improve the experience of customer interactions in novel ways. In his session at @ThingsExpo, Gordon Haff, Red Hat Technology Evangelist, shared examples from a wide range of industries – including en...
Detecting internal user threats in the Big Data eco-system is challenging and cumbersome. Many organizations monitor internal usage of the Big Data eco-system using a set of alerts. This is not a scalable process given the increase in the number of alerts with the accelerating growth in data volume and user base. Organizations are increasingly leveraging machine learning to monitor only those data elements that are sensitive and critical, autonomously establish monitoring policies, and to detect...
"We're a cybersecurity firm that specializes in engineering security solutions both at the software and hardware level. Security cannot be an after-the-fact afterthought, which is what it's become," stated Richard Blech, Chief Executive Officer at Secure Channels, in this SYS-CON.tv interview at @ThingsExpo, held November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA.
To get the most out of their data, successful companies are not focusing on queries and data lakes, they are actively integrating analytics into their operations with a data-first application development approach. Real-time adjustments to improve revenues, reduce costs, or mitigate risk rely on applications that minimize latency on a variety of data sources. Jack Norris reviews best practices to show how companies develop, deploy, and dynamically update these applications and how this data-first...
Intelligent Automation is now one of the key business imperatives for CIOs and CISOs impacting all areas of business today. In his session at 21st Cloud Expo, Brian Boeggeman, VP Alliances & Partnerships at Ayehu, will talk about how business value is created and delivered through intelligent automation to today’s enterprises. The open ecosystem platform approach toward Intelligent Automation that Ayehu delivers to the market is core to enabling the creation of the self-driving enterprise.
The question before companies today is not whether to become intelligent, it’s a question of how and how fast. The key is to adopt and deploy an intelligent application strategy while simultaneously preparing to scale that intelligence. In her session at 21st Cloud Expo, Sangeeta Chakraborty, Chief Customer Officer at Ayasdi, will provide a tactical framework to become a truly intelligent enterprise, including how to identify the right applications for AI, how to build a Center of Excellence to ...
SYS-CON Events announced today that Massive Networks will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Massive Networks mission is simple. To help your business operate seamlessly with fast, reliable, and secure internet and network solutions. Improve your customer's experience with outstanding connections to your cloud.
Because IoT devices are deployed in mission-critical environments more than ever before, it’s increasingly imperative they be truly smart. IoT sensors simply stockpiling data isn’t useful. IoT must be artificially and naturally intelligent in order to provide more value In his session at @ThingsExpo, John Crupi, Vice President and Engineering System Architect at Greenwave Systems, will discuss how IoT artificial intelligence (AI) can be carried out via edge analytics and machine learning techn...