Hardware Reference
In-Depth Information
Creating Your Own Applets
To fully appreciate the development methodology of applets, it's necessary to know a little about WARP. WARP is
a system built on WebFace that abstracts the basic elements of web design to ensure that the control logic and presentation
elements are strictly separated. This means that it's not possible to add a link in your page with the following:
<a href="process.php?bedroom_light=on">Switch Light On</a>
but instead you have to ask an applet manager to generate one for you:
$html = $appMan->getAppletLink($applet, "on", "bedroom_light", "Switch Light On");
You would then pick up the argument like this:
$prm = $appMan->queryParameter($applet, "bedroom_light");
This approach has several benefits. Naturally, it forces a separation between logic and display, which encourages
more structured code, and it means you can place the applet onto any page you like, since the page itself isn't
mentioned. But more important, it allows for an easy upgrade path. WARP is based on something akin to a RESTful
approach. Because HTTP is a stateless protocol, there is no way of remembering the user action from one page to the
next. Some web sites do this by using lots of different pages, where the page itself is an implicit reminder of the state.
Some will create server-side objects that remember the state and last for as long as your browser is looking at the
page or until an arbitrary timeout. WARP does this by recording the state as part of the URL. And with several applets
appearing on each page, each applet must therefore have its own part of the URL indicating its own state. A typical
URL might appear as follows:
http://my.minervahome.net/minerva/wmm.php?WRP001X1_user=0&WRP001X1_day=0&WRP002X3_dpage «
=0&WRP002X3_fpage=0&WRP004X6_current=/&WRP004X6_dpage=0&WRP004X6_fpage=0&wintype «
=main&content=WRP002X&max=WRP002X
If you dissect this carefully, you can see that each parameter fits the pattern of WRP, followed by a three-digit
applet code, an X separator and parameter index number, an underscore, and then a name/value pair. There are also
some parameters that describe WARP's internal state in the form of wintype , content , and max . Naturally, attempting
to generate or parse this URL manually would be foolhardy!
The WARP Directories
There are three directories of note inside minerva/warp :
applets : The code and assets for each of the applets, inside their own subdirectory
conf : The configuration data for the earlier applets, inside an identically named
subdirectory
warplib : The base and operational classes for the applet and applet manager
Search WWH ::




Custom Search