jade.core
Class AgentContainerImpl

java.lang.Object
  |
  +--jade.core.AgentContainerImpl

public class AgentContainerImpl
extends java.lang.Object
implements AgentContainer, jade.core.AgentToolkit

This class is a concrete implementation of the JADE agent container, providing runtime support to JADE agents. This class cannot be instantiated from applications. Instead, the Runtime.createAgentContainer(Profile p) method must be called.

Version:
$Date: 2003/03/19 11:39:52 $ $Revision: 2.123 $
Author:
Giovanni Rimassa - Universita` di Parma
See Also:
Runtime.createAgentContainer(Profile)

Fields inherited from interface jade.core.AgentContainer
ADD_RT, DEL_RT, NOSTART, START, TRANSFER_ABORT, TRANSFER_COMMIT
 
Method Summary
 void addPlatformListener(AgentManager.Listener l)
           
 void changeAgentPrincipal(AID agentID, jade.security.CertificateFolder certs)
           
 void changeContainerPrincipal(jade.security.CertificateFolder certs)
           
 void changedAgentPrincipal(AID agentID, jade.security.AgentPrincipal principal)
           
 void copyAgent(AID agentID, Location where, java.lang.String newName)
           
 void createAgent(AID agentID, byte[] serializedInstance, AgentContainer classSite, boolean startIt)
           
 void createAgent(AID agentID, java.lang.String className, java.lang.Object[] args, java.lang.String ownership, jade.security.CertificateFolder certs, boolean startIt)
           
 void disableDebugger(AID debuggerName, AID notToBeDebugged)
           
 void disableSniffer(AID snifferName, AID notToBeSniffed)
           
 void dispatch(ACLMessage msg, AID receiverID)
           
 void enableDebugger(AID debuggerName, AID toBeDebugged)
           
 void enableSniffer(AID snifferName, AID toBeSniffed)
           
 void exit()
           
 byte[] fetchClassFile(java.lang.String name)
           
 AgentController getAgent(AID agentID)
          Get the agentcontroller for a local agent given its AID.
 jade.security.AgentPrincipal getAgentPrincipal(AID agentID)
           
 AID getAMS()
           
 jade.security.Authority getAuthority()
           
 AID getDefaultDF()
           
 java.lang.String getProperty(java.lang.String key, java.lang.String aDefault)
           
 void handleBehaviourAdded(AID agentID, Behaviour b)
           
 void handleBehaviourRemoved(AID agentID, Behaviour b)
           
 void handleChangeBehaviourState(AID agentID, Behaviour b, java.lang.String from, java.lang.String to)
           
 void handleChangedAgentPrincipal(AID agentID, jade.security.AgentPrincipal oldPrincipal, jade.security.CertificateFolder certs)
           
 void handleChangedAgentState(AID agentID, AgentState from, AgentState to)
           
 void handleClone(AID agentID, Location where, java.lang.String newName)
           
 void handleEnd(AID agentID)
           
 void handleMove(AID agentID, Location where)
           
 void handlePosted(AID agentID, ACLMessage msg)
           
 void handleReceived(AID agentID, ACLMessage msg)
           
 void handleSend(ACLMessage msg, AID sender)
           
 void handleStart(java.lang.String localName, Agent instance)
           
 Location here()
           
 void initAgent(AID agentID, Agent instance, boolean startIt)
           
 void installACLCodec(java.lang.String className)
           
 jade.mtp.MTPDescriptor installMTP(java.lang.String address, java.lang.String className)
           
 void killAgent(AID agentID)
           
 void moveAgent(AID agentID, Location where)
           
 void ping(boolean hang)
           
 void postTransferResult(AID agentID, boolean result, List messages)
           
 void removePlatformListener(AgentManager.Listener l)
           
 void resumeAgent(AID agentID)
           
 void routeOut(ACLMessage msg, AID receiver, java.lang.String address)
           
 void setPlatformAddresses(AID id)
           
 void shutDown()
           
 void suspendAgent(AID agentID)
           
 void uninstallMTP(java.lang.String address)
           
 void updateRoutingTable(int op, jade.mtp.MTPDescriptor mtp, AgentContainer ac)
           
 void waitAgent(AID agentID)
           
 void wakeAgent(AID agentID)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getAgent

public AgentController getAgent(AID agentID)
Get the agentcontroller for a local agent given its AID.
Parameters:
agentID - The agentID of the desired agent.
Since:
JADE2.6
See Also:
PlatformController.getAgent(String)

createAgent

public void createAgent(AID agentID,
                        java.lang.String className,
                        java.lang.Object[] args,
                        java.lang.String ownership,
                        jade.security.CertificateFolder certs,
                        boolean startIt)
                 throws IMTPException
Specified by:
createAgent in interface AgentContainer

createAgent

public void createAgent(AID agentID,
                        byte[] serializedInstance,
                        AgentContainer classSite,
                        boolean startIt)
                 throws IMTPException,
                        jade.security.AuthException
Specified by:
createAgent in interface AgentContainer

fetchClassFile

public byte[] fetchClassFile(java.lang.String name)
                      throws IMTPException,
                             java.lang.ClassNotFoundException
Specified by:
fetchClassFile in interface AgentContainer

initAgent

public void initAgent(AID agentID,
                      Agent instance,
                      boolean startIt)
               throws NameClashException,
                      IMTPException,
                      NotFoundException,
                      jade.security.AuthException

suspendAgent

public void suspendAgent(AID agentID)
                  throws IMTPException,
                         NotFoundException
Specified by:
suspendAgent in interface AgentContainer

resumeAgent

public void resumeAgent(AID agentID)
                 throws IMTPException,
                        NotFoundException
Specified by:
resumeAgent in interface AgentContainer

changeAgentPrincipal

public void changeAgentPrincipal(AID agentID,
                                 jade.security.CertificateFolder certs)
                          throws IMTPException,
                                 NotFoundException
Specified by:
changeAgentPrincipal in interface AgentContainer

changedAgentPrincipal

public void changedAgentPrincipal(AID agentID,
                                  jade.security.AgentPrincipal principal)
                           throws IMTPException
Specified by:
changedAgentPrincipal in interface AgentContainer

changeContainerPrincipal

public void changeContainerPrincipal(jade.security.CertificateFolder certs)
                              throws IMTPException
Specified by:
changeContainerPrincipal in interface AgentContainer

getAgentPrincipal

public jade.security.AgentPrincipal getAgentPrincipal(AID agentID)

waitAgent

public void waitAgent(AID agentID)
               throws IMTPException,
                      NotFoundException
Specified by:
waitAgent in interface AgentContainer

wakeAgent

public void wakeAgent(AID agentID)
               throws IMTPException,
                      NotFoundException
Specified by:
wakeAgent in interface AgentContainer

moveAgent

public void moveAgent(AID agentID,
                      Location where)
               throws IMTPException,
                      NotFoundException
Specified by:
moveAgent in interface AgentContainer

copyAgent

public void copyAgent(AID agentID,
                      Location where,
                      java.lang.String newName)
               throws IMTPException,
                      NotFoundException
Specified by:
copyAgent in interface AgentContainer

killAgent

public void killAgent(AID agentID)
               throws IMTPException,
                      NotFoundException
Specified by:
killAgent in interface AgentContainer

exit

public void exit()
          throws IMTPException
Specified by:
exit in interface AgentContainer

postTransferResult

public void postTransferResult(AID agentID,
                               boolean result,
                               List messages)
                        throws IMTPException,
                               NotFoundException
Specified by:
postTransferResult in interface AgentContainer

enableSniffer

public void enableSniffer(AID snifferName,
                          AID toBeSniffed)
                   throws IMTPException
Specified by:
enableSniffer in interface AgentContainer
Parameters:
snifferName - The Agent ID of the sniffer to send messages to.
toBeSniffed - The AID of the agent to be sniffed

disableSniffer

public void disableSniffer(AID snifferName,
                           AID notToBeSniffed)
                    throws IMTPException
Specified by:
disableSniffer in interface AgentContainer
Parameters:
snifferName - The Agent ID of the sniffer to send messages to.
notToBeSniffed - The AID of the agent to stop sniffing

enableDebugger

public void enableDebugger(AID debuggerName,
                           AID toBeDebugged)
                    throws IMTPException
Specified by:
enableDebugger in interface AgentContainer
Parameters:
debuggerName - The Agent ID of the debugger to send messages to.
toBeDebugged - The AID of the agent to start debugging.

disableDebugger

public void disableDebugger(AID debuggerName,
                            AID notToBeDebugged)
                     throws IMTPException
Specified by:
disableDebugger in interface AgentContainer
Parameters:
debuggerName - The Agent ID of the debugger to send messages to.
notToBeDebugged - The AID of the agent to stop debugging.

dispatch

public void dispatch(ACLMessage msg,
                     AID receiverID)
              throws IMTPException,
                     NotFoundException
Specified by:
dispatch in interface AgentContainer

ping

public void ping(boolean hang)
          throws IMTPException
Specified by:
ping in interface AgentContainer

installACLCodec

public void installACLCodec(java.lang.String className)
                     throws ACLCodec.CodecException

installMTP

public jade.mtp.MTPDescriptor installMTP(java.lang.String address,
                                         java.lang.String className)
                                  throws IMTPException,
                                         jade.mtp.MTPException
Specified by:
installMTP in interface AgentContainer

uninstallMTP

public void uninstallMTP(java.lang.String address)
                  throws IMTPException,
                         NotFoundException,
                         jade.mtp.MTPException
Specified by:
uninstallMTP in interface AgentContainer

updateRoutingTable

public void updateRoutingTable(int op,
                               jade.mtp.MTPDescriptor mtp,
                               AgentContainer ac)
                        throws IMTPException
Specified by:
updateRoutingTable in interface AgentContainer

routeOut

public void routeOut(ACLMessage msg,
                     AID receiver,
                     java.lang.String address)
              throws IMTPException,
                     jade.mtp.MTPException
Specified by:
routeOut in interface AgentContainer

getAuthority

public jade.security.Authority getAuthority()
Specified by:
getAuthority in interface jade.core.AgentToolkit

shutDown

public void shutDown()

here

public Location here()
Specified by:
here in interface jade.core.AgentToolkit

handleSend

public void handleSend(ACLMessage msg,
                       AID sender)
                throws jade.security.AuthException
Specified by:
handleSend in interface jade.core.AgentToolkit

handlePosted

public void handlePosted(AID agentID,
                         ACLMessage msg)
                  throws jade.security.AuthException
Specified by:
handlePosted in interface jade.core.AgentToolkit

handleReceived

public void handleReceived(AID agentID,
                           ACLMessage msg)
                    throws jade.security.AuthException
Specified by:
handleReceived in interface jade.core.AgentToolkit

handleBehaviourAdded

public void handleBehaviourAdded(AID agentID,
                                 Behaviour b)
Specified by:
handleBehaviourAdded in interface jade.core.AgentToolkit

handleBehaviourRemoved

public void handleBehaviourRemoved(AID agentID,
                                   Behaviour b)
Specified by:
handleBehaviourRemoved in interface jade.core.AgentToolkit

handleChangeBehaviourState

public void handleChangeBehaviourState(AID agentID,
                                       Behaviour b,
                                       java.lang.String from,
                                       java.lang.String to)
Specified by:
handleChangeBehaviourState in interface jade.core.AgentToolkit

handleChangedAgentPrincipal

public void handleChangedAgentPrincipal(AID agentID,
                                        jade.security.AgentPrincipal oldPrincipal,
                                        jade.security.CertificateFolder certs)
Specified by:
handleChangedAgentPrincipal in interface jade.core.AgentToolkit

handleChangedAgentState

public void handleChangedAgentState(AID agentID,
                                    AgentState from,
                                    AgentState to)
Specified by:
handleChangedAgentState in interface jade.core.AgentToolkit

handleStart

public void handleStart(java.lang.String localName,
                        Agent instance)
Specified by:
handleStart in interface jade.core.AgentToolkit

handleEnd

public void handleEnd(AID agentID)
Specified by:
handleEnd in interface jade.core.AgentToolkit

handleMove

public void handleMove(AID agentID,
                       Location where)
                throws jade.security.AuthException,
                       NotFoundException,
                       IMTPException
Specified by:
handleMove in interface jade.core.AgentToolkit

handleClone

public void handleClone(AID agentID,
                        Location where,
                        java.lang.String newName)
                 throws jade.security.AuthException
Specified by:
handleClone in interface jade.core.AgentToolkit

setPlatformAddresses

public void setPlatformAddresses(AID id)
Specified by:
setPlatformAddresses in interface jade.core.AgentToolkit

getAMS

public AID getAMS()
Specified by:
getAMS in interface jade.core.AgentToolkit

getDefaultDF

public AID getDefaultDF()
Specified by:
getDefaultDF in interface jade.core.AgentToolkit

getProperty

public java.lang.String getProperty(java.lang.String key,
                                    java.lang.String aDefault)
Specified by:
getProperty in interface jade.core.AgentToolkit

addPlatformListener

public void addPlatformListener(AgentManager.Listener l)
                         throws java.lang.ClassCastException

removePlatformListener

public void removePlatformListener(AgentManager.Listener l)
                            throws java.lang.ClassCastException