Download presentation
Presentation is loading. Please wait.
Published byAimee Westerman Modified over 10 years ago
1
1 Separation of Concerns in Mobile Agent Applications Naoyasu Ubayashi Toshiba Corporation) Tetsuo Tamai University of Tokyo Reflection2001 The Third International Conference on Metalevel Architecture and Separation of Crosscutting Concerns Kyoto, Japan September 25-28, 2001
2
2 Plan of Presentation 1. Introduction 2. Problems of constructing cooperative mobile agent applications 3. RoleEP model and Java RoleEP Framework 4. Related works 5. Conclusions
3
3 1. Introduction
4
4 Background Recently, cooperative distributed applications based on mobile agent systems are increasing. Using mobile agents, we can develop cooperative distributed applications that run over the Internet more easily and more flexibly than before. But, there are problems...
5
5 Problems It is difficult to understand collaborations among agents and travels of individual agents as a whole because mobility/collaboration functions tend to be intertwined in the code. It is difficult to define behaviors of agents explicitly because they are influenced by the external context. Agents may change their functions dynamically. host agent mobility function collaboration function intertwined!
6
6 Aspects of mobilty/collaboration Many aspects of mobility/collaboration strategies including traveling, coordination constraints, synchronization constraints and security-checking strategies should be considered when mobile agent applications are constructed.
7
7 Goal of this research This research proposes the concept of RoleEP (Role Based Evolutionary Programming) in order to alleviate the problems mentioned here. 1) RoleEP provides a mechanism for separating concerns about mobility/collaboration in mobile agent applications. 2) RoleEP gives a systematic and dynamic evolutionary programming style. Goal
8
8 2. Problems of constructing cooperative mobile agent applications Traditional approaches
9
9 1. Orthodox approach 2. Design-pattern approach 3. AOP approach
10
10 Example A distributed information retrieval system (a typical example of cooperative distributed applications based on mobile agent systems) contract-net protocol ( collaboration) Host user proxy roaming around hosts (mobility) searcher (manager) contract-net protocol ( collaboration) (contractor) User A user requests an agent to search information on specified topics.
11
11 Viewpoints for estimation Viewpoints Separation of concerns1) roaming around hosts (mobility) 2) contract-net protocol (collaboration) Evolution1) User proxy agent (evolve) Manager agent 2) Searcher agent (evolve) Contractor agent User proxy + User proxy + Manager
12
12 Case1: Orthodox approach A program description maps domain structures to program structures. Approach
13
13 Description of case1 -- Written in quasi-code similar to Java public class UserProxy { public void roam(){ : // move to the next host // and execute the method // "contractNet_start" } public void contractNet_start(){ : // multicasts a task-announcement message // to all agents existing in the host. } public void contractNet_bid(){ : // select the best_contractor // if all bids are finished. best-contractor.contractNet_award(); } public void contractNet_end(){ // save the information // from the best_contractor // move to the next host roam(); }} Code for roaming around hosts is mixed with code for executing the contract-net protocol. Mobilty function Mobility function Contract-net function In most cases, mobile agent applications are described in this programming style !!
14
14 Estimation of case1 ViewpointsEstimation Separation of concerns × Evolution × It is difficult to understand a program behavior as a whole since mobility/collaboration functions that compose a program are not described separately. Merit Problem none Estimation
15
15 Case2: Design-pattern approach Design patterns for Aglets (Aridor, Y. and Lange, D.B.) 1) Traveling Patterns: Itinerary, Forwarding, Ticket, etc. 2) Task Patterns: Master-Slave, Plan, etc. 3) Collaboration Patterns: Meeting, Locker, Messenger, Facilitator, Organized Group, etc. Collaborations among agents are structured using design patterns focused on mobile agents. Approach The Aglets is a mobile agent system based on Java.
16
16 Description of case2 -- Written in Aglets public class UserProxy extends Aglets{ public void roam(){ // sets sequential planning itinerary itinerary = new SeqPlanItinerary(this); itinerary.addPlan(HostAddress1, "contractNet_start"); : itinerary.addPlan(HostAddressN, "contractNet_start"); // starts the trip itinerary.startTrip(); } public void contractNet_start(){ // multicasts a task-announcement message // to all agents existing in the host. : // waits until contract-net process is finished } public void contractNet_bid(){ // select the best_contractor // if all bids are finished. : best-contractor.award(); } public void contractNet_end(){ // saves results of the task execution. : // notifies this agent. }} Itinerary Pattern Separated! (within an agent) Contract-net function Mobility function This program is written in Aglets using the Itinerary pattern, a design pattern for roaming around hosts.
17
17 Estimation of case2 Problem Merit Code for roaming around hosts is separated from code for executing the contract-net protocol. Separations of mobility/collaboration descriptions are limited only within an agent. As shown in the program, if a roaming agent wants to behave as a manager at the host machine the agent moves into, functions requested for a manager should be described as methods of the agent ! Estimation ViewpointsEstimation Separation of concerns Evolution ×
18
18 Case3: AOP approach (Aspect Oriented Programming) AOP is a programming paradigm such that a system is divided into aspects and objects. Crosscutting concerns are defined as aspects. A compiler, called weaver, weaves aspects and objects together into a system. Kendall, E.A. proposed role model designs and implementations with AspectJ that is an aspect-oriented extension to Java. Approach
19
19 Description of case3 -- Written in AspectJ public class UserProxy{ public void roam(){ … }} aspect Manager extends Role{ // introduces public void UserProxy.start(){} public void UserProxy.bid (InforSearcher i){} public void UserProxy.end(Result r){ } // advise weaves before (Userproxy u) : target (u) && call (public void start) {…} before (Userproxy u) : target (u) && call (public void bid) {…} before (Userproxy u) : target (u) && call (public void end) {…} } public class InfoSearcher{ public void executeTask(){ … }} aspect Contractor extends Role{ // introduces public void InfoSearcher.taskAnnounce (Userproxy u) {} public void InfoSearcher.award (Userproxy u) {} // advise weave before(InfoSearcher i): target (i) && call (public void taskAnnounce) {…} before (InfoSearcher i): target (i) && call (public void award) { u.end( executeTask() ); } weaver program static weaving Mobility function Contract-net function Contract-net function
20
20 Estimation of case3 Each aspect must be defined per a role. A description that crosscuts roles may be dispersed in several aspects. Dynamic evolution is not emphasized. Problem Merit Code for roaming around hosts is separated from code for executing the contract-net protocol completely. Estimation ViewpointsEstimation Separation of concerns Evolution
21
21 Estimation of traditional approaches (summary) ApproachesViewpoints (Separation of concerns)(Evolution) Orthodox approach × × Design-pattern approach × AOP approach In traditional approaches, language constructs for separation of concerns and evolution are insufficient. In traditional approaches, language constructs for separation of concerns and evolution are insufficient.
22
22 3. RoleEP model and Java RoleEP Framework
23
23 Goal of RoleEP 1) RoleEP provides a mechanism for separating concerns about mobility/collaboration in mobile agent applications. 2) RoleEP gives a systematic and dynamic evolutionary programming style.
24
24 RoleEP Model RoleEP is composed of four model constructs -- environments, roles, objects and agents [Evolution (object agent)] Object bind Binding-interface (abstract method) Role Agent migrate Environment
25
25 Model constructs (1) A function that an agent assumes in a field. Environment A field where a group of mobile agents collaborate with each other. Role Mobility/collaboration functions including tours around hosts and message communications among agents are described by role attributes and role methods. Role Agent migrate Environment Role
26
26 Model constructs (2) Object An object becomes an agent by binding itself to a role that is defined in an environment, and acquires functions needed for collaborating with other agents that exist in the same environment. [Evolution (object agent)] Object bind Binding-interface (abstract method) Role Agent migrate Environment Objects have original functions that are common to all kinds of environment and do not contain mobility/collaboration functions. Agent
27
27 Model constructs (3) Binding-operation Agent ( Role + Object ) role method binding-interface Role Object bind rename signature & delegate concrete methods (before action) send a message corresponding to (after action) binding-interface Binding-operation binds binding-interfaces of roles to concrete methods of objects. The binding-interface defines the interface in order to receive messages from other roles existing in the same environment. Using the binding-interface, collaborations among a set of roles can be described separately from each object. Binding-operations are implemented by renaming signatures and creating delegational relations between roles and objects dynamically.
28
28 Separation of Concerns in RoleEP Model Mobility/Collaboration functions Mobility/Collaboration functions Original functions separated [Evolution (object agent)] Object bind Binding-interface (abstract method) Role Agent migrate Environment
29
29 Model constructs (Summary) environment ::= [environment attributes, environment methods, roles] role ::= [role attributes, role methods, binding-interfaces] agent ::= [roles, object] object ::= [attributes, methods]
30
30 Construction of Cooperative Mobile Agent Applications in RoleEP Cooperative mobile agent applications, which may change their functions dynamically, can be constructed by synthesizing multiple environments dynamically. Evolutionary construction
31
31 Epsilon/J -- Java RoleEP Framework Epsilon/J is a framework that supports RoleEP concepts.] This framework, which is presented as class libraries, is implemented on Aglets that is a mobile agent system based on Java.
32
32 Description in Epsilon/J public class Roaming extends Environment{ public class Visitor extends Role{ …} } public class ContractNet extends Environment{ public class Manager extends Role{ public void start(){} public void bid(){} public void end(){} } public class Contractor extends Role{ public void award(){ m.end ( executeTask() ); }} public class UserProxy extends EpsilonObj{ public void life(){ bind... bind... } public class InfoSearcher extends EpsilonObj{ public void life() { bind( executeTask, searchInfo); } public void searchInfo(){ …} } object Environment & role Dynamic evolution! addBindingInterface (executeTask) addBindingInterface (executeTask) Mobility function Contract-net function
33
33 Binding-operation Agent ( Role + Object ) ExecuteTask (binding-interface) bind Rename signature & delegate concrete methods Contractor Role Searcher Object If the binding-interface executeTask is bound to the method searchInfo, the message "executeTask" received by the role is renamed "searchInfo" and delegated to the object. UserProxy Object Manager Role searchInfo Separated!!
34
34 Estimation of RoleEP ApproachesViewpoints (Separation of concerns)(Evolution) RoleEP Orthodox approach × × Design-pattern approach × AOP approach
35
35 Merits of RoleEP 1) Construction mechanisms for mobility/collaboration components Environment classes can be regarded as mobility/collaboration components. 2) Evolution mechanisms for agents An object can dynamically evolve to an agent that can behave multiple roles. Using RoleEP, programs that adapt to external context can be described easily. 3) Agentification mechanisms In RoleEP, a role corresponds to a transducer that accepts messages from other agents and translates them into messages that an object can understand. RoleEP can be regarded as one of dynamic agentification mechanisms.
36
36 4. Related works
37
37 Related works Aspect Oriented Programming (Kiczales, G., et al.) Subject Oriented Programming (Harrison, W. and Ossher, H.) Hyperspaces Pluggable composite adapter (Mezini, M., et al.) Role model (VanHilst, M. and Notkin, D.) SOC ( Separation of Crosscutting Concerns ) RoleEP emphasizes not only SOC but also dynamic evolution !
38
38 5. Conclusions
39
39 Conclusions We proposed RoleEP, a new approach that constructs cooperative mobile agent applications. 1) RoleEP provides a mechanism for separating concerns about mobility/collaboration in mobile agent applications. 2) RoleEP gives a systematic and dynamic evolutionary programming style. 1) RoleEP provides a mechanism for separating concerns about mobility/collaboration in mobile agent applications. 2) RoleEP gives a systematic and dynamic evolutionary programming style.
40
40 Appendix
41
41 AOP vs RoleEP viewpoint AOPRoleEP aspectsaspectsenvironments and roles componentscomponentsobjects joint points join pointsroles (between aspects and components) weaving methodweaverbinding-operation aspect reuseemphasizedemphasized dynamic evolutionnot emphasizedemphasized
42
42 Pluggable composite adapter adapter ContractNet { adapter Manager adapts UserProxy { public void start(){...} public void bid() {...} public void end() {...} } adapter Contractor adapts InfoSearcher { public void taskAnnounce(){...} public void award(){ InfoSearcher.this.searchInfo(); } }} Notions of the pluggable composite adapter are quite similar to RoleEP. However, there are some differences between them as follows: 1)A relation between an adapter and an adaptee is described statically in the the pluggable composite adapter; 2)Descriptions of adapter's behavior depend on interface names of adaptee's class in the pluggable composite adapter.
43
43 Mobile Ambients Mobile Ambients (Cardelli, L. and Gordon, A.D.) This model gives a layered agent structure. In this model, agents run on fields constructed by synthesizing contexts (environments) dynamically.
44
44 *If a role receives a message corresponding to its binding-interface from other roles or itself, the role delegates the message to an object bound to the role.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.