The wide-spread acceptance of mobile devices (e.g., smartphones, tablets) changed the development as well as the use of software applications radically. Because applications running on mobile devices change their location and, hence, their environmental situations they are used in, they have to adapt their appearance and behaviour accordingly. This kind of flexibility is commonly called context-aware adaptation in self-adaptive systems. Currently, such systems rely on an environmental model (i.e., context model), which describes the entities of the execution context and their relationships. In these models, software engineers predefine statically at design-time which contextual information can be observed at runtime. At runtime a MAPE-K-Loop [1] (a) monitors the environment using sensors, (b) analyses the gathered data to instantiate the context meta-model, (c) plans necessary reconfigurations, and (d) executes the chosen plans. The main problem, however, is that software developers usually cannot predefine all environmental entities, which could be important for an adaptation process at runtime, at design-time. Lets consider an application that mutes a smartphone automatically, every time the user must not be disturbed (e.g., the user is participating in a meeting). The fact, however, that a user would be disturbed by a ringing smartphone is highly individual. A developer of such an application could most possibly not foresee all individual cases (e.g., when a baby is sleeping within the same room the user is located). To address this problem, the adaptation process itself should adaptable.
SMAGs is a modeldriven, platform independent design and operation principle for fine-grained, dynamic and unanticipated adaptation with a focus on increased reuse. SMAGs consists of many small, distributed applications that are linked dynamically. Role-Based Design and Programming [1] is used to change the structure and behaviour of individual applications as well as to express dynamically varying relationships across several distributed applications. A role is a dynamic service of an object in a specified context, offering the possibility to express separation of concerns, interface-structuring, dynamic collaboration description, and access restriction [7]. Roles are played by objects, dynamically altering the structure and behaviour of the player. In other words, roles enable an adaptation technique on meta-layer M0, the object-layer. On the one hand, roles can extend the object’s state and functionality (i.e., introduce new methods and/or attributes). On the other hand, the objects existing behaviour can be changed. Furthermore, roles contain references to other roles. Since roles can be played and discarded at runtime, they are capable of expressing dynamically changing relationships across multiple system entities (e.g., objects, components, etc.). The major difference to other invasive composition approaches (e.g., aspects) is that roles are played within a context (e.g., ”a person plays the student role within the context of an university”). This tight coupling between behaviour and environmental conditions makes Role-Based Design a powerful approach to model Self Adaptive Systems (SAS).
Figure 1: Design/Runtime Artifacts
As depicted in Figure 1, at design-time, a platform independent Meta Architecture defines Component Types which specify provided and required Port Types. A Port-Type represents an interface specification. From several Meta Architectures a platform specific architecture can be derived, describing Components implementing Component Types and Ports implementing Port-Types. Ports can be grouped into Port Models. Each Port Model is associated with a binding to components and with environmental conditions, stating when it should be integrated into the application. At runtime, Components can be instantiated and connected by their matching required and provided Port Types. With the instantiation of Ports/Port Models and their binding to Components, the behaviour of individual Component Instances as well as the structure of the overall application can be adapted according to a given context. For more detailed information please read [1]. The SMAGs approach proposes an adaptation architecture. In [1], an overview of this architecture is presented. It represents a MAPE-K loop with the Sensor Layer monitoring the environment and transferring the gathered information to a Context Model. An Inference Layer relates existing and deduces new information based on the data in the Context Model. An Adaptation Layer creates reconfiguration plans based on the information from the Context Model and the current configuration of the adaptive application. Those plans are then executed by a Runtime Environment. Because the adaptation architecture itself is a SMAGs-based application, the concrete implementations (e.g., the Context Model representation etc.) can be changed at runtime. This adaptive adaptation architecture enables Meta Adaptation.
Figure 2: The SMAGs Repository Architecture
Furthermore, the SMAGs approach is based on a distributed repository infrastructure. A repository can be used to store the meta-architecture and architectural information as well as component and port implementations. These artefacts can either be reused at design-time for the design and implementation of new systems or at runtime to extend a running application with new components and ports. Additionally, each repository exposes a Service Trader. Applications can register remotely to offered functionality alongside with contextual information at the Service Trader. Other applications can query the published services to autonomously create dynamically varying SoS. The SMAGs approach is used to model a novel adaptation paradigm for unanticipated adaptation in mobile scenarios.
Figure 3: The Smags Adaptation Architecture
[RWL96] T. Reenskaug, P. Wold, and O. A. Lehne, Working with Objects – The OOram Software Engineering Method. Manning, 1996.
[PRG+12] C. Piechnick, S. Richly, S. Götz, C. Wilke, and U. Aßmann, “Using Role-Based Composition to Support Unanticipated, Dynamic Adaptation – Smart Application Grids,” in ADAPTIVE 2012, The Fourth International Conference on Adaptive and Self-Adaptive Systems and Applications, Nice, France, 2012, pp. 93–102.