Package jade.core
Class MainContainerImpl
- java.lang.Object
-
- jade.core.MainContainerImpl
-
- All Implemented Interfaces:
AgentManager,MainContainer
public class MainContainerImpl extends Object implements MainContainer, AgentManager
This class is a concrete implementation of the JADE main container, providing runtime support to JADE agents, and the special, front end container where the AMS and the Default DF can run. This class cannot be instantiated from applications. Instead, theRuntime.createMainContainer(Profile p)method must be called.- Version:
- $Date$ $Revision$
- Author:
- Giovanni Rimassa - Universita' di Parma
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jade.core.AgentManager
AgentManager.Listener
-
-
Constructor Summary
Constructors Constructor Description MainContainerImpl(Profile p, PlatformManagerImpl pm)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AgentDescriptoracquireAgentDescriptor(AID agentID)voidactivate(AID agentID)Resume an agent wherever it isvoidaddListener(AgentManager.Listener l)Add a listener of platform eventsvoidaddTool(AID tool)AID[]agentNames()Return the IDs of all agents in the platformAID[]agentTools()voidamsDeregister(AMSAgentDescription dsc)Deregister an agent from the White Pages service of this platformvoidamsModify(AMSAgentDescription dsc)Modify the registration of an agent to the White Pages service of this platform.voidamsRegister(AMSAgentDescription dsc)Register an agent to the White Pages service of this platformListamsSearch(AMSAgentDescription template, long maxResults)Searches the White Pages for agents whose description matches a given template.voidbornAgent(AID aid, ContainerID cid, JADEPrincipal principal, String ownership, boolean forceReplacement)Notify the platform that an agent has just born on a containerListcontainerAgents(ContainerID cid)Return all agents living on a containerContainerID[]containerIDs()Return the IDs of all containers in the platformListcontainerMTPs(ContainerID cid)Return all MTPs in a given containervoidcopy(AID agentID, Location where, String newName)Clone an agent to a given destinationvoidcreate(String name, String className, Object[] args, ContainerID cid, JADEPrincipal owner, Credentials initialCredentials, JADEPrincipal requesterPrincipal, Credentials requesterCredentials)Create an agent on a given containervoiddeadAgent(AID name, boolean containerRemoved)Notify the platform that an agent has just diedvoiddeadMTP(MTPDescriptor mtp, ContainerID cid)Notify the platform that an MTP is no longer active on a given containervoiddebugOff(AID debuggerName, List notToBeDebugged)Deactivate debugging on a given agentvoiddebugOn(AID debuggerName, List toBeDebugged)Activate debugging on a given agentvoidfrozenAgent(AID name, ContainerID bufferContainer)Notify the platform that an agent has just frozenAMSAgentDescriptiongetAMSDescription(AID agentID)Return the AMS description of an agentContainerIDgetContainerID(AID agentID)Return the ID of the container an agent lives inNodeDescriptorgetContainerNode(ContainerID cid)Return the node a container is deployed atPlatformManagergetPlatformManager()MTPDescriptorinstallMTP(String address, ContainerID cid, String className)Install a new MTP on a given containervoidkill(AID agentID, JADEPrincipal requesterPrincipal, Credentials requesterCredentials)Kill an agent wherever it isvoidkillContainer(ContainerID cid, JADEPrincipal requesterPrincipal, Credentials requesterCredentials)Kill a given containervoidmove(AID agentID, Location where)Move an agent to a given destinationvoidmovedAgent(AID agentID, ContainerID srcID, ContainerID destID)Notify the platform that an agent has just movedvoidnewMTP(MTPDescriptor mtp, ContainerID cid)Notify the platform that a new MTP has become active on a given containervoidreleaseAgentDescriptor(AID agentID)voidremoveListener(AgentManager.Listener l)Remove a listener of platform eventsvoidremoveTool(AID tool)voidresumedAgent(AID name)Notify the platform that an agent has just resumedvoidshutdownPlatform(JADEPrincipal requesterPrincipal, Credentials requesterCredentials)Shut down the whole platformvoidsniffOff(AID snifferName, List notToBeSniffed)Deactivate sniffing on a given agentvoidsniffOn(AID snifferName, List toBeSniffed)Activate sniffing on a given agentvoidsuspend(AID agentID)Suspend an agent wherever it isvoidsuspendedAgent(AID name)Notify the platform that an agent has just suspendedvoidtake(AID agentID, String username, byte[] password)Change the ownership of an agent // FIXME: implement or removevoidthawedAgent(AID name, ContainerID bufferContainer)Notify the platform that an agent has just thawedvoidtoolAdded(AID tool)voidtoolRemoved(AID tool)voiduninstallMTP(String address, ContainerID cid)Uninstall an MTP on a given containervoidwait(AID agentID, String password)Put an agent in the WAITING state wherever it isvoidwake(AID agentID, String password)Wake-up an agent wherever it is
-
-
-
Constructor Detail
-
MainContainerImpl
public MainContainerImpl(Profile p, PlatformManagerImpl pm) throws ProfileException
- Throws:
ProfileException
-
-
Method Detail
-
getPlatformManager
public PlatformManager getPlatformManager()
-
bornAgent
public void bornAgent(AID aid, ContainerID cid, JADEPrincipal principal, String ownership, boolean forceReplacement) throws NameClashException, NotFoundException
Notify the platform that an agent has just born on a container- Specified by:
bornAgentin interfaceMainContainer- Throws:
NameClashExceptionNotFoundException
-
deadAgent
public void deadAgent(AID name, boolean containerRemoved) throws NotFoundException
Notify the platform that an agent has just died- Specified by:
deadAgentin interfaceMainContainer- Throws:
NotFoundException
-
suspendedAgent
public void suspendedAgent(AID name) throws NotFoundException
Notify the platform that an agent has just suspended- Specified by:
suspendedAgentin interfaceMainContainer- Throws:
NotFoundException
-
resumedAgent
public void resumedAgent(AID name) throws NotFoundException
Notify the platform that an agent has just resumed- Specified by:
resumedAgentin interfaceMainContainer- Throws:
NotFoundException
-
movedAgent
public void movedAgent(AID agentID, ContainerID srcID, ContainerID destID) throws NotFoundException
Notify the platform that an agent has just moved- Specified by:
movedAgentin interfaceMainContainer- Throws:
NotFoundException
-
frozenAgent
public void frozenAgent(AID name, ContainerID bufferContainer) throws NotFoundException
Notify the platform that an agent has just frozen- Specified by:
frozenAgentin interfaceMainContainer- Throws:
NotFoundException
-
thawedAgent
public void thawedAgent(AID name, ContainerID bufferContainer) throws NotFoundException
Notify the platform that an agent has just thawed- Specified by:
thawedAgentin interfaceMainContainer- Throws:
NotFoundException
-
newMTP
public void newMTP(MTPDescriptor mtp, ContainerID cid) throws IMTPException
Notify the platform that a new MTP has become active on a given container- Specified by:
newMTPin interfaceMainContainer- Throws:
IMTPException
-
deadMTP
public void deadMTP(MTPDescriptor mtp, ContainerID cid) throws IMTPException
Notify the platform that an MTP is no longer active on a given container- Specified by:
deadMTPin interfaceMainContainer- Throws:
IMTPException
-
addTool
public void addTool(AID tool)
- Specified by:
addToolin interfaceAgentManager
-
removeTool
public void removeTool(AID tool)
- Specified by:
removeToolin interfaceAgentManager
-
create
public void create(String name, String className, Object[] args, ContainerID cid, JADEPrincipal owner, Credentials initialCredentials, JADEPrincipal requesterPrincipal, Credentials requesterCredentials) throws UnreachableException, JADESecurityException, NotFoundException, NameClashException
Create an agent on a given container- Specified by:
createin interfaceAgentManager- Throws:
UnreachableException- if the container is unreachableJADESecurityException- if this action is not authorizedNotFoundException- if the passed container does not existNameClashException
-
kill
public void kill(AID agentID, JADEPrincipal requesterPrincipal, Credentials requesterCredentials) throws NotFoundException, UnreachableException, JADESecurityException
Kill an agent wherever it is- Specified by:
killin interfaceAgentManager- Throws:
NotFoundExceptionUnreachableExceptionJADESecurityException
-
suspend
public void suspend(AID agentID) throws NotFoundException, UnreachableException, JADESecurityException
Suspend an agent wherever it is- Specified by:
suspendin interfaceAgentManager- Throws:
NotFoundExceptionUnreachableExceptionJADESecurityException
-
activate
public void activate(AID agentID) throws NotFoundException, UnreachableException, JADESecurityException
Resume an agent wherever it is- Specified by:
activatein interfaceAgentManager- Throws:
NotFoundExceptionUnreachableExceptionJADESecurityException
-
wait
public void wait(AID agentID, String password) throws NotFoundException, UnreachableException
Put an agent in the WAITING state wherever it is- Specified by:
waitin interfaceAgentManager- Throws:
NotFoundExceptionUnreachableException
-
wake
public void wake(AID agentID, String password) throws NotFoundException, UnreachableException
Wake-up an agent wherever it is- Specified by:
wakein interfaceAgentManager- Throws:
NotFoundExceptionUnreachableException
-
move
public void move(AID agentID, Location where) throws NotFoundException, UnreachableException, JADESecurityException
Move an agent to a given destination- Specified by:
movein interfaceAgentManager- Throws:
NotFoundExceptionUnreachableExceptionJADESecurityException
-
copy
public void copy(AID agentID, Location where, String newName) throws NotFoundException, NameClashException, UnreachableException, JADESecurityException
Clone an agent to a given destination- Specified by:
copyin interfaceAgentManager- Throws:
NotFoundExceptionNameClashExceptionUnreachableExceptionJADESecurityException
-
killContainer
public void killContainer(ContainerID cid, JADEPrincipal requesterPrincipal, Credentials requesterCredentials) throws NotFoundException, UnreachableException, JADESecurityException
Kill a given container- Specified by:
killContainerin interfaceAgentManager- Throws:
NotFoundExceptionUnreachableExceptionJADESecurityException
-
shutdownPlatform
public void shutdownPlatform(JADEPrincipal requesterPrincipal, Credentials requesterCredentials) throws JADESecurityException
Shut down the whole platform- Specified by:
shutdownPlatformin interfaceAgentManager- Throws:
JADESecurityException
-
installMTP
public MTPDescriptor installMTP(String address, ContainerID cid, String className) throws NotFoundException, UnreachableException, MTPException
Install a new MTP on a given container- Specified by:
installMTPin interfaceAgentManager- Throws:
NotFoundExceptionUnreachableExceptionMTPException
-
uninstallMTP
public void uninstallMTP(String address, ContainerID cid) throws NotFoundException, UnreachableException, MTPException
Uninstall an MTP on a given container- Specified by:
uninstallMTPin interfaceAgentManager- Throws:
NotFoundExceptionUnreachableExceptionMTPException
-
take
public void take(AID agentID, String username, byte[] password) throws NotFoundException, UnreachableException, JADESecurityException
Change the ownership of an agent // FIXME: implement or remove- Specified by:
takein interfaceAgentManager- Throws:
NotFoundExceptionUnreachableExceptionJADESecurityException
-
sniffOn
public void sniffOn(AID snifferName, List toBeSniffed) throws NotFoundException, UnreachableException
Activate sniffing on a given agent- Specified by:
sniffOnin interfaceAgentManager- Throws:
NotFoundExceptionUnreachableException
-
sniffOff
public void sniffOff(AID snifferName, List notToBeSniffed) throws NotFoundException, UnreachableException
Deactivate sniffing on a given agent- Specified by:
sniffOffin interfaceAgentManager- Throws:
NotFoundExceptionUnreachableException
-
debugOn
public void debugOn(AID debuggerName, List toBeDebugged) throws NotFoundException, UnreachableException
Activate debugging on a given agent- Specified by:
debugOnin interfaceAgentManager- Throws:
NotFoundExceptionUnreachableException
-
debugOff
public void debugOff(AID debuggerName, List notToBeDebugged) throws NotFoundException, UnreachableException
Deactivate debugging on a given agent- Specified by:
debugOffin interfaceAgentManager- Throws:
NotFoundExceptionUnreachableException
-
amsRegister
public void amsRegister(AMSAgentDescription dsc) throws AlreadyRegistered, JADESecurityException
Register an agent to the White Pages service of this platform- Specified by:
amsRegisterin interfaceAgentManager- Throws:
AlreadyRegisteredJADESecurityException
-
amsDeregister
public void amsDeregister(AMSAgentDescription dsc) throws NotRegistered, JADESecurityException
Deregister an agent from the White Pages service of this platform- Specified by:
amsDeregisterin interfaceAgentManager- Throws:
NotRegisteredJADESecurityException
-
amsModify
public void amsModify(AMSAgentDescription dsc) throws NotRegistered, NotFoundException, UnreachableException, JADESecurityException
Modify the registration of an agent to the White Pages service of this platform. If the modification implies a change in the agent state (and the agent lives in the platform) --> force that change If the modification implies a change in the agent ownership (and the agent lives in the platform) --> force that change- Specified by:
amsModifyin interfaceAgentManager- Throws:
NotRegisteredNotFoundExceptionUnreachableExceptionJADESecurityException
-
amsSearch
public List amsSearch(AMSAgentDescription template, long maxResults)
Searches the White Pages for agents whose description matches a given template.- Specified by:
amsSearchin interfaceAgentManager
-
containerIDs
public ContainerID[] containerIDs()
Return the IDs of all containers in the platform- Specified by:
containerIDsin interfaceAgentManager- Specified by:
containerIDsin interfaceMainContainer
-
agentNames
public AID[] agentNames()
Return the IDs of all agents in the platform- Specified by:
agentNamesin interfaceAgentManager- Specified by:
agentNamesin interfaceMainContainer
-
containerMTPs
public List containerMTPs(ContainerID cid) throws NotFoundException
Return all MTPs in a given container- Specified by:
containerMTPsin interfaceAgentManager- Specified by:
containerMTPsin interfaceMainContainer- Throws:
NotFoundException
-
containerAgents
public List containerAgents(ContainerID cid) throws NotFoundException
Return all agents living on a container- Specified by:
containerAgentsin interfaceAgentManager- Specified by:
containerAgentsin interfaceMainContainer- Throws:
NotFoundException
-
toolAdded
public void toolAdded(AID tool)
- Specified by:
toolAddedin interfaceMainContainer
-
toolRemoved
public void toolRemoved(AID tool)
- Specified by:
toolRemovedin interfaceMainContainer
-
agentTools
public AID[] agentTools()
- Specified by:
agentToolsin interfaceAgentManager
-
getContainerID
public ContainerID getContainerID(AID agentID) throws NotFoundException
Return the ID of the container an agent lives in- Specified by:
getContainerIDin interfaceAgentManager- Specified by:
getContainerIDin interfaceMainContainer- Throws:
NotFoundException
-
getContainerNode
public NodeDescriptor getContainerNode(ContainerID cid) throws NotFoundException
Return the node a container is deployed at- Specified by:
getContainerNodein interfaceMainContainer- Throws:
NotFoundException
-
getAMSDescription
public AMSAgentDescription getAMSDescription(AID agentID) throws NotFoundException
Return the AMS description of an agent- Specified by:
getAMSDescriptionin interfaceAgentManager- Throws:
NotFoundException
-
addListener
public void addListener(AgentManager.Listener l)
Add a listener of platform events- Specified by:
addListenerin interfaceAgentManager
-
removeListener
public void removeListener(AgentManager.Listener l)
Remove a listener of platform events- Specified by:
removeListenerin interfaceAgentManager
-
acquireAgentDescriptor
public AgentDescriptor acquireAgentDescriptor(AID agentID)
- Specified by:
acquireAgentDescriptorin interfaceMainContainer
-
releaseAgentDescriptor
public void releaseAgentDescriptor(AID agentID)
- Specified by:
releaseAgentDescriptorin interfaceMainContainer
-
-