TSM - Internet of Things in the Java Universe

Dănuţ Chindriş - Java Developer

The IT experts called 2014 „the Internet of Things year”, as it was one of the hottest topics of the year that just ended. The assigned title is not surprising at all if we consider that important websites such as dzone.com, jaxenter.com or oracle.com published several articles every week about the technologies that are part of the Internet of Things and the bloggers didn’t waste any chance to write about their latest IoT projects. Publishing houses were vigilant as well, dozens of titles being published in 2014, many more waiting to hit the printing press this year.

All these things happened while a whole bunch of new gadgets and intelligent devices were released and many software platforms and implementations of well known or lesser known protocols were released as well. Many technology passionate people have heard of popular products, launched during the past few years, such as Philips Hue or Nest, but starting with 2014 one would need to put some effort into keeping up with the pace the new devices, such as Sen.se Mother, Fitbit Charge or SkyBell are released at. IoT influences more and more the areas of everyday life, such as health, with devices that monitor the patients, home nursing, using gadgets for a healthy lifestyle, transportation, with connected vehicles, home automation, industry etc.

Before we start talking about the ways the Java community can have its voice heard in the Internet of Things space, we owe the reader a short description of what exactly is IoT.

Definitions

The Internet of Things or shortly IoT is a concept discussed more and more during the past few years, but what it means is not always well understood. CASAGRAS (Coordination and support action for global RFID-related activities and standardisation) gives us a rather definition which says about IoT the following: it is “a global network infrastructure, linking physical and virtual objects through the exploitation of data capture and communication capabilities. This infrastructure includes existing and evolving Internet and network developments. It will offer specific object-identification, sensor and connection capability as the basis for the development of independent cooperative services and applications. These will be characterised by a high degree of autonomous data capture, event transfer, network connectivity and interoperability.” [1]

The definition offered by Stephen Haller of SAP helps us see a clearer image of the Internet of Things, which is seen as “a world where physical objects are seamlessly integrated into the information network, and where the physical objects can become active participants in business processes. Services are available to interact with these ‚smart objects‘ over the Internet, query and change their state and any information associated with them, taking into account security and privacy issues.” [2]

Another explanation is given by Oracle, who states that “the Internet of Things is about collecting and managing the massive amounts of data from a rapidly growing network of devices and sensors, processing that data, and then sharing it with other connected things.” [3] To better understand the dimension of these data volumes we can take a look at the Oracle Team USA navigation team, who works with boats equipped each with 300 sensors, intended to give information about a multitude of parameters, such as strain on the mast, effectiveness of sail adjustments, even the strength and stability of the hull. These sensors measure 3000 variables 10 times every second, producing 500 GB of raw data a day. Another interesting aspect is the fact that today only 11% of the total volume of data is generated by devices, but IDC estimates that by 2020 the percentage will raise to 40%.[4]

This descriptive title which tries to catch the essence of the next big trend in IT is actually the effort to rethink our relationship with the objects we use every day and also the relationship of the objects one with each other. According to the experts, IT will strongly pursue this direction. Proof to this statement is the fact that several big names of the 21st century’s technology, such as Cisco or Bosch, performed studies on this subject, concluding that the IoT projects will exceed the economical value of $15 trillion annually by 2020[5]. Also the analysts from Cisco state that in 2010 there were over 12.5 billion objects connected to the Internet and estimate that there will be approximately 25 billion of intelligent things connected to the Internet by the end of 2015. For the year of 2020 their prediction is that of 50 billion things connected [6].

Oracle and Java Embedded

In this context enters the stage Java, both as platform based on the Java Virtual Machine and as programming language, having a community of over 9 million users. We make this distinction between platform and language [7] because a device running a JVM is not limited to execute Java applications only; these may be, in certain conditions, applications written using Scala, Clojure etc. In the past, the embedded devices’ programming was done mainly in low level languages such as C or assembly.

In this article we will try to create an opinion about the IoT solutions proposed by Oracle, a company whose Java platform implementation benefits from the highest level of popularity among programmers. However in future articles we will look closely the features of other Java projects for IoT, such as those belonging to the stack developed by Eclipse Foundation.

During the past few years Oracle was massively invested into a series of products called sugestivelly Java Embedded, which offers the Java programmers the possibility to write applications for such devices, from smart cards and wireless modules to single board computers (SBC), such as Raspberry PI. The Java Embedded platforms are the main thing Oracle offers to the embedded developers and through which it contributes to the Internet of Things space.

Oracle’s vision for Java 8 was to release, besides the Standard Edition (SE), two other important variants of the platform, precisely the Oracle ME Embedded 8 and Oracle Java SE Embedded 8, adding the Java Embedded Suite to the list. Henrik Ståhl, vicepresident over product management for Java and IoT at Oracle, states in the November/December 2014 of the Oracle Java Magazine that by launching these variants of the platform they have made „available the features the programmers are used to in Java SE, on the embedded platforms also” [8].

