Class df
- java.lang.Object
-
- jade.core.Agent
-
- jade.gui.GuiAgent
-
- jade.domain.df
-
- All Implemented Interfaces:
TimerListener,DFGUIAdapter,Serializable,Serializable,Runnable
public class df extends GuiAgent implements DFGUIAdapter
Standard Directory Facilitator agent. This class implements FIPA DF agent. JADE applications typically don't use this class directly, but interact with the DF agent through ACL message passing. The
DFServiceclass provides a number of static methods that facilitate this task. More DF agents can be created by application programmers to divide a platform into many Agent Domains.A DF agent accepts a number of optional configuration parameters that can be set either as command line options or within a properties file (to be passed to the DF as an argument).
Parameter Description jade_domain_df_autocleanupIf set to true, indicates that the DF will automatically clean up registrations as soon as an agent terminates. The default isfalsejade_domain_df_maxleasetimeIndicates the maximum lease time (in millisecond) that the DF will grant for agent description registrations (defaults to infinite). jade_domain_df_maxresultIndicates the maximum number of items found in a search operation that the DF will return to the requester (defaults to 100). jade_domain_df_disablevalidationTurns off content validation on incoming/outgoing messages (defaults to false) jade_domain_df_db-defaultIf set to true, indicates that the DF will store its catalogue into an internal HSQL database, running within the same VM. (The HSQL jar files have to added to the Java CLASSPATH)jade_domain_df_db-urlIndicates the JDBC URL of the database the DF will store its catalogue into. This parameter is ignored if jade_domain_df_db-defaultis set. If neither this parameter norjade_domain_df_db-defaultis specified the DF will keep its catalogue in memory.jade_domain_df_db-driverIndicates the JDBC driver to be used to access the DF database (defaults to the ODBC-JDBC bridge). This parameter is ignored if jade_domain_df_db-urlis not set orjade_domain_df_db-defaultis set.jade_domain_df_db-username,jade_domain_df_db-passwordIndicate the username and password to be used to access the DF database (default to null). These parameters are ignored if jade_domain_df_db-urlis not set orjade_domain_df_db-defaultis set.jade_domain_df_db-cleantablesIf set to true, indicates that the DF will clean the content of all pre-existing database tables, used by the DF. This parameter is ignored if the catalogue is not stored in a database.jade_domain_df_db-abortonerrorIf set to true, indicates that the DF will immediately terminate in case it cannot connect to the database. This parameter is ignored if the catalogue is not stored in a database.jade_domain_df_kb-factoryIndicates the name of the factory class that should be used to create the knowledge base objects for the DF. The class has to be a sub class of jade.domain.DFKBFactory. jade_domain_df_poolsizeThe dimension of the pool of thread dedicated to serving registration, deregistration and search requests. If 0(default) is specified then registration, deregistration and search requests are served directly by the df agent Thread. This parameter is ignored when using a volatile (in-memory) knowledge base.For instance the following command line will launch a JADE main container with a DF that will store its catalogue into a database accessible at URL jdbc:odbc:dfdb and that will keep agent registrations for 1 hour at most.
java jade.Boot -gui -jade_domain_df_db-url jdbc:odbc:dfdb -jade_domain_df_maxleasetime 3600000Each DF has a GUI but, by default, it is not visible. The GUI of the agent platform includes a menu item that allows to show the GUI of the default DF. In order to show the GUI, you should simply send the following message to each DF agent:
(request :content (action DFName (SHOWGUI)) :ontology JADE-Agent-Management :protocol fipa-request)- Version:
- $Date$ $Revision$
- Author:
- Giovanni Rimassa - Universita' di Parma, Tiziana Trucco - TILAB S.p.A., Elisabetta Cortese - TILAB S.p.A., Giovanni Caire - TILAB, Roland Mungenast - Profactor
- See Also:
DFService, Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jade.core.Agent
Agent.Interrupted
-
-
Field Summary
-
Fields inherited from class jade.core.Agent
AP_ACTIVE, AP_DELETED, AP_IDLE, AP_INITIATED, AP_MAX, AP_MIN, AP_SUSPENDED, AP_WAITING, D_ACTIVE, D_MAX, D_MIN, D_RETIRED, D_SUSPENDED, D_UNKNOWN, MSG_QUEUE_CLASS
-
Fields inherited from interface jade.domain.DFGUIAdapter
CLOSEGUI, DEREGISTER, EXIT, FEDERATE, MODIFY, REFRESHAPPLET, REGISTER, SEARCH
-
-
Constructor Summary
Constructors Constructor Description df()Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidactivateAutoCleanup()protected voidaddParent(AID dfName, DFAgentDescription dfd)This method can be used to add a parent (a DF this DF is federated with).protected voidderegisterAction(Deregister d, AID requester)Serve the Deregister action of the FIPA management ontology.protected voidDFDeregister(DFAgentDescription dfd)protected KBIteratorDFIteratedSearch(DFAgentDescription dfd)protected voidDFModify(DFAgentDescription dfd)protected voidDFRegister(DFAgentDescription dfd)protected ListDFSearch(DFAgentDescription dfd, int maxResults)DFAgentDescriptiongetDescriptionOfThisDF()This method returns the current description of this DFDFAgentDescriptiongetDescriptionOfThisDF(AID parent)This method returns the description of this df used to federate with the given parentDFAgentDescriptiongetDFAgentDsc(AID name)This method returns the description of an agent registered with the DF.protected KBIteratoriteratedSearchAction(Search s, AID requester)Serve a Search action of the FIPA management ontology requested using an iterated-fipa-request protocol.protected voidmodifyAction(Modify m, AID requester)Serve the Modify action of the FIPA management ontology.protected voidonGuiEvent(GuiEvent ev)Abstract method to handle posted GUI events.protected voidregisterAction(Register r, AID requester)Serve the Register action of the FIPA management ontology.protected voidremoveParent(AID dfName)this method can be used to remove a parent (a DF with which this DF is federated).protected ListsearchAction(Search s, AID requester)Serve the Search action of the FIPA management ontology.protected voidsetDescriptionOfThisDF(DFAgentDescription dfd)This method set the description of the df according to the DFAgentDescription passed.protected voidsetup()This method starts all behaviours needed by DF agent to perform its role within JADE agent platform.protected booleanshowGui()This method make visible the GUI of the DF.protected voidtakeDown()Cleanup DF on exit.protected voidunsubscribeAgent(AID id)-
Methods inherited from class jade.gui.GuiAgent
postGuiEvent
-
Methods inherited from class jade.core.Agent
addBehaviour, afterClone, afterMove, beforeClone, beforeMove, blockingReceive, blockingReceive, blockingReceive, blockingReceive, changeStateTo, clean, createMessageQueue, doActivate, doClone, doDelete, doMove, doSuspend, doTimeOut, doWait, doWait, doWake, getAgentState, getAID, getAID, getAMS, getArguments, getBehavioursCnt, getBootProperties, getContainerController, getContentManager, getCurQueueSize, getDefaultDF, getExecutedBehavioursCnt, getGenerateBehaviourEvents, getGenerateMessageEvents, getHap, getHelper, getLocalName, getName, getO2AInterface, getO2AObject, getPostedMessagesCnt, getProperty, getQueueSize, getReceivedMessagesCnt, getSentMessagesCnt, getState, here, isAlive, isRestarting, join, notifyChangeBehaviourState, notifyRestarted, postMessage, putBack, putO2AObject, receive, receive, receive, registerO2AInterface, removeBehaviour, removeTimer, restartLater, restoreBufferedState, restoreFields, run, send, setArguments, setEnabledO2ACommunication, setGenerateBehaviourEvents, setGenerateMessageEvents, setO2AManager, setQueueSize, waitUntilStarted, write
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jade.domain.DFGUIAdapter
postGuiEvent
-
-
-
-
Constructor Detail
-
df
public df()
Default constructor. This constructor does nothing; however, applications can create their own DF agents using regular platform management commands. Moreover, customized versions of a Directory Facilitator agent can be built subclassing this class and exploiting its protected interface.
-
-
Method Detail
-
setup
protected void setup()
This method starts all behaviours needed by DF agent to perform its role within JADE agent platform.- Overrides:
setupin classAgent- See Also:
Agent.addBehaviour(Behaviour b),Behaviour
-
activateAutoCleanup
protected void activateAutoCleanup()
-
unsubscribeAgent
protected void unsubscribeAgent(AID id)
-
takeDown
protected void takeDown()
Cleanup DF on exit. This method performs all necessary cleanup operations during agent shutdown.
-
DFRegister
protected void DFRegister(DFAgentDescription dfd) throws AlreadyRegistered
- Throws:
AlreadyRegistered
-
DFDeregister
protected void DFDeregister(DFAgentDescription dfd) throws NotRegistered
- Throws:
NotRegistered
-
DFModify
protected void DFModify(DFAgentDescription dfd) throws NotRegistered
- Throws:
NotRegistered
-
DFSearch
protected List DFSearch(DFAgentDescription dfd, int maxResults)
-
DFIteratedSearch
protected KBIterator DFIteratedSearch(DFAgentDescription dfd)
-
registerAction
protected void registerAction(Register r, AID requester) throws FIPAException
Serve the Register action of the FIPA management ontology.- Throws:
FIPAException
-
deregisterAction
protected void deregisterAction(Deregister d, AID requester) throws FIPAException
Serve the Deregister action of the FIPA management ontology.- Throws:
FIPAException
-
modifyAction
protected void modifyAction(Modify m, AID requester) throws FIPAException
Serve the Modify action of the FIPA management ontology.- Throws:
FIPAException
-
searchAction
protected List searchAction(Search s, AID requester) throws FIPAException
Serve the Search action of the FIPA management ontology.- Returns:
- the List of descriptions matching the template specified in the Search action. If no description is found an empty List is returned. In case a recursive search is required it returns null to indicate that the result is not yet available.
- Throws:
FIPAException
-
iteratedSearchAction
protected KBIterator iteratedSearchAction(Search s, AID requester) throws FIPAException
Serve a Search action of the FIPA management ontology requested using an iterated-fipa-request protocol.- Returns:
- an iterator over the DFAgentDescription matching the specified search template.
- Throws:
FIPAException
-
onGuiEvent
protected void onGuiEvent(GuiEvent ev)
Description copied from class:GuiAgentAbstract method to handle posted GUI events. Subclasses ofGuiAgentwill implement their own reactions to GUI events starting with this method.- Specified by:
onGuiEventin classGuiAgent- Parameters:
ev- The GUI event to handle.
-
getDFAgentDsc
public DFAgentDescription getDFAgentDsc(AID name) throws FIPAException
This method returns the description of an agent registered with the DF.- Specified by:
getDFAgentDscin interfaceDFGUIAdapter- Throws:
FIPAException
-
getDescriptionOfThisDF
public DFAgentDescription getDescriptionOfThisDF()
This method returns the current description of this DF- Specified by:
getDescriptionOfThisDFin interfaceDFGUIAdapter
-
getDescriptionOfThisDF
public DFAgentDescription getDescriptionOfThisDF(AID parent)
This method returns the description of this df used to federate with the given parent- Specified by:
getDescriptionOfThisDFin interfaceDFGUIAdapter
-
showGui
protected boolean showGui()
This method make visible the GUI of the DF.- Returns:
- true if the GUI was not visible already, false otherwise.
-
setDescriptionOfThisDF
protected void setDescriptionOfThisDF(DFAgentDescription dfd)
This method set the description of the df according to the DFAgentDescription passed. The programmers can call this method to provide a different initialization of the description of the df they are implementing. The method is called inside the setup of the agent and set the df description using a default description.
-
addParent
protected void addParent(AID dfName, DFAgentDescription dfd)
This method can be used to add a parent (a DF this DF is federated with).- Parameters:
dfName- the parent df (the df with which this df has been registered)dfd- the description used by this df to register with the parent.
-
removeParent
protected void removeParent(AID dfName)
this method can be used to remove a parent (a DF with which this DF is federated).
-
-