Skip to main content

phoneME Advanced Peer File Structure

Posted by darryl_m on December 13, 2006 at 12:01 PM PST

For those interested in creating a
phoneME Advanced implementation on other platforms with other
windowing toolkits, you may be wondering how and where to start. The
first thing you'll want to do is get the CDC VM (CVM) up and running.
I won't go into detail about this, but an important point to note is
that the CDC (Connected Device Configuration) specifies a set of Java
classes that must be present. Besides porting the VM itself, the CDC
classes also need to be ported. This, however, should be fairly
straightforward. The bulk of the CDC Java code, which is usable
across platforms, is in the src/share/classes
directory. These Java classes require support of the underlying
native code which interfaces with the OS of choice directly. The
bulk of the CDC native code can be found in the src/share/native
directory. For example, if you look at
it makes a native call (public final native Class getClass();) which
is serviced by src/share/native/java/lang/Object.c.
The files in the src/share
directory are shared by all implementations, regardless of the
hardware/OS. If there are special requirements by the hardware/OS
which cannot be serviced by a shared file, you'll find files in
src/os<-cpu>. For example, separate code is required to
interface with the audio device in Personal Profile. So you'll find
audioDevice.c in these places:

The good news is that, as previously
stated in this
article, the code which is NOT in the shared area is minimized as
much as is possible.

Once we get above the configuration to
the profiles, things become easier. Sitting atop CDC is the
Foundation Profile (FP). Almost all of the code for implementing the
FP is in the src/share/foundation
directory. And just like the CDC code, there is a
directory for Java code and a src/share/foundation/native
directory for the native code which is called by the Java code.
There are some files in the src/os<-cpu> directory which
support the Foundation Profile. For example, the native
PlainSocketImpl_md.c file which supports FP's class
can be found in the src/os-<cpu> directories.

Above the FP lies the Personal Basis Profile (PBP). Things get
a little more complicated here as the PBP adds windowing code in the
form of the Abstract Window Toolkit (AWT). This complicates things
because there are different windowing toolkits on different platforms
(and even on the same platform!) which can be used. Fortunately,
however, the PBP code is isolated to the src/share/basis
directory. Again, the common src/share/basis/classes
directory contains the Java code and the src/share/basis/native
directory contains the supporting native code. If you look in the
directory, you'll see the Java classes which support the Microwindows
and Qt UI toolkits under the
microwindows and qt directories respectively. And of course, under
are also the microwindows and qt directories containing the
supporting native code. The code in these native directories
interact directly with the microwindows and qt libraries. This, plus
the corresponding Java code is the “porting” layer for

Above the PBP sits the Personal Profile
(PP). PP is a bit different in that it re-implements some of the
classes in its underlying layer (PBP). For example, you'll find an and file in both PBP and PP. This is
necessary to support the differences in PP. PP has yet a different
directory structure from PBP underneath. You'll notice in the
directory, a directory named common. This directory contains Java
classes which are common to the varying PP implementations. For
example, there is a file named
The various PP implementations have a GraphicsDevice class of
their own which extends this common GraphicsDevice class. There is
also an awt directory which contains a peer_based directory.
Underneath this is a directory (java/awt) containing files common to
all the peer-based PP implementations. The specific peer-based
implementations are in the sun/awt/<impl> directories. There,
you'll find qt, gtk, and pocketpc implementations.

Related Topics >>