There are many pieces of the pizza party application which you could re-use in your own applications – as is, or with slight modifications.
The HistoryServlet (org.cougaar.pizza.servlet.HistoryServlet, javadoc here) is a generic servlet that can be added to other applications as is. If you want the “Comment” column for your custom objects to be richer, you can use the HistoryServletFriendly (here) interface to mark your objects to display better. See its Javadoc for usage.
The Service Discovery plugins in the pizza party app are all minor extensions of simple plugins that you can use as is in your application. Most applications using service discovery will be able to use these as is. For details on these plugins, see the org.cougaar.pizza.plugin Javadoc. In general, you will be able to use these plugins most readily when:
- You have Community-based Yellow Pages (that is, you are using communities, some of which are of CommunityType “YPCommunity” and name a “YPServerAgent”. See the “MA” agent and its components for detais on building a YPServerAgent.
- You are looking up providers in the yellow pages by the name of the Role they provide. If you want to do more complex lookups, you will need something more complex than the org.cougaar.pizza.plugin.util.RoleWithBlacklistScorer.
- Providers are constant: once they agree to provide a service, they are always willing to provide that service. They mail still fail individual Tasks, but will not revoke the relationship altogether.
- For other restrictions, see the Javadoc for the individual plugins.
The InvitePlugin and RSVPPlugin show how to use a Relay to send a query to a set of agents. They also show how to use a Community to define an AttributeBasedAddress, and use that as the target of a message.
The PizzaPreferenceServlet shows how to use a Blackboard Query in a servlet to get a snapshot of the Blackboard state.
The PlaceOrderPlugin shows how to use the PlanningFactory and the PluginHelper to create Tasks and put Preferences on them, and manage the AllocationResults that flow back.
For an example on how to define new Asset types, define new PropertyGroups, and use them, the Kitchen and Pizza assets provide nice (documented) examples. See the asset package javadoc and KitchenPrototypePlugin and PizzaPrototypePlugin.