Agent Framework - PowerPoint PPT Presentation

1 / 32
About This Presentation
Title:

Agent Framework

Description:

public abstract class Agent implements Runnable, Serializable, IAgent ... public void run(); like the main() of a C program. execution code of the Agent ... – PowerPoint PPT presentation

Number of Views:19
Avg rating:3.0/5.0
Slides: 33
Provided by: Informatio367
Category:

less

Transcript and Presenter's Notes

Title: Agent Framework


1
Agent Framework
  • Keith Hau Dang

2
AgentOS
  • Provides an environment for the development and
    the deployment of agent-based client-server
    application based on agents
  • Agent
  • object
  • contains computational logic and state info.
  • Mobile
  • can migrate between hosts

3
Why AgentOS
  • Break down a complex problem in to simple ones
  • Take advantages of distributed computing
  • Reduce communication among objects on different
    nodes
  • migration

4
Overview
  • AgentOS
  • Agent Framework
  • client
  • Agent and supporting execution environment (Agent
    Context)
  • AgentOS Kernel
  • server
  • one on each computer
  • Manages agents and provides system services to
    agents

5
AgentOS Kernel
Incoming Messages
Migrating Agents
II.
Router
Agent Listener
Agent Context
Multicast Group Manager
Agent
V.
Kernel
I.
Debug Agent
Inter-Agent Communication Event Pool
III.
Registry
Directory Service
Kernel Configuration
IV.
Active Agent List
Registered Home Agents
History List
6
Agent Framework Components
  • Agent Package used in the migration of the
    agent
  • Serialized Agent (if used)
  • Agent Module
  • Agent Data
  • Agent Context provides agents the access to the
    services and EventPool
  • Service API
  • Service Providers
  • Event API

7
Agent Framework
Agent
Agent Data
Agent Module
Serialized Agent
Agent Package
Service Providers
Service API
Event API
Agent Context
8
Mobile Agents
Agent
9
Agents
  • autonomous mobile object
  • contains computational logic
  • contains state information
  • Behaviors
  • migration
  • replication
  • etc.

10
Agent Class
  • public abstract class Agent implements Runnable,
    Serializable, IAgent
  • protected transient IAgentContext context
  • private InetAddress lastNode
  • public Agent()
  • public void run()
  • public void onCreation(Object init)
  • public void onDisposal()
  • public void onDispatch() throws AgentException
  • public void onArrival()
  • public void onClone()
  • public void onCloning() throws AgentException
  • public void onActivation()
  • public void migrateTo(AgentOSNode node)
  • public void onDeactivation() throws
    AgentException
  • public final void setAgentContext(IAgentContext
    aContext) throws

11
Agent API
  • public void migrateTo(AgentOSNode node)
  • serialize Agent
  • send Agent Module and Agent Package to new
    AgentOSNode
  • public void run()
  • like the main() of a C program
  • execution code of the Agent
  • Must always be override or agent does nothing and
    dies

12
AgentOSInstance
  • Unique identification of an Agent
  • Contains AgentOSID
  • Host information of where the Agent was created

13
AgentOSInstance
  • public class AgentOSInstance implements
    Serializable
  • protected AgentOSID m_idStatic
  • //The location in the AgentOS Network
  • protected AgentOSNode m_nodeLocation
  • //The creation instance
  • protected long m_nInstance

14
Agent Package
  • Contains the Agent itself and the Agents Data
  • Contains serialized agent (if used)
  • Agent properties and data are stored in the Agent
    Data
  • Identified by unique AgentOSID

15
Agent Package Class
  • public class AgentPackage implements Serializable
  • private byte agent
  • private AgentOSID m_idPkg
  • private Hashtable properties
  • public AgentPackage(String anAgentName, AgentOSID
    aPackageIdentifier)
  • public void addProperty(AgentData aProperty)
    throws AgentPackageException
  • public Object getProperty(String aPropertyName)
  • public Object removeProperty(String
    aPropertyName) throws AgentPackageException

16
Agent Package
  • public void addProperty(AgentData aProperty)
    throws AgentPackageException
  • Adds State information about Agent
  • AgentData is a name/value pair
  • public Object getProperty(String aPropertyName)
  • Retrieves a property give the string name
  • Returns an Object containing the value
  • Agent must validate data type

17
Agent Package cont.
  • AgentOSID
  • 438AA0803316BFC8BE6CCB7C0201

