Context Services: JContextAPI
JContextAPI is the Java implementation of the context service of the Open Wearable Computing Framework (OWCF). There is a lightweight version of JContextAPI for the .NET framework: this version has some limitation in functionalities, but it offers interoperability between the Java platform and the .NET platform.
JContextAPI is a Java API for building context-aware applications. Context information is modelled as a set of events, and JContextAPI offers the software infrastructure that allows the distribution of these events according to the publisher-subscriber design pattern. Context information can be produced by a variety of sources, which can be integrated as publishers of context events within JContextAPI. The application using JContextAPI can register a set of subscribers, which will be notified of context events.
JContextAPI offers also networking capabilities: it allows seamless exchange of context events among several applications that use the API and that are connected to the same IP network.
JContextAPI has a component-oriented architecture based on the core framework of OWCF. Each component is defined by a Java interface, and it is implemented by a class included in JContextAPI. All components are configurable through a set of XML files; configuration of components is achieved through the dependency-injection capabilities of the core OWCF.
JContextAPI are based on a simple idea: a Java application can be made context aware adopting an event notification mechanism. The application explicitly subscribes to event notification, and context changes are then notified as events. The event notification mechanism abstracts the application developers from the (possibly very complicated) details of capturing and generating context information, which is an operation that may involve some low level APIs for interfacing with dedicated hardware (such as sensors).
Since there are several sophisticated low level context processing toolkits, the JContextAPI provides also ad-hoc interfaces towards these toolkits. The ad-hoc interfaces shields the application developers from the internal mechanism of the specific context processing toolkits, and expose context information as events in the upper layers of the architecture.
The following picture gives a high level view of the JContextAPI architecture.
The JContextAPI provides a middle layer (shown in green), which sits between the Application code (in orange), and low level APIs or toolkit for context processing (in blue). Although the JContextAPI uses dedicated context processing toolkits for obtaining pre-elaborated low level context information, it is also possible to develop custom context processors, which are dedicated components for processing data and generating custom context events.
The event notification mechanism is based on the classical Observer pattern:
- the context aware application implements and register a listener for specific context changes events
- JContextAPI manage registered listeners and notify them when corresponding context changes happen
- if the application is no longer interested in receiving context changes events, then it can remove its listener
The following diagram shows the basic sequence of operations.
JContextAPI allows also to build a distributed event notification systems: a set of context aware applications may run on corresponding set of networked machines (one application per machine), and can exchange context events among them. JContextAPI uses a simple peer-to-peer approach to allow distribution of context events among the set of applications.
System Requirements
JContextAPI is compatible with a system supporting Java 2 Standard Edition version 1.3.1 (J2SE).
Maturity Level (?)
| Component Name | Responsible Partner | Initial Maturity Level | Current Maturity Level |
| Context Services: JContextAPI | HP | 0 | 7 |


