Java Mobile Agents with Aglets Wolfgang Schreiner [email protected].

58
Java Mobile Agents Java Mobile Agents with Aglets with Aglets Wolfgang Schreiner [email protected] c.at

Transcript of Java Mobile Agents with Aglets Wolfgang Schreiner [email protected].

Page 1: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Java Mobile AgentsJava Mobile Agentswith Agletswith Aglets

Wolfgang [email protected]

Page 2: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Chapter 1 – Chapter 1 –

Introduction to Mobile AgentsIntroduction to Mobile Agents

Page 3: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

What is a Software Agent?What is a Software Agent?

End-User Perspective– An agent is a program that assists people and acts

on their behalf– Agents function by allowing people delegate

work to them

System Perspective– An agent is a software object that is situated

within an execution environment– possesses mandatory and orthogonal properties

Page 4: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

What is a Mobile Agent?What is a Mobile Agent?

Stationary Agent– executes only on the system where it begins execution– interacts with an agent using communication mechanisms

Mobile Agent– not bound to the system where it begins

execution– has the ability to transport itself from one system

in a network to another

Page 5: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Reasons for Mobile AgentsReasons for Mobile Agents

Reduce network load Reduce network latency Encapsulate protocols Execute asynchronously and

autonomously Adapt dynamically Are naturally heterogeneous Are robust and fault-tolerant

Page 6: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Network ComputingNetwork Computing

Client-Server Paradigm– A server locally hosts services that provide

access to resources and code that implements these services.

Code-on-Demand Paradigm– no preinstalled code on the client side

Mobile Agent Paradigm– hosts are allowed a high degree of flexibility

Page 7: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Mobile Agent ApplicationsMobile Agent Applications

Electronic Commerce Personal assistance Distributed information retrieval Telecommunication network services Workflow applications and groupware Monitoring and notification Parallel processing

Page 8: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Mobile Agent SystemsMobile Agent Systems

Java– Aglets

– Odyssey– Concordia– Voyager

Others– Agent Tcl– Ara– TACOMA

Page 9: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Mobile Agent StandardizationMobile Agent StandardizationMASIFMASIF

Agent managementAgent transferAgent and agent system namesAgent system type and location

syntax

Page 10: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Chapter 2 – Chapter 2 –

Elements of aElements of aMobile Agent SystemMobile Agent System

Page 11: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Agent ...Agent ...

Page 12: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

... and Place... and Place

Page 13: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Agent Behaviour (1)Agent Behaviour (1)

Creation– Instantiation and identifier assignment

– Initialization

– Autonomous execution

Disposal– Preparing for disposal

– Suspension of execution

Page 14: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Agent Behaviour (2)Agent Behaviour (2)

Dispatching– Suspend, serialize, encode, transfer

Receiving– Receive, decode, de-serialize, resume execution

Agent Class Transfer– Class at destination– Class at origin– Code-on-demand

Page 15: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

CommunicationCommunication

Page 16: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

MASIFMASIF

MAFAgentSystem Interface– agent management tasks

MAFFinder Interface– agent naming service

Page 17: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Chapter 3 –Chapter 3 –

Mobile Agents with JavaMobile Agents with Java

Page 18: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Java Agents - BenefitsJava Agents - Benefits

Platform IndependenceSecure ExecutionDynamic Class LoadingMultithread ProgrammingObject SerializationReflection

Page 19: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Java Agents - DrawbacksJava Agents - Drawbacks

Inadequate Support for Resource Control

No Protection of ReferencesNo Object Ownership of ReferencesNo Support for Preservation and

Resumption of the Execution State

Page 20: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

The Aglet ModelThe Aglet Model

Basic Elements– aglet, proxy, context, identifier

– creation, cloning, dispatching, retraction, disposal, activation/deactivation

Aglet Event Model– clone, mobility and persistence listener

Aglet Communication Model– Message, FutureReply, ReplySet

Page 21: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Aglet PackageAglet Package

class Agletinterface AgletProxyinterface AgletContextclass Messageclass FutureReplyclass AgletID

Page 22: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Chapter 4 –Chapter 4 –

Anatomy of an AgletAnatomy of an Aglet

Page 23: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Aglet DisposalAglet Disposal

public final void Aglet.dispose(); public void Aglet.onDisposing();

Example:

public class DisposalExample

extends Aglet {

public void onDisposing() { ... }

public void run() {

dispose();

}

}

Page 24: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Delegation-Based Event Delegation-Based Event ModelModel

CloneEvent, MobilityEvent, PersistencyEvent

CloneListener, MobilityListener, PersistencyListener

CloneAdapter, MobilityAdapter, PersistencyAdapter

Page 25: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

CloningCloning

public final Object Aglet.onClone();

public final void Aglet.addCloneListener(CloneListener);

public final void Aglet.removeCloneListener(CloneListener);

public void CloneAdapter.onCloning(CloneEvent);

public void CloneAdapter.onClone(CloneEvent); public void CloneAdapter.onCloned(CloneEvent);

Page 26: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Aglet MobilityAglet Mobility

public final void Aglet.dispatch(URL); public final void

Aglet.addMobilityListener(MobilityListener); public final void

Aglet.removeMobilityListener(MobilityListener); public void

MobilityAdapter.onDispatching(MobilityEvent); public void

MobilityAdapter.onArrival(MobilityEvent); public void

MobilityAdapter.onReverting(MobilityEvent);

Page 27: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

PersistencePersistence

public final void deactivate(long); public final void Aglet.addPersistencyListener

(PersistencyListener); public final void

Aglet.removePersistencyListener (PersistencyListener);

