Java Reference
In-Depth Information
Typically, when the first operation in a JSR that has a customizable
DLL is invoked, the common code in the Symbian C++ layer does the
following:
// load the DLL
User::LeaveIfError(iDLL.Load(KDLLName));
// look up the first ordinal function - the factory function
FactoryFunctionL = (TFactoryFunc)iDLL.Lookup(1);
// invoke the factory function to create a Factory instance
iFactory = (*FactoryFunctionL)();
The DLL is loaded and the first exported function of the DLL is
invoked. That returns a main Factory , which is used to create objects
that implement agreed interfaces that are called from the common code.
The customized DLLs are provided by Symbian licensees.
One of the major responsibilities of the Symbian C++ layer is to
integrate JSRs on top of the native Symbian OS APIs. However, any
correlation between a Java ME API and its counterpart Symbian C++ API
is only coincidental and minor. The two worlds are completely different
in design, idioms and way of thinking. Still, Java ME on Symbian OS
is tightly integrated with the native Symbian OS services. That implies
that both main layers, the Java layer and Symbian C++ layer, include
a large amount of code that decouples, adapts, abstracts and bridges
between the two worlds. While the Java ME subsystem architecture can
be generalized, the integration of JSRs on top of native Symbian OS is
mostly done on a case-by-case basis. Each JSR brings its own challenges.
Chapter 11 describes a few cases of integrating JSRs on top of the native
Symbian OS services.
In the Symbian C++ layer, there are not only Symbian C++ classes that
act as native peers to their Java object counterparts, there is also much
code that builds up the internal architecture and frameworks. One of
the main frameworks deals with handling asynchronous operations. One
possible way to logically break up this layer is to distinguish between
synchronous operations and asynchronous operations. The flow of the
synchronous operations is that the operation starts in the Java layer, enters
the JNI layer, goes down to the Symbian C++ layer and then goes all
the way up again. Asynchronous operations do the same thing, with one
fundamental exception - when they reach the native Symbian C++ layer,
before going up again, they queue the asynchronous operation to be
executed on another native thread.
To give an example, getting a file size has to use a synchronous
method in the native Symbian C++ File API. The Java layer delegates
the operation to the native Symbian C++ layer, via the JNI layer, and
 
Search WWH ::




Custom Search