|
iSeriesMonitorME: An Intro to Wireless Programming with iSeries ToolboxME
by Marc Logemann
This is the first of three articles about Java 2 Micro Edition (J2ME) development with the ToolboxME API. I'll focus on the introduction of the wireless package in the JTOpen package (the open-source version of the IBM Toolbox for Java) and the J2ME specifications provided by Sun Microsystems, and detail the CLDC configuration and the MIDP profile. In the next article I will outline how to prepare for a J2ME-based development project. In the third, I will program our first MIDlet, which communicates with an iSeries server to check system status. This application is also the name of the article series, which I call iSeriesMonitorME.
J2ME: A Bunch of Specifications
J2ME is a category. Together with the Java 2 Standard Edition (J2SE) and the Java 2 Enterprise Edition (J2EE) categories, J2ME expresses the whole Java world. So when you do Java development, you live in at least one of these three categories. The J2ME category is one of the most exciting and evolving areas in the Java space.
J2ME consists of configurations and profiles. At the moment there are two major configurations, the Connected Device Configuration (CDC), which is targeted at consumer electronics, like televisions, and the Connected Limited Device Configuration (CLDC), which is targeted at devices with less memory, like handhelds or mobile phones. Profiles exist on top of configurations and define add-on functionalities; whereas configurations only provide very basic functions, things you normally find in the java.lang package. One of these profiles based on CLDC is the Mobile Device Information Profile (MIDP). This article focuses on this profile, because it is supported by nearly all major mobile phone vendors and also by Palm-based devices. Expect that there will be a profile called PDAP under the CLDC configuration in the near future that will work better with devices like PDAs. Right now some PDAs also use the MIDP profile, which was designed for smaller devices with less CPU and memory.
When you look at the features of today's smartphones, you often see the support for PersonalJava. This API is a historical piece of software that doesn't fit in the J2ME specification. It's mainly a stripped-down J2SE variant. You will see this specification migrate into the CDC configuration within the Personal profile in the near future.
Along with these configurations, there are specifications about how a Virtual Machine (VM) must behave for a certain configuration. For the CLDC configuration there is a reference virtual machine provided by Sun, called KVM (kilobyte virtual machine). As you might imagine, a lot of functionalities of the standard JVM, which is provided in the J2SE or J2EE API, had to be cut of in order to run on a device with such limited CPU and memory. An example of such a missing functionality is the support of floating point numbers. Figure 1 shows the platform architecture for a typical MIDP application.
Figure 1: The MIDP application structure
|
Sun has just released the final specification of MIDP 2.0. This specification is maintained in the JCP (Java Community Process) as JSR-118. Because it was just released, there is no chance to see this specification yet on a real device and the mobile devices vendors, like Nokia and Siemens, have not yet announced MIDP 2.0 device release dates. The only way to test MIDP 2.0-based applications is to use the J2ME Wireless Toolkit 2.0 Beta 1 for Windows; besides many other things, it contains an emulator for the 2.0 revision of the spec. Here are some enhancements in MIDP 2.0:
- Secure networking (HTTPS, SSL/TLS)
- Extended network connectivity (TCP/IP sockets, datagrams)
- Audio and gaming (in MIDP 1.0 audio was only in vendor APIs)
- Over-the-Air Provisioning (OTA) now inside the specs
- GUI enhancements (for example layout and inheritance functionalities)
The application I will create in the upcoming issues is MIDP 1.0-based. The first reason is that it's much more attractive to have a real device that you can run your application on. The second reason is that I won't need any of the new functionalities inside my simple application.
ToolboxME: The Micro Package in JTOpen
The IBM JTOpen team faced the same problems when creating their micro APIs as Sun did with their J2ME package. They had to create classes that were suitable for devices with limited resources. The JTOpen classes for J2SE development consists of several hundred classes, so in order to have the same basic functionalities, a stripped-down version was required.
In this process, the JTOpen communication was redesigned for the micro package in a way that the client, a mobile phone for example, doesn't communicate with the iSeries directly but with a proxy server. This proxy server, called MEServer, has the complete JTOpen package on board and communicates with the iSeries (Figure 2).
Figure 2: The communication diagram
|
The ToolboxME API focuses on four main functionalities: executing (CL) commands, executing programs, accessing data queues, and accessing databases on the iSeries. In the forthcoming articles, I will focus on the programCall part of the ToolboxME package, because my example application will use it.
If you've worked with JTOpen classes for J2SE or J2EE development before, you will feel comfortable very quickly, because you will also use an AS/400 object for connecting to the iSeries; the only difference with this object in the micro package is that it needs the address of the MEServer. Further you will notice that many instance methods became static methods in order to reduce the memory footprint of the resulting MIDP application, since static methods are not bound to objects, but to classes.
The ToolboxME package has a size of 34 KB in its original distribution. If you only need one of the four main functionalities, for example the programCall part, you can remove some classes in order to reduce the overall size of the JAR file. You might think 34 KB is not very much at all, but some older Java-capable mobile phones have an application size limit of 50 KB. This means that on these devices you only have 16 KB left for the main application logic. But don't take it too seriously; the next article will show you a way to reduce your application size without losing functionality. For a complete list of Java-capable mobile phones or PDAs, check the overview provided by Sun.
This first article has presented the different APIs involved when you are trying to develop a MIDP-based wireless application with access to an iSeries. For a much more detailed view on the APIs, you should consider visiting the appropriate sites. For ToolboxME, check the JTOpen Web site. For the different profiles and configurations, check Sun's wireless site. The ToolboxME library can also be obtained via an LPP (5722-XP1), with the name "iSeries Access for Wireless," distributed by IBM.
The next article in this series will outline how to prepare your development environment for wireless projects, without an IDE vendor lock. You will see how to prepare your IDE for doing things like preverification or obfuscation.
Marc Logemann is a senior e-business consultant at Spirit/21 AG, a German consulting company that focuses on iSeries services and development. He is involved in several Java- and PHP-based open-source projects and likes reading books about new technologies. Marc can be reached at marc@logemann.info.
Sponsored By
ASNA/GUILD COMPANIES
|
|
Enter to Win
Free Airfare!
Free Luxury Accommodations!
Free Conference Registration!
ASNApalooza - March 5-7, 2003
Westin Riverwalk Hotel, San Antonio, Texas
ASNApalooza is ASNA's annual educational conference featuring three days of Visual RPG (AVR) sessions and hands-on labs. It is a perfect opportunity for AS/400 and iSeries professionals to learn more about leveraging RPG and DB2/400 to the Web, Windows and the .NET development environment. See the conference agenda at www.palooza.asna.com/2003_agenda.asp for more information.
To enter the drawing for FREE airfare, accommodations, and registration for ASNApalooza, send us your name, the name of the company you work for, your phone number and email address to: ASNApalooza2003@itjungle.com
If you are not a subscriber to the Guild Companies email newsletters, we will begin your free subscriptions immediately and enter your name in the ASNApalooza drawing. Of course, all current subscribers will also be entered in the drawing.
Please note: All entries must be emailed no later than January 31, 2003. The winner will be announced February 3, 2003.
Airfare includes a round-trip flight from a major regional airport near your home to San Antonio, Texas. Accommodations include three nights at the Westin River Walk, the host hotel for ASNApalooza. Registration includes admittance to all tech sessions, two lunches, and two cocktail receptions.
--Contest co-sponsored by ASNA and Guild Companies
OFFICIAL RULES
No purchase is necessary to enter or win this sweepstakes.
The following promotion is intended for participation in the 50 United States and the District of Columbia only (excluding, without limitation, overseas military installations, Puerto Rico and other U.S. territories) and shall only be construed and evaluated according to U.S. law. Do not proceed if you are not a legal U.S. resident of (and currently located in) the 50 United States or the District of Columbia only excluding overseas military installations, Puerto Rico and other U.S. territories, 18 years of age or older with a valid driver's license. Entrants must have Internet access prior to entering. Void where prohibited by law.
1. SWEEPSTAKES TERM: From January 6, 2003, to January 31, 2003.
2. MEANS OF ENTRY: No Purchase Necessary. To enter you must agree that Guild Companies, Inc. is permitted to add your email address to the list of subscribers to our free newsletters. There is no charge to register. There is a limit of one (1) sweepstakes entry per person (regardless of whether a person has more than one email address) or email address (regardless of whether more than one person uses the same email address). If more than one (1) sweepstakes entry is received per person or email address, only the first sweepstakes entry will be accepted. All sweepstakes entries become the property of the sponsors and none will be acknowledged or returned. EMAIL CHANGE OF ADDRESS POLICY: It is the sole responsibility of the entrant to notify Sponsors if his or her email address changes. In the event of a dispute about the identity of an entrant, entries will be declared made by the authorized account holder of the email address submitted at time of entry. Authorized account holder is defined as the natural person who is assigned to an email address by an Internet access provider, online service provider or other organization (e.g., business, educational institution, etc.) that is responsible for assigning email addresses for the domain associated with the submitted email address. The potential winner may be required to provide Sponsors with proof that the potential winner is the authorized account holder of the email address associated with the winning entry. Entries must be submitted from a valid email account, which may be identified by reverse domain name search.
3. PRIZE DRAWING: One (1) grand prize winner will be selected from among all eligible entries received. Drawing to take place on or about February 3, 2003 by Guild Companies, Inc., whose decision is final in all matters relating to this sweepstakes.
4. PRIZE: One (1) grand prize winner will receive: a complimentary round-trip airline ticket from the regional airport closest to the winner's home address; complimentary accommodations for three nights at the Westin River Walk Hotel on March 4, 5, and 6, 2003; and free ASNApalooza 2003 Conference registration including admittance to all tech sessions, two lunches, and two cocktail receptions. Other costs and expenses not specified herein are not included and are solely the winner's responsibility. All federal, state and local taxes (and any other applicable taxes, fees, and surcharges) are the sole responsibility of the grand prize winner. Odds of winning depend on the number of eligible entries received. No substitution or transfer of grand prize or cash equivalent is permitted.
Grand prize winner will be notified by phone, email, U.S. mail, and/or overnight courier, within seven (7) days after the drawing date and must complete, sign, notarize and return an Affidavit of Eligibility and Liability Release, and where permitted by law, a publicity release within seven (7) days following attempted notification. Failure to comply with the requirements above within this time period may result in disqualification and selection of an alternate winner. Any grand prize notification/documentation/grand prize returned as undeliverable for any reason may result in disqualification and selection of an alternate winner. If a winner is ineligible or cannot be notified an alternate winner will be selected.
5. ELIGIBILITY: This sweepstakes is open only to legal U.S. residents of (and currently located in) the 50 United States and the District of Columbia (excluding, without limitation, overseas military installations, Puerto Rico and other U.S. territories) who are 18 years of age or older. Void where prohibited by law. Entrants must have Internet access prior to January 6, 2003. Employees (and the members of the immediate families or households of such employees) of Guild Companies Inc. and ASNA, affiliates, subsidiaries, related entities, agents, advertising, promotion, fulfillment agencies, and anyone involved in this sweepstakes' production, development or handling, and all other sweepstakes promotional partners are not eligible to participate in this sweepstakes.
6. TERMS: By participating entrants agree (a) to be bound by these official rules and by the decisions of the sponsors, which are final on all matters pertaining to this sweepstakes, and (b) to release, indemnify and hold harmless Guild Companies Inc. and ASNA ("Sponsors")
from any and all liability, claims for damages, losses or injuries of any kind, including death, resulting from or in connection with the sweepstakes or from (i) altered, late, lost, damaged, destroyed, inaccurate, defaced, misdirected, mutilated, illegible, stolen, delayed, garbled, misrouted, incomplete entries or human, telephone, computer, online or technical malfunctions (including busy lines and disconnections), or (ii) their participation, or (iii) the awarding, acceptance, receipt, use, misuse, possession, loss or misdirection of grand prize or preparing for or participation in any grand prize-related activity and any travel related thereto. This sweepstakes is governed by, and these rules will be construed and interpreted pursuant to, the laws of the United States. All federal, state and local laws and regulations apply. Restrictions, conditions, and limitations apply. The acceptance of the grand prize constitutes the grant of an unconditional right for sponsors and promotional partners to use winner's name, address, voice, likeness, photograph, biographical and grand prize information and/or statements about the promotion, for any publicity, advertising and promotional purposes in any media without additional compensation, except where prohibited by law. Sponsors and promotional partners are not responsible for the inability of a winner to accept the grand prize for any reason nor for any delivery cancellations, delays or interruptions. Sponsors and Promotional Partners will not replace any lost or stolen grand prize items. Normal Internet access and usage charges imposed by an entrant's online service will apply. Due to possible scheduling changes, sponsors reserve the right, at their sole discretion, to adjust the dates/times of this sweepstakes.
7. CONDUCT: Sponsors reserve the right at their sole discretion to disqualify any individual it finds to be tampering with the entry process or the operation of the sweepstakes or web site; to be acting in violation of the official rules; or to be acting in an unsportsmanlike or disruptive manner, or with intent to annoy, abuse, threaten or harass any other person. Sponsors reserve the right to lock out an entrant whose eligibility is in question or who has been disqualified or is otherwise ineligible to enter. CAUTION: ANY ATTEMPT BY AN ENTRANT OR ANY OTHER INDIVIDUAL TO DELIBERATELY ALTER OR DAMAGE ANY WEB SITE OR UNDERMINE THE LEGITIMATE OPERATION OF THE SWEEPSTAKES IS A VIOLATION OF CRIMINAL AND CIVIL LAWS AND SHOULD SUCH AN ATTEMPT BE MADE, SPONSORS RESERVE THE RIGHT TO SEEK DAMAGES FROM ANY SUCH ENTRANT TO THE FULLEST EXTENT PERMITTED BY LAW.
8. LIMITATIONS OF LIABILITY: Sponsors and promotional partners are not responsible for typographical, printing or other errors in the offer or administration of this sweepstakes, including but not limited to errors in advertising, the official rules, the selection, notification and announcement of the winner or the distribution of the grand prize, nor are they responsible for any incorrect or inaccurate information, whether caused by Web site users or by any of the equipment or programming associated with or utilized in the sweepstakes or by any technical or human error which may occur in the processing of submissions in the sweepstakes. Sponsors and promotional partners assume no responsibility for any error, omission, interruption, deletion, defect, delay in operation or transmission, communications line failure, theft of or destruction or unauthorized access to, or alteration of, entries. Sponsors and promotional partners are not responsible for any problems, failures or technical malfunction of any telephone network or lines, computer online systems, servers or providers, computer equipment, hardware/software, players or browsers, failure of email or entrants due to or resulting from technical problems or traffic congestion on the Internet or at any Web site or combination thereof, including injury or damage to participants or to any other person's computer related to or resulting from participating or downloading materials in this sweepstakes. If for any reason the sweepstakes is not capable of running as planned due to: (a) infection by computer virus, bugs, tampering, unauthorized intervention, fraud, technical failure or other causes which corrupt or affect the administration, security, fairness, integrity or proper conduct of the sweepstakes; or (b) earthquake, flood, fire, storm or other natural disaster, act of God, labor controversy or threat thereof, civil disturbance or commotion, disruption of the public markets, war or armed conflict (whether or not officially declared) the sponsors reserve the right at their sole discretion to cancel, terminate, modify, or suspend the sweepstakes without obligation or prior notice and in such event to determine the winner via random drawing from among all valid entries received up to the time of such cancellation, termination, modification or suspension.
9. PRIVACY: By entering the sweepstakes, you agree to the use of your personal information as described in the privacy policy, located at www.itjungle.com. You further agree that the personal information collected during this sweepstakes may be shared with the aforementioned companies (sponsors/promotional partners) above whose use of such information shall be governed by their own privacy policies.
10. RULES/WINNERS LIST: This sweepstakes is subject to these complete and official rules.
11. SPONSORS: Guild Companies, Inc., 50 Park Terrace East, Suite 8F, New York, NY 10034; and ASNA Inc., 14855 Blanco Road, Suite 300, San Antonio, TX 78216.
|
|
Editors
Shannon O'Donnell
Kevin Vandever
Managing Editor
Shannon Pastore
Contributing Editors:
Howard Arner
Raymond Everhart
Joe Hertvik
Ted Holt
David Morris
Publisher and
Advertising Director:
Jenny Thomas
Advertising Sales Representative
Kim Reed
Contact the Editors
Do you have a gripe, inside dope or an opinion?
Email the editors:
editors@itjungle.com
|