---
title: "booktrading / manager"
author: "turingfellow"
date: "2011-03-29T23:18:44Z"
tags: []
categories: ["企业架构"]
slug: "booktrading-manager"
draft: false
lastmod: "2011-03-29T23:18:44Z"
id: 979646
url: "https://turingfellow.iteye.com/blog/979646"
---

&lt;html&gt;&lt;head&gt;&lt;title&gt;

jadex.examples.booktrading.manager

&lt;/title&gt;&lt;/head&gt;&lt;body&gt;  
   
This package contains the manager agent used to start the booktrading scenario.

&lt;/body&gt;&lt;/html&gt;  
&lt;!--  
 &lt;H3&gt;The manager agent for starting the application.&lt;/H3&gt;

 Can be used to start the booktrading example with different  
 initial configurations of buyer and seller agents.

--&gt;  
&lt;agent xmlns="[http://jadex.sourceforge.net/jadex](http://jadex.sourceforge.net/jadex)"  
    xmlns:xsi="[http://www.w3.org/2001/XMLSchema-instance](http://www.w3.org/2001/XMLSchema-instance)"  
    xsi:schemaLocation="[http://jadex.sourceforge.net/jadex](http://jadex.sourceforge.net/jadex)  
                     [http://jadex.sourceforge.net/jadex-0.96.xsd](http://jadex.sourceforge.net/jadex-0.96.xsd)"  
    name="Manager"  
    package="jadex.examples.booktrading.manager"&gt;

 &lt;imports&gt;  
  &lt;import&gt;jadex.\*&lt;/import&gt;  
  &lt;import&gt;jadex.planlib.\*&lt;/import&gt;  
  &lt;import&gt;java.util.\*&lt;/import&gt;  
  &lt;import&gt;jadex.examples.booktrading.common.\*&lt;/import&gt;  
 &lt;/imports&gt;

 &lt;capabilities&gt;  
  &lt;capability name="startcap" file="StartAgents"/&gt;  
  &lt;capability name="amscap" file="jadex.planlib.AMS"/&gt;  
 &lt;/capabilities&gt;

 &lt;goals&gt;  
  &lt;achievegoalref name="start\_agents"&gt;  
   &lt;concrete ref="startcap.start\_agents"/&gt;  
   &lt;deliberation&gt;  
    &lt;!-- Wait for all agents being started before destroying the manager. --&gt;  
    &lt;inhibits ref="ams\_destroy\_agent"/&gt;  
   &lt;/deliberation&gt;  
  &lt;/achievegoalref&gt;  
  &lt;!-- Goal used to kill manager after startup. --&gt;  
  &lt;achievegoalref name="ams\_destroy\_agent"&gt;  
   &lt;concrete ref="amscap.ams\_destroy\_agent"/&gt;  
  &lt;/achievegoalref&gt;  
 &lt;/goals&gt;

 &lt;properties&gt;  
&lt;!--  &lt;property name="debugging"&gt;true&lt;/property&gt;--&gt;  
 &lt;/properties&gt;

 &lt;configurations&gt;  
  &lt;configuration name="One buyer / one seller"&gt;  
   &lt;goals&gt;  
    &lt;initialgoal ref="start\_agents"&gt;  
     &lt;parameterset ref="agentinfos"&gt;  
      &lt;value&gt;  
       new StartAgentInfo("jadex.examples.booktrading.buyer.Buyer", "Alex", 0, new String\[]{"initial\_orders"},  
       new Object\[]{new Order\[]  
       {  
        new Order("All about agents", new Date(System.currentTimeMillis()+60000), 100, 120, true),  
        new Order("All about web services", new Date(System.currentTimeMillis()+60000), 40, 60, true),  
        new Order("Harry Potter", new Date(System.currentTimeMillis()+60000), 5, 10, true),  
        new Order("Agents in the real world", new Date(System.currentTimeMillis()+60000), 30, 65, true)  
       }})  
      &lt;/value&gt;  
      &lt;value&gt;  
       new StartAgentInfo("jadex.examples.booktrading.seller.Seller", "Lars", 0, new String\[]{"initial\_orders"},  
       new Object\[]{new Order\[]  
       {  
        new Order("All about agents", new Date(System.currentTimeMillis()+60000), 130, 110, false),  
        new Order("All about web services", new Date(System.currentTimeMillis()+60000), 50, 30, false),  
        new Order("Harry Potter", new Date(System.currentTimeMillis()+60000), 15, 9, false),  
        new Order("Agents in the real world", new Date(System.currentTimeMillis()+60000), 100, 60, false)  
       }})  
      &lt;/value&gt;  
     &lt;/parameterset&gt;  
    &lt;/initialgoal&gt;  
    &lt;initialgoal ref="ams\_destroy\_agent"&gt;  
     &lt;parameter ref="agentidentifier"&gt;  
      &lt;value&gt;$agent.getAgentIdentifier()&lt;/value&gt;  
     &lt;/parameter&gt;  
    &lt;/initialgoal&gt;  
   &lt;/goals&gt;  
  &lt;/configuration&gt;  
  &lt;configuration name="One buyer / two sellers"&gt;  
   &lt;goals&gt;  
    &lt;initialgoal ref="start\_agents"&gt;  
     &lt;parameterset ref="agentinfos"&gt;  
      &lt;value&gt;  
       new StartAgentInfo("jadex.examples.booktrading.buyer.Buyer", "Alex", 0, new String\[]{"initial\_orders"},  
       new Object\[]{new Order\[]  
       {  
        new Order("All about agents", new Date(System.currentTimeMillis()+60000), 100, 120, true),  
        new Order("All about web services", new Date(System.currentTimeMillis()+60000), 40, 60, true),  
        new Order("Harry Potter", new Date(System.currentTimeMillis()+60000), 5, 10, true),  
        new Order("Agents in the real world", new Date(System.currentTimeMillis()+60000), 30, 65, true)  
       }})  
      &lt;/value&gt;  
      &lt;value&gt;  
       new StartAgentInfo("jadex.examples.booktrading.seller.Seller", "Lars", 0, new String\[]{"initial\_orders"},  
       new Object\[]{new Order\[]  
       {  
        new Order("All about agents", new Date(System.currentTimeMillis()+60000), 130, 110, false),  
        new Order("All about web services", new Date(System.currentTimeMillis()+60000), 50, 30, false),  
        new Order("Harry Potter", new Date(System.currentTimeMillis()+60000), 12, 6, false),  
        new Order("Agents in the real world", new Date(System.currentTimeMillis()+60000), 100, 60, false)  
       }})  
      &lt;/value&gt;  
      &lt;value&gt;  
       new StartAgentInfo("jadex.examples.booktrading.seller.Seller", "Dirk", 0, new String\[]{"initial\_orders"},  
       new Object\[]{new Order\[]  
       {  
        new Order("All about agents", new Date(System.currentTimeMillis()+60000), 120, 100, false),  
        new Order("All about web services", new Date(System.currentTimeMillis()+60000), 40, 20, false),  
        new Order("Harry Potter", new Date(System.currentTimeMillis()+60000), 16, 12, false),  
        new Order("Agents in the real world", new Date(System.currentTimeMillis()+60000), 100, 60, false)  
       }})  
      &lt;/value&gt;  
     &lt;/parameterset&gt;  
    &lt;/initialgoal&gt;  
    &lt;initialgoal ref="ams\_destroy\_agent"&gt;  
     &lt;parameter ref="agentidentifier"&gt;  
      &lt;value&gt;$agent.getAgentIdentifier()&lt;/value&gt;  
     &lt;/parameter&gt;  
    &lt;/initialgoal&gt;  
   &lt;/goals&gt;  
  &lt;/configuration&gt;  
 &lt;/configurations&gt;

&lt;/agent&gt;