Package jade.domain

Class 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 DFService class 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_autocleanup If set to true, indicates that the DF will automatically clean up registrations as soon as an agent terminates. The default is false
    jade_domain_df_maxleasetime Indicates the maximum lease time (in millisecond) that the DF will grant for agent description registrations (defaults to infinite).
    jade_domain_df_maxresult Indicates the maximum number of items found in a search operation that the DF will return to the requester (defaults to 100).
    jade_domain_df_disablevalidation Turns off content validation on incoming/outgoing messages (defaults to false)
    jade_domain_df_db-default If 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-url Indicates the JDBC URL of the database the DF will store its catalogue into. This parameter is ignored if jade_domain_df_db-default is set. If neither this parameter nor jade_domain_df_db-default is specified the DF will keep its catalogue in memory.
    jade_domain_df_db-driver Indicates 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-url is not set or jade_domain_df_db-default is set.
    jade_domain_df_db-username, jade_domain_df_db-password Indicate the username and password to be used to access the DF database (default to null). These parameters are ignored if jade_domain_df_db-url is not set or jade_domain_df_db-default is set.
    jade_domain_df_db-cleantables If 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-abortonerror If 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-factory Indicates 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_poolsize The 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 3600000

    Each 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
    • 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

      • 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.
        Overrides:
        takeDown in class Agent
      • 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: GuiAgent
        Abstract method to handle posted GUI events. Subclasses of GuiAgent will implement their own reactions to GUI events starting with this method.
        Specified by:
        onGuiEvent in class GuiAgent
        Parameters:
        ev - The GUI event to handle.
      • 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).