JVM unique number
Sequential Counter
Time Stamp
Host IP Address
18
Agent Package cont.
  • Agent Data
  • Used to store data needed for maintaining state
  • Data consists of name-value pairs
  • Values can be any standard or user defined class
    instance
  • The class must be contained within the Agent
    Module

19
Agent Package cont.
  • AgentData Class
  • public class AgentData implements Serializable
  • protected int determineVariant(Object obj)
  • public AgentData(String aName, Object theData)

20
Agent Module
  • Contains Agents class files or the location of
    the class files
  • Class files are stored in an AgentFileSuitcase
    object
  • Two access methods local and remote
  • local method access to only the class files that
    are contained with the Agent Module
  • remote access retrieve the class from the
    specified location

21
Agent Module cont.
  • Currently only local retrieval is supported
  • Security issues such as class file integrity will
    have to be worked out before remote retrieval
    methods are supported
  • Prevent third parties from changing behaviors of
    the agent

22
Agent Module cont.
  • Agent Module Class
  • public final class AgentModule implements
    Serializable
  • private Hashtable index
  • private Hashtable class_files
  • public synchronized byte getClassBytes(String
    s) throws ClassNotFoundException
  • public synchronized Class getAgentClass(String s)
    throws ClassNotFoundException
  • public synchronized void addClassFileLocator(Class
    FileLocator anIndex) throws AgentModuleException
  • public synchronized void addClassFile(ClassFileLoc
    ator anIndex, byte aClassFile ) throws
    AgentModuleException

23
Agent Module cont.
  • public synchronized void addClassFile(ClassFileLoc
    ator anIndex, byte aClassFile ) throws
    AgentModuleException
  • Add a Class File to the Module
  • public synchronized Class getAgentClass(String s)
    throws ClassNotFoundException
  • retrieves a Class from agent package give its name

24
Agent Module cont.
  • Class AgentFileSuitcase
  • container for class files
  • associate a string name with a class file

25
Agent Module cont.
  • Class AgentFileSuitcase
  • public class AgentFileSuitcase implements
    Serializable
  • //Stores bytes of class, or class itself
  • private byte file
  • private Class theClass
  • private String file_name
  • public AgentFileSuitcase(String aFileName, byte
    aFile)
  • public AgentFileSuitcase(String aFileName, Class
    aFile)
  • public AgentFileSuitcase(String aFileName, URL
    url)
  • public AgentFileSuitcase(String aFileName, String
    file)

26
Agent Context
  • Agent execution environment
  • Responsible for handing Agent requests for
    services
  • Two interfaces IAgentContext and
    ISystemAgentContext
  • IAgentContext is the interface for application
    agents
  • ISystemAgentContext is reserved for system agents
    only

27
AgentContext
  • public class AgentContext extends Thread
    implements IAgentContext, IAgentContextSys
  • private IAgent agent
  • private AgentModule agent_module
  • private AgentPackage agent_package
  • private AgentClassLoader agent_loader
  • private Thread agent_thread
  • private long agent_sleep_time
  • private long agent_run_time
  • private Kernel kernel

28
AgentContext
  • protected void initNewAgent() throws
    AgentContextException
  • public void run()
  • public synchronized IServiceProvider
    getService(String aServiceName)
  • public void execSerialization()
  • public void execDispatch(InetAddress toLocation)
  • public void execDeactivation()
  • public void execTimedDeactivation(long aTime)
  • public EventPool getEventPool()

29
AgentContext
  • public AgentContext (Kernel k, InputStream
    anInputStream) throws AgentContextException
  • public AgentContext(Kernel k, URL agentURL)
    throws AgentContextException
  • public AgentOSNode getNodeLocation()
  • public void setAgentSleepTime(long aTime)
  • public void setAgentRunTime(long aTime)
  • public AgentOSInstance getAgentInstanceId()
  • public AgentOSID getAgentPackageId()

30
AgentClassLoader
  • Loads Agent classes from Agent Module
  • The class loader does not allow class from the
    'agentos. and java. namespace to be loaded
    from the Agent Module.

31
AgentClassLoader
  • public final class AgentClassLoader extends
    ClassLoader
  • private AgentModule class_repository
  • protected synchronized Class loadClass(String
    name, boolean resolve) throws ClassNotFoundExcepti
    on

32
AgentInputStream
  • Stream used to read in Agent Serialized Files.
  • inputStream to Agent Module and Agent Package
    when an Agent migrates
  • Agent Module get read first, then Agent Package
Write a Comment
User Comments (0)
About PowerShow.com