Title: 13Mobile Agents1
1Lecture 13 Mobile Agents
- Topics
- Basics
- Mobile Agent Model
- Applications
- Discussions
- Case study - Aglet
- Some Other Mobile Agents
- Concordia
- MOA
2Basics
- What is Mobile Agents?
- Mobile agents are programs that assist people and
act on their behalf (agent), and they can travel
in network - Mobility Agents that can travel in network
- Autonomy migrate at times and to place of their
own choosing - Compare to ..
- Stationary agent
- Mobile code (Applets)
- Mobile object
3Basics
- Network Computing Paradigms
- Client-Server Paradigm Code-onDemand
Paradigm -
Server
Know how
Download (Applet)
Client
Client
Know- how
Know- how
Server
Mobile Agent Paradigm
Agent
Agent
Network
Know- how
Know- how
Host
Host
4Basics
- Limitation of Client/Server
- Scaling -- Multiple servers
- Quality of network connection
- Reliability , latency , bandwidth
- Protocol
- Advantage of Mobile Agents
- Every node is a server
- Request Network connection
- No application-level protocol
5Basics
- Seven good reasons for Mobile Agents
- Reduce network load
- Overcome network latency
- Encapsulate protocols
- Execute asynchronously and autonomously
- Adapt dynamically
- Naturally heterogeneous
- Fault-tolerant
6Mobile Agent Model
- Agent travel to Host work and interact with
other agents in place (meeting place)
Host
Agent
Place
Resources
Engine
7Mobile Agent Model
- Key concepts
- Agent
- the main entity in Mobile Agent System
- Place
- the environment where agents operate
- Security
- security policies for protecting agents,
networks, and servers
8Mobile Agent Model
- Agent
- State
- needed for resume computation after traveling
- Implementation
- needed for location-independent agent execution
- Interface
- needed for agent communication
- Identifier
- needed for recognize and locate traveling agents
- Principals
- needed to determine legal and moral responsibility
9Mobile Agent Model
- Place
- Engine
- Workhorse and virtual machines for one or more
places - Resources
- Databases, processors, and other services
provided by the host - Location
- The network address of a given place
- Principals
- Those legally responsible for the operation of a
place
10Mobile Agent Model
- Security
- Agent protection
- remote host, other agents, unauthorized third
parties - Host protection
- incoming agents, third parties
- Network protection
- -- incoming agents
- Security Services
- Authentication
- user, host, code, agent
- Integrity
- Confidentiality
- Authorization
- Non-repudiation
- Auditing
11Mobile Agent Model
- Agent Behavior
- Agent Management
- Creation
- Disposal
- Agent Transfer
- Dispatch and Receive
- Agent class transfer
12Mobile Agent Model
- Creation
- Instantiation and identifier assignment
- Initialization
- Autonomous execution
- Disposal
- Preparing for disposal
- Suspension of execution
13Mobile Agent Model
Sender
Receiver
Resume Execution
Suspend Execution
Serialize Agent
Deserialize Agent
Encode Data
Decode Data
Transfer Data
Receive Data
Network
14Mobile Agent Model
Server
Class at Server (code on demand)
Class code
Origin
Server
Agent
Agent
Class code
Class code
Class at origin
Class at destination
15Mobile Agent Model - Standard
- MASIF (Mobile Agent System Interoperability
Facility) defines - Agent management
- Agent transfer
- Agent and agent system names
- Agent system type and location syntax
- MASIF doesnt do
- Language interoperability
- Standardize local agent operations
16Mobile Agent Model - Standard
- OSM (Open Service Model) A model for Global
Information Brokerage and Distribution - The next generation framework for globally
distributed Electronic Commerce and virtual
trading market systems - Contain advanced Java based desktop components
supporting a catalogue browsing, service
inspection, monitoring and construction tools
17Mobile Agent Model - Standard
OSM - Open Service Model
18Applications
- Electronic Commerce
- Personal Assistance
- Distributed Information Retrieval
- Telecommunication Network Service
19Applications
- Example mobile agent systems
- Java-based
- Aglets (IBM)
- Concordia (Mitsubishis)
- Odyssey (General Magic Inc.)
- Voyager (ObjectSpace)
- Others
- Agent Tcl (Dartmouth College)
- Tacoma (Univ.of Tromso and Cornell Univ.)
20Applications
- Benefits
- Platform independence
- Secure execution
- Dynamic class loading
- Multithread programming
- Object serialization
- reflection
- Drawbacks
- Inadequate support for resource control
- No protection of references
- No object ownership of references
- No support for preservation and resumption of the
execution state
21Discussions
- Advantages of Mobile Agents
- Reduced network load
- Reduced resource usage of the client
- Asynchronous processing
- Reconfigurable services
- Active behavior
- Decentralized structure
22Discussions
- Disadvantages of Mobile Agents
- Security threats
- Technical problems
- transport/migration
- efficiency
- standards/interoperability
- billing systems
23Case Study - Aglet
- Aglet A mobile agent that conforms to a set of
security restrictions - A Java aglet is a mobile Java object
- It can move from one host to another
- It supports concepts of autonomous execution and
dynamic routing on its itinerary. - Has its own thread of control
- Is event-driven
- Communicates by message passing
24Case Study - Aglet
Aglet and Proxy Client Interaction Proxy
Aglet
- Aglet Model
- Proxy a representative of an aglet
- Context an aglets workplace (place)
- Identifier
Host, Server process (Engine) and Context
Host
Context
Context
Server Process (Engine)
Network
25Case Study - Aglet
- Aglet Life Cycle
- Creation
- Cloning
- Dispatching and Retraction (Mobility)
- Activation and Deactivation (Persistence)
- Disposal
Dispose
Context A
Context B
Clone
Dispatch
Aglet
Aglet
Retract
Create
Deactivate
Activate
Disk storage
Class File
26Case Study - Aglet
- Aglet Event Model
- Clone listener
- Mobility listener
- Persistence listener
Clone event
CloneListener
Aglet
Mobility event
MobilityListener
PersistenceListener
Persistence event
27Case Study - Aglet
- Aglet Communication Model
- Allows aglets to create and exchange messages in
flexible ways - Key Components
- Aglet, AgletProxy, Message, Future reply, Reply
set
Aglet/ Application
Message
Message
Proxy
Aglet
Reply
Reply
28Aglet Package a Quick Tour
- Aglet Class
- AgletProxy Interface
- AgletContext Interface
- Message Class
- FutureReply Class
- AgletID Class
29 Aglet Class
- Create a customized aglet
- import com.ibm.aglet.
- Public class MyFirstAglet extends Aglet
- //put aglets methods here
-
- Overriden methods
- public void onCreation(Object init)
- //do some initialization here
-
- public void run() //do something here //main
entry point - //e.g. call dispatch(new URL(atp//some.host.com/
/context))
30Aglet Class
- What happens when dispatch?
- Object Serialization
- Transfer
-
- Deserialization and re-create state
State
Byte Code
Host
Host
Sending
Receiving
State
Byte Code
Host
Host
31AgletProxy
- Why AgletProxy?
- Acts as a shield object that protects an aglet
from malicious aglets - Provide the aglet with location transparency
- How to get a proxy?
- Get proxy from a newly created aglet
- AgletContext.createAglet(),
- AgletProxy.clone()
- Get proxy from existing aglets
- Aglet.getProxy() get its own proxy
- AgletContext.getAgletProxies() retrieve an
enum. of proxies in a context - AgletContext.getAgletProxy() get an aglet proxy
for a given aglet ID - Message passing passed as an argument
- AgletContext.setProperty put proxy into context
property and share it.
32AgletContext
- An aglet uses AgletContext to
- Get information about its environment (place)
- Send message to the environment, including other
aglets currently active in that environment - How it works
- contextgetAgletContext()
- context.createAglet()
- context.retractAglet(remoteContextURL,agletID)
33Message Class
- Aglets communicate by exchanging objects of the
Message class - kind field distinguishes messages
- Message myNamenew Message(my name, Jacob)
- Message yournamenew Message(your name?)
- Methods to send message (defined in AgletProxy
class) - Object sendMessage(Message msg)
- FutureReply sendFutureMessage(Message msg)
- Void sendOnewayMessage(Message msg)
34Message Class
- Message handling
- Public boolean handleMessage(Message msg)
- if(msg.samekind(my name))
- String name(String)msg.getArg()
- return true //Yes, I handled this message
- else if(msg.samekind(your name?))
- msg.sendReply(Yina) //Return its name
- return true //Yes, I handled this message
- else
- return false //No, I did not handle this
message
35FutureReply Class
- Returned by the asynchoronous message-sending
method - Used to handle later receive the result
asynchronously - FutureReply future-proxy.sendFutureMessage(msg)
- While(!future.isAvailable())
- doPeriodicWork()
-
- Object reply future.getReply()
36AgletID Class
- Identity
- Globally unique
- Throughout lifetime
- AgletID object
- Hides the implementation-specific representation
- Immutable
- Use
- AgletID aidproxy.getAgletID()
- proxycontext.getAgletProxy(aid)
37Anatomy of an Aglet
- Creation Disposal
- Clone
- Mobility
- Dispatch and Retract
- Persistence
- Activate and Deactivate
38Creation
- public final AgletContext Aglet.getAgletContext()
- //Example
- getAgletContext().createAglet(getCodeBase(),SomeA
glet,null) - Methods that can be overridden
- protected Aglet.Aglet()
- Public void Aglet.onCreation(Object init)
- Public void Aglet.run()
createAglet()
Aglet()
onCreation()
run()
39Disposal
- public final void Aglet.dispose()
- public void Aglet.onDisposing()
Dispose()
onDisposing()
run()
40Event
- Event Types
- CloneEvent
- MobilityEvent
- PersistencyEvent
- Delegation-Based Event Model
- CloneListener CloneAdapter
- MobilityListener MobilityAdapter
- PersistencyListener PersistencyAdapter
41Cloning
- Public final Object Aglet.clone()
- Public final void Aglet.addCloneListener(CloneList
ener listener) - Public final void Aglet.removeCloneListener(CloneL
istener listener) - public CloneAdapter.CloneAdapter()
- public void CloneAdapter.onCloning(CloneEvent
event) - public void CloneAdapter.onClone(CloneEvent
event) - public void CloneAdapter.onCloned(CloneEvent
event)
42- Cloning (continued)
- public class CloningExample extends Aglet
- boolean _theClonefalse
- public void onCreation(Object o)
- addCloneListener(new CloneAdapter()
- public void onCloning(CloneEvent e)
- // print to the console
- public void onClone(CloneEvent e)
- // print to the console
- public void onCloned(CloneEvent e)
- // print to the console
- )
-
public void run() if (! _theClone)
//the original runs here try clone()
catch (Exception e) System.out.println(e.
getMessage()) else //the clone runs here
run()
original
onCloning()
onCloned()
onClone()
clone
run()
43Mobility
run( )
Origin
dispatch( )
onDispatching( )
onArrival( )
Destination
run( )
retractAglet( )
Local
onArrival( )
run( )
run( )
Remote
onReverting( )
44Persistence
Aglet Context
Activate
Deactivate
run( )
deactivate( )
Before
onDeactivating( )
onActivation( )
After
run( )
45Inside Aglets
Services and User-defined aglets
Aglet API
- Aglet Runtime Layer
- Core Framework
- Management Components
- CacheManager
- SecurityManager
- PersistanceManager
Communication API
Communication Layer
46Communication Layer
- Communication API
- Agent Transfer Protocol (ATP)
- An ATP request consists of a request line,
header fields, content. - Four standard request method
- Dispatch
- Retract
- Fetch
- Message
ATP
ATP
Host
Host
HTTP
HTTP Tunneling of ATP
47Aglet Security
- Principals
- Aglet
- Context Server
- Network Domain
- Permissions
- Protection
- Policy Authority
- Aglet owner
- Context owner
- Network Domain owner
48Some Other Mobile Agent Systems
49Some Other Mobile Agent Systems
- MOA (Mobile Objects and Agents )