Sunteți pe pagina 1din 4

Second International Conference on Emerging Trends in Engineering and Technology, ICETET-09

APP2MID: Methodology for Conversion of Java Applets


Animations to Java MIDlets
Kapil Kadam and Sameer Sahasrabudhe

Abstract—Java applets are used in e-learning, mainly for It has two important APIs (Application Programming
creating animations. Many leading educational and Interface) - The CLDC API (Connected Limited Device
professional organizations have large repositories of Configuration) and the MIDP API (Mobile Information
animations, created using Java applets which are mostly for Device Profile) [8].
desktops. Use of mobile phones is increasing especially amongst Only a subset of Core Java APIs java.lang, java.io and
students, and creating new eLearning content for mobile java.util are supported by J2ME. For example, the java.lang
phones is resource intensive. It is desirable to have a
in J2ME (CLDC 1.1 version) has 17 classes and 1 interface,
methodology to adapt existing Java animations on mobile
phones. This paper presents a methodology (APP2MID) which compared with the java.lang of Java SE (JDK 1.6 version),
converts the Java applet into Java MIDlet that can run on which has 35 classes and 8 interfaces. J2ME also possesses
mobile phones. The conversion methodology is divided in three many features which are specific and limited to J2ME itself.
logical phases and will help the user to create MIDlets from the Table 1 shows the core Java APIs supported by CLDC 1.1 [8].
available Java applets, maintaining the original programming
logic. We illustrate this methodology using a case study. TABLE I
CORE JAVA SE APIS SUPPORTED BY J2ME
I. INTRODUCTION
Package Classes

J AVA applets have been one of the popular content


creation format for eLearning. Many leading
organizations in educational and professional domains
java.lang
Boolean, Byte, Character, Class, Integer, Long,Double,
Float, Math, Object, Runnable, Runtime, Short, String,
StringBuffer, System, Thread, Throwable
have large repositories of educational animations created ByteArrayInputStream, ByteArrayOutputStream,
using JAVA [4]. DataInput, DataOutput, DataInputStream,
Concurrently, mobiles are becoming even more common java.io DataOutputStream, InputStream, OutputStream,
as compared to computers. The portability and the reach of InputStreamReader, OutputStreamWriter, PrintStream,
Reader, Writer
mobiles is quite more than that of the computers and
therefore it is not at all surprising that mobiles are preferred Calendar, Date, Enumeration, Hashtable, Random, Stack,
as a medium for educational content dissemination [1], [2]. java.util
TimeZone, Vector
Looking at the large number of Open Source JAVA
applets available for the desktops, it is desirable to have a
methodology to convert those for mobiles in a seamless From the earlier discussion, following points are evident:
manner. In this paper we present one such methodology: 1. Large numbers of Java applets animations are
APP2MID. available.
Java SE (Java standard edition) is used for creating applets 2. J2ME does not support all the APIs that are used in
especially for desktops. These applets cannot run on mobile Java applet animations creation
phones because the APIs used are not supported by mobile 3. Re-creation of same animations for mobiles would
phones. For creating applications for mobile phones and be resource intensive.
other handheld devices, J2ME (Java 2 Micro edition) 4. Maintaining the original programming logic of the
technology is used [6]. J2ME represents a simpler version of animation is critical.
Java SE, with a reduced feature set, for the devices with Seamless conversion of applets to MIDlets is certainly
limited memory, small screen sizes, alternative input desirable. In this paper we present one such methodology. A
methods, and slow processors [7]. case study is used to illustrate the methodology in detail.

Manuscript received August 20, 2009. This work was supported in part
II. CONVERSION PROCESS: APP2MID
by the TTSL IIT Bombay Center of Excellence in Telecommunications The conversion process APP2MID has three logical phases.
(TICET) project of IIT Bombay.
These phases convert the original Java applet into various
Kapil Kadam is M. Tech. from Walchand College of Engineering,
Sangli, India and is currently working as Project Engineer at the formats, in a cascading manner to achieve the final goal of
Department of Computer Science and Engineering of IIT Bombay, India. creating a MIDlet. The Java applet is not converted directly
Phone: +91-22-25764987; fax: +91-22-25720022; e-mail: into MIDlet, as it may create problems for code extraction.
kkapilkk@gmail.com
For example, multiple uses of standard keywords like ‘if’, in
Sameer Sahasrabudhe is a graduate in Fine arts. He is currently working
as a Project Manager at the Department of Computer Science and a Java applet may get replaced by single one in Java MIDlet.
Engineering of IIT Bombay, India. Phone: +91-22-25764913; fax: +91-22- Due to the unsystematic code identification it can lead to
25720022; e-mail: s1000brains@iitb.ac.in

978-0-7695-3884-6/09 $26.00 © 2009 IEEE 428

