The first application we developed using JAWAP was a simple
horoscope feature: The Russell Grant Horoscope. This was a
service that provided a user with their horoscope. The following
requirements were applied:
Ø The first time a user uses
the service, a screen is presented requesting the user's star
sign.
Ø The horoscope for that star
sign is then displayed.
Ø The user's star sign is
recorded in an LDAP directory for future use.
Ø The user has the option of
changing their star sign.
Ø A help feature is provided
if the user is not sure of their star sign.
Ø When the user returns to
the service, the star sign recorded in the LDAP directory is
referenced and the relevant horoscope displayed.
Ø The feed is provided in XML
and fetched via HTTP. The feed is updated on a daily basis.
Ø The Ericsson R320, Nokia
7110 and Motorola Timeport P7389 are to be supported.
As specified, the feed was to be provided in XML. Here is a
snippet of the Aries and Taurus code on the 16th February 2000.
<horoscope type="daily" at="20000216">
<star sign ="Aries. Mar21-Apr20">
<text>Your home environment is due for
a shake up. Whether you're a student of Feng Shui or a master, you
could do worse than to steal some decorative ideas from this old
oriental way of living. The introduction of anything wooden or to
do with communication is excellent.</text>
</star sign>
<star sign ="Taurus. Apr21-May21">
<text>You'll be up with the movers and
shakers if you open your mind to new ideas and techniques. Getting
involved with anything from the World Wide Web to computers per se
will lead to all kinds of interesting future opportunities. A
travel choice should be made today.</text>
</star sign>
</horoscope>
The JAWAP framework was used, and the following implementation
classes were developed:

Ø Horoscope: Simply the
identification of the service, locatable by a URL. No load
distribution is provided for the first implementation.
Ø HoroscopeServer: This is
active for the deployment of the service. On instantiation, the
feed object is created and a thread of the feed class is
started.
Ø Feed: The content is
fetched via HTTP at instantiation. The feed is updated daily, being
refreshed at midnight.
Ø HoroscopeData: The current
set of horoscopes is stored in this class and passed to the
horoscope session when a user initiates a service session.
Ø TokenStream: This class is
used to parse the HoroscopeData to select a particular star
sign.
Ø HoroscopeSession: The WAP
session is held in this class.
Ø HoroscopeLDAP: The logic to
fetch the user's profile is implemented in this class. For the
demonstration, a dummy class is used; otherwise a directory server
would be needed.
Ø R320Display: The
implementation for the Ericsson R320.
Ø N7110Display: The
implementation for the Nokia 7110.
Ø P7389Display: The
implementation for the Motorola Timeport P7389.
A display class exists for each WAP browser supported. For this
application, the Ericsson R320, Nokia 7110 and Motorola P7389 are
supported.

The Ericsson R320, illustrated above, has the smallest screen of
the three devices. But if word wrap is used, the content is
compatible with all the devices.

For the Nokia 7110 there is no horizontal navigation. This does
not pose a compatibility problem, as the application does not have
any side-by-side links. The deck size for the Nokia is different
from the R320, and so this value has to be checked.

The Motorola Timeport P7389 uses the Phone.com browser, which is
shown above, and has some differing characteristics from the other
two browsers. The most significant of these is that the deck title
is not automatically placed at the top of the screen.
Because the display is implemented in a Java class, inheritance
can be used optimally. The following class model is applicable:

The Ericsson R320 was developed first, and selected as the basis
for all the other devices. The classes N7110 and P7389, for the
Nokia and Motorola, were extended versions of the R320, with only
small changes. This was a very neat solution, as there was
substantial commonality between the devices. (The button set, for
example, was common to all.) The diagram above shows a possible
extension for a future Nokia release where there is commonality
with the 7110.