With the release of the new version of the distributions mentioned above, Oracle has tried to bring the two platforms to the highest level of compatibility and, at the same time, to align them with Java SE 8. To accomplish this, they introduced the concept of Compact Profiles, the developers being able to choose between the complete set of Java SE APIs and three other subsets which only have available those APIs that are necessary for the relevant use cases. Such a use case could be running an OSGi stack (Open Service Gateway initiative), As we’ll see in a future article, OSGi plays an important part when it comes to the efforts made by the Eclipse Foundation for implementing a complete IoT stack, called Open IoT stack for Java.

Starting with Java version 8 which was released in the first part of 2014 we saw that Oracle has put considerable effort into bringing the Micro Edition (ME) variant of the platform up to date, confirming the commitment of the corporation in the IoT solutions war. Among the enhancements made on the platform there is the increased efficiency of the deployment process on small devices, such as intelligent sensors or the embedded gateways. Also the APIs have been updated to answer the programming needs for the target devices. Through this new Java ME version the platform has more things in common with Java SE, but there are some features, such as reflection or lambda expressions that still have to be added. This is an important aspect, because this way, any Java programmer will be able to get involved in embedded projects in a short time, without much effort. Henrik Ståhl announces that in 2015 some hardware manufacturers plan to integrate Java ME in their devices, which will lead to a higher adoption rate of the platform.

Figure 1 Overview of the Oracle Java ME Embedded 8 platform[9]

The components built using the embedded solutions we’re talking about, deployed in an IoT context, give business applications access to resources installed in the surrounding environment, both to receive input from them and to issue commands. Such a use case is the orchestration of heterogeneous temperature and lightning control systems in a building. We notice that the ability of Java ME to control equipment such as sensors, valves or servo-motors is a fundamental aspect for building an IoT infrastructure.

Looking at it from afar we can notice that the Java architecture allows us to create vertical applications, as Maulin Patel, the leader in embedded processing solutions at Freescale showed [8]. First we collect data from intelligent objects with Java ME, then we switch to Java SE for gateway services, and in the end we execute the data processing and handling with Java EE in the cloud.

Almost every time there is a talk about IoT the security problem is brought up. In an open and heterogeneous environment as the Internet of Things infrastructure is, security is essential but hard to get. It is enough that an attacker has to one of the IoT solution’s components to be able to exploit the possible flaws in its defensive system. For instance, when it comes to the intelligent meters the person that would profit most from compromising these units could be the owner of the building where they were installed. Thus the potential attacker has even physical access to the equipment, a problem which raises questions concerning the levels where the security mechanisms should be implemented. Now that we have noticed the seriousness of this matter, we can announce that there is good news for the IoT developers in the Java universe, because this platform guarantees the data security on the entire verticality of the implemented system. Security is a feature embedded into the platform’s architecture, being developed and updated constantly, with each new version. We will give more details concerning the security model offered by Java ME Embedded 8 in one of the next paragraphs when we will talk about a few technical features of the platform.

Java ME Embedded 8

The platform dedicated to the devices having the least resources, for instance cards, is called suggestively Java Card. However, the first product in the Oracle family that brings an important influence in the IoT space is Java ME Embedded 8. Consequently, in the following paragraphs we will focus on this product. Before we look at some of its details, we have to mention that Java ME Embedded comprises two versions: Java ME Embedded and Java ME Embedded Client.

Java ME Embedded 8 is a platform that can be used by devices that have less than 1 MB of memory. Thus it is fit for intelligent object that don’t possess graphical interface, with long “on” time and limited resources.

As we can see in Figure 1, the foundation for Java ME Embedded 8 is the virtual machine, found here as Connected Limited Device Configuration or in short CLDC 8. This component represents a subset of Java SE 8, dedicated to embedded devices. As we mentioned above, along with version 8, CLDC means a first step towards a better alignment with Java Standard Edition and also an important leap from CLDC 1.1.1. Consequently, we have annotations, generics and many other Java features, familiar to all developers. Although there has been an important evolution with the release of CLDC 8, the binary compatibility with the previous version hasn’t been forsaken.

Above the foundation represented by CLDC 8 lay several essential components for the platform. One of them is Generic Connection Framework (GCF 8). As one can guess this component handles the connectivity problems. This framework is necessary as in the embedded space the connectivity possibilities are numerous and the devices where our application runs have various communication interfaces with the outer world. Some may have Wi-Fi connectivity capacity, others cellular type, Bluetooth or cable. Also for an optimized connectivity control GCF 8 exposes the AccessPoint API. In addition GCF 8 comes with support for IPv6, freeing the Java ME Embedded 8 developers from the fear of IPv4 addresses exhaustion.