Authorized licensed use limited to: UNIVERSIDAD DE SANTIAGO DE CHILE. Downloaded on May 12,2010 at 16:22:45 UTC from IEEE Xplore. Restrictions apply.
compilation errors and some unidentifiable exceptions too. In order to achieve this we wrote another class “Converter”
In order to avoid such errors we designed the methodology in the “APP2MIDconverter.java” program mentioned in
in three phases, which are described below. Refer Fig. 1. Phase-II. This class “Converter” does the MIDlet XML to
Java MIDlet conversion. The output of this phase is a desired
Java MIDlet. Schematic representation of this phase is shown
Phase I Phase II Phase III Testing in Fig. 4.
Phase
Java Applet Applet XML to MIDlet XML
to Applet MIDlet XML to Java MIDlet
XML Output
Transformation MIDlet Testing
MIDlet XML
Input XML to XML
Applet XML Transformer

Fig. 1: Conversion Phases Class


XMLTraverser DTD
Validation
A. Conversion Phase-I
The first phase converts the Java applet to a XML file for Input
better representation than normal text and mapping. This Package.xml Valid MIDlet
XML
phase has Java applet as the input. This applet is converted
to XML using the available Java to XML converter
(Java2XML) [9]. After conversion the applet XML is
validated by using a browser (Internet Explorer) [3]. Fig. 3: Conversion Phase-II
Java and XML both are platform independent and XML is
fully compatible with Java. Standard Java class structure can
be well represented in the form of XML tags, so that Java Input XML to Java Output
MIDlet XML Converter
classes, methods, interfaces, packages are processed easily Java MIDlet

by maintaining the Java programming standards [5]. Class


The produced representation allows easy extraction of the Converter
semantics of source code, its analysis and transformation.
The output of this phase is a valid XML of the applet.
Schematic representation of this phase is shown in Fig. 2. Fig. 4: Conversion Phase-III
B. Conversion Phase-II
D. Testing Phase
Input Java to DTD Valid Testing is the most important way of assuring (or
Java Applet XML Validation Applet XML controlling) the quality of software or application developed.
Converter
The third phase delivers the Java MIDlet as final output.
The resultant Java MIDlet is tested with Sun’s Wireless
Fig. 2 Conversion Phase-I toolkit emulator [10] by selecting MIDP2.0 & CLDC1.1 APIs,
that gives the desired output, the actual results are presented
The second phase transforms the output of Phase-I, i.e. in further sections. An error free result leads towards the
applet XML to a MIDlet XML. The motivation of this phase actual device testing. Mobile phones like Nokia N72 [12] &
is to transform the applet XML into MIDlet XML. This enable Sony Ericsson W58i [13] were used for testing as they are
mapping of applet XML into another XML to obtain the supported by MIDP 2.0 & CLDC1.1 APIs.
desired MIDlet structure.
In order to address this we wrote a Java program III. CASE STUDY
(APP2MIDconverter.java), containing class “XML Traverser” CONVERSION OF ANIMATIONS IN PROJECT OSCAR
traverses each node of the applet XML and does the XML to
XML transformation. This created Package.xml file which Project OSCAR stands for Open Source Courseware
contained XML representation of basic MIDlet program Animations Repository [11]. This is a project of IIT Bombay
structure. The transformed XML is validated in a similar way and hosts over hundred animations, which covers different
as mentioned in the Phase-I. The output of this phase is a subjects from standard 7th to standard 12th like Mathematics,
valid XML of the desired MIDlet. Schematic representation of Physics, Biology and Chemistry. It also covers Engineering
this phase is shown in Fig. 3. subjects for Undergraduate and Post Graduate studies like
Networking, Mechanical engineering, etc.
C. Conversion Phase-III Most of the animations from the repository are Java
The third phase converts the output of Phase-II, i.e. MIDlet applets, which is suitable for testing the conversion
XML to a Java MIDlet. The motivation of this phase is to methodology presented in this paper.
convert MIDlet XML into Java MIDlet which is the desired We have selected Basic Angles animation from
final output. Mathematics repository as a test case [11]. BasicAngles.java

429

Authorized licensed use limited to: UNIVERSIDAD DE SANTIAGO DE CHILE. Downloaded on May 12,2010 at 16:22:45 UTC from IEEE Xplore. Restrictions apply.
is a Java applet program which contains the code for the of the Phase-I, which is the applet XML (Figure7). After
basic angles animation. Fig. 5 shows the output of processing through conversion phase-II we got the MIDlet
BasicAngles.java applet when executed in applet viewer and XML (Fig 8), which shows the portion of MIDlet XML. At
Fig. 6 shows the small portion of the code. the end of conversion phase-II we get the XML
representation of MIDlet.
The desired output at this phase is XML representation of
MIDlet. The transformation adds packages required for
MIDlet. For example package “javax.microedition.midlet”
represented as XML tag
<import module=“javax.microedition.midlet”>
in the MIDlet XML (Fig. 8).

Fig 5: Basic angles animation applet

Fig. 7: XML applet

Fig 6: BasicAngles.java applet code

