摘要
Context-awareness is becoming critical for mo- bile and ubiquitous computing, where the application needs dynamically adapt its behavior to its execution environment. Context-oriented programming (COP) languages support dy- namic behavior adaptation, however, they do not support dy- namic layer addition. As a result, they provide little support for the runtime adaptation of application behavior in case that unpredictable execution environments are encountered. Furthermore, block-structured constructs for layer activation hardly support fine-grain adaptation and separate changes of contexts and execution of context-specific methods with dif- ficulty. In this paper, we propose a virtual machine (VM)- centric approach to address these issues. It incorporates ob- ject composition and delegation into the VM to implement layer activation, and extends existing VM services to sup- port dynamic layer addition. To ensure that our approach preserves the type safety properties of the program, we de- velop a calculus built on featherweight Java (FJ) to describe the approach, focus on type-checking issues, and prove type soundness of the calculus. We also present the implementa- tion and evaluation of our approach. The evaluation demon- strates that our approach has advantages over the compiler- based approach proposed by JCOP.
Context-awareness is becoming critical for mo- bile and ubiquitous computing, where the application needs dynamically adapt its behavior to its execution environment. Context-oriented programming (COP) languages support dy- namic behavior adaptation, however, they do not support dy- namic layer addition. As a result, they provide little support for the runtime adaptation of application behavior in case that unpredictable execution environments are encountered. Furthermore, block-structured constructs for layer activation hardly support fine-grain adaptation and separate changes of contexts and execution of context-specific methods with dif- ficulty. In this paper, we propose a virtual machine (VM)- centric approach to address these issues. It incorporates ob- ject composition and delegation into the VM to implement layer activation, and extends existing VM services to sup- port dynamic layer addition. To ensure that our approach preserves the type safety properties of the program, we de- velop a calculus built on featherweight Java (FJ) to describe the approach, focus on type-checking issues, and prove type soundness of the calculus. We also present the implementa- tion and evaluation of our approach. The evaluation demon- strates that our approach has advantages over the compiler- based approach proposed by JCOP.