devices. Software development for these targets
is well supported. Development typically takes
place using an integrated development environ-
ment or other tools on a development host; the
resulting code is then either cross-compiled for or
directly interpreted on the embedded target.
Active Community Support. There are active,
knowledgeable communities for both hardware
and operating system.
Specific device choices include
• low end: ASUS WL520gU with a 200MHz
Broadcom CPU, 4MB flash, and 16MB RAM for
US$40
• mid-range: ASUS WL500gP v2 with a 240MHz
Broadcom CPU, 8MB flash, and 32MB RAM for
US$65
• high end: Buffalo WZR-HP-G300NH with a
400MHz Atheros CPU, 32MB flash and 64MB
RAM for US$90
The remaining step is to choose an embedded Linux
distribution. Some of the available choices, such as
Tomato and DD-WRT, focus primarily on router func-
tionality, while others, such as Embedded Debian,
have too large a footprint for our target devices. We
have chosen OpenWrt (OpenWrt, 2010) for the fol-
lowing reasons: support for a wide range of devices,
including the three mentioned above; open and flexi-
ble with excellent build system; extensive documen-
tation; mature code base under active development,
and a competent and helpful community. Various em-
bedded distros, including OpenWrt, replace the C li-
brary (usually glibc) with uClibc, which provides es-
sentially the same functionality with a much smaller
memory footprint.
We typically configure our devices to run as wire-
less clients (in so-called station mode) on an existing
wireless network infrastructure. We have confirmed
that the low-end WL520gU can run for four hours on
four rechargeable NiMH AA batteries. In the near
future, we plan to add a small solar panel to charge
the battery pack continually. The advantage of such a
configuration is that it can be deployed where desired
but without the need for any wired connections.
4 RESTFUL SERVICES FOR
EMBEDDED DEVICES
In practice, we have found it challenging to apply
RESTful thinking to green computing on embedded
devices. We cannot simply deploy a service devel-
oped for a conventional platform to an embedded
one. For example, the RESTful sensor proxy example
shown above, implemented in Java using the Restlet
and Spring frameworks, will not run on the limited
Java ME (Micro Edition) virtual machines available
on embedded Linux platforms.
In the remainder of this section, we will discuss
preliminary results from our ongoing effort to eval-
uate programming languages and REST frameworks.
This effort is quite similar to the implementing-rest
project (Amundsen et al., 2011), but with the added
constraint of embedded Linux devices as deployment
targets. As we will discuss below in more detail, this
added constraint requires us to shift focus from Java
and .NET to cross-compilation, scripting, and other
lightweight approaches.
Java. As mentioned above,Java on OpenWrt is lim-
ited to the Java ME platform with the Connected De-
vice Configuration (CDC, JSR 218). The CDC Foun-
dation Profile is a set of APIs designed for headless
servers and other devices without a GUI. Java ME,
still based on Java 1.4.2, is missing important re-
cent additions to the language, most notably, anno-
tations and complete support for reflection, as well
as java.util.concurrent. Because most modern REST
frameworks, dependency injection containers, and
other commonly used frameworks and tools rely on
these language features, they cannot be used on our
target devices out of the box. Even the NetKernel
resource-oriented platform, which explicitly supports
Java 1.4.2, will not work out of the box on Java ME
because it uses the String.replaceAll method instead
of String.replace; we are currently investigating how
much effort it would take to port NetKernel to this
platform. Furthermore, many frameworks rely heav-
ily on XML, which can be memory-intensive and for
which Java ME support is limited (JSR 280); we pro-
pose to rely more on JSON than XML for lightweight
externalized configuration and data exchange. Con-
sequently, if one wants to develop Java services for
embedded Linux devices, one is limited to a solution
stack of older versions of the relevant layers, such as
the Jetty 6.1.x: web server, db4o 7.x object database,
beanshell 2.0b4 scripting environment, and PicoCon-
tainer 1.3 dependencyinjection container. Instead, we
hope that there will at some point be a Java “Micro
Enterprise Edition” that is more up-to-date language-
wise and offers better support for RESTful service de-
velopment for embedded devices.
.NET/Mono. We hope that .NET on the Mono run-
time will eventually be a viable alternative. Mono
is known to run on ARM, but the pertinent docu-
mentation refers to Mono 1.x, while the current ver-
REST ON ROUTERS? - Preliminary Lessons for Language Designers, Framework Architects and App Developers
169