A. Phase-I Results
As mentioned in the conversion phase-I the input for this
phase is Java applet program i.e. BasicAngles.java (refer
Fig. 6) which is converted into applet XML. The output of
conversion phase-I is shown in Fig. 7 which shows the small
portion of the XML applet.
As mentioned in the conversion phase-I about standard
Java class structure & XML tags, it can be seen from the Fig.
7 that the standard class structure of Java applet (refer Fig.
6) is well represented in the form of XML.
For example class “BasicAngles” with visibility attribute Fig. 8: XML MIDlet
“public” (Fig 6) is represented as a XML tag
<class name=“BasicAngles” visibility=“public”> C. Phase-III Results
in Fig 7. Other code of Java applet was also converted in the The output of phase-II i.e. MIDlet XML is the input for
form of XML tags. phase-III. The XML representation of desired MIDlet intends
to convert this into Java MIDlet. Every tag of this XML is
B. Phase-II Results
processed and converted into Java MIDlet format
As said earlier the input of the second phase is the output maintaining its standards.

430

Authorized licensed use limited to: UNIVERSIDAD DE SANTIAGO DE CHILE. Downloaded on May 12,2010 at 16:22:45 UTC from IEEE Xplore. Restrictions apply.
For example XML tag and were converted successfully. On critical review of the
<import module=“javax.microedition.midlet”> converted applets we have found the following aspects,
from Fig. 8 is converted to following Java statement of which can be addressed in the future:
MIDlet. • It is necessary to try and convert all possible Java SE
“import javax.microedition.midlet” classes used in animation.
as shown in Fig. 9. • The MIDlet created using this methodology was of the
The rest of the XML tags are also processed to generate the same screen size of the applet. This feature made it
Java MIDlet. The generated Java MIDlet is the mobile mandatory to the user to use scrolling to view the
version of the original Java applet i.e. BasicAngles.java and animation on the smaller screen size of mobile phones.
ready to be tested. The output of conversion phase-III is • The MIDlet created using this methodology will be
shown in Fig. 9 which shows the small portion of the final compatible only with the mobile handsets with API
Java MIDlet code. support of MIDP 2.0, and CLDC 1.1.

ACKNOWLEDGEMENT
We acknowledge the support of Prof. Sridhar Iyer,
(Project OSCAR, IIT Bombay) and Prof. D.B. Kulkarni
(Walchand College of Engineering, Sangli) for their
invaluable guidance. We also acknowledge the support of
the TICET Project (Department of Computer Science and
Engineering, IIT Bombay).

REFERENCES
[1] P. Thornton; Houser, “Using Mobile Phones in Education.”
Proceeding of 2nd IEEE International Workshop on Wireless and
Mobile Technologies in Education. Digital Object Identifier
10.1109/WMTE.2004.1281319, pp ii-ii.
[2] B. Shen, W. T. Ooi, G.Morabito and E. Steinbach, “Multimedia
Applications in Mobile/Wireless Context.” IEEE Transaction on
Multimedia. Volume 10, Issue 5, Aug 2008, Digital Object Identifier
10.1109/TMM.2008.921722, pages 673-674.
[3] Anders Mller, Christian Kirkegaard and Michael I. Schwartzbach,
“Static analysis of xml transformations in java.” IEEE Transactions
on Software Engineering Volume 30, Issue 3, March 2004, Digital
Object Identifier 10.1109/TSE.2004.1271173, pages 181-192.
Fig. 9: Java MIDlet [4] P. Kamthan, “Java Applets in Education” published on: Sunday, 7th
March 1999, URL1:http://tech.irt.org/articles/js151/index.htm.
URL2:http://oscar.iitb.ac.in/documents/java.pdf.
D. Testing Phase Results [5] IBM, “Xml related technologies and programming with Java”,(book).
We tested the resultant Java MIDlet on Sun’s wireless Publisher: Printice-Hall of India, ISBN: 8120325060.
[6] Kim Topley, “J2ME in Nutshell”,(book). Publisher: O’Reilly, ISBN:
toolkit emulator, which is mainly used to test J2ME 059600253x.
applications. The MIDlet worked without any errors. The [7] Hari Menon, “Portability Analysis in Mobile Gaming using J2ME.”
results are shown in Fig. 10. Morgantown, West Virginia, 20006.
[8] Sun Microsystems, Inc. “J2me building blocks for mobile
devices,white paper on kvm and the connected, limited device
configuration (CLDC).” May 19 2000.
URL: http://java.sun.com/products/cldc/wp/KVMwp.pdf.
[9] Harsh Jain, “Java to Xml, URL:https://java2xml.dev.java.net
[10] Sudipto Chanda, “Creating apps for mobiles”, PCQUEST, Jan 1,
2009, URL: http://java. sun.com/javame/technology.
[11] Project OSCAR, IIT Bombay, India, URL: http://oscar.iitb.ac.in/.
[12] Nokia N72, URL:http://www.nokia.co.in/find-
products/products/nokia-n72/technical-specifications
[13] Sony Ericsson W580i,
URL:http://www.gsmarena.com/sony_ericsson_w580-1928.php.

Fig. 10: Java MIDlet Animation on Sun’s wireless toolkit


emulator

IV. CONCLUSION
The outputs of the case study of the Basic Angles
animation applet, confirms the success of the conversion
methodology: APP2MID. Some more applets were also tried

431

Authorized licensed use limited to: UNIVERSIDAD DE SANTIAGO DE CHILE. Downloaded on May 12,2010 at 16:22:45 UTC from IEEE Xplore. Restrictions apply.

S-ar putea să vă placă și