250 likes | 429 Views
Pizza Party Application. Sample and Regression Test An Overview. The Pizza Party. This application (COUGAAR_INSTALL_PATH/pizza) is a good introduction to Cougaar features, and helps ensure all features are working in new releases.
E N D
Pizza Party Application Sample and Regression Test An Overview
The Pizza Party • This application (COUGAAR_INSTALL_PATH/pizza) is a good introduction to Cougaar features, and helps ensure all features are working in new releases. • It shows Plugins, Tasks and Allocations, Assets, Property Groups, Relays, Communities, ABAs, Yellow Pages, Service Discovery, Servlets, Alarms, …
The Story • Alice is throwing a pizza party • She invites the friends on her FriendsOfMark buddy list • They are Carnivores or Vegetarians, and tell her the kind of pizza they want • After waiting for RSVPs, she wants to order the pizza • She then does Service Discovery, to look in the Yellow Pages for PizzaProviders • In the non-SD version, she has a single relationship with Joes • She finds a provider (Joes), and sends a 2-party order • Meat and Veggie • Joes does not sell Veggie pizza, so that part of the order fails • In the non-SD version, Alice has failed – her friends will not be happy! • Alice wants to order from just one place, so rescinds the order • She goes back to the Yellow Pages, specifying she doesn’t want Joes • Having looked in Cambridge, she expands her search to the overall MA Yellow Pages, and finds Dominos. • Alice re-sends her order to Dominos • Dominos is happy to sell her the pizza • The party is on!
SDPizzaNode1 SDPizzaNode2 MA Cambridge Alice Joe’s Dominos Tony Mark Bob Nodes and Agents There is one “society.xml” file per Node. See pizza/configs/pizzaparty for SDPizzaNode1 and SDPizzaNode2.xml
Cambridge Alice Joe’s Dominos Tony Mark Bob Pizza Communities MA YP Community Defined in communities.xml YP Server, Comm Manager MA Cambridge YP Community Pizza Provider YP Server, Comm Manager Comm Manager, Pizza Client Friends of Mark Community Pizza Provider
Other Configuration Data • The 2 Node’s list a bunch of VM parameters (-D arguments) • Where the White Pages will run • COUGAAR_INSTALL_PATH • Log Service Config file • LDMDomains.ini lists Domains • We user Pizza and ServiceDiscovery
MA Cambridge Alice Joe’s Dominos Tony Mark Bob Community Initialization CommunityPlugin does the work Comm Join (whole community) Comm Join Comm Join Comm Join Comm Join
MA Cambridge Joe’s Dominos Service Discovery Initialization Publish Taxonomy Register as PizzaProvider Publish Taxonomy Register as PizzaProvider See the SDRegistrationPlugin and PublishTaxonomy plugins (Additionally, each Agent’s AssetDataParamPlugin creates a local self Entity Asset)
Alice Joe’s Dominos Tony Mark Bob Entity Asset Creation AssetDataParamPlugin creates a local self Entity Asset, representing the local Person or Store. It is used for Relationships (like PizzaProvider), and tells people the kind of pizza they like (Meat or Veggie). Store - Dominos Store - Joes Person – Alice Vegetarian Person – Tony Carnivore Person – Mark Vegetarian Person – Bob Carnivore
Alice Joe’s Dominos Prototype Registration Register the Store’s Kitchen, with a PropertyGroup indicating the kind of Pizza they make KitchenPrototypePI KitchenPrototypePI PizzaPrototypePI Register a prototype Pizza Asset, for use as the DirectObject on the Order Task
MA Cambridge Alice Joe’s Dominos Tony Mark Bob Step 1: Invite to Party Publish Invitation Relay with ABA target “FriendsOfMark” Invitation InvitePI Alice gets own invite ABA Expanded, Relay sent to all Targets
MA Cambridge Alice Joe’s Dominos Tony Mark Bob Step 2: Find Food Preference RSVP Plugin checks self Entity’s PGs and puts Response on Relay of Meat or Veggie Preference Self: Meat or Veggie PG? RSVPPI Invitation Invitation Invitation Invitation
MA Cambridge Alice Joe’s Dominos Tony Mark Bob Step 3: Collect Incoming Replies Relay responses when published are auto sent back to Alice Relay Source auto-updates the collected PizzaPreferences PizzaPreferences: 2 Meat, 2 Veggie Relay Responses Invitation Invitation Invitation
MA Cambridge Alice Joe’s Dominos Tony Mark Bob Step 4: Publish PizzaPreferences Invite Plugin then publishes a PizzaPreferences object, which the PlaceOrderPI subscribes to SDPlaceOrderPI Pizza Preferences: 2 Meat, 2 Veggie InvitePI Invitation Invitation Invitation
MA Cambridge Alice Joe’s Dominos Tony Mark Bob Step 5: Create Orders SDPlaceOrder Plugin publishes a Task: “Order Pizza”, and expands that for each kind of Pizza needed SDPlaceOrderPI Task: Order Pizza Task: Order 2 Meat Task: Order 2 Veggie Invitation Invitation Invitation
Step 6: Ask for Providers Publish FindProviders with Role Pizza Provider. SDClientPlugin passes an MMQuery to the MatchmakerPlugin. Alice SDPlaceOrderPI SDClientPI MatchmakerPI Task: FindProviders: PizzaProvider MMQuery: PizzaProvider
MA CommunityService Cambridge Step 7: Query Yellow Pages Dominos MatchmakerPlugin asks CommunityService for it’s YP Community. Then it issues a YP Query for a registered PizzaProvider. That query will look in the local YP first. If it can’t find a match, it looks in the next higher YP (parent Community). When an answer comes back, it is scored with the RoleWithBlacklistScorer – if it’s the right Role, without being on the Blacklist, we use it. The answer goes back to the SDClientPlugin Joe’s PizzaProvider? Joes MatchmakerPI Alice Cambridge-YPCommunity YP?
Step 8: Establish Relationship The SDClientPlugin sends a ServiceContractRelay to the named Provider. The AgreeableProviderPlugin at Joes just says yes, attaching a Contract. The ServiceContractLP sees the Contract, and fills in a Relationship on the local self Entity on each end of the relationship. The SDClientPlugin, having gotten a Contract, Disposes the FindProviders Task as successfully complete. Joe’s Relationship: Alice/PizzaConsumer AgreeableProviderPI Contract ServiceContractRelay Relationship: Joes/PizzaProvider SDClientPI Alice FindProviders: Success Disposition
Joe’s Relationship: Joes/PizzaProvider Step 9: Allocate Tasks The SDPlaceOrderPlugin, having finished FindProviders, gets the Provider off it’s Relationship Schedule on the self Entity, and Allocates the 2 Order Tasks to that Entity. The infrastructure sees this Allocation to an Entity, and copies the Task at the other Entity – Joes. Alice Task: Order 2 Meat Allocation: Joes Task: Order 2 Veggie Allocation: Joes SDPlaceOrderPI FindProviders: Success Disposition
Alice Step 10:Match Capabilities At Joes, the ProcessOrderPlugin sees 2 new Order Tasks. It Allocates them to the local Kitchen Asset. It looks at the local Kitchen Asset to match the Meat / Veggie toppings requested on the DirectObject of the Order Task. If its Kitchen has matching capabilities, the Task gets a Success Result, otherwise it says it will deliver 0 pizzas, and gives it a Failure Result. The infrastructure copies those results back to Alice (where the Tasks came from). Kitchen - Meat Allocation: PASS Task: Order 2 Meat Allocation: FAIL Task: Order 2 Veggie Joe’s ProcessOrderPI
Step 11: Done? If the Provider (Joes) filled the Orders (he didn’t) Alice would be done. Otherwise, the SDPlaceOrderPlugin rescinds the Allocations (Alice wants to order all pizza from one store), and must issue a new FindProviders Task, asking for a new provider, other than Joes. Now, we repeat steps 6-11. This time, we get Dominos, and the party is on!
What Next? • Have you read the documentation? (Online at http://tutorials.cougaar.org/pizza ) • Read through the javadoc (Online at http://cougaar.cougaar.org/software/latest/javadoc/pizza/doc/api/ ) • Read through the config files (pizza/configs/pizzaparty – see the Readme) • Try modifying the application • Add a friend • Make Joes serve Veggie Pizza