Back to the subject of security in the Internet of Things world, we can offer a few details about the way GCF 8 solves this problem. Java ME Embedded 8 comes equipped with implementations of the latest security standards, among whom we can count Transport Layer Security 1.2 and Datagram Transport Layer Security 1.2. Thus, Oracle assures the users of the platform that it offers “the higher network and authentication encryption levels” [9].

Another building block for Java ME Embedded 8 is the Micro Edition Embedded Profile 8 (MEEP 8). This component is responsible with defining the model, the container where the application runs, in general with its lifecycle. Through MEEP 8 we can share code among applications; we can update components in the system or apply patches to the application. Sharing libraries – called suggestively LIBlets – is done through MEEP 8 also, and it contributes to the minimizing of memory need and applications modularization. In addition, MEEP 8 offers the applications the possibility to communicate one with another either synchronously (Inter-MIDlet Communication or IMC) or asynchronously through a messaging system based on events.

Security is an important topic for MEEP 8 too, because one can define security policies for authentication and authorization based on the situation at hand. Thus, the code is loaded and executed in a secure environment, as every component is associated to a client and having specific permissions. These have to be verified at every access attempt.

A crucial component for Java ME Embedded 8 is the Device Access API which offers the applications access to the peripheral devices such as the sensors, switches or LEDs. This component was part of the previous versions as well, but now it come with new features, among whom we can enumerate late binding, which allows for new peripherals to be added without changing the API.

Together with these building blocks, Java ME Embedded 8 comes with numerous APIs; such is the one for web services or localization.

Having all these Java ME Embedded components at our disposal, it’s within our grasp to build embedded applications, making a contribution to the Internet of Things space.

Java ME SDK 8 comes to our aid; it is a complete toolkit, created to meet all our needs while creating and maintaining an application. This SDK offers an emulation environment that gives us the possibility to test our applications even if the target devices aren’t available at development time. We can also debug both in emulation mode and when the application is running on the device. To make this toolkit complete, Oracle offers plugins for Netbeans IDE and Eclipse IDE which incorporate all the features of the SDK. We will discuss more things and give examples of how to use Java ME SDK 8 in one of the following articles.

Java ME Embedded Client is a CDC (Connected Device Configuration) implementation which, in principle, is the configuration targeted to the mobile devices that have some more resources, such as smart phones. For Java ME Embedded Client this configuration has been narrowed and optimized to fit the low-end and medium embedded systems. Although the footprint of this configuration is small it offers a large portion of the Java language. Thus Java ME Embedded Client is destined to intelligent objects having less than 10 MB of memory and without graphical interface.

Conclusions

The Romanian IT industry is not foreign to the Internet of Things space; we began to see products Made in Romania released, such as Pocketo or Tintag. Also there are companies in Romania that are involved in projects fit for the IoT paradigm. For instance, we see such a project at Braşov in the automotive domain, with the concept of connected car. Another thing to be glad about is the fact that there are IoT events one of them being ALT Festival which took place in November 2014 at Braşov.

An important objective for Oracle in the last period of time is the advancement of the Java platform in the fight that is being for among the IoT solutions. Moreover the corporation expressed its desire to win this battle so that Java would become the choice of the majority of the specialists involved in such projects. However the answer of the opponents was quick, a few voices expressing their skepticism concerning the fitness of the platform in the IoT space. There are many arguments both for and against this idea but one thing is certain: Java has come a long way to reach the current level of maturity, diversity and application. The efforts from the last years brought forth a new products family, that prove themselves promising and more than that begin to prove their value within real IoT projects. We will clearly see this thing in the next article when we will touch, through some examples, the practical side of the Java ME Embedded 8 platform.

Resources

[1] CASAGRAS, “RFID and the Inclusive Model for the Internet of Things”

[2] Stephen Haller, “Internet of Things: An Integral Part of the Future Internet”, SAP Research, 2009

[3] “The Internet of Things: Manage the Complexity, Seize the Opportunity”, Oracle Corporation, 2014

[4] “IDC Digital Universe Study”, sponsored by EMC, December 2012

[5] Dzone Research, “2014 Guide to Internet of Things”

[6] http://share.cisco.com/internet-of-things.html

[7] Benjamin Evans, Martijn Verburg, “The Well-Grounded Java Developer”, Manning, 2013

[8] “Java Development for the Internet of Things”, Oracle Java Magazine, November/December 2014 Issue

[9] http://www.oracle.com/technetwork/articles/java/ma14-java-me-embedded-2177659.html