Welcome!

Java IoT Authors: Pat Romanski, Elizabeth White, Liz McMillan, Carmen Gonzalez, Yeshim Deniz

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 Peak 10, Inc., a national IT infrastructure and cloud services provider, will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Peak 10 provides reliable, tailored data center and network services, cloud and managed services. Its solutions are designed to scale and adapt to customers’ changing business needs, enabling them to lower costs, improve performance and focus intern...
Everywhere we turn in our industry we can find strong opinions about the direction, type and nature of cloud’s impact on computing and business. Another word that is used in every context in our industry is “hybrid.” In his session at 20th Cloud Expo, Alvaro Gonzalez, Director of Technical, Partner and Field Marketing at Peak 10, will use a combination of a few conceptual props and some research recently commissioned by Peak 10 to offer a real-world consideration of how the various categories of...
Five years ago development was seen as a dead-end career, now it’s anything but – with an explosion in mobile and IoT initiatives increasing the demand for skilled engineers. But apart from having a ready supply of great coders, what constitutes true ‘DevOps Royalty’? It’ll be the ability to craft resilient architectures, supportability, security everywhere across the software lifecycle. In his keynote at @DevOpsSummit at 20th Cloud Expo, Jeffrey Scheaffer, GM and SVP, Continuous Delivery Busine...
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...
SYS-CON Events announced today that SoftLayer, an IBM Company, has been named “Gold Sponsor” of SYS-CON's 18th Cloud Expo, which will take place on June 7-9, 2016, at the Javits Center in New York, New York. SoftLayer, an IBM Company, provides cloud infrastructure as a service from a growing number of data centers and network points of presence around the world. SoftLayer’s customers range from Web startups to global enterprises.
The 21st International Cloud Expo has announced that its Call for Papers is open. Cloud Expo, to be held October 31 - November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA, brings together Cloud Computing, Big Data, Internet of Things, DevOps, Digital Transformation, Machine Learning and WebRTC to one location. With cloud computing driving a higher percentage of enterprise IT budgets every year, it becomes increasingly important to plant your flag in this fast-expanding busin...
Multiple data types are pouring into IoT deployments. Data is coming in small packages as well as enormous files and data streams of many sizes. Widespread use of mobile devices adds to the total. In this power panel at @ThingsExpo, moderated by Conference Chair Roger Strukhoff, panelists will look at the tools and environments that are being put to use in IoT deployments, as well as the team skills a modern enterprise IT shop needs to keep things running, get a handle on all this data, and deli...
SYS-CON Events announced today that Systena America will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Systena Group has been in business for various software development and verification in Japan, US, ASEAN, and China by utilizing the knowledge we gained from all types of device development for various industries including smartphones (Android/iOS), wireless communication, security technology and IoT serv...
SYS-CON Events announced today that Loom Systems will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Founded in 2015, Loom Systems delivers an advanced AI solution to predict and prevent problems in the digital business. Loom stands alone in the industry as an AI analysis platform requiring no prior math knowledge from operators, leveraging the existing staff to succeed in the digital era. With offices in S...
With major technology companies and startups seriously embracing Cloud strategies, now is the perfect time to attend @CloudExpo | @ThingsExpo, June 6-8, 2017, at the Javits Center in New York City, NY and October 31 - November 2, 2017, Santa Clara Convention Center, CA. Learn what is going on, contribute to the discussions, and ensure that your enterprise is on the right path to Digital Transformation.
SYS-CON Events announced today that EARP Integration will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. EARP Integration is a passionate software house. Since its inception in 2009 the company successfully delivers smart solutions for cities and factories that start their digital transformation. EARP provides bespoke solutions like, for example, advanced enterprise portals, business intelligence systems an...
We build IoT infrastructure products - when you have to integrate different devices, different systems and cloud you have to build an application to do that but we eliminate the need to build an application. Our products can integrate any device, any system, any cloud regardless of protocol," explained Peter Jung, Chief Product Officer at Pulzze Systems, in this SYS-CON.tv interview at @ThingsExpo, held November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA
SYS-CON Events announced today that Enzu will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY, and the 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Enzu’s mission is to be the leading provider of enterprise cloud solutions worldwide. Enzu enables online businesses to use its IT infrastructure to their competitive ad...
Existing Big Data solutions are mainly focused on the discovery and analysis of data. The solutions are scalable and highly available but tedious when swapping in and swapping out occurs in disarray and thrashing takes place. The resolution for thrashing through machine learning algorithms and support nomenclature is through simple techniques. Organizations that have been collecting large customer data are increasingly seeing the need to use the data for swapping in and out and thrashing occurs ...
SYS-CON Events announced today that delaPlex will exhibit at SYS-CON's @CloudExpo, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. delaPlex pioneered Software Development as a Service (SDaaS), which provides scalable resources to build, test, and deploy software. It’s a fast and more reliable way to develop a new product or expand your in-house team.
SYS-CON Events announced today that Interoute has been named “Bronze Sponsor” of SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Interoute is the owner operator of Europe's largest network and a global cloud services platform, which encompasses over 70,000 km of lit fiber, 15 data centers, 17 virtual data centers and 33 colocation centers, with connections to 195 additional partner data centers. Our full-service Unifie...
DevOps is often described as a combination of technology and culture. Without both, DevOps isn't complete. However, applying the culture to outdated technology is a recipe for disaster; as response times grow and connections between teams are delayed by technology, the culture will die. A Nutanix Enterprise Cloud has many benefits that provide the needed base for a true DevOps paradigm.
SYS-CON Events announced today that Progress, a global leader in application development, has been named “Bronze Sponsor” of SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Enterprises today are rapidly adopting the cloud, while continuing to retain business-critical/sensitive data inside the firewall. This is creating two separate data silos – one inside the firewall and the other outside the firewall. Cloud ISVs oft...
SYS-CON Events announced today that WineSOFT will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. 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, SSL, peer-to-peer, mob...
SYS-CON Events announced today that Carbonite will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Carbonite protects your entire IT footprint with the right level of protection for each workload, ensuring lower costs and dependable solutions with DoubleTake and Evault.