1 / 71

移动 Agent 系统

移动 Agent 系统. ——Aglets. 提纲. Aglets 简介 Aglets 模型 Aglets API Aglets 样 例. Aglets. Aglets IBM http://www.trl.ibm.com/aglets/ http://aglets.sourceforge.net/ Latest version 2.5-alpha Stable version: 2.0.2. Aglets. What are mobile agents?

ziarre
Download Presentation

移动 Agent 系统

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 移动Agent系统 ——Aglets

  2. 提纲 • Aglets简介 • Aglets模型 • Aglets API • Aglets样例

  3. Aglets • Aglets • IBM • http://www.trl.ibm.com/aglets/ • http://aglets.sourceforge.net/ • Latest version • 2.5-alpha • Stable version: 2.0.2

  4. Aglets • What are mobile agents? • Mobile network agents are programs that can be dispatched from one computer and transported to a remote computer for execution. Arriving at the remote computer, they present their credentials and obtain access to local services and data. The remote computer may also serve as a broker by bringing together agents with similar interests and compatible goals, thus providing a meeting place at which agents can interact.

  5. Aglets • What is the Aglets Software Development Kit? • The Aglets Software Development Kit is an environment for programming mobile Internet agents in Java. (It is what we used to be called Aglets Workbench.)

  6. Aglets • What is an aglet? • The aglet represents the next leap forward in the evolution of executable content on the Internet, introducing program code that can be transported along with state information. Aglets are Java objects that can move from one host on the Internet to another. That is, an aglet that executes on one host can suddenly halt execution, dispatch itself to a remote host, and resume execution there. When the aglet moves, it takes along its program code as well as its data.

  7. Aglets • Aglet Mobile Agent Platform (Aglets MAP): is the core platform, able to manage mobile agents. • Tahiti: is the main server in charge of managing the mobility of agents. It comes with a GUI that helps administrators taking care of running agents. • Aglets Software Development Kit (Aglets SDK – ASDK): is a library that provides developers all the facilities required to write mobile agents compliant to the Aglets MAP.

  8. aglets • 迁移机制 • 通信机制 • 安全保障

  9. Mobility • Strong Mobility vs. Weak Mobility • Example • for (inti = 0; i<10; i++){ • migrate ( remoteHosts[i] ); • }

  10. Mobility • Aglets only support weak mobility! • In fact, almost all the Java MAP support only the weak mobility. • No support in Java to get enough information about the execution flow. • The Thread class itself is not serializable, and so cannot be transmitted over the network.

  11. Mobility • Aglets ensures that an agent will keep its Java state (i.e. the value of its inner variable) among migrations (at least if the Java state is serializable). • When the agent is going to be executed on the remote machine, the execution will start from a well defined entry point (a method), and no re-initialization will happen (in order to not override the current agent state).

  12. Communication • Based on message passing! • Agents cannot directly reference other agents, so it is not possible for an agent to handle a “pointer” to another agent. • For security reason

  13. Communication • Proxy Pattern • A proxy is an object that masquerades another object (its owner) and that forwarders method calls to its owner.

  14. Communication • Aglets are hidden by proxies, and other aglets can send messages or perform method calls against the proxy, having the proxy to forward such method calls on the owner agent. • Advantages: • Aglets are always protected, being invisible and that the system can create and manage a lot of proxies for the same aglet without breaking the agent protection. • The dispose of a proxy does not causes the disposing of the agent it is masquerading. • In Aglets, agents are created and managed by the MAP, while proxies represents “handles” to other agents, thanks to which agents can communicate each other.

  15. SECURITY • protection of the host against aglets, • protection of other aglets, • protection of the aglet from the host, and • protection of the underlying network.

  16. Security

  17. security • The Aglet security model supports the flexible definition of various security policies and describes how and where a secure system enforces these policies. • Security policies are defined in terms of a set of rules by one administrative authority.

  18. Security Policies • the conditions under which aglets may access objects; • the authentication required of users and other principals, which actions an authenticated entity is allowed to perform, and whether entities can delegate their rights; • the communications security required between aglets and between contexts, including trust; and • the degree of accountability required for each security relevant activity.

  19. Aglet 体系结构 Generic Mobile Agent Server Interagent Communication Manager Application Gateway External Application Agent Agent Manager Network Directory Manager Security Manager Reliability Manager Generic Mobile Agent Server Generic Mobile Agent Server

  20. Aglet 模型 • What is java aglet? • Lightweight agent • Java object that can move from one host to another • A mobile java agent that supports concepts of autonomous execution and dynamic routing on its itinerary. • Has its own thread of control • Is event-driven • Communicates by message passing • “Write once, go anywhere”

  21. Aglet Model(1) • Basic Elements: • Aglet – a mobile Java object • Proxy – a representative of an aglet • Context – an aglet’s workplace • Identifier – bound to each aglet

  22. Relationship between Aglet and Proxy • Proxy Represents the Aglet • A handle for local, remote or deactivated aglet • Shields Public Methods for Potential Misuse • Can Hide the “actual” Location of Aglet • Proxy and Aglet on Different Computing Nodes • Proxy :Aglet < = > n : 1

  23. Proxy Aglet Interaction Clients Proxy H1 Interaction Clients H2 Aglet

  24. Context • A context is an uniform execution environment for aglet. • a stationary object • provides a means for maintaining and managing running aglets • One node in a computer network may run multiple servers and each server may host multiple contexts. • Contexts are named and can thus be located by the combination of their server's address and their name.

  25. Context • Aglets must be instantiated within a context, and at any time belong to exactly one context. • Context can be used for: • createAglet • retractAglet • getAgletProxies / getAgletProxy • setProperty/getProperty

  26. Relationship between Host, Server Process(Engine), and Contexts Host Context Context Context Server Process (Engine) Network

  27. Proxy aglet Context Context, proxy, aglet

  28. Aglet Model(2) • Basic Elements • Aglet : a mobile java object • Proxy : a representative of an aglet • Context : an aglet’s workplace • Identifier : bound to each aglet • Message : an object exchanged between aglets • Future reply : an asynchronous message-sending

  29. Aglet Model(2) • Message • an object exchanged between aglets. It allows for synchronous as well as asynchronous message passing between aglets. • Future reply • A future reply is used in asynchronous message-sending as a handler to receive a result later asynchronously

  30. Aglet : Communication Model • Message passing: • 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

  31. Aglet Model(2) Proxy Proxy Message aglet aglet Context

  32. Aglet: Operations • Six Basic Operations • Creation • Cloning • Dispatching • Retraction • Activation and Deactivation • Disposal

  33. Aglet: Operations • Creation • Initializes a New Aglet • Assigns Aglet an Identifier • Cloning • Produce an Identical Copy of an Aglet • Differences Between Clone and Original Aglet • Identifier • Place of Execution

  34. Aglet: Operations • Dispatching • Aglet is Transported (Pushed) From One Context to Another • Retraction • Concept that Returns an Aglet Back to its Original Context • Original Context Pulls Back the Aglet From the Current Context

  35. Aglet: Operations • Deactivation and Activation • Deactivation Must Occur Before Activation • Deactivation Halts the Execution of an Aglet • Activation Starts Execution of an Aglet • Activation Must Occur to Restore the Aglet • Disposal • Stops Execution of an Aglet • Removes an Aglet From its Current Context

  36. Basic Operations • Classification of Six Basic Aglet Operations • Classified as the Life Cycle of an Aglet • Observation of Six Basic Aglet Operations • Context Functions Just Like a Place

  37. Agent Life-Cycle Model Context A Context B Clone Dispatch Dispose Aglet Aglet Retract Create Deactivate Activate Class File Disk Storage

  38. Agent Life-Cycle Model

  39. Aglet Event Model • Aglet Programming Model • Similar to the Java Event Model • Event Based • Listeners Used to Perform Event Actions • Three Event Model Listeners • Clone Listener • Mobility Listener • Persistence Listener • Actions • Listen for the Event They are Named After • Listeners Can Be Customized to Perform Specific Actions When the Listener Event Occurs

  40. Relationship between Aglet and its Listeners Aglet Clone Events CloneListener Mobility Events MobilityListener Persistence Events PersistenceListener

  41. Event Model Listeners • Clone Listener • Listens for Cloning Events • Actions Can Be Customized to Occur Before, During, or After the Cloning • Mobility Listener • Listens for Mobility Events • Actions Can Be Customized to Occur When an Aglet is About to Be Dispatched, Retracted, or Arrives in a New Context • Persistence Listener • Listens for Persistence Events • Actions Can Be Customized to Occur When an Aglet is About to Be Deactivated or Has Been Activated

  42. Example • Agent dispatch

  43. The Aglet Model • Message Handling • Aglets exploit a communication system based on message passing. • An agent that wants to explicitly manage messages has to override the handleMessage(..) method, returning true in the case that the message is managed by the agent, and false otherwise.

  44. Message Handling • An aglet is not necessarily aware of message source, it just receives and handles messages. Message source should be included in some way in the message itself, since there is no other way to identify it. • Message handling is as complex as the handleMessage(…) implementation. • The method handleMessage(Message msg) has one parameter, the message received by the aglet, which can be used to define the aglet message handling behavior. • The message type is its classification.

  45. Message Handling

  46. The Aglet Model • Agent Design Patterns • Traveling • Task • Interaction

  47. Agent Design Pattern (cont.) • Traveling • Itinerary: routes among destinations. • Forwarding: a host forwards an arrived agent to another host. • Ticket: objectifies a destination address and encapsulates the quality of service and permissions needed to dispatch an agent to a host address and to execute it there.

  48. Agent Design Pattern (cont.) • Task • Master-Slave: an agent delegate a task to another • Plan: organize multiple tasks to be performed in sequence or in parallel by multiple agents.

  49. Agent Design Pattern (cont.) • Interaction • Meeting: two or more agents initiate local interaction at a given host. • Locker: defines a storage and come back for data later. • Messenger: an agent carries a remote message from one agent to another. • Facilitator: an agent provides services for naming and locating agents. • Organized Group: travel together.

  50. Aglet Class & API

More Related