A Guideline about Writing Codes Runnable on PDA

By Maria Myers,2014-06-22 18:02
7 views 0
A Guideline about Writing Codes Runnable on PDA

Running HyperCast on PDAs

    Guangyu Dong, June 22, 2011

    1. Current version of Java on PDA

    1.1 Jeode

    We have been running Jeode that is part of the free software bundle included in the PDA box. It basically implements a subset of Java 1.1.

1.2 IBM J9

    This JVM has been tested on PDA and it works just fine. It supports J2ME Personal Profile, which is basically subset of Java 1.2. It’s not free, but nor is it very expensive (about $50 for 10 license?). It’s a possibility to switch to this JVM after the experiment is done.

1.3 Java on Linux

     If Linux is installed (for example, a Stargate platform), Java 1.3.1 is supported.

2. Classes that may need to be used on PDA

    This section lists the classes or package that might need to be used when running HyperCast on the PDAs. Other classes that are not listed here usually support some functions that are not required to run on the PDA platform. For example, we don’t want to (and we don’t have to) run an Overlay Server or

    RunControl program on a small handheld device. Furthermore, some overlay protocols (DT, HC) are not designed to run under wireless ad hoc environment therefore maybe need to be used on the PDA, but on the other hand we might decide to use them in a infrastructure wireless network scenario.

    If some class is needed to be run on PDAs, some work might need to be done on its source code to make it compatible with the JVM on PDAs (See section 3). Those classes that is not going to be run on PDA can be kept intact since they never get chance to be executed. We compile the HyperCast using JDK 1.4, therefore the classes can always compile even though it might be incompatible with the JVM on PDA.

2.1 HyperCast core

    1) hypercast

    All classes except HTTP_Server and HTTP_Utility

2) hypercast.adapters

Adapter classes that might be used on PDA, like:






    All classes

    4) hypercast.MonitorAndControl MCAdvertiseMessage








5) hypercast.NONE

    All classes

6) hypercast.SPT

    All classes

7) hypercast.DT

    Depends on if we need to run DT protocol on PDA

7) hypercast.HC

    Depends on if we need to run HC protocol on PDA

    2.2 RunControl software 1) runserver.RunServer class

2.3 Demo applications

1) edu.virginia.cs.mng.hypercast.demo.pda

    All classes

    3. Guideline to make a class compatible with PDA JVM To make a class runnable on PDA, we need to write the codes under the following guidelines that are applied to avoid incompatible features not supported on PDA (suppose PDA use Java 1.1):

3.1 Compiling

    Use the same way to compile the HyperCast as we do on the normal platform. That is, we can still use JDK 1.4 to compile the HyperCast even though we want to run it on a JVM with lower JAVA version.

3.2 Avoiding undefined methods

    If a class used is defined in Java 1.1 but some of its methods are only defined in a newer Java version, then try to avoid using those methods. Such as:

    java.util.Vector.remove (int) (1.2)

    java.lang.String.split(); (1.4)

    java.util.Hashtable.keySet () (1.2)

    java.util.Properties.setProperty (java.lang.String,java.lang.String) (1.2)

3.3 Supplying undefined libraries

    If a class used is not defined in Java 1.1, try to find an external class library to support this class and make sure it’s runnable on PDA. Some available external class libraries that can be possibly run on PDA are listed here:

    crimson.jar: provide support for XML API

    xml-apis.jar: provide XML transformation API

    xalan.jar: provide XPath API

    jdom.jar: provide XML parser

     jce-jdk12-124.jar: provide cryptography implementation

    If the above try fail for some classes, just avoid using them. Instead, try an alternative way to finish your codes. Some classes which have been used in our code might fall into this category:

    java.util.LinkedList; (1.2)

    java.util.Collections; (1.2)

    java.nio.*; (1.4); (1.4)

    java.util.Timer; (1.3)

    java.util.TimerTask; (1.3)

3.4 Avoiding undefined keyword

     Beside the classes and methods, some new keywords not defined in 1.1 should be avoided, for example: assert

3.5 Testing

    Even though we have made sure not to use those functions not defined in Java 1.1, we still need to test the software on PDA to make sure it works. Some of the methods are said to be in Java 1.1, but

    not in the PersonalJava specification running on PDA, such as:

    java.lang.Long.decode (java.lang.String)

    4 A example list of some imcompatible codes in current HyperCast package

    This list is obtained by compiling the HyperCast codes with following parameters: javac source 1.2 target 1.1 bootclasspath <a PersonalJava standard class library jar> -classpath <all the available external jars> <the HyperCast source codes>

This line of command is only used to identify the codes that are not compatible with the JVM on PDA,

    not a way to compile the HyperCast. We use normal JDK 1.4 compiler to compile HyperCast.

*: Files marked with ‘*’ might need to be used on PDA

    edu\virginia\cs\mng\hypercast\ *

    edu\virginia\cs\mng\hypercast\adapters\ import java.util.LinkedList; (1.2)

edu\virginia\cs\mng\hypercast\ *

    import java.util.Collections; (1.2)

edu\virginia\cs\mng\hypercast\StatsProcessor.javal *

    java.util.Vector.remove (int) (1.2)

edu\virginia\cs\mng\hypercast\ *

    java.util.Hashtable.keySet () (1.2)

edu\virginia\cs\mng\hypercast\ *

    java.lang.Long.decode (java.lang.String)

edu\virginia\cs\mng\hypercast\ *

    java.util.Properties.setProperty (java.lang.String,java.lang.String) (1.2)


import java.nio.*; (1.4)

    edu\virginia\cs\mng\hypercast\adapters\ import; (1.4)

    edu\virginia\cs\mng\hypercast\MonitorAndControl\ import java.util.Timer; (1.3)

    import java.util.TimerTask; (1.3)

edu\virginia\cs\mng\hypercast\ *

    edu\virginia\cs\mng\hypercast\MonitorAndControl\ symbol : constructor Exception (java.lang.String,java.lang.Throwable) (1.4)

    location: class java.lang.Exception

     public NoSuchPortalException (final String message, final Throwable cause) { super (message,

    cause) };

    symbol : constructor Exception (java.lang.Throwable) (1.4)

    location: class java.lang.Exception

     public NoSuchPortalException (final Throwable cause) { super (cause); }

edu\virginia\cs\mng\hypercast\MonitorAndControl\ *

    java.lang.String.split (java.lang.String) (1.4)

edu\virginia\cs\mng\hypercast\MessageStore *

    assert false (1.4)

Report this document

For any questions or suggestions please email