110 likes | 204 Views
The YinYang System. Manager. Manager. Register/Deregister other Managers Register/Deregister Domains Register/Deregister Active Agents Handle an Agent Service Management the communication between Domains Implement Interface Plug. Domain. Domain. Launch an active agent (local or remote)
E N D
Manager • Register/Deregister other Managers • Register/Deregister Domains • Register/Deregister Active Agents • Handle an Agent Service • Management the communication between Domains • Implement Interface Plug
Domain • Launch an active agent (local or remote) • Run an agent (local or remote) • Kill an active agent • Management the communication between active agents • Register its agents, Get agent information, Search agents
Agents • Status • MOBILE • STATIC • DOWNLOAD • PRIVATE • Manager and Domain are Jini Services, but Agents are not. • Build an agent by extending the abstract class Agent.
Agents • Agent can have an ”AgentFrame” (GUI) • Agent can use ”inbox ” to store messages • Agent can build a KQML Message • Agent can readMessage, can getMessage and handle it. • Agents need to implement the method AgentServiceResult perform(Object par)
HelloAgent • public class HelloAgent extends Agent implements Serializable { ..} • public HelloAgent() { super(Agent.MOBILE); } • public AgentServiceResult perform(Object par) { • AgentServiceResult res = new AgentServiceResult(); String str = doWork(par); res.setResult(str); return res; }
JavaMail • Packages: mail.jar, activation.jar • Send a mail • Make a Session • Make a MimeMessage msg • Send the message: Transport.send(msg)
Read a mail • Make a Session • Get the store and establish the connection • Open the folder • Get all message in the folder • Read a specified message.