public void PersistencyAdapter.onDeactivating (PersistencyEvent);

public void PersistencyAdapter.onActivation (PersistencyEvent);

Page 28: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

EventsEvents

CloneEventMobilityEvent

– public URL MobilityEvent.getLocation();

PersistencyEvent– public long

PersistencyAdapter.getDuration();

Page 29: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Chapter 5 –Chapter 5 –

Aglet ContextAglet Context

Page 30: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Aglet CreationAglet Creation

Code and Code Base

Code Base and Class Mobility

Initialization Argument

Page 31: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Proxy RetrievalProxy Retrieval

Proxy Iterator– public abstract Enumeration

AgletContext.getAgletProxies();

Getting a Local Proxy– public abstract AgletProxy

AgletContext.getAgletProxy(AgletID);

Getting a Remote Proxy– URL as additional parameter

Page 32: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Aglet RetractionAglet Retraction

public abstract AgletProxy AgletContext.retractAglet(URL,AgletID);

Example:

AgletID aid=proxy.getAgletID();

Proxy.dispatch(dest);

getAgletContext().retractAglet(dest,aid);

Page 33: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Context PropertiesContext Properties

public abstract Object AgletContext.getProperty(String);

public abstract Object AgletContext.getProperty(String,Object);

public abstract void AgletContext.setProperty(String,Object);

Page 34: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Chapter 6 –Chapter 6 –

Aglet MessagingAglet Messaging

Page 35: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Simple MessagingSimple Messaging

public Object AgletProxy.sendMessage(Message); public boolean Aglet.handleMessage(Message);

Page 36: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

The The MessageMessage Class Class

Message Creation– public Message(String [,…] );

Receiving Messages– getArg, setArg, getKind, sameKind

Replying to Messages– public void Message.sendReply();– public void

Message.sendException(Exception);

Page 37: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Getting the ReplyGetting the Reply

Page 38: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Message ManagementMessage Management

Serialized Message HandlingMessage PrioritiesParallel Message HandlingSynchronized Message Handling

Page 39: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

MulticastingMulticasting

public final void Aglet.subscribeMessage(String);

public final void Aglet.unsubscribeMessage(String);

public final void Aglet.unsubscribeAllMessages();

public ReplySet AgletContext.multicastMessage(Message);

Page 40: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Receiving Multiple RepliesReceiving Multiple Replies

public boolean ReplySet.hasMoreReplies();

public FutureReply ReplySet.getNextFutureReply();

public boolean ReplySet.addFutureReply(FutureReply);

Page 41: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Chapter 7 –Chapter 7 –

Aglet CollaborationAglet Collaboration

Page 42: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Aglet ProxyAglet Proxy

CloningDisposalDispatchingDeactivation and ActivationAglet Information

Page 43: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Controlling an AgletControlling an Aglet

Page 44: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Finding an AgletFinding an Aglet

SearchLoggingRegistrationAgletFinder

– Lookup: NAME

– Register: NAME & PROXY

– Unregister: NAME

Page 45: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Aglets in Parallel ExecutionAglets in Parallel Execution

Page 46: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Chapter 8 –Chapter 8 –

Agent Design PatternsAgent Design Patterns

Page 47: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Design Pattern ClassificationDesign Pattern Classification

Traveling Patterns– Itinerary, Forward, Ticket

Task Patterns– Master-Slave

Interaction Patterns– Meeting, Locker, Messenger, Finder, Organized Group

Page 48: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Chapter 9 –Chapter 9 –

Inside AgletsInside Aglets

Page 49: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Architectural OverviewArchitectural Overview

Core Framework– Initialization and (de-)serialization– Class loading and transfer– Aglet references and garbage collection

Management Components– PersistencyManager– CacheManager– SecurityManager

Communication Layer

Page 50: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Aglet Object StructureAglet Object Structure

Page 51: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Initialization and SerializationInitialization and Serialization

Initialization of Aglets– Locate aglet class, load class data, define class

– Instantiate new object

– Create reference AgletRef, establish connection

– Start execution

Serialization and Object Mobility

Page 52: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Class Loading and TransferClass Loading and Transfer

Class LoadingClass Transfer

– Archived classes

– Code base classes– System classes– Others

Class Resumption and EvolutionOther Considerations of Class

Mobility

Page 53: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Communication LayerCommunication Layer

Communication API– MASIF

Agent Transfer Protocol– Dispatch

– Retract

– Fetch

– Message

Page 54: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Chapter 10 –Chapter 10 –

Aglet SecurityAglet Security

Page 55: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

What Can Go Wrong?What Can Go Wrong?

Agent Protection– Remote host threatens agent– Agent threatens another agent– Unauthorized third parties threaten agent

Host Protection– Incoming agent threatens host

– Unauthorized third parties threaten host

Network protection– Incoming agent threatens the network

Page 56: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Taxonomy of AttacksTaxonomy of Attacks

Passive Attacks– Eavesdropping

– Traffic Analysis

Active Attacks– Illegal Access – Replay

– Masquerade – Resource Exhaustion

– Trojan Horse – Repudiation

– Alteration

Page 57: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Security ServicesSecurity Services

Authentication– user, host, code, agent

IntegrityConfidentialityAuthorizationNonrepudiationAuditing

Page 58: Java Mobile Agents with Aglets Wolfgang Schreiner e9902261@student.tuwien.ac.at.

Security ModelSecurity Model

Principals– Aglet, Context and Server, Network Domain

Permissions– File, Network, Window, Context, Aglet

ProtectionsPolicy and Authority

– Aglet owner, Context owner